From 1c7bee53ac91a8296c144f157ab8646b1a7a6595 Mon Sep 17 00:00:00 2001 From: Alexander Gogl Date: Wed, 17 Apr 2024 16:00:41 +0200 Subject: [PATCH 1/2] added option to customize latex footnote command in export --- etc/ORG-NEWS | 4 ++++ lisp/ox-latex.el | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index e61bd6988..a579260f5 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -999,6 +999,10 @@ even though it does not have its own ID. By giving files top-level id properties, links to headlines in the file can also be made more robust by using the file id instead of the file path. +*** New option ~latex-default-footnote-command~ + +This new option allows you to define the LaTeX command the org-mode footnotes are converted to (for example ~\\sidenote{%s%s}~). + ** New features *** =colview= dynamic block now writes column width specifications diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index 5c19e1fe7..b45d13ca2 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -135,6 +135,9 @@ (:latex-default-table-environment nil nil org-latex-default-table-environment) (:latex-default-quote-environment nil nil org-latex-default-quote-environment) (:latex-default-table-mode nil nil org-latex-default-table-mode) + ;; TODO implement options variable + (:latex-default-footnote-command "\\footnote{%s%s}" nil org-latex-default-footnote-command) + ;; (:latex-diary-timestamp-format nil nil org-latex-diary-timestamp-format) (:latex-engraved-options nil nil org-latex-engraved-options) (:latex-engraved-preamble nil nil org-latex-engraved-preamble) @@ -667,6 +670,14 @@ The function result will be used in the section format string." ;;;; Footnotes +(defcustom org-latex-default-footnote-command "\\footnote{%s%s}" + "Default command used to insert footnotes. + Customize this command if the LaTeX class provides a different notation command like `\\sidenote{%s%s}' that you want to use." + :group 'org-export-latex + :version "24.4" ;; FIXME enter correct version + :package-version '(Org . "9.7") + :type 'string) + (defcustom org-latex-footnote-separator "\\textsuperscript{,}\\," "Text used to separate footnotes." :group 'org-export-latex @@ -780,7 +791,6 @@ default we use here encompasses both." :group 'org-export-latex :type 'string) - ;;;; Tables (defcustom org-latex-default-table-environment "tabular" @@ -2239,7 +2249,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." (t (let ((def (org-export-get-footnote-definition footnote-reference info))) (concat - (format "\\footnote{%s%s}" (org-trim (org-export-data def info)) + (format org-latex-default-footnote-command (org-trim (org-export-data def info)) ;; Only insert a \label if there exist another ;; reference to def. (cond ((not label) "") -- 2.41.0