From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [patch] more robust footnotes Date: Tue, 24 May 2016 23:54:13 +0200 Message-ID: <87d1ob86m2.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> <87bn3w8nba.fsf@saiph.selenimh> <87k2ij895o.fsf_-_@gmx.us> <87h9dn87nn.fsf@saiph.selenimh> <87eg8r6srw.fsf@gmx.us> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5KHT-0006WI-Mf for emacs-orgmode@gnu.org; Tue, 24 May 2016 17:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5KHP-0006yO-Iq for emacs-orgmode@gnu.org; Tue, 24 May 2016 17:54:26 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:58868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5KHP-0006xw-Be for emacs-orgmode@gnu.org; Tue, 24 May 2016 17:54:23 -0400 In-Reply-To: <87eg8r6srw.fsf@gmx.us> (rasmus@gmx.us's message of "Tue, 24 May 2016 23:38:27 +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 Rasmus 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,