emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* latex newcommand in org
@ 2016-05-20 18:10 Doyley, Marvin M.
  0 siblings, 0 replies; 8+ messages in thread
From: Doyley, Marvin M. @ 2016-05-20 18:10 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

Hi there,

In my group, we typically response to reviewers comments (in latex) by first defining the  following command in the header

\newcommand{\response}[1]{\textcolor{red}{#1}}
then marking up the text as follows

\response{red text}

I try to do the same in org,  i.e., putting
 #+latex_header:\newcommand{\response}[1]{\textcolor{red}{#1}}
then \response{BLAH BLAH} in the text. The only snag is that on export I get \response\{BLAH BLAH\}

Any suggestion how to fix this

cheers,
M












[-- Attachment #2: Type: text/html, Size: 2761 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: latex newcommand in org
       [not found] <4623b22355d94329a72b69bd254e036d@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2016-05-20 18:45 ` Eric S Fraga
  2016-05-20 19:50   ` Marcin Borkowski
  0 siblings, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2016-05-20 18:45 UTC (permalink / raw)
  To: Doyley, Marvin M.; +Cc: emacs-orgmode@gnu.org

On Friday, 20 May 2016 at 18:10, Doyley, Marvin M. wrote:
> Hi there,
>
> In my group, we typically response to reviewers comments (in latex) by first defining the  following command in the header
>
> \newcommand{\response}[1]{\textcolor{red}{#1}}
> then marking up the text as follows
>
> \response{red text}
>
> I try to do the same in org,  i.e., putting
>  #+latex_header:\newcommand{\response}[1]{\textcolor{red}{#1}}
> then \response{BLAH BLAH} in the text. The only snag is that on export I get \response\{BLAH BLAH\}

Easiest solution is @@latex:\response{blah blah}@@ but that will lose you
all the org formatting.  Longer solution is to use environments, such as

#+begin_response
blah blah blah
#+end_response

and define a "response" LaTeX environment, along these lines:

#+latex_header: \makeatletter\newenvironment{response}{\textcolor{red}}{}\makeatother

(untested)

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.92.1, Org release_8.3.4-775-g3308a5

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: latex newcommand in org
  2016-05-20 18:45 ` Eric S Fraga
@ 2016-05-20 19:50   ` Marcin Borkowski
  2016-05-20 20:37     ` Doyley, Marvin M.
  2016-05-20 21:00     ` Leslie Watter
  0 siblings, 2 replies; 8+ messages in thread
From: Marcin Borkowski @ 2016-05-20 19:50 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode@gnu.org, Doyley, Marvin M.


On 2016-05-20, at 20:45, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> On Friday, 20 May 2016 at 18:10, Doyley, Marvin M. wrote:
>> Hi there,
>>
>> In my group, we typically response to reviewers comments (in latex) by first defining the  following command in the header
>>
>> \newcommand{\response}[1]{\textcolor{red}{#1}}
>> then marking up the text as follows
>>
>> \response{red text}
>>
>> I try to do the same in org,  i.e., putting
>>  #+latex_header:\newcommand{\response}[1]{\textcolor{red}{#1}}
>> then \response{BLAH BLAH} in the text. The only snag is that on export I get \response\{BLAH BLAH\}
>
> Easiest solution is @@latex:\response{blah blah}@@ but that will lose you
> all the org formatting.  Longer solution is to use environments, such as
>
> #+begin_response
> blah blah blah
> #+end_response
>
> and define a "response" LaTeX environment, along these lines:
>
> #+latex_header: \makeatletter\newenvironment{response}{\textcolor{red}}{}\makeatother
>
> (untested)

Notice also that commands and environments in LaTeX are not
interchangeable; there are things only commands can do and things only
environments can do.  (Well, not really - technically, I guess,
environments are strictly more powerful than commands, though I'm not
100% sure - but some things are quite difficult to do with environments
and trivial with commands.)

See also
http://tex.stackexchange.com/questions/102141/what-are-the-consideration-when-choosing-either-newcommand-or-newenvironment

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: latex newcommand in org
  2016-05-20 19:50   ` Marcin Borkowski
@ 2016-05-20 20:37     ` Doyley, Marvin M.
  2016-05-20 21:00     ` Leslie Watter
  1 sibling, 0 replies; 8+ messages in thread
From: Doyley, Marvin M. @ 2016-05-20 20:37 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2315 bytes --]

Thanks,

I will give Eric’s suggestion a go.

Cheers,
M


On May 20, 2016, at 3:50 PM, Marcin Borkowski <mbork@mbork.pl<mailto:mbork@mbork.pl>> wrote:


On 2016-05-20, at 20:45, Eric S Fraga <e.fraga@ucl.ac.uk<mailto:e.fraga@ucl.ac.uk>> wrote:

On Friday, 20 May 2016 at 18:10, Doyley, Marvin M. wrote:
Hi there,

In my group, we typically response to reviewers comments (in latex) by first defining the  following command in the header

\newcommand{\response}[1]{\textcolor{red}{#1}}
then marking up the text as follows

\response{red text}

I try to do the same in org,  i.e., putting
#+latex_header:\newcommand{\response}[1]{\textcolor{red}{#1}}
then \response{BLAH BLAH} in the text. The only snag is that on export I get \response\{BLAH BLAH\}

Easiest solution is @@latex:\response{blah blah}@@ but that will lose you
all the org formatting.  Longer solution is to use environments, such as

#+begin_response
blah blah blah
#+end_response

and define a "response" LaTeX environment, along these lines:

#+latex_header: \makeatletter\newenvironment{response}{\textcolor{red}}{}\makeatother

(untested)

Notice also that commands and environments in LaTeX are not
interchangeable; there are things only commands can do and things only
environments can do.  (Well, not really - technically, I guess,
environments are strictly more powerful than commands, though I'm not
100% sure - but some things are quite difficult to do with environments
and trivial with commands.)

See also
https://urldefense.proofpoint.com/v2/url?u=http-3A__tex.stackexchange.com_questions_102141_what-2Dare-2Dthe-2Dconsideration-2Dwhen-2Dchoosing-2Deither-2Dnewcommand-2Dor-2Dnewenvironment&d=CwIBAg&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU&m=BXygbrudx0ZbLjXB7_QSNrR5Nwf_kj7fU2GbMseZG9Q&s=u6a29DcYPvJ-0G5l--k-db1OPj9GPF2DO89fbOOfje0&e=

Best,

--
Marcin Borkowski
https://urldefense.proofpoint.com/v2/url?u=http-3A__octd.wmi.amu.edu.pl_en_Marcin-5FBorkowski&d=CwIBAg&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU&m=BXygbrudx0ZbLjXB7_QSNrR5Nwf_kj7fU2GbMseZG9Q&s=msRYXf0n_C3V5ncax1tSsNPVzKQ8OOotiw7ibezCLxU&e=
Faculty of Mathematics and Computer Science
Adam Mickiewicz University


[-- Attachment #2: Type: text/html, Size: 6456 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: latex newcommand in org
  2016-05-20 19:50   ` Marcin Borkowski
  2016-05-20 20:37     ` Doyley, Marvin M.
@ 2016-05-20 21:00     ` Leslie Watter
  2016-05-20 23:45       ` Doyley, Marvin M.
       [not found]       ` <600dd6834d16428ba8a66f9bdd1b0f14@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 2 replies; 8+ messages in thread
From: Leslie Watter @ 2016-05-20 21:00 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: emacs-orgmode@gnu.org, Doyley, Marvin M.

[-- Attachment #1: Type: text/plain, Size: 2179 bytes --]

You can use also macros in combination with latex \newcommand:

Following there's a sample with html:

#+MACRO: color @@html:<span style="color: $1">$2</span>@@
# macro sample: {{{color(red, aceitação)}}}


Note: untested with latex newcommand....1


Cheers,

LEslie



On Fri, May 20, 2016 at 4:50 PM, Marcin Borkowski <mbork@mbork.pl> wrote:

>
> On 2016-05-20, at 20:45, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:
>
> > On Friday, 20 May 2016 at 18:10, Doyley, Marvin M. wrote:
> >> Hi there,
> >>
> >> In my group, we typically response to reviewers comments (in latex) by
> first defining the  following command in the header
> >>
> >> \newcommand{\response}[1]{\textcolor{red}{#1}}
> >> then marking up the text as follows
> >>
> >> \response{red text}
> >>
> >> I try to do the same in org,  i.e., putting
> >>  #+latex_header:\newcommand{\response}[1]{\textcolor{red}{#1}}
> >> then \response{BLAH BLAH} in the text. The only snag is that on export
> I get \response\{BLAH BLAH\}
> >
> > Easiest solution is @@latex:\response{blah blah}@@ but that will lose
> you
> > all the org formatting.  Longer solution is to use environments, such as
> >
> > #+begin_response
> > blah blah blah
> > #+end_response
> >
> > and define a "response" LaTeX environment, along these lines:
> >
> > #+latex_header:
> \makeatletter\newenvironment{response}{\textcolor{red}}{}\makeatother
> >
> > (untested)
>
> Notice also that commands and environments in LaTeX are not
> interchangeable; there are things only commands can do and things only
> environments can do.  (Well, not really - technically, I guess,
> environments are strictly more powerful than commands, though I'm not
> 100% sure - but some things are quite difficult to do with environments
> and trivial with commands.)
>
> See also
>
> http://tex.stackexchange.com/questions/102141/what-are-the-consideration-when-choosing-either-newcommand-or-newenvironment
>
> Best,
>
> --
> Marcin Borkowski
> http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
> Faculty of Mathematics and Computer Science
> Adam Mickiewicz University
>
>


-- 
Leslie H. Watter

[-- Attachment #2: Type: text/html, Size: 3348 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: latex newcommand in org
  2016-05-20 21:00     ` Leslie Watter
@ 2016-05-20 23:45       ` Doyley, Marvin M.
       [not found]       ` <600dd6834d16428ba8a66f9bdd1b0f14@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 0 replies; 8+ messages in thread
From: Doyley, Marvin M. @ 2016-05-20 23:45 UTC (permalink / raw)
  To: leslie@watter.net; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 3101 bytes --]

Eric’s suggestion works like a charm with the following modification
#+latex_header:\newenvironment{response}{\color{red}}{\ignorespacesafterend}

Thanks I really appreciate the help.

Cheers,
M

On May 20, 2016, at 5:00 PM, Leslie Watter <leslie@watter.net<mailto:leslie@watter.net>> wrote:

You can use also macros in combination with latex \newcommand:

Following there's a sample with html:

#+MACRO: color @@html:<span style="color: $1">$2</span>@@
# macro sample: {{{color(red, aceitação)}}}


Note: untested with latex newcommand....1


Cheers,

LEslie



On Fri, May 20, 2016 at 4:50 PM, Marcin Borkowski <mbork@mbork.pl<mailto:mbork@mbork.pl>> wrote:

On 2016-05-20, at 20:45, Eric S Fraga <e.fraga@ucl.ac.uk<mailto:e.fraga@ucl.ac.uk>> wrote:

> On Friday, 20 May 2016 at 18:10, Doyley, Marvin M. wrote:
>> Hi there,
>>
>> In my group, we typically response to reviewers comments (in latex) by first defining the  following command in the header
>>
>> \newcommand{\response}[1]{\textcolor{red}{#1}}
>> then marking up the text as follows
>>
>> \response{red text}
>>
>> I try to do the same in org,  i.e., putting
>>  #+latex_header:\newcommand{\response}[1]{\textcolor{red}{#1}}
>> then \response{BLAH BLAH} in the text. The only snag is that on export I get \response\{BLAH BLAH\}
>
> Easiest solution is @@latex:\response{blah blah}@@ but that will lose you
> all the org formatting.  Longer solution is to use environments, such as
>
> #+begin_response
> blah blah blah
> #+end_response
>
> and define a "response" LaTeX environment, along these lines:
>
> #+latex_header: \makeatletter\newenvironment{response}{\textcolor{red}}{}\makeatother
>
> (untested)

Notice also that commands and environments in LaTeX are not
interchangeable; there are things only commands can do and things only
environments can do.  (Well, not really - technically, I guess,
environments are strictly more powerful than commands, though I'm not
100% sure - but some things are quite difficult to do with environments
and trivial with commands.)

See also
http://tex.stackexchange.com/questions/102141/what-are-the-consideration-when-choosing-either-newcommand-or-newenvironment<https://urldefense.proofpoint.com/v2/url?u=http-3A__tex.stackexchange.com_questions_102141_what-2Dare-2Dthe-2Dconsideration-2Dwhen-2Dchoosing-2Deither-2Dnewcommand-2Dor-2Dnewenvironment&d=CwMFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU&m=VX_uCv1LGJK_oX4her-tCTorTtXocoyqvQv-bAOtWGI&s=E18ceWIZlt89thSTn5MiwO2G6Qdu3XH9Mjo0TR1B37o&e=>

Best,

--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski<https://urldefense.proofpoint.com/v2/url?u=http-3A__octd.wmi.amu.edu.pl_en_Marcin-5FBorkowski&d=CwMFaQ&c=kbmfwr1Yojg42sGEpaQh5ofMHBeTl9EI2eaqQZhHbOU&r=T41F_5QsIVBGYhPPUkgYHUp9iPHgs2rOCjs7rfKaTMU&m=VX_uCv1LGJK_oX4her-tCTorTtXocoyqvQv-bAOtWGI&s=3aRJKRHeKpjvY0YOvttPHrgWOpGqNNgIEP3SH_ZKcUU&e=>
Faculty of Mathematics and Computer Science
Adam Mickiewicz University




--
Leslie H. Watter


[-- Attachment #2: Type: text/html, Size: 5739 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: latex newcommand in org
       [not found]       ` <600dd6834d16428ba8a66f9bdd1b0f14@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2016-05-21 11:00         ` Eric S Fraga
  2016-05-21 16:24           ` Marcin Borkowski
  0 siblings, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2016-05-21 11:00 UTC (permalink / raw)
  To: Doyley, Marvin M.; +Cc: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 546 bytes --]

On Friday, 20 May 2016 at 23:45, Doyley, Marvin M. wrote:
> Eric’s suggestion works like a charm with the following modification
> #+latex_header:\newenvironment{response}{\color{red}}{\ignorespacesafterend}

Excellent and the modification makes sense for your use case.

-- 
: Professor Eric S Fraga, CPSE, Chemical Engineering, UCL
: GnuPG/PGP key 0xFFFCF67D, http://www.ucl.ac.uk/~ucecesf
:
: CFP: Nature-Inspired Algorithms: Design, Analysis and Application
:      Special session, META'2016 (http://meta2016.sciencesconf.org/)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: business-card.vcf --]
[-- Type: text/x-vcard, Size: 483 bytes --]

BEGIN:VCARD
VERSION:2.1
UID:1
REV:2011-12-20T21:29:15Z
FN:Professor Eric S Fraga, PhD
N:Fraga;Eric
ORG:University College London (UCL)
TITLE:Professor of Process Systems Engineering
EMAIL;WORK:e.fraga@ucl.ac.uk
TEL;WORK;VOICE:44(0)20 7679 3817
ADR;WORK:;CPSE, Department of Chemical Engineering;210A Roberts Building, Torrington Place;London;;WC1E 7JE;United Kingdom
URL:<WWLINK TYPE="GENERIC" VALUE="http://www.ucl.ac.uk/~ucecesf/">http://www.ucl.ac.uk/~ucecesf/</WWLINK>
END:VCARD

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: latex newcommand in org
  2016-05-21 11:00         ` Eric S Fraga
@ 2016-05-21 16:24           ` Marcin Borkowski
  0 siblings, 0 replies; 8+ messages in thread
From: Marcin Borkowski @ 2016-05-21 16:24 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode@gnu.org, Doyley, Marvin M.


On 2016-05-21, at 13:00, Eric S Fraga <e.fraga@ucl.ac.uk> wrote:

> On Friday, 20 May 2016 at 23:45, Doyley, Marvin M. wrote:
>> Eric’s suggestion works like a charm with the following modification
>> #+latex_header:\newenvironment{response}{\color{red}}{\ignorespacesafterend}
>
> Excellent and the modification makes sense for your use case.

You might also want to say

\newenvironment{response}{\unskip\color{red}\ignorespaces}{\unskip\ignorespacesafterend}

(not tested).

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-05-21 16:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20 18:10 latex newcommand in org Doyley, Marvin M.
     [not found] <4623b22355d94329a72b69bd254e036d@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-05-20 18:45 ` Eric S Fraga
2016-05-20 19:50   ` Marcin Borkowski
2016-05-20 20:37     ` Doyley, Marvin M.
2016-05-20 21:00     ` Leslie Watter
2016-05-20 23:45       ` Doyley, Marvin M.
     [not found]       ` <600dd6834d16428ba8a66f9bdd1b0f14@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-05-21 11:00         ` Eric S Fraga
2016-05-21 16:24           ` Marcin Borkowski

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).