From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: [PATCH] Preserve math environments in title when exporting to LaTeX Date: Mon, 25 Oct 2010 08:41:54 -0700 Message-ID: <87ocai8ekd.fsf@berkeley.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=39299 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PAPAD-0006hD-Ov for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 11:40:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PAPAB-0005RA-Vq for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 11:40:45 -0400 Received: from cm03fe.ist.berkeley.edu ([169.229.218.144]:35199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PAPAB-0005Qs-Jq for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 11:40:43 -0400 Received: from c-67-164-33-170.hsd1.ca.comcast.net ([67.164.33.170] helo=ludwig) by cm03fe.ist.berkeley.edu with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (auth plain:richard.lawrence@berkeley.edu) (envelope-from ) id 1PAPA6-0003Al-AK for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 08:40:39 -0700 Received: from rwl by ludwig with local (Exim 4.69) (envelope-from ) id 1PAPBK-00011w-7N for emacs-orgmode@gnu.org; Mon, 25 Oct 2010 08:41:54 -0700 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 --=-=-= 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org-latex.el.diff Content-Description: Preserve math environments in title diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 4fcbbb7..f97436c 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -727,13 +727,33 @@ when PUB-DIR is set, use this as the publishing directory." (org-current-export-file buffer-file-name) (title (or (and subtree-p (org-export-get-title-from-subtree)) (plist-get opt-plist :title) - (and (not - (plist-get opt-plist :skip-before-1st-heading)) - (org-export-grab-title-from-buffer)) + (unless (plist-get opt-plist :skip-before-1st-heading) + (let ((pt (org-export-grab-title-from-buffer))) + (remove-text-properties 0 (length pt) + '(:org-license-to-kill t) pt) + pt)) (and buffer-file-name (file-name-sans-extension (file-name-nondirectory buffer-file-name))) "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 (and (not to-buffer) (concat --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--