Debian Codegraph @

texmf-dist/tex/latex/oberdiek/hypbmsec.sty

raw
1 %%
2 %% This is file `hypbmsec.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% hypbmsec.dtx (with options: `package')
8 %%
9 %% This is a generated file.
10 %%
11 %% Project: hypbmsec
12 %% Version: 2024-08-07 v2.6
13 %%
14 %% Copyright (C)
15 %% 1998-2000, 2006, 2007 Heiko Oberdiek
16 %% 2016-2024 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/oberdiek/issues
33 %%
34 %%
35 %% This work consists of the main source file hypbmsec.dtx
36 %% and the derived files
37 %% hypbmsec.sty, hypbmsec.pdf, hypbmsec.ins, hypbmsec.drv.
38 %%
39 \NeedsTeXFormat{LaTeX2e}
40 \ProvidesPackage{hypbmsec}%
41 [2024-08-07 v2.6 Bookmarks in sectioning commands (HO)]
42 \@ifundefined{hbs@do}{}{%
43 \PackageInfo{hypbmsec}{Package 'hypbmsec' is already loaded}%
44 \endinput
45 }
46 \def\hbs@do#1{%
47 \@ifstar{#1*}{%
48 \let\hbs@tocstring\relax
49 \let\hbs@bmstring\relax
50 \let\hbs@seccmd#1%
51 \hbs@checkarg
52 }%
53 }
54 \def\hbs@checkarg{%
55 \@ifnextchar[\hbs@getsquare{%
56 \@ifnextchar(\hbs@getbookmark\hbs@process
57 }%
58 }
59 \long\def\hbs@getsquare[#1]{%
60 \ifx\hbs@tocstring\relax
61 \def\hbs@tocstring{#1}%
62 \else
63 \hbs@bmdef{#1}%
64 \fi
65 \hbs@checkarg
66 }
67 \def\hbs@getbookmark(#1){%
68 \hbs@bmdef{#1}%
69 \hbs@checkarg
70 }
71 \def\hbs@bmdef#1{%
72 \ifx\hbs@bmstring\relax
73 \def\hbs@bmstring{#1}%
74 \else
75 \PackageError{hypbmsec}{%
76 Sectioning command with too many parameters%
77 }{%
78 You can only give one outline entry.%
79 }%
80 \fi
81 }
82 \long\def\hbs@process#1{%
83 \ifx\hbs@tocstring\relax
84 \ifx\hbs@bmstring\relax
85 \hbs@seccmd{#1}%
86 \else
87 \begingroup
88 \def\x##1{\endgroup
89 \hbs@seccmd{\texorpdfstring{#1}{##1}}%
90 }%
91 \expandafter\x\expandafter{\hbs@bmstring}%
92 \fi
93 \else
94 \ifx\hbs@bmstring\relax
95 \expandafter\hbs@seccmd\expandafter[%
96 \expandafter{\hbs@tocstring}%
97 ]{#1}%
98 \else
99 \expandafter\expandafter\expandafter
100 \hbs@seccmd\expandafter\expandafter\expandafter[%
101 \expandafter\expandafter\expandafter
102 \texorpdfstring
103 \expandafter\expandafter\expandafter{%
104 \expandafter\hbs@tocstring\expandafter
105 }\expandafter{%
106 \hbs@bmstring
107 }%
108 ]{#1}%
109 \fi
110 \fi
111 }
112 \AtBeginDocument{%
113 \@ifundefined{texorpdfstring}{%
114 \@ifundefined{ifbookmark}{%
115 \let\texorpdfstring\@firstoftwo
116 \@ifpackageloaded{hyperref}{%
117 \PackageInfo{hypbmsec}{%
118 \ifx\hy@driver\@empty
119 Default driver %
120 \else
121 '\hy@driver' %
122 \fi
123 of hyperref not supported,\MessageBreak
124 bookmark parameters will be ignored%
125 }%
126 }{%
127 \PackageInfo{hypbmsec}{%
128 Package hyperref not loaded,\MessageBreak
129 bookmark parameters will be ignored%
130 }%
131 }%
132 }%
133 {%
134 \newcommand\texorpdfstring[2]{\ifbookmark{#2}{#1}}%
135 \PackageWarningNoLine{hypbmsec}{%
136 Old hyperref version found,\MessageBreak
137 update of hyperref recommended%
138 }%
139 }%
140 }{}%
141 \let\hbs@part \part
142 \let\hbs@section \section
143 \let\hbs@subsection \subsection
144 \let\hbs@subsubsection\subsubsection
145 \let\hbs@paragraph \paragraph
146 \let\hbs@subparagraph \subparagraph
147 \renewcommand\part {\hbs@do\hbs@part}%
148 \renewcommand\section {\hbs@do\hbs@section}%
149 \renewcommand\subsection {\hbs@do\hbs@subsection}%
150 \renewcommand\subsubsection{\hbs@do\hbs@subsubsection}%
151 \renewcommand\paragraph {\hbs@do\hbs@paragraph}%
152 \renewcommand\subparagraph {\hbs@do\hbs@subparagraph}%
153 \begingroup\expandafter\expandafter\expandafter\endgroup
154 \expandafter\ifx\csname chapter\endcsname\relax\else
155 \let\hbs@chapter \chapter
156 \renewcommand\chapter {\hbs@do\hbs@chapter}%
157 \fi
158 }
159 \endinput
160 %%
161 %% End of file `hypbmsec.sty'.