docs/bib-ref2

view pb/hyperendnotes.sty @ 54:7a137e17e34d

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