summaryrefslogtreecommitdiff
path: root/macros/generic/misc/endnote.tex
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/misc/endnote.tex
Initial commit
Diffstat (limited to 'macros/generic/misc/endnote.tex')
-rw-r--r--macros/generic/misc/endnote.tex36
1 files changed, 36 insertions, 0 deletions
diff --git a/macros/generic/misc/endnote.tex b/macros/generic/misc/endnote.tex
new file mode 100644
index 0000000000..6ca4cd8df9
--- /dev/null
+++ b/macros/generic/misc/endnote.tex
@@ -0,0 +1,36 @@
+% Use \endnote{1}{text}. At the end of your document, type
+% \producenotes to actually flush all end notes to be printed.
+%
+% macros for making endnotes instead of footnotes
+% We make @ signs act like letters, temporarily, to avoid conflict
+% between user names and internal control sequences of plain format.
+\catcode`@=11
+\newbox\endnotebox
+\def\setendnotefont#1{\gdef\endnotefont{#1}}
+\setendnotefont{\rm}
+\def\endnote#1{\let\@sf\empty
+ \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi
+ #1\@sf\vendnote{{#1}}}
+\def\vendnote#1{\global\setbox\endnotebox=
+ \vbox{\parindent=0pt\endnotefont\unvbox\endnotebox\bgroup
+ \indent\llap#1\ignorespaces\futurelet\next\aftergroup\no@te\relax}}
+\def\no@te{\ifcat\bgroup\noexpand\next \let\next\n@@te
+ \else\let\next\n@t\fi \next}
+\def\n@@te{\bgroup\aftergroup\@endnote\let\next}
+\def\n@t#1{#1\@endnote}
+\def\@endnote{\strut\egroup}
+%
+\newcount\enotecounter
+\def\resetenotecount{\global\enotecounter=0 } \resetenotecount
+\def\setenotecount#1{\global\enotecounter=#1 }
+%
+\def\setendnoteflagfont#1{\gdef\endnoteflagfont{#1}}
+\setendnoteflagfont{\sevenrm}
+\def\enote{\unskip
+ \global\advance \enotecounter by 1 % First bump the counter.
+ % Now convert the current value of the counter into a superscripted numeral
+ \endnote{{$^{\hbox{\endnoteflagfont\the\enotecounter}}$}}}
+%
+\def\producenotes{%
+\ifvoid\endnotebox\else\medskip\unvbox\endnotebox\par\fi}
+\catcode`@=12 % at signs are no longer letters