emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG] Footnotes in section titles


From: Ihor Radchenko
Subject: [BUG] Footnotes in section titles
Date: Wed, 24 Jan 2024 12:11:21 +0000

Eric Anderson <kluwak@gmail.com> writes:

> The resulting LaTeX code (also attached) uses \footnote inside \section and
> \paragraph macros, producing compiler errors.  A little googling turns up
> the following comp.text.tex usenet post
> https://comp.text.tex.narkive.com/lkZWQYaS/using-footnotes-in-paragraph,
> explaining that \footnote is fragile and cannot be used in those contexts
> without \protect.  Manually adding \protect before \footnote in the
> automatically-generated tex file appears to produce correct results.
>
> I don't know if the best fix is to always \protect \footnotes in LaTeX
> export, or if more contextual smarts are required, but this seems like an
> issue worth addressing.

Confirmed.

\protect is not a good idea. There is a reason why LaTeX refuses
footnotes in titles - titles can appear in multiple places in the
document (TOC, page footer, etc) and thus references to the footnotes
are non-deterministic.

https://texfaq.org/FAQ-ftnsect suggests to use
\usepackage[stable]{footmisc}
or to pass optional argument to \section without footnote
\section[title]{title\footnote{title ftnt}}

The footmisc package is a nice solution, but it has certain requirements
about loading order. In particular, it must be loaded after certain
packages (setspace, memoir). We cannot yet control the \usepackage
ordering in LaTeX preamble and always place default LaTeX packages first
- something we cannot do for footmisc.

The \section[...]{...} approach may work, but it is tricky - it is
completely up to the `org-latex-classes'. So, we may have to use regexp
replacement, which might be fragile.

So, I prefer the first approach with footmisc. But we can only do it
after Timothy's patch introducing more flexible templating system is
landed.

CCing Timothy.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]