[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Accepted] [O] Protect starred commands in LaTeX export correctly
From: |
Bastien Guerry |
Subject: |
[Accepted] [O] Protect starred commands in LaTeX export correctly |
Date: |
Wed, 23 Mar 2011 15:05:47 +0100 (CET) |
Patch 712 (http://patchwork.newartisans.com/patch/712/) is now "Accepted".
Maintainer comment: none
This relates to the following submission:
http://mid.gmane.org/%3Cm3zkom15w6.fsf_-_%40e4300lm.epcc.ed.ac.uk%3E
Here is the original message containing the patch:
> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] Protect starred commands in LaTeX export correctly
> Date: Wed, 23 Mar 2011 15:28:04 -0000
> From: Lawrence Mitchell <address@hidden>
> X-Patchwork-Id: 712
> Message-Id: <address@hidden>
> To: address@hidden
>
> * 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]*>\\)*"
>