Hello, Rasmus <ras...@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