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.
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).
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 ofLaTeX 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, ...).