emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kirsten <drostekirsten@gmail.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Richard Lawrence <richard.lawrence@berkeley.edu>, emacs-orgmode@gnu.org
Subject: Re: [PATCH] Preserve math environments in title when exporting to LaTeX
Date: Sun, 21 Nov 2010 10:23:39 +0100	[thread overview]
Message-ID: <2C8E152D-19B2-44C8-BA8A-C9C086ABC036@gmail.com> (raw)
In-Reply-To: <86740850-4B24-406D-A505-0289A50830D2@gmail.com>


On Nov 21, 2010, at 9:54 AM, Carsten Dominik wrote:

> Hi Richard,
>
> I have now applied this patch.  I am not entirely sure it will have  
> no adverse effects, so please, people who do export to LaTeX, check  
> after the next pull if you see any problems.

Actually, I think I have just found a better way to solve this issue,
in a way that will also solve it for figure captions.

Please, LaTeX export users, test the current git version.

THanks

- Carsten

>
> Thanks Richard!
>
> - Carsten
>
> On Oct 25, 2010, at 5:41 PM, Richard Lawrence wrote:
>
>> 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
>>
>> 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
>> _______________________________________________
>> 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
>

  reply	other threads:[~2010-11-21  9:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-25 15:41 [PATCH] Preserve math environments in title when exporting to LaTeX Richard Lawrence
2010-11-21  8:54 ` Carsten Dominik
2010-11-21  9:23   ` Kirsten [this message]
2010-11-21  9:24   ` Carsten Dominik
2010-11-21 17:14     ` Thomas S. Dye
2010-11-21 17:18       ` Carsten Dominik
2010-11-22  6:11     ` Richard Lawrence
2010-11-22  9:36     ` Eric S Fraga
2010-11-22 18:09       ` Carsten Dominik

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=2C8E152D-19B2-44C8-BA8A-C9C086ABC036@gmail.com \
    --to=drostekirsten@gmail.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=richard.lawrence@berkeley.edu \
    /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).