summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-11-20 15:05:42 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2009-11-20 15:05:42 +0100
commit3f64f8ec732e67442c93c96f19934ae8aa3d5e0e (patch)
treee945f81f6c4f0ff98dcd5f6f9842dd2146fa9cbf
parenta2e0d000c8baae0891dd8205d10b259507f5f68e (diff)
downloadorg-mode-3f64f8ec732e67442c93c96f19934ae8aa3d5e0e.tar.gz
LaTeX export: Protect secondary footnote references
Francesco Pizzolante writes: > Exporting multiple references to the same footnote to LaTeX lead to a wrong > generated code. > > The following example: > > --8<---------------cut here---------------start------------->8--- > * Title > This is my text[fn:1:This is my footnote.]. And another one[fn:1]. > --8<---------------cut here---------------end--------------->8--- > > Will produce the following LaTeX code: > > --8<---------------cut here---------------start------------->8--- > \section{Title} > \label{sec-1} > > This is my text\footnote{This is my footnote. }. And another one\$$^{1}$\$. > --8<---------------cut here---------------end--------------->8--- > > The correct code should be: > > --8<---------------cut here---------------start------------->8--- > \section{Title} > \label{sec-1} > > This is my text\footnote{This is my footnote. }. And another one$^{1}$. > --8<---------------cut here---------------end--------------->8---
-rwxr-xr-xlisp/ChangeLog3
-rw-r--r--lisp/org-latex.el3
2 files changed, 5 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3e9abdf..a35b2b9 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
2009-11-20 Carsten Dominik <carsten.dominik@gmail.com>
+ * org-latex.el (org-export-latex-preprocess): Protect secondary
+ footnote references.
+
* org-indent.el (org-indent-initialize): Avoid empty strings as
line prefixes.
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index 7062b9e..5b04473 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1815,7 +1815,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(save-excursion
(if (not (re-search-forward (concat "^" (regexp-quote foot-prefix))
nil t))
- (replace-match "$^{\\1}$")
+ (replace-match (org-export-latex-protect-string
+ (concat "$^{" (match-string 1) "}$")))
(replace-match "")
(let ((end (save-excursion
(if (re-search-forward "^$\\|^#.*$\\|\\[[0-9]+\\]" nil t)