
meillo@54: %%% hyperendnotes.sty
meillo@54: \makeatletter
meillo@54: \newif\ifenotelinks
meillo@54: \newcounter{Hendnote}
meillo@54: % Redefining portions of endnotes-package:
meillo@54: \let\savedhref\href
meillo@54: \let\savedurl\url
meillo@54: \def\endnotemark{%
meillo@54: \@ifnextchar[\@xendnotemark{%
meillo@54: \stepcounter{endnote}%
meillo@54: \protected@xdef\@theenmark{\theendnote}%
meillo@54: \protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54: \@endnotemark
meillo@54: }%
meillo@54: }%
meillo@54: \def\@xendnotemark[#1]{%
meillo@54: \begingroup\c@endnote#1\relax
meillo@54: \unrestored@protected@xdef\@theenmark{\theendnote}%
meillo@54: \unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54: \endgroup
meillo@54: \@endnotemark
meillo@54: }%
meillo@54: \def\endnotetext{%
meillo@54: \@ifnextchar[\@xendnotenext{%
meillo@54: \protected@xdef\@theenmark{\theendnote}%
meillo@54: \protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54: \@endnotetext
meillo@54: }%
meillo@54: }%
meillo@54: \def\@xendnotenext[#1]{%
meillo@54: \begingroup
meillo@54: \c@endnote=#1\relax
meillo@54: \unrestored@protected@xdef\@theenmark{\theendnote}%
meillo@54: \unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54: \endgroup
meillo@54: \@endnotetext
meillo@54: }%
meillo@54: \def\endnote{%
meillo@54: \@ifnextchar[\@xendnote{%
meillo@54: \stepcounter{endnote}%
meillo@54: \protected@xdef\@theenmark{\theendnote}%
meillo@54: \protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54: \@endnotemark\@endnotetext
meillo@54: }%
meillo@54: }%
meillo@54: \def\@xendnote[#1]{%
meillo@54: \begingroup
meillo@54: \c@endnote=#1\relax
meillo@54: \unrestored@protected@xdef\@theenmark{\theendnote}%
meillo@54: \unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54: \show\@theenvalue
meillo@54: \endgroup
meillo@54: \@endnotemark\@endnotetext
meillo@54: }%
meillo@54: \def\@endnotemark{%
meillo@54: \leavevmode
meillo@54: \ifhmode
meillo@54: \edef\@x@sf{\the\spacefactor}\nobreak
meillo@54: \fi
meillo@54: \ifenotelinks
meillo@54: \expandafter\@firstofone
meillo@54: \else
meillo@54: \expandafter\@gobble
meillo@54: \fi
meillo@54: {%
meillo@54: \Hy@raisedlink{%
meillo@54: \hyper@@anchor{Hendnotepage.\@theenvalue}{\empty}%
meillo@54: }%
meillo@54: }%
meillo@54: \hyper@linkstart{link}{Hendnote.\@theenvalue}%
meillo@54: \makeenmark
meillo@54: \hyper@linkend
meillo@54: \ifhmode
meillo@54: \spacefactor\@x@sf
meillo@54: \fi
meillo@54: \relax
meillo@54: }%
meillo@54: \long\def\@endnotetext#1{%
meillo@54: \if@enotesopen
meillo@54: \else
meillo@54: \@openenotes
meillo@54: \fi
meillo@54: \immediate\write\@enotes{%
meillo@54: \@doanenote{\@theenmark}{\@theenvalue}%
meillo@54: }%
meillo@54: \begingroup
meillo@54: \def\next{#1}%
meillo@54: \newlinechar='40
meillo@54: \immediate\write\@enotes{\meaning\next}%
meillo@54: \endgroup
meillo@54: \immediate\write\@enotes{%
meillo@54: \@endanenote
meillo@54: }%
meillo@54: }%
meillo@54: \def\theendnotes{%
meillo@54: \immediate\closeout\@enotes
meillo@54: \global\@enotesopenfalse
meillo@54: \begingroup
meillo@54: \makeatletter
meillo@54: \edef\@tempa{`\string>}%
meillo@54: \ifnum\catcode\@tempa=12
meillo@54: \let\@ResetGT\relax
meillo@54: \else
meillo@54: \edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}%
meillo@54: \@makeother\>%
meillo@54: \fi
meillo@54: \def\@doanenote##1##2##3>{%
meillo@54: \def\@theenmark{##1}%
meillo@54: \def\@theenvalue{##2}%
meillo@54: \par
meillo@54: \smallskip %<-small vertical gap between endnotes
meillo@54: \begingroup
meillo@54: \def\href{\expandafter\savedhref}%
meillo@54: \def\url{\expandafter\savedurl}%
meillo@54: \@ResetGT
meillo@54: \edef\@currentlabel{\csname p@endnote\endcsname\@theenmark}%
meillo@54: \enoteformat
meillo@54: }%
meillo@54: \def\@endanenote{%
meillo@54: \par\endgroup
meillo@54: }%
meillo@54: % Redefine, how numbers are formatted in the endnotes-section:
meillo@54: \renewcommand*\@makeenmark{%
meillo@54: \hbox{\normalfont\@theenmark~}%
meillo@54: }%
meillo@54: % header of endnotes-section
meillo@54: \enoteheading
meillo@54: % font-size of endnotes
meillo@54: \enotesize
meillo@54: \input{\jobname.ent}%
meillo@54: \endgroup
meillo@54: }%
meillo@54: \def\enoteformat{%
meillo@54: \rightskip\z@
meillo@54: %\leftskip1.8em
meillo@54: \noindent
meillo@54: \hangindent .0
meillo@54: \parindent
meillo@54: \leavevmode\llap{%
meillo@54: \setcounter{Hendnote}{\@theenvalue}%
meillo@54: \addtocounter{Hendnote}{-1}%
meillo@54: \refstepcounter{Hendnote}%
meillo@54: \ifenotelinks
meillo@54: \expandafter\@secondoftwo
meillo@54: \else
meillo@54: \expandafter\@firstoftwo
meillo@54: \fi
meillo@54: {\@firstofone}%
meillo@54: {\hyperlink{Hendnotepage.\@theenvalue}}%
meillo@54: {\makeenmark}%
meillo@54: }%
meillo@54: }%
meillo@54: % stop redefining portions of endnotes-package:
meillo@54: \makeatother
meillo@54: % Toggle switch in order to turn on/off back-links in the
meillo@54: % endnote-section:
meillo@54: \enotelinkstrue
meillo@54: %\enotelinksfalse



