From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: 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/)] Date: Mon, 23 May 2016 23:41:13 +0200 Message-ID: <87bn3w8nba.fsf@saiph.selenimh> References: <1461444845.13483.6.camel@gmail.com> <87h9eqt74z.fsf@gmx.us> <87a8kivzcc.fsf@saiph.selenimh> <87r3durmc6.fsf@gmx.us> <87h9ep6hkx.fsf@saiph.selenimh> <874mapstdk.fsf@gmx.us> <87a8kh4wpp.fsf@saiph.selenimh> <87r3ctalx7.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4xbN-00064E-GB for emacs-orgmode@gnu.org; Mon, 23 May 2016 17:41:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b4xbI-00033v-G7 for emacs-orgmode@gnu.org; Mon, 23 May 2016 17:41:28 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:43580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b4xbI-00033b-9o for emacs-orgmode@gnu.org; Mon, 23 May 2016 17:41:24 -0400 In-Reply-To: <87r3ctalx7.fsf@gmx.us> (rasmus@gmx.us's message of "Sun, 22 May 2016 22:16:04 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Rasmus Cc: emacs-orgmode@gnu.org Hello, Rasmus writes: > With the attached patch ox-latex seems to behave in this way. Thank you. Some comments follow. > Though perhaps there=E2=80=99s 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 . 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 in= fo)) > + (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=3D 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=3D 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}"=20 (org-trim (org-export-data def info)) (org-latex--label def info t t)) ? Regards, --=20 Nicolas Goaziou