[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] [PATCH] Protect starred commands in LaTeX export correctly
From: |
Lawrence Mitchell |
Subject: |
[O] [PATCH] Protect starred commands in LaTeX export correctly |
Date: |
Wed, 23 Mar 2011 10:28:04 +0000 |
User-agent: |
Gnus/5.110014 (No Gnus v0.14) Emacs/24.0.50 (gnu/linux) |
* 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 <address@hidden> 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