From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Borkowski Subject: Re: latex newcommand in org Date: Fri, 20 May 2016 21:50:05 +0200 Message-ID: <87a8jkpl02.fsf@mbork.pl> References: <4623b22355d94329a72b69bd254e036d@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> <87k2iomuvb.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:33168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3qRU-0001V8-OC for emacs-orgmode@gnu.org; Fri, 20 May 2016 15:50:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b3qRQ-0003od-Gv for emacs-orgmode@gnu.org; Fri, 20 May 2016 15:50:39 -0400 Received: from mail.mojserwer.eu ([195.110.48.8]:46958) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b3qRQ-0003o5-0w for emacs-orgmode@gnu.org; Fri, 20 May 2016 15:50:36 -0400 In-reply-to: <87k2iomuvb.fsf@ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Eric S Fraga Cc: "emacs-orgmode@gnu.org" , "Doyley, Marvin M." On 2016-05-20, at 20:45, Eric S Fraga 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