emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix the export of underscores in links in the LaTeX export
@ 2009-01-08 12:58 Christian Egli
  2009-01-08 13:25 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Egli @ 2009-01-08 12:58 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 629 bytes --]


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}

[-- Attachment #2: Org test file containing link with underscores --]
[-- Type: text/plain, Size: 132 bytes --]

#+OPTIONS:   ^:nil TeX:nil toc:nil

* Title
** Subtitle
[[http://wiki.dspace.org/index.php/Configure_media_filters][media filters]]

[-- Attachment #3: Type: text/plain, Size: 1076 bytes --]

 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))

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-01-08 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-08 12:58 [PATCH] Fix the export of underscores in links in the LaTeX export Christian Egli
2009-01-08 13:25 ` Carsten Dominik

Code repositories for project(s) associated with this inbox:


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).