Hi

On 17/04/2024 21:32, Alexander Gogl wrote:
Dear Ihor,

thank's for your advice! Here is the updated patch. Now it works.

......................................................................
ox-latex: New option to customize LaTeX footnote command

Some LaTeX classes define their own footnote commands. For example,
kaobook
(https://github.com/fmarotta/kaobook/blob/master/example_and_documentation.pdf)
has \footnotes and \sidenotes, whereby sidenotes (notes are put into the
outter margin) are the dominant form of putting notes in kaobook. It
would be great if you could make the footnote command in the footnote
function customizable. My proposal is in the attachment.
......................................................................




Best

Alexander

PS: I have a hard time to setup an environment to test the patch because
my Spacemacs configuration conflicts with the Org mode development
version. Can anyone provide me a link to a ressource that describes the
procedure?

Ihor Radchenko <[email protected]> --- 2024-04-17 Mi 16:21:

Alexander Gogl <[email protected]> writes:

I completed the patch (see attachment). Please let me know if I made any 
mistake in the patch or if I should send the patch to another E-Mail-Address.

Thanks! We use Org mailing list (public) to send patches and discuss Org
mode development.

I added Org mailing list to CC in this email.
You can simply use "Reply All" to send the next version of the patch.

Reason for patch

Some LaTeX classes define their own footnote commands. For example, kaobook
(https://github.com/fmarotta/kaobook/blob/master/example_and_documentation.pdf)
has \footnotes and \sidenotes, whereby sidenotes (notes are put into the
outter margin) are the dominant form of putting notes in kaobook. It would be
great if you could make the footnote command in the footnote function
customizable. My proposal is in the attachment.

You can put this description in the commit message.
Also, if you can, please add changelog entries, as described in
https://orgmode.org/worg/org-contribute.html#commit-messages

Subject: [PATCH] added option to customize latex footnote command in export

What about

ox-latex: New option to customize LaTeX footnote command

My version (1) clearly states which library the patch is changing; (2)
Uses imperative tone as we usually do in commit messages.

+*** 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}~).

We use "Org mode" to name Org mode.
Also, we fill the text to default `fill-column' value of 70.

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

May you explain the purpose of this TODO?

+    (:latex-default-footnote-command "\\footnote{%s%s}" nil 
org-latex-default-footnote-command)

"\\footnote{%s%s}" makes no sense in this context. The format of export
options is described in the docstring of `org-export-options-alist':

     The key of the alist is the property name, and the value is a list
     like (KEYWORD OPTION DEFAULT BEHAVIOR) where:
KEYWORD is a string representing a buffer keyword, or nil.
     OPTION is a string that could be found in an #+OPTIONS: line.
     DEFAULT is the default value for the property.
     BEHAVIOR determines how Org should handle multiple keywords for

You placed "\\footnote{%s%s}" in KEYWORD slot, which is not right.
KEYWORD slot is what defines how to set the value locally. For example,
"AUTHOR" in (:author "AUTHOR" nil user-full-name parse) means that
:author export option can be set as

#+AUTHOR: value

+(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."

Please explain what is the meaning of each %s in the value in the
docstring.

Also, please re-fill the docstring to avoid long lines.

+  :group 'org-export-latex
+  :version "24.4"  ;; FIXME enter correct version

:version is not needed. It is obsolete keyword we no longer use in the
new customizations.


Seems to have been applied. Not closed in BARK...

--
Pedro A. Aranda
ox-latex & ox-beamer maintainer

Sagen's Paradeiser! (ORF: Als Radiohören gefährlich war) => write BE!
IA: onomatopeya del rebuzno
2nd year of the New Koprocracy


Reply via email to