From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lawrence Mitchell Subject: [PATCH] Protect starred commands in LaTeX export correctly Date: Wed, 23 Mar 2011 10:28:04 +0000 Message-ID: References: <87lj06fpjr.fsf@ericabrahamsen.net> <87mxkmp5y6.fsf@ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=46924 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q2LQI-0004mn-5W for emacs-orgmode@gnu.org; Wed, 23 Mar 2011 06:36:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q2LQG-00079c-P1 for emacs-orgmode@gnu.org; Wed, 23 Mar 2011 06:36:18 -0400 Received: from lo.gmane.org ([80.91.229.12]:38500) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q2LQG-000799-JW for emacs-orgmode@gnu.org; Wed, 23 Mar 2011 06:36:16 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Q2LQC-0002GA-M7 for emacs-orgmode@gnu.org; Wed, 23 Mar 2011 11:36:12 +0100 Received: from e4300lm.epcc.ed.ac.uk ([129.215.63.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Mar 2011 11:36:12 +0100 Received: from wence by e4300lm.epcc.ed.ac.uk with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 23 Mar 2011 11:36:12 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org * lisp/org-latex.el (org-export-latex-preprocess): Correctly match starred command names. Many LaTeX commands exist in both normal and starred forms. Adjust the regexp in `org-export-latex-preprocess' to match the starred form as well. --- lisp/org-latex.el | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Eric S Fraga wrote: > Eric Abrahamsen writes: >> Hi, >> In a certain org file I put this line into the export options: >> #+begin_src org-mode >> #+TEXT: \vspace*{0.5in} >> #+end_src > Should this not be > #+LATEX: \vspace*{0.5in} > instead of TEXT? [...] > One could argue that the latex escaping that org does should > include *'ed commands as well... but this may have other repercussions > that I am not aware of. Indeed it probably should, here's a patch that does exactly that, avoiding the need for the above workaround. With this change \vspace*{1cm} is correctly exported like \vspace{1cm}. diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 2acc169..912ebba 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -2364,7 +2364,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." ;; Protect LaTeX commands like \command[...]{...} or \command{...} (goto-char (point-min)) (let ((re (concat - "\\\\\\([a-zA-Z]+\\)" + "\\\\\\([a-zA-Z]+\\*?\\)" "\\(?:<[^<>\n]*>\\)*" "\\(?:\\[[^][\n]*?\\]\\)*" "\\(?:<[^<>\n]*>\\)*" -- 1.7.4.rc2.18.gb20e9