* Latex export: Differing behavior for symbols in headlines
@ 2010-10-21 16:09 Richard Lawrence
2010-10-21 16:36 ` Nick Dokos
0 siblings, 1 reply; 5+ messages in thread
From: Richard Lawrence @ 2010-10-21 16:09 UTC (permalink / raw
To: emacs-orgmode
Dear Orgsters,
I am seeing differing behavior for how special symbols that appear in a
headline are exported to LaTeX, depending on whether I export an entire
Org document or just the current subtree.
I have, for example, a file that looks like this:
* Headline 1
** Headline 2, concerning $\alpha$ and $\beta$
If I export the whole document, the $'s around \alpha and \beta are
properly interpreted as math-mode delimiters, and Headline 2 becomes a
section title that looks exactly as I would expect.
If I export just Headline 2, however, the $'s are escaped, and show up
as literal '$' characters in the title of the exported document.
(I can't remove the $'s, because I am actually using some custom LaTeX
commands, not special symbols like \alpha and \beta that Org would
recognize as needing to be put in math mode.)
So, two questions:
1) Is this difference between whole-document vs. current-subtree export
the expected behavior?
2) If so, what's the right way to work around it? If not, where should
I look to try and fix it?
(I am running the latest development version of Org.)
Thanks!
Best,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Latex export: Differing behavior for symbols in headlines
2010-10-21 16:09 Latex export: Differing behavior for symbols in headlines Richard Lawrence
@ 2010-10-21 16:36 ` Nick Dokos
2010-10-24 3:45 ` Bug: " Richard Lawrence
0 siblings, 1 reply; 5+ messages in thread
From: Nick Dokos @ 2010-10-21 16:36 UTC (permalink / raw
To: Richard Lawrence; +Cc: nicholas.dokos, emacs-orgmode
Richard Lawrence <richard.lawrence@berkeley.edu> wrote:
> Dear Orgsters,
>
> I am seeing differing behavior for how special symbols that appear in a
> headline are exported to LaTeX, depending on whether I export an entire
> Org document or just the current subtree.
>
> I have, for example, a file that looks like this:
>
> * Headline 1
> ** Headline 2, concerning $\alpha$ and $\beta$
>
> If I export the whole document, the $'s around \alpha and \beta are
> properly interpreted as math-mode delimiters, and Headline 2 becomes a
> section title that looks exactly as I would expect.
>
> If I export just Headline 2, however, the $'s are escaped, and show up
> as literal '$' characters in the title of the exported document.
>
> (I can't remove the $'s, because I am actually using some custom LaTeX
> commands, not special symbols like \alpha and \beta that Org would
> recognize as needing to be put in math mode.)
>
> So, two questions:
>
> 1) Is this difference between whole-document vs. current-subtree export
> the expected behavior?
>
Looks like a bug to me. I can reproduce it too.
> 2) If so, what's the right way to work around it? If not, where should
> I look to try and fix it?
>
I tried using \( and \) as the inline math delimiters but that did not
work either: I got $ signs *inserted* and then latex complains about that:
foo.org:
--8<---------------cut here---------------start------------->8---
* Headline 1
** Headline 2, concerning \(\alpha\) and \(\beta\)
--8<---------------cut here---------------end--------------->8---
foo.tex (elided):
--8<---------------cut here---------------start------------->8---
...
\title{Headline 2, concerning \($\alpha$\) and \($\beta$\)}
...
--8<---------------cut here---------------end--------------->8---
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Bug: Re: Latex export: Differing behavior for symbols in headlines
2010-10-21 16:36 ` Nick Dokos
@ 2010-10-24 3:45 ` Richard Lawrence
2010-10-24 7:30 ` Richard Lawrence
2010-10-25 8:42 ` Giovanni Ridolfi
0 siblings, 2 replies; 5+ messages in thread
From: Richard Lawrence @ 2010-10-24 3:45 UTC (permalink / raw
To: emacs-orgmode
Nick Dokos <nicholas.dokos@hp.com> writes:
>> 1) Is this difference between whole-document vs. current-subtree export
>> the expected behavior?
>>
> Looks like a bug to me. I can reproduce it too.
Was my original email enough to constitute a bug report?
>> 2) If so, what's the right way to work around it? If not, where should
>> I look to try and fix it?
>>
I'm still wondering about the latter question here. This is important
enough to me that I am willing to take a stab at fixing it, but my Elisp
experience is basically limited to init file customizations. Can anyone
who knows the ins and outs of the LaTeX export code give me a few
pointers about where to start?
Thanks,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: Re: Latex export: Differing behavior for symbols in headlines
2010-10-24 3:45 ` Bug: " Richard Lawrence
@ 2010-10-24 7:30 ` Richard Lawrence
2010-10-25 8:42 ` Giovanni Ridolfi
1 sibling, 0 replies; 5+ messages in thread
From: Richard Lawrence @ 2010-10-24 7:30 UTC (permalink / raw
To: emacs-orgmode
Richard Lawrence <richard.lawrence@berkeley.edu> responds to himself:
>>> 2) If so, what's the right way to work around it? If not, where should
>>> I look to try and fix it?
>>>
>
> I'm still wondering about the latter question here. This is important
> enough to me that I am willing to take a stab at fixing it, but my Elisp
> experience is basically limited to init file customizations. Can anyone
> who knows the ins and outs of the LaTeX export code give me a few
> pointers about where to start?
OK, I've been reading the code in org-latex.el for a while now, and I
have at least come to understand why $'s in a headline are escaped when
the export is restricted to a subtree.
The explanation is this: within org-export-as-latex, the headline is
bound to `title', and passed to org-export-latex-make-header, which in
turn passes the value into org-export-latex-content, thusly:
;; org-latex.el, line 1283
(format
"\n\n\\title{%s}\n"
;; convert the title
(org-export-latex-content
title '(lists tables fixed-width keywords)))
org-export-latex-content works by performing a series of mutations on a
temporary buffer. One of these mutations,
org-export-latex-special-chars, replaces "$" with "\$". So that's
where the replacement is happening when the headline of a subtree is
used as the title for a LaTeX export.
(Actually, this begs the question: how should one export an Org file to
LaTeX if part of the title should be in math mode? Is escaping $'s in
the document title really the best behavior? My guess would be that
people need math mode in their document titles far more often than they
need a literal "$".)
Here's what I don't understand yet: when the entire Org file is
exported, rather than just a subtree, the headlines (which eventually
become the section titles in the output) are apparently *not* processed
this way, because then the $'s in such headlines pass through unescaped.
I'm not sure if this is because they never pass through
org-export-latex-content, or because $'s have had the org-protected
property set by the time they *do* pass through it.
Guidance would be much appreciated!
Best,
Richard
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Bug: Re: Latex export: Differing behavior for symbols in headlines
2010-10-24 3:45 ` Bug: " Richard Lawrence
2010-10-24 7:30 ` Richard Lawrence
@ 2010-10-25 8:42 ` Giovanni Ridolfi
1 sibling, 0 replies; 5+ messages in thread
From: Giovanni Ridolfi @ 2010-10-25 8:42 UTC (permalink / raw
To: Richard Lawrence; +Cc: emacs-orgmode
Richard Lawrence <richard.lawrence@berkeley.edu> writes:
Hi, Richard,
> Nick Dokos <nicholas.dokos@hp.com> writes:
>
>>> 1) Is this difference between whole-document vs. current-subtree export
>>> the expected behavior?
>>>
>> Looks like a bug to me. I can reproduce it too.
>
> Was my original email enough to constitute a bug report?
Well, a week ago Carsten wrote[1]:
"Org-mode will never be a perfect TeX scanner, and this is really hard.
Help yourself and Org by using \( and \) as math delimiters [...] "
How about:
* Headline 1
** Headline 2, concerning \(\alpha\) and \(\beta\)
that will be exported as:
\title{Headline 2, concerning \($\alpha$\) and \($\beta$\)}
cheers,
Giovanni
[1] http://lists.gnu.org/archive/html/emacs-orgmode/2010-10/msg00981.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-10-25 8:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-21 16:09 Latex export: Differing behavior for symbols in headlines Richard Lawrence
2010-10-21 16:36 ` Nick Dokos
2010-10-24 3:45 ` Bug: " Richard Lawrence
2010-10-24 7:30 ` Richard Lawrence
2010-10-25 8:42 ` Giovanni Ridolfi
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.