sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.64k stars 96 forks source link

footnotes in section headers (minor) #1287

Open Omikhleia opened 2 years ago

Omikhleia commented 2 years ago

I know footnotes in sectioning commands are at the best "controversial", and known even to behave weirdly in LaTeX (where it is also likewise problematic for table and figure captioning and the lists of figures/tables)

So one might admittedly argue that it is somewhat bad to have footnote in section headers, but you know... authors...

FWIW, if it occurs in SILE 0.12,

In LibreOffice, the footnotes from headers do not appear in the TOC. I haven't tried with MS-Word, but I assume most "modern" users to expect the footnotes to vanish in these cases, indeed.

It would be easy to "kill" the footnote command while processing the TOC and restore it afterwards. That might be a very general solution (to all possible weird things an author would want to put in their section titles), but would minimally do the trick (I did that in my own "styled-enabled TOC" re-implementation work in progress, and likewise for the lists of figures and tables I am working on).

Not sure it is the proper way to go, though ;)

EDIT: Beyond the TOC issues, one may also wonder what happens to footnotes if these sections are pushed to page headers. Haven't tried that yet. EDIT2: Just did it and it was messy too (at least in my headers implementation). Went on to kill the command temporarily there too...

alerque commented 2 years ago

I've had to implement this before, I'll try to dig up the project that used it. I believe I did content filtering of some kind.

Omikhleia commented 2 years ago

For the record, also impacting the TOC stuff even more with #1350

As noted there, other commands might need to be filtered in various contexts, so what I used in my attempt as an "ad-hoc" workaround, that is to kill the command (i.e. temporarily redefine it to an empty function), is unlikely the proper solution and we may need something more general.