Menu

#182 An implementation of --latex-footnotes

None
closed-accepted
nobody
None
5
2026-05-29
2021-06-18
No

Attached is a patch that implements the --latex-footnotes option for 99% of use cases. I don't know whether you'd find it satisfactory enough to accept, but I thought I'd at least try.

Shortcomings of this implementation:

  • Footnotes aren't hyperlinked back to their references. I am not aware of a way to solve this without basically reimplemeting docutils-footnotes.

  • Recursive footnotes are not supported and will cause a recursion error. Support would require tracking and referencing (à la https://tex.stackexchange.com/a/23158/) the number that LaTeX assigns to each footnote, which normally resets on chapters and would be broken by packages like footmisc and perpage.

  • If the same footnote is referenced multiple times, it will be treated as a new footnote each time. I believe this has the same solution as the above.

  • If a footnote contains two or more nested footnotes, the numbering will be messed up; see https://tex.stackexchange.com/q/38643/ for a way to address this.

1 Attachments

Discussion

  • John Thorvald Wodder II

    Update: I've realized that the submitted patch does not correctly handle chained footnotes, so I've modified it to fix that (with a test case, of course).

     
  • Günter Milde

    Günter Milde - 2021-06-26

    Thank you for sharing the patch. See the updated comment in the latex writer source and todo.txt for open questions.

    For additional footnote marks, I'd use the \footref command (package scrextend rsp. part of
    LaTeX since 2021-05-01).

    For hyperlinks, hyperref's "hyperfootnotes" option and/or the "footnotebackref" package may help.

    We may also consider to use a "footnote queue" with "docutils footnotes", too to write the \DUfootnotetext at the earliest possible moment to keep footnotes on the same page as the footnote mark: either immediately after the \DUfootnotemark or after closing a problematic command or environment (heading, table, ...).

     
  • Günter Milde

    Günter Milde - 2026-05-01
    • status: open --> open-accepted
     
  • Günter Milde

    Günter Milde - 2026-05-01

    The patch is commited in [r10314]. The commits up to [r10322] take care of 99% of the remaining 1% problematic cases and document the changes and limitations.

     

    Related

    Commit: [r10314]
    Commit: [r10322]

  • Günter Milde

    Günter Milde - 2026-05-29
    • status: open-accepted --> closed-accepted
     
  • Günter Milde

    Günter Milde - 2026-05-29

    "LaTeX footnotes" are supported in Docutils 0.23.
    I applied the patch and did some heavy testing and refactoring later.
    Note that this is still provisional and needs more "road testing".

    Docutils does not handle all cases where standard LaTeX does not support footnotes in special places (like headings, inside tables, ...) as there are different solutions out in optional LaTeX packages and we don't want to force one special approach or dependency on authors.

     

Log in to post a comment.