From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id WDsLIGklIGaYVgAA62LTzQ:P1 (envelope-from ) for ; Wed, 17 Apr 2024 21:39:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id WDsLIGklIGaYVgAA62LTzQ (envelope-from ) for ; Wed, 17 Apr 2024 21:39:21 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=FuDZr+AF; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1713382761; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=gImrpKq2+1BW0itfdMB8ro42fbVnLmrONI6vo3L3Ssc=; b=n8fPnAG5wn9WZkalJc7L8gY7Xl9voPeujF0bWZTfyMrzUX4pUKxlLld2UZ7FGcUv+8x/oB p5cSq+7DJx+ib7QD6aBq97guJvvb7QnZlgk03kdIJT9oP1EW5/iEnbV6LmaYnM1lpeKfg2 XIqWjKeB6CjSZVLsW0VxcPfvNGB1WJfqhDOXU7K2OCyuq+XgB6l7gD1D3n3t/Ub9ALGhdB fLrgEEClr/knTozzqRIz+JTURtR0GrcG6wJW+rRnZL4wb0GEK7JSfOagk/wv+mIX+rjqbA YlXiWyoPhkJrk9XdZZm5mP5zrkHJlmKv81FSESmafhKC0IkU7fheutKMZJdcIg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1713382761; a=rsa-sha256; cv=none; b=tIfXXBw2el1VsUC5DLG9JPAEqdvX+n7dMo0zSqO5HLt6dfXtRVbOjbeN1BiWWhx0pY7Wfn odDVp90V4NiS/kY42neybFqsuyWpp33IStvEq8XYhaG0fcZX8plroEWySrx7dO5jbbrwT3 HtzedzBHBiOqLee52dAWwC4ZF3Dc3Wn1KGxKMwx5K4175YkeHWTPFq6ZhiYp4kI1dPwPXI udiS25cC6U4eP1ZaPscUFgXPGh3LDqPvCuy5C3ocr7sM78apePMCAnNdwUzYGuEw538mcU So7tl7Wc+sL/mmkufuZ/3/xOsm6g1LYQnfHcXnTjC0+nBtCc1BYYfC3DbJ2QsA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=FuDZr+AF; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gmail.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 35EC565ABD for ; Wed, 17 Apr 2024 21:39:21 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rxB72-0006da-6K; Wed, 17 Apr 2024 15:38:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rxB70-0006dO-JO for emacs-orgmode@gnu.org; Wed, 17 Apr 2024 15:38:30 -0400 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rxB6x-0003hL-VN for emacs-orgmode@gnu.org; Wed, 17 Apr 2024 15:38:30 -0400 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-516ef30b16eso31432e87.3 for ; Wed, 17 Apr 2024 12:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713382705; x=1713987505; darn=gnu.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=gImrpKq2+1BW0itfdMB8ro42fbVnLmrONI6vo3L3Ssc=; b=FuDZr+AFNqWK7hDB6V4I+Cy56iaiu2KNCV3JJwHZAAUS1xsCfhW0lVemLhJo2RzHMa jbbovwJLtfawkL+W8pMdXNR1qsXJIze8ox/kpL8I/tSk9i4yxPrh/nKkEMbMlN5ZT6UQ CCMbkC49NoT+DFz78B1d/P0po3mCap12dE/bZIRkfxwdbJvQzfn8L1ztmi26eI+50tS5 /loJLImbExzXm7EsmfcmlZSa8w9GN6HPBjZ17VyVL8tbJ01+irHUKzqyK6pGw5eo67Ao 3IuLtlR7g+/ng8qf4Y9Zq3rHabiNvXpO+nXYnknLXX47OcUGZwL1jr0z3edEPjdxNzKM kZVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713382705; x=1713987505; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=gImrpKq2+1BW0itfdMB8ro42fbVnLmrONI6vo3L3Ssc=; b=P0HX/HjSxqWQo7GHWVSdNWulIZlcPZwmiRNMjGlqroemIUvdVoZSL8DoVDkGkC4Lp9 RS4o/BYmJ4RBriVUdcknVL+/AbHUUb1623hNDMfab42qDhoPoZKm5ku/ANWtiJakyPkG r3f0t2JqjoPwloyhLLYZuPQUZ1DaKYn2YJ91B3ng2D9jKVDToDv7k8VM0b+QWxE+nJhs 91JiwG2XRHNatzuLzgci7DEUl0zjJa5nr5cwYxxaO+FeCYw39Ckvo2liy1U6p0h+QVsH qz0e/lze8OMk8btomDc4tgH0xPwOM3lBSqRpF+TaLgmdknSDWGpVM+mZH96Cs+33V7aj cELw== X-Gm-Message-State: AOJu0YzgOHkucUZxyZlhrbq16jFnYS4qqxOsbhLqRDv/gdDLqJcyjAZJ cXuVfd/qXq//USyfC4xXu+PZ6ApC9r8ISlqDQjSUmC/r+Ff4f4h60mHxSw== X-Google-Smtp-Source: AGHT+IFmqwFpm7GzHcu8TCCdHC+4fqlnWxMeJ1qOKF80UbZdPLRxgm19RZStX0UTi9C7FzPtlluH2A== X-Received: by 2002:ac2:4247:0:b0:518:b865:eab4 with SMTP id m7-20020ac24247000000b00518b865eab4mr134640lfl.60.1713382704353; Wed, 17 Apr 2024 12:38:24 -0700 (PDT) Received: from ago-mbp-uni.local (213162081018.public.t-mobile.at. [213.162.81.18]) by smtp.gmail.com with ESMTPSA id lb10-20020a170906adca00b00a526fd6362asm3951776ejb.117.2024.04.17.12.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 12:38:23 -0700 (PDT) References: <87sf4cbary.fsf@localhost> <87y1chwmut.fsf@localhost> <875xzig0jy.fsf@localhost> <87o7a8arjt.fsf@localhost> User-agent: mu4e 1.10.8; emacs 30.0.50 From: Alexander Gogl To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [FR] Please add custom command variable to org-latex-footnote-reference Date: Wed, 17 Apr 2024 21:32:02 +0200 In-reply-to: <87o7a8arjt.fsf@localhost> X-Mailer: mu4e 1.10.8; emacs 30.0.50 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=gogl.alexander@gmail.com; helo=mail-lf1-x12f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -9.68 X-Spam-Score: -9.68 X-Migadu-Queue-Id: 35EC565ABD X-Migadu-Scanner: mx13.migadu.com X-TUID: xarK7hmhK2a6 --=-=-= Content-Type: text/plain 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. ...................................................................... --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-added-option-to-customize-latex-footnote-command-in-.patch >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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0002-ox-latex-New-option-to-customize-LaTeX-footnote-comm.patch >From 12d211a5f0c56faf1b829fef26f788f210a31382 Mon Sep 17 00:00:00 2001 From: Alexander Gogl Date: Wed, 17 Apr 2024 21:22:51 +0200 Subject: [PATCH 2/2] ox-latex: New option to customize LaTeX footnote command * lisp/ox-latex.el (org-export-define-backend): Add option. (org-latex-default-footnote-command): New custom variable. (org-latex-footnote-reference): Replace string "\\footnote{%s%s}" with custom variable. * etc/ORG-NEWS (New and changed options): Add description to option. 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. Modified from a feature request by Alexander Gogl. TINYCHANGE --- etc/ORG-NEWS | 12 ++++++++++-- lisp/ox-latex.el | 12 ++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index a579260f5..571ab3c98 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -999,9 +999,17 @@ 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~ +*** New option ~latex-default-footnote-command~ to customize the LaTeX footnote command -This new option allows you to define the LaTeX command the org-mode footnotes are converted to (for example ~\\sidenote{%s%s}~). +This new option allows you to define the LaTeX command the Org mode +footnotes are converted to (for example ~\sidenote{%s%s}~ instead of +the default ~\footnote{%s%s}~). + +The option can be customized either by + +a) setting the global variable in the ~org-export-latex~ customization + group or +b) by setting the file local variable ~LATEX_FOOTNOTE_COMMAND~ ** New features *** =colview= dynamic block now writes column width specifications diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index b45d13ca2..058b5a31a 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -135,9 +135,7 @@ (: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-default-footnote-command "LATEX_FOOTNOTE_COMMAND" nil org-latex-default-footnote-command t) (: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) @@ -672,9 +670,11 @@ The function result will be used in the section format string." (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." + Customize this command if the LaTeX class provides a different + command like `\sidenote{%s%s}' that you want to use. +%s +" :group 'org-export-latex - :version "24.4" ;; FIXME enter correct version :package-version '(Org . "9.7") :type 'string) @@ -2249,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 org-latex-default-footnote-command (org-trim (org-export-data def info)) + (format (plist-get info :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 --=-=-= Content-Type: text/plain 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 --- 2024-04-17 Mi 16:21: > Alexander Gogl 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. --=-=-=--