emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Lawrence <richard.lawrence@berkeley.edu>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: Re: Latex export: Differing behavior for symbols in headlines
Date: Sun, 24 Oct 2010 00:30:28 -0700	[thread overview]
Message-ID: <8739rwnj3f.fsf@berkeley.edu> (raw)
In-Reply-To: 877hh8nthl.fsf_-_@berkeley.edu

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

  reply	other threads:[~2010-10-24  7:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-10-25  8:42     ` Giovanni Ridolfi

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=8739rwnj3f.fsf@berkeley.edu \
    --to=richard.lawrence@berkeley.edu \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

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