| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: hypbmsec.dtx |
| 4 |
% Version: 2024-08-07 v2.6 |
| 5 |
% Info: Bookmarks in sectioning commands |
| 6 |
% |
| 7 |
% Copyright (C) |
| 8 |
% 1998-2000, 2006, 2007 Heiko Oberdiek |
| 9 |
% 2016-2024 Oberdiek Package Support Group |
| 10 |
% https://github.com/ho-tex/oberdiek/issues |
| 11 |
% |
| 12 |
% This work may be distributed and/or modified under the |
| 13 |
% conditions of the LaTeX Project Public License, either |
| 14 |
% version 1.3c of this license or (at your option) any later |
| 15 |
% version. This version of this license is in |
| 16 |
% https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 17 |
% and the latest version of this license is in |
| 18 |
% https://www.latex-project.org/lppl.txt |
| 19 |
% and version 1.3 or later is part of all distributions of |
| 20 |
% LaTeX version 2005/12/01 or later. |
| 21 |
% |
| 22 |
% This work has the LPPL maintenance status "maintained". |
| 23 |
% |
| 24 |
% The Current Maintainers of this work are |
| 25 |
% Heiko Oberdiek and the Oberdiek Package Support Group |
| 26 |
% https://github.com/ho-tex/oberdiek/issues |
| 27 |
% |
| 28 |
% This work consists of the main source file hypbmsec.dtx |
| 29 |
% and the derived files |
| 30 |
% hypbmsec.sty, hypbmsec.pdf, hypbmsec.ins, hypbmsec.drv. |
| 31 |
% |
| 32 |
% Distribution: |
| 33 |
% CTAN:macros/latex/contrib/oberdiek/hypbmsec.dtx |
| 34 |
% CTAN:macros/latex/contrib/oberdiek/hypbmsec.pdf |
| 35 |
% |
| 36 |
% Unpacking: |
| 37 |
% (a) If hypbmsec.ins is present: |
| 38 |
% tex hypbmsec.ins |
| 39 |
% (b) Without hypbmsec.ins: |
| 40 |
% tex hypbmsec.dtx |
| 41 |
% (c) If you insist on using LaTeX |
| 42 |
% latex \let\install=y\input{hypbmsec.dtx} |
| 43 |
% (quote the arguments according to the demands of your shell) |
| 44 |
% |
| 45 |
% Documentation: |
| 46 |
% (a) If hypbmsec.drv is present: |
| 47 |
% latex hypbmsec.drv |
| 48 |
% (b) Without hypbmsec.drv: |
| 49 |
% latex hypbmsec.dtx; ... |
| 50 |
% The class ltxdoc loads the configuration file ltxdoc.cfg |
| 51 |
% if available. Here you can specify further options, e.g. |
| 52 |
% use A4 as paper format: |
| 53 |
% \PassOptionsToClass{a4paper}{article} |
| 54 |
% |
| 55 |
% Program calls to get the documentation (example): |
| 56 |
% pdflatex hypbmsec.dtx |
| 57 |
% makeindex -s gind.ist hypbmsec.idx |
| 58 |
% pdflatex hypbmsec.dtx |
| 59 |
% makeindex -s gind.ist hypbmsec.idx |
| 60 |
% pdflatex hypbmsec.dtx |
| 61 |
% |
| 62 |
% Installation: |
| 63 |
% TDS:tex/latex/oberdiek/hypbmsec.sty |
| 64 |
% TDS:doc/latex/oberdiek/hypbmsec.pdf |
| 65 |
% TDS:source/latex/oberdiek/hypbmsec.dtx |
| 66 |
% |
| 67 |
%<*ignore> |
| 68 |
\begingroup |
| 69 |
\catcode123=1 % |
| 70 |
\catcode125=2 % |
| 71 |
\def\x{LaTeX2e}% |
| 72 |
\expandafter\endgroup |
| 73 |
\ifcase 0\ifx\install y1\fi\expandafter |
| 74 |
\ifx\csname processbatchFile\endcsname\relax\else1\fi |
| 75 |
\ifx\fmtname\x\else 1\fi\relax |
| 76 |
\else\csname fi\endcsname |
| 77 |
%</ignore> |
| 78 |
%<*install> |
| 79 |
\input docstrip.tex |
| 80 |
\Msg{************************************************************************} |
| 81 |
\Msg{* Installation} |
| 82 |
\Msg{* Package: hypbmsec 2024-08-07 v2.6 Bookmarks in sectioning commands (HO)} |
| 83 |
\Msg{************************************************************************} |
| 84 |
|
| 85 |
\keepsilent |
| 86 |
\askforoverwritefalse |
| 87 |
|
| 88 |
\let\MetaPrefix\relax |
| 89 |
\preamble |
| 90 |
|
| 91 |
This is a generated file. |
| 92 |
|
| 93 |
Project: hypbmsec |
| 94 |
Version: 2024-08-07 v2.6 |
| 95 |
|
| 96 |
Copyright (C) |
| 97 |
1998-2000, 2006, 2007 Heiko Oberdiek |
| 98 |
2016-2024 Oberdiek Package Support Group |
| 99 |
|
| 100 |
This work may be distributed and/or modified under the |
| 101 |
conditions of the LaTeX Project Public License, either |
| 102 |
version 1.3c of this license or (at your option) any later |
| 103 |
version. This version of this license is in |
| 104 |
https://www.latex-project.org/lppl/lppl-1-3c.txt |
| 105 |
and the latest version of this license is in |
| 106 |
https://www.latex-project.org/lppl.txt |
| 107 |
and version 1.3 or later is part of all distributions of |
| 108 |
LaTeX version 2005/12/01 or later. |
| 109 |
|
| 110 |
This work has the LPPL maintenance status "maintained". |
| 111 |
|
| 112 |
The Current Maintainers of this work are |
| 113 |
Heiko Oberdiek and the Oberdiek Package Support Group |
| 114 |
https://github.com/ho-tex/oberdiek/issues |
| 115 |
|
| 116 |
|
| 117 |
This work consists of the main source file hypbmsec.dtx |
| 118 |
and the derived files |
| 119 |
hypbmsec.sty, hypbmsec.pdf, hypbmsec.ins, hypbmsec.drv. |
| 120 |
|
| 121 |
\endpreamble |
| 122 |
\let\MetaPrefix\DoubleperCent |
| 123 |
|
| 124 |
\generate{% |
| 125 |
\file{hypbmsec.ins}{\from{hypbmsec.dtx}{install}}% |
| 126 |
\file{hypbmsec.drv}{\from{hypbmsec.dtx}{driver}}% |
| 127 |
\usedir{tex/latex/oberdiek}% |
| 128 |
\file{hypbmsec.sty}{\from{hypbmsec.dtx}{package}}% |
| 129 |
} |
| 130 |
|
| 131 |
\catcode32=13\relax% active space |
| 132 |
\let =\space% |
| 133 |
\Msg{************************************************************************} |
| 134 |
\Msg{*} |
| 135 |
\Msg{* To finish the installation you have to move the following} |
| 136 |
\Msg{* file into a directory searched by TeX:} |
| 137 |
\Msg{*} |
| 138 |
\Msg{* hypbmsec.sty} |
| 139 |
\Msg{*} |
| 140 |
\Msg{* To produce the documentation run the file `hypbmsec.drv'} |
| 141 |
\Msg{* through LaTeX.} |
| 142 |
\Msg{*} |
| 143 |
\Msg{* Happy TeXing!} |
| 144 |
\Msg{*} |
| 145 |
\Msg{************************************************************************} |
| 146 |
|
| 147 |
\endbatchfile |
| 148 |
%</install> |
| 149 |
%<*ignore> |
| 150 |
\fi |
| 151 |
%</ignore> |
| 152 |
%<*driver> |
| 153 |
\NeedsTeXFormat{LaTeX2e} |
| 154 |
\ProvidesFile{hypbmsec.drv}% |
| 155 |
[2024-08-07 v2.6 Bookmarks in sectioning commands (HO)]% |
| 156 |
\documentclass{ltxdoc} |
| 157 |
\usepackage{holtxdoc}[2011/11/22] |
| 158 |
\begin{document} |
| 159 |
\DocInput{hypbmsec.dtx}% |
| 160 |
\end{document} |
| 161 |
%</driver> |
| 162 |
% \fi |
| 163 |
% |
| 164 |
% |
| 165 |
% |
| 166 |
% \GetFileInfo{hypbmsec.drv} |
| 167 |
% |
| 168 |
% \title{The \xpackage{hypbmsec} package} |
| 169 |
% \date{2024-08-07 v2.6} |
| 170 |
% \author{Heiko Oberdiek\thanks |
| 171 |
% {Please report any issues at \url{https://github.com/ho-tex/oberdiek/issues}}} |
| 172 |
% |
| 173 |
% \maketitle |
| 174 |
% |
| 175 |
% \begin{abstract} |
| 176 |
% This package expands the syntax of the sectioning commands. If the |
| 177 |
% argument of the sectioning commands isn't usable as outline entry, |
| 178 |
% a replacement for the bookmarks can be given. |
| 179 |
% \end{abstract} |
| 180 |
% |
| 181 |
% \tableofcontents |
| 182 |
% |
| 183 |
% \newcommand{\type}[1]{\textsf{#1}} |
| 184 |
% |
| 185 |
% ^^A No thread support. |
| 186 |
% \newenvironment{article}[1]{}{} |
| 187 |
% |
| 188 |
% \section{Usage} |
| 189 |
% |
| 190 |
% \subsection{Bookmarks restrictions}\label{sec:restrictions} |
| 191 |
% Outline entries (bookmarks) are written to a file and have |
| 192 |
% to obey the pdf specification. |
| 193 |
% Therefore they have several restrictions: |
| 194 |
% \begin{itemize} |
| 195 |
% \item Bookmarks have to be encoded in PDFDocEncoding^^A |
| 196 |
% \footnote{\Package{hyperref} doesn't support |
| 197 |
% Unicode.}. |
| 198 |
% \item They should only expand to letters and spaces. |
| 199 |
% \item The result of expansion have to be a valid pdf string. |
| 200 |
% \item Stomach commands like \cmd{\relax}, box commands, math, |
| 201 |
% assignments, or definitions aren't allowed. |
| 202 |
% \item Short entries are recommended, which allow a clear view. |
| 203 |
% \end{itemize} |
| 204 |
% |
| 205 |
% \subsection{\texorpdfstring{\cmd{\texorpdfstring}}{^^A |
| 206 |
% \textbackslash texorpdfstring}} |
| 207 |
% The generic way in package \Package{hyperref} is the use |
| 208 |
% of \cmd{\texorpdfstring}^^A |
| 209 |
% \footnote{In versions of \Package{hyperref} below 6.54 see |
| 210 |
% \cmd{\ifbookmark}.}: |
| 211 |
% \begin{quote} |
| 212 |
%\begin{verbatim} |
| 213 |
%\section{Pythagoras: |
| 214 |
% \texorpdfstring{$a^2+b^2=c^2$}{% |
| 215 |
% a\texttwosuperior\ + b\texttwosuperior\ = |
| 216 |
% c\texttwosuperior}% |
| 217 |
%} |
| 218 |
%\end{verbatim} |
| 219 |
% \end{quote} |
| 220 |
% |
| 221 |
% \subsection{Sectioning commands} |
| 222 |
% The package \Package{hyperref} automatically generates |
| 223 |
% bookmarks from the sectioning commands, |
| 224 |
% unless it is suppressed by an option. |
| 225 |
% Commands that structure the text are here called |
| 226 |
% ``sectioning commands'': |
| 227 |
% \begin{quote} |
| 228 |
% \cmd{\part}, \cmd{\chapter},\\ |
| 229 |
% \cmd{\section}, \cmd{\subsection}, \cmd{\subsubsection},\\ |
| 230 |
% \cmd{\paragraph}, \cmd{\subparagraph} |
| 231 |
% \end{quote} |
| 232 |
% |
| 233 |
% \subsection{Places\texorpdfstring{ for sectioning strings}{}} |
| 234 |
% \label{sec:places} |
| 235 |
% The argument(s) of these commands are used on several places: |
| 236 |
% \begin{description} |
| 237 |
% \item[\type{text}] |
| 238 |
% The current text without restrictions. |
| 239 |
% \item[\type{toc}] |
| 240 |
% The headlines and the table of contents with the |
| 241 |
% restrictions of ``moving arguments''. |
| 242 |
% \item[\type{out}] |
| 243 |
% The outlines with many restrictions: The outline |
| 244 |
% have to expand to a valid pdf string with PDFDocEncoding |
| 245 |
% (see \ref{sec:restrictions}). |
| 246 |
% \end{description} |
| 247 |
% |
| 248 |
% \subsection{\texorpdfstring{Solution with o}{O}ptional arguments} |
| 249 |
% If the user wants to use a footnote within a sectioning command, |
| 250 |
% the \LaTeX{} solution is an optional argument: |
| 251 |
% \begin{quote} |
| 252 |
% |\section[Title]{Title\footnote{Footnote text}}| |
| 253 |
% \end{quote} |
| 254 |
% Now |Title| without the footnote is used in the headlines and |
| 255 |
% the table of contents. Also \Package{hyperref} uses it for the |
| 256 |
% bookmarks. |
| 257 |
% |
| 258 |
% This package \Package{\filename} offers two possibilities to |
| 259 |
% specify a separate outline entry: |
| 260 |
% \begin{itemize} |
| 261 |
% \item An additional second optional argument in square brackets. |
| 262 |
% \item An additional optional argument in parentheses (in |
| 263 |
% association with a pdf string that is internally surrounded |
| 264 |
% by parentheses, too). |
| 265 |
% \end{itemize} |
| 266 |
% Because \Package{\filename} stores the original meaning of the |
| 267 |
% sectioning commands and uses them again, there should be no |
| 268 |
% problems with packages that redefine the sectioning commands, if |
| 269 |
% these packages doesn't change the syntax. |
| 270 |
% |
| 271 |
% \subsection{Syntax} |
| 272 |
% The following examples show the syntax of the sectioning |
| 273 |
% commands. For the places the strings appear the abbreviations |
| 274 |
% are used, that are introduced in \ref{sec:places}. |
| 275 |
% |
| 276 |
% \subsubsection{\texorpdfstring{Star form}{^^A |
| 277 |
% \textbackslash section*\{\}}} |
| 278 |
% The behaviour of the star form isn't changed. The string |
| 279 |
% appears only in the current text: |
| 280 |
% \begin{article}{Syntax} |
| 281 |
% \begin{quote} |
| 282 |
% |\section*{text}| |
| 283 |
% \end{quote} |
| 284 |
% \end{article} |
| 285 |
% |
| 286 |
% \subsubsection{\texorpdfstring{Without optional arguments}{^^A |
| 287 |
% \textbackslash section\{\}}} |
| 288 |
% The normal case, the string in the mandatory argument is |
| 289 |
% used for all places: |
| 290 |
% \begin{article}{Syntax} |
| 291 |
% \begin{quote} |
| 292 |
% |\section{text, toc, out}| |
| 293 |
% \end{quote} |
| 294 |
% \end{article} |
| 295 |
% |
| 296 |
% \subsubsection{\texorpdfstring{One optional argument}{^^A |
| 297 |
% \textbackslash section[]\{\}}} |
| 298 |
% Also the form with one optional parameter in square brackets isn't |
| 299 |
% new; for the bookmarks the optional parameter is used: |
| 300 |
% \begin{article}{Syntax} |
| 301 |
% \begin{quote} |
| 302 |
% |\section[toc, out]{text}| |
| 303 |
% \end{quote} |
| 304 |
% \end{article} |
| 305 |
% |
| 306 |
% \subsubsection{\texorpdfstring{Two optional arguments}{^^A |
| 307 |
% \textbackslash section[][out]\{\}}}\label{sec:two} |
| 308 |
% The second optional parameter in square brackets is introduced |
| 309 |
% by this package to specify an outline entry: |
| 310 |
% \begin{article}{Syntax} |
| 311 |
% \begin{quote} |
| 312 |
% |\section[toc][out]{text}| |
| 313 |
% \end{quote} |
| 314 |
% \end{article} |
| 315 |
% |
| 316 |
% \subsubsection{\texorpdfstring{Optional argument in parentheses}{^^A |
| 317 |
% \textbackslash section(out)\{\}}} |
| 318 |
% Often the \type{toc} and the \type{text} string would be the same. |
| 319 |
% With the method of the two optional arguments in square brackets |
| 320 |
% (see \ref{sec:two}) this string must be given twice, |
| 321 |
% if the user only wants to specify a different outline entry. |
| 322 |
% Therefore this package offers another possibility: |
| 323 |
% In association with the internal representation in the pdf file |
| 324 |
% an outline entry can be given in parentheses. |
| 325 |
% So the package can easily distinguish between |
| 326 |
% the two forms of optional arguments and the order does not matter: |
| 327 |
% \begin{article}{Syntax} |
| 328 |
% \begin{quote} |
| 329 |
% |\section(out){toc, text}|\\ |
| 330 |
% |\section[toc](out){text}|\\ |
| 331 |
% |\section(out)[toc]{text}| |
| 332 |
% \end{quote} |
| 333 |
% \end{article} |
| 334 |
% |
| 335 |
% \subsection{Without \Package{hyperref}} |
| 336 |
% Package \Package{\filename} uses \Package{hyperref} for support of |
| 337 |
% the bookmarks, but this package is not required. |
| 338 |
% If \Package{hyperref} isn't loaded, or |
| 339 |
% is called with a driver that doesn't support bookmarks, |
| 340 |
% package \Package{\filename} shouldn't be removed, |
| 341 |
% because this would lead to |
| 342 |
% a wrong syntax of the sectioning commands. |
| 343 |
% In any cases package \Package{\filename} |
| 344 |
% supports its syntax and ignores the outline entries, |
| 345 |
% if there are no code for bookmarks. |
| 346 |
% So it is possible to write texts, |
| 347 |
% that are processed with several drivers to get different output |
| 348 |
% formats. |
| 349 |
% |
| 350 |
% \subsection{Protecting parentheses} |
| 351 |
% If the string itself contains parentheses, they have to be hidden |
| 352 |
% from \TeX's argument parsing mechanism. |
| 353 |
% The argument should be surrounded |
| 354 |
% by curly braces: |
| 355 |
% \begin{quote} |
| 356 |
% |\section({outlines(bookmarks)}){text, toc}| |
| 357 |
% \end{quote} |
| 358 |
% With version 6.54 of \Package{hyperref} the other standard method |
| 359 |
% works, too: The closing parenthesis is protected: |
| 360 |
% \begin{quote} |
| 361 |
% |\section(outlines(bookmarks{)}){text, toc}| |
| 362 |
% \end{quote} |
| 363 |
% |
| 364 |
% \StopEventually{ |
| 365 |
% } |
| 366 |
% |
| 367 |
% \section{Implementation} |
| 368 |
% \begin{macrocode} |
| 369 |
%<*package> |
| 370 |
% \end{macrocode} |
| 371 |
% Package identification. |
| 372 |
% \begin{macrocode} |
| 373 |
\NeedsTeXFormat{LaTeX2e} |
| 374 |
\ProvidesPackage{hypbmsec}% |
| 375 |
[2024-08-07 v2.6 Bookmarks in sectioning commands (HO)] |
| 376 |
% \end{macrocode} |
| 377 |
% |
| 378 |
% Because of redefining the sectioning commands, it is dangerous |
| 379 |
% to reload the package several times. |
| 380 |
% \begin{macrocode} |
| 381 |
\@ifundefined{hbs@do}{}{% |
| 382 |
\PackageInfo{hypbmsec}{Package 'hypbmsec' is already loaded}% |
| 383 |
\endinput |
| 384 |
} |
| 385 |
% \end{macrocode} |
| 386 |
% |
| 387 |
% \begin{macro}{\hbs@do} |
| 388 |
% The redefined sectioning commands calls \cmd{\hbs@do}. It does |
| 389 |
% \begin{itemize} |
| 390 |
% \item handle the star case. |
| 391 |
% \item resets the macros that store the entries for the outlines |
| 392 |
% (\cmd{\hbs@bmstring}) and table of contents (\cmd{\hbs@tocstring}). |
| 393 |
% \item store the sectioning command |#1| in \cmd{\hbs@seccmd} |
| 394 |
% for later reuse. |
| 395 |
% \item at last call \cmd{\hbs@checkarg} that scans and interprets the |
| 396 |
% parameters of the redefined sectioning command. |
| 397 |
% \end{itemize} |
| 398 |
% \begin{macrocode} |
| 399 |
\def\hbs@do#1{% |
| 400 |
\@ifstar{#1*}{% |
| 401 |
\let\hbs@tocstring\relax |
| 402 |
\let\hbs@bmstring\relax |
| 403 |
\let\hbs@seccmd#1% |
| 404 |
\hbs@checkarg |
| 405 |
}% |
| 406 |
} |
| 407 |
% \end{macrocode} |
| 408 |
% \end{macro} |
| 409 |
% |
| 410 |
% \begin{macro}{\hbs@checkarg} |
| 411 |
% \cmd{\hbs@checkarg} determines the type of the next argument: |
| 412 |
% \begin{itemize} |
| 413 |
% \item An optional argument in square brackets can be an entry |
| 414 |
% for the table of contents or the bookmarks. It will be |
| 415 |
% read by \cmd{\hbs@getsquare} |
| 416 |
% \item An optional argument in parentheses is an outline entry. |
| 417 |
% This is worked off by \cmd{\hbs@getbookmark}. |
| 418 |
% \item If there are no more optional arguments, \cmd{\hbs@process} |
| 419 |
% reads the mandatory argument and calls the original |
| 420 |
% sectioning commands. |
| 421 |
% \end{itemize} |
| 422 |
% \begin{macrocode} |
| 423 |
\def\hbs@checkarg{% |
| 424 |
\@ifnextchar[\hbs@getsquare{% |
| 425 |
\@ifnextchar(\hbs@getbookmark\hbs@process |
| 426 |
}% |
| 427 |
} |
| 428 |
% \end{macrocode} |
| 429 |
% \end{macro} |
| 430 |
% |
| 431 |
% \begin{macro}{\hbs@getsquare} |
| 432 |
% \cmd{\hbs@getsquare} reads an optional argument in square |
| 433 |
% brackets and determines, if this is an entry for the table |
| 434 |
% of contents or the bookmarks. |
| 435 |
% \begin{macrocode} |
| 436 |
\long\def\hbs@getsquare[#1]{% |
| 437 |
\ifx\hbs@tocstring\relax |
| 438 |
\def\hbs@tocstring{#1}% |
| 439 |
\else |
| 440 |
\hbs@bmdef{#1}% |
| 441 |
\fi |
| 442 |
\hbs@checkarg |
| 443 |
} |
| 444 |
% \end{macrocode} |
| 445 |
% \end{macro} |
| 446 |
% |
| 447 |
% \begin{macro}{\hbs@getbookmark} |
| 448 |
% \cmd{\hbs@getbookmark} reads an outline entry in parentheses. |
| 449 |
% \begin{macrocode} |
| 450 |
\def\hbs@getbookmark(#1){% |
| 451 |
\hbs@bmdef{#1}% |
| 452 |
\hbs@checkarg |
| 453 |
} |
| 454 |
% \end{macrocode} |
| 455 |
% \end{macro} |
| 456 |
% |
| 457 |
% \begin{macro}{\hbs@bmdef} |
| 458 |
% The command \cmd{\hbs@bmdef} save the bookmark entry in |
| 459 |
% parameter |#1| in the macro \cmd{\hbs@bmstring} and catches |
| 460 |
% the case, if the user has given several outline strings. |
| 461 |
% \begin{macrocode} |
| 462 |
\def\hbs@bmdef#1{% |
| 463 |
\ifx\hbs@bmstring\relax |
| 464 |
\def\hbs@bmstring{#1}% |
| 465 |
\else |
| 466 |
\PackageError{hypbmsec}{% |
| 467 |
Sectioning command with too many parameters% |
| 468 |
}{% |
| 469 |
You can only give one outline entry.% |
| 470 |
}% |
| 471 |
\fi |
| 472 |
} |
| 473 |
% \end{macrocode} |
| 474 |
% \end{macro} |
| 475 |
% |
| 476 |
% \begin{macro}{\hbs@process} |
| 477 |
% The parameter |#1| is the mandatory argument of the sectioning |
| 478 |
% commands. \cmd{\hbs@process} calls the original sectioning command |
| 479 |
% stored in \cmd{\hbs@seccmd} with arguments that depend of which |
| 480 |
% optional argument are used previously. |
| 481 |
% \begin{macrocode} |
| 482 |
\long\def\hbs@process#1{% |
| 483 |
\ifx\hbs@tocstring\relax |
| 484 |
\ifx\hbs@bmstring\relax |
| 485 |
\hbs@seccmd{#1}% |
| 486 |
\else |
| 487 |
\begingroup |
| 488 |
\def\x##1{\endgroup |
| 489 |
\hbs@seccmd{\texorpdfstring{#1}{##1}}% |
| 490 |
}% |
| 491 |
\expandafter\x\expandafter{\hbs@bmstring}% |
| 492 |
\fi |
| 493 |
\else |
| 494 |
\ifx\hbs@bmstring\relax |
| 495 |
\expandafter\hbs@seccmd\expandafter[% |
| 496 |
\expandafter{\hbs@tocstring}% |
| 497 |
]{#1}% |
| 498 |
\else |
| 499 |
\expandafter\expandafter\expandafter |
| 500 |
\hbs@seccmd\expandafter\expandafter\expandafter[% |
| 501 |
\expandafter\expandafter\expandafter |
| 502 |
\texorpdfstring |
| 503 |
\expandafter\expandafter\expandafter{% |
| 504 |
\expandafter\hbs@tocstring\expandafter |
| 505 |
}\expandafter{% |
| 506 |
\hbs@bmstring |
| 507 |
}% |
| 508 |
]{#1}% |
| 509 |
\fi |
| 510 |
\fi |
| 511 |
} |
| 512 |
% \end{macrocode} |
| 513 |
% \end{macro} |
| 514 |
% |
| 515 |
% We have to check, whether package \Package{hyperref} is loaded |
| 516 |
% and have to provide a definition for \cmd{\texorpdfstring}. |
| 517 |
% Because \Package{hyperref} can be loaded after this package, |
| 518 |
% we do the work later (\cmd{\AtBeginDocument}). |
| 519 |
% |
| 520 |
% This code only checks versions of \Package{hyperref} that |
| 521 |
% define \cmd{\ifbookmark} (v6.4x until v6.53) or |
| 522 |
% \cmd{\texorpdfstring} (v6.54 and above). Older versions aren't |
| 523 |
% supported. |
| 524 |
% \begin{macrocode} |
| 525 |
\AtBeginDocument{% |
| 526 |
\@ifundefined{texorpdfstring}{% |
| 527 |
\@ifundefined{ifbookmark}{% |
| 528 |
\let\texorpdfstring\@firstoftwo |
| 529 |
\@ifpackageloaded{hyperref}{% |
| 530 |
\PackageInfo{hypbmsec}{% |
| 531 |
\ifx\hy@driver\@empty |
| 532 |
Default driver % |
| 533 |
\else |
| 534 |
'\hy@driver' % |
| 535 |
\fi |
| 536 |
of hyperref not supported,\MessageBreak |
| 537 |
bookmark parameters will be ignored% |
| 538 |
}% |
| 539 |
}{% |
| 540 |
\PackageInfo{hypbmsec}{% |
| 541 |
Package hyperref not loaded,\MessageBreak |
| 542 |
bookmark parameters will be ignored% |
| 543 |
}% |
| 544 |
}% |
| 545 |
}% |
| 546 |
{% |
| 547 |
\newcommand\texorpdfstring[2]{\ifbookmark{#2}{#1}}% |
| 548 |
\PackageWarningNoLine{hypbmsec}{% |
| 549 |
Old hyperref version found,\MessageBreak |
| 550 |
update of hyperref recommended% |
| 551 |
}% |
| 552 |
}% |
| 553 |
}{}% |
| 554 |
% \end{macrocode} |
| 555 |
% |
| 556 |
% Other packages are allowed to redefine the sectioning commands, |
| 557 |
% if they does not change the syntax. Therefore the redefinitions |
| 558 |
% of this package should be done after the other packages. |
| 559 |
% \begin{macrocode} |
| 560 |
\let\hbs@part \part |
| 561 |
\let\hbs@section \section |
| 562 |
\let\hbs@subsection \subsection |
| 563 |
\let\hbs@subsubsection\subsubsection |
| 564 |
\let\hbs@paragraph \paragraph |
| 565 |
\let\hbs@subparagraph \subparagraph |
| 566 |
\renewcommand\part {\hbs@do\hbs@part}% |
| 567 |
\renewcommand\section {\hbs@do\hbs@section}% |
| 568 |
\renewcommand\subsection {\hbs@do\hbs@subsection}% |
| 569 |
\renewcommand\subsubsection{\hbs@do\hbs@subsubsection}% |
| 570 |
\renewcommand\paragraph {\hbs@do\hbs@paragraph}% |
| 571 |
\renewcommand\subparagraph {\hbs@do\hbs@subparagraph}% |
| 572 |
\begingroup\expandafter\expandafter\expandafter\endgroup |
| 573 |
\expandafter\ifx\csname chapter\endcsname\relax\else |
| 574 |
\let\hbs@chapter \chapter |
| 575 |
\renewcommand\chapter {\hbs@do\hbs@chapter}% |
| 576 |
\fi |
| 577 |
} |
| 578 |
% \end{macrocode} |
| 579 |
% |
| 580 |
% \begin{macrocode} |
| 581 |
%</package> |
| 582 |
% \end{macrocode} |
| 583 |
% |
| 584 |
% \section{Installation} |
| 585 |
% |
| 586 |
% \subsection{Download} |
| 587 |
% |
| 588 |
% \paragraph{Package.} This package is available on |
| 589 |
% CTAN\footnote{\CTANpkg{hypbmsec}}: |
| 590 |
% \begin{description} |
| 591 |
% \item[\CTAN{macros/latex/contrib/oberdiek/hypbmsec.dtx}] The source file. |
| 592 |
% \item[\CTAN{macros/latex/contrib/oberdiek/hypbmsec.pdf}] Documentation. |
| 593 |
% \end{description} |
| 594 |
% |
| 595 |
% |
| 596 |
% \paragraph{Bundle.} All the packages of the bundle `oberdiek' |
| 597 |
% are also available in a TDS compliant ZIP archive. There |
| 598 |
% the packages are already unpacked and the documentation files |
| 599 |
% are generated. The files and directories obey the TDS standard. |
| 600 |
% \begin{description} |
| 601 |
% \item[\CTANinstall{install/macros/latex/contrib/oberdiek.tds.zip}] |
| 602 |
% \end{description} |
| 603 |
% \emph{TDS} refers to the standard ``A Directory Structure |
| 604 |
% for \TeX\ Files'' (\CTANpkg{tds}). Directories |
| 605 |
% with \xfile{texmf} in their name are usually organized this way. |
| 606 |
% |
| 607 |
% \subsection{Bundle installation} |
| 608 |
% |
| 609 |
% \paragraph{Unpacking.} Unpack the \xfile{oberdiek.tds.zip} in the |
| 610 |
% TDS tree (also known as \xfile{texmf} tree) of your choice. |
| 611 |
% Example (linux): |
| 612 |
% \begin{quote} |
| 613 |
% |unzip oberdiek.tds.zip -d ~/texmf| |
| 614 |
% \end{quote} |
| 615 |
% |
| 616 |
% \subsection{Package installation} |
| 617 |
% |
| 618 |
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting |
| 619 |
% \docstrip\ archive. The files are extracted by running the |
| 620 |
% \xfile{.dtx} through \plainTeX: |
| 621 |
% \begin{quote} |
| 622 |
% \verb|tex hypbmsec.dtx| |
| 623 |
% \end{quote} |
| 624 |
% |
| 625 |
% \paragraph{TDS.} Now the different files must be moved into |
| 626 |
% the different directories in your installation TDS tree |
| 627 |
% (also known as \xfile{texmf} tree): |
| 628 |
% \begin{quote} |
| 629 |
% \def\t{^^A |
| 630 |
% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} |
| 631 |
% hypbmsec.sty & tex/latex/oberdiek/hypbmsec.sty\\ |
| 632 |
% hypbmsec.pdf & doc/latex/oberdiek/hypbmsec.pdf\\ |
| 633 |
% hypbmsec.dtx & source/latex/oberdiek/hypbmsec.dtx\\ |
| 634 |
% \end{tabular}^^A |
| 635 |
% }^^A |
| 636 |
% \sbox0{\t}^^A |
| 637 |
% \ifdim\wd0>\linewidth |
| 638 |
% \begingroup |
| 639 |
% \advance\linewidth by\leftmargin |
| 640 |
% \advance\linewidth by\rightmargin |
| 641 |
% \edef\x{\endgroup |
| 642 |
% \def\noexpand\lw{\the\linewidth}^^A |
| 643 |
% }\x |
| 644 |
% \def\lwbox{^^A |
| 645 |
% \leavevmode |
| 646 |
% \hbox to \linewidth{^^A |
| 647 |
% \kern-\leftmargin\relax |
| 648 |
% \hss |
| 649 |
% \usebox0 |
| 650 |
% \hss |
| 651 |
% \kern-\rightmargin\relax |
| 652 |
% }^^A |
| 653 |
% }^^A |
| 654 |
% \ifdim\wd0>\lw |
| 655 |
% \sbox0{\small\t}^^A |
| 656 |
% \ifdim\wd0>\linewidth |
| 657 |
% \ifdim\wd0>\lw |
| 658 |
% \sbox0{\footnotesize\t}^^A |
| 659 |
% \ifdim\wd0>\linewidth |
| 660 |
% \ifdim\wd0>\lw |
| 661 |
% \sbox0{\scriptsize\t}^^A |
| 662 |
% \ifdim\wd0>\linewidth |
| 663 |
% \ifdim\wd0>\lw |
| 664 |
% \sbox0{\tiny\t}^^A |
| 665 |
% \ifdim\wd0>\linewidth |
| 666 |
% \lwbox |
| 667 |
% \else |
| 668 |
% \usebox0 |
| 669 |
% \fi |
| 670 |
% \else |
| 671 |
% \lwbox |
| 672 |
% \fi |
| 673 |
% \else |
| 674 |
% \usebox0 |
| 675 |
% \fi |
| 676 |
% \else |
| 677 |
% \lwbox |
| 678 |
% \fi |
| 679 |
% \else |
| 680 |
% \usebox0 |
| 681 |
% \fi |
| 682 |
% \else |
| 683 |
% \lwbox |
| 684 |
% \fi |
| 685 |
% \else |
| 686 |
% \usebox0 |
| 687 |
% \fi |
| 688 |
% \else |
| 689 |
% \lwbox |
| 690 |
% \fi |
| 691 |
% \else |
| 692 |
% \usebox0 |
| 693 |
% \fi |
| 694 |
% \end{quote} |
| 695 |
% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's |
| 696 |
% TDS installing feature, then some files can already be in the right |
| 697 |
% place, see the documentation of \docstrip. |
| 698 |
% |
| 699 |
% \subsection{Refresh file name databases} |
| 700 |
% |
| 701 |
% If your \TeX~distribution |
| 702 |
% (\TeX\,Live, \mikTeX, \dots) relies on file name databases, you must refresh |
| 703 |
% these. For example, \TeX\,Live\ users run \verb|texhash| or |
| 704 |
% \verb|mktexlsr|. |
| 705 |
% |
| 706 |
% \subsection{Some details for the interested} |
| 707 |
% |
| 708 |
% \paragraph{Unpacking with \LaTeX.} |
| 709 |
% The \xfile{.dtx} chooses its action depending on the format: |
| 710 |
% \begin{description} |
| 711 |
% \item[\plainTeX:] Run \docstrip\ and extract the files. |
| 712 |
% \item[\LaTeX:] Generate the documentation. |
| 713 |
% \end{description} |
| 714 |
% If you insist on using \LaTeX\ for \docstrip\ (really, |
| 715 |
% \docstrip\ does not need \LaTeX), then inform the autodetect routine |
| 716 |
% about your intention: |
| 717 |
% \begin{quote} |
| 718 |
% \verb|latex \let\install=y\input{hypbmsec.dtx}| |
| 719 |
% \end{quote} |
| 720 |
% Do not forget to quote the argument according to the demands |
| 721 |
% of your shell. |
| 722 |
% |
| 723 |
% \paragraph{Generating the documentation.} |
| 724 |
% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate |
| 725 |
% the documentation. The process can be configured by the |
| 726 |
% configuration file \xfile{ltxdoc.cfg}. For instance, put this |
| 727 |
% line into this file, if you want to have A4 as paper format: |
| 728 |
% \begin{quote} |
| 729 |
% \verb|\PassOptionsToClass{a4paper}{article}| |
| 730 |
% \end{quote} |
| 731 |
% An example follows how to generate the |
| 732 |
% documentation with pdf\LaTeX: |
| 733 |
% \begin{quote} |
| 734 |
%\begin{verbatim} |
| 735 |
%pdflatex hypbmsec.dtx |
| 736 |
%makeindex -s gind.ist hypbmsec.idx |
| 737 |
%pdflatex hypbmsec.dtx |
| 738 |
%makeindex -s gind.ist hypbmsec.idx |
| 739 |
%pdflatex hypbmsec.dtx |
| 740 |
%\end{verbatim} |
| 741 |
% \end{quote} |
| 742 |
% |
| 743 |
% \begin{History} |
| 744 |
% \begin{Version}{1998/11/20 v1.0} |
| 745 |
% \item |
| 746 |
% First version. |
| 747 |
% \item |
| 748 |
% It merges package \xpackage{hysecopt} and |
| 749 |
% \item |
| 750 |
% package \xpackage{hypbmpar}. |
| 751 |
% \item |
| 752 |
% Published for the DANTE'99 meeting^^A |
| 753 |
% \URL{}{http://dante99.cs.uni-dortmund.de/handouts/oberdiek/hypbmsec.sty}. |
| 754 |
% \end{Version} |
| 755 |
% \begin{Version}{1999/04/12 v2.0} |
| 756 |
% \item |
| 757 |
% Adaptation to \Package{hyperref} version 6.54. |
| 758 |
% \item |
| 759 |
% Documentation in dtx format. |
| 760 |
% \item |
| 761 |
% Copyright: LPPL (\CTAN{macros/latex/base/lppl.txt}) |
| 762 |
% \item |
| 763 |
% First CTAN release. |
| 764 |
% \end{Version} |
| 765 |
% \begin{Version}{2000/03/22 v2.1} |
| 766 |
% \item |
| 767 |
% Bug fix in redefinition of \cmd{\chapter}. |
| 768 |
% \item |
| 769 |
% Copyright: LPPL 1.2 |
| 770 |
% \end{Version} |
| 771 |
% \begin{Version}{2006/02/20 v2.2} |
| 772 |
% \item |
| 773 |
% Code is not changed. |
| 774 |
% \item |
| 775 |
% New DTX framework. |
| 776 |
% \item |
| 777 |
% LPPL 1.3 |
| 778 |
% \end{Version} |
| 779 |
% \begin{Version}{2007/03/05 v2.3} |
| 780 |
% \item |
| 781 |
% Bug fix: Expand \cs{hbs@tocstring} and \cs{hbs@bmstring} before |
| 782 |
% calling \cs{hbs@seccmd}. |
| 783 |
% \end{Version} |
| 784 |
% \begin{Version}{2007/04/11 v2.4} |
| 785 |
% \item |
| 786 |
% Line ends sanitized. |
| 787 |
% \end{Version} |
| 788 |
% \begin{Version}{2016/05/16 v2.5} |
| 789 |
% \item |
| 790 |
% Documentation updates. |
| 791 |
% \end{Version} |
| 792 |
% \begin{Version}{2024-08-07 v2.6} |
| 793 |
% \item Updated |
| 794 |
% \end{Version} |
| 795 |
% \end{History} |
| 796 |
% |
| 797 |
% \PrintIndex |
| 798 |
% |
| 799 |
% \Finale |
| 800 |
\endinput |