From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Egli Subject: [PATCH] Fix the export of underscores in links in the LaTeX export Date: Thu, 08 Jan 2009 13:58:36 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LKuTK-0002hm-DG for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 07:58:50 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LKuTJ-0002hM-IY for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 07:58:49 -0500 Received: from [199.232.76.173] (port=40642 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LKuTJ-0002hI-7f for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 07:58:49 -0500 Received: from main.gmane.org ([80.91.229.2]:57592 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LKuTI-0002Rv-Gn for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 07:58:48 -0500 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LKuTG-0004JN-0t for emacs-orgmode@gnu.org; Thu, 08 Jan 2009 12:58:46 +0000 Received: from d05.sbszh.ch ([217.192.14.190]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Jan 2009 12:58:46 +0000 Received: from christian.egli by d05.sbszh.ch with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Jan 2009 12:58:46 +0000 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 I have the attached org file which I export to LaTeX. With the current version of git the export produces the link as follows: \href{http://wiki.dspace.org/index.php/Configure\_media\_{}filters}{media filters} Notice the spurious '{}' before filters. Needless to say this link doesn't work. I tried to understand the source of the problem and came up with the following patch which seems to work. However since I don't quite understand this code you should take my change with a grain of salt. With my patch I now get the following link. \href{http://wiki.dspace.org/index.php/Configure\_media\_filters}{media filters} --=-=-= Content-Disposition: inline; filename=test.org Content-Description: Org test file containing link with underscores #+OPTIONS: ^:nil TeX:nil toc:nil * Title ** Subtitle [[http://wiki.dspace.org/index.php/Configure_media_filters][media filters]] --=-=-= Thanks Christian --- lisp/org-export-latex.el | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/org-export-latex.el b/lisp/org-export-latex.el index daa75dc..eeb8199 100644 --- a/lisp/org-export-latex.el +++ b/lisp/org-export-latex.el @@ -958,12 +958,13 @@ SUBSUP corresponds to the ^: option in the #+OPTIONS line. Convert CHAR depending on STRING-BEFORE and STRING-AFTER." (cond ((equal string-before "\\") (concat string-before char string-after)) + ; deal with links + ((eq 'org-link (get-text-property 0 'face char)) + (concat string-before "\\" char string-after)) ;; this is part of a math formula ((and (string-match "\\S-+" string-before) (string-match "\\S-+" string-after)) - (cond ((eq 'org-link (get-text-property 0 'face char)) - (concat string-before "\\" char string-after)) - ((save-match-data (org-inside-latex-math-p)) + (cond ((save-match-data (org-inside-latex-math-p)) (if subsup (cond ((eq 1 (length string-after)) (concat string-before char string-after)) -- 1.5.6.3 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--