Preserve math environments in title when exporting to LaTeX
* lisp/org-latex.el (org-export-as-latex): Sent the section title through the preprocessor. Hi all, This patch fixes the issue I originally described here: http://article.gmane.org/gmane.emacs.orgmode/32281 It preserves math-mode delimiters (e.g. "$" and "\(") in the document title when exporting to LaTeX. (That is, it prevents them from being escaped, by running the title through org-export-preprocess-string, which marks them with the org-protected property.) It should work regardless of whether the title is pulled from a headline, from the text before the first headline, or from an explicit #+TITLE declaration. (This is my first time contributing a patch to a Free Software project -- so please, let me know what you think!) Best, Richard
This commit is contained in:
parent
d637546804
commit
c579f08eee
|
@ -729,13 +729,33 @@ when PUB-DIR is set, use this as the publishing directory."
|
||||||
(org-current-export-file buffer-file-name)
|
(org-current-export-file buffer-file-name)
|
||||||
(title (or (and subtree-p (org-export-get-title-from-subtree))
|
(title (or (and subtree-p (org-export-get-title-from-subtree))
|
||||||
(plist-get opt-plist :title)
|
(plist-get opt-plist :title)
|
||||||
(and (not
|
(unless (plist-get opt-plist :skip-before-1st-heading)
|
||||||
(plist-get opt-plist :skip-before-1st-heading))
|
(let ((pt (org-export-grab-title-from-buffer)))
|
||||||
(org-export-grab-title-from-buffer))
|
(remove-text-properties 0 (length pt)
|
||||||
|
'(:org-license-to-kill t) pt)
|
||||||
|
pt))
|
||||||
(and buffer-file-name
|
(and buffer-file-name
|
||||||
(file-name-sans-extension
|
(file-name-sans-extension
|
||||||
(file-name-nondirectory buffer-file-name)))
|
(file-name-nondirectory buffer-file-name)))
|
||||||
"No Title"))
|
"No Title"))
|
||||||
|
; Preprocessing preserves math environments in title
|
||||||
|
(title
|
||||||
|
(and title (string-match "\\S-" title)
|
||||||
|
(org-export-preprocess-string
|
||||||
|
title
|
||||||
|
:emph-multiline t
|
||||||
|
:for-LaTeX t
|
||||||
|
:comments nil
|
||||||
|
:tags (plist-get opt-plist :tags)
|
||||||
|
:priority (plist-get opt-plist :priority)
|
||||||
|
:footnotes (plist-get opt-plist :footnotes)
|
||||||
|
:drawers (plist-get opt-plist :drawers)
|
||||||
|
:timestamps (plist-get opt-plist :timestamps)
|
||||||
|
:todo-keywords (plist-get opt-plist :todo-keywords)
|
||||||
|
:add-text nil
|
||||||
|
:select-tags nil
|
||||||
|
:exclude-tags nil
|
||||||
|
:LaTeX-fragments nil)))
|
||||||
(filename
|
(filename
|
||||||
(and (not to-buffer)
|
(and (not to-buffer)
|
||||||
(concat
|
(concat
|
||||||
|
|
Loading…
Reference in New Issue