Debian Codegraph @

texmf-dist/source/latex/hyperref/hyperref-patches.dtx

raw
1 % \iffalse meta-comment
2 %% File: hyperref-patches.dtx
3 %% Copyright
4 %% 1995-2001 Sebastian Rahtz, with portions written by David Carlisle and Heiko Oberdiek,
5 %% 2001-2015 Heiko Oberdiek.
6 %% 2016-2019 Oberdiek Package Support Group
7 %% 2019-2026 LaTeX Project
8 %% https://github.com/latex3/hyperref/issues
9 %%
10 %% This file is part of the `Hyperref Bundle'.
11 %% -------------------------------------------
12 %%
13 %% This work may be distributed and/or modified under the
14 %% conditions of the LaTeX Project Public License, either version 1.3
15 %% of this license or (at your option) any later version.
16 %% The latest version of this license is in
17 %% http://www.latex-project.org/lppl.txt
18 %% and version 1.3 or later is part of all distributions of LaTeX
19 %% version 2005/12/01 or later.
20 %%
21 %% This work has the LPPL maintenance status `maintained'.
22 %%
23 %% The Current Maintainer of this work is the LaTeX Project.
24 %%
25 %% The list of all files belonging to the `Hyperref Bundle' is
26 %% given in the file `manifest.txt'.
27 %
28 %<*driver>
29 \DocumentMetadata{tagging=on}
30 \documentclass[full]{l3in2edoc}
31 \usepackage{array,booktabs}
32 \hypersetup{pdfauthor=The LaTeX Project,pdftitle=hyperref patches}
33 \usepackage{caption}
34 \begin{document}
35 \DocInput{\jobname.dtx}
36 \end{document}
37 %</driver>
38 % \fi
39 %
40 % \title{^^A
41 % Old hyperref patches
42 % }
43 %
44 % \author{^^A
45 % The \LaTeX{} Project\thanks
46 % {^^A
47 % E-mail:
48 % \href{mailto:[email protected]}
49 % {[email protected]}^^A
50 % }^^A
51 % }
52 %
53 % \date{Version 2026-04-24 v7.01q}
54 %
55 % \maketitle
56 % \begin{documentation}
57 %
58 % \section{\pkg{hyperref-patches} documentation}
59 %
60 % \pkg{hyperref} has included over the years a rather large number of
61 % patches and correction for external packages to make them compatible with
62 % hyperlinks.
63 %
64 % Some of these patches are now (mostly) unnecessary, either because the external
65 % package is no longer used or because the package was fixed or extended to
66 % supports hyperlinks.
67 %
68 % This small package contains patches where it is not sure if they can be removed
69 % completely so that if needed that can be added manually, either by loading
70 % this package or by copying the code.
71 %
72 % By default all patches are loaded, a patch can be disabled with a package option.
73 % Currently the following options are available:
74 % \texttt{nofoiltex}, \texttt{nolisting}, \texttt{nolistings}, \texttt{norevtex}.
75 %
76 % \end{documentation}
77 %
78 % \begin{implementation}
79 %
80 % \section{\pkg{hyperref-patches} documentation}
81 %
82 % \begin{macrocode}
83 %<*package>
84 \ProvidesPackage{hyperref-patches}[2021-06-29 v0.9 old hyperref patches]
85 % \end{macrocode}
86 % \section{Package options to disable patches}
87 %
88 % \begin{macrocode}
89 \newif\ifHy@patches@foiltex
90 \Hy@patches@foiltextrue
91 \DeclareOption{nofoiltex}{\Hy@patches@foiltexfalse}
92 \newif\ifHy@patches@listing
93 \Hy@patches@listingtrue
94 \DeclareOption{nolisting}{\Hy@patches@listingfalse}
95 \newif\ifHy@patches@listings
96 \Hy@patches@listingstrue
97 \DeclareOption{nolistings}{\Hy@patches@listingsfalse}
98 \newif\ifHy@patches@revtex
99 \Hy@patches@revtextrue
100 \DeclareOption{norevtex}{\Hy@patches@revtexfalse}
101 \ProcessOptions
102 % \end{macrocode}
103 % \section{Compatibility with foiltex}
104 % --Moved 2021-06-30--
105 %
106 % foils.cls redefine figure, table and caption as it doesn't want them to float
107 % and also thinks that list of figures and tables are unnecessary. This
108 % means that \cs{ext@table} and \cs{ext@figure} are missing too which
109 % are needed by the definitions of hyperref.
110 %
111 % foiltex is not part of the standard tex systems and hasn't been update the last
112 % time in 2008. So the patch is removed from hyperref.
113 %
114 % --End of move comment--
115 %
116 % \begin{macrocode}
117 \ifHy@patches@foiltex
118 \@ifclassloaded{foils}{%
119 \providecommand*\ext@table{lot}%
120 \providecommand*\ext@figure{lof}%
121 }{}
122 \fi
123 % \end{macrocode}
124 % \section{listing}
125 % --Moved 2021-06-30--
126 %
127 % This provide two commands for the listing package which is from 1999.
128 % Probably unneeded anyway, as this are the defaults, at best they prevent some warnings.
129 %
130 % --End of move comment--
131 % \begin{macrocode}
132 \ifHy@patches@listing
133 \@ifpackageloaded{listing}{%
134 \providecommand*\theHlisting{\thelisting}%
135 \providecommand*\toclevel@listing{0}%
136 }{}
137 \fi
138 % \end{macrocode}
139 %
140 % \section{listings}
141 % --Moved 2021-06-30--
142 %
143 % This provide two commands for the listing package which is from 1999.
144 % Probably unneeded anyway, as this are the defaults, at best they prevent some warnings.
145 %
146 % --End of move comment--
147 % \begin{macrocode}
148 \ifHy@patches@listings
149 \@ifpackageloaded{listings}{%
150 \providecommand*\theHlstlisting{\thelstlisting}%
151 \providecommand*\toclevel@lstlisting{0}%
152 }{}
153 \fi
154 % \end{macrocode}
155 %
156 % \section{revtex}
157 %
158 % --Moved 2021-09-02--
159 % revtex.cls is obsolete and it is no installed in texlive and miktex so the patch for it
160 % has been removed from hyperref.
161 % --End of move comment--
162 %
163 % Revtex (bless its little heart) takes over |\bibcite| and looks
164 % at the result to measure something. Make this a hypertext link
165 % and it goes ape. Therefore, make an anodyne result first, call
166 % its business, then go back to the real thing.
167 % \begin{macrocode}
168 \ifHy@patches@revtex
169 \@ifclassloaded{revtex}{%
170 \Hy@Info{*** compatibility with revtex **** }%
171 \def\revtex@checking#1#2{%
172 \expandafter\let\expandafter\T@temp\csname b@#1\endcsname
173 \expandafter\def\csname b@#1\endcsname{#2}%
174 \@SetMaxRnhefLabel{#1}%
175 \expandafter\let\csname b@#1\endcsname\T@temp
176 }%
177 % \end{macrocode}
178 % Tanmoy provided this replacement for CITEX. Lord knows what it does.
179 % For chapterbib added: \@extra@b@citeb
180 % \begin{macrocode}
181 \@ifundefined{@CITE}{\def\@CITE{\@cite}}{}%
182 \providecommand*{\@extra@b@citeb}{}%
183 \def\@CITEX[#1]#2{%
184 \let\@citea\@empty
185 \leavevmode
186 \unskip
187 $^{%
188 \scriptstyle
189 \@CITE{%
190 \@for\@citeb:=#2\do{%
191 \@citea
192 \def\@citea{,\penalty\@m\ }%
193 \edef\@citeb{\expandafter\@firstofone\@citeb}%
194 \if@filesw
195 \immediate\write\@auxout{\string\citation{\@citeb}}%
196 \fi
197 \@ifundefined{b@\@citeb\extra@b@citeb}{%
198 \mbox{\reset@font\bfseries ?}%
199 \G@refundefinedtrue
200 \@latex@warning{%
201 Citation `\@citeb' on page \thepage \space undefined%
202 }%
203 }{%
204 {\csname b@\@citeb\@extra@b@citeb\endcsname}%
205 }%
206 }%
207 }{#1}%
208 }$%
209 }%
210 % \end{macrocode}
211 % No, life is too short. I am not going to understand the
212 % Revtex |\@collapse| macro, I shall
213 % just restore the original behaviour of |\@citex|;
214 % sigh. This is SO vile.
215 % \begin{macrocode}
216 \def\@citex[#1]#2{%
217 \let\@citea\@empty
218 \@cite{%
219 \@for\@citeb:=#2\do{%
220 \@citea
221 \def\@citea{,\penalty\@m\ }%
222 \edef\@citeb{\expandafter\@firstofone\@citeb}%
223 \if@filesw
224 \immediate\write\@auxout{\string\citation{\@citeb}}%
225 \fi
226 \@ifundefined{b@\@citeb\@extra@b@citeb}{%
227 \mbox{\reset@font\bfseries ?}%
228 \G@refundefinedtrue
229 \@latex@warning{%
230 Citation `\@citeb' on page \thepage \space undefined%
231 }%
232 }{%
233 \hbox{\csname b@\@citeb\@extra@b@citeb\endcsname}%
234 }%
235 }%
236 }{#1}%
237 }%
238 }{}
239 \fi
240 % \end{macrocode}
241 %
242 % \begin{macrocode}
243 %</package>
244 % \end{macrocode}
245 %
246 % \end{implementation}
247 %
248 % \PrintIndex