emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Lawrence Mitchell <wence@gmx.li>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Protect starred commands in LaTeX export correctly
Date: Wed, 23 Mar 2011 10:28:04 +0000	[thread overview]
Message-ID: <m3zkom15w6.fsf_-_@e4300lm.epcc.ed.ac.uk> (raw)
In-Reply-To: 87mxkmp5y6.fsf@ucl.ac.uk

* 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 <eric@ericabrahamsen.net> 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]+\\*?\\)"

  reply	other threads:[~2011-03-23 10:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23  4:07 escaping of #+TEXT lines: \vspace vs \vspace* Eric Abrahamsen
2011-03-23  9:00 ` Eric S Fraga
2011-03-23 10:28   ` Lawrence Mitchell [this message]
2011-03-23 11:28     ` [PATCH] Protect starred commands in LaTeX export correctly Eric Abrahamsen
2011-03-23 14:05     ` [Accepted] " Bastien Guerry
2011-03-23 14:11     ` [PATCH] " Eric S Fraga
2011-03-23 14:16     ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3zkom15w6.fsf_-_@e4300lm.epcc.ed.ac.uk \
    --to=wence@gmx.li \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


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).