Debian Codegraph @

texmf-dist/tex/latex/hypdoc/hypdoc.sty

raw
1 %%
2 %% This is file `hypdoc.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% hypdoc.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: hypdoc
12 %% Version: 2023-10-26 v1.19
13 %%
14 %% Copyright (C)
15 %% 2002, 2006, 2007, 2009-2011 Heiko Oberdiek
16 %% 2016-2023 Oberdiek Package Support Group
17 %%
18 %% This work may be distributed and/or modified under the
19 %% conditions of the LaTeX Project Public License, either
20 %% version 1.3c of this license or (at your option) any later
21 %% version. This version of this license is in
22 %% https://www.latex-project.org/lppl/lppl-1-3c.txt
23 %% and the latest version of this license is in
24 %% https://www.latex-project.org/lppl.txt
25 %% and version 1.3 or later is part of all distributions of
26 %% LaTeX version 2005/12/01 or later.
27 %%
28 %% This work has the LPPL maintenance status "maintained".
29 %%
30 %% The Current Maintainers of this work are
31 %% Heiko Oberdiek and the Oberdiek Package Support Group
32 %% https://github.com/ho-tex/hypdoc/issues
33 %%
34 %% This work consists of the main source file hypdoc.dtx
35 %% and the derived files
36 %% hypdoc.sty, hypdoc.pdf, hypdoc.ins, hypdoc.drv.
37 %%
38 \NeedsTeXFormat{LaTeX2e}
39 \ProvidesPackage{hypdoc}%
40 [2023-10-26 v1.19 Hyper extensions for doc.sty (HO)]%
41 \newif\ifHD@numbered
42 \DeclareOption{numbered}{\HD@numberedtrue}
43 \ProcessOptions*\relax
44 \RequirePackage{atveryend}[2010/03/24]
45 \RequirePackage{doc}
46 \ifx\numexpr\@undefined
47 \RequirePackage{calc}%
48 \fi
49 \@ifpackageloaded{hyperref}
50 {
51 \ifHy@hyperindex
52 \PackageWarning{hypdoc}{%
53 hyperref has been loaded before with option 'hyperindex' enabled.\MessageBreak
54 The index will not work properly.}
55 \fi
56 \ifHy@pdfusetitle\else
57 \PackageInfo{hypdoc}{%
58 hyperref has been loaded before with option 'pdfusetitle' disabled.}
59 \fi
60 }
61 {\RequirePackage[%
62 hyperindex=false,%
63 pdfusetitle,%
64 ]{hyperref}[2002/05/09]%
65 }
66 \hypersetup{%
67 colorlinks,%
68 plainpages=false,%
69 bookmarksopen,%
70 bookmarksnumbered,%
71 bookmarksopenlevel=0,%
72 pdfstartview={FitBH \hypercalcbp{%
73 \paperheight-\topmargin-1in-\headheight-\headsep
74 }},%
75 }
76 \newcounter{HD@unique}
77 \renewcommand{\theHD@unique}{%
78 \number\value{HD@unique}%
79 }
80 \g@addto@macro\Hy@UseMaketitleInfos{%
81 \@ifundefined{fileinfo}{}{%
82 \ifx\@pdfsubject\@empty
83 \hypersetup{pdfsubject={\fileinfo}}%
84 \fi
85 }%
86 }
87 \pdfstringdefDisableCommands{%
88 \let\thanks\@gobble
89 \let\footnote\@gobble
90 \def\cs#1{\textbackslash #1}%
91 \let\normalfont\@empty
92 \let\scshape\@empty
93 \def\and{and }%
94 }
95 \def\HD@sectionpatch{%
96 \ifHD@numbered
97 \HD@@sectionpatch{section}%
98 \HD@@sectionpatch{chapter}%
99 \else
100 \let\Hy@writebookmark\HD@disable@writebookmark
101 \fi
102 }
103 \def\HD@@sectionpatch#1{%
104 \expandafter\let\csname HDorg@@#1\expandafter\endcsname
105 \csname #1\endcsname
106 \@namedef{#1}{%
107 \@ifstar{\@nameuse{HDorg@@#1}}{\@nameuse{HDorg@@#1}}%
108 }%
109 }
110 \def\HD@disable@writebookmark#1#2#3#4#5{}
111 \def\HD@guesstoclevel#1{%
112 \expandafter\HD@@guesstoclevel#1\section\HD@end
113 }
114 \long\def\HD@@guesstoclevel#1#2\HD@end{%
115 \@ifundefined{toclevel@\expandafter\@gobble\string#1\@empty}{%
116 1%
117 }{%
118 \@nameuse{toclevel@\expandafter\@gobble\string#1\@empty}%
119 }%
120 }
121 \let\HDorg@tableofcontents\tableofcontents
122 \def\tableofcontents{%
123 \begingroup
124 \@ifundefined{c@section}{%
125 \def\c@section{0}%
126 }{}%
127 \expandafter\endgroup
128 \ifcase\c@section
129 \stepcounter{HD@unique}%
130 \pdfbookmark[\HD@guesstoclevel{\HDorg@tableofcontents}]%
131 {\contentsname}{toc\theHD@unique}%
132 \HDorg@tableofcontents
133 \else
134 \ifHD@numbered
135 \else
136 \stepcounter{HD@unique}%
137 \pdfbookmark[\HD@guesstoclevel{\HDorg@tableofcontents}]%
138 {\contentsname}{toc\theHD@unique}%
139 \fi
140 \begingroup
141 \HD@sectionpatch
142 \HDorg@tableofcontents
143 \endgroup
144 \fi
145 }
146 \let\HDorg@listoffigures\listoffigures
147 \def\listoffigures{%
148 \ifHD@numbered
149 \else
150 \stepcounter{HD@unique}%
151 \pdfbookmark[\HD@guesstoclevel{\HDorg@listoffigures}]%
152 {\listfigurename}{toc\theHD@unique}%
153 \fi
154 \begingroup
155 \HD@sectionpatch
156 \HDorg@listoffigures
157 \endgroup
158 }
159 \let\HDorg@listoftables\listoftables
160 \def\listoftables{%
161 \ifHD@numbered
162 \else
163 \stepcounter{HD@unique}%
164 \pdfbookmark[\HD@guesstoclevel{\HDorg@listoftables}]%
165 {\listtablename}{toc\theHD@unique}%
166 \fi
167 \begingroup
168 \HD@sectionpatch
169 \HDorg@listoftables
170 \endgroup
171 }
172 \let\HDorg@thebibliography\thebibliography
173 \def\thebibliography{%
174 \ifHD@numbered
175 \else
176 \stepcounter{HD@unique}%
177 \pdfbookmark[\HD@guesstoclevel{\HDorg@thebibliography}]%
178 {\@ifundefined{chapter}{\refname}{\bibname}}{bib\theHD@unique}%
179 \fi
180 \HD@sectionpatch
181 \HDorg@thebibliography
182 }
183 \let\HDorg@theindex\theindex
184 \def\theindex{%
185 \let\HDorg@index@prologue\index@prologue
186 \let\HDorg@writebookmark\Hy@writebookmark
187 \HD@sectionpatch
188 \g@addto@macro\IndexParms{%
189 \ifHD@numbered
190 \else
191 \let\Hy@writebookmark\HDorg@writebookmark
192 \fi
193 \let\bfseries\HD@bfseries
194 }%
195 \edef\HD@toclevel@index{\HD@guesstoclevel{\index@prologue}}%
196 \begingroup
197 \count@=\HD@toclevel@index\relax
198 \advance\count@ by 1 %
199 \xdef\HD@toclevel@subindex{\the\count@}%
200 \endgroup
201 \def\index@prologue{%
202 \ifHD@numbered
203 \else
204 \begingroup
205 \stepcounter{HD@unique}%
206 \let\Hy@writebookmark\HDorg@writebookmark
207 \pdfbookmark[\HD@toclevel@index]%
208 {\indexname}{index\theHD@unique}%
209 \endgroup
210 \fi
211 \HDorg@index@prologue
212 }%
213 \HDorg@theindex
214 }
215 \let\HDorg@bfseries\bfseries
216 \def\HD@bfseries{\futurelet\HD@hfil\HD@@bfseries}%
217 \def\HD@@bfseries{%
218 \HDorg@bfseries
219 \ifx\HD@hfil\hfil
220 \expandafter\HD@@@bfseries
221 \fi
222 }
223 \def\HD@@@bfseries\hfil#1\hfil{%
224 \ifx\\#1\\%
225 \else
226 \raisebox{\baselineskip}[0pt]{%
227 \kern-\HD@margin\relax
228 \pdfbookmark[\HD@toclevel@subindex]{#1}{HD.#1}%
229 \kern\HD@margin\relax
230 }%
231 \fi
232 \hfil#1\hfil
233 }%
234 \def\HD@margin{1mm}
235 \let\HDorg@theglossary\theglossary
236 \def\theglossary{%
237 \let\HDorg@glossary@prologue\glossary@prologue
238 \let\HDorg@writebookmark\Hy@writebookmark
239 \HD@sectionpatch
240 \def\glossary@prologue{%
241 \ifHD@numbered
242 \else
243 \begingroup
244 \let\Hy@writebookmark\HDorg@writebookmark
245 \stepcounter{HD@unique}%
246 \pdfbookmark[\HD@guesstoclevel{\HDorg@glossary@prologue}]%
247 {\changehistoryname}{glossary\theHD@unique}%
248 \endgroup
249 \fi
250 \HDorg@glossary@prologue
251 }%
252 \HDorg@theglossary
253 }
254 \providecommand*{\glossaryname}{Change History}
255 \providecommand*{\changehistoryname}{\glossaryname}
256 \newcounter{HD@hypercount}
257 \newlength{\HD@helplength}
258 \newif\ifHD@savedest
259 \HD@savedesttrue
260 \AtBeginDocument{%
261 \HD@savedest@init
262 }
263 \RequirePackage{rerunfilecheck}[2009/12/10]
264 \begingroup
265 \catcode`\^^M=\active
266 \@firstofone{\endgroup
267 \def\HD@savedest@init{%
268 \ifHD@savedest
269 \let\HDorg@tilde~%
270 \let~\HD@savedest@entry
271 \edef\HDorg@catcodeM{\the\catcode`\^^M}%
272 \let\HDorg@M^^M%
273 \catcode`\^^M=\active
274 \def^^M{}%
275 \InputIfFileExists{\jobname.hd}{}{}%
276 \let~\HDorg@tilde
277 \let^^M\HDorg@M
278 \catcode`\^^M=\HDorg@catcodeM\relax
279 \newwrite\HD@savedest@out
280 \RerunFileCheck{\jobname.hd}{%
281 \immediate\closeout\HD@savedest@out
282 }{}%
283 \immediate\openout\HD@savedest@out=\jobname.hd\relax
284 \else
285 \let\HD@savedest@add\@gobble
286 \fi
287 }%
288 \def\HD@savedest@entry#1^^M{%
289 \@namedef{HD.#1}{}%
290 }%
291 }
292 \def\HD@savedest@add#1{%
293 \immediate\write\HD@savedest@out{\string~#1}%
294 }
295 \newif\ifHD@targetraise
296 \HD@targetraisetrue
297 \def\HD@target{%
298 \ifHD@targetraise
299 \ifhmode
300 \settoheight{\HD@helplength}{[H]}%
301 \addtolength{\HD@helplength}{0.4ex}%
302 \raisebox{\HD@helplength}[0pt][0pt]{%
303 \HD@maketarget
304 }%
305 \else
306 \HD@maketarget
307 \fi
308 \else
309 \HD@maketarget
310 \fi
311 }
312 \def\HD@maketarget{%
313 \stepcounter{HD@hypercount}%
314 \def\HD@next{%
315 \leavevmode
316 \llap{\hypertarget{HD.\the\c@HD@hypercount}{}\,}%
317 }%
318 \ifHD@savedest
319 \expandafter\ifx\csname HD.\the\c@HD@hypercount\endcsname\@empty
320 \else
321 \let\HD@next\relax
322 \fi
323 \fi
324 \HD@next
325 }
326 \g@addto@macro\CodelineIndex{%
327 \let\special@index\HD@codeline@wrindex
328 }
329 \g@addto@macro\PageIndex{%
330 \let\special@index\HD@page@wrindex
331 }
332 \def\HD@codeline@wrindex#1{%
333 \begingroup
334 \let\HDorg@encapchar\encapchar
335 \def\encapchar##1\encapchar##2\@nil{%
336 \HDorg@encapchar
337 hdclindex{\the\c@HD@hypercount}{##1}%
338 }%
339 \codeline@wrindex{%
340 #1\encapchar\encapchar\@nil
341 }%
342 \endgroup
343 }
344 \def\HD@page@wrindex#1{%
345 \begingroup
346 \let\HDorg@encapchar\encapchar
347 \def\encapchar##1\encapchar##2\@nil{%
348 \HDorg@encapchar
349 hdpindex{##1}%
350 }%
351 \HDorg@index{#1\encapchar\encapchar\@nil}%
352 \endgroup
353 }
354 \def\hdclindex#1#2#3{%
355 \csname\ifx\\#2\\relax\else#2\fi\endcsname{%
356 \hyperlink{HD.#1}{#3}%
357 \HD@savedest@add{#1}%
358 }%
359 }
360 \def\hdpindex#1#2{%
361 \csname\ifx\\#1\\relax\else#1\fi\endcsname{%
362 \hyperpage{#2}%
363 }%
364 }
365 \let\HDorg@PrintDescribeMacro\PrintDescribeMacro
366 \renewcommand\PrintDescribeMacro[1]{%
367 \begingroup
368 \let\HDorg@MacroFont\MacroFont
369 \def\MacroFont{%
370 \HD@target
371 \HDorg@MacroFont
372 }%
373 \HDorg@PrintDescribeMacro{#1}%
374 \endgroup
375 }
376 \let\HDorg@PrintMacroName\PrintMacroName
377 \renewcommand\PrintMacroName[1]{%
378 \begingroup
379 \let\HDorg@MacroFont\MacroFont
380 \def\MacroFont{%
381 \HD@target
382 \HDorg@MacroFont
383 }%
384 \HDorg@PrintMacroName{#1}%
385 \endgroup
386 }
387 \let\HDorg@theCodelineNo\theCodelineNo
388 \renewcommand*\theCodelineNo{%
389 \settowidth{\HD@helplength}{\HDorg@theCodelineNo\ }%
390 \ifdim\HD@helplength<\MacroIndent
391 \addtolength{\HD@helplength}{-\MacroIndent}%
392 \llap{%
393 \begingroup\HD@target\endgroup
394 \hspace*{-\HD@helplength}%
395 }%
396 \else
397 \HD@target
398 \fi
399 \HDorg@theCodelineNo
400 }
401 \AtBeginDocument{%
402 \let\HDorg@index\index
403 }
404 \let\HDorg@SpecialUsageIndex\SpecialUsageIndex
405 \renewcommand*\SpecialUsageIndex[1]{%
406 \@bsphack
407 \begingroup
408 \HD@target
409 \let\index\HDorg@index
410 \let\HDorg@encapchar\encapchar
411 \edef\encapchar usage{%
412 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
413 }%
414 \HDorg@SpecialUsageIndex{#1}%
415 \endgroup
416 \@esphack
417 }
418 \begingroup\expandafter\expandafter\expandafter\endgroup
419 \expandafter\ifx\csname autoindex\endcsname\relax
420 \else
421 \let\HDorg@autoindex\autoindex
422 \renewcommand*\autoindex[1]{%
423 \@bsphack
424 \begingroup
425 \HD@target
426 \let\index\HDorg@index
427 \let\HDorg@encapchar\encapchar
428 \edef\encapchar usage{%
429 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
430 }%
431 \HDorg@autoindex{#1}%
432 \endgroup
433 \@esphack
434 }%
435 \pdfstringdefDisableCommands{\let\autoindex\@gobble }
436 \fi
437 \let\HDorg@SpecialEnvIndex\SpecialEnvIndex
438 \renewcommand*\SpecialEnvIndex[1]{%
439 \@bsphack
440 \begingroup
441 \HD@target
442 \let\HDorg@encapchar\encapchar
443 \edef\encapchar usage{%
444 \HDorg@encapchar hdclindex{\the\c@HD@hypercount}{usage}%
445 }%
446 \HDorg@SpecialEnvIndex{#1}%
447 \endgroup
448 \@esphack
449 }
450 \let\HDorg@SortIndex\SortIndex
451 \renewcommand*{\SortIndex}[2]{%
452 \@bsphack
453 \begingroup
454 \let\index\HD@page@wrindex
455 \HDorg@SortIndex{#1}{#2}%
456 \endgroup
457 \@esphack
458 }
459 \let\HDorg@wrglossary\@wrglossary
460 \def\@wrglossary#1{%
461 \let\HDorg@encapchar\encapchar
462 \def\encapchar##1\encapchar##2\@nil{%
463 \HDorg@encapchar
464 hdpindex{##1}%
465 }%
466 \HDorg@wrglossary{#1\encapchar\encapchar\@nil}%
467 }
468 \AfterLastShipout{%
469 \if@filesw
470 \immediate\write\@auxout{%
471 \string\providecommand\string\HD@SetMacroIndent[1]{}%
472 }%
473 \immediate\write\@auxout{%
474 \string\HD@SetMacroIndent{\number\value{CodelineNo}}%
475 }%
476 \fi
477 }
478 \def\HD@SetMacroIndent#1{%
479 \begingroup
480 \value{CodelineNo}=#1\relax
481 \settowidth{\MacroIndent}{\HDorg@theCodelineNo\ }%
482 \global\MacroIndent\MacroIndent
483 \endgroup
484 }
485 \endinput
486 %%
487 %% End of file `hypdoc.sty'.