docs/bib-ref2

annotate pb/hyperendnotes.sty @ 58:b424a623d2be

hgignore: minor cleanups
author markus schnalke <meillo@marmaro.de>
date Mon, 20 Oct 2014 07:20:18 +0200
parents
children
rev   line source
meillo@54 1 %%% hyperendnotes.sty
meillo@54 2 \makeatletter
meillo@54 3 \newif\ifenotelinks
meillo@54 4 \newcounter{Hendnote}
meillo@54 5 % Redefining portions of endnotes-package:
meillo@54 6 \let\savedhref\href
meillo@54 7 \let\savedurl\url
meillo@54 8 \def\endnotemark{%
meillo@54 9 \@ifnextchar[\@xendnotemark{%
meillo@54 10 \stepcounter{endnote}%
meillo@54 11 \protected@xdef\@theenmark{\theendnote}%
meillo@54 12 \protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54 13 \@endnotemark
meillo@54 14 }%
meillo@54 15 }%
meillo@54 16 \def\@xendnotemark[#1]{%
meillo@54 17 \begingroup\c@endnote#1\relax
meillo@54 18 \unrestored@protected@xdef\@theenmark{\theendnote}%
meillo@54 19 \unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54 20 \endgroup
meillo@54 21 \@endnotemark
meillo@54 22 }%
meillo@54 23 \def\endnotetext{%
meillo@54 24 \@ifnextchar[\@xendnotenext{%
meillo@54 25 \protected@xdef\@theenmark{\theendnote}%
meillo@54 26 \protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54 27 \@endnotetext
meillo@54 28 }%
meillo@54 29 }%
meillo@54 30 \def\@xendnotenext[#1]{%
meillo@54 31 \begingroup
meillo@54 32 \c@endnote=#1\relax
meillo@54 33 \unrestored@protected@xdef\@theenmark{\theendnote}%
meillo@54 34 \unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54 35 \endgroup
meillo@54 36 \@endnotetext
meillo@54 37 }%
meillo@54 38 \def\endnote{%
meillo@54 39 \@ifnextchar[\@xendnote{%
meillo@54 40 \stepcounter{endnote}%
meillo@54 41 \protected@xdef\@theenmark{\theendnote}%
meillo@54 42 \protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54 43 \@endnotemark\@endnotetext
meillo@54 44 }%
meillo@54 45 }%
meillo@54 46 \def\@xendnote[#1]{%
meillo@54 47 \begingroup
meillo@54 48 \c@endnote=#1\relax
meillo@54 49 \unrestored@protected@xdef\@theenmark{\theendnote}%
meillo@54 50 \unrestored@protected@xdef\@theenvalue{\number\c@endnote}%
meillo@54 51 \show\@theenvalue
meillo@54 52 \endgroup
meillo@54 53 \@endnotemark\@endnotetext
meillo@54 54 }%
meillo@54 55 \def\@endnotemark{%
meillo@54 56 \leavevmode
meillo@54 57 \ifhmode
meillo@54 58 \edef\@x@sf{\the\spacefactor}\nobreak
meillo@54 59 \fi
meillo@54 60 \ifenotelinks
meillo@54 61 \expandafter\@firstofone
meillo@54 62 \else
meillo@54 63 \expandafter\@gobble
meillo@54 64 \fi
meillo@54 65 {%
meillo@54 66 \Hy@raisedlink{%
meillo@54 67 \hyper@@anchor{Hendnotepage.\@theenvalue}{\empty}%
meillo@54 68 }%
meillo@54 69 }%
meillo@54 70 \hyper@linkstart{link}{Hendnote.\@theenvalue}%
meillo@54 71 \makeenmark
meillo@54 72 \hyper@linkend
meillo@54 73 \ifhmode
meillo@54 74 \spacefactor\@x@sf
meillo@54 75 \fi
meillo@54 76 \relax
meillo@54 77 }%
meillo@54 78 \long\def\@endnotetext#1{%
meillo@54 79 \if@enotesopen
meillo@54 80 \else
meillo@54 81 \@openenotes
meillo@54 82 \fi
meillo@54 83 \immediate\write\@enotes{%
meillo@54 84 \@doanenote{\@theenmark}{\@theenvalue}%
meillo@54 85 }%
meillo@54 86 \begingroup
meillo@54 87 \def\next{#1}%
meillo@54 88 \newlinechar='40
meillo@54 89 \immediate\write\@enotes{\meaning\next}%
meillo@54 90 \endgroup
meillo@54 91 \immediate\write\@enotes{%
meillo@54 92 \@endanenote
meillo@54 93 }%
meillo@54 94 }%
meillo@54 95 \def\theendnotes{%
meillo@54 96 \immediate\closeout\@enotes
meillo@54 97 \global\@enotesopenfalse
meillo@54 98 \begingroup
meillo@54 99 \makeatletter
meillo@54 100 \edef\@tempa{`\string>}%
meillo@54 101 \ifnum\catcode\@tempa=12
meillo@54 102 \let\@ResetGT\relax
meillo@54 103 \else
meillo@54 104 \edef\@ResetGT{\noexpand\catcode\@tempa=\the\catcode\@tempa}%
meillo@54 105 \@makeother\>%
meillo@54 106 \fi
meillo@54 107 \def\@doanenote##1##2##3>{%
meillo@54 108 \def\@theenmark{##1}%
meillo@54 109 \def\@theenvalue{##2}%
meillo@54 110 \par
meillo@54 111 \smallskip %<-small vertical gap between endnotes
meillo@54 112 \begingroup
meillo@54 113 \def\href{\expandafter\savedhref}%
meillo@54 114 \def\url{\expandafter\savedurl}%
meillo@54 115 \@ResetGT
meillo@54 116 \edef\@currentlabel{\csname p@endnote\endcsname\@theenmark}%
meillo@54 117 \enoteformat
meillo@54 118 }%
meillo@54 119 \def\@endanenote{%
meillo@54 120 \par\endgroup
meillo@54 121 }%
meillo@54 122 % Redefine, how numbers are formatted in the endnotes-section:
meillo@54 123 \renewcommand*\@makeenmark{%
meillo@54 124 \hbox{\normalfont\@theenmark~}%
meillo@54 125 }%
meillo@54 126 % header of endnotes-section
meillo@54 127 \enoteheading
meillo@54 128 % font-size of endnotes
meillo@54 129 \enotesize
meillo@54 130 \input{\jobname.ent}%
meillo@54 131 \endgroup
meillo@54 132 }%
meillo@54 133 \def\enoteformat{%
meillo@54 134 \rightskip\z@
meillo@54 135 %\leftskip1.8em
meillo@54 136 \noindent
meillo@54 137 \hangindent .0
meillo@54 138 \parindent
meillo@54 139 \leavevmode\llap{%
meillo@54 140 \setcounter{Hendnote}{\@theenvalue}%
meillo@54 141 \addtocounter{Hendnote}{-1}%
meillo@54 142 \refstepcounter{Hendnote}%
meillo@54 143 \ifenotelinks
meillo@54 144 \expandafter\@secondoftwo
meillo@54 145 \else
meillo@54 146 \expandafter\@firstoftwo
meillo@54 147 \fi
meillo@54 148 {\@firstofone}%
meillo@54 149 {\hyperlink{Hendnotepage.\@theenvalue}}%
meillo@54 150 {\makeenmark}%
meillo@54 151 }%
meillo@54 152 }%
meillo@54 153 % stop redefining portions of endnotes-package:
meillo@54 154 \makeatother
meillo@54 155 % Toggle switch in order to turn on/off back-links in the
meillo@54 156 % endnote-section:
meillo@54 157 \enotelinkstrue
meillo@54 158 %\enotelinksfalse