* Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
@ 2016-04-23 20:54 Jorge Peixoto de Morais Neto
2016-04-25 8:38 ` Rasmus
0 siblings, 1 reply; 19+ messages in thread
From: Jorge Peixoto de Morais Neto @ 2016-04-23 20:54 UTC (permalink / raw)
To: Emacs-orgmode@gnu.org
Export the following Org file to PDF:
------------------------------------------------------------------------
Line1.[fn:1]
\pagebreak
Line2.[fn:1]
* Footnotes
[fn:1] Footnote.
------------------------------------------------------------------------
In the generated PDF, the second footnote reference (on page 2) is not
clickable. If this happened on a large document, how would the reader
locate the footnote definition?
I reproduced this with an empty ~/.emacs. This is Ubuntu 16.04.
Emacs : GNU Emacs 25.0.93.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
of 2016-04-22
Package: Org-mode version 8.3.4 (8.3.4-39-ge0acd8-elpaplus @
/home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)
current state:
==============
(setq
org-tab-first-hook '(org-hide-block-toggle-maybe org-babel-hide-result-
toggle-maybe org-babel-header-arg-expand)
org-speed-command-hook '(org-speed-command-default-hook org-babel-speed-
command-hook)
org-occur-hook '(org-first-headline-recenter)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-html-format-drawer-function '(lambda (name contents) contents)
org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-
function
org-confirm-shell-link-function 'yes-or-no-p
org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
org-latex-format-headline-function 'org-latex-format-headline-default-
function
org-after-todo-state-change-hook '(org-clock-out-if-current)
org-latex-format-drawer-function '(lambda (name contents) contents)
org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-
configure-edit-buffer)
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-babel-pre-tangle-hook '(save-buffer)
org-mode-hook '(#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-
mode-hook org-show-block-all append local] 5]
#[nil "\300\301\302\303\304$\207" [org-add-hook change-major-
mode-hook org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes org-
eldoc-load)
org-archive-hook '(org-attach-archive-delete-maybe)
org-ascii-format-drawer-function '(lambda (name contents width) contents)
org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point org-babel-execute-safely-
maybe)
org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers org-
cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-confirm-elisp-link-function 'yes-or-no-p
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-html-format-headline-function 'org-html-format-headline-default-function
org-html-format-inlinetask-function 'org-html-format-inlinetask-default-
function
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
)
--
- I am Brazilian. I hope my English is correct and I welcome corrections.
- Please adopt free formats like PDF, ODF, LaTeX, Vorbis, Opus, WebM and 7z.
- Free software for Android: https://f-droid.org/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-23 20:54 Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)] Jorge Peixoto de Morais Neto
@ 2016-04-25 8:38 ` Rasmus
2016-04-25 8:58 ` Nicolas Goaziou
0 siblings, 1 reply; 19+ messages in thread
From: Rasmus @ 2016-04-25 8:38 UTC (permalink / raw)
To: emacs-orgmode
Jorge Peixoto de Morais Neto <jorge13515@gmail.com> writes:
> Line1.[fn:1]
>
> \pagebreak
>
> Line2.[fn:1]
> * Footnotes
> [fn:1] Footnote.
> ------------------------------------------------------------------------
> In the generated PDF, the second footnote reference (on page 2) is not
> clickable. If this happened on a large document, how would the reader
> locate the footnote definition?
Currently, that's not possible in Org. You could something like this,
Line1.[fn:1]
\pagebreak
Line2 (see footnote [[f1]])
* Footnotes
[fn:1] <<f1>> Footnote.
You could also settle for user labels,
# -*- org-latex-prefer-user-labels:t -*-
#+latex_header: \usepackage{scrextend}
#+macro: fnref (eval (if (org-export-derived-backend-p org-export-current-backend 'latex) (format "@@latex:\\footref{%s}@@" "$1") "<<$1>>"))
Line1.[fn:1]
#+latex: \pagebreak
Line2.{{{fnref(f1)}}}
* Footnotes
[fn:1] <<f1>> Footnote.
Ultimately, I think a decent fix would be to add a prefix to
org-latex--label for targets pointing to footnotes. They should be
prefixed with "fn:". Then, it should be easy to hack together a filter.
Rasmus
--
A page of history is worth a volume of logic
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-25 8:38 ` Rasmus
@ 2016-04-25 8:58 ` Nicolas Goaziou
2016-04-25 10:53 ` Rasmus
0 siblings, 1 reply; 19+ messages in thread
From: Nicolas Goaziou @ 2016-04-25 8:58 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> Ultimately, I think a decent fix would be to add a prefix to
> org-latex--label for targets pointing to footnotes. They should be
> prefixed with "fn:". Then, it should be easy to hack together
> a filter.
OOC, isn't `org-export-filter-footnote-reference-functions' enough as
a filter?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-25 8:58 ` Nicolas Goaziou
@ 2016-04-25 10:53 ` Rasmus
2016-04-25 11:41 ` Nicolas Goaziou
0 siblings, 1 reply; 19+ messages in thread
From: Rasmus @ 2016-04-25 10:53 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Rasmus <rasmus@gmx.us> writes:
>
>> Ultimately, I think a decent fix would be to add a prefix to
>> org-latex--label for targets pointing to footnotes. They should be
>> prefixed with "fn:". Then, it should be easy to hack together
>> a filter.
>
> OOC, isn't `org-export-filter-footnote-reference-functions' enough as
> a filter?
Probably I’m lacking the adequate creativity.
I’ll sketch the problem as I see it.
Consider the filter FUN and the below file.
The transcoded version of the second "[fn:1]", say S2, will be passed to
our filter FUN, if FUN is added to
org-export-filter-footnote-reference-functions. But S2 will only contain
the estimated number of the footnote¹, e.g. "\footnotemark[1]{}". In
particular, we haven’t got the potentially transcoded reference to the
footnote definition. Without the reference, I don’t know how to add a
hyperref link.
We could capture the transcoded version of the link "[[f1]]" in FUN, if
FUN is added to org-export-filter-link-functions (I think). But by then
we’d only be served a generic reference, e.g. "\ref{org925ce52}". I don’t
know how we’d then differentiate between a link to a footnote and to some
other type of element, e.g. a source block. Hence, it becomes hard to
guess when to use e.g. \footref{.} instead of \ref{.}.
Rasmus
* head
:PROPERTIES:
:CUSTOM_ID: h1
:END:
Line1.[fn:1] or [[f1]]
\pagebreak
Line2[fn:1] [[f1]]
* Footnotes
[fn:1] <<f1>> Footnote.
Footnotes:
¹ It’s estimated because it’s not done on the latex side. E.g. I can
get an incorrect number by adding this to the top of my file:
#+latex: \addtocounter{footnote}{1}
More realistically, breakage would occur when a footnote is added by
some arbitrary latex command that Org doesn’t know about.
--
Dung makes an excellent fertilizer
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-25 10:53 ` Rasmus
@ 2016-04-25 11:41 ` Nicolas Goaziou
2016-04-25 13:36 ` Rasmus
0 siblings, 1 reply; 19+ messages in thread
From: Nicolas Goaziou @ 2016-04-25 11:41 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> The transcoded version of the second "[fn:1]", say S2, will be passed to
> our filter FUN, if FUN is added to
> org-export-filter-footnote-reference-functions. But S2 will only contain
> the estimated number of the footnote¹, e.g. "\footnotemark[1]{}".
Indeed. I don't know any other way to handle repeated footnote markers
in LaTeX.
> We could capture the transcoded version of the link "[[f1]]" in FUN, if
> FUN is added to org-export-filter-link-functions (I think). But by then
> we’d only be served a generic reference, e.g. "\ref{org925ce52}". I don’t
> know how we’d then differentiate between a link to a footnote and to some
> other type of element, e.g. a source block. Hence, it becomes hard to
> guess when to use e.g. \footref{.} instead of \ref{.}.
You can retrieve element referenced as "org925ce52" with
(cdr (assoc "org925ce52" (plist-get info :internal-references)))
It's a bit low-level, but it is useful, it could be factored out as
a function in "ox.el".
Regards,
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-25 11:41 ` Nicolas Goaziou
@ 2016-04-25 13:36 ` Rasmus
2016-04-25 13:57 ` Nicolas Goaziou
0 siblings, 1 reply; 19+ messages in thread
From: Rasmus @ 2016-04-25 13:36 UTC (permalink / raw)
To: emacs-orgmode
Hi,
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> The transcoded version of the second "[fn:1]", say S2, will be passed to
>> our filter FUN, if FUN is added to
>> org-export-filter-footnote-reference-functions. But S2 will only contain
>> the estimated number of the footnote¹, e.g. "\footnotemark[1]{}".
>
> Indeed. I don't know any other way to handle repeated footnote markers
> in LaTeX.
Could we inject labels in all footnotes? If so we could simply use
\textsuperscript{\ref{FN-LABEL}}
In place of
\footnotemark[FN-GUESS]{}
It seems \footref of scrextend.sty has some extra robustness built into it
but until someone complains I think the \textsuperscript hack should be
enough and better then what we’ve got.
Example:
\documentclass[11pt]{article}
\usepackage[hidelinks]{hyperref}
\usepackage{parskip} % to avoid \noindent
\usepackage{scrextend} % to get \footref
\begin{document}
\addtocounter{footnote}{1}
Text\footnote{\label{org925ce52} Footnote.}\\
Text\footref{org925ce52}\\
Text\textsuperscript{\ref{org925ce52}}\\
Text\footnotemark[2]{}\\
\end{document}
>> We could capture the transcoded version of the link "[[f1]]" in FUN, if
>> FUN is added to org-export-filter-link-functions (I think). But by then
>> we’d only be served a generic reference, e.g. "\ref{org925ce52}". I don’t
>> know how we’d then differentiate between a link to a footnote and to some
>> other type of element, e.g. a source block. Hence, it becomes hard to
>> guess when to use e.g. \footref{.} instead of \ref{.}.
>
> You can retrieve element referenced as "org925ce52" with
>
> (cdr (assoc "org925ce52" (plist-get info :internal-references)))
Cool! I hadn’t noticed that these are part of info.
> It's a bit low-level, but it is useful, it could be factored out as
> a function in "ox.el".
It should be enough to allow Jorge to write a simple filter to address
original issue.
Rasmus
--
To err is human. To screw up 10⁶ times per second, you need a computer
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-25 13:36 ` Rasmus
@ 2016-04-25 13:57 ` Nicolas Goaziou
2016-04-25 14:04 ` Rasmus
2016-05-22 20:16 ` Rasmus
0 siblings, 2 replies; 19+ messages in thread
From: Nicolas Goaziou @ 2016-04-25 13:57 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Could we inject labels in all footnotes? If so we could simply use
>
> \textsuperscript{\ref{FN-LABEL}}
>
> In place of
>
> \footnotemark[FN-GUESS]{}
>
> It seems \footref of scrextend.sty has some extra robustness built into it
> but until someone complains I think the \textsuperscript hack should be
> enough and better then what we’ve got.
That's a bit hackish, but definitely possible. Do yo want to provide
a patch?
Regards,
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-25 13:57 ` Nicolas Goaziou
@ 2016-04-25 14:04 ` Rasmus
2016-04-25 14:07 ` Rasmus
2016-05-22 20:16 ` Rasmus
1 sibling, 1 reply; 19+ messages in thread
From: Rasmus @ 2016-04-25 14:04 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> Could we inject labels in all footnotes? If so we could simply use
>>
>> \textsuperscript{\ref{FN-LABEL}}
>>
>> In place of
>>
>> \footnotemark[FN-GUESS]{}
>>
>> It seems \footref of scrextend.sty has some extra robustness built into it
>> but until someone complains I think the \textsuperscript hack should be
>> enough and better then what we’ve got.
>
> That's a bit hackish, but definitely possible. Do yo want to provide
> a patch?
It's no (much) more hackish then what we’ve got.
I would not be able to work on a patch until the 8th, so someone is free
to beat me to it. I’ve put a link to this thread in my calendar.
[I'm also working on a patch to improve templating for
org-publish-org-sitemap, but that’s another thread].
Rasmus
--
ツ
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-25 14:04 ` Rasmus
@ 2016-04-25 14:07 ` Rasmus
0 siblings, 0 replies; 19+ messages in thread
From: Rasmus @ 2016-04-25 14:07 UTC (permalink / raw)
To: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>
>> Rasmus <rasmus@gmx.us> writes:
>>
>>> Could we inject labels in all footnotes? If so we could simply use
>>>
>>> \textsuperscript{\ref{FN-LABEL}}
>>>
>>> In place of
>>>
>>> \footnotemark[FN-GUESS]{}
>>>
>>> It seems \footref of scrextend.sty has some extra robustness built into it
>>> but until someone complains I think the \textsuperscript hack should be
>>> enough and better then what we’ve got.
>>
>> That's a bit hackish, but definitely possible. Do yo want to provide
>> a patch?
>
> It's no (much) more hackish then what we’ve got.
Alternatively, we can use a more robust solution, but we’d add more
dependencies. And I don’t like adding new dependencies...
Rasmus
--
Bang bang
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-04-25 13:57 ` Nicolas Goaziou
2016-04-25 14:04 ` Rasmus
@ 2016-05-22 20:16 ` Rasmus
2016-05-23 21:41 ` Nicolas Goaziou
1 sibling, 1 reply; 19+ messages in thread
From: Rasmus @ 2016-05-22 20:16 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 903 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Rasmus <rasmus@gmx.us> writes:
>
>> Could we inject labels in all footnotes? If so we could simply use
>>
>> \textsuperscript{\ref{FN-LABEL}}
>>
>> In place of
>>
>> \footnotemark[FN-GUESS]{}
>>
>> It seems \footref of scrextend.sty has some extra robustness built into it
>> but until someone complains I think the \textsuperscript hack should be
>> enough and better then what we’ve got.
>
> That's a bit hackish, but definitely possible. Do yo want to provide
> a patch?
With the attached patch ox-latex seems to behave in this way. Though
perhaps there’s a more efficient way to get the first footnote-reference
to a given definition than trawling through with
org-export--footnote-reference-map.
Nicolas, where is the info plist documented or defined/populated?
Rasmus
--
Together we will make the possible totalllly impossible!
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-More-robust-footnote-referencing.patch --]
[-- Type: text/x-diff, Size: 4732 bytes --]
From 07f15d538aa02d5b45fa545395442f5663260430 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sun, 22 May 2016 20:33:06 +0200
Subject: [PATCH] ox-latex: More robust footnote referencing
* lisp/ox-latex.el (org-latex--label): Prefix footnote with "fn".
(org-latex--delayed-footnotes-definitions): Fix typo in docstring.
(org-latex-footnote-reference): Use \ref{.} and \label{.} for repeated
references.
---
lisp/ox-latex.el | 72 ++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 47 insertions(+), 25 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 9c31645..3c66a32 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1246,6 +1246,8 @@ Eventually, if FULL is non-nil, wrap label within \"\\label{}\"."
org-latex-math-environments-re
(org-element-property :value datum))
"eq:"))
+ (footnote-reference "fn:")
+ (footnote-definition "fn:")
(paragraph
(and (org-element-property :caption datum)
"fig:")))
@@ -1498,7 +1500,7 @@ INFO is a plist used as a communication channel. See
INFO is a plist used as a communication channel.
-Footnotes definitions are returned within \"\\footnotetxt{}\"
+Footnotes definitions are returned within \"\\footnotetext{}\"
commands.
This function is used within constructs that don't support
@@ -1803,30 +1805,50 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(defun org-latex-footnote-reference (footnote-reference _contents info)
"Transcode a FOOTNOTE-REFERENCE element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
- (concat
- ;; Insert separator between two footnotes in a row.
- (let ((prev (org-export-get-previous-element footnote-reference info)))
- (when (eq (org-element-type prev) 'footnote-reference)
- (plist-get info :latex-footnote-separator)))
- (cond
- ;; Use \footnotemark if the footnote has already been defined.
- ((not (org-export-footnote-first-reference-p footnote-reference info))
- (format "\\footnotemark[%s]{}"
- (org-export-get-footnote-number footnote-reference info)))
- ;; Use \footnotemark if reference is within another footnote
- ;; reference, footnote definition or table cell.
- ((org-element-lineage footnote-reference
- '(footnote-reference footnote-definition table-cell))
- "\\footnotemark")
- ;; Otherwise, define it with \footnote command.
- (t
- (let ((def (org-export-get-footnote-definition footnote-reference info)))
- (concat
- (format "\\footnote{%s}" (org-trim (org-export-data def info)))
- ;; Retrieve all footnote references within the footnote and
- ;; add their definition after it, since LaTeX doesn't support
- ;; them inside.
- (org-latex--delayed-footnotes-definitions def info)))))))
+ (let ((label (org-element-property :label footnote-reference)))
+ (concat
+ ;; Insert separator between two footnotes in a row.
+ (let ((prev (org-export-get-previous-element footnote-reference info)))
+ (when (eq (org-element-type prev) 'footnote-reference)
+ (plist-get info :latex-footnote-separator)))
+ (cond
+ ;; Use \footnotemark if the footnote has already been defined.
+ ((not (org-export-footnote-first-reference-p footnote-reference info))
+ (format "\\textsuperscript{\\ref{%s}}"
+ (org-latex--label
+ (catch 'exit
+ (org-export--footnote-reference-map
+ (lambda (f)
+ (let ((l (org-element-property :label f)))
+ (when (and l label (string= label l))
+ (throw 'exit f))))
+ (plist-get info :parse-tree) info))
+ info t)))
+ ;; Use \footnotemark if reference is within another footnote
+ ;; reference, footnote definition or table cell.
+ ((org-element-lineage footnote-reference
+ '(footnote-reference footnote-definition table-cell))
+ "\\footnotemark")
+ ;; Otherwise, define it with \footnote command.
+ (t
+ (let ((def (org-export-get-footnote-definition footnote-reference info)))
+ (concat
+ (format "\\footnote{%s%s}" (org-trim (org-export-data def info))
+ (if (catch 'exit
+ (org-export--footnote-reference-map
+ (lambda (f)
+ (let ((l (org-element-property :label f)))
+ (when (and l label
+ (not (eq f footnote-reference))
+ (string= label l))
+ (throw 'exit t))))
+ (plist-get info :parse-tree) info))
+ (org-latex--label footnote-reference info t t)
+ ""))
+ ;; Retrieve all footnote references within the footnote and
+ ;; add their definition after it, since LaTeX doesn't support
+ ;; them inside.
+ (org-latex--delayed-footnotes-definitions def info))))))))
;;;; Headline
--
2.8.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-05-22 20:16 ` Rasmus
@ 2016-05-23 21:41 ` Nicolas Goaziou
2016-05-24 20:59 ` [patch] more robust footnotes (was: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]) Rasmus
2016-08-10 21:09 ` Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)] Kaushal Modi
0 siblings, 2 replies; 19+ messages in thread
From: Nicolas Goaziou @ 2016-05-23 21:41 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> With the attached patch ox-latex seems to behave in this way.
Thank you. Some comments follow.
> Though perhaps there’s a more efficient way to get the first
> footnote-reference to a given definition than trawling through with
> org-export--footnote-reference-map.
Couldn't you refer to the definition instead of the first reference ?
There is a function grabbing it and it is unique for a given label.
Also, not that `org-export-get-footnote-definition' doesn't return the
definition itself, only its contents. Therefore the reference are
different and there is no possible ambiguity.
> Nicolas, where is the info plist documented or defined/populated?
It is documented at
<http://orgmode.org/worg/dev/org-export-reference.html>. However, caches
used for memoization are not referenced.
> + ;; Use \footnotemark if the footnote has already been defined.
The comment no longer seems accurate.
> + ((not (org-export-footnote-first-reference-p footnote-reference info))
> + (format "\\textsuperscript{\\ref{%s}}"
> + (org-latex--label
> + (catch 'exit
> + (org-export--footnote-reference-map
> + (lambda (f)
> + (let ((l (org-element-property :label f)))
> + (when (and l label (string= label l))
> + (throw 'exit f))))
> + (plist-get info :parse-tree) info))
> + info t)))
See above.
> + ;; Use \footnotemark if reference is within another footnote
> + ;; reference, footnote definition or table cell.
> + ((org-element-lineage footnote-reference
> + '(footnote-reference footnote-definition table-cell))
> + "\\footnotemark")
> + ;; Otherwise, define it with \footnote command.
> + (t
> + (let ((def (org-export-get-footnote-definition footnote-reference info)))
> + (concat
> + (format "\\footnote{%s%s}" (org-trim (org-export-data def info))
> + (if (catch 'exit
> + (org-export--footnote-reference-map
> + (lambda (f)
> + (let ((l (org-element-property :label f)))
> + (when (and l label
> + (not (eq f footnote-reference))
> + (string= label l))
> + (throw 'exit t))))
> + (plist-get info :parse-tree) info))
> + (org-latex--label footnote-reference info t t)
> + ""))
I'm not sure to understand the logic here. You seem to add a label to
all references sharing a given label but the first one. Intuitively,
I think it should be the opposite.
Besides, in this branch of the `cond', all footnote references are the
first for their their label.
Wouldn't it be sufficient to use
(format "\\footnote{%s%s}"
(org-trim (org-export-data def info))
(org-latex--label def info t t))
?
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 19+ messages in thread
* [patch] more robust footnotes (was: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)])
2016-05-23 21:41 ` Nicolas Goaziou
@ 2016-05-24 20:59 ` Rasmus
2016-05-24 21:31 ` [patch] more robust footnotes Nicolas Goaziou
2016-08-10 21:09 ` Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)] Kaushal Modi
1 sibling, 1 reply; 19+ messages in thread
From: Rasmus @ 2016-05-24 20:59 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]
Hi,
Thanks for comments.
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>> Though perhaps there’s a more efficient way to get the first
>> footnote-reference to a given definition than trawling through with
>> org-export--footnote-reference-map.
>
> Couldn't you refer to the definition instead of the first reference ?
> There is a function grabbing it and it is unique for a given label.
> Also, not that `org-export-get-footnote-definition' doesn't return the
> definition itself, only its contents. Therefore the reference are
> different and there is no possible ambiguity.
Yeah that's much better. Thanks!
>> + (format "\\footnote{%s%s}" (org-trim (org-export-data def info))
>> + (if (catch 'exit
>> + (org-export--footnote-reference-map
>> + (lambda (f)
>> + (let ((l (org-element-property :label f)))
>> + (when (and l label
>> + (not (eq f footnote-reference))
>> + (string= label l))
>> + (throw 'exit t))))
>> + (plist-get info :parse-tree) info))
>> + (org-latex--label footnote-reference info t t)
>> + ""))
>
> I'm not sure to understand the logic here. You seem to add a label to
> all references sharing a given label but the first one. Intuitively,
> I think it should be the opposite.
>
> Besides, in this branch of the `cond', all footnote references are the
> first for their their label.
>
> Wouldn't it be sufficient to use
>
> (format "\\footnote{%s%s}"
> (org-trim (org-export-data def info))
> (org-latex--label def info t t))
The GOAL is to make "pretty" latex and not clutter every footnote with
labels. I think the logic is better now, but it uses the plain
org-export-map rather than org-export--footnote-reference-map. I guess
that’s anyway more clean and org-export-get-footnote-definition should do
the necessary caching.
Rasmus
--
Governments should be afraid of their people
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-html-Find-preamble-spec-case-insensitively.patch --]
[-- Type: text/x-diff, Size: 1027 bytes --]
From 8b7534d16b611fa4f55df59ce4e2521b5c525cc0 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sun, 22 May 2016 15:10:16 +0200
Subject: [PATCH] ox-html: Find preamble-spec case-insensitively
* ox-html.el (org-html--build-pre/postamble): Find the spec based on
the language case-insensitively.
Note that the default org-html-preamble-format and
org-export-default-language are incompatible.
---
lisp/ox-html.el | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index a05fa2d..3d4e5da 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -1854,10 +1854,11 @@ communication channel."
(format "<p class=\"validation\">%s</p>\n"
validation-link))))
(t (format-spec
- (or (cadr (assoc
+ (or (cadr (assoc-string
(plist-get info :language)
(eval (intern
- (format "org-html-%s-format" type)))))
+ (format "org-html-%s-format" type)))
+ t))
(cadr
(assoc
"en"
--
2.8.2
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [patch] more robust footnotes
2016-05-24 20:59 ` [patch] more robust footnotes (was: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]) Rasmus
@ 2016-05-24 21:31 ` Nicolas Goaziou
2016-05-24 21:38 ` Rasmus
0 siblings, 1 reply; 19+ messages in thread
From: Nicolas Goaziou @ 2016-05-24 21:31 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> The GOAL is to make "pretty" latex and not clutter every footnote with
> labels.
I understand that. I actually misread the code.
> I think the logic is better now, but it uses the plain
> org-export-map rather than org-export--footnote-reference-map.
The difference between `org-element-map' and
`org-export--footnote-reference-map' is about the order in which
footnotes references are processed. In this case, you don't care about
it, so `org-element-map' is probably a better choice.
> From: Rasmus <rasmus@gmx.us>
> Date: Sun, 22 May 2016 15:10:16 +0200
> Subject: [PATCH] ox-html: Find preamble-spec case-insensitively
You sent the wrong patch.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [patch] more robust footnotes
2016-05-24 21:31 ` [patch] more robust footnotes Nicolas Goaziou
@ 2016-05-24 21:38 ` Rasmus
2016-05-24 21:54 ` Nicolas Goaziou
0 siblings, 1 reply; 19+ messages in thread
From: Rasmus @ 2016-05-24 21:38 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 119 bytes --]
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> You sent the wrong patch.
Ups...!
--
Vote for proprietary math!
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ox-latex-More-robust-repeated-footnote-references.patch --]
[-- Type: text/x-diff, Size: 5906 bytes --]
From 880eb2047f7895a4d767ce59b9fe13465b5a16a7 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sun, 22 May 2016 20:33:06 +0200
Subject: [PATCH] ox-latex: More robust repeated footnote references
* lisp/ox-latex.el (org-latex--label): Prefix footnote with "fn".
(org-latex--delayed-footnotes-definitions): Fix typo in docstring.
(org-latex-footnote-defined-format): New defcustom.
(org-latex-footnote-reference): Refer to repeated footnotes using
labels. Format using new defcustom.
---
lisp/ox-latex.el | 78 ++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 53 insertions(+), 25 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 0946fe4..5883448 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -119,6 +119,7 @@
(:latex-default-table-mode nil nil org-latex-default-table-mode)
(:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format)
(:latex-footnote-separator nil nil org-latex-footnote-separator)
+ (:latex-footnote-defined-format nil nil org-latex-footnote-defined-format)
(:latex-format-drawer-function nil nil org-latex-format-drawer-function)
(:latex-format-headline-function nil nil org-latex-format-headline-function)
(:latex-format-inlinetask-function nil nil org-latex-format-inlinetask-function)
@@ -651,6 +652,16 @@ The function result will be used in the section format string."
:group 'org-export-latex
:type 'string)
+(defcustom org-latex-footnote-defined-format "\\textsuperscript{\\ref{%s}}"
+ "Format string used to format reference to footnote already defined.
+%s will be replaced by the label of the referred footnote."
+ :group 'org-export-latex
+ :type '(choice
+ (const :tag "Use plain superscript (default)" "\\textsuperscript{\\ref{%s}}")
+ (const :tag "Use Memoir/KOMA-Script footref" "\\footref{%s}")
+ (string :tag "Other format string"))
+ :version "25.2"
+ :package-version '(Org . "9.0"))
;;;; Timestamps
@@ -1246,6 +1257,8 @@ Eventually, if FULL is non-nil, wrap label within \"\\label{}\"."
org-latex-math-environments-re
(org-element-property :value datum))
"eq:"))
+ (footnote-reference "fn:")
+ (footnote-definition "fn:")
(paragraph
(and (org-element-property :caption datum)
"fig:")))
@@ -1498,7 +1511,7 @@ INFO is a plist used as a communication channel. See
INFO is a plist used as a communication channel.
-Footnotes definitions are returned within \"\\footnotetxt{}\"
+Footnotes definitions are returned within \"\\footnotetext{}\"
commands.
This function is used within constructs that don't support
@@ -1804,30 +1817,45 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(defun org-latex-footnote-reference (footnote-reference _contents info)
"Transcode a FOOTNOTE-REFERENCE element from Org to LaTeX.
CONTENTS is nil. INFO is a plist holding contextual information."
- (concat
- ;; Insert separator between two footnotes in a row.
- (let ((prev (org-export-get-previous-element footnote-reference info)))
- (when (eq (org-element-type prev) 'footnote-reference)
- (plist-get info :latex-footnote-separator)))
- (cond
- ;; Use \footnotemark if the footnote has already been defined.
- ((not (org-export-footnote-first-reference-p footnote-reference info))
- (format "\\footnotemark[%s]{}"
- (org-export-get-footnote-number footnote-reference info)))
- ;; Use \footnotemark if reference is within another footnote
- ;; reference, footnote definition or table cell.
- ((org-element-lineage footnote-reference
- '(footnote-reference footnote-definition table-cell))
- "\\footnotemark")
- ;; Otherwise, define it with \footnote command.
- (t
- (let ((def (org-export-get-footnote-definition footnote-reference info)))
- (concat
- (format "\\footnote{%s}" (org-trim (org-export-data def info)))
- ;; Retrieve all footnote references within the footnote and
- ;; add their definition after it, since LaTeX doesn't support
- ;; them inside.
- (org-latex--delayed-footnotes-definitions def info)))))))
+ (let ((label (org-element-property :label footnote-reference)))
+ (concat
+ ;; Insert separator between two footnotes in a row.
+ (let ((prev (org-export-get-previous-element footnote-reference info)))
+ (when (eq (org-element-type prev) 'footnote-reference)
+ (plist-get info :latex-footnote-separator)))
+ (cond
+ ;; Use `:latex-footnote-defined-format' if the footnote has
+ ;; already been defined.
+ ((not (org-export-footnote-first-reference-p footnote-reference info))
+ (format (plist-get info :latex-footnote-defined-format)
+ (org-latex--label
+ (org-export-get-footnote-definition footnote-reference info)
+ info t)))
+ ;; Use \footnotemark if reference is within another footnote
+ ;; reference, footnote definition or table cell.
+ ((org-element-lineage footnote-reference
+ '(footnote-reference footnote-definition table-cell))
+ "\\footnotemark")
+ ;; Otherwise, define it with \footnote command.
+ (t
+ (let ((def (org-export-get-footnote-definition footnote-reference info)))
+ (concat
+ (format "\\footnote{%s%s}" (org-trim (org-export-data def info))
+ ;; Only insert a label if there exist another
+ ;; reference to def.
+ (if (org-element-map
+ (plist-get info :parse-tree)
+ 'footnote-reference
+ (lambda (f)
+ (and (not (eq f footnote-reference))
+ (eq def (org-export-get-footnote-definition f info))))
+ info t)
+ (org-trim (org-latex--label def info t t))
+ ""))
+ ;; Retrieve all footnote references within the footnote and
+ ;; add their definition after it, since LaTeX doesn't support
+ ;; them inside.
+ (org-latex--delayed-footnotes-definitions def info))))))))
;;;; Headline
--
2.8.3
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [patch] more robust footnotes
2016-05-24 21:38 ` Rasmus
@ 2016-05-24 21:54 ` Nicolas Goaziou
2016-05-25 7:16 ` Rasmus
0 siblings, 1 reply; 19+ messages in thread
From: Nicolas Goaziou @ 2016-05-24 21:54 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Rasmus <rasmus@gmx.us> writes:
> (:latex-default-table-mode nil nil org-latex-default-table-mode)
> (:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format)
> (:latex-footnote-separator nil nil org-latex-footnote-separator)
> + (:latex-footnote-defined-format nil nil org-latex-footnote-defined-format)
How dare you break the lexical order of the properties here? :)
> @@ -1246,6 +1257,8 @@ Eventually, if FULL is non-nil, wrap label within \"\\label{}\"."
> org-latex-math-environments-re
> (org-element-property :value datum))
> "eq:"))
> + (footnote-reference "fn:")
> + (footnote-definition "fn:")
You don't seem to use the latter. Does it still make sense to provide
it?
> + (format "\\footnote{%s%s}" (org-trim (org-export-data def info))
> + ;; Only insert a label if there exist another
> + ;; reference to def.
> + (if (org-element-map
> + (plist-get info :parse-tree)
> + 'footnote-reference
> + (lambda (f)
> + (and (not (eq f footnote-reference))
> + (eq def (org-export-get-footnote-definition f info))))
> + info t)
> + (org-trim (org-latex--label def info t t))
> + ""))
I suggest to avoid calling repeatedly
`org-export-get-footnote-definition'. Also, if the footnote reference is
anonymous, there is no point in calling `org-element-map'. The following
is more efficient:
(format "\\footnote{%s%s}"
(org-trim (org-export-data def info))
;; Only insert a label if there exist another reference to def.
(cond
((not label) "")
((org-element-map (plist-get info :parse-tree) 'footnote-reference
(lambda (f)
(and (not (eq f footnote-reference))
(equal (org-element-property :label f) label)
(org-latex--label def info t t)))
info t))
(t "")))
Thank you for you work.
Regards,
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [patch] more robust footnotes
2016-05-24 21:54 ` Nicolas Goaziou
@ 2016-05-25 7:16 ` Rasmus
2016-05-25 16:50 ` Nicolas Goaziou
0 siblings, 1 reply; 19+ messages in thread
From: Rasmus @ 2016-05-25 7:16 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> You don't seem to use the latter. Does it still make sense to provide
> it?
No.
> I suggest to avoid calling repeatedly
> `org-export-get-footnote-definition'. Also, if the footnote reference is
> anonymous, there is no point in calling `org-element-map'. The following
> is more efficient:
>
> (format "\\footnote{%s%s}"
> (org-trim (org-export-data def info))
> ;; Only insert a label if there exist another reference to def.
> (cond
> ((not label) "")
> ((org-element-map (plist-get info :parse-tree) 'footnote-reference
> (lambda (f)
> (and (not (eq f footnote-reference))
> (equal (org-element-property :label f) label)
> (org-latex--label def info t t)))
> info t))
> (t "")))
Thanks.
I have pushed the change.
Rasmus
--
Er du tosset for noge' lårt!
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [patch] more robust footnotes
2016-05-25 7:16 ` Rasmus
@ 2016-05-25 16:50 ` Nicolas Goaziou
2016-05-25 17:51 ` Rasmus
0 siblings, 1 reply; 19+ messages in thread
From: Nicolas Goaziou @ 2016-05-25 16:50 UTC (permalink / raw)
To: Rasmus; +Cc: emacs-orgmode
Hello,
Rasmus <rasmus@gmx.us> writes:
> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>>
>> I suggest to avoid calling repeatedly
>> `org-export-get-footnote-definition'. Also, if the footnote reference is
>> anonymous, there is no point in calling `org-element-map'. The following
>> is more efficient:
>>
>> (format "\\footnote{%s%s}"
>> (org-trim (org-export-data def info))
>> ;; Only insert a label if there exist another reference to def.
>> (cond
>> ((not label) "")
>> ((org-element-map (plist-get info :parse-tree) 'footnote-reference
>> (lambda (f)
>> (and (not (eq f footnote-reference))
>> (equal (org-element-property :label f) label)
>> (org-latex--label def info t t)))
>> info t))
>> (t "")))
>
> Thanks.
>
> I have pushed the change.
Thank you.
However, the patch you committed doesn't short-circuit on anonymous
footnotes, per above (the (not label) part). As a consequence, every
anonymous footnote (as long as there is more than one) gets a label,
AFAICT.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [patch] more robust footnotes
2016-05-25 16:50 ` Nicolas Goaziou
@ 2016-05-25 17:51 ` Rasmus
0 siblings, 0 replies; 19+ messages in thread
From: Rasmus @ 2016-05-25 17:51 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
> Hello,
>
> Rasmus <rasmus@gmx.us> writes:
>
>> Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:
>>>
>>> I suggest to avoid calling repeatedly
>>> `org-export-get-footnote-definition'. Also, if the footnote reference is
>>> anonymous, there is no point in calling `org-element-map'. The following
>>> is more efficient:
>>>
>>> (format "\\footnote{%s%s}"
>>> (org-trim (org-export-data def info))
>>> ;; Only insert a label if there exist another reference to def.
>>> (cond
>>> ((not label) "")
>>> ((org-element-map (plist-get info :parse-tree) 'footnote-reference
>>> (lambda (f)
>>> (and (not (eq f footnote-reference))
>>> (equal (org-element-property :label f) label)
>>> (org-latex--label def info t t)))
>>> info t))
>>> (t "")))
>>
>> Thanks.
>>
>> I have pushed the change.
>
> Thank you.
>
> However, the patch you committed doesn't short-circuit on anonymous
> footnotes, per above (the (not label) part). As a consequence, every
> anonymous footnote (as long as there is more than one) gets a label,
> AFAICT.
You are right. I missed that case. I've pushed your suggested fix.
Rasmus
--
Spil noget med Slayer!
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]
2016-05-23 21:41 ` Nicolas Goaziou
2016-05-24 20:59 ` [patch] more robust footnotes (was: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]) Rasmus
@ 2016-08-10 21:09 ` Kaushal Modi
1 sibling, 0 replies; 19+ messages in thread
From: Kaushal Modi @ 2016-08-10 21:09 UTC (permalink / raw)
To: Rasmus, emacs-orgmode, Nicolas Goaziou
[-- Attachment #1: Type: text/plain, Size: 3588 bytes --]
Hi guys,
Looks like I just reported the exact same bug few minutes back.
@Rasmus: Are you still working on committing the fix for this?
Thanks.
Kaushal
On Mon, May 23, 2016 at 5:42 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:
> Hello,
>
> Rasmus <rasmus@gmx.us> writes:
>
> > With the attached patch ox-latex seems to behave in this way.
>
> Thank you. Some comments follow.
>
> > Though perhaps there’s a more efficient way to get the first
> > footnote-reference to a given definition than trawling through with
> > org-export--footnote-reference-map.
>
> Couldn't you refer to the definition instead of the first reference ?
> There is a function grabbing it and it is unique for a given label.
> Also, not that `org-export-get-footnote-definition' doesn't return the
> definition itself, only its contents. Therefore the reference are
> different and there is no possible ambiguity.
>
> > Nicolas, where is the info plist documented or defined/populated?
>
> It is documented at
> <http://orgmode.org/worg/dev/org-export-reference.html>. However, caches
> used for memoization are not referenced.
>
> > + ;; Use \footnotemark if the footnote has already been defined.
>
> The comment no longer seems accurate.
>
> > + ((not (org-export-footnote-first-reference-p footnote-reference
> info))
> > + (format "\\textsuperscript{\\ref{%s}}"
> > + (org-latex--label
> > + (catch 'exit
> > + (org-export--footnote-reference-map
> > + (lambda (f)
> > + (let ((l (org-element-property :label f)))
> > + (when (and l label (string= label l))
> > + (throw 'exit f))))
> > + (plist-get info :parse-tree) info))
> > + info t)))
>
> See above.
>
> > + ;; Use \footnotemark if reference is within another footnote
> > + ;; reference, footnote definition or table cell.
> > + ((org-element-lineage footnote-reference
> > + '(footnote-reference footnote-definition
> table-cell))
> > + "\\footnotemark")
> > + ;; Otherwise, define it with \footnote command.
> > + (t
> > + (let ((def (org-export-get-footnote-definition
> footnote-reference info)))
> > + (concat
> > + (format "\\footnote{%s%s}" (org-trim (org-export-data def info))
> > + (if (catch 'exit
> > + (org-export--footnote-reference-map
> > + (lambda (f)
> > + (let ((l (org-element-property :label f)))
> > + (when (and l label
> > + (not (eq f footnote-reference))
> > + (string= label l))
> > + (throw 'exit t))))
> > + (plist-get info :parse-tree) info))
> > + (org-latex--label footnote-reference info t t)
> > + ""))
>
> I'm not sure to understand the logic here. You seem to add a label to
> all references sharing a given label but the first one. Intuitively,
> I think it should be the opposite.
>
> Besides, in this branch of the `cond', all footnote references are the
> first for their their label.
>
> Wouldn't it be sufficient to use
>
> (format "\\footnote{%s%s}"
> (org-trim (org-export-data def info))
> (org-latex--label def info t t))
>
> ?
>
> Regards,
>
> --
> Nicolas Goaziou
>
> --
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 4847 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2016-08-10 21:10 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-23 20:54 Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)] Jorge Peixoto de Morais Neto
2016-04-25 8:38 ` Rasmus
2016-04-25 8:58 ` Nicolas Goaziou
2016-04-25 10:53 ` Rasmus
2016-04-25 11:41 ` Nicolas Goaziou
2016-04-25 13:36 ` Rasmus
2016-04-25 13:57 ` Nicolas Goaziou
2016-04-25 14:04 ` Rasmus
2016-04-25 14:07 ` Rasmus
2016-05-22 20:16 ` Rasmus
2016-05-23 21:41 ` Nicolas Goaziou
2016-05-24 20:59 ` [patch] more robust footnotes (was: Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)]) Rasmus
2016-05-24 21:31 ` [patch] more robust footnotes Nicolas Goaziou
2016-05-24 21:38 ` Rasmus
2016-05-24 21:54 ` Nicolas Goaziou
2016-05-25 7:16 ` Rasmus
2016-05-25 16:50 ` Nicolas Goaziou
2016-05-25 17:51 ` Rasmus
2016-08-10 21:09 ` Bug: When exporting to PDF an Org file where multiple footnotes share the same definition, only the first footnote is clickable [8.3.4 (8.3.4-39-ge0acd8-elpaplus @ /home/jorge/.emacs.d/elpa/org-plus-contrib-20160418/)] Kaushal Modi
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.