The Endnotes Package: John Lavagnino 2020-01-02
The Endnotes Package: John Lavagnino 2020-01-02
John Lavagnino∗†
2020-01-02
Based on the footnotes section of LATEX.TEX (version 2.09 – release of 19 April 1986),
with “footnote” changed to “endnote” and “fn” changed to “en” (where appropriate),
with all the minipage stuff pulled out, and with some small changes for the different
operation of endnotes. Subsequently updated to follow the code for LATEX 2ε 〈2000/06/01〉.
Uses an extra external file, with .ent extension, to hold the text of the endnotes. This
may be deleted after the run; a new version is generated each time—it doesn’t require
information collected from the previous run.
This code does not obey \nofiles. Perhaps it should.
1 Change log
JL – Modified to include \addtoendnotes. JL, 10/22/89.
JK – Modification by Jörg Knappen 25. 2. 1991:
Introduced \notesname in the spirit of international LATEX. \notesname is set
per default to be {Notes}, but can easily be redifined, e. g. for german language
\renewcommand{\notesname}{Anmerkungen}
∗
Centre for Computing in the Humanities, King’s College London
†
Now Maintained by the LATEX3 project, https://github.com/rf-latex/endnotes
1
DW – Modification by Dominik Wujastyk, London, 19 September 1991:
Moved the line
\edef\@currentlabel{\csname p@endnote\endcsname\@theenmark}
out of the definition of \@endnotetext and into the definition of \@doanenote
so that \label and \ref commands work correctly in endnotes. Otherwise,
the \label just pointed to the last section heading (or whatever) preceding the
\theendnotes command.
2
Do not break but just warn if \theendnotes is used, but no endnotes have been
inserted yet.
If the last remaining \endnote is removed, clear the *.ent auxiliary file.
2 Endnote commands
\endnote{〈note〉} : User command to insert a endnote.
\theenmark : Holds the current endnote’s mark—e. g., † or ‘1’ or ‘a’. (You don’t
want to set this yourself, as it comes either from the autonum-
bering of notes or from the optional argument to \endnote. But
you’ll need to use it if you define your own \makeenmark.)
\makeenmark : A macro to generate the endnote marker from \theenmark. The
default definition is \hbox{$^\theenmark$}.
\@makeentext{〈note〉} : Must produce the actual endnote, using \theenmark as the mark
of the endnote and 〈note〉 as the text. It is called when effectively
inside a \parbox, with \hsize = \columnwidth. For example,
it might be as simple as $^{\theenmark}$␣〈note〉
3
4 Endnote pseudocode
\endnote{NOTE} ==
BEGIN
\stepcounter{endnote}
\@theenmark :=G eval (\theendnote)
\@endnotemark
\@endnotetext{NOTE}
END
\endnote[NUM]{NOTE} ==
BEGIN
begingroup
counter endnote :=L NUM
\@theenmark :=G eval (\theendnote)
endgroup
\@endnotemark
\@endnotetext{NOTE}
END
\@endnotetext{NOTE} ==
BEGIN
write to \@enotes file: "\@doanenote{ENDNOTE MARK}"
begingroup
\next := NOTE
set \newlinechar for \write to \space
write to \@enotes file: \meaning\next
(that is, "macro:->NOTE)
endgroup
END
\addtoendnotes{TEXT} ==
BEGIN
open endnotes file if not already open
begingroup
let \protect to \string
set \newlinechar for \write to \space
write TEXT to \@enotes file
endgroup
END
\endnotemark ==
BEGIN \stepcounter{endnote}
\@theenmark :=G eval(\theendnote)
4
\@endnotemark
END
\endnotemark[NUM] ==
BEGIN
begingroup
endnote counter :=L NUM
\@theenmark :=G eval(\theendnote)
endgroup
\@endnotemark
END
\@endnotemark ==
BEGIN
\leavevmode
IF hmode THEN \@x@sf := \the\spacefactor FI
\makeenmark % put number in main text
IF hmode THEN \spacefactor := \@x@sf FI
END
\endnotetext ==
BEGIN \@theenmark :=G eval (\theendnote)
\@endnotetext
END
\endnotetext[NUM] ==
BEGIN begingroup counter endnote :=L NUM
\@theenmark :=G eval (\theendnote)
endgroup
\@endnotetext
END