From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: Bug: Re: Latex export: Differing behavior for symbols in headlines Date: Sun, 24 Oct 2010 00:30:28 -0700 Message-ID: <8739rwnj3f.fsf@berkeley.edu> References: <87lj5rplxv.fsf@berkeley.edu> <19863.1287678982@gamaville.dokosmarshall.org> <877hh8nthl.fsf_-_@berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=58058 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P9v1E-0001VW-5j for emacs-orgmode@gnu.org; Sun, 24 Oct 2010 03:29:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P9v1C-0006vP-Ot for emacs-orgmode@gnu.org; Sun, 24 Oct 2010 03:29:28 -0400 Received: from lo.gmane.org ([80.91.229.12]:53980) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P9v1C-0006vF-E2 for emacs-orgmode@gnu.org; Sun, 24 Oct 2010 03:29:26 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1P9v18-0002Lq-GG for emacs-orgmode@gnu.org; Sun, 24 Oct 2010 09:29:22 +0200 Received: from c-67-164-33-170.hsd1.ca.comcast.net ([67.164.33.170]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Oct 2010 09:29:22 +0200 Received: from richard.lawrence by c-67-164-33-170.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 24 Oct 2010 09:29:22 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Richard Lawrence 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