TL;DR: Is there a package that allows writing the
text of a footnote after the position where the
mark should be inserted? Note that I'm asking
about positioning of source code, not about
positioning of the note in the output document.
When writing LaTeX I find the inline character of
footnote source somewhat distracting.
This is some text\footnote{That for
whatever reason contains a long
footnote. The main text becomes split
apart} so far that it is barely readable.
Doing tricks with newlines like
This is some text\footnote{
That for whatever reason contains a long
footnote. The main text becomes split
apart}
so far that it is barely readable.
Also helps only so much. I'd much prefer to write
This is some text\fn{1} that contains a
couple\fn{2} footnotes yet remain readable.
\text{1}{Here is the text of the first
footnote, conveniently readable while reading
the main source, yet not disrupting it.}
\text{2}{-/2}
I know that some tricks are possible with
\footnotemark
and \footnotetext
. When having
more than one footnote in a paragraph however this
would require manually changing the footnote
counter, which is too inconvenient to make this a
sensible alternative. Also if I'm not mistaken, it
carries the risk of causing footnotes to be
displayed on the wrong page, when the paragraph
stretches to the next page but the \footnotemark
is in text on the current page.
+---------------+ +---------------+
|... | |end of the page|
| | |... |
| | | |
|some text with²| |————— |
|footnote on the| |²The FNText |
+---------------+ +---------------+
Is there maybe some package that automates such a
style?
As a quick hack I sometimes used constructs like
\def\fnlater#1#2{\def#1{\footnote{#2}}}
...
\fnlater\myfnI{The footnote text must be
defined before the paragraph.}
...
Here is some textparagraph\myfnI that refers
to the previously defined footnote.
Sadly this custom solution has two major flaws:
-
It requires defining the footnote before
using it, while intuitively footnotes are expected
after the surrounding text. -
It should cause a compilation error, when the
footnote is accidentially used twice. -
It should also cause a compilation error, when
the footnote isn't used at all.
Since I don't think that these issues are easily
fixed, especially the requirement to define the
footnote before the surrounding text, using custom
hacks is undesireable.
If such a package exists for LaTeX, availability of a
corresponding module for LyX would be even better.
As a minimal compileable example put any of these
code examples into a skeleton
\documentclass{article}
\begin{document}
...
\end{document}
Best Answer
I managed to put this together.
It only allows clear text in the footer, but apart from thatit should do all you wanted. No error is raised if a label is undefined, however, as that would give an error every time a new footnote is added.Edit: Now it supports formatting thanks to
\detokenize
:DFootnotes are defined anywhere in the document with
\definefootnote{label}{footnotetext}
and used anywhere else in the document with\usefootnote{label}
.