* escaping of #+TEXT lines: \vspace vs \vspace*
@ 2011-03-23 4:07 Eric Abrahamsen
2011-03-23 9:00 ` Eric S Fraga
0 siblings, 1 reply; 7+ messages in thread
From: Eric Abrahamsen @ 2011-03-23 4:07 UTC (permalink / raw)
To: emacs-orgmode
Hi,
In a certain org file I put this line into the export options:
#+begin_src org-mode
#+TEXT: \vspace*{0.5in}
#+end_src
The starred version is necessary, obviously, since this comes before any
text, and LaTeX will ignore a plain old \vspace{} in those cases.
This currently gets escaped as \vspace*\{0.5in\}, which keeps it from
working. I noticed that regular \vspace{} is not escaped, so I went
looking in org-latex.el, but can't begin to figure out which regexp in
which function is protecting the unstarred version, but not the starred
version.
Is this fixable?
Thanks!
Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: escaping of #+TEXT lines: \vspace vs \vspace*
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 ` [PATCH] Protect starred commands in LaTeX export correctly Lawrence Mitchell
0 siblings, 1 reply; 7+ messages in thread
From: Eric S Fraga @ 2011-03-23 9:00 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
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?
By the way, if you want such commands to be recognised inline within
normal org text, without having to escape them, I do the following:
#+latex_header: \newcommand{\Gap}[1]{\vspace*{#1}}
and then simply type \Gap{0.5in} whenever you want to invoke this vspace
command. 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.
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.97.g078c0)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] Protect starred commands in LaTeX export correctly
2011-03-23 9:00 ` Eric S Fraga
@ 2011-03-23 10:28 ` Lawrence Mitchell
2011-03-23 11:28 ` Eric Abrahamsen
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Lawrence Mitchell @ 2011-03-23 10:28 UTC (permalink / raw)
To: emacs-orgmode
* 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]+\\*?\\)"
"\\(?:<[^<>\n]*>\\)*"
"\\(?:\\[[^][\n]*?\\]\\)*"
"\\(?:<[^<>\n]*>\\)*"
--
1.7.4.rc2.18.gb20e9
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] Protect starred commands in LaTeX export correctly
2011-03-23 10:28 ` [PATCH] Protect starred commands in LaTeX export correctly Lawrence Mitchell
@ 2011-03-23 11:28 ` Eric Abrahamsen
2011-03-23 14:05 ` [Accepted] " Bastien Guerry
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Eric Abrahamsen @ 2011-03-23 11:28 UTC (permalink / raw)
To: emacs-orgmode
Lawrence Mitchell <wence@gmx.li> writes:
> * 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.
Awesome! This seems like a good idea. Though the other Eric's suggestion
just to use #+LATEX of course worked perfectly, I'm not sure why I
thought I needed #+TEXT in order to place the text before the first
headline…
Eric
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Accepted] Protect starred commands in LaTeX export correctly
2011-03-23 10:28 ` [PATCH] Protect starred commands in LaTeX export correctly Lawrence Mitchell
2011-03-23 11:28 ` Eric Abrahamsen
@ 2011-03-23 14:05 ` Bastien Guerry
2011-03-23 14:11 ` [PATCH] " Eric S Fraga
2011-03-23 14:16 ` Bastien
3 siblings, 0 replies; 7+ messages in thread
From: Bastien Guerry @ 2011-03-23 14:05 UTC (permalink / raw)
To: emacs-orgmode
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 <wence@gmx.li>
> X-Patchwork-Id: 712
> Message-Id: <m3zkom15w6.fsf_-_@e4300lm.epcc.ed.ac.uk>
> 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 <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]+\\*?\\)"
> "\\(?:<[^<>\n]*>\\)*"
> "\\(?:\\[[^][\n]*?\\]\\)*"
> "\\(?:<[^<>\n]*>\\)*"
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Protect starred commands in LaTeX export correctly
2011-03-23 10:28 ` [PATCH] Protect starred commands in LaTeX export correctly Lawrence Mitchell
2011-03-23 11:28 ` Eric Abrahamsen
2011-03-23 14:05 ` [Accepted] " Bastien Guerry
@ 2011-03-23 14:11 ` Eric S Fraga
2011-03-23 14:16 ` Bastien
3 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2011-03-23 14:11 UTC (permalink / raw)
To: Lawrence Mitchell; +Cc: emacs-orgmode
Lawrence Mitchell <wence@gmx.li> writes:
> * lisp/org-latex.el (org-export-latex-preprocess): Correctly
> match starred command names.
Brilliant! Thanks.
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.99.gac6e4.dirty)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] Protect starred commands in LaTeX export correctly
2011-03-23 10:28 ` [PATCH] Protect starred commands in LaTeX export correctly Lawrence Mitchell
` (2 preceding siblings ...)
2011-03-23 14:11 ` [PATCH] " Eric S Fraga
@ 2011-03-23 14:16 ` Bastien
3 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2011-03-23 14:16 UTC (permalink / raw)
To: Lawrence Mitchell; +Cc: emacs-orgmode
Hi Lawrence,
Lawrence Mitchell <wence@gmx.li> writes:
> * lisp/org-latex.el (org-export-latex-preprocess): Correctly
> match starred command names.
Great -- thanks for this simple and clear patch! I've now applied it.
--
Bastien
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-03-23 14:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH] Protect starred commands in LaTeX export correctly Lawrence Mitchell
2011-03-23 11:28 ` 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
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).