Hi, Thanks for comments. Nicolas Goaziou 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