1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-26 07:33:39 +00:00

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---
This commit is contained in:
Carsten Dominik 2009-11-20 15:05:42 +01:00
parent a2e0d000c8
commit 3f64f8ec73
2 changed files with 5 additions and 1 deletions

View File

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

View File

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