org-e-latex: Allow previously definied footnotes in item tag
* contrib/lisp/org-e-latex.el (org-e-latex-footnote-reference): Allow previously definied footnotes in item tag.
This commit is contained in:
parent
e8aafa3337
commit
fca0169147
|
@ -1279,25 +1279,26 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
(when (eq (org-element-type prev) 'footnote-reference)
|
(when (eq (org-element-type prev) 'footnote-reference)
|
||||||
org-e-latex-footnote-separator))
|
org-e-latex-footnote-separator))
|
||||||
(cond
|
(cond
|
||||||
|
;; Use \footnotemark if reference is within an item's tag. Since
|
||||||
|
;; we can't specify footnote number as an optional argument within
|
||||||
|
;; an item tag, juggle with footnote counter to achieve the same
|
||||||
|
;; result.
|
||||||
|
((eq (org-element-type (org-export-get-parent-element footnote-reference))
|
||||||
|
'item)
|
||||||
|
(let ((num (org-export-get-footnote-number footnote-reference info)))
|
||||||
|
(format "\\setcounter{footnote}{%s}\\footnotemark\\setcounter{footnote}{%s}"
|
||||||
|
(1- num) num)))
|
||||||
;; Use \footnotemark if the footnote has already been defined.
|
;; Use \footnotemark if the footnote has already been defined.
|
||||||
((not (org-export-footnote-first-reference-p footnote-reference info))
|
((not (org-export-footnote-first-reference-p footnote-reference info))
|
||||||
(format "\\footnotemark[%s]{}"
|
(format "\\footnotemark[%s]{}"
|
||||||
(org-export-get-footnote-number footnote-reference info)))
|
(org-export-get-footnote-number footnote-reference info)))
|
||||||
;; Use also \footnotemark if reference is within another footnote
|
;; Use \footnotemark if reference is within another footnote
|
||||||
;; reference or footnote definition.
|
;; reference or footnote definition.
|
||||||
((loop for parent in (org-export-get-genealogy footnote-reference)
|
((loop for parent in (org-export-get-genealogy footnote-reference)
|
||||||
thereis (memq (org-element-type parent)
|
thereis (memq (org-element-type parent)
|
||||||
'(footnote-reference footnote-definition)))
|
'(footnote-reference footnote-definition)))
|
||||||
(let ((num (org-export-get-footnote-number footnote-reference info)))
|
(let ((num (org-export-get-footnote-number footnote-reference info)))
|
||||||
(format "\\footnotemark[%s]{}\\setcounter{footnote}{%s}" num num)))
|
(format "\\footnotemark[%s]{}\\setcounter{footnote}{%s}" num num)))
|
||||||
;; Use also \footnotemark if reference is within an item's tag.
|
|
||||||
;; Note: this won't work if reference has already been defined
|
|
||||||
;; since we cannot specify footnote number through square
|
|
||||||
;; brackets, forbidden in an optional argument.
|
|
||||||
((eq (org-element-type (org-export-get-parent-element footnote-reference))
|
|
||||||
'item)
|
|
||||||
(format "\\footnotemark\\setcounter{footnote}{%s}"
|
|
||||||
(org-export-get-footnote-number footnote-reference info)))
|
|
||||||
;; Otherwise, define it with \footnote command.
|
;; Otherwise, define it with \footnote command.
|
||||||
(t
|
(t
|
||||||
(let ((def (org-export-get-footnote-definition footnote-reference info)))
|
(let ((def (org-export-get-footnote-definition footnote-reference info)))
|
||||||
|
|
Loading…
Reference in New Issue