Debian Codegraph @

texmf-dist/source/latex/thumbs/thumbs.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: thumbs.dtx
4 % Version: 2026-01-18 v1.1d
5 % Info: Thumb marks and overview page(s)
6 %
7 % Copyright © 2010 - 2026 by
8 % H.-Martin Münch <Martin dot Muench at Uni-Bonn dot de>
9 %
10 % This work may be distributed and/or modified under the
11 % conditions of the LaTeX Project Public License, either
12 % version 1.3c of this license or (at your option) any later
13 % version. This version of this license is in
14 % https://www.latex-project.org/lppl/lppl-1-3c.txt
15 % and the latest version of this license is in
16 % https://www.latex-project.org/lppl.txt
17 % and version 1.3c or later is part of all distributions of
18 % LaTeX version 2005-12-01 or later.
19 %
20 % This work has the LPPL maintenance status "maintained".
21 %
22 % The Current Maintainer of this work is H.-Martin Münch.
23 %
24 % This work consists of the main source file thumbs.dtx,
25 % the README, and the derived files
26 % thumbs.sty, thumbs.pdf,
27 % thumbs.ins, thumbs.drv,
28 % thumbs-example.tex, thumbs-example.pdf.
29 %
30 % "thumbs" is available on CTAN:
31 % https://ctan.org/pkg/thumbs
32 %
33 % Also a TDS.ZIP file is provided that contains all the files
34 % already sorted in a TDS tree:
35 % https://mirror.ctan.org/install/macros/latex/contrib/thumbs.tds.zip
36 %
37 %<*ignore>
38 \begingroup
39 \catcode123=1 %
40 \catcode125=2 %
41 \def\x{LaTeX2e}%
42 \expandafter\endgroup
43 \ifcase 0\ifx\install y1\fi\expandafter
44 \ifx\csname processbatchFile\endcsname\relax\else1\fi
45 \ifx\fmtname\x\else 1\fi\relax
46 \else\csname fi\endcsname
47 %</ignore>
48 %<*install>
49 \input docstrip.tex
50 \Msg{**************************************************************************}
51 \Msg{* Installation *}
52 \Msg{* Package: thumbs 2026-01-18 v1.1d Thumb marks and overview page(s) (HMM)*}
53 \Msg{**************************************************************************}
54
55 \keepsilent
56 \askforoverwritefalse
57
58 \let\MetaPrefix\relax
59 \preamble
60
61 This is a generated file.
62
63 Project: thumbs
64 Version: 2026-01-18 v1.1d
65 Info: Thumb marks and overview page(s)
66
67 Copyright (C) 2010 - 2026 by
68 H.-Martin Muench <Martin dot Muench at Uni-Bonn dot de>
69
70 This work may be distributed and/or modified under the
71 conditions of the LaTeX Project Public License, either
72 version 1.3c of this license or (at your option) any later
73 version. This version of this license is in
74 https://www.latex-project.org/lppl/lppl-1-3c.txt
75 and the latest version of this license is in
76 https://www.latex-project.org/lppl.txt
77 and version 1.3c or later is part of all distributions of
78 LaTeX version 2005-12-01 or later.
79
80 This work has the LPPL maintenance status "maintained".
81
82 The Current Maintainer of this work is H.-Martin Muench.
83
84 This work consists of the main source file thumbs.dtx,
85 the README, and the derived files
86 thumbs.sty, thumbs.pdf,
87 thumbs.ins, thumbs.drv,
88 thumbs-example.tex, thumbs-example.pdf.
89
90 In memoriam
91 Claudia Simone Barth + 1996-01-30
92 Tommy Muench + 2014-01-02
93 Hans-Klaus Muench + 2014-08-24
94
95 \endpreamble
96 \let\MetaPrefix\DoubleperCent
97
98 \generate{%
99 \file{thumbs.ins}{\from{thumbs.dtx}{install}}%
100 \file{thumbs.drv}{\from{thumbs.dtx}{driver}}%
101 \usedir{tex/latex/thumbs}%
102 \file{thumbs.sty}{\from{thumbs.dtx}{package}}%
103 \usedir{doc/latex/thumbs}%
104 \file{thumbs-example.tex}{\from{thumbs.dtx}{example}}%
105 }
106
107 \catcode32=13\relax% active space
108 \let =\space%
109 \Msg{************************************************************************}
110 \Msg{*}
111 \Msg{* To finish the installation you have to move the following}
112 \Msg{* file into a directory searched by TeX:}
113 \Msg{*}
114 \Msg{* thumbs.sty}
115 \Msg{*}
116 \Msg{* To produce the documentation run the file `thumbs.drv'}
117 \Msg{* through (pdf)LaTeX, e.g.}
118 \Msg{* pdflatex thumbs.drv}
119 \Msg{* makeindex -s gind.ist thumbs.idx}
120 \Msg{* pdflatex thumbs.drv}
121 \Msg{* makeindex -s gind.ist thumbs.idx}
122 \Msg{* pdflatex thumbs.drv}
123 \Msg{*}
124 \Msg{* At least three runs are necessary e.g. to get the}
125 \Msg{* references right!}
126 \Msg{*}
127 \Msg{* Happy TeXing!}
128 \Msg{*}
129 \Msg{************************************************************************}
130
131 \endbatchfile
132 %</install>
133 %<*ignore>
134 \fi
135 %</ignore>
136 %
137 % \section{The documentation driver file}
138 %
139 % The next bit of code contains the documentation driver file for
140 % \TeX , i.\,e., the file that will produce the documentation you
141 % are currently reading. It will be extracted from this file by the
142 % \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip}
143 % and specify the \texttt{driver} option when \texttt{docstrip}
144 % asks for options.
145 %
146 % \begin{macrocode}
147 %<*driver>
148 \NeedsTeXFormat{LaTeX2e}[2025-06-01]
149 \ProvidesFile{thumbs.drv}[2026-01-18 v1.1d Thumb marks and overview page(s) (HMM)]
150 \documentclass[landscape]{ltxdoc}[2024/02/08]% v2.1j Standard LaTeX documentation class
151 \usepackage{geometry}[2020/01/02]% v5.9 Page Geometry
152 \usepackage{holtxdoc}[2019/12/09]% v0.30 Private additional ltxdoc support (HO)
153 \hypersetup{%
154 pdfsubject={Thumb marks and overview page(s) (HMM)},%
155 pdfkeywords={LaTeX, thumb, thumbs, thumb index, thumbs index, index},%
156 pdfencoding=auto,%
157 pdflang={en},%
158 breaklinks=true,%
159 linktoc=all,%
160 pdfstartview=FitH,%
161 pdfpagelayout=OneColumn,%
162 bookmarksnumbered=true,%
163 bookmarksopen=true,%
164 bookmarksopenlevel=3,%
165 pdfmenubar=true,%
166 pdftoolbar=true,%
167 pdfwindowui=true,%
168 pdfnewwindow=true%
169 }
170 \CodelineIndex
171 \hyphenation{printing docu-ment docu-menta-tion}
172 \DeclareMathAlphabet{\mathup}{OT1}{\familydefault}{m}{n}
173 \DeclareRobustCommand{\unit}[1]{\ensuremath{\mathord{\thinspace\mathup{#1}}}}
174 \providecommand{\eTeX}{\ensuremath{\m@th\varepsilon}-\TeX}
175 \begin{document}
176 \DocInput{thumbs.dtx}%
177 \end{document}
178 %</driver>
179 % \end{macrocode}
180 % \fi
181 %
182 % \GetFileInfo{thumbs.drv}
183 %
184 % \begingroup
185 % \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}%
186 % \makeatletter
187 % \@onelevel@sanitize\x
188 % \expandafter\endgroup
189 % \expandafter\DoNotIndex\expandafter{\x}
190 % \expandafter\DoNotIndex\expandafter{\string\ }
191 % \begingroup
192 % \makeatletter
193 % \lccode`9=32\relax
194 % \lowercase{%^^A
195 % \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A
196 % }%^^A
197 % \expandafter\endgroup\x
198 %
199 % \DoNotIndex{\ ,\,,\@auxout,\@expl@@@shipout@add@foreground@picture@@n,\@gobble,\@gobbletwo,%
200 % \@ifl@t@r,\@ifundefined,\@instreamthumb,\@tempcnta,\@tempdima,\@tempdimb,\@tempdimc,\@thumbsout,%
201 % \@unused,\@whilenum,\addcontentsline,\addtocontents,\addtocounter,\addtolength,\advance,\AlphAlph,%
202 % \arabic,\begin,\bigskip,\box,\c@page,\c@Th@mbTmpA,\c@Th@mbTmpB,\chapter,\cleardoublepage,\clearpage,%
203 % \closein,\closeout,\color,\colorlet,\csname,\DeclareKeys,\DeclareMathAlphabet,\DeclareRobustCommand,%
204 % \dimexpr,\divide,\do,\documentclass,\dotfill,\empty,\end,\endcsname,\ensuremath,\euro,\evenmarkindent,%
205 % \evenprintvoffset,\evensidemargin,\eventxtindent,\expanded,\familydefault,\fill,\fmtversion,\footskip,\frac,%
206 % \gdef,\glossary,\hbox,\headheight,\headsep,\hfill,\hrulefill,\hsize,\hspace,\Huge,\hyperref,%
207 % \if@filesw,\if@twocolumn,\if@twoside,\ifdim,\ifnum,\ifodd,\IfPackageLoadedF,\IfPackageLoadedT,%
208 % \IfPackageLoadedTF,\ifx,\immediate,\index,\jobname,\label,\LaTeX,\ldots,\leaders,\leftskip,\linebreak,%
209 % \lipsum,\listfiles,\makeatletter,\makeatother,\MakeUppercase,\MakeUppercases,\markboth,\mathord,\mathup,%
210 % \message,\MessageBreak,\NeedsTeXFormat,\newcommand,\newcounter,\newdimen,\newline,\newpage,\noindent,%
211 % \nopagecolor,\normalsize,\null,\number,\numexpr,\oddsidemargin,\PackageError,\PackageInfo,\PackageWarning,%
212 % \PackageWarningNoLine,\pagebreak,\pagecolor,\pagenumbering,\pageref,\paperheight,\paperwidth,\parbox,%
213 % \parindent,\PassOptionsToPackage,\phantom,\phantomsection,\ProcessKeyOptions,\protect,%
214 % \protected@file@percent,\ProvidesPackage,\put,\raggedleft,\raggedright,\read,\renewcommand,\RequirePackage,%
215 % \RerunFileCheck,\rlap,\rule,\section,\setcounter,\SetKeys,\setlength,\settowidth,\smallskip,\space,\ss,%
216 % \stepcounter,\tableofcontents,\textbf,\textheight,\textit,\textquotedblleft,\textquotedblright,\textsc,%
217 % \textsf,\textsuperscript,\texttt,\textwidth,\the,\thepage,\thepagecolor,\thinspace,\topmargin,%
218 % \url,\usepackage,\value,\vbox,\verb,\voffset,\vspace,\write,\z@}
219 %
220 % \title{The \xpackage{thumbs} package}
221 % \author{H.-Martin Münch\\\xemail{Martin.Muench at Uni-Bonn.de}}
222 % \date{2026-01-18 v1.1d}
223 % \maketitle
224 %
225 % \begin{abstract}
226 % \noindent This \LaTeX{} package allows to create one or more
227 % customizable thumb index(es), providing a quick and easy reference method
228 % for large documents. It must be loaded after the page size has been set,
229 % when printing the document no~\textquotedblleft shrink to
230 % page\textquotedblright{} should be used, and a printer capable of
231 % printing up to the border of the sheet of paper is needed
232 % (or afterwards cutting the paper, cf.~the \xpackage{crop} package).
233 % \end{abstract}
234 %
235 % \bigskip
236 %
237 % \noindent Disclaimer for web links: The author is not responsible for any contents
238 % referred to in this work unless having full knowledge of illegal contents.
239 % If any damage occurs by the use of information presented there,
240 % only the author of the respective pages might be liable,
241 % not the one who has referred to those pages.
242 % \newpage
243 % \tableofcontents
244 % \newpage
245 %
246 % \section{Introduction\label{s:Introduction}}
247 % \indent This \LaTeX{} package puts running, customizable thumb marks
248 % into the outer margin, moving downward as the chapter number
249 % (or whatever shall be marked by the thumb marks) increases.
250 % Additionally an overview page/table of thumb marks can be added automatically,
251 % which gives the respective names of the thumbed objects,
252 % the page where the object/thumb mark first appears,
253 % and the thumb mark itself at the respective position. The thumb marks are probably useful
254 % for documents, where a quick and easy way to find \hbox{e.\,g.}~a~chapter is needed, for example
255 % in reference guides, anthologies, or quite large documents.\newline
256 % \xpackage{thumbs} must be loaded after the page size has been set,
257 % when printing the document no~\textquotedblleft shrink to page\textquotedblright{} should
258 % be used, a~printer capable of printing up to the border of the sheet of paper is needed
259 % (or~afterwards cutting the paper, cf. the \xpackage{crop} packeg).\newline
260 % Usage with |\usepackage[landscape]{geometry}|, |\documentclass[landscape]{|\ldots|}|,
261 % |\usepackage[landscape]{geometry}|, \linebreak |\usepackage{lscape}|, or |\usepackage{pdflscape}|
262 % is possible.\par
263 %
264 % \noindent A note on terms and definitions:\par\vspace{+0.5\baselineskip}
265 %
266 % \noindent\textbf{Thumb index}:\vspace{-0.5\baselineskip}
267 % \begin{quote}
268 % A thumb index, also called a cut{-}in index or an index notch, is a round cut{-}out in the pages
269 % of dictionaries, encyclopedias, Bibles and other large religious books, and various sectioned,
270 % often alphabetic, reference works, used to locate entries starting at a particular letter or section.
271 % The individual notches are called thumb cuts and enable the reader to turn to any section they want.
272 % \end{quote}\vspace{-0.5\baselineskip}
273 % (\url{https://en.wikipedia.org/w/index.php?title=Thumb_index&oldid=1297058528};\newline
274 % see also \url{https://de.wikipedia.org/wiki/Daumenregister})\newline
275 % The \xpackage{thumbs} package does not auto{-}magically produce cuts
276 % in the paper, while the produced marks could be used to determine
277 % where to cut (and leaving one mark at the bottom of each cut).
278 % Therefore, strictly speaking, \xpackage{thumbs} is the wrong term.\par\vspace{+0.5\baselineskip}
279 %
280 % \noindent\textbf{Edge index}:\vspace{-0.5\baselineskip}
281 % \begin{quote}
282 % An edge index is a form of index that consists of marks on the edges of the pages of a printed
283 % work. These marks are step-like printed and usually contain order words, letters, or numbers,
284 % \hbox{(e.\,g.,} A~to Z in a dictionary or telephone book). Usually, they are colored and help to find
285 % desired points, especially in reference works. They are created by printing to the edge of the
286 % sheet so that they are visible on the closed books' edge. Advantageously, edge indexing is part
287 % of the printing process, permits nearly unlimited headings, and does not add to the cost of
288 % binding. These are offset by the disadvantage of being unable to know what a mark refers~to
289 % without opening the book. \ldots\newline
290 % When each edge index mark labels one chapter, the desired one can be found by counting the marks.
291 % When the edge index marks label first letters in a dictionary or telephone book, some can be
292 % identified by their \textquotedblleft thickness\textquotedblright , i.\,e.~in English there are
293 % only few words beginning with \textquotedblleft Q\textquotedblright{} but a lot beginning with
294 % \textquotedblleft S\textquotedblright . \ldots\newline
295 % An edge index is distinct from a thumb index, but the terms thumb index or chapter thumbs
296 % have been applied to edge indices.
297 % \end{quote}\vspace{-0.5\baselineskip}
298 % (\url{https://en.wikipedia.org/w/index.php?title=Edge_index&oldid=1303541874};\newline
299 % see also \url{https://de.wikipedia.org/wiki/Handmarke} and\newline
300 % \url{http://de.wikipedia.org/wiki/Datei:Farbschnitt_und_Register.jpg}
301 % Book with blue cut decoration and edge index\newline
302 % \url{http://de.wikipedia.org/wiki/Datei:HandmarkeKopfschnitt.jpg}
303 % Edge index at the top cut\newline
304 % \url{http://de.wikipedia.org/wiki/Datei:SeitennummerierungEck.JPG}
305 % Page number at the top cut edge)\par
306 %
307 % \noindent The correct terms therefore are edge index and edge index marks.\newline
308 % When looking at the section about alternatives to this package
309 % (p.~\pageref{sec:Alternatives}), \textquotedblleft thumb (mark)\textquotedblright{} %
310 % obviousely is the term which is colloquially used for it.
311 % (A~search for \textquotedblleft edge\textquotedblright{} at
312 % \href{https://www.ctan.org/}{ctan.org} on 31. July 2023 returned no relevant result.)
313 % Thus the colloquial term has been kept for this package
314 % while here providing the information about the formal one.
315 %
316 % \section{Usage}
317 % \subsection{Loading}
318 % \indent Load the package placing
319 % \begin{quote}
320 % |\usepackage[<|\textit{options}|>]{thumbs}|
321 % \end{quote}
322 % \noindent into the preamble of your \LaTeXe\ source file.\newline
323 % The \xpackage{thumbs} package takes the dimensions of the page
324 % |\AddToHook{begindocument}[start]| and does not react to changes afterwards.
325 % Therefore this package must be loaded \emph{after} the page dimensions
326 % have been set, e.\,g.~with package \xpackage{geometry}
327 % (\url{https://www.ctan.org/pkg/geometry}).
328 % Of course it is also OK to just keep the default page/{}paper settings,
329 % but when anything is changed, it must be done before \xpackage{thumbs}
330 % executes its |\AddToHook{begindocument}[start]| code.\newline
331 % The format of the paper, where the document shall be printed upon,
332 % should also be used for creating the document. Then the document can
333 % be printed without adapting the size, like e.\,g.~\textquotedblleft shrink
334 % to page\textquotedblright . That would add a white border around the document
335 % and by moving the thumb marks from the edge of the paper they no longer appear
336 % at the side of the stack of paper. It is also necessary to use a printer
337 % capable of printing up to the border of the sheet of paper. Alternatively
338 % it is possible after the printing to cut the paper to the right size.
339 % (The \xpackage{crop}\index{crop} package is very useful for this.)
340 % While performing the cutting manually is probably quite cumbersome,
341 % printing houses use paper, which is larger than the desired format,
342 % and afterwards cut it to format.\newline
343 % Some faulty outdated version of a \xfile{pdf}-viewer added a white line
344 % at the bottom and right side of the document when presenting it.
345 % This did not change the printed version. To test for this problem,
346 % a doublepage of the example file has been completely coloured.
347 % (Probably better exclude those two pages from printing\ldots)\newline
348 % When using the thumb marks overview page (edge index), it is necessary
349 % to |\protect| entries like |\pi| (same as with entries in tables of contents,
350 % figures, tables,\ldots).
351 %
352 % \subsection{Options}
353 % \DescribeMacro{options}
354 % \indent The \xpackage{thumbs} package takes the following options:
355 %
356 % \subsubsection{linefill\label{sss:linefill}}
357 % \DescribeMacro{linefill}
358 % \indent Option |linefill| wants to know how the line between object
359 % (e.\,g.~chapter name) and page number shall be filled at the overview
360 % page. Empty option will result in a blank line, |line| will fill the distance
361 % with a line, |dots| will fill the distance with dots.
362 %
363 % \subsubsection{thumblink\label{sss:thumblink}}
364 % \DescribeMacro{thumblink}
365 % \indent Option |thumblink| determines, what is hyperlinked at the thumb marks
366 % overview page (when the \xpackage{hyperref} package is used):
367 %
368 % \begin{description}
369 % \item[- |none|] creates \emph{none} hyperlinks
370 %
371 % \item[- |title|] hyperlinks the \emph{titles} of the thumb marks
372 %
373 % \item[- |page|] hyperlinks the \emph{page} numbers of the thumb marks
374 %
375 % \item[- |titleandpage|] hyperlinks the \emph{title and page} numbers of the thumb marks
376 %
377 % \item[- |line|] hyperlinks the whole \emph{line}, i.\,e. title, dots%
378 % (or line or whatsoever) and page numbers of the thumb marks
379 %
380 % \item[- |rule|] hyperlinks the whole \emph{rule}.
381 % \end{description}
382 %
383 % \subsubsection{minheight\label{sss:minheight}}
384 % \DescribeMacro{minheight}
385 % \indent Option |minheight| wants to know the minimal vertical extension
386 % of each thumb mark. This is only useful in combination with option |height=auto|
387 % (see below). When the height is automatically calculated and smaller than
388 % the |minheight| value, the height is set equal to the given |minheight| value
389 % and a new column/page of thumb marks is used. The default value is
390 % $47\unit{pt}$\ $(\approx 16.5\unit{mm} \approx 0.65\unit{in})$.
391 %
392 % \subsubsection{height\label{sss:height}}
393 % \DescribeMacro{height}
394 % \indent Option |height| wants to know the vertical extension of each thumb mark.
395 % The default value \textquotedblleft |auto|\textquotedblright\ calculates
396 % an appropriate value automatically decreasing with increasing number of thumb
397 % marks (but fixed for each document). When the height is smaller than |minheight|,
398 % this package deems this as too small and instead uses a new column/page of thumb
399 % marks. If smaller thumb marks are really wanted, choose a smaller |minheight|
400 % (e.\,g.~$0\unit{pt}$).
401 %
402 % \subsubsection{width\label{sss:width}}
403 % \DescribeMacro{width}
404 % \indent Option |width| wants to know the horizontal extension of each thumb mark.
405 % The default option-value \textquotedblleft |auto|\textquotedblright\ calculates
406 % a width-value automatically: (|\paperwidth| minus |\textwidth|), which is the
407 % total width of inner and outer margin, divided by~$4$. Instead of this, any
408 % positive width given by the user is accepted. (Try |width={\paperwidth}|
409 % in the example!) Option |width={autoauto}| leads to thumb marks, which are
410 % just wide enough to fit the widest thumb mark text.
411 %
412 % \subsubsection{distance\label{sss:distance}}
413 % \DescribeMacro{distance}
414 % \indent Option |distance| wants to know the vertical spacing between
415 % two thumb marks. The default value is $2\unit{mm}$.
416 %
417 % \subsubsection{topthumbmargin\label{sss:topthumbmargin}}
418 % \DescribeMacro{topthumbmargin}
419 % \indent Option |topthumbmargin| wants to know the vertical spacing between
420 % the upper page (paper) border and top thumb mark. The default (|auto|)
421 % is $1\unit{inch}$ plus |\th@bmsvoffset| plus |\topmargin|.
422 % Dimensions (e.\,g.~$1\unit{cm}$) are also accepted.
423 %
424 % \subsubsection{bottomthumbmargin\label{sss:bottomthumbmargin}}
425 % \DescribeMacro{bottomthumbmargin}
426 % \indent Option |bottomthumbmargin| wants to know the vertical spacing between
427 % the lower page (paper) border and last thumb mark. The default (|auto|) for the
428 % position of the last thumb is\newline
429 % |1in+\topmargin-\th@mbsdistance+\th@mbheighty+\headheight+\headsep+\textheight|
430 % |+\footskip-\th@mbsdistance|\newline
431 % |-\th@mbheighty|.\newline
432 % Dimensions (e.\,g.~$1\unit{cm}$) are also accepted.
433 %
434 % \subsubsection{eventxtindent\label{sss:eventxtindent}}
435 % \DescribeMacro{eventxtindent}
436 % \indent Option |eventxtindent| expects a dimension (default value: $5\unit{pt}$,
437 % negative values are possible, of course),
438 % by which the text inside of thumb marks on even pages is moved away from the
439 % page edge, i.e. to the right. Probably using the same or at least a similar value
440 % as for option |oddtxtexdent| makes sense.
441 %
442 % \subsubsection{oddtxtexdent\label{sss:oddtxtexdent}}
443 % \DescribeMacro{oddtxtexdent}
444 % \indent Option |oddtxtexdent| expects a dimension (default value: $5\unit{pt}$,
445 % negative values are possible, of course),
446 % by which the text inside of thumb marks on odd pages is moved away from the
447 % page edge, i.e. to the left. Probably using the same or at least a similar value
448 % as for option |eventxtindent| makes sense.
449 %
450 % \subsubsection{evenmarkindent\label{sss:evenmarkindent}}
451 % \DescribeMacro{evenmarkindent}
452 % \indent Option |evenmarkindent| expects a dimension (default value: $0\unit{pt}$,
453 % negative values are possible, of course),
454 % by which the thumb marks (background and text) on even pages are moved away from the
455 % page edge, i.e. to the right. This might be useful when the paper,
456 % onto which the document is printed, is later cut to another format.
457 % Probably using the same or at least a similar value as for option |oddmarkexdent|
458 % makes sense.
459 %
460 % \subsubsection{oddmarkexdent\label{sss:oddmarkexdent}}
461 % \DescribeMacro{oddmarkexdent}
462 % \indent Option |oddmarkexdent| expects a dimension (default value: $0\unit{pt}$,
463 % negative values are possible, of course),
464 % by which the thumb marks (background and text) on odd pages are moved away from the
465 % page edge, i.e. to the left. This might be useful when the paper,
466 % onto which the document is printed, is later cut to another format.
467 % Probably using the same or at least a similar value as for option |oddmarkexdent|
468 % makes sense.
469 %
470 % \subsubsection{evenprintvoffset\label{sss:evenprintvoffset}}
471 % \DescribeMacro{evenprintvoffset}
472 % \indent Option |evenprintvoffset| expects a dimension (default value: $0\unit{pt}$,
473 % negative values are possible, of course),
474 % by which the thumb marks (background and text) on even pages are moved downwards.
475 % This might be useful when a duplex printer shifts recto and verso pages
476 % against each other by some small amount, \hbox{e.\,g.} a~millimeter or two,
477 % which is not uncommon. Please do not use this option with another value than $0\unit{pt}$
478 % for files which you submit to other persons. Their printer probably shifts the
479 % pages by another amount, which might even lead to increased mismatch
480 % if both printers shift in opposite directions. Ideally the pdf viewer
481 % would correct the shift depending on printer (or at least give some option
482 % similar to \textquotedblleft shift verso pages by
483 % \hbox{$x\unit{mm}$\textquotedblright{}.}
484 %
485 % \subsubsection{leftindexruleplus\label{sss:leftindexruleplus}}
486 % \DescribeMacro{leftindexruleplus}
487 % \indent Option |leftindexruleplus| expects a dimension (default value: $0\unit{pt}$,
488 % negative values are possible, of course),
489 % by which the rules of the thumb mark entries in the thumb mark overview (edge index)
490 % on left pages are made longer (or shorter, if negative value is given). Sometimes
491 % those rules end a bit too early. While I did not determine yet why they are behaving
492 % like this, option |leftindexruleplus| allows to add e.\,g.{} |\evensidemargin|
493 % (or $20\unit{pt}$ or another length) to the rules.
494 %
495 % \pagebreak
496 % \subsubsection{frame\label{sss:frame}}
497 % \DescribeMacro{frame}
498 % \indent Option |frame| is |\empty| by default. \textsc{Bjorn Victor} suggested
499 % to use thumb marks consisting only of frames instead of filled rectangles.
500 % This can be accomplished by giving a length to the option |frame|,
501 % for example |frame={2pt}|. The thumb mark is still filled, but with
502 % |\thepagecolor|, which makes it appear as empty.
503 %
504 % \subsubsection{frameinnercolor\label{sss:frameinnercolor}}
505 % \DescribeMacro{frameinnercolor}
506 % \indent If option |frame| is used with some length value (i.\,e. line thickness),
507 % the frame is filled with |\thepagecolor| by default. When another filling
508 % is whished for, the option |frameinnercolor| accepts colours,
509 % for example |frameinnercolor={yellow}|.
510 %
511 % \subsubsection{txtcentered\label{sss:txtcentered}}
512 % \DescribeMacro{txtcentered}
513 % \indent The thumb's text is placed using either |\raggedright| or |\raggedleft|
514 % (depending on left or right page for double sided documents).
515 % With option |txtcentered=true| the thumb's text is centered instead.
516 %
517 % \subsubsection{ignorehoffset, ignorevoffset\label{sss:ignoreoffset}}
518 % \DescribeMacro{ignorehoffset}
519 % \DescribeMacro{ignorevoffset}
520 % \indent Usually |\hoffset| and |\voffset| should be regarded,
521 % but moving the thumb marks away from the paper edge probably
522 % makes them useless. Therefore |\hoffset| and |\voffset| are ignored
523 % by default, or when option |ignorehoffset| or |ignorehoffset=true| is used
524 % (and |ignorevoffset| or |ignorevoffset=true|, respectively).
525 % But in case that the user wants to print at one sort of paper
526 % but later trim it to another one, regarding the offsets would be
527 % necessary (for example when using the \xpackage{crop}\index{crop} package).
528 % Therefore |ignorehoffset=false| and |ignorevoffset=false| can be used
529 % to regard these offsets. (Combinations |ignorehoffset=true, ignorevoffset=false|
530 % and |ignorehoffset=false, ignorevoffset=true| are also possible.)
531 %
532 % \subsubsection{nophantomsection\label{sss:nophantomsection}}
533 % \DescribeMacro{nophantomsection}
534 % \indent Option |nophantomsection| globally disables the automatic placement of a
535 % |\phantomsection| before the thumb marks. Generally it is desirable to have a
536 % hyperlink from the thumbs overview page to lead to the thumb mark and not to some
537 % earlier place. Therefore automatically a |\phantomsection| is placed before each
538 % thumb mark. But for example when using the thumb mark after a |\chapter{...}|
539 % command, it is probably nicer to have the link point at the top of that chapter's
540 % title (instead of the line below it). When automatic placing of the
541 % |\phantomsection|s has been globally disabled, nevertheless manual use of
542 % |\phantomsection| is still possible. The other way round: When automatic placing
543 % of the |\phantomsection|s has \emph{not} been globally disabled, it can be disabled
544 % just for the following thumb mark by the command |\thumbsnophantom|.
545 %
546 % \subsubsection{plainthumbsoverview\label{sss:plainthumbsoverview}}
547 % \DescribeMacro{plainthumbsoverview}
548 % \indent Option |plainthumbsoverview| (|false| by default, but |true| if used)
549 % removes the coloured rules behind the entries on the overview pages and prints
550 % the text in the current colour (usually black).
551 % (Feature requested by \textsc{bplasa}.)
552 %
553 % \pagebreak
554 % \subsubsection{verbose, silent\label{sss:verbose}}
555 % \DescribeMacro{verbose, silent}
556 % \indent Option |verbose=false| (the default) suppresses some messages,
557 % which otherwise are presented at the screen and written into the \xfile{log}~file.
558 % Look for\newline
559 % |************** THUMB dimensions **************|\newline
560 % in the \xfile{log} file for height and width of the thumb marks as well as
561 % top and bottom thumb marks margins.~--
562 % Instead of |verbose=false| also |silent=true| and instead of |verbose=true|
563 % also |silent=false| can be used.
564 %
565 % \subsubsection{draft, final\label{sss:draft}}
566 % \DescribeMacro{draft, final}
567 % \indent Option |draft| (\emph{not} the default) sets the thumb mark width to
568 % $2\unit{pt}$, thumb mark text colour to black and thumb mark background colour
569 % to grey (|gray|). Either do not use this option with the \xpackage{thumbs} package at all,
570 % or use |draft=false|, or |final|, or |final=true| to get the original appearance
571 % of the thumb marks.
572 %
573 % \subsubsection{hidethumbs\label{sss:hidethumbs}}
574 % \DescribeMacro{hidethumbs}
575 % \indent Option |hidethumbs| (\emph{not} the default) prevents \xpackage{thumbs}
576 % to create thumb marks (or thumb marks overview pages). This could be useful
577 % when thumb marks were placed, but for some reason no thumb marks (and overview pages)
578 % shall be placed. Removing |\usepackage[...]{thumbs}| would not work but
579 % create errors for unknown commands (e.\,g.~|\addthumb|, |\addtitlethumb|,
580 % |\thumbnewcolumn|, |\stopthumb|, |\continuethumb|, |\addthumbsoverviewtocontents|,
581 % |\thumbsoverview|, |\thumbsoverviewback|, \linebreak |\thumbsoverviewverso|, and
582 % |\thumbsoverviewdouble|). (A~|\jobname.tmb| file is created nevertheless.)~--
583 % Either do not use this option with the \xpackage{thumbs}
584 % package at all, or use |hidethumbs=false| to get the original appearance
585 % of the thumb marks.
586 %
587 % \subsubsection{righttoleft\label{sss:righttoleft}}
588 % \DescribeMacro{righttoleft}
589 % \indent Option |righttoleft| (\emph{not} the default) tells the \xpackage{thumbs} package
590 % that right-to-left writing is used (e.\,g.~Arabic) and the thumb marks need to be placed
591 % on the other edge of the paper. When using this option, also options like
592 % |eventxtindent| and |oddtxtexdent| need to be adapted, and you must expect to need to
593 % use |even| when you want to change |odd| and to use negative dimensions
594 % when you want to use positive ones -- everything is mirrored, but naming and such
595 % is not changed automatically.
596 %
597 % \subsubsection{Obsolete options: \texttt{pagecolor}, \texttt{evenindent}, \texttt{oddexdent}}
598 % \indent The following obsolete options have been removed:
599 % \begin{description}
600 % \item[-] |pagecolor|: Instead the \xpackage{pagecolor} package is used. Use |\pagecolor{...}|
601 % \emph{after} |\usepackage[...]{thumbs}| and \emph{before} \linebreak
602 % |\begin{document}| to define a background colour of the pages.
603 % \item[-] |evenindent|: It was replaced by option |eventxtindent|.
604 % \item[-] |oddexdent|: It was replaced by option |oddtxtexdent|.
605 %\end{description}
606 %
607 % \newpage
608 % \subsection{Commands to be used in the document}
609 % \subsubsection{\textbackslash addthumb}
610 % \DescribeMacro{\addthumb}
611 % To add a thumb mark, use the |\addthumb| command, which has these four parameters:
612 % \begin{enumerate}
613 % \item a title for the thumb mark (for the thumb marks overview page,
614 % e.\,g.~the chapter title),
615 %
616 % \item the text to be displayed in the thumb mark (for example the chapter
617 % number: |\thechapter|),
618 %
619 % \item the colour of the text in the thumb mark,
620 %
621 % \item and the background colour of the thumb mark
622 % \end{enumerate}
623 % (parameters in this order) at the page where you want this thumb mark placed
624 % (for the first time).
625 %
626 % \subsubsection{\textbackslash addtitlethumb}
627 % \DescribeMacro{\addtitlethumb}
628 % When a thumb mark shall not or cannot be placed on a page, e.\,g.~at the title page or
629 % when using |\includepdf| from \xpackage{pdfpages} package, but the reference in the thumb
630 % marks overview nevertheless shall name that page number and hyperlink to that page,
631 % |\addtitlethumb| can be used at the following page. It has five arguments. The arguments
632 % one to four are identical to the ones of |\addthumb| (see above),
633 % and the fifth argument consists of the label of the page, where the hyperlink
634 % at the thumb marks overview page shall link to. The \xpackage{thumbs} package does
635 % \emph{not} create that label!
636 % If manually no label can be placed on the first page, the label \texttt{pagesLTS.0}
637 % from the \xpackage{pageslts} package (needs to be loaded explicitly!) can be used.
638 %
639 % \subsubsection{\textbackslash stopthumb and \textbackslash continuethumb}
640 % \DescribeMacro{\stopthumb}
641 % \DescribeMacro{\continuethumb}
642 % When a page (or pages) shall have no thumb marks, use the |\stopthumb| command
643 % (without parameters). Placing another thumb mark with |\addthumb| or |\addtitlethumb|
644 % or using the command |\continuethumb| continues the thumb marks.
645 %
646 % \subsubsection{\textbackslash thumbsoverview/back/verso/double}
647 % \DescribeMacro{\thumbsoverview}
648 % \DescribeMacro{\thumbsoverviewback}
649 % \DescribeMacro{\thumbsoverviewverso}
650 % \DescribeMacro{\thumbsoverviewdouble}
651 % The commands |\thumbsoverview|, |\thumbsoverviewback|, |\thumbsoverviewverso|, and/or
652 % |\thumbsoverviewdouble| is/are used to place the overview page(s) for the thumb marks
653 % (edge index). Their single parameter is used to mark this page/these pages%
654 % (e.\,g.~in the page header). If these marks are not wished, |\thumbsoverview...{}|
655 % will generate empty marks in the page header(s). |\thumbsoverview| can be used
656 % more than once (for example at the beginning and at the end of the document,
657 % or |\thumbsoverview| at the beginning and |\thumbsoverviewback| at the end).
658 % The overviews have labels |TableOfThumbs1|, |TableOfThumbs2|, and so on,
659 % which can be referred to with e.\,g.{} |\pageref{TableOfThumbs1}|.
660 % The reference |TableOfThumbs| (without number) aims at the last used Table of Thumbs
661 % (for compatibility with older versions of this package). When using option |righttoleft|,
662 % the marks are placed at the other edge of the page than listed here.
663 % \begin{description}
664 % \item[-] |\thumbsoverview| prints the thumb marks at the right side
665 % and (in |twoside| mode) skips left sides (useful e.\,g.{} at the beginning
666 % of a document).
667 %
668 % \item[-] |\thumbsoverviewback| prints the thumb marks at the left side
669 % and (in |twoside| mode) skips right sides (useful e.\,g.{} at the end
670 % of a document).
671 %
672 % \item[-] |\thumbsoverviewverso| prints the thumb marks at the right side
673 % and (in |twoside| mode) repeats them at the next left side and so on
674 % (useful anywhere in the document and when one wants to prevent empty
675 % pages).
676 %
677 % \item[-] |\thumbsoverviewdouble| prints the thumb marks at the left side
678 % and (in |twoside| mode) repeats them at the next right side and so on
679 % (useful anywhere in the document and when one wants to prevent empty
680 % pages).
681 % \end{description}
682 % \smallskip
683 %
684 % \subsubsection{\textbackslash thumbnewcolumn}
685 % \DescribeMacro{\thumbnewcolumn}
686 % With the command |\thumbnewcolumn| a new column can be started, even if the current one
687 % was not filled. This could be useful e.\,g.{} for a dictionary, which uses one column for
688 % translations from language A to language B, and the second column for translations
689 % from language B to language A. But in that case one probably should increase the
690 % size of the thumb marks, so that $26$~thumb marks (in~case of the Latin alphabet)
691 % fill one thumb column. Do not use |\thumbnewcolumn| on a page where |\addthumb| was
692 % already used, but use |\addthumb| immediately after |\thumbnewcolumn|.
693 %
694 % \subsubsection{\textbackslash addthumbsoverviewtocontents}
695 % \DescribeMacro{\addthumbsoverviewtocontents}
696 % |\addthumbsoverviewtocontents| with two arguments is a replacement for
697 % |\addcontentsline{toc}{<level>}{<text>}|, where the first argument of
698 % |\addthumbsoverviewtocontents| is for |<level>| and the second for |<text>|.
699 % If an entry of the thumbs mark overview shall be placed in the table of contents,
700 % |\addthumbsoverviewtocontents| with its arguments should be used immediately before
701 % |\thumbsoverview|.
702 %
703 % \subsubsection{\textbackslash thumbsnophantom}
704 % \DescribeMacro{\thumbsnophantom}
705 % When automatic placing of the |\phantomsection|s has \emph{not} been globally
706 % disabled by using option |nophantomsection| (see subsection~\ref{sss:nophantomsection}),
707 % it can be disabled just for the following thumb mark by the command |\thumbsnophantom|.
708 %
709 % \subsection{Changing thumb colour and text\label{ss:VariableThumb}}%
710 % \index{Changing thumb colour and text}%
711 % \DescribeMacro{Changing thumb colour and~text}%
712 % It is possible to change the colour and text of an existing thumb mark.
713 % To accomplish this, in the preamble two new colours must be defined, for example:
714 %
715 %\begin{verbatim}
716 %\xdef\thetextchangingcolour{red}%
717 %\colorlet{textchangingcolour}{\thetextchangingcolour}%
718 %
719 %\xdef\themarkchangingcolour{green}%
720 %\colorlet{markchangingcolour}{\themarkchangingcolour}%
721 %\end{verbatim}
722 %
723 % \noindent and two commands for the text, for example:
724 %
725 %\begin{verbatim}
726 %\DeclareRobustCommand{\thethumbchangingtextE}{\Huge{\textbf{E}}}
727 %\DeclareRobustCommand{\thethumbchangingtexte}{\Huge{\textbf{e}}}
728 %
729 %\gdef\thumbchangingtext{\thethumbchangingtexte}
730 %\end{verbatim}
731 %
732 % \noindent Now a thumb mark added with
733 % \hbox{|\addthumb{Name}{\protect\thumbchangingtext}{textchangingcolour}{markchangingcolour}|}
734 % appears as red text \textquotedblleft E\textquotedblright{} on green background,
735 % but really it is not \texttt{red} but \texttt{textchangingcolour}
736 % (which was defined as \texttt{red}) and not \texttt{green} but
737 % \texttt{markchangingcolour} (which was defined as \texttt{green})
738 % and not \textquotedblleft E\textquotedblright{} but
739 % |\thumbchangingtext|, which currently just happens (well, on purpose)
740 % to be \textquotedblleft E\textquotedblright .
741 %
742 % \noindent Some pages(s) later:
743 %
744 % \begin{verbatim}
745 %\xdef\thetextchangingcolour{blue}%
746 %\colorlet{textchangingcolour}{\thetextchangingcolour}%
747 %
748 %\xdef\themarkchangingcolour{yellow}%
749 %\colorlet{markchangingcolour}{\themarkchangingcolour}%
750 %
751 %\gdef\thumbchangingtext{\thethumbchangingtexte}%
752 %\end{verbatim}
753 %
754 % \noindent Here the thumb mark still uses \texttt{textchangingcolour},
755 % \texttt{markchangingcolour}, and |\thumbchangingtext|,
756 % but instead of \texttt{red}, \texttt{green}, and \textquotedblleft E\textquotedblright{}
757 % those have been redefined to \texttt{blue}, \texttt{yellow}, and
758 % \textquotedblleft e\textquotedblright{}. Instead of |\thumbchangingtext|
759 % also some variable like |\thepage| can be used.\newline
760 % For the thumb marks overview page(s) it must be decided which colours and text
761 % to use and the according definitions have to be made before that page/those pages!
762 % Otherwise inconsistencies or even
763 % \textquotedblleft\texttt{undefined}\textquotedblright{-}errors
764 % would result.\newline
765 % (This feature was requested by \textsc{Su Mei Goh}.)
766 %
767 % \subsection{crop\label{ss:crop}}\index{crop}
768 % \DescribeMacro{crop}
769 % To make the thumb marks \textquotedblleft bleed \textquotedblright{} (i.\,e.
770 % really appear at the edge), they must really extend to the edge of the paper.
771 % To accomplish this, either a really-to-the-edge-printer is needed or
772 % after printing cutting the paper right through a part of the thumb marks.
773 % (Printing houses use paper, which is larger than the desired format,
774 % and afterwards cut it to format.)
775 % If you do not want to be left with a smaller paper format,
776 % you can start with a larger physical page (without changing the page layout!).
777 % The \xpackage{crop} package is very useful for this. For testing that package,
778 % you can use A4 paper layout and print on A3 paper;
779 % for real production probably \textquotedblleft frame \textquotedblright{} would
780 % be removed from the crop options:
781 % \begin{verbatim}
782 % \usepackage[cross,cam,frame,width=297truemm,height=420truemm,center,axes]{crop}[2017/11/19]% v1.10 Crop marks (MF)
783 % \end{verbatim}
784 % In contrast to the \textquotedblleft normal \textquotedblright{} example
785 % the offsets must be regarded for use with the crop package, i.\,e.~ options
786 % |ignorehoffset=false| and |ignorevoffset=false| should be given to the
787 % \xpackage{thumbs} package. The example file has been prepared accordingly
788 % but \xpackage{crop} and the options have been commented out.
789 %
790 % \newpage
791 % \section{Alternatives\label{sec:Alternatives}}\index{Alternatives}
792 %
793 % \begin{description}
794 % \item[-] \xpackage{chapterthumb}, 2005/03/10, v0.1, by \textsc{Markus Kohm}, available at\newline
795 % \url{https://mirror.ctan.org/info/examples/KOMA-Script-3/Anhang-B/source/chapterthumb.sty};\newline
796 % unfortunately without documentation, which is probably available in the book:\newline
797 % \textsc{Kohm}, \textsc{M., \& Morawski}, \textsc{J.-U.} (2012): KOMA-Script -- Die Anleitung.
798 % Eine Sammlung von Klassen und Paketen für \LaTeX2e,
799 % 4.,~überarbeitete und erweiterte Auflage,
800 % Lehmanns, Berlin, ISBN:~978-3-86541-459-5,
801 % \url{https://www.lehmanns.de/shop/mathematik-informatik/22551854-9783865414595-koma-script-die-anleitung}; in~German.
802 %
803 % \item[-] \xpackage{eso-pic}: While version v2.0c 2010/10/06 had issues,
804 % v3.0c 2023-05-03 might work. It is available at \url{https://ctan.org/pkg/eso-pic}.
805 %
806 % \item[-] \xpackage{fancytabs} is available at
807 % \url{https://ctan.org/pkg/fancytabs}; does requires \xpackage{TikZ} from the
808 % \href{https://ctan.org/pkg/pgf}{pgf} bundle.
809 %
810 % \item[-] \xpackage{thumb}, 2001, without file version, by \textsc{Ingo Klöckel},
811 % was available at ftp://ftp.dante.de/pub/tex/info/examples/ltt/thumb.sty, \linebreak
812 % unfortunately without documentation, which is probably available in the book:\newline
813 % \textsc{Klöckel}, \textsc{I.} (2001): \LaTeX2e.\ Tips und Tricks, Dpunkt.Verlag GmbH,
814 % ISBN:~978-3-93258-837-2; in~German.
815 %
816 % \item[-] \xpackage{thumb} (a completely different one), 1997/12/24, v1.0,
817 % by \textsc{Christian Holm}, available at \url{https://ctan.org/pkg/thumb}.
818 %
819 % \item[-] \xpackage{thumbindex}, 2009/12/13, without file version, by \textsc{Hisashi Morita},
820 % available at \url{https://hisashim.org/2009/12/13/thumbindex.html}.
821 %
822 % \item[-] Thumb-indexes, from the \xpackage{fancyhdr} package, available as source code
823 % in the documentation of the \xpackage{fancyhdr} package, \url{https://ctan.org/pkg/fancyhdr}.
824 %
825 % \item[-] \xpackage{thumbpdf}, 2018-09-07, v3.17, by \textsc{Heiko Oberdiek}, is for creating
826 % thumbnails in a \xfile{pdf} document, not thumb marks (and therefore \textit{no} alternative);
827 % available at \url{https://ctan.org/pkg/thumbpdf}.
828 %
829 % \item[-] \xpackage{thumby}, 2010/01/14, v0.1, by \textsc{Sergey Goldgaber},
830 % \textquotedblleft is designed to work with the \href{https://ctan.org/pkg/memoir}{memoir}
831 % class, and also requires \href{https://ctan.org/pkg/perltex}{Perl\TeX} and
832 % \href{https://ctan.org/pkg/pgf}{tikz}\textquotedblright\ %
833 % (\url{https://ctan.org/pkg/thumby}), available at \url{https://ctan.org/pkg/thumby}.
834 % \end{description}
835 %
836 % \bigskip
837 %
838 % \noindent Newer versions might be available (and better suited).
839 % You programmed or found another alternative,
840 % which is available at \url{CTAN.org}?
841 % OK, send an e-mail to me with the name, location at \url{CTAN.org},
842 % and a short notice, and I will probably include it in the list above.
843 % \newpage
844 %
845 % \section{Example}
846 % \begin{macrocode}
847 %<*example>
848 \documentclass[a4paper,twoside,british]{article}[2025/01/22]% v1.4n Standard LaTeX document class
849 \usepackage{lipsum}[2021-09-20]% v2.7 150 paragraphs of Lorem Ipsum dummy text
850 \usepackage{eurosym}[1998/08/06]% v1.1 European currency symbol ''Euro''
851 \usepackage[extension=pdf,%
852 pdfpagelayout=TwoPageRight,pdfpagemode=UseThumbs,%
853 plainpages=false,pdfpagelabels=true,%
854 hyperindex=false,%
855 pdflang={en},%
856 pdftitle={thumbs package example},%
857 pdfauthor={H.-Martin Muench},%
858 pdfsubject={Example for the thumbs package},%
859 pdfkeywords={LaTeX, thumbs, thumb marks},%
860 pdfview=Fit,pdfstartview=Fit,%
861 linktoc=all]{hyperref}[2025-07-12]% v7.01o Hypertext links for LaTeX
862 \usepackage[a4paper]{geometry}[2020/01/02]% v5.9 Page Geometry
863 % % For testing with package crop,
864 % % you can use a4 paper layout and print on a3 paper;
865 % % for real production probably "frame" would be removed from the crop options:
866 % \usepackage[cross,cam,frame,width=297truemm,height=420truemm,center,axes]{crop}[2017/11/19]% v1.10 Crop marks (MF)
867 \IfPackageLoadedTF{crop}{%
868 % In contrast to the "normal" example the offsets must be regarded for use with the crop package:
869 \PassOptionsToPackage{ignorehoffset=false,ignorevoffset=false}{thumbs}% crop
870 }{\PassOptionsToPackage{ignorehoffset=true,ignorevoffset=true}{thumbs}% no crop
871 }
872 \usepackage[linefill=dots,thumblink=rule,minheight={47pt},height={auto},width={auto},%
873 distance={2mm},topthumbmargin={auto},bottomthumbmargin={auto},%
874 eventxtindent={5pt},oddtxtexdent={5pt},%
875 evenmarkindent={0pt},oddmarkexdent={0pt},evenprintvoffset={0pt},%
876 leftindexruleplus={1em},%
877 % unused options: frame, frameinnercolor
878 txtcentered=false,%
879 nophantomsection=false,plainthumbsoverview=false,%
880 verbose=true,final=true, hidethumbs=false,%
881 % unused, obsolete options:
882 % pagecolor: instead the pagecolor package is used.
883 % evenindent: was replaced by eventxtindent.
884 % oddexdent: was replaced by oddtxtexdent.
885 ]{thumbs}[2026-01-18]% v1.1d Thumb marks and overview page(s) (HMM)
886 \nopagecolor% use \pagecolor{white} if \nopagecolor does not work
887 \IfPackageLoadedF{hyperref}{\usepackage{url}[2013/09/16]% v3.4 Verb mode for urls etc.
888 }
889
890 % \end{macrocode}
891 % \pagebreak
892 % \begin{macrocode}
893 \DeclareMathAlphabet{\mathup}{OT1}{\familydefault}{m}{n}
894 \DeclareRobustCommand{\unit}[1]{\ensuremath{\mathord{\thinspace\mathup{#1}}}}
895
896 \xdef\thetextchangingcolour{red}
897 \colorlet{textchangingcolour}{\thetextchangingcolour}
898
899 \xdef\themarkchangingcolour{green}
900 \colorlet{markchangingcolour}{\themarkchangingcolour}
901
902 \DeclareRobustCommand{\thethumbchangingtextE}{\Huge{\textbf{E}}}
903 \DeclareRobustCommand{\thethumbchangingtexte}{\Huge{\textbf{e}}}
904 \gdef\thumbchangingtext{\thethumbchangingtextE}
905
906 \listfiles
907 \begin{document}
908 \pagenumbering{arabic}
909 \label{FirstPage}
910 \section*{Example for thumbs}
911 \addcontentsline{toc}{section}{Example for thumbs}
912 \markboth{Example for thumbs}{Example for thumbs}
913
914 This example demonstrates the most common uses of package \textsf{thumbs}, v1.1d as of 2026-01-18.
915 The used options were\newline
916 \texttt{linefill=dots}, \texttt{thumblink=rule}, \texttt{minheight=\{47pt\}},
917 \texttt{height=auto}, \texttt{width={auto}}, \newline
918 \texttt{distance=\{2mm\}}, \texttt{topthumbmargin=\{auto\}}, \texttt{bottomthumbmargin=\{auto\}}, \newline
919 \texttt{eventxtindent=\{5pt\}}, \texttt{oddtxtexdent=\{5pt\}},
920 \texttt{evenmarkindent=\{0pt\}}, \texttt{oddmarkexdent=\{0pt\}}, \newline
921 \texttt{evenprintvoffset=\{0pt\}},
922 \texttt{leftindexruleplus=\{1em\}},
923 \texttt{txtcentered=false}, \newline
924 \texttt{nophantomsection=false},
925 \texttt{plainthumbsoverview=false},
926 \texttt{verbose=true}, \texttt{final=true}, and \newline
927 \texttt{hidethumbs=false}. \newline
928
929 These are the default options, except
930 \texttt{leftindexruleplus=\{1em\}} (default: \texttt{0pt}) and \newline
931 \texttt{verbose=true}.\newline
932
933 If package \textsf{crop} was loaded, options
934 \texttt{ignorehoffset=true} and \texttt{ignorevoffset=true} were passed to the \textsf{thumbs} package,
935 otherwise \texttt{ignorehoffset=false} and \texttt{ignorevoffset=false}. \newline
936
937 Options \texttt{frame} and \texttt{frameinnercolor} were not used.\newline
938
939 % \end{macrocode}
940 % \pagebreak
941 % \begin{macrocode}
942 The obsolete options \texttt{pagecolor} (instead the \texttt{pagecolor} package is used),
943 \texttt{evenindent} (was replaced by \texttt{eventxtindent}), and
944 \texttt{oddexdent} (was replaced by \texttt{oddtxtexdent}) were not used. \newline
945
946 For more details please see the documentation!\bigskip
947
948 \textbf{Hyperlinks or not:} If the \textsf{hyperref} package is loaded,
949 the references in the overview page for the thumb marks are also hyperlinked
950 (except when option \texttt{thumblink=none} is used).\bigskip
951
952 \noindent\textbf{For testing purpose pages \pageref{greenpage}f. have been completely coloured!}\newline
953 \textbf{Better exclude those two pages from printing\ldots}\bigskip
954
955 Some thumb mark texts are too large for the thumb mark by intention
956 (especially when the paper size and therefore also the thumb mark size
957 is decreased). When option \texttt{width=\{autoauto\}} would be used,
958 the thumb mark width would be automatically increased.
959 Please see page~\pageref{HugeText} for details!\bigskip
960
961 For printing this example to another format of paper (e.\,g.~A4) it is necessary to add the according
962 option (e.\,g.~\verb|a4paper|) to the document class and recompile it! (In that case the
963 thumb marks column change will occur at another point, of course.)
964 With paper format equal to document format the document can be printed without adapting the size,
965 like e.\,g.~\textquotedblleft shrink to page\textquotedblright . That would add a white border around
966 the document and by moving the thumb marks from the edge of the paper they no longer appear
967 at the side of the stack of paper. It is also necessary to use a printer capable of printing up to the
968 border of the sheet of paper. Alternatively it is possible after the printing to cut the paper to the
969 right size. While performing this manually is probably quite cumbersome, printing houses use paper,
970 which is slightly larger than the desired format, and afterwards cut it to format.
971 \newpage
972
973 \addtitlethumb{Frontmatter}{0}{white}{gray}{FirstPage}
974
975 At the first page no thumb mark was used, but we want to begin with thumb marks
976 at the first page, therefore a
977 \begin{verbatim}
978 \addtitlethumb{Frontmatter}{0}{white}{gray}{FirstPage}
979 \end{verbatim}
980 was used at the beginning of this page. This does not place a thumb mark at that page,
981 but the pagenumber and link{-}target in the Table of Thumbs point to the first page.
982 The label \verb|FirstPage| needs to be placed manually on the first page, of course!
983 If manually no label can be placed on the first page, the label \texttt{pagesLTS.0}
984 from the \textsf{pageslts} package (needs to be loaded explicitly!) can be used.
985 \newpage
986 \tableofcontents
987 \newpage
988
989 To include an overview page for the thumb marks,
990 \begin{verbatim}
991 \addthumbsoverviewtocontents{section}{Thumb marks overview}%
992 \thumbsoverview{Table of Thumbs}%
993 \end{verbatim}
994 is used, where \verb|\addthumbsoverviewtocontents| adds the thumb marks overview page to the table of contents.
995 (\textquotedblleft Edge index\textquotedblright{} would be the correct/{}formal term, see the Introduction in the manual.)
996 \smallskip
997
998 Generally it is desirable to have a hyperlink from the thumbs overview page to lead to the thumb mark
999 and not to some earlier place. Therefore automatically a~\verb|\phantomsection| is placed before each thumb mark.
1000 But for example when using the thumb mark after a~\verb|\chapter{...}| command, it is probably nicer to have
1001 the link point at the top of that chapter's title (instead of the line below it). The automatic placing of the
1002 \verb|\phantomsection| can be disabled either globally by using option \texttt{nophantomsection},
1003 or locally for the next thumb mark by the command \verb|\thumbsnophantom|. (When disabled globally,
1004 still manual use of \verb|\phantomsection| is possible.)
1005
1006 \addthumbsoverviewtocontents{section}{Thumb marks overview}%
1007 \thumbsoverview{Table of Thumbs}%
1008
1009 \noindent Those were the overview pages for the thumb marks.
1010 \newpage
1011
1012 \section{The first section}
1013 \addthumb{First section}{%
1014 \space\Huge{\textbf{$1\textsuperscript{st}$}}}{yellow}{green}
1015
1016 \begin{verbatim}
1017 \addthumb{First section}{%
1018 \space\Huge{\textbf{$1\textsuperscript{st}$}}}{yellow}{green}
1019 \end{verbatim}
1020
1021 A thumb mark is added for this section. The parameters are: title for the thumb mark,
1022 the text to be displayed in the thumb mark (choose your own format),
1023 the colour of the text in the thumb mark,
1024 and the background colour of the thumb mark (parameters in this order).\newline
1025
1026 Now for some pages of \textquotedblleft content\textquotedblright\ldots
1027
1028 \newpage
1029 \lipsum[1]
1030 \newpage
1031 \lipsum[1]
1032 \newpage
1033 \lipsum[1]
1034 \newpage
1035
1036 \section{The second section}
1037 \addthumb{Second section}{\Huge{\textbf{\arabic{section}}}}{green}{yellow}
1038
1039 For this section, the text to be displayed in the thumb mark was set to
1040 \begin{verbatim}
1041 \Huge{\textbf{\arabic{section}}}
1042 \end{verbatim}
1043 i.\,e. the number of the section will be displayed (huge \& bold).\newline
1044
1045 Let us change the thumb mark on a page with an even number:
1046 \newpage
1047
1048 \section{The third section}
1049 \addthumb{Third section}{\Huge{\textbf{\arabic{section}}}}{blue}{red}
1050
1051 No problem!
1052
1053 And you do not need to have a section to add a thumb:
1054 \newpage
1055
1056 \addthumb{Still third section}{\Huge{\textbf{\arabic{section}b}}}{red}{blue}
1057
1058 This is still the third section, but there is a new thumb mark.
1059
1060 On the other hand, you can even get rid of the thumb marks for some page(s):
1061 \newpage
1062
1063 \stopthumb
1064
1065 \noindent The command
1066 \begin{verbatim}
1067 \stopthumb
1068 \end{verbatim}
1069 was used here. Until another \verb|\addthumb| (with parameters) or
1070 \begin{verbatim}
1071 \continuethumb
1072 \end{verbatim}
1073 is used, there will be no more thumb marks.
1074 \newpage
1075 Still no thumb marks.\newpage
1076 Still no thumb marks.\newpage
1077 Still no thumb marks.\newpage
1078
1079 % \end{macrocode}
1080 % \pagebreak
1081 % \begin{macrocode}
1082 \continuethumb
1083
1084 Thumb mark continued (unchanged).\newpage
1085 Thumb mark continued (unchanged).\newpage
1086
1087 Time for another thumb,
1088
1089 \addthumb{Another heading}{Small text}{white}{black}
1090
1091 and another.\bigskip
1092
1093 \addthumb{Huge Text paragraph}{\Huge{Huge\newline Text}}{yellow}{green}
1094
1095 \textquotedblleft {\Huge{Huge Text}}\textquotedblright\ is too wide for the thumb mark. When option
1096 \texttt{width=\{autoauto\}} would be used, the thumb mark width would be automatically increased.
1097 Now the text is either split over two lines (try \verb|Huge\newline Text| for another format)
1098 or (in case \verb|Huge~Text| is used) is written over the border of the thumb mark. When the text is
1099 too wide for the thumb mark and cannot be split, \LaTeX{} might nevertheless place the text into the
1100 next line. By this the text is placed too low. Adding a
1101 \hbox{\verb|\protect\vspace*{-| some length \verb|}|} to the text could help, for example\newline
1102 \verb|\addthumb{Huge Text}{\protect\vspace*{-3pt}\Huge{Huge~Text}}...|.\label{HugeText}\bigskip
1103
1104 \addthumb{Huge Text}{\Huge{Huge~Text}}{red}{blue}
1105 \addthumb{Huge Bold Text}{\Huge{\textbf{HBT}}}{black}{yellow}
1106
1107 \noindent When there is more than one thumb mark at one page, this is also no problem.\newpage
1108 Some text\newpage
1109 Some text\newpage
1110 Some text\newpage
1111
1112 \section{xcolor}
1113 \addthumb{xcolor}{\Huge{\textbf{xcolor}}}{magenta}{cyan}
1114
1115 It is probably a good idea to have a look at the \textsf{xcolor} package and use other colours than used
1116 in this example.\newline
1117 (About automatically increasing the thumb mark width to the thumb mark text width please see the note
1118 at page~\pageref{HugeText}.)
1119 \newpage
1120
1121 \addthumb{A mark}{\Huge{\textbf{A}}}{lime}{darkgray}
1122
1123 I just need to add further thumb marks to get them reaching the bottom of the page.\newline
1124 Generally the vertical size of the thumb marks is set to the value given in the height option.
1125 If it is \texttt{auto}, the size of the thumb marks is decreased, so that they fit all on one page.
1126 But when they get smaller than \texttt{minheight}, instead of decreasing their size further,
1127 a~new thumbs column is started (which will happen here).
1128 \newpage
1129
1130 \addthumb{B mark}{\Huge{\textbf{B}}}{brown}{pink}
1131
1132 Another thumb mark.\newpage
1133
1134 \addthumb{C mark}{\Huge{\textbf{C}}}{brown}{pink}
1135
1136 There! A new thumb column was started automatically!
1137
1138 On the one hand you can, of course, keep the colour for more than one thumb mark.
1139 On the other hand you can change the colour of an existing thumb mark,
1140 shown at page~\pageref{E mark}f.\newpage
1141
1142 \addthumb{$1/1.\,955\,83$\, EUR}{\Huge{\textbf{D}}}{orange}{violet}
1143
1144 \noindent I am just adding further thumb marks.
1145
1146 \noindent If you are curious why the thumb mark between
1147 \textquotedblleft C mark\textquotedblright\ and \textquotedblleft E mark\textquotedblright\ has
1148 not been named \textquotedblleft D mark\textquotedblright\ but
1149 \textquotedblleft $1/1.\,955\,83$\, EUR\textquotedblright :
1150
1151 $1\unit{DM}=1\unit{D\ Mark}=1\unit{Deutsche\ Mark}%
1152 =\frac{1}{1.\,955\,83}\,$\euro$\,=1/1.\,955\,83\unit{Euro}=1/1.\,955\,83\unit{EUR}$.
1153 \newpage
1154 Just a page.
1155 \newpage
1156
1157 \xdef\thetextchangingcolour{red}%
1158 \colorlet{textchangingcolour}{\thetextchangingcolour}%
1159
1160 \xdef\themarkchangingcolour{green}%
1161 \colorlet{markchangingcolour}{\themarkchangingcolour}%
1162
1163 %% In the preamble:
1164 %%\DeclareRobustCommand{\thethumbchangingtextE}{\Huge{\textbf{E}}}
1165 %%\DeclareRobustCommand{\thethumbchangingtexte}{\Huge{\textbf{e}}}
1166 %%\gdef\thumbchangingtext{\thethumbchangingtextE}
1167
1168 \gdef\thumbchangingtext{\thethumbchangingtextE}%
1169
1170 \addthumb{E mark}{\protect\thumbchangingtext}{textchangingcolour}{markchangingcolour}
1171 \label{E mark}
1172
1173 % \end{macrocode}
1174 % \pagebreak
1175 % \begin{macrocode}
1176 As announced above, it is not only possible to keep the colour for more than one thumb mark,
1177 but also to change the colour(s) and the text of an existing thumb mark. Here a thumb mark added with
1178 \begin{verbatim}
1179 \addthumb{Name}{\protect\thumbchangingtext}{textchangingcolour}{%
1180 markchangingcolour}
1181 \end{verbatim}
1182 appears as red text \textquotedblleft E\textquotedblright{} on green background,
1183 but really it is not \texttt{red} but \texttt{textchangingcolour} (which was defined as \texttt{red})
1184 and not \texttt{green} but\newline
1185 \texttt{markchangingcolour} (which was defined as \texttt{green}). Also the text of a thumb mark
1186 can be changed. Here \verb|thumbchangingtext| was used as text, which was defined as
1187 \verb|thethumbchangingtextE|, which was predefined in the preamble:
1188 \begin{verbatim}
1189 \DeclareRobustCommand{\thethumbchangingtextE}{\Huge{\textbf{E}}}
1190 \end{verbatim}
1191 \newpage
1192
1193 \noindent Some pages(s) later:
1194
1195 \begin{verbatim}
1196 \xdef\thetextchangingcolour{blue}%
1197 \colorlet{textchangingcolour}{\thetextchangingcolour}%
1198
1199 \xdef\themarkchangingcolour{yellow}%
1200 \colorlet{markchangingcolour}{\themarkchangingcolour}%
1201
1202 \gdef\thumbchangingtext{\thethumbchangingtexte}%
1203 \end{verbatim}
1204
1205 \xdef\thetextchangingcolour{blue}%
1206 \colorlet{textchangingcolour}{\thetextchangingcolour}%
1207
1208 \xdef\themarkchangingcolour{yellow}%
1209 \colorlet{markchangingcolour}{\themarkchangingcolour}%
1210
1211 \gdef\thumbchangingtext{\thethumbchangingtexte}%
1212
1213 And here the thumb mark still uses \texttt{textchangingcolour} and\newline
1214 \texttt{markchangingcolour}, but instead of \texttt{red} and \texttt{green}
1215 those have been redefined to \texttt{blue} and \texttt{yellow}.
1216 \verb|\thumbchangingtext| was still used as text, but redefined as \verb|\thethumbchangingtexte|,
1217 which was predefined in the preamble:
1218 \begin{verbatim}
1219 \DeclareRobustCommand{\thethumbchangingtexte}{\Huge{\textbf{e}}}
1220 \end{verbatim}
1221 % \end{macrocode}
1222 % \pagebreak
1223 % \begin{macrocode}
1224 Instead of \verb|\thumbchangingtext| also some variable like \verb|\thepage| can be used.\newline
1225 For the thumb marks overview page(s) it must be decided which colour(s) and text
1226 to use and the according definitions have to be made before that page{/}those pages!
1227 Otherwise inconsistencies or even \textquotedblleft\texttt{undefined}\textquotedblright{-}errors
1228 would result.
1229 \newpage
1230 (This page was intentionally left blank.)
1231 \newpage
1232
1233 To prevent inconsistencies between the different thumb mark overviews,
1234 we redefine \texttt{textchangingcolour} to \texttt{red},
1235 \texttt{markchangingcolour} to \texttt{green}, and
1236 \verb|\thumbchangingtext| to \verb|\thethumbchangingtextE| again here.
1237
1238 \xdef\thetextchangingcolour{red}%
1239 \colorlet{textchangingcolour}{\thetextchangingcolour}%
1240
1241 \xdef\themarkchangingcolour{green}%
1242 \colorlet{markchangingcolour}{\themarkchangingcolour}%
1243
1244 \gdef\thumbchangingtext{\thethumbchangingtextE}%
1245
1246 \newpage
1247
1248 \makeatletter%
1249 \ifx\thumbs@frame\thumbs@empty\relax%
1250 \gdef\thumbs@frame{2pt}%
1251 \gdef\th@mbs@fr@meinnercolor{\thepagecolor}% could also be another colour
1252 \gdef\thumbs@checkforexample{0}%
1253 \else% somebody changed the example to use the frame option:
1254 \gdef\thumbs@checkforexample{1}%
1255 \PackageInfo{thumbs}{The frame option is already used,\MessageBreak%
1256 not changing here anything!}%
1257 \fi%
1258 \makeatother%
1259
1260 \textsc{Bjorn Victor} suggested to use thumb marks consisting only of frames
1261 instead of filled rectangles. Options \texttt{frame} and \texttt{frameinnercolor} were introduced
1262 to accomplish this. While these options have not been used in this example, it is possible to trick
1263 \LaTeX{} into believing that they had been used. (Do not use this for a regular document!)
1264 This is just for demonstrating how a thumb mark consisting just of a frame with
1265 $2\unit{pt}$~thick lines would look like\newpage
1266 \noindent on left and right pages.\newpage
1267
1268 Now let us restore the filled thumb marks again
1269
1270 \makeatletter%
1271 \ifx\thumbs@checkforexample\thumbs@zero\relax%
1272 \gdef\thumbs@frame{\empty}%
1273 \gdef\th@mbs@fr@meinnercolor{\thepagecolor}%
1274 %\else Somebody changed the example to use the frame option!
1275 \fi%
1276 \makeatother%
1277
1278 and then have a look at \verb|\thumbsoverviewverso|:
1279
1280 \addthumbsoverviewtocontents{section}{Table of Thumbs, verso mode}%
1281 \thumbsoverviewverso{Table of Thumbs, verso mode}
1282
1283 \newpage
1284
1285 And, of course, also at \verb|\thumbsoverviewdouble|:
1286
1287 \addthumbsoverviewtocontents{section}{Table of Thumbs, double mode}%
1288 \thumbsoverviewdouble{Table of Thumbs, double mode}
1289
1290 \newpage
1291
1292 \addthumb{F mark}{\Huge{\textbf{F}}}{lightgray}{black}
1293
1294 I am just adding further thumb marks.
1295 \newpage
1296
1297 \addthumb{G mark}{\Huge{\textbf{G}}}{magenta}{black}
1298
1299 Some text.
1300
1301 \newpage
1302 \thumbnewcolumn
1303 \addthumb{New thumb marks column}{\Huge{\textit{NC}}}{magenta}{black}
1304
1305 There! A new thumb column was started manually!
1306
1307 \newpage
1308 Some text.
1309 \newpage
1310
1311 \addthumb{H mark}{\Huge{\textbf{H}}}{orange}{violet}
1312
1313 I just added another thumb mark.
1314 \newpage
1315 The following two pages are completely coloured in green.
1316 \newpage
1317 \pagecolor{green}
1318
1319 \IfPackageLoadedT{hyperref}{\phantomsection}
1320 \label{greenpage}
1321
1322 Some faulty, outdated version of a pdf-viewer sometimes (for the same document!)
1323 added a white line at the bottom and right side of the document when presenting it. This did
1324 not change the printed version. To test for this problem, this doublepage has been completely coloured.
1325 (Probably better exclude these two pages from printing!)\newline
1326
1327 \textsc{Heiko Oberdiek} wrote at Tue, 26 Apr 2011 14:13:29 +0200 in the \newline
1328 comp.text.tex newsgroup (see e.\,g.\newline
1329 \url{https://groups.google.com/g/de.comp.text.tex/c/4GAcL6qlTZ8/m/NzccDqakrrMJ}):\newline
1330 \textquotedblleft Der Ursprung ist 0 0, da gibt es nicht viel zu runden; bei den anderen
1331 Seiten werden pt als bp in die PDF-Datei geschrieben, d.\,h.~der Balken ist um 72.27/72 zu
1332 gro\ss{}, das sollte auch Rundungsfehler abdecken.\textquotedblright\newline
1333
1334 (The origin is 0 0, there is not much to be rounded; for the other sides the $\unit{pt}$
1335 are written as $\unit{bp}$ into the pdf-file, i.\,e.~the rule is too large by $72.27/72$,
1336 which should cover also rounding errors.)\newline
1337
1338 The thumb marks are also too wide -- on purpose! This has been done to assure,
1339 that they cover the page up to its (paper) border, therefore they are placed
1340 a little bit over the paper margin.\newline
1341
1342 Now I red somewhere in the net (should have remembered to note the url),
1343 that white margins are presented, whenever there is some object outside of the page.
1344 Thus, it is a feature, not a bug?!
1345 What I do not understand: The same document sometimes is presented
1346 with white lines and sometimes without (same viewer, same PC).\newline
1347 But at least it does not influence the printed version.
1348 \newpage
1349 Another green page.
1350 \newpage
1351 \pagecolor{white}
1352
1353 It is possible to use the Table of Thumbs more than once (for example at the beginning and
1354 at the end of the document) and to refer to them via e.\,g.~\verb|\pageref{TableOfThumbs1}|,\linebreak
1355 \verb|\pageref{TableOfThumbs2}|,\ldots , here: page~\pageref{TableOfThumbs1},
1356 page~\pageref{TableOfThumbs2}, and via e.\,g.~\verb|\pageref{TableOfThumbs}|
1357 it is referred to the last used Table of Thumbs (for compatibility with older package versions).
1358 If there is only one Table of Thumbs, this one is also the last one, of course.
1359 Here it is at page~\pageref{TableOfThumbs}.\newline
1360
1361 % \end{macrocode}
1362 % \pagebreak
1363 % \begin{macrocode}
1364 Now let us have a look at \verb|\thumbsoverviewback|:
1365
1366 \addthumbsoverviewtocontents{section}{Table of Thumbs, back mode}%
1367 \thumbsoverviewback{Table of Thumbs, back mode}%
1368 \newpage
1369
1370 Text can be placed after any of the Tables of Thumbs, of course.
1371 \end{document}
1372 %</example>
1373 % \end{macrocode}
1374 % \StopEventually{}
1375 % \newpage
1376 %
1377 % \section{The implementation}
1378 % We start off by checking that we are loading into \LaTeXe{} and
1379 % announcing the name and version of this package.
1380 %
1381 % \begin{macrocode}
1382 %<*package>
1383 % \end{macrocode}
1384 %
1385 % \begin{macrocode}
1386 \NeedsTeXFormat{LaTeX2e}[2025/06/01]
1387 \@ifl@t@r\fmtversion{2025/06/01}{% would have understood
1388 % \IfFormatAtLeastTF{2025-06-01}{<true code>}{<false code>}
1389 }{\PackageError{thumbs}{Newer LaTeX format needed or older thumbs package}{%
1390 Needed LaTeX format version: 2025-06-01 or newer.\MessageBreak%
1391 Found\space\space LaTeX format version: \fmtversion.\MessageBreak%
1392 Either update your TeX distribution\MessageBreak%
1393 or use an archived version of thumbs\MessageBreak%
1394 (see section History in the documentation).}
1395 }
1396 \ProvidesPackage{thumbs}[2026-01-18 v1.1d Thumb marks and overview page(s) (HMM)]
1397
1398 % \end{macrocode}
1399 %
1400 % A short description of the \xpackage{thumbs} package:
1401 %
1402 % \begin{macrocode}
1403 %% This package allows to create a customizable thumb index (edge index),
1404 %% providing a quick and easy reference method for large documents,
1405 %% as well as one or several overview page(s).
1406
1407 % \end{macrocode}
1408 %
1409 % Several packages are needed (see subsection~\ref{ss:Downloads}):
1410 %
1411 % \begin{macrocode}
1412 \RequirePackage{xcolor}[2024/09/29]% v3.02 LaTeX color extensions (UK)
1413 \RequirePackage{picture}[2020-04-22]% v1.6 Dimens for picture macros (HO)
1414 \RequirePackage{alphalph}[2019/12/09]% v2.6 Convert numbers to letters (HO)
1415 \RequirePackage{rerunfilecheck}[2025-06-21]% v1.11 Rerun checks for auxiliary files (HO)
1416 \RequirePackage{pagecolor}[2025-01-28]% v1.2d Provides thepagecolor (HMM)
1417 \RequirePackage{undolabl}[2025-01-28]% v1.0o Overriding labels (HMM)
1418 % \end{macrocode}
1419 %
1420 % The \xpackage{undolabl} package is needed for |\overridelabel|.
1421 %
1422 % The options are introduced, where the obsolete options
1423 % |pagecolor| (use |\pagecolor{...}| after |\usepackage[...]{thumbs}| and before |\begin{document}|
1424 % to define a background colour of the pages),
1425 % |evenindent| (was renamed to |eventxtindent|) and
1426 % |oddexdent| (was renamed to |oddtxtexdent|)
1427 % have been removed:
1428 %
1429 % \begin{macrocode}
1430
1431 \DeclareKeys[thumbs]{
1432 % OBSOLETE: pagecolor -> use \pagecolor{...} after \usepackage[...]{thumbs} and before \begin{document}
1433 % OBSOLETE: evenindent -> eventxtindent
1434 % OBSOLETE: oddexdent -> oddtxtexdent
1435 linefill .store = \thumbs@linefill,
1436 thumblink .store = \thumbs@thumblink,
1437 minheight .store = \thumbs@minheight,
1438 height .store = \thumbs@height,
1439 width .store = \thumbs@width,
1440 distance .store = \thumbs@distance,
1441 topthumbmargin .store = \thumbs@topthumbmargin,
1442 bottomthumbmargin .store = \thumbs@bottomthumbmargin,
1443 eventxtindent .store = \thumbs@eventxtindent,
1444 oddtxtexdent .store = \thumbs@oddtxtexdent,
1445 evenmarkindent .store = \thumbs@evenmarkindent,
1446 oddmarkexdent .store = \thumbs@oddmarkexdent,
1447 evenprintvoffset .store = \thumbs@evenprintvoffset,
1448 leftindexruleplus .store = \thumbs@leftindexruleplus,
1449 frame .store = \thumbs@frame,
1450 frameinnercolor .store = \thumbs@frameinnercolor,
1451 txtcentered .if = thumbs@txtcentered,
1452 ignorehoffset .if = thumbs@ignorehoffset,
1453 ignorevoffset .if = thumbs@ignorevoffset,
1454 nophantomsection .if = thumbs@nophantomsection,
1455 plainthumbsoverview .if = thumbs@plainthumbsoverview,
1456 verbose .if = thumbs@verbose,
1457 silent .code = \thumbs@verbosefalse,
1458 draft .if = thumbs@draft,
1459 final .code = \thumbs@draftfalse,
1460 hidethumbs .if = thumbs@hidethumbs,
1461 righttoleft .if = thumbs@righttoleft
1462 }
1463
1464 \SetKeys[thumbs]{
1465 linefill = dots,
1466 thumblink = rule,
1467 minheight = 47pt,
1468 height = auto,
1469 width = auto,
1470 distance = 2mm,
1471 topthumbmargin = auto,
1472 bottomthumbmargin = auto,
1473 eventxtindent = 5pt,
1474 oddtxtexdent = 5pt,
1475 evenmarkindent = 0pt,
1476 oddmarkexdent = 0pt,
1477 evenprintvoffset = 0pt,
1478 leftindexruleplus = 0pt,
1479 frame = \empty,
1480 frameinnercolor = \thepagecolor,
1481 txtcentered = false,
1482 ignorehoffset = true,
1483 ignorevoffset = true,
1484 verbose = true,
1485 hidethumbs = false,
1486 righttoleft = false
1487 }
1488
1489 \ProcessKeyOptions[thumbs]
1490
1491 % \end{macrocode}
1492 %
1493 % For determining on which page we are, we use the counter |ThumbsPage|:
1494 %
1495 % \begin{macrocode}
1496 \newcounter{ThumbsPage}
1497 \setcounter{ThumbsPage}{1}
1498 \AddToHook{shipout/foreground}{\addtocounter{ThumbsPage}{1}}
1499
1500 % \end{macrocode}
1501 %
1502 % The (background) page colour is set to |\thepagecolor| (from the \xpackage{pagecolor} package),
1503 % because the \xpackage{xcolour} package needs a defined colour here (it~can be changed later).
1504 %
1505 % \begin{macrocode}
1506 \pagecolor{\thepagecolor}
1507
1508 % \end{macrocode}
1509 %
1510 % \DescribeMacro{ignorehoffset}
1511 % \DescribeMacro{ignorevoffset}\index{crop}
1512 % Usually |\hoffset| and |\voffset| should be regarded, but moving the thumb marks away
1513 % from the paper edge probably makes them useless. Therefore |\hoffset| and |\voffset|
1514 % are ignored by default, or when option |ignorehoffset| or |ignorehoffset=true| is used
1515 % (and |ignorevoffset| or |ignorevoffset=true|, respectively). But in case that the user
1516 % wants to print at one sort of paper but later trim it to another one, regarding
1517 % the offsets would be necessary. This is the case especially when using the
1518 % \xpackage{crop} package. Therefore |ignorehoffset=false| and |ignorevoffset=false| can
1519 % be used to regard these offsets.
1520 % (Combinations |ignorehoffset=true, ignorevoffset=false| and
1521 % |ignorehoffset=false, ignorevoffset=true| are also possible.)
1522 %
1523 % \begin{macrocode}
1524 \ifthumbs@ignorehoffset
1525 \PackageInfo{thumbs}{%
1526 Option ignorehoffset NOT =false:\MessageBreak%
1527 hoffset will be ignored.\MessageBreak%
1528 To make thumbs regard hoffset\MessageBreak%
1529 (for example when using the crop package)\MessageBreak%
1530 use option ignorehoffset=false\@gobble}
1531 \gdef\th@bmshoffset{0sp}
1532 \else
1533 \PackageInfo{thumbs}{%
1534 Option ignorehoffset=false:\MessageBreak%
1535 hoffset will be regarded.\MessageBreak%
1536 This might move the thumb marks\MessageBreak%
1537 horizontally away from the physical paper edge\MessageBreak%
1538 (which should be done e.g. when using the crop package)\@gobble}
1539 \gdef\th@bmshoffset{\hoffset}
1540 \fi
1541
1542 % \end{macrocode}
1543 % \pagebreak
1544 % \begin{macrocode}
1545 \ifthumbs@ignorevoffset
1546 \PackageInfo{thumbs}{%
1547 Option ignorevoffset NOT =false:\MessageBreak%
1548 voffset will be ignored.\MessageBreak%
1549 To make thumbs regard voffset\MessageBreak%
1550 (for example when using the crop package)\MessageBreak%
1551 use option ignorevoffset=false\@gobble}
1552 \gdef\th@bmsvoffset{0sp}
1553 \else
1554 \PackageInfo{thumbs}{%
1555 Option ignorevoffset=false:\MessageBreak%
1556 voffset will be regarded.\MessageBreak%
1557 This might move the thumb marks\MessageBreak%
1558 vertically away from the physical paper edge\MessageBreak%
1559 (which should be done e.g. when using the crop package)\@gobble}
1560 \gdef\th@bmsvoffset{\voffset}
1561 \fi
1562
1563 % \end{macrocode}
1564 %
1565 % \DescribeMacro{frameinnercolor}
1566 % |\thumbs@empty| is later needed for comparisons.~--
1567 % The |frameinnercolor| option gives the colour to fill the frame with,
1568 % if the thumb marks are not to be drawn filled but only as frame.
1569 % The \textquotedblleft colour\textquotedblright{} is usually
1570 % |\thepagecolor| or |white|, but flexibility is given to the user.
1571 % The colour to be used is initialised as |\thepagecolor|,
1572 % because nothing shall be drawn when no thumb mark is requested
1573 % (but really an empty thumb mark is drawn, thus it must be made
1574 % \textquotedblleft invisible\textquotedblright ).
1575 %
1576 % \begin{macrocode}
1577 \gdef\thumbs@empty{\empty}
1578 \gdef\th@mbs@fr@meinnercolor{\thepagecolor}
1579
1580 % \end{macrocode}
1581 %
1582 % \DescribeMacro{linefill}
1583 % We process the |linefill| option value:
1584 %
1585 % \begin{macrocode}
1586 \ifx\thumbs@linefill\empty%
1587 \gdef\th@mbs@linefill{\hspace*{\fill}}
1588 \else
1589 \def\th@mbstest{line}
1590 \ifx\thumbs@linefill\th@mbstest%
1591 \gdef\th@mbs@linefill{\hrulefill}
1592 \else
1593 \def\th@mbstest{dots}
1594 \ifx\thumbs@linefill\th@mbstest%
1595 \gdef\th@mbs@linefill{\dotfill}
1596 \else
1597 \PackageError{thumbs}{Option linefill with invalid value}{%
1598 Option linefill has value "\thumbs@linefill ".\MessageBreak%
1599 Valid values are "" (empty), "line", or "dots".\MessageBreak%
1600 "" (empty) will be used now.}
1601 \gdef\th@mbs@linefill{\hspace*{\fill}}
1602 \fi
1603 \fi
1604 \fi
1605
1606 % \end{macrocode}
1607 %
1608 % We introduce new dimensions for width, height, position of and vertical distance
1609 % between the thumb marks and some helper dimensions.
1610 %
1611 % \begin{macrocode}
1612 \newdimen\th@mbwidthx
1613
1614 \newdimen\th@mbheighty% Thumb height y
1615 \setlength{\th@mbheighty}{\z@}
1616
1617 \newdimen\th@mbposx
1618 \newdimen\th@mbposy
1619 \newdimen\th@mbposyA
1620 \newdimen\th@mbposyB
1621 \newdimen\th@mbposytop
1622 \newdimen\th@mbposybottom
1623 \newdimen\th@mbwidthxtoc
1624 \newdimen\th@mbwidthtmp
1625 \newdimen\th@mbsposytocy
1626 \newdimen\th@mbsposytocyy
1627 \newdimen\th@mbirulex
1628 \newdimen\th@mbiruley
1629
1630 % \end{macrocode}
1631 %
1632 % Horizontal indentation of thumb marks text on odd/even pages according to the chosen options:
1633 %
1634 % \begin{macrocode}
1635 \newdimen\th@mbHitO
1636 \setlength{\th@mbHitO}{\thumbs@oddtxtexdent}
1637 \newdimen\th@mbHitE
1638 \setlength{\th@mbHitE}{\thumbs@eventxtindent}
1639
1640 % \end{macrocode}
1641 %
1642 % Horizontal indentation of whole thumb marks on odd/even pages according to the chosen options:
1643 %
1644 % \begin{macrocode}
1645 \newdimen\th@mbHimO
1646 \setlength{\th@mbHimO}{\thumbs@oddmarkexdent}
1647 \newdimen\th@mbHimE
1648 \setlength{\th@mbHimE}{\thumbs@evenmarkindent}
1649
1650 % \end{macrocode}
1651 %
1652 % Vertical distance between thumb marks on odd/even pages according to the chosen option:
1653 %
1654 % \begin{macrocode}
1655 \newdimen\th@mbsdistance
1656 \ifx\thumbs@distance\empty%
1657 \setlength{\th@mbsdistance}{1mm}
1658 \else
1659 \setlength{\th@mbsdistance}{\thumbs@distance}
1660 \fi
1661
1662 % \end{macrocode}
1663 %
1664 % Handling of option |leftindexruleplus|, see page~\pageref{sss:leftindexruleplus}:
1665 %
1666 % \begin{macrocode}
1667 \newdimen\th@mbslirplus
1668 \ifx\thumbs@leftindexruleplus\empty%
1669 \setlength{\th@mbslirplus}{\z@}
1670 \else
1671 \setlength{\th@mbslirplus}{\thumbs@leftindexruleplus}
1672 \fi
1673
1674 % \end{macrocode}
1675 %
1676 % Option |verbose| (or complementary option |silent|):
1677 %
1678 % \begin{macrocode}
1679 \ifthumbs@verbose\else
1680 \PackageInfo{thumbs}{%
1681 Option verbose=false (or silent=true) found:\MessageBreak%
1682 You will lose some information in the log file\@gobble}
1683 \fi
1684
1685 % \end{macrocode}
1686 %
1687 % We create a new |Box| for the thumbs and make some global definitions.
1688 %
1689 % \begin{macrocode}
1690 \newbox\ThumbsBox
1691
1692 \gdef\th@mbs{0}
1693 \gdef\th@mbsmax{0}
1694 \gdef\th@umbsperpage{0}% will be set via .aux file
1695 \gdef\th@umbsperpagecount{0}
1696
1697 \gdef\th@mbtitle{}
1698 \gdef\th@mbtext{}
1699 \gdef\th@mbtextcolour{\thepagecolor}
1700 \gdef\th@mbbackgroundcolour{\thepagecolor}
1701 \gdef\th@mbcolumn{0}
1702
1703 \gdef\th@mbtextA{}
1704 \gdef\th@mbtextcolourA{\thepagecolor}
1705 \gdef\th@mbbackgroundcolourA{\thepagecolor}
1706
1707 \gdef\th@mbprinting{1}
1708 \gdef\th@mbtoprint{0}
1709 \gdef\th@mbonpage{0}
1710 \gdef\th@mbonpagemax{0}
1711
1712 \gdef\th@mbcolumnnew{0}
1713
1714 \gdef\th@mbs@toc@level{}
1715 \gdef\th@mbs@toc@text{}
1716
1717 \gdef\th@mbmaxwidth{\z@}
1718
1719 \gdef\th@mb@titlelabel{}
1720
1721 \gdef\th@mbstable{0}% number of thumb marks overview tables (edge indexes)
1722
1723 % \end{macrocode}
1724 %
1725 % For comparisons, zero, one, and two are defined (|\z@|, |\@ne| and so on do not work for this):
1726 %
1727 % \begin{macrocode}
1728 \def\thumbs@zero{0}
1729 \def\thumbs@one{1}
1730 \def\thumbs@two{2}
1731
1732 % \end{macrocode}
1733 %
1734 % |\th@mbpofffix| is short for \textquotedblleft page number offset fix\textquotedblright{}
1735 % (see page~\pageref{Labelpofffix}):
1736 %
1737 % \begin{macrocode}
1738 \xdef\th@mbpofffix{-1}% page number offset fix
1739
1740 % \end{macrocode}
1741 %
1742 % If the \xpackage{crop}\index{crop} package is used to print (with unchanged layout)
1743 % on a larger format of paper, \xpackage{crop} must be loaded before \xpackage{thumbs}.
1744 % (When testing, even the inverse order worked, but better not rely on it.)
1745 %
1746 % \begin{macrocode}
1747 \IfPackageLoadedTF{crop}{\gdef\th@mbcrop{1}}{\gdef\th@mbcrop{0}}
1748 \AddToHook{enddocument/info}[kernel/warnings]{%
1749 \IfPackageLoadedT{crop}{\ifx\th@mbcrop\thumbs@zero\relax%
1750 \PackageError{thumbs}{Package crop loaded *after* package thumbs}{%
1751 When package crop shall be used,\MessageBreak%
1752 it must be loaded *before* package thumbs,\MessageBreak%
1753 but it was loaded *afterwards*!}%
1754 \fi}%
1755 }
1756
1757 % \end{macrocode}
1758 %
1759 % After issues with |\@tempcnta|, and because the \eTeX{} extensions are available since 1999
1760 % and \eTeX{} is included in all modern distributions,
1761 % I~decided to give two new counters to the \xpackage{thumbs} package.
1762 %
1763 % \begin{macrocode}
1764 \newcounter{Th@mbTmpA}
1765 \newcounter{Th@mbTmpB}
1766
1767 % \end{macrocode}
1768 %
1769 % We define a new length |\th@mbcomprulewidth| and set it to the
1770 % sum of |\th@mbwidthx| and |\th@mbruleoutside|.
1771 %
1772 % \begin{macrocode}
1773 \newdimen\th@mbcomprulewidth
1774 \newdimen\th@mbruleoutside
1775 \setlength{\th@mbruleoutside}{6cm}
1776 \setlength{\th@mbcomprulewidth}{\dimexpr\th@mbwidthx+\th@mbruleoutside\relax}
1777
1778 % \end{macrocode}
1779 %
1780 % \pagebreak
1781 % It is checked whether writing to \jobname.tmb is allowed.
1782 %
1783 % \begin{macrocode}
1784 \if@filesw\else
1785 \PackageWarningNoLine{thumbs}{No auxiliary files allowed!\MessageBreak%
1786 It was not allowed to write to files.\MessageBreak%
1787 A lot of packages do not work without access to files\MessageBreak%
1788 like the .aux one. The thumbs package needs to write\MessageBreak%
1789 to the \jobname.tmb file. To exit press\MessageBreak%
1790 Ctrl+Z\MessageBreak%
1791 .\MessageBreak}
1792 \fi
1793
1794 % \end{macrocode}
1795 %
1796 % \begin{macro}{\th@mb@txtBox}
1797 % |\th@mb@txtBox| writes its second argument (most likely |\th@mb@tmp@text|)
1798 % in normal text size. Sometimes another text size could
1799 % \textquotedblleft leak\textquotedblright{} from the respective page,
1800 % |\normalsize| prevents this. If another text size is whished for,
1801 % it can always be changed inside |\th@mb@tmp@text|.
1802 % The colour given in the first argument (most likely |\th@mb@tmp@textcolour|)
1803 % is used and either |center|ed (depending on the |txtcentered| option) or
1804 % |\raggedleft| or |\raggedright| (depending on the third argument).
1805 % The forth argument determines the width of the |\parbox|.
1806 % Centering is a little bit difficult:
1807 %
1808 % \begin{macrocode}
1809 \newcommand{\th@mb@txtBox}[4]{%
1810 \setlength{\th@mbwidthtmp}{#4}%
1811 \ifthumbs@txtcentered%
1812 \addtolength{\th@mbwidthtmp}{3pt}%
1813 \ifodd\c@Th@mbTmpA\relax%
1814 \hspace*{+\th@mbHitO}%
1815 \else%
1816 \if@twoside%
1817 \hspace*{-\th@mbHitE}%
1818 \else%
1819 \hspace*{+\th@mbHitO}%
1820 \fi%
1821 \fi%
1822 \fi%
1823 \parbox[c][\th@mbheighty][c]{\th@mbwidthtmp}{%
1824 \settowidth{\th@mbwidthtmp}{\normalsize{#2}}%
1825 \addtolength{\th@mbwidthtmp}{-#4}%
1826 \ifthumbs@txtcentered%
1827 {\begingroup{\begin{center}{\color{#1}\normalsize{#2}}\end{center}}\endgroup}%
1828 \else%
1829 % \end{macrocode}
1830 % \pagebreak
1831 % \begin{macrocode}
1832 \def\th@mbstest{#3}%
1833 \def\th@mbstestb{r}%
1834 \ifx\th@mbstest\th@mbstestb%
1835 \ifdim\th@mbwidthtmp >0sp\relax\hspace*{-\th@mbwidthtmp}\fi%
1836 {\raggedleft\leftskip 0sp minus \textwidth{\hfill\color{#1}\normalsize{#2}}}%
1837 \else% \th@mbstest = l
1838 {\raggedright{\color{#1}\normalsize{\hspace*{1pt}\space{#2}}}}%
1839 \fi%
1840 \fi%
1841 }%
1842 }
1843
1844 % \end{macrocode}
1845 % \end{macro}
1846 %
1847 % \begin{macro}{\setth@mbheight}
1848 % In |\setth@mbheight| the height of a thumb mark (for automatic thumb heights) is computed as\newline
1849 % \textquotedblleft |((Thumbs extension) / (Number of Thumbs)) - (2|%
1850 % $\times $\ |distance between Thumbs)|\textquotedblright.
1851 %
1852 % \begin{macrocode}
1853 \newcommand{\setth@mbheight}{%
1854 \setlength{\th@mbheighty}{\z@}%
1855 \addtolength{\th@mbheighty}{\headheight}%
1856 \addtolength{\th@mbheighty}{\headsep}%
1857 \addtolength{\th@mbheighty}{\textheight}%
1858 \addtolength{\th@mbheighty}{\footskip}%
1859 \setcounter{Th@mbTmpA}{\th@mbsmax}%
1860 \ifnum\c@Th@mbTmpA>1\relax%
1861 \divide\th@mbheighty\th@mbsmax%
1862 \fi%
1863 \addtolength{\th@mbheighty}{-\th@mbsdistance}%
1864 \addtolength{\th@mbheighty}{-\th@mbsdistance}%
1865 }
1866
1867 % \end{macrocode}
1868 % \end{macro}
1869 %
1870 % At the beginning of the document the hook |begindocument| is executed.
1871 % |\th@bmshoffset| and |\th@bmsvoffset| are set again,
1872 % because |\hoffset| and |\voffset| could have been changed.
1873 %
1874 % \begin{macrocode}
1875 \AddToHook{begindocument}[start]{%
1876 \ifthumbs@ignorehoffset%
1877 \gdef\th@bmshoffset{0sp}%
1878 \else%
1879 \gdef\th@bmshoffset{\hoffset}%
1880 \fi%
1881 \ifthumbs@ignorevoffset%
1882 \gdef\th@bmsvoffset{0sp}%
1883 \else%
1884 \gdef\th@bmsvoffset{\voffset}%
1885 \fi%
1886 \xdef\th@mbpaperwidth{\the\paperwidth}%
1887 \setlength{\@tempdima}{1pt}%
1888 % \end{macrocode}
1889 % \pagebreak
1890 % \begin{macrocode}
1891 \ifdim \thumbs@minheight < \@tempdima% too small
1892 \setlength{\thumbs@minheight}{1pt}%
1893 \else%
1894 \ifdim \thumbs@minheight = \@tempdima% small, but ok
1895 \else%
1896 \ifdim \thumbs@minheight > \@tempdima% ok
1897 \else%
1898 \PackageError{thumbs}{Option minheight has invalid value}{%
1899 As value for option minheight please use\MessageBreak%
1900 a number and a length unit (e.g. mm, cm, pt)\MessageBreak%
1901 and no space between them\MessageBreak%
1902 and include this value+unit combination in curly brackets\MessageBreak%
1903 (please see the thumbs-example.tex file).\MessageBreak%
1904 When pressing Return, minheight will now be set to 47pt.}%
1905 \setlength{\thumbs@minheight}{47pt}%
1906 \fi%
1907 \fi%
1908 \fi%
1909 \setlength{\@tempdima}{\thumbs@minheight}%
1910 % \end{macrocode}
1911 %
1912 % Thumb height |\th@mbheighty| is treated. If the value is empty,
1913 % it is set to |\@tempdima|, which was just defined to be $47\unit{pt}$
1914 % (by default), or to the value chosen by the user with package option
1915 % |minheight={...}|:
1916 %
1917 % \begin{macrocode}
1918 \ifx\thumbs@height\empty%
1919 \setlength{\th@mbheighty}{\@tempdima}%
1920 \else%
1921 \def\th@mbstest{auto}%
1922 \ifx\thumbs@height\th@mbstest%
1923 % \end{macrocode}
1924 %
1925 % If it is not empty but \texttt{auto}(matic), the value is computed
1926 % via |\setth@mbheight| (see above).
1927 %
1928 % \begin{macrocode}
1929 \setth@mbheight%
1930 % \end{macrocode}
1931 %
1932 % When the height is smaller than |\thumbs@minheight| (default: $47\unit{pt}$),
1933 % this is too small, and instead a now column/page of thumb marks is used.
1934 %
1935 % \begin{macrocode}
1936 \ifdim \th@mbheighty < \thumbs@minheight%
1937 \PackageWarningNoLine{thumbs}{Thumbs not high enough:\MessageBreak%
1938 Option height has value "auto". For \th@mbsmax\space thumbs per page\MessageBreak%
1939 this results in a thumb height of \the\th@mbheighty.\MessageBreak%
1940 This is lower than the minimal thumb height, \thumbs@minheight,\MessageBreak%
1941 therefore another thumbs column will be opened.\MessageBreak%
1942 If you do not want this, choose a smaller value\MessageBreak%
1943 for option "minheight"%
1944 }
1945 \setlength{\th@mbheighty}{\z@}%
1946 \addtolength{\th@mbheighty}{\@tempdima}% = \thumbs@minheight
1947 \fi%
1948 \else%
1949 % \end{macrocode}
1950 %
1951 % When a value has been given for the thumb marks' height, this fixed value is used.
1952 %
1953 % \begin{macrocode}
1954 \ifthumbs@verbose%
1955 \edef\thumbsinfo{\the\th@mbheighty}%
1956 \PackageInfo{thumbs}{Now setting thumbs' height to \thumbsinfo}%
1957 \fi%
1958 \setlength{\th@mbheighty}{\thumbs@height}%
1959 \fi%
1960 \fi%
1961 % \end{macrocode}
1962 %
1963 % Read in the |\jobname.tmb|-file:
1964 %
1965 % \begin{macrocode}
1966 \newread\@instreamthumb%
1967 % \end{macrocode}
1968 %
1969 % Inform the users about the dimensions of the thumb marks (look in the \xfile{log} file):
1970 %
1971 % \begin{macrocode}
1972 \ifthumbs@verbose%
1973 \message{^^J}%
1974 \edef\thumbsinfo{\the\th@mbheighty}%
1975 \PackageInfo{thumbs}{************** THUMB dimensions **************\@gobbletwo}%
1976 \PackageInfo{thumbs}{The height of the thumb marks is \thumbsinfo\@gobble}%
1977 \fi%
1978 % \end{macrocode}
1979 %
1980 % Setting the thumb mark width (|\th@mbwidthx|):
1981 %
1982 % \begin{macrocode}
1983 \ifthumbs@draft%
1984 \setlength{\th@mbwidthx}{2pt}%
1985 \else%
1986 \setlength{\th@mbwidthx}{\paperwidth}%
1987 \addtolength{\th@mbwidthx}{-\textwidth}%
1988 \divide\th@mbwidthx by 4%
1989 \setlength{\@tempdima}{0sp}%
1990 \ifx\thumbs@width\empty%
1991 \else%
1992 \def\th@mbstest{auto}%
1993 \ifx\thumbs@width\th@mbstest%
1994 \else%
1995 \def\th@mbstest{autoauto}%
1996 \ifx\thumbs@width\th@mbstest%
1997 \@ifundefined{th@mbmaxwidtha}{%
1998 \if@filesw%
1999 \gdef\th@mbmaxwidtha{0sp}%
2000 \setlength{\th@mbwidthx}{\th@mbmaxwidtha}%
2001 \AddToHook{enddocument/info}[kernel/warnings]{%
2002 \PackageWarningNoLine{thumbs}{%
2003 \string\th@mbmaxwidtha\space undefined.\MessageBreak%
2004 Rerun to get the thumb marks width right%
2005 }%
2006 }%
2007 \else%
2008 \PackageError{thumbs}{You cannot use option autoauto without \jobname.aux file}{%
2009 Recompilation should create the .aux file,\MessageBreak%
2010 otherwise do not use the autoauto option.}%
2011 \fi%
2012 }{%\else
2013 \setlength{\th@mbwidthx}{\th@mbmaxwidtha}%
2014 }%\fi
2015 \else%
2016 \ifdim \thumbs@width > \@tempdima% OK
2017 \setlength{\th@mbwidthx}{\thumbs@width}%
2018 \else%
2019 \PackageError{thumbs}{Thumbs not wide enough}{%
2020 Option width has value "\thumbs@width".\MessageBreak%
2021 This is not a valid dimension larger than zero.\MessageBreak%
2022 Width will be set automatically.}%
2023 \fi%
2024 \fi%
2025 \fi%
2026 \fi%
2027 \fi%
2028 \ifthumbs@verbose%
2029 \edef\thumbsinfo{\the\th@mbwidthx}%
2030 \PackageInfo{thumbs}{The width of the thumb marks on the paper is \thumbsinfo\@gobble}%
2031 \ifthumbs@draft%
2032 \PackageInfo{thumbs}{because thumbs package is in draft mode\@gobble}%
2033 \fi%
2034 \fi%
2035 % \end{macrocode}
2036 %
2037 % Setting the position of the first/top thumb mark. Vertical (y) position
2038 % is a little bit complicated, because option\newline
2039 % |\thumbs@topthumbmargin| must be handled:
2040 %
2041 % \begin{macrocode}
2042 % Thumb position x \th@mbposx
2043 \setlength{\th@mbposx}{\paperwidth}%
2044 \addtolength{\th@mbposx}{-\th@mbwidthx}%
2045 \ifthumbs@ignorehoffset%
2046 \addtolength{\th@mbposx}{-\hoffset}%
2047 \fi%
2048 \addtolength{\th@mbposx}{1pt}%
2049 % Thumb position y \th@mbposy
2050 \ifx\thumbs@topthumbmargin\empty%
2051 \def\thumbs@topthumbmargin{auto}%
2052 \fi%
2053 % \end{macrocode}
2054 % \pagebreak
2055 % \begin{macrocode}
2056 \def\th@mbstest{auto}%
2057 \ifx\thumbs@topthumbmargin\th@mbstest%
2058 \setlength{\th@mbposy}{1in}%
2059 \addtolength{\th@mbposy}{+\topmargin}%
2060 \addtolength{\th@mbposy}{-\th@mbsdistance}%
2061 \addtolength{\th@mbposy}{+\th@mbheighty}%
2062 \else%
2063 \setlength{\@tempdima}{-1pt}%
2064 \ifdim\thumbs@topthumbmargin > \@tempdima\relax%
2065 \else%
2066 \PackageWarning{thumbs}{Thumbs column starting too high.\MessageBreak%
2067 Option topthumbmargin has value "\thumbs@topthumbmargin ".\MessageBreak%
2068 topthumbmargin will be set to -1pt.\MessageBreak%
2069 }%
2070 \gdef\thumbs@topthumbmargin{-1pt}%
2071 \fi%
2072 \setlength{\th@mbposy}{\thumbs@topthumbmargin}%
2073 \addtolength{\th@mbposy}{-\th@mbsdistance}%
2074 \addtolength{\th@mbposy}{+\th@mbheighty}%
2075 \fi%
2076 \setlength{\th@mbposytop}{\th@mbposy}%
2077 \ifthumbs@verbose%
2078 \setlength{\@tempdimc}{\th@mbposytop}%
2079 \addtolength{\@tempdimc}{-\th@mbheighty}%
2080 \addtolength{\@tempdimc}{+\th@mbsdistance}%
2081 \edef\thumbsinfo{\the\@tempdimc}%
2082 \PackageInfo{thumbs}{The top thumb margin is \thumbsinfo\@gobble}%
2083 \fi%
2084 % \end{macrocode}
2085 %
2086 % Setting the lowest position of a thumb mark, according to option |\thumbs@bottomthumbmargin|:
2087 %
2088 % \begin{macrocode}
2089 % Max. thumb position y \th@mbposybottom
2090 \ifx\thumbs@bottomthumbmargin\empty%
2091 \gdef\thumbs@bottomthumbmargin{auto}%
2092 \fi%
2093 \def\th@mbstest{auto}%
2094 \ifx\thumbs@bottomthumbmargin\th@mbstest%
2095 \setlength{\th@mbposybottom}{1in}%
2096 \addtolength{\th@mbposybottom}{+\th@bmsvoffset}%
2097 \addtolength{\th@mbposybottom}{+\topmargin}%
2098 \addtolength{\th@mbposybottom}{-\th@mbsdistance}%
2099 \addtolength{\th@mbposybottom}{+\th@mbheighty}%
2100 \addtolength{\th@mbposybottom}{+\headheight}%
2101 \addtolength{\th@mbposybottom}{+\headsep}%
2102 \addtolength{\th@mbposybottom}{+\textheight}%
2103 \addtolength{\th@mbposybottom}{+\footskip}%
2104 \addtolength{\th@mbposybottom}{-\th@mbsdistance}%
2105 \addtolength{\th@mbposybottom}{-\th@mbheighty}%
2106 \IfPackageLoadedT{crop}{\addtolength{\th@mbposybottom}{-\th@bmsvoffset}}%
2107 \else%
2108 \setlength{\@tempdima}{\paperheight}%
2109 \addtolength{\@tempdima}{-\thumbs@bottomthumbmargin}%
2110 \addtolength{\@tempdima}{-\th@mbposytop}%
2111 \addtolength{\@tempdima}{-\th@mbsdistance}%
2112 \addtolength{\@tempdima}{-\th@mbheighty}%
2113 \addtolength{\@tempdima}{-\th@mbsdistance}%
2114 \IfPackageLoadedT{crop}{\addtolength{\@tempdima}{-\th@bmsvoffset}}%
2115 \ifdim \@tempdima > 0sp\relax%
2116 \else%
2117 \setlength{\@tempdima}{\paperheight}%
2118 \addtolength{\@tempdima}{-\th@mbposytop}%
2119 \addtolength{\@tempdima}{-\th@mbsdistance}%
2120 \addtolength{\@tempdima}{-\th@mbheighty}%
2121 \addtolength{\@tempdima}{-\th@mbsdistance}%
2122 \addtolength{\@tempdima}{-1pt}%
2123 \IfPackageLoadedT{crop}{\addtolength{\@tempdima}{-\th@bmsvoffset}}%
2124 \PackageWarning{thumbs}{Thumbs column ending too high.\MessageBreak%
2125 Option bottomthumbmargin has value "\thumbs@bottomthumbmargin ".\MessageBreak%
2126 bottomthumbmargin will be set to "\the\@tempdima".\MessageBreak%
2127 }%
2128 \xdef\thumbs@bottomthumbmargin{\the\@tempdima}%
2129 \fi%
2130 \setlength{\@tempdima}{\thumbs@bottomthumbmargin}%
2131 \setlength{\@tempdimc}{-1pt}%
2132 \ifdim \@tempdima < \@tempdimc%
2133 \PackageWarning{thumbs}{Thumbs column ending too low.\MessageBreak%
2134 Option bottomthumbmargin has value "\thumbs@bottomthumbmargin ".\MessageBreak%
2135 bottomthumbmargin will be set to -1pt.\MessageBreak%
2136 }%
2137 \gdef\thumbs@bottomthumbmargin{-1pt}%
2138 \fi%
2139 \setlength{\th@mbposybottom}{\paperheight}%
2140 \addtolength{\th@mbposybottom}{-\thumbs@bottomthumbmargin}%
2141 \fi%
2142 \ifthumbs@verbose%
2143 \setlength{\@tempdimc}{\paperheight}%
2144 \addtolength{\@tempdimc}{-\th@mbposybottom}%
2145 \edef\thumbsinfo{\the\@tempdimc}%
2146 \PackageInfo{thumbs}{The bottom thumb margin is \thumbsinfo\@gobble}%
2147 \PackageInfo{thumbs}{**********************************************\@gobbletwo}%
2148 \message{^^J}%
2149 \fi%
2150 % \end{macrocode}
2151 %
2152 % \pagebreak
2153 % |\th@mbposyA| is set to the top-most vertical thumb position~(y).
2154 % Because it will be increased \hbox{(i.\,e. the} thumb positions will move downwards
2155 % on the page), |\th@mbsposytocyy| is used to remember this position unchanged.
2156 %
2157 % \begin{macrocode}
2158 \addtolength{\th@mbposy}{-\th@mbheighty}% because it will be advanced also for the first thumb.
2159 \setlength{\th@mbposyA}{\th@mbposy}% \th@mbposyA will change.
2160 \setlength{\th@mbsposytocyy}{\th@mbposy}% \th@mbsposytocyy shall not be changed.
2161 }
2162
2163 % \end{macrocode}
2164 %
2165 % \begin{macro}{\th@mb@dvance}
2166 % The internal command |\th@mb@dvance| is used to advance the position of the current
2167 % thumb by |\th@mbheighty| and |\th@mbsdistance|. If the resulting position
2168 % of the thumb is lower than the |\th@mbposybottom| position \hbox{(i.\,e.~|\th@mbposy|}
2169 % \emph{higher} than |\th@mbposybottom|), a~new thumb column will be started by the next
2170 % |\addthumb|, otherwise a blank thumb is created and |\th@mb@dvance| is calling itself
2171 % again. This loop continues until a new thumb column is ready to be started.
2172 %
2173 % \begin{macrocode}
2174 \newcommand{\th@mb@dvance}{%
2175 \addtolength{\th@mbposy}{+\th@mbheighty}%
2176 \addtolength{\th@mbposy}{+\th@mbsdistance}%
2177 \ifdim\th@mbposy>\th@mbposybottom\relax%
2178 \addtolength{\th@mbposy}{-\th@mbheighty}%
2179 \addtolength{\th@mbposy}{-\th@mbsdistance}%
2180 \else%
2181 \addtolength{\th@mbposy}{-\th@mbheighty}%
2182 \addtolength{\th@mbposy}{-\th@mbsdistance}%
2183 \thumborigaddthumb{}{}{\string\thepagecolor}{\string\thepagecolor}%
2184 \th@mb@dvance%
2185 \fi%
2186 }
2187
2188 % \end{macrocode}
2189 % \end{macro}
2190 %
2191 % \begin{macro}{\thumbnewcolumn}
2192 % With the command |\thumbnewcolumn| a new column can be started, even if the current one
2193 % was not filled. This could be useful e.\,g.~for a dictionary, which uses one column for
2194 % translations from language~A to language~B, and the second column for translations
2195 % from language~B to language~A. But in that case one probably should increase the
2196 % size of the thumb marks, so that $26$~thumb marks (in~case of the Latin alphabet)
2197 % fill one thumb column. Do not use |\thumbnewcolumn| on a page where |\addthumb| was
2198 % already used, but use |\addthumb| immediately after |\thumbnewcolumn|.
2199 %
2200 % \begin{macrocode}
2201 \newcommand{\thumbnewcolumn}{%
2202 \ifx\th@mbtoprint\thumbs@one\relax%
2203 \PackageError{thumbs}{\string\thumbnewcolumn\space after \string\addthumb }{%
2204 On page \thepage\space (approx.) \string\addthumb\space was used and *afterwards* %
2205 \string\thumbnewcolumn .\MessageBreak%
2206 When you want to use \string\thumbnewcolumn , do not use an \string\addthumb\space %
2207 on the same\MessageBreak%
2208 page before \string\thumbnewcolumn . Thus, either remove the \string\addthumb , %
2209 or use a\MessageBreak%
2210 \string\pagebreak , \string\newpage\space etc. before \string\thumbnewcolumn .\MessageBreak%
2211 (And remember to use an \string\addthumb\space*after* \string\thumbnewcolumn .)\MessageBreak%
2212 Your command \string\thumbnewcolumn\space will be ignored now.%
2213 }%
2214 \else%
2215 \PackageWarning{thumbs}{%
2216 Starting of another column requested by command\MessageBreak%
2217 \string\thumbnewcolumn.\space Only use this command directly\MessageBreak%
2218 before an \string\addthumb\space - did you?!\MessageBreak%
2219 Code}%
2220 \gdef\th@mbcolumnnew{1}%
2221 \th@mb@dvance%
2222 \gdef\th@mbprinting{0}%
2223 \gdef\th@mbcolumnnew{2}%
2224 \fi%
2225 }
2226
2227 % \end{macrocode}
2228 % \end{macro}
2229 %
2230 % \begin{macro}{\addtitlethumb}
2231 % When a thumb mark shall not or cannot be placed on a page, e.\,g.~at the title page or
2232 % when using |\includepdf| from \xpackage{pdfpages} package, but the reference in the thumb
2233 % marks overview nevertheless shall name that page number and hyperlink to that page,
2234 % |\addtitlethumb| can be used at the following page. It has five arguments. The arguments
2235 % one to four are identical to the ones of |\addthumb| (see below),
2236 % and the fifth argument consists of the label of the page, where the hyperlink
2237 % at the thumb marks overview page shall link to.
2238 % If manually no label can be placed on the first page, the label \texttt{pagesLTS.0}
2239 % from the \xpackage{pageslts} package (needs to be loaded explicitly!) can be used.
2240 %
2241 % \begin{macrocode}
2242 \newcommand{\addtitlethumb}[5]{%
2243 \xdef\th@mb@titlelabel{#5}%
2244 \addthumb{#1}{#2}{#3}{#4}%
2245 \xdef\th@mb@titlelabel{}%
2246 }
2247
2248 % \end{macrocode}
2249 % \end{macro}
2250 %
2251 % \begin{macro}{\thumbsnophantom}
2252 % To locally disable the setting of a |\phantomsection| before a thumb mark,
2253 % the command |\thumbsnophantom| is provided. (But at first it is not disabled.)
2254 %
2255 % \begin{macrocode}
2256 \gdef\th@mbsphantom{1}
2257
2258 \newcommand{\thumbsnophantom}{\gdef\th@mbsphantom{0}}
2259
2260 % \end{macrocode}
2261 % \end{macro}
2262 %
2263 % \begin{macro}{\addthumb}
2264 % Now the |\addthumb| command is defined, which is used to add a new
2265 % thumb mark to the document. |\th@mbs@fr@meinnercolor| was
2266 % |\thepagecolor| instead of |\thumbs@frameinnercolor|,
2267 % if no thumb mark was issued.
2268 %
2269 % \begin{macrocode}
2270 \newcommand{\addthumb}[4]{%
2271 \gdef\th@mbs@fr@meinnercolor{\thumbs@frameinnercolor}%
2272 \gdef\th@mbprinting{1}%
2273 \addtolength{\th@mbposy}{\th@mbheighty}%
2274 \addtolength{\th@mbposy}{\th@mbsdistance}%
2275 \ifdim\th@mbposy>\th@mbposybottom%
2276 \PackageInfo{thumbs}{Thumbs column full, starting another column\MessageBreak}%
2277 \setlength{\th@mbposy}{\th@mbposytop}%
2278 \addtolength{\th@mbposy}{\th@mbsdistance}%
2279 % \end{macrocode}
2280 % \pagebreak
2281 % \begin{macrocode}
2282 \ifx\th@mbcolumn\thumbs@zero\relax%
2283 \xdef\th@umbsperpagecount{\th@mbs}%
2284 \gdef\th@mbcolumn{1}%
2285 \fi%
2286 \fi%
2287 \setcounter{Th@mbTmpA}{\th@mbs}%
2288 \addtocounter{Th@mbTmpA}{1}%
2289 \xdef\th@mbs{\the\c@Th@mbTmpA}%
2290 % \end{macrocode}
2291 %
2292 % The |\addthumb| command has four parameters:
2293 % \begin{enumerate}
2294 % \item a title for the thumb mark (for the thumb marks overview page, e.\,g.~the chapter title),
2295 %
2296 % \item the text to be displayed in the thumb mark (for example a chapter number),
2297 %
2298 % \item the colour of the text in the thumb mark,
2299 %
2300 % \item and the background colour of the thumb mark
2301 % \end{enumerate}
2302 % (parameters in this order).
2303 %
2304 % \begin{macrocode}
2305 \gdef\th@mbtitle{#1}%
2306 \gdef\th@mbtext{#2}%
2307 \gdef\th@mbtextcolour{#3}%
2308 \gdef\th@mbbackgroundcolour{#4}%
2309 % \end{macrocode}
2310 %
2311 % \phantomsection\label{tmtww}
2312 % The width of the thumb mark text is determined and compared to the width of the
2313 % thumb mark (rule). When the text is wider than the rule, this has to be changed
2314 % (either automatically with option |width={autoauto}| in the next compilation run
2315 % or manually by changing |width={|\ldots|}| by the user). It could be acceptable
2316 % to have a thumb mark text consisting of more than one line, of course, in which
2317 % case nothing needs to be changed. Possible horizontal movement (|\th@mbHitO|,
2318 % |\th@mbHitE|) has to be taken into account.
2319 %
2320 % \begin{macrocode}
2321 \settowidth{\@tempdima}{\th@mbtext}%
2322 \ifdim\th@mbHitO>\th@mbHitE\relax%
2323 \addtolength{\@tempdima}{\th@mbHitO}%
2324 \else%
2325 \addtolength{\@tempdima}{\th@mbHitE}%
2326 \fi%
2327 \ifdim\@tempdima>\th@mbmaxwidth%
2328 \xdef\th@mbmaxwidth{\the\@tempdima}%
2329 \fi%
2330 \ifdim\@tempdima>\th@mbwidthx%
2331 \ifthumbs@draft% \relax
2332 \else%
2333 \edef\thumbsinfoa{\the\th@mbwidthx}
2334 \edef\thumbsinfob{\the\@tempdima}
2335 \PackageWarning{thumbs}{%
2336 Thumb mark on paper too small (width: \thumbsinfoa )\MessageBreak%
2337 or its text too wide (width:%
2338 \space\space\space\space\space\space\space\space\space\space%
2339 \thumbsinfob )\MessageBreak%
2340 }%
2341 \fi%
2342 \fi%
2343 % \end{macrocode}
2344 %
2345 % Into the |\jobname.tmb| file a |\thumbcontents| entry is written.
2346 % If \xpackage{hyperref} is found, a |\phantomsection| is placed (except when
2347 % globally disabled by option |nophantomsection| or locally by |\thumbsnophantom|),
2348 % a~label for the thumb mark created, and the |\thumbcontents| entry will be
2349 % hyperlinked to that label (except when |\addtitlethumb| was used, then the label
2350 % reported from the user is used -- the \xpackage{thumbs} package does \emph{not}
2351 % create that label!).
2352 %
2353 % \begin{macrocode}
2354 \IfPackageLoadedT{hyperref}{%
2355 \ifthumbs@nophantomsection%
2356 \else%
2357 \ifx\th@mbsphantom\thumbs@one\relax%
2358 \phantomsection%
2359 \else%
2360 \gdef\th@mbsphantom{1}%
2361 \fi%
2362 \fi%
2363 }%
2364 \label{thumbs.\th@mbs}%
2365 \if@filesw%
2366 \ifx\th@mb@titlelabel\empty%
2367 \addtocontents{tmb}{\string\thumbcontents{#1}{#2}{#3}{#4}{\thepage}{thumbs.\th@mbs}{\th@mbcolumnnew}\protected@file@percent}%
2368 \else%
2369 \addtocounter{page}{-1}%
2370 \edef\th@mb@page{\thepage}%
2371 \addtocontents{tmb}{\string\thumbcontents{#1}{#2}{#3}{#4}{\th@mb@page}{\th@mb@titlelabel}{\th@mbcolumnnew}\protected@file@percent}%
2372 \addtocounter{page}{+1}%
2373 \fi%
2374 %\else there is a problem, but the according warning message was already given earlier.
2375 \fi%
2376 % \end{macrocode}
2377 %
2378 % Maybe there is a rare case, where more than one thumb mark will be placed at one page.
2379 % Probably a |\pagebreak|, |\newpage| or something similar would be advisable,
2380 % but nevertheless we should prepare for this case. We save the properties of the thumb mark(s).
2381 %
2382 % \begin{macrocode}
2383 \ifx\th@mbcolumnnew\thumbs@one\relax%
2384 \else%
2385 \setcounter{Th@mbTmpA}{\th@mbonpage}%
2386 \addtocounter{Th@mbTmpA}{1}%
2387 \xdef\th@mbonpage{\the\c@Th@mbTmpA}%
2388 \fi%
2389 \ifx\th@mbtoprint\thumbs@zero\relax%
2390 \else%
2391 \ifx\th@mbcolumnnew\thumbs@zero\relax%
2392 \PackageWarning{thumbs}{More than 1 thumb at 1 page:\MessageBreak%
2393 You placed more than 1 thumb mark (at least \th@mbonpage )\MessageBreak%
2394 on page \thepage\space (page is approximately).\MessageBreak%
2395 Maybe you want to insert a page break here?\MessageBreak%
2396 Thumb added}%
2397 \fi%
2398 \fi%
2399 \ifnum\th@mbonpage=1%
2400 \ifnum\th@mbonpagemax>0% \relax
2401 \else \gdef\th@mbonpagemax{1}%
2402 \fi%
2403 \gdef\th@mbtextA{#2}%
2404 \gdef\th@mbtextcolourA{#3}%
2405 \gdef\th@mbbackgroundcolourA{#4}%
2406 \setlength{\th@mbposyA}{\th@mbposy}%
2407 \else%
2408 \ifx\th@mbcolumnnew\thumbs@zero\relax%
2409 \setcounter{Th@mbTmpA}{\the\c@Th@mbTmpA}%
2410 \@tempcnta=1\relax%
2411 \edef\th@mbonpagetest{\the\@tempcnta}%
2412 \@whilenum\th@mbonpagetest<\th@mbonpage\do{%
2413 \advance\@tempcnta by 1%
2414 \xdef\th@mbonpagetest{\the\@tempcnta}%
2415 \ifnum\th@mbonpage=\th@mbonpagetest%
2416 \ifnum\th@mbonpagemax<\th@mbonpage%
2417 \xdef\th@mbonpagemax{\th@mbonpage}%
2418 \fi%
2419 \edef\th@mbtmpdef{\csname th@mbtext\AlphAlph{\the\@tempcnta}\endcsname}%
2420 \expandafter\gdef\th@mbtmpdef{#2}%
2421 \edef\th@mbtmpdef{\csname th@mbtextcolour\AlphAlph{\the\@tempcnta}\endcsname}%
2422 \expandafter\gdef\th@mbtmpdef{#3}%
2423 \edef\th@mbtmpdef{\csname th@mbbackgroundcolour\AlphAlph{\the\@tempcnta}\endcsname}%
2424 \expandafter\gdef\th@mbtmpdef{#4}%
2425 \fi%
2426 }%
2427 \@tempcnta=\the\c@Th@mbTmpA\relax%
2428 \else%
2429 \ifnum\th@mbonpagemax<\th@mbonpage%
2430 \xdef\th@mbonpagemax{\th@mbonpage}%
2431 \fi%
2432 \fi%
2433 \fi%
2434 \ifx\th@mbcolumnnew\thumbs@two\relax%
2435 \gdef\th@mbcolumnnew{0}%
2436 \fi%
2437 \gdef\th@mbtoprint{1}%
2438 }
2439
2440 % \end{macrocode}
2441 % \end{macro}
2442 %
2443 % \pagebreak
2444 % \begin{macro}{\stopthumb}
2445 % When a page (or pages) shall have no thumb marks, |\stopthumb| stops the issuing%
2446 % of thumb marks (until another thumb mark is placed or |\continuethumb| is used).
2447 %
2448 % \begin{macrocode}
2449 \newcommand{\stopthumb}{\gdef\th@mbprinting{0}}
2450
2451 % \end{macrocode}
2452 % \end{macro}
2453 %
2454 % \begin{macro}{\continuethumb}
2455 % |\continuethumb| continues the issuing of thumb marks (equal to the one
2456 % before this was stopped by |\stopthumb|).
2457 %
2458 % \begin{macrocode}
2459 \newcommand{\continuethumb}{\gdef\th@mbprinting{1}}
2460
2461 % \end{macrocode}
2462 % \end{macro}
2463 %
2464 % \begin{macro}{\th@mbtabrule}
2465 % |\th@mbtabrule| prints the background rules in the thumb mark index page.
2466 % If frames instead of filled marks are used, a second (smaller) rule in colour %
2467 % |\thumbs@frameinnercolor| needs to be printed over the first rule.
2468 %
2469 % \begin{macrocode}
2470 \newcommand{\th@mbtabrule}{%
2471 \rule{\dimexpr\th@mbwidthxtoc+\th@mbruleoutside\relax}{\th@mbheighty}%
2472 \ifx\thumbs@frame\thumbs@empty\relax%
2473 \else%
2474 \hspace*{-\th@mbwidthxtoc}%
2475 \hspace*{\thumbs@frame}%
2476 \setlength{\th@mbwidthtmp}{\th@mbwidthxtoc}%
2477 \addtolength{\th@mbwidthtmp}{-\thumbs@frame}%
2478 \addtolength{\th@mbwidthtmp}{-\thumbs@frame}%
2479 \xdef\th@mbfrw{\the\th@mbwidthtmp}%
2480 \setlength{\th@mbwidthtmp}{\th@mbheighty}%
2481 \addtolength{\th@mbwidthtmp}{-\thumbs@frame}%
2482 \addtolength{\th@mbwidthtmp}{-\thumbs@frame}%
2483 {\color{\thumbs@frameinnercolor}%
2484 \rule[\thumbs@frame]{\th@mbfrw}{\th@mbwidthtmp}%
2485 }%
2486 \hspace*{\thumbs@frame}%
2487 \fi%
2488 }
2489
2490 % \end{macrocode}
2491 % \end{macro}
2492 %
2493 % \begin{environment}{thumbspicture}
2494 %
2495 % This package uses |picture| environments to place some stuff. When tagging is a thing,
2496 % pictures need alt-text, thus there would be a warning of missing alt-text.
2497 % Alternatively |artifact| for decorations and |actualtext| for symbols could be used.
2498 % But if such option for the |picture| environment would be used without |\DocumentMetadata|,
2499 % then an error would result because in that case there is no such option for the
2500 % |picture| environment. Thus we need to define a wrapper environment |thumbspicture|:
2501 %
2502 % \begin{macrocode}
2503 \newenvironment{thumbspicture}[1][]{\gdef\thumbs@picture@option{#1}\thumbs@picture@parse}{\end{picture}}
2504
2505 \def\thumbs@picture@parse(#1){%
2506 \IfDocumentMetadataTF{\expanded{\noexpand\begin{picture}[\thumbs@picture@option]}(#1)%
2507 }{\begin{picture}(#1)}%
2508 }
2509
2510 % \end{macrocode}
2511 % \end{environment}
2512 %
2513 % \begin{macro}{\thumbcontents}
2514 % The \textbf{internal} command |\thumbcontents| (which will be read in from the
2515 % |\jobname.tmb| file) creates a thumb mark entry on the overview page(s).
2516 % Its seven parameters are
2517 % \begin{enumerate}
2518 % \item the title for the thumb mark,
2519 %
2520 % \item the text to be displayed in the thumb mark,
2521 %
2522 % \item the colour of the text in the thumb mark,
2523 %
2524 % \item the background colour of the thumb mark,
2525 %
2526 % \item the first page of this thumb mark,
2527 %
2528 % \item the label where it should hyperlink to,
2529 %
2530 % \item and an indicator, whether |\thumbnewcolumn| is just issuing blank thumbs to fill a column
2531 % \end{enumerate}
2532 % (parameters in this order). Without \xpackage{hyperref} the
2533 % $6\textsuperscript{th}$~parameter is just ignored.
2534 %
2535 % \begin{macrocode}
2536 \newcommand{\thumbcontents}[7]{%
2537 \addtolength{\th@mbposy}{\th@mbheighty}%
2538 \addtolength{\th@mbposy}{\th@mbsdistance}%
2539 \ifdim\th@mbposy>\th@mbposybottom%
2540 \setlength{\th@mbposy}{\th@mbposytop}%
2541 \addtolength{\th@mbposy}{\th@mbsdistance}%
2542 \fi%
2543 \def\th@mb@tmp@title{#1}%
2544 \def\th@mb@tmp@text{#2}%
2545 \def\th@mb@tmp@textcolour{#3}%
2546 \def\th@mb@tmp@backgroundcolour{#4}%
2547 \def\th@mb@tmp@page{#5}%
2548 \def\th@mb@tmp@label{#6}%
2549 \def\th@mb@tmp@column{#7}%
2550 \ifx\th@mb@tmp@column\thumbs@two\relax%
2551 \def\th@mb@tmp@column{0}%
2552 \fi%
2553 \setlength{\th@mbwidthxtoc}{\paperwidth}%
2554 \addtolength{\th@mbwidthxtoc}{-1in}%
2555 % \end{macrocode}
2556 %
2557 % Depending on which side the thumb marks should be placed the according dimensions have to be adapted.
2558 %
2559 % \begin{macrocode}
2560 \def\th@mbstest{r}%
2561 \ifx\th@mbstest\th@mbsprintpage% right page
2562 \addtolength{\th@mbwidthxtoc}{-\th@mbHimO}%
2563 \addtolength{\th@mbwidthxtoc}{-\oddsidemargin}%
2564 \setlength{\@tempdimc}{1in}%
2565 \addtolength{\@tempdimc}{+\oddsidemargin}%
2566 % \end{macrocode}
2567 % \pagebreak
2568 % \begin{macrocode}
2569 \else% left page
2570 \addtolength{\th@mbwidthxtoc}{-\th@mbHimE}%
2571 \addtolength{\th@mbwidthxtoc}{-\evensidemargin}%
2572 \setlength{\@tempdimc}{\th@bmshoffset}%
2573 \addtolength{\@tempdimc}{-\hoffset}
2574 \fi%
2575 \setlength{\th@mbposyB}{-\th@mbposy}%
2576 \if@twoside%
2577 \setcounter{Th@mbTmpA}{\the\c@ThumbsPage}%
2578 \addtocounter{Th@mbTmpA}{\th@mbpofffix}%
2579 \ifodd\c@Th@mbTmpA\relax%
2580 \else%
2581 \addtolength{\th@mbposyB}{-\thumbs@evenprintvoffset}%
2582 \fi%
2583 \fi%
2584 \def\th@mbstest{l}%
2585 \ifx\th@mbstest\th@mbsprintpage% left page
2586 \addtolength{\@tempdimc}{+\th@mbHimE}%
2587 % \end{macrocode}
2588 %
2589 % Thumb rules on right pages shall start $1\unit{em}$ before the text:
2590 %
2591 % \begin{macrocode}
2592 \setlength{\@tempdimb}{0em}%
2593 \else% right page
2594 \setlength{\@tempdimb}{1em}%
2595 \fi%
2596 \addtolength{\@tempdimc}{-\@tempdimb}%
2597 \addtolength{\th@mbwidthxtoc}{\@tempdimb}%
2598 \put(\@tempdimc,\th@mbposyB){%
2599 \ifx\th@mbstest\th@mbsprintpage% left page
2600 % \end{macrocode}
2601 %
2602 % Increase |\th@mbwidthxtoc| by the absolute value of |\evensidemargin|.\newline
2603 % With the \xpackage{bigintcalc} package it would also be possible to use:\newline
2604 % |\setlength{\@tempdimb}{\evensidemargin}%|\newline
2605 % |\@settopoint\@tempdimb%|\newline
2606 % |\advance\th@mbwidthxtoc+\bigintcalcSgn{\expandafter\strip@pt \@tempdimb}\evensidemargin%|\newline
2607 % Also the length given by option |leftindexruleplus| must be added to the thumb width
2608 % |\th@mbwidthxtoc|. - For right-to-left writing |2\evensidemargin|s need to be added.
2609 %
2610 % \begin{macrocode}
2611 \ifdim\evensidemargin <0sp\relax%
2612 \addtolength{\th@mbwidthxtoc}{-\evensidemargin}%
2613 \ifthumbs@righttoleft\addtolength{\th@mbwidthxtoc}{-\evensidemargin}\fi%
2614 \else% >=0sp
2615 \addtolength{\th@mbwidthxtoc}{+\evensidemargin}%
2616 \ifthumbs@righttoleft\addtolength{\th@mbwidthxtoc}{+\evensidemargin}\fi%
2617 \fi%
2618 \addtolength{\th@mbwidthxtoc}{\th@mbslirplus}%
2619 \fi%
2620 \begin{thumbspicture}[artifact](\@tempdimb,0)%
2621 % \end{macrocode}
2622 %
2623 % Correcting for |\th@mbruleoutside| (only needed on left sides).
2624 %
2625 % \begin{macrocode}
2626 \ifx\th@mbstest\th@mbsprintpage% left page
2627 \def\th@mbruleoutsidecor{\th@mbruleoutside}%
2628 \hspace*{-\th@mbruleoutsidecor}%
2629 \else% right page
2630 \def\th@mbruleoutsidecor{0sp}%
2631 % \end{macrocode}
2632 % Here also |\hspace*{-\th@mbruleoutsidecor}|, but |\th@mbruleoutsidecor| is |0sp|, so we can skip this.
2633 % \begin{macrocode}
2634 \fi%
2635 % \end{macrocode}
2636 %
2637 % The whole entry in the overview page (edge index) is made into a coloured rule.
2638 % When the option |plainthumbsoverview=true| is chosen, the rule gets |\thepagecolor|,
2639 % thereby becoming \textquotedblleft invisible\textquotedblright .
2640 %
2641 % \begin{macrocode}
2642 \ifthumbs@plainthumbsoverview\relax%
2643 \def\th@mb@tmp@backgroundcolour{\thepagecolor}%
2644 \fi%
2645 % \end{macrocode}
2646 %
2647 % When the option |thumblink=rule| was chosen, the whole rule is made into a hyperlink.
2648 % Otherwise the rule is created without hyperlink (here).
2649 %
2650 % \begin{macrocode}
2651 \def\th@mbstest{rule}%
2652 \ifx\thumbs@thumblink\th@mbstest%
2653 \ifx\th@mb@tmp@column\thumbs@zero\relax%
2654 {\color{\th@mb@tmp@backgroundcolour}%
2655 % \end{macrocode}
2656 %
2657 % Print the |\rule|, on left pages move the hyperlink to the right, onto the page,
2658 % make the hyperlink.
2659 %
2660 % \begin{macrocode}
2661 \rlap{\th@mbtabrule}%
2662 \hspace*{\th@mbruleoutsidecor}%
2663 \hyperref[\th@mb@tmp@label]{\phantom{\rule{\th@mbwidthxtoc}{\th@mbheighty}}}%
2664 }%
2665 \else%
2666 % \end{macrocode}
2667 %
2668 % When |\th@mb@tmp@column| is not zero, then this is a blank thumb mark from |thumbnewcolumn|.
2669 %
2670 % \begin{macrocode}
2671 \phantom{{\color{\th@mb@tmp@backgroundcolour}\th@mbtabrule}}%
2672 \fi%
2673 \else%
2674 {\color{\th@mb@tmp@backgroundcolour}\th@mbtabrule}%
2675 \fi%
2676 \end{thumbspicture}%
2677 % \end{macrocode}
2678 %
2679 % When |\th@mbsprintpage| is |l|, before the picture |\th@mbwidthxtoc| was changed,
2680 % which must be reverted now.
2681 %
2682 % \begin{macrocode}
2683 \ifx\th@mbstest\th@mbsprintpage% l
2684 \ifdim\evensidemargin <0sp\relax%
2685 \addtolength{\th@mbwidthxtoc}{+\evensidemargin}%
2686 \else% >=0sp
2687 \addtolength{\th@mbwidthxtoc}{-\evensidemargin}%
2688 \fi%
2689 \fi%
2690 % \end{macrocode}
2691 %
2692 % When |\th@mb@tmp@column| is zero, then this is \textbf{not} a blank thumb mark from |thumbnewcolumn|,
2693 % and we need to fill it with some content. If it is not zero, it is a blank thumb mark,
2694 % and nothing needs to be done here.
2695 %
2696 % \begin{macrocode}
2697 \ifx\th@mb@tmp@column\thumbs@zero\relax%
2698 \setlength{\th@mbwidthxtoc}{\paperwidth}%
2699 \addtolength{\th@mbwidthxtoc}{-1in}%
2700 \IfPackageLoadedF{crop}{\addtolength{\th@mbwidthxtoc}{-\hoffset}}%
2701 \ifx\th@mbstest\th@mbsprintpage% l
2702 \addtolength{\th@mbwidthxtoc}{-\evensidemargin}%
2703 \else%
2704 \addtolength{\th@mbwidthxtoc}{-\oddsidemargin}%
2705 \fi%
2706 % \end{macrocode}
2707 %
2708 % When the text is wider than its mark (warning given earlier, see \pageref{tmtww}),
2709 % we need to use the text width instead of the mark width.
2710 %
2711 % \begin{macrocode}
2712 \setlength{\@tempdima}{\th@mbwidthx}%
2713 \setlength{\@tempdimc}{\th@mbmaxwidtha}%
2714 \ifdim\@tempdima>\@tempdimc\relax%
2715 \addtolength{\th@mbwidthxtoc}{-\th@mbwidthx}%
2716 \else%
2717 \addtolength{\th@mbwidthxtoc}{-\th@mbmaxwidtha}%
2718 \fi%
2719 \addtolength{\th@mbwidthxtoc}{-1em}%
2720 \addtolength{\th@mbwidthxtoc}{-20pt}%
2721 \ifdim\th@mbwidthxtoc>\textwidth%
2722 \setlength{\th@mbwidthxtoc}{\textwidth}%
2723 \fi%
2724 % \end{macrocode}
2725 %
2726 % If option |plainthumbsoverview| was set, the coloured background must be removed.
2727 % (Well, removing is not possible, but printing over it in |\thepagecolour|.)
2728 %
2729 % \begin{macrocode}
2730 \ifx\th@mbstest\th@mbsprintpage% left page
2731 \ifthumbs@plainthumbsoverview\relax%
2732 \begin{thumbspicture}[artifact](0,0)%
2733 {\color{\th@mb@tmp@backgroundcolour}\rule{\th@mbwidthx}{\th@mbheighty}}%
2734 \end{thumbspicture}%
2735 \fi%
2736 % \end{macrocode}
2737 %
2738 % Depending on which side the thumb marks should be placed the
2739 % according dimensions have to be adapted here, too.
2740 %
2741 % \begin{macrocode}
2742 \begin{thumbspicture}[artifact](-\th@mbHimE,0)(-6pt,-0.5\th@mbheighty+384930sp)%
2743 \bgroup%
2744 \setlength{\parindent}{0sp}%
2745 \setlength{\@tempdimc}{\th@mbwidthx}%
2746 \addtolength{\@tempdimc}{-\th@mbHitO}%
2747 \setlength{\@tempdimb}{\th@mbwidthx}%
2748 \addtolength{\@tempdimb}{-\th@mbHitE}%
2749 \setcounter{Th@mbTmpA}{\c@ThumbsPage}%
2750 \addtocounter{Th@mbTmpA}{\th@mbpofffix}%
2751 % \end{macrocode}
2752 % \newpage
2753 % \begin{macrocode}
2754 \ifodd\c@Th@mbTmpA\relax%
2755 \hspace*{-\th@mbHitO}%
2756 \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
2757 \else%
2758 \if@twoside%
2759 \hspace*{+\th@mbHitE}%
2760 \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
2761 \else%
2762 \hspace*{-\th@mbHitO}%
2763 \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
2764 \fi%
2765 \fi%
2766 \egroup%
2767 \end{thumbspicture}%
2768 \setlength{\@tempdimc}{-1in}%
2769 \addtolength{\@tempdimc}{-\evensidemargin}%
2770 \else% right page
2771 \setlength{\@tempdimc}{0sp}%
2772 \fi%
2773 \begin{thumbspicture}[artifact](0,0)(\@tempdimc,-0.5\th@mbheighty+384930sp)%
2774 \bgroup%
2775 % \end{macrocode}
2776 %
2777 % With option |plainthumbsoverview| |\th@mb@tmp@textcolour| must be defined (current colour).
2778 %
2779 % \begin{macrocode}
2780 \ifthumbs@plainthumbsoverview\relax%
2781 \def\th@mb@tmp@textcolour{.}%
2782 \fi%
2783 \setlength{\parindent}{0sp}%
2784 \vbox%
2785 {\hsize=\th@mbwidthxtoc {%
2786 % \end{macrocode}
2787 %
2788 % Depending on the value of option |thumblink|, parts of the text are made into hyperlinks:
2789 % \begin{description}
2790 % \item[- |none|] creates \emph{none} hyperlink
2791 %
2792 % \begin{macrocode}
2793 \def\th@mbstest{none}%
2794 \ifx\thumbs@thumblink\th@mbstest%
2795 {\color{\th@mb@tmp@textcolour}\noindent \th@mb@tmp@title%
2796 \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
2797 }%
2798 \else%
2799 % \end{macrocode}
2800 %
2801 % \item[- |title|] hyperlinks the \emph{titles} of the thumb marks
2802 %
2803 % \begin{macrocode}
2804 \def\th@mbstest{title}%
2805 \ifx\thumbs@thumblink\th@mbstest%
2806 {\color{\th@mb@tmp@textcolour}\noindent%
2807 \hyperref[\th@mb@tmp@label]{\th@mb@tmp@title}%
2808 \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
2809 }%
2810 \else%
2811 % \end{macrocode}
2812 %
2813 % \item[- |page|] hyperlinks the \emph{page} numbers of the thumb marks
2814 %
2815 % \begin{macrocode}
2816 \def\th@mbstest{page}%
2817 \ifx\thumbs@thumblink\th@mbstest%
2818 {\color{\th@mb@tmp@textcolour}\noindent%
2819 \th@mb@tmp@title%
2820 \leaders\box \ThumbsBox {\th@mbs@linefill \pageref{\th@mb@tmp@label}}%
2821 }%
2822 \else%
2823 % \end{macrocode}
2824 %
2825 % \item[- |titleandpage|] hyperlinks the \emph{title and page} numbers of the thumb marks
2826 %
2827 % \begin{macrocode}
2828 \def\th@mbstest{titleandpage}%
2829 \ifx\thumbs@thumblink\th@mbstest%
2830 {\color{\th@mb@tmp@textcolour}\noindent%
2831 \hyperref[\th@mb@tmp@label]{\th@mb@tmp@title}%
2832 \leaders\box \ThumbsBox {\th@mbs@linefill \pageref{\th@mb@tmp@label}}%
2833 }%
2834 \else%
2835 % \end{macrocode}
2836 %
2837 % \item[- |line|] hyperlinks the whole \emph{line}, i.\,e. title, dots (or line or whatsoever)
2838 % and page numbers of the thumb marks
2839 %
2840 % \begin{macrocode}
2841 \def\th@mbstest{line}%
2842 \ifx\thumbs@thumblink\th@mbstest%
2843 {\color{\th@mb@tmp@textcolour}\noindent%
2844 \hyperref[\th@mb@tmp@label]{\th@mb@tmp@title%
2845 \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}}%
2846 }%
2847 \else%
2848 % \end{macrocode}
2849 %
2850 % \item[- |rule|] hyperlinks the whole \emph{rule}, but that was already done above,
2851 % so here no linking is done
2852 %
2853 % \begin{macrocode}
2854 \def\th@mbstest{rule}%
2855 \ifx\thumbs@thumblink\th@mbstest%
2856 {\color{\th@mb@tmp@textcolour}\noindent%
2857 \th@mb@tmp@title%
2858 \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
2859 }%
2860 \else%
2861 % \end{macrocode}
2862 % \end{description}
2863 % \newpage
2864 % Another value for |\thumbs@thumblink| should never be encountered here.
2865 %
2866 % \begin{macrocode}
2867 \PackageError{thumbs}{\string\thumbs@thumblink\space invalid}{%
2868 \string\thumbs@thumblink\space has an invalid value,\MessageBreak%
2869 although it did not have an invalid value before,\MessageBreak%
2870 and the thumbs package did not change it.\MessageBreak%
2871 Therefore some other package (or the user)\MessageBreak%
2872 manipulated it.\MessageBreak%
2873 Now setting it to "none" as last resort.%
2874 }%
2875 \gdef\thumbs@thumblink{none}%
2876 {\color{\th@mb@tmp@textcolour}\noindent%
2877 \th@mb@tmp@title%
2878 \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
2879 }%
2880 \fi%
2881 \fi%
2882 \fi%
2883 \fi%
2884 \fi%
2885 \fi%
2886 }%
2887 }%
2888 \egroup%
2889 \end{thumbspicture}%
2890 % \end{macrocode}
2891 %
2892 % The thumb mark (with text) as set in the document outside of the thumb marks overview page(s)
2893 % is also presented here, except when we are printing at the left side.
2894 % For option |plainthumbsoverview| again the coloured background is removed.
2895 %
2896 % \begin{macrocode}
2897 \ifx\th@mbstest\th@mbsprintpage% left page: relax.
2898 \else% right page
2899 \ifthumbs@plainthumbsoverview\relax%
2900 \begin{thumbspicture}[artifact](0,0)(1in+\oddsidemargin-\th@mbxpos,0)%
2901 {\color{\th@mb@tmp@backgroundcolour}\rule{\dimexpr\th@mbwidthx+10pt\relax}{\th@mbheighty}}%
2902 \end{thumbspicture}%
2903 \fi%
2904 \begin{thumbspicture}[artifact](0,0)(1in+\oddsidemargin-\th@mbxpos,-0.5\th@mbheighty+384930sp)%
2905 \bgroup%
2906 \setlength{\parindent}{0sp}%
2907 \setlength{\@tempdimc}{\th@mbwidthx}%
2908 \addtolength{\@tempdimc}{-\th@mbHitO}%
2909 \setlength{\@tempdimb}{\th@mbwidthx}%
2910 \addtolength{\@tempdimb}{-\th@mbHitE}%
2911 \setcounter{Th@mbTmpA}{\c@ThumbsPage}%
2912 \addtocounter{Th@mbTmpA}{\th@mbpofffix}%
2913 \ifodd\c@Th@mbTmpA\relax%
2914 \hspace*{-\th@mbHitO}%
2915 \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
2916 \else%
2917 \if@twoside%
2918 \hspace*{+\th@mbHitE}%
2919 \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
2920 \else%
2921 \hspace*{-\th@mbHitO}%
2922 \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
2923 \fi%
2924 \fi%
2925 \egroup%
2926 \end{thumbspicture}%
2927 \fi%
2928 \fi%
2929 }%
2930 }
2931
2932 % \end{macrocode}
2933 % \end{macro}
2934 %
2935 % \begin{macro}{\th@mb@yA}
2936 % |\th@mb@yA| sets the y-position to be used in |\th@mbprint|.
2937 %
2938 % \begin{macrocode}
2939 \newcommand{\th@mb@yA}{%
2940 \addtolength{\th@mbposyA}{\th@mbheighty}%
2941 \addtolength{\th@mbposyA}{\th@mbsdistance}%
2942 \ifdim\th@mbposyA>\th@mbposybottom%
2943 \PackageWarning{thumbs}{You are not only using more than one thumb mark at one\MessageBreak%
2944 single page, but also thumb marks from different thumb\MessageBreak%
2945 columns. May I suggest the use of a \string\pagebreak\space or\MessageBreak%
2946 \string\newpage ?%
2947 }%
2948 \setlength{\th@mbposyA}{\th@mbposytop}%
2949 \fi%
2950 }
2951
2952 % \end{macrocode}
2953 % \end{macro}
2954 %
2955 % \begin{macro}{\th@mbprint}
2956 % |\th@mbprint| places |picture|s containing the thumb mark on the page.
2957 % First computing some dimensions/positions. To be really safe,
2958 % |\th@mbwidthx| is increased by $10\unit{pt}$ outside of the layout page
2959 % (which is reverted afterwards).\newline
2960 % The |picture| with the background of the thumb mark is placed.
2961 %
2962 % \begin{macrocode}
2963 \newcommand{\th@mbprint}[3]{%
2964 \setlength{\th@mbposyB}{-\th@mbposyA}%
2965 \addtolength{\th@mbwidthx}{+10pt}%
2966 \if@twoside%
2967 \setcounter{Th@mbTmpA}{\c@ThumbsPage}%
2968 \addtocounter{Th@mbTmpA}{\th@mbpofffix}%
2969 \ifodd\c@Th@mbTmpA\relax% right page
2970 \put(\th@mbxpos,\th@mbposyB){%
2971 \begin{thumbspicture}[artifact](0,0)%
2972 {\color{#3}\rule{\th@mbcomprulewidth}{\th@mbheighty}}%
2973 \end{thumbspicture}%
2974 }%
2975 \else% left page
2976 \setlength{\@tempdimc}{-\th@mbposyA}%
2977 \addtolength{\@tempdimc}{-\thumbs@evenprintvoffset}%
2978 \setlength{\th@mbposyB}{\@tempdimc}%
2979 \put(\th@mbxpos-10pt-\th@mbruleoutside+\th@mbwidthx,\th@mbposyB){%
2980 \begin{thumbspicture}[artifact](0,0)%
2981 {\color{#3}\rule{\th@mbcomprulewidth}{\th@mbheighty}}%
2982 \end{thumbspicture}%
2983 }%
2984 \fi%
2985 \else% one-sided, right page
2986 \put(\th@mbxpos,\th@mbposyB){%
2987 \begin{thumbspicture}[artifact](0,0)%
2988 {\color{#3}\rule{\th@mbcomprulewidth}{\th@mbheighty}}%
2989 \end{thumbspicture}%
2990 }%
2991 \fi%
2992 \addtolength{\th@mbwidthx}{-10pt}%
2993 % \end{macrocode}
2994 %
2995 % |\thumbs@frame| is used when the thumb marks shall only be frames and not filled.
2996 % In this case a second, smaller |picture| is placed over the first one:
2997 %
2998 % \begin{macrocode}
2999 \ifx\thumbs@frame\thumbs@empty\relax%
3000 \else%
3001 % \end{macrocode}
3002 %
3003 % \begin{description}
3004 % \item[-] height minus two times the thickness of the line of the frame:
3005 %
3006 % \begin{macrocode}
3007 \setlength{\th@mbiruley}{\th@mbheighty}%
3008 \addtolength{\th@mbiruley}{-\thumbs@frame}%
3009 \addtolength{\th@mbiruley}{-\thumbs@frame}%
3010 % \end{macrocode}
3011 %
3012 % \item[-] width minus two times the thickness of the line of the frame:
3013 %
3014 % \begin{macrocode}
3015 \setlength{\th@mbirulex}{\th@mbwidthx}%
3016 \addtolength{\th@mbirulex}{-\thumbs@frame}%
3017 \addtolength{\th@mbirulex}{-\thumbs@frame}%
3018 % \end{macrocode}
3019 %
3020 % \item[-] horizontal position:
3021 %
3022 % \begin{macrocode}
3023 \setlength{\th@mbwidthtmp}{\thumbs@frame}%
3024 \ifdim \th@mbxpos > 0sp\relax%
3025 \addtolength{\th@mbwidthtmp}{+\th@mbxpos}%
3026 % \end{macrocode}
3027 %
3028 % \begin{description}
3029 % \item[+] right page: decreased by the length of the thumb mark going over the page's right border
3030 %
3031 % \begin{macrocode}
3032 \addtolength{\th@mbirulex}{+\paperwidth}%
3033 \addtolength{\th@mbirulex}{-\th@mbxpos}%
3034 \addtolength{\th@mbirulex}{-\th@mbwidthx}%
3035 \else%
3036 % \end{macrocode}
3037 %
3038 % \item[+] left page: decreased by the length of the thumb mark going over the page's left border
3039 %
3040 % \begin{macrocode}
3041 \addtolength{\th@mbwidthtmp}{-\th@mbxpos}%
3042 \addtolength{\th@mbirulex}{+\th@mbxpos}%
3043 % \end{macrocode}
3044 %
3045 % (|+\th@mbxpos|, because the value of |\th@mbxpos| is already negative or zero)
3046 %
3047 % \begin{macrocode}
3048 \fi%
3049 % \end{macrocode}
3050 %
3051 % \end{description}
3052 %
3053 % \begin{macrocode}
3054 \addtolength{\th@mbirulex}{-1pt}%
3055 \put(\th@mbwidthtmp,\th@mbposyB+\thumbs@frame){%
3056 \begin{thumbspicture}[artifact](0,0)%
3057 {\color{\th@mbs@fr@meinnercolor}\rule{\th@mbirulex}{\th@mbiruley}}%
3058 \end{thumbspicture}%
3059 }%
3060 \fi%
3061 % \end{macrocode}
3062 % \end{description}
3063 %
3064 % The third picture finally contains the text:
3065 %
3066 % \begin{macrocode}
3067 \put(\th@mbxpos,\th@mbposyB){%
3068 \begin{thumbspicture}[artifact](0,0)(0,-0.5\th@mbheighty+384930sp)%
3069 \bgroup%
3070 \setlength{\parindent}{0sp}%
3071 \setlength{\@tempdimc}{\th@mbwidthx}%
3072 \addtolength{\@tempdimc}{-\th@mbHitO}%
3073 \setlength{\@tempdimb}{\th@mbwidthx}%
3074 \addtolength{\@tempdimb}{-\th@mbHitE}%
3075 \setcounter{Th@mbTmpA}{\c@ThumbsPage}%
3076 \addtocounter{Th@mbTmpA}{\th@mbpofffix}%
3077 \ifodd\c@Th@mbTmpA\relax%
3078 \hspace*{-\th@mbHitO}%
3079 \th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
3080 \else%
3081 \if@twoside%
3082 \hspace*{+\th@mbHitE}%
3083 \th@mb@txtBox{#2}{#1}{l}{\@tempdimb}%
3084 \else%
3085 \hspace*{-\th@mbHitO}%
3086 \th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
3087 \fi%
3088 \fi%
3089 \egroup%
3090 \end{thumbspicture}%
3091 }%
3092 }
3093
3094 % \end{macrocode}
3095 % \end{macro}
3096 % \pagebreak
3097 %
3098 % \DescribeMacro{\AddToHook{shipout/before}}
3099 % |\@expl@@@shipout@add@background@picture@@n| (formerly |\AtBeginShipoutUpperLeft|)
3100 % calls the |\th@mbprint| macro for each thumb mark which shall be placed on that page.
3101 % When |\stopthumb| was used, the thumb mark is omitted.
3102 %
3103 % \begin{macrocode}
3104 \AddToHook{shipout/before}{%
3105 \ifx\th@mbcolumnnew\thumbs@zero\relax% OK
3106 \else%
3107 \PackageError{thumbs}{Missing \string\addthumb\space after \string\thumbnewcolumn }{%
3108 Command \string\thumbnewcolumn\space was used, but no new thumb placed with \string\addthumb\MessageBreak%
3109 (at least not at the same page). After \string\thumbnewcolumn\space please always use an\MessageBreak%
3110 \string\addthumb . Until the next \string\addthumb , there will be no thumb marks on the\MessageBreak%
3111 pages. Starting a new column of thumb marks and not putting a thumb mark into\MessageBreak%
3112 that column does not make sense. If you just want to get rid of column marks,\MessageBreak%
3113 do not abuse \string\thumbnewcolumn\space but use \string\stopthumb .\MessageBreak%
3114 (This error message will be repeated at all following pages,\MessageBreak%
3115 \space until \string\addthumb\space is used.)%
3116 }%
3117 \fi%
3118 \setcounter{Th@mbTmpA}{\c@ThumbsPage}%
3119 \addtocounter{Th@mbTmpA}{\th@mbpofffix}%
3120 % \end{macrocode}
3121 %
3122 % Changing the paper size mid-document will probably cause some problems.
3123 % But if it works, we try to cope with it. (When the change is performed
3124 % without changing |\paperwidth|, we cannot detect it. Sorry.)
3125 %
3126 % \begin{macrocode}
3127 \edef\th@mbstmpwidth{\the\paperwidth}%
3128 \ifdim\th@mbpaperwidth=\th@mbstmpwidth% OK
3129 \else%
3130 \PackageWarningNoLine{thumbs}{Paperwidth has changed. Thumb mark positions become now adapted}%
3131 \setlength{\th@mbposx}{\paperwidth}%
3132 \addtolength{\th@mbposx}{-\th@mbwidthx}%
3133 \ifthumbs@ignorehoffset%
3134 \addtolength{\th@mbposx}{-\hoffset}%
3135 \fi%
3136 \addtolength{\th@mbposx}{+1pt}%
3137 \xdef\th@mbpaperwidth{\the\paperwidth}%
3138 \fi%
3139 % \end{macrocode}
3140 %
3141 % Determining the correct |\th@mbxpos|:
3142 %
3143 % \begin{macrocode}
3144 \edef\th@mbxpos{\the\th@mbposx}%
3145 \ifodd\c@Th@mbTmpA\relax%
3146 \else%
3147 \if@twoside%
3148 \ifthumbs@ignorehoffset%
3149 \setlength{\@tempdimc}{-\hoffset}%
3150 \addtolength{\@tempdimc}{-1pt}%
3151 \edef\th@mbxpos{\the\@tempdimc}%
3152 \else%
3153 \def\th@mbxpos{-1pt}%
3154 \fi%
3155 % \end{macrocode}
3156 % | \else \relax%|
3157 % \begin{macrocode}
3158 \fi%
3159 \fi%
3160 \setlength{\@tempdimc}{\th@mbxpos}%
3161 \if@twoside%
3162 \ifodd\c@Th@mbTmpA\relax%
3163 \addtolength{\@tempdimc}{-\th@mbHimO}%
3164 \else \addtolength{\@tempdimc}{+\th@mbHimE}%
3165 \fi%
3166 \else \addtolength{\@tempdimc}{-\th@mbHimO}%
3167 \fi%
3168 \edef\th@mbxpos{\the\@tempdimc}%
3169 \@expl@@@shipout@add@foreground@picture@@n{%
3170 \ifx\th@mbprinting\thumbs@one\relax%
3171 \th@mbprint{\th@mbtextA}{\th@mbtextcolourA}{\th@mbbackgroundcolourA}%
3172 \setcounter{Th@mbTmpB}{1}%
3173 \edef\th@mbonpagetest{\the\c@Th@mbTmpB}%
3174 \@whilenum\th@mbonpagetest<\th@mbonpage\do{%
3175 \addtocounter{Th@mbTmpB}{1}%
3176 \edef\th@mbonpagetest{\the\c@Th@mbTmpB}%
3177 \th@mb@yA%
3178 \def\Th@mbTmpDefText{\csname th@mbtext\AlphAlph{\the\c@Th@mbTmpB}\endcsname}%
3179 \def\Th@mbTmpDefColour{\csname th@mbtextcolour\AlphAlph{\the\c@Th@mbTmpB}\endcsname}%
3180 \def\Th@mbTmpDefBackgroundColour{\csname th@mbbackgroundcolour\AlphAlph{\the\c@Th@mbTmpB}\endcsname}%
3181 \th@mbprint{\Th@mbTmpDefText}{\Th@mbTmpDefColour}{\Th@mbTmpDefBackgroundColour}%
3182 }%
3183 \fi%
3184 % \end{macrocode}
3185 %
3186 % When more than one thumb mark was placed at that page, on the following pages
3187 % only the last issued thumb mark shall appear.
3188 %
3189 % \begin{macrocode}
3190 \setcounter{Th@mbTmpB}{\th@mbonpage}%
3191 \ifnum\c@Th@mbTmpB<2\relax%
3192 \else%
3193 \gdef\th@mbtextA{\th@mbtext}%
3194 \gdef\th@mbtextcolourA{\th@mbtextcolour}%
3195 \gdef\th@mbbackgroundcolourA{\th@mbbackgroundcolour}%
3196 \gdef\th@mbposyA{\th@mbposy}%
3197 \fi%
3198 \gdef\th@mbonpage{0}%
3199 \gdef\th@mbtoprint{0}%
3200 }%
3201 }
3202
3203 % \end{macrocode}
3204 % \pagebreak
3205 %
3206 % \DescribeMacro{Hook enddocument/afterlastpage}
3207 % |\AddToHook{enddocument/afterlastpage}| (formerly |\AfterLastShipout|)
3208 % is executed after the last page has been shipped out.
3209 % It is still possible to \hbox{e.\,g.} write to the \xfile{aux} file at this time.
3210 %
3211 % \begin{macrocode}
3212 \AddToHook{enddocument/afterlastpage}{%
3213 \ifx\th@mbcolumnnew\thumbs@zero\relax% OK
3214 \else%
3215 \PackageWarningNoLine{thumbs}{%
3216 Still missing \string\addthumb\space after \string\thumbnewcolumn\space after\MessageBreak%
3217 last ship-out: Command \string\thumbnewcolumn\space was used,\MessageBreak%
3218 but no new thumb placed with \string\addthumb\space anywhere in the\MessageBreak%
3219 rest of the document. Starting a new column of thumb\MessageBreak%
3220 marks and not putting a thumb mark into that column\MessageBreak%
3221 does not make sense. If you just want to get rid of\MessageBreak%
3222 thumb marks, do not abuse \string\thumbnewcolumn\space but use\MessageBreak%
3223 \string\stopthumb %
3224 }%
3225 \fi%
3226 % \end{macrocode}
3227 %
3228 % After the last shipout the number of thumb marks per overview page,
3229 % the total number of thumb marks, and the maximal thumb mark text width
3230 % are determined and saved for the next \LaTeX\ run via the \xfile{.aux} file.
3231 %
3232 % \begin{macrocode}
3233 \ifx\th@mbcolumn\thumbs@zero\relax% if there is only one column of thumbs
3234 \xdef\th@umbsperpagecount{\th@mbs}%
3235 \gdef\th@mbcolumn{1}%
3236 \fi%
3237 \ifx\th@umbsperpagecount\thumbs@zero\relax%
3238 \gdef\th@umbsperpagecount{\th@mbs}% \th@mbs was increased with each \addthumb
3239 \fi%
3240 \ifdim\th@mbmaxwidth>\th@mbwidthx%
3241 \ifthumbs@draft% \relax
3242 \else%
3243 \def\th@mbstest{autoauto}%
3244 \ifx\thumbs@width\th@mbstest%
3245 \AddToHook{enddocument/info}{%
3246 \PackageWarningNoLine{thumbs}{Rerun to get the thumb marks width right}%
3247 }%
3248 \else%
3249 \AddToHook{enddocument/info}{%
3250 \edef\thumbsinfoa{\th@mbmaxwidth}%
3251 \edef\thumbsinfob{\the\th@mbwidthx}%
3252 \PackageWarningNoLine{thumbs}{%
3253 Thumb mark too small or its text too wide:\MessageBreak%
3254 The widest thumb mark text is \thumbsinfoa\space wide,\MessageBreak%
3255 but the thumb marks are only \space\thumbsinfob\space wide.\MessageBreak%
3256 Either shorten or scale down the text,\MessageBreak%
3257 or increase the thumb mark width,\MessageBreak%
3258 or use option width=autoauto%
3259 }%
3260 }%
3261 \fi%
3262 \fi%
3263 \fi%
3264 \if@filesw%
3265 \immediate\write\@auxout{\string\gdef\string\th@mbmaxwidtha{\th@mbmaxwidth}}%
3266 \immediate\write\@auxout{\string\gdef\string\th@umbsperpage{\th@umbsperpagecount}}%
3267 \immediate\write\@auxout{\string\gdef\string\th@mbsmax{\th@mbs}}%
3268 \expandafter\newwrite\csname tf@tmb\endcsname%
3269 % \end{macrocode}
3270 %
3271 % And a rerun check is performed: Did the |\jobname.tmb| file change?
3272 %
3273 % \begin{macrocode}
3274 \RerunFileCheck{\jobname.tmb}{\immediate\closeout \csname tf@tmb\endcsname}{%
3275 Warning: Rerun to get list of thumbs right!}%
3276 \immediate\openout \csname tf@tmb\endcsname = \jobname.tmb\relax%
3277 %\else there is a problem, but the according warning message was already given earlier.
3278 \fi%
3279 }
3280
3281 % \end{macrocode}
3282 %
3283 % \begin{macro}{\addthumbsoverviewtocontents}
3284 % |\addthumbsoverviewtocontents| with two arguments is a replacement for
3285 % |\addcontentsline{toc}{<level>}{<text>}|, where the first argument of
3286 % |\addthumbsoverviewtocontents| is for |<level>| and the second for |<text>|.
3287 % If an entry of the thumbs mark overview shall be placed in the table of contents,
3288 % |\addthumbsoverviewtocontents| with its arguments should be used immediately before
3289 % |\thumbsoverview|.
3290 %
3291 % \begin{macrocode}
3292 \newcommand{\addthumbsoverviewtocontents}[2]{%
3293 \gdef\th@mbs@toc@level{#1}%
3294 \gdef\th@mbs@toc@text{#2}%
3295 }
3296
3297 % \end{macrocode}
3298 % \end{macro}
3299 %
3300 % \begin{macro}{\clearotherdoublepage}
3301 % We need a command to clear a double page, thus that the following text
3302 % is \emph{left} instead of \emph{right} as accomplished with the usual
3303 % |\cleardoublepage|. For this we take the original |\cleardoublepage| code
3304 % and revert the |\ifodd\c@page\else| (i.\,e. if even |\c@page|) condition.
3305 %
3306 % \begin{macrocode}
3307 \newcommand{\clearotherdoublepage}{%
3308 \clearpage\if@twoside\ifodd\c@page% removed "\else" from \cleardoublepage
3309 \hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi%
3310 }
3311
3312 % \end{macrocode}
3313 % \end{macro}
3314 %
3315 % \begin{macro}{\th@mbstablabeling}
3316 % When the \xpackage{hyperref} package is used, one might like to refer to the
3317 % thumb overview page(s) (edge index/{}indices), therefore |\th@mbstablabeling|%
3318 % command is defined (and used later). First a~|\phantomsection| is added.
3319 % With or without \xpackage{hyperref} a label |TableOfThumbs1| (or |TableOfThumbs2|
3320 % or\ldots) is placed here. For compatibility with older versions of this
3321 % package also the label |TableOfThumbs| is created. Equal to older versions
3322 % it aims at the last used Table of Thumbs, but since version~1.0g \textbf{without}\newline
3323 % |Error: Label TableOfThumbs multiply defined| -- thanks to |\overridelabel| from
3324 % the \xpackage{undolabl} package.\newline
3325 % When |\addthumbsoverviewtocontents| was used, the entry is placed into the
3326 % table of contents.
3327 % \pagebreak
3328 %
3329 % \begin{macrocode}
3330 \newcommand{\th@mbstablabeling}{%
3331 \IfPackageLoadedT{hyperref}{\phantomsection}%
3332 \let\label\thumbsoriglabel%
3333 \ifx\th@mbstable\thumbs@one\relax%
3334 \label{TableOfThumbs}%
3335 \label{TableOfThumbs1}%
3336 \else%
3337 \overridelabel{TableOfThumbs}%
3338 \label{TableOfThumbs\th@mbstable}%
3339 \fi%
3340 \let\label\@gobble%
3341 \ifx\th@mbs@toc@level\empty%\relax
3342 \else \addcontentsline{toc}{\th@mbs@toc@level}{\th@mbs@toc@text}%
3343 \fi%
3344 }
3345
3346 % \end{macrocode}
3347 % \end{macro}
3348 %
3349 % \DescribeMacro{\thumbsoverview}
3350 % \DescribeMacro{\thumbsoverviewback}
3351 % \DescribeMacro{\thumbsoverviewverso}
3352 % \DescribeMacro{\thumbsoverviewdouble}
3353 % For compatibility with documents created using older versions of this package
3354 % |\thumbsoverview| did not get a second argument, but it is renamed to
3355 % |\thumbsoverviewprint| and additional to |\thumbsoverview| new commands are
3356 % introduced. It is of course also possible to use |\thumbsoverviewprint| with
3357 % its two arguments directly, therefore its name does not include any |@|
3358 % (saving the users the use of |\makeatother| and |\makeatletter|).
3359 % \begin{description}
3360 % \item[-] |\thumbsoverview| prints the thumb marks at the right side
3361 % and (in |twoside| mode) skips left sides (useful e.\,g.~at the beginning
3362 % of a document)
3363 %
3364 % \item[-] |\thumbsoverviewback| prints the thumb marks at the left side
3365 % and (in |twoside| mode) skips right sides (useful e.\,g.~at the end
3366 % of a document)
3367 %
3368 % \item[-] |\thumbsoverviewverso| prints the thumb marks at the right side
3369 % and (in |twoside| mode) repeats them at the next left side and so on
3370 % (useful anywhere in the document and when one wants to prevent empty
3371 % pages)
3372 %
3373 % \item[-] |\thumbsoverviewdouble| prints the thumb marks at the left side
3374 % and (in |twoside| mode) repeats them at the next right side and so on
3375 % (useful anywhere in the document and when one wants to prevent empty
3376 % pages)
3377 % \end{description}
3378 %
3379 % The |\thumbsoverview...| commands are used to place the overview page(s)
3380 % (edge index/{}indices) for the thumb marks. Their parameter is used
3381 % to mark this page/{}these pages (e.\,g.~in the page header).
3382 % If these marks are not wished, |\thumbsoverview...{}| will generate
3383 % empty marks in the page header(s). |\thumbsoverview...| can be used
3384 % more than once (for example at the beginning and at the end of the document).
3385 % The overviews have labels |TableOfThumbs1|, |TableOfThumbs2| and so on,
3386 % which can be referred to with e.\,g.~|\pageref{TableOfThumbs1}|.
3387 % The reference |TableOfThumbs| (without number) aims at the last used Table of Thumbs
3388 % (for compatibility with older versions of this package).
3389 % \pagebreak
3390 %
3391 % For right-to-left writing the thumb marks must be put at the other edge of the page.
3392 %
3393 % \begin{macro}{\thumbsoverview}
3394 % \begin{macrocode}
3395 \newcommand{\thumbsoverview}[1]{%
3396 \ifthumbs@righttoleft\thumbsoverviewprint{#1}{l}%
3397 \else\thumbsoverviewprint{#1}{r}%
3398 \fi%
3399 }
3400
3401 % \end{macrocode}
3402 % \end{macro}
3403 % \begin{macro}{\thumbsoverviewback}
3404 % \begin{macrocode}
3405 \newcommand{\thumbsoverviewback}[1]{%
3406 \if@twoside%
3407 \else%
3408 \PackageWarning{thumbs}{\string\thumbsoverviewback\space%
3409 used in a one-sided document.\MessageBreak%
3410 Maybe you want to use \string\thumbsoverview\space instead?\MessageBreak%
3411 Code}%
3412 \fi%
3413 \ifthumbs@righttoleft\thumbsoverviewprint{#1}{r}%
3414 \else\thumbsoverviewprint{#1}{l}%
3415 \fi%
3416 }
3417
3418 % \end{macrocode}
3419 % \end{macro}
3420 % \begin{macro}{\thumbsoverviewverso}
3421 % \begin{macrocode}
3422 \newcommand{\thumbsoverviewverso}[1]{%
3423 \if@twoside%
3424 \else%
3425 \PackageWarning{thumbs}{\string\thumbsoverviewverso\space%
3426 used in a one-sided document.\MessageBreak%
3427 Maybe you want to use \string\thumbsoverview\space instead?\MessageBreak%
3428 Code}%
3429 \fi%
3430 \ifthumbs@righttoleft\thumbsoverviewprint{#1}{d}%
3431 \else\thumbsoverviewprint{#1}{v}%
3432 \fi%
3433 }
3434
3435 % \end{macrocode}
3436 % \end{macro}
3437 %
3438 % \begin{macro}{\thumbsoverviewdouble}
3439 % \begin{macrocode}
3440 \newcommand{\thumbsoverviewdouble}[1]{%
3441 \if@twoside%
3442 \else%
3443 \PackageWarning{thumbs}{\string\thumbsoverviewdouble\space%
3444 used in a one-sided document.\MessageBreak%
3445 Maybe you want to use \string\thumbsoverview\space instead?\MessageBreak%
3446 Code}%
3447 \fi%
3448 \ifthumbs@righttoleft\thumbsoverviewprint{#1}{v}%
3449 \else\thumbsoverviewprint{#1}{d}%
3450 \fi%
3451 }
3452
3453 % \end{macrocode}
3454 % \end{macro}
3455 %
3456 % \begin{macro}{\thumbsoverviewprint}
3457 % |\thumbsoverviewprint| works by calling the internal command |\th@mbs@verview|
3458 % (see below), repeating this until all thumb marks have been processed.
3459 %
3460 % \begin{macrocode}
3461 \newcommand{\thumbsoverviewprint}[2]{%
3462 % \end{macrocode}
3463 %
3464 % It would be possible to just |\edef\th@mbsprintpage{#2}|, but
3465 % |\thumbsoverviewprint| might be called manually and without valid second argument.
3466 %
3467 % \begin{macrocode}
3468 \edef\th@mbstest{#2}%
3469 \def\th@mbstestb{r}%
3470 \ifx\th@mbstest\th@mbstestb% right
3471 \gdef\th@mbsprintpage{r}%
3472 \else%
3473 \def\th@mbstestb{l}%
3474 \ifx\th@mbstest\th@mbstestb% left
3475 \gdef\th@mbsprintpage{l}%
3476 \else%
3477 \def\th@mbstestb{v}%
3478 \ifx\th@mbstest\th@mbstestb% verso
3479 \gdef\th@mbsprintpage{v}%
3480 \else%
3481 \def\th@mbstestb{d}%
3482 \ifx\th@mbstest\th@mbstestb% double
3483 \gdef\th@mbsprintpage{d}%
3484 \else%
3485 \PackageError{thumbs}{Invalid second parameter of \string\thumbsoverviewprint }{%
3486 The second argument of command \string\thumbsoverviewprint\space must be\MessageBreak%
3487 either "r" or "l" or "v" or "d" but it is neither.\MessageBreak%
3488 Now "r" is chosen instead ("l" for right-to-left writing).}%
3489 \ifthumbs@righttoleft\gdef\th@mbsprintpage{l}%
3490 \else\gdef\th@mbsprintpage{r}%
3491 \fi%
3492 \fi%
3493 \fi%
3494 \fi%
3495 \fi%
3496 % \end{macrocode}
3497 % \pagebreak
3498 %
3499 % Option |\thumbs@thumblink| is checked for a valid and reasonable value here.
3500 %
3501 % \begin{macrocode}
3502 \def\th@mbstest{none}%
3503 \ifx\thumbs@thumblink\th@mbstest% OK
3504 \else%
3505 \IfPackageLoadedTF{hyperref}{% hyperref loaded
3506 \def\th@mbstest{title}%
3507 \ifx\thumbs@thumblink\th@mbstest% OK
3508 \else%
3509 \def\th@mbstest{page}%
3510 \ifx\thumbs@thumblink\th@mbstest% OK
3511 \else%
3512 \def\th@mbstest{titleandpage}%
3513 \ifx\thumbs@thumblink\th@mbstest% OK
3514 \else%
3515 \def\th@mbstest{line}%
3516 \ifx\thumbs@thumblink\th@mbstest% OK
3517 \else%
3518 \def\th@mbstest{rule}%
3519 \ifx\thumbs@thumblink\th@mbstest% OK
3520 \else%
3521 \PackageError{thumbs}{Option thumblink with invalid value}{%
3522 Option thumblink has invalid value "\thumbs@thumblink ".\MessageBreak%
3523 Valid values are "none", "title", "page",\MessageBreak%
3524 "titleandpage", "line", or "rule".\MessageBreak%
3525 "rule" will be used now.}%
3526 \gdef\thumbs@thumblink{rule}%
3527 \fi%
3528 \fi%
3529 \fi%
3530 \fi%
3531 \fi%
3532 }{% hyperref not loaded
3533 \PackageError{thumbs}{Option thumblink not "none", but hyperref not loaded}{%
3534 The option thumblink of the thumbs package was not set to "none",\MessageBreak%
3535 but to some kind of hyperlinks, without using package hyperref.\MessageBreak%
3536 Either choose option "thumblink=none", or load package hyperref.\MessageBreak%
3537 When pressing Return, "thumblink=none" will be set now.}%
3538 \gdef\thumbs@thumblink{none}%
3539 }%
3540 \fi%
3541 % \end{macrocode}
3542 %
3543 % When the thumb overview is printed and there is already a thumb mark set,
3544 % for example for the front-matter (e.\,g.~title page, bibliographic information,
3545 % acknowledgements, dedication, preface, abstract, tables of content, tables,
3546 % and figures, lists of symbols and abbreviations, and the thumbs overview
3547 % (edge index) itself, of course) or when the overview is placed near the
3548 % end of the document, the current y-position of the thumb mark must be remembered
3549 % (and later restored) and the printing of that thumb mark must be stopped
3550 % (and later continued).
3551 %
3552 % \begin{macrocode}
3553 \edef\th@mbprintingovertoc{\th@mbprinting}%
3554 \ifnum \th@mbsmax > \thumbs@zero\relax%
3555 \if@twoside%
3556 \def\th@mbstest{r}% right
3557 \ifx\th@mbstest\th@mbsprintpage%
3558 \ifthumbs@righttoleft\clearotherdoublepage%
3559 \else\cleardoublepage%
3560 \fi%
3561 \else%
3562 \def\th@mbstest{v}% verso
3563 \ifx\th@mbstest\th@mbsprintpage%
3564 \ifthumbs@righttoleft\clearotherdoublepage%
3565 \else\cleardoublepage%
3566 \fi%
3567 \else% l(eft) or d(ouble)
3568 \ifthumbs@righttoleft\cleardoublepage%
3569 \else\clearotherdoublepage%
3570 \fi%
3571 \fi%
3572 \fi%
3573 \else\clearpage%
3574 \fi%
3575 \stopthumb%
3576 \PackageInfo{thumbs}{If you get an error "Runaway argument? \string\MakeUppercases"\MessageBreak%
3577 you probably forgot the argument for a\MessageBreak%
3578 \string\thumbsoverview/back/verso/double\space command}%
3579 \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}%
3580 \fi%
3581 \setlength{\th@mbsposytocy}{\th@mbposy}%
3582 \setlength{\th@mbposy}{\th@mbsposytocyy}%
3583 \ifx\th@mbstable\thumbs@zero\relax%
3584 \newcounter{th@mblinea}%
3585 \newcounter{th@mblineb}%
3586 \newcounter{FileLine}%
3587 \newcounter{thumbsstop}%
3588 \fi%
3589 \setcounter{th@mblinea}{\th@mbstable}%
3590 \addtocounter{th@mblinea}{+1}%
3591 \xdef\th@mbstable{\number\value{th@mblinea}}%
3592 \setcounter{th@mblinea}{1}%
3593 \setcounter{th@mblineb}{\th@umbsperpage}%
3594 \setcounter{FileLine}{1}%
3595 \setcounter{thumbsstop}{1}%
3596 \addtocounter{thumbsstop}{\th@mbsmax}%
3597 % \end{macrocode}
3598 % \pagebreak
3599 %
3600 % We do not want any labels or index or glossary entries confusing the
3601 % table of thumb marks entries, but the commands must work outside of it:
3602 %
3603 % \begin{macro}{\thumbsoriglabel}
3604 % \begin{macrocode}
3605 \let\thumbsoriglabel\label%
3606 % \end{macrocode}
3607 % \end{macro}
3608 % \begin{macro}{\thumbsorigindex}
3609 % \begin{macrocode}
3610 \let\thumbsorigindex\index%
3611 % \end{macrocode}
3612 % \end{macro}
3613 % \begin{macro}{\thumbsorigglossary}
3614 % \begin{macrocode}
3615 \let\thumbsorigglossary\glossary%
3616 % \end{macrocode}
3617 % \end{macro}
3618 % \begin{macrocode}
3619 \let\label\@gobble%
3620 \let\index\@gobble%
3621 \let\glossary\@gobble%
3622 % \end{macrocode}
3623 %
3624 % Some preparation in case of double printing the overview page(s):
3625 %
3626 % \begin{macrocode}
3627 \def\th@mbstest{v}% right left right ...
3628 \ifx\th@mbstest\th@mbsprintpage%
3629 \def\th@mbsprintpage{l}% because it will be changed to r(ight)
3630 \def\th@mbdoublepage{1}%
3631 \else%
3632 \def\th@mbstest{d}% left right left ...
3633 \ifx\th@mbstest\th@mbsprintpage%
3634 \def\th@mbsprintpage{r}% because it will be changed to l(eft)
3635 \def\th@mbdoublepage{1}%
3636 \else%
3637 \def\th@mbdoublepage{0}%
3638 \fi%
3639 \fi%
3640 \def\th@mb@resetdoublepage{0}%
3641 \@whilenum\value{FileLine}<\value{thumbsstop}\do%
3642 % \end{macrocode}
3643 %
3644 % For double printing the overview page(s) (edge index) we just change between printing
3645 % left and right, and we need to reset the line number of the |\jobname.tmb| file
3646 % which is read, because we need to read things twice.
3647 %
3648 % \begin{macrocode}
3649 {\ifx\th@mbdoublepage\thumbs@one\relax%
3650 \def\th@mbstest{r}% right
3651 \ifx\th@mbsprintpage\th@mbstest%
3652 \def\th@mbsprintpage{l}% left
3653 \else% \th@mbsprintpage is l(eft)
3654 \def\th@mbsprintpage{r}% right
3655 \fi%
3656 \clearpage%
3657 \ifx\th@mb@resetdoublepage\thumbs@one\relax%
3658 \setcounter{th@mblinea}{\theth@mblinea}%
3659 \setcounter{th@mblineb}{\theth@mblineb}%
3660 \def\th@mb@resetdoublepage{0}%
3661 \else%
3662 \edef\theth@mblinea{\number\value{th@mblinea}}%
3663 \edef\theth@mblineb{\number\value{th@mblineb}}%
3664 \def\th@mb@resetdoublepage{1}%
3665 \fi%
3666 \else%
3667 \if@twoside%
3668 \def\th@mbstest{r}% right
3669 \ifx\th@mbstest\th@mbsprintpage%
3670 \ifthumbs@righttoleft\clearotherdoublepage%
3671 \else\cleardoublepage%
3672 \fi%
3673 \else% l(eft)
3674 \ifthumbs@righttoleft\cleardoublepage%
3675 \else\clearotherdoublepage%
3676 \fi%
3677 \fi%
3678 \else\clearpage%
3679 \fi%
3680 \fi%
3681 % \end{macrocode}
3682 %
3683 % When the very first page of a thumb marks overview is generated,
3684 % the label is set (with the |\th@mbstablabeling| command).
3685 %
3686 % \begin{macrocode}
3687 \ifnum\value{FileLine}=1\relax%
3688 \ifx\th@mbdoublepage\thumbs@one\relax%
3689 \ifx\th@mb@resetdoublepage\thumbs@one\relax%
3690 \th@mbstablabeling%
3691 \fi%
3692 \else%
3693 \th@mbstablabeling%
3694 \fi%
3695 \fi%
3696 \null%
3697 \th@mbs@verview%
3698 \pagebreak%
3699 \ifthumbs@verbose%
3700 \message{THUMBS: Fileline: \number\value{FileLine}, a: \number\value{th@mblinea}, %
3701 b: \number\value{th@mblineb}, per page: \th@umbsperpage, max: \th@mbsmax.^^J}%
3702 \fi%
3703 % \end{macrocode}
3704 %
3705 % \noindent When double page mode is active and |\th@mb@resetdoublepage| is one,
3706 % the last page of the thumbs mark overview must be repeated, but\newline
3707 % | \@whilenum\value{FileLine}<\value{thumbsstop}\do|\newline
3708 % would prevent this, because |FileLine| is already too large
3709 % and would only be reset \emph{inside} the loop,
3710 % but the loop would not be executed again.
3711 % \pagebreak
3712 %
3713 % \begin{macrocode}
3714 \ifx\th@mb@resetdoublepage\thumbs@one\relax%
3715 \setcounter{FileLine}{\theth@mblinea}%
3716 \fi%
3717 }%
3718 % \end{macrocode}
3719 %
3720 % After the overview, the current thumb mark (if there is any) is restored,
3721 %
3722 % \begin{macrocode}
3723 \setlength{\th@mbposy}{\th@mbsposytocy}%
3724 \ifx\th@mbprintingovertoc\thumbs@one\relax%
3725 \continuethumb%
3726 \fi%
3727 % \end{macrocode}
3728 %
3729 % as well as the |\label|, |\index|, and |\glossary| commands:
3730 %
3731 % \begin{macrocode}
3732 \let\label\thumbsoriglabel%
3733 \let\index\thumbsorigindex%
3734 \let\glossary\thumbsorigglossary%
3735 % \end{macrocode}
3736 %
3737 % and |\th@mbs@toc@level| and |\th@mbs@toc@text| need to be emptied,
3738 % otherwise for each following Table of Thumb Marks/Edge Index the same entry
3739 % in the table of contents would be added, if no new
3740 % |\addthumbsoverviewtocontents| would be given.
3741 % (But when no |\addthumbsoverviewtocontents| is given, it can be assumed
3742 % that no |thumbsoverview|-entry shall be added to contents.)
3743 %
3744 % \begin{macrocode}
3745 \addthumbsoverviewtocontents{}{}%
3746 }
3747
3748 % \end{macrocode}
3749 % \end{macro}
3750 %
3751 % \begin{macro}{\th@mbs@verview}
3752 % \begin{macrocode}
3753 \newcommand{\th@mbs@verview}{%
3754 % \end{macrocode}
3755 % The internal command |\th@mbs@verview| reads a line from file |\jobname.tmb| and
3756 % executes the content of that line~-- if that line has not been processed yet,
3757 % in which case it is just ignored (see |\@unused|).
3758 %
3759 % Here was |\AddToHookNext{shipout/before}{\AtBeginShipoutUpperLeftForeground{...}}|.\newline
3760 % If it was |\AddToHook{shipout/before}{\AtBeginShipoutUpperLeftForeground{...}}|, it could be replaced by\newline
3761 % |\AddToHook{shipout/foreground}{...}|, but because of \textquotedblleft |Next|\textquotedblright\ it cannot.
3762 %
3763 % \begin{macrocode}
3764 \AddToHookNext{shipout/before}{%
3765 \@expl@@@shipout@add@foreground@picture@@n{%
3766 \IfFileExists{\jobname.tmb}{% then
3767 \ifthumbs@verbose%
3768 \message{^^JPackage thumbs Info: Processing line \number\value{th@mblinea} to \number\value{th@mblineb} of \jobname.tmb.^^J}%
3769 \fi%
3770 \setcounter{FileLine}{1}%
3771 \openin\@instreamthumb=\jobname.tmb%
3772 \@whilenum\value{FileLine}<\value{th@mblineb}\do%
3773 {\ifthumbs@verbose%
3774 \message{THUMBS: Processing \jobname.tmb line \number\value{FileLine}.}%
3775 \fi%
3776 \ifnum \value{FileLine}<\value{th@mblinea}\relax%
3777 \read\@instreamthumb to \@unused%
3778 \ifthumbs@verbose\message{Can be skipped.^^J}\fi%
3779 % NIRVANA: ignore the line by not executing it, i.e. not executing \@unused.
3780 % % \@unused
3781 \else%
3782 \ifnum \value{FileLine}=\value{th@mblinea}\relax%
3783 \read\@instreamthumb to \@thumbsout% execute the code of this line
3784 \ifthumbs@verbose%
3785 \message{Executing \jobname.tmb line \number\value{FileLine}.^^J}%
3786 \fi%
3787 \@thumbsout%
3788 \else%
3789 \ifnum \value{FileLine}>\value{th@mblinea}\relax%
3790 \read\@instreamthumb to \@thumbsout% execute the code of this line
3791 \ifthumbs@verbose%
3792 \message{Executing \jobname.tmb line \number\value{FileLine}.^^J}%
3793 \fi%
3794 \@thumbsout%
3795 \else% THIS SHOULD NEVER HAPPEN!
3796 \PackageError{thumbs}{Unexpected error! (Really!)}{%
3797 ! You are in trouble here.\MessageBreak%
3798 ! Type\space \space X \string<Return\string>\space to quit.\MessageBreak%
3799 ! Delete temporary auxiliary files\MessageBreak%
3800 ! (like \jobname.aux, \jobname.tmb, \jobname.out)\MessageBreak%
3801 ! and retry the compilation.\MessageBreak%
3802 ! If the error persists, cross your fingers\MessageBreak%
3803 ! and try typing\space \space \string<Return\string>\space to proceed.\MessageBreak%
3804 ! If that does not work,\MessageBreak%
3805 ! please contact the maintainer of the thumbs package.\MessageBreak%
3806 }%
3807 \fi%
3808 \fi%
3809 \fi%
3810 \stepcounter{FileLine}%
3811 }%
3812 \ifnum \value{FileLine}=\value{th@mblineb}\relax%
3813 \ifthumbs@verbose%
3814 \message{THUMBS: Processing \jobname.tmb line \number\value{FileLine}.}%
3815 \fi%
3816 \read\@instreamthumb to \@thumbsout% Execute the code of that line.
3817 \ifthumbs@verbose%
3818 \message{Executing \jobname.tmb line \number\value{FileLine}.^^J}%
3819 \fi%
3820 \@thumbsout%
3821 \stepcounter{FileLine}%
3822 \fi%
3823 \closein\@instreamthumb%
3824 % \end{macrocode}
3825 %
3826 % And on to the next overview page of thumb marks (if there are so many thumb marks):
3827 %
3828 % \begin{macrocode}
3829 \addtocounter{th@mblinea}{\th@umbsperpage}%
3830 \addtocounter{th@mblineb}{\th@umbsperpage}%
3831 \setcounter{Th@mbTmpA}{\th@mbsmax}%
3832 \ifnum\value{th@mblineb}>\c@Th@mbTmpA\relax%
3833 \setcounter{th@mblineb}{\c@Th@mbTmpA}%
3834 \fi%
3835 }{% else
3836 % \end{macrocode}
3837 %
3838 % When |\jobname.tmb| was not found, we cannot read from that file, therefore
3839 % the |FileLine| is set to |thumbsstop|, stopping the calling of |\th@mbs@verview|
3840 % in |\thumbsoverview|. (And we issue a warning, of course.)
3841 %
3842 % \begin{macrocode}
3843 \setcounter{FileLine}{\number\value{thumbsstop}}%
3844 \AddToHook{enddocument/info}[kernel/warnings]{%
3845 \PackageWarningNoLine{thumbs}{%
3846 File \jobname.tmb not found.\MessageBreak%
3847 Rerun to get thumbs overview page(s) right.%
3848 }%
3849 }%
3850 }%
3851 }%
3852 }%
3853 }
3854
3855 % \end{macrocode}
3856 % \end{macro}
3857 %
3858 % \begin{macro}{\thumborigaddthumb}
3859 % When we are in |draft| mode, the thumb marks are
3860 % \textquotedblleft de-coloured\textquotedblright{},
3861 % their width is reduced, and a warning is given.
3862 %
3863 % \begin{macrocode}
3864 \let\thumborigaddthumb\addthumb%
3865
3866 % \end{macrocode}
3867 % \end{macro}
3868 %
3869 % \begin{macrocode}
3870 \ifthumbs@draft
3871 \setlength{\th@mbwidthx}{2pt}
3872 \renewcommand{\addthumb}[4]{\thumborigaddthumb{#1}{#2}{black}{gray}}
3873 \PackageWarningNoLine{thumbs}{thumbs package in draft mode:\MessageBreak%
3874 Thumb mark width is set to 2pt,\MessageBreak%
3875 thumb mark text colour to black, and\MessageBreak%
3876 thumb mark background colour to gray.\MessageBreak%
3877 Use package option final to get the original values.\MessageBreak%
3878 }
3879 \fi
3880
3881 % \end{macrocode}
3882 %
3883 % When we are in |hidethumbs| mode, there are no thumb marks
3884 % and therefore neither any thumb mark overview page. A~warning is given.
3885 %
3886 % \begin{macrocode}
3887 \ifthumbs@hidethumbs
3888 \renewcommand{\addthumb}[4]{\relax}
3889 \PackageWarningNoLine{thumbs}{thumbs package in hide mode:\MessageBreak%
3890 Thumb marks are hidden.\MessageBreak%
3891 Set package option "hidethumbs=false" to get thumb marks%
3892 }
3893 \renewcommand{\thumbnewcolumn}{\relax}
3894 \fi
3895
3896 % \end{macrocode}
3897 %
3898 % \phantomsection\label{Labelpofffix}%
3899 % To determine whether to place the thumb marks at the left or right side of
3900 % a two{-}sided paper, \xpackage{thumbs} must determine whether the page number
3901 % is odd or even. Because |\thepage| can be set to some value, the |ThumbsPage|
3902 % counter is used instead. When the current page number is determined in hook
3903 % |{shipout/before}|, it is usually already the number of the next page to be put out.
3904 % But depending on loading of several packages and depending on the order they are loaded in,
3905 % it is not the next page number but the current one. In earlier versions of the
3906 % \xpackage{thumbs} package, it was checked which packages had been loaded in what order.
3907 % When it turned out that it depended on even more packages than those
3908 % checked for at that time, a~new procedure was introduced.
3909 % |\AtBeginDvi|, i.\,e.~when the first page is shipped out,
3910 % it is checked whether the |\c@ThumbsPage| current page number is odd
3911 % \hbox{(i.\,e. 1)} or even \hbox{(i.\,e. 2} or~0) and the corresponding
3912 % |\th@mbpofffix| is defined. For one{-}sided printing all pages are
3913 % right ones (respectively left ones for right-to-left writing).
3914 % Now the information about the necessary |\th@mbpofffix| is needed already earlier,
3915 % thus it is written to the \xfile{aux} file. At the next compilation of the document
3916 % the \xfile{aux} file will be read before beginning the first page,
3917 % thus the information will be available.
3918 %
3919 % \begin{macrocode}
3920 \AddToHook{begindocument}[start]{%
3921 \AtBeginDvi{%
3922 \if@twoside%
3923 \ifodd\c@ThumbsPage\relax%
3924 \xdef\th@mbpofffix{0}%
3925 \else%
3926 \xdef\th@mbpofffix{1}%
3927 \fi%
3928 \else%
3929 % \end{macrocode}
3930 %
3931 % For one sided printing all pages are right pages (for left-to-right writing),
3932 % therefore |\th@mbpofffix| does not even matter, but it needs to be defined anyway.
3933 %
3934 % \begin{macrocode}
3935 \xdef\th@mbpofffix{0}%
3936 \fi%
3937 % \end{macrocode}
3938 %
3939 % For right-to-left writing we need to put the marks on the other edge of the page:
3940 %
3941 % \begin{macrocode}
3942 \ifthumbs@righttoleft%
3943 \setcounter{Th@mbTmpA}{\numexpr\th@mbpofffix+1\relax}%
3944 \xdef\th@mbpofffix{\number\value{Th@mbTmpA}}%
3945 \fi%
3946 \if@filesw%
3947 \immediate\write\@auxout{\string\xdef\string\th@mbpofffix{\th@mbpofffix}}%
3948 \fi%
3949 }%
3950 }
3951 % \end{macrocode}
3952 % \begin{macrocode}
3953 %</package>
3954 % \end{macrocode}
3955 % \pagebreak
3956 %
3957 % \section{Installation}
3958 %
3959 % \subsection{Downloads\label{ss:Downloads}}
3960 % Everything is available at \url{https://www.ctan.org},
3961 % but may need additional packages themselves.\newline
3962 %
3963 % \DescribeMacro{thumbs.dtx}
3964 % For unpacking the |thumbs.dtx| file and constructing the documentation it is required:
3965 % \begin{description}
3966 % \item[-] \TeX Format \LaTeXe{}: \url{https://www.CTAN.org}
3967 %
3968 % \item[-] document class \xclass{ltxdoc}, 2024/02/08, v2.1j, Standard LaTeX documentation class,
3969 % \url{https://www.ctan.org/pkg/ltxdoc}
3970 %
3971 % \item[-] package \xpackage{geometry}, 2020/01/02, v5.9, Page Geometry,
3972 % \url{https://www.ctan.org/pkg/geometry}
3973 %
3974 % \item[-] package \xpackage{holtxdoc}, 2019/12/09, v0.30, Private additional ltxdoc support (HO),
3975 % \url{https://www.ctan.org/pkg/holtxdoc}
3976 % \end{description}
3977 %
3978 % \DescribeMacro{thumbs.sty}
3979 % The |thumbs.sty| for \LaTeXe{} (i.\,e.~each document using the \xpackage{thumbs} package) requires:
3980 % \begin{description}
3981 % \item[-] \TeX{} Format \LaTeXe{}, \url{https://www.CTAN.org}
3982 %
3983 % \item[-] package \xpackage{xcolor}, 2024/09/29, v3.02, LaTeX color extensions (UK),
3984 % \url{https://www.ctan.org/pkg/xcolor}
3985 %
3986 % \item[-] package \xpackage{picture}, 2020-04-22, v1.6, Dimens for picture macros (HO),
3987 % \url{https://www.ctan.org/pkg/picture}
3988 %
3989 % \item[-] package \xpackage{alphalph}, 2019/12/09, v2.6, Convert numbers to letters (HO),
3990 % \url{http://www.ctan.org/pkg/alphalph}
3991 %
3992 % \item[-] package \xpackage{rerunfilecheck}, 2025-06-21, v1.11, Rerun checks for auxiliary files (HO),
3993 % \url{https://www.ctan.org/pkg/rerunfilecheck}
3994 %
3995 % \item[-] package \xpackage{pagecolor}, 2025-01-28, v1.2d, Provides thepagecolor (HMM),
3996 % \url{https://www.ctan.org/pkg/pagecolor}
3997 %
3998 % \item[-] package \xpackage{undolabl}, 2025-01-28, v1.0o, Overriding labels (HMM),
3999 % \url{https://www.ctan.org/pkg/undolabl}
4000 % \end{description}
4001 %
4002 % \DescribeMacro{thumb-example.tex}
4003 % The |thumb-example.tex| requires the same file as all documents using the \xpackage{thumbs} package, i.\,e.
4004 % \begin{description}
4005 % \item[-] package \xpackage{thumbs}, 2026-01-18, v1.1d,
4006 % \url{https://www.ctan.org/pkg/thumbs}\newline
4007 % (Well, it is the example file for this package, and because you are reading the documentation for the
4008 % \xpackage{thumbs} package, it~can be assumed that you already have some version of it -- is it the current one?)
4009 % \end{description}
4010 % and additionally:
4011 % \begin{description}
4012 % \item[-] package \xpackage{eurosym}, 1998/08/06, v1.1, European currency symbol
4013 % \textquotedblleft Euro\textquotedblright, \url{https://www.ctan.org/pkg/eurosym}
4014 %
4015 % \item[-] package \xpackage{lipsum}, 2021-09-20, v2.7, 150~paragraphs of Lorem Ipsum dummy text,
4016 % \url{https://www.ctan.org/pkg/lipsum}
4017 %
4018 % \item[-] package \xpackage{hyperref}, 2025-07-12, v7.01o, Hypertext links for \LaTeX,
4019 % \url{https://www.ctan.org/pkg/hyperref}
4020 %
4021 % \item[-] package \xpackage{geometry}, 2020/01/02, v5.9, Page Geometry,
4022 % \url{https://www.ctan.org/pkg/geometry}
4023 % \end{description}
4024 % \pagebreak
4025 %
4026 % If the printing of unchanged layout on larger physical paper shall be tested, also the \xpackage{crop}\index{crop}
4027 % package is needed (or another package providing the same functions):
4028 % \begin{description}
4029 % \item[-] package \xpackage{crop}, 2017/11/19, v1.10, Crop marks (MF),
4030 % \url{https://www.ctan.org/pkg/crop}
4031 % \end{description}
4032 %
4033 % \DescribeMacro{Alternatives}
4034 % As possible alternatives in section~\ref{sec:Alternatives}, Alternatives, there are listed
4035 % (newer versions might be available):
4036 % \begin{description}
4037 % \item[-] package \xpackage{chapterthumb}, 2005/03/10, v0.1,\newline
4038 % \url{https://mirror.ctan.org/info/examples/KOMA-Script-3/Anhang-B/source/chapterthumb.sty}
4039 %
4040 % \item[-] package \xpackage{eso-pic}, 2023-05-03, v3.0c, \url{https://www.ctan.org/pkg/eso-pic}
4041 %
4042 % \item[-] package \xpackage{fancytabs}, 2016/03/29, v1.9, \url{https://www.ctan.org/pkg/fancytabs}
4043 %
4044 % \item[-] package \xpackage{thumb}, 2001, without file version, by \textsc{Ingo Klöckel},
4045 % which was available at\newline
4046 % ftp://ftp.dante.de/pub/tex/info/examples/ltt/thumb.sty.
4047 %
4048 % \item[-] package \xpackage{thumb} (a completely different one), 1997/12/24, v1.0,
4049 % \url{https://www.ctan.org/pkg/thumb}
4050 %
4051 % \item[-] package \xpackage{thumbindex}, 2009/12/13, without file version,
4052 % \url{https://hisashim.org/2009/12/13/thumbindex.html}
4053 %
4054 % \item[-] thumb-indexes, from the \xpackage{fancyhdr} package, available as source code
4055 % in the documentation of the \xpackage{fancyhdr} package,\newline
4056 % \url{https://ctan.org/pkg/fancyhdr}.
4057 %
4058 % \item[-] package \xpackage{thumbpdf}, 2018-09-07, v3.17, \url{https://www.ctan.org/pkg/thumbpdf}
4059 %
4060 % \item[-] package \xpackage{thumby}, 2010/01/14, v0.1, \url{https://www.ctan.org/pkg/thumby}
4061 % \end{description}
4062 %
4063 % \DescribeMacro{Münch}
4064 % A hyperlinked list of my (other) packages can be found at \url{https://www.ctan.org/author/muench-hm}.
4065 %
4066 % \subsection{Package, unpacking TDS}
4067 % \paragraph{Package.} This package is available on \url{https://www.CTAN.org}.
4068 % \begin{description}
4069 % \item[\url{https://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.dtx}]\hspace*{0.1cm} \newline
4070 % The source file.
4071 % \item[\url{https://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.pdf}]\hspace*{0.1cm} \newline
4072 % The documentation.
4073 % \item[\url{https://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs-example.pdf}]\hspace*{0.1cm} \newline
4074 % The compiled example file, as it should look like.
4075 % \item[\url{https://mirror.ctan.org/macros/latex/contrib/thumbs/README}]\hspace*{0.1cm} \newline
4076 % The README file.
4077 % \end{description}
4078 % There is also a |thumbs.tds.zip| available:
4079 % \begin{description}
4080 % \item[\url{https://mirror.ctan.org/install/macros/latex/contrib/thumbs.tds.zip}]\hspace*{0.1cm} \newline
4081 % Everything in TDS compliant, compiled format.
4082 % \end{description}
4083 % which additionally contains\newline
4084 % \begin{tabular}{ll}
4085 % thumbs.ins & The \texttt{ins}tallation file.\\
4086 % thumbs.drv & The \mbox{\texttt{dr}i\texttt{v}er} to generate the documentation.\\
4087 % thumbs.sty & The \texttt{sty}le file.\\
4088 % thumbs-example.tex & The example file.
4089 % \end{tabular}
4090 %
4091 % \bigskip
4092 %
4093 % \noindent For required other packages please see the preceding subsection.
4094 %
4095 % \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
4096 % \docstrip{} archive. The files are extracted by running the
4097 % \xext{dtx} through \plainTeX :
4098 % \begin{quote}
4099 % \verb|tex thumbs.dtx|
4100 % \end{quote}
4101 %
4102 % \noindent About generating the documentation see paragraph~\ref{GenDoc} below.\par
4103 %
4104 % \paragraph{TDS.} Now the different files must be moved into
4105 % the different directories in your installation TDS tree
4106 % (also known as \xfile{texmf} tree):
4107 % \begin{quote}
4108 % \def\t{^^A
4109 % \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
4110 % thumbs.sty & tex/latex/thumbs/thumbs.sty\\
4111 % thumbs.pdf & doc/latex/thumbs/thumbs.pdf\\
4112 % thumbs-example.tex & doc/latex/thumbs/thumbs-example.tex\\
4113 % thumbs-example.pdf & doc/latex/thumbs/thumbs-example.pdf\\
4114 % thumbs.dtx & source/latex/thumbs/thumbs.dtx\\
4115 % \end{tabular}^^A
4116 % }^^A
4117 % \sbox0{\t}^^A
4118 % \ifdim\wd0>\linewidth
4119 % \begingroup
4120 % \advance\linewidth by\leftmargin
4121 % \advance\linewidth by\rightmargin
4122 % \edef\x{\endgroup
4123 % \def\noexpand\lw{\the\linewidth}^^A
4124 % }\x
4125 % \def\lwbox{^^A
4126 % \leavevmode
4127 % \hbox to \linewidth{^^A
4128 % \kern-\leftmargin\relax
4129 % \hss
4130 % \usebox0
4131 % \hss
4132 % \kern-\rightmargin\relax
4133 % }^^A
4134 % }^^A
4135 % \ifdim\wd0>\lw
4136 % \sbox0{\small\t}^^A
4137 % \ifdim\wd0>\linewidth
4138 % \ifdim\wd0>\lw
4139 % \sbox0{\footnotesize\t}^^A
4140 % \ifdim\wd0>\linewidth
4141 % \ifdim\wd0>\lw
4142 % \sbox0{\scriptsize\t}^^A
4143 % \ifdim\wd0>\linewidth
4144 % \ifdim\wd0>\lw
4145 % \sbox0{\tiny\t}^^A
4146 % \ifdim\wd0>\linewidth
4147 % \lwbox
4148 % \else
4149 % \usebox0
4150 % \fi
4151 % \else
4152 % \lwbox
4153 % \fi
4154 % \else
4155 % \usebox0
4156 % \fi
4157 % \else
4158 % \lwbox
4159 % \fi
4160 % \else
4161 % \usebox0
4162 % \fi
4163 % \else
4164 % \lwbox
4165 % \fi
4166 % \else
4167 % \usebox0
4168 % \fi
4169 % \else
4170 % \lwbox
4171 % \fi
4172 % \else
4173 % \usebox0
4174 % \fi
4175 % \end{quote}
4176 % If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's
4177 % TDS installing feature, then some files can already be in the right
4178 % place, see the documentation of \docstrip.
4179 %
4180 % \subsection{Refresh file name databases}
4181 % If your \TeX~distribution (\TeX\,Live, \mikTeX, \dots) relies on
4182 % file name databases, you must refresh these. For example, \TeX\,Live\ users
4183 % run \verb|texhash| or \verb|mktexlsr|.
4184 %
4185 % \subsection{Some details for the interested}
4186 % \paragraph{Unpacking with \LaTeX.}
4187 % The \xfile{.dtx} chooses its action depending on the format:
4188 % \begin{description}
4189 % \item[\plainTeX:] Run \docstrip\ and extract the files.
4190 % \item[\LaTeX:] Generate the documentation.
4191 % \end{description}
4192 % If you insist on using \LaTeX\ for \docstrip\ (really,
4193 % \docstrip\ does not need \LaTeX ), then inform the autodetect routine
4194 % about your intention:
4195 % \begin{quote}
4196 % \verb|latex \let\install=y\input{thumbs.dtx}|
4197 % \end{quote}
4198 % Do not forget to quote the argument according to the demands
4199 % of your shell.
4200 %
4201 % \paragraph{Generating the documentation.\label{GenDoc}}
4202 % You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
4203 % the documentation. The process can be configured by a
4204 % configuration file \xfile{ltxdoc.cfg}. For instance, put the following
4205 % line into this file, if you want to have A4 as paper format:
4206 % \begin{quote}
4207 % \verb|\PassOptionsToClass{a4paper}{article}|
4208 % \end{quote}
4209 %
4210 % \noindent An example follows how to generate the
4211 % documentation with \pdfLaTeX :
4212 %
4213 % \begin{quote}
4214 %\begin{verbatim}
4215 %pdflatex thumbs.dtx
4216 %makeindex -s gind.ist thumbs.idx
4217 %pdflatex thumbs.dtx
4218 %makeindex -s gind.ist thumbs.idx
4219 %pdflatex thumbs.dtx
4220 %\end{verbatim}
4221 % \end{quote}
4222 %
4223 % \subsection{Compiling the example}
4224 %
4225 % The example file, \textsf{thumbs-example.tex}, can be compiled \hbox{e.\,g.} via\newline
4226 % \indent |pdflatex thumbs-example.tex|\newline
4227 % and will need probably at least four~(!) compiler runs to get everything right.
4228 %
4229 % \bigskip
4230 %
4231 % \section{Acknowledgements}
4232 %
4233 % I would like to thank \textsc{Heiko Oberdiek} for providing the \xpackage{hyperref} as well as a~lot~(!)
4234 % of other useful packages (from which I also got everything I know about creating a file in \xext{dtx} format,
4235 % OK, say it: copying), and everybody at \url{https://tex.stackexchange.com/} for their help in all things \TeX{}
4236 % (especially \textsc{David Carlisle} for \url{https://tex.stackexchange.com/a/45654},
4237 % although it is no longer used in this package).
4238 % Thanks for bug reports go to \textsc{Veronica Brandt}, \textsc{Martin Baute} (even two bug reports),
4239 % \textsc{Su Mei Goh}, \textsc{Michael Dorner}, \textsc{Yannick Mürtz}, and \textsc{Martin Friedrich }.
4240 % For the suggestion of new features I give thanks to \textsc{Martin Baute}, \textsc{Stephanie Hein},
4241 % \textsc{Bjorn Victor}, \textsc{Heini Geiring}, \textsc{bplasa}, and \textsc{Su Mei Goh}.\newpage
4242 %
4243 % \phantomsection
4244 % \begin{History}\label{History}
4245 % \begin{Version}{2010/04/01 v0.01 -- 2011/05/13 v0.46}
4246 % \item Diverse $\beta $-versions during the creation of this package.
4247 % \end{Version}
4248 % \begin{Version}{2011/05/14 v1.0a}
4249 % \item Upload to \url{https://www.ctan.org/pkg/thumbs}.
4250 % \end{Version}
4251 % \begin{Version}{2011/05/18 v1.0b}
4252 % \item When more than one thumb mark is places at one single page,
4253 % the variables containing the values (text, colour, backgroundcolour)
4254 % of those thumb marks are now created dynamically. Theoretically,
4255 % one can now have $2\,147\,483\,647$ thumb marks at one page instead of
4256 % six thumb marks (as with \xpackage{thumbs} version~1.0a),
4257 % but I am quite sure that some other limit will be reached before the
4258 % $2\,147\,483\,647\textsuperscript{th}$ thumb mark.
4259 % \item Bug fix: When a document using the \xpackage{thumbs} package was compiled,
4260 % and the \xfile{.aux} and \xfile{.tmb} files were created, and the
4261 % \xfile{.tmb} file was deleted (or renamed or moved),
4262 % while the \xfile{.aux} file was not deleted (or renamed or moved),
4263 % and the document was compiled again, and the \xfile{.aux} file was
4264 % reused, then reading from the then empty \xfile{.tmb} file resulted
4265 % in an endless loop. Fixed.
4266 % \end{Version}
4267 % \begin{Version}{2011/05/20 v1.0c}
4268 % \item The thumb mark width is written to the \xfile{log} file (in |verbose| mode
4269 % only). The knowledge of the value could be helpful for the user,
4270 % when option |width={auto}| was used, and one wants the thumb marks to be
4271 % half as big, or with double width, or a little wider, or a little
4272 % smaller\ldots\ Also thumb marks' height, top thumb margin and bottom thumb
4273 % margin are given. Look for\newline
4274 % |************** THUMB dimensions **************|\newline
4275 % in the \xfile{log} file.
4276 % \item Bug fix: There was a\newline
4277 % | \advance\th@mbheighty-\th@mbsdistance|,\newline
4278 % where\newline
4279 % | \advance\th@mbheighty-\th@mbsdistance|\newline
4280 % | \advance\th@mbheighty-\th@mbsdistance|\newline
4281 % should have been, causing wrong thumb marks' height, thereby wrong number
4282 % of thumb marks per column, and thereby another endless loop. Fixed.
4283 % \item The \xpackage{ifthen} package is no longer required for the \xpackage{thumbs}
4284 % package, removed from its |\RequirePackage| entries.
4285 % \item The \xpackage{infwarerr} package is used for its |\@PackageInfoNoLine| command.
4286 % \item The \xpackage{warning} package is no longer used by the \xpackage{thumbs}
4287 % package, removed from its |\RequirePackage| entries. Instead,
4288 % the \xpackage{atveryend} package is used, because it is loaded anyway
4289 % when the \xpackage{hyperref} package is used.
4290 % \end{Version}
4291 % \begin{Version}{2011/05/26 v1.0d}
4292 % \item Bug fix: labels or index or glossary entries were gobbled for the thumb marks
4293 % overview page, but gobbling leaked to the rest of the document; fixed.
4294 % \item New option |silent|, complementary to old option |verbose|.
4295 % \item New option |draft| (and complementary option |final|), which
4296 % \textquotedblleft de-coloures\textquotedblright{} the thumb marks
4297 % and reduces their width \hbox{to $2\unit{pt}$.}
4298 % \end{Version}
4299 % \begin{Version}{2011/06/02 v1.0e}
4300 % \item Gobbling of labels or index or glossary entries improved.
4301 % \item Dimension |\thumbsinfodimen| no longer needed, removed.
4302 % \item Internal command |\thumbs@info| no longer needed, removed.
4303 % \item New value |autoauto| (not default!) for option |width|, setting the thumb marks
4304 % width to fit the widest thumb mark text.
4305 % \item When |width={autoauto}| is not used, a warning is issued, when the thumb marks
4306 % width is smaller than the thumb mark text.
4307 % \item Bug fix: Since version v1.0b as of 2011/05/18 the number of thumb marks at one
4308 % single page was no longer limited to six, but the example still stated this.
4309 % Fixed.
4310 % \end{Version}
4311 % \begin{Version}{2011/06/08 v1.0f}
4312 % \item Bug fix: |\th@mb@titlelabel| should be defined |\empty| at the beginning
4313 % of the package: fixed. (Bug reported by \textsc{Veronica Brandt}. Thanks!)
4314 % \item Bug fix: |\thumbs@distance| versus |\th@mbsdistance|: There should be only
4315 % two times |\thumbs@distance|, the value of option |distance|,
4316 % otherwise it should be the length |\th@mbsdistance|: fixed.
4317 % (Also this bug reported by \textsc{Veronica Brandt}. Thanks!)
4318 % \item |\hoffset| and |\voffset| are now ignored by default,
4319 % but can be regarded using the options |ignorehoffset=false|
4320 % and |ignorevoffset=false|.
4321 % (Pointed out again by \textsc{Veronica Brandt}. Thanks!)
4322 % \item Added to documentation: The package takes the dimensions |\AtBeginDocument|
4323 % [now: \AddToHook{begindocument}[start]],
4324 % thus later the page dimensions should not be changed.
4325 % Now explicitly stated this in the documentation.
4326 % |\paperwidth| changes are probably possible.
4327 % \end{Version}
4328 % \begin{Version}{2011/06/24 v1.0g}
4329 % \item Bug fix: When \xpackage{hyperref} was \textit{not} used,
4330 % then some labels were not set at all~-- fixed.
4331 % \item Bug fix: When more than one Table of Tumbs (edge indices) were created
4332 % with the |\thumbsoverview| command, there were some
4333 % |counter ... already defined|-errors~-- fixed.
4334 % \item Bug fix: When more than one Table of Tumbs were created with the
4335 % |\thumbsoverview| command, there was a
4336 % |Label TableofTumbs multiply defined|-error and it was not possible
4337 % to refer to any but the last Table of Tumbs. Fixed with labels
4338 % |TableofTumbs1|, |TableofTumbs2|,\ldots{} (|TableofTumbs| still aims
4339 % at the last used Table of Thumbs for compatibility.)
4340 % \item Bug fix: Sometimes the thumb marks were stopped one page too early
4341 % before the Table of Thumbs~-- fixed.
4342 % \end{Version}
4343 % \begin{Version}{2011/08/08 v1.0h}
4344 % \item Replaced |\global\edef| by |\xdef|.
4345 % \item Now using the \xpackage{pagecolor} package. Empty thumb marks now
4346 % inherit their colour from the pages's background. Option |pagecolor|
4347 % is therefore obsolete.
4348 % \item The \xpackage{pagesLTS} package has been replaced by the
4349 % \xpackage{pageslts} package.
4350 % \item New kinds of thumb mark overview pages introduced additionally to
4351 % |\thumbsoverview|: |\thumbsoverviewback|, |\thumbsoverviewverso|,
4352 % and |\thumbsoverviewdouble|.
4353 % \item New option |hidethumbs=true| to hide thumb marks (and their
4354 % overview page(s)).
4355 % \item Option |ignorehoffset| did not work for the thumb marks overview page(s)~--
4356 % neither |true| nor |false|; fixed.
4357 % \end{Version}
4358 % \begin{Version}{2011/08/22 v1.0i}
4359 % \item Hot fix: \TeX{} 2011/06/27 has changed |\enddocument| and
4360 % thus broken the |\AtVeryVeryEnd| command/hooking
4361 % of \xpackage{atveryend} package as of 2011/04/23, v1.7.
4362 % Version 2011/06/30, v1.8, fixed it, but this version was not available
4363 % at \url{CTAN.org} yet. Until then |\AtEndAfterFileList| was used.
4364 % \end{Version}
4365 % \begin{Version}{2011/10/19 v1.0j}
4366 % \item Changed some Warnings into Infos (as suggested by \textsc{Martin Baute}).
4367 % \item The SW(P)-warning is now only given |\IfFileExists{tcilatex.tex}|,
4368 % otherwise just a message is given. (Warning questioned by
4369 % \textsc{Martin Baute}.)
4370 % \item New option |nophantomsection| to \emph{globally} disable the automatic
4371 % placement of a |\phantomsection| before \emph{all} thumb marks.
4372 % \item New command |\thumbsnophantom| to \emph{locally} disable the automatic
4373 % placement of a |\phantomsection| before the \emph{next} thumb mark.
4374 % \end{Version}
4375 % \begin{Version}{2012/01/01 v1.0k}
4376 % \item Bugfix: Wrong installation path given in the documentation, fixed.
4377 % \item No longer uses the |th@mbs@tmpA| counter but uses |\@tempcnta| instead.
4378 % \item No longer abuses the |\th@mbposyA| dimension but |\@tempdima|.
4379 % \end{Version}
4380 % \begin{Version}{2012/01/07 v1.0l}
4381 % \item Bugfix: Used a |\@tempcnta| where a |\@tempdima| should have been.
4382 % \end{Version}
4383 % \begin{Version}{2012/02/23 v1.0m}
4384 % \item Bugfix: Replaced |\newcommand{\QTO}[2]{#2}| (for SWP) by
4385 % |\providecommand{\QTO}[2]{#2}|.
4386 % \item Bugfix: When the \xpackage{tikz} package was loaded before \xpackage{thumbs},
4387 % in |twoside|-mode the thumb marks were printed at the wrong side
4388 % of the page. (Bug reported by \textsc{Martin Baute}.) With
4389 % \xpackage{hyperref} it really depends on the loading order of the
4390 % three packages.
4391 % \item Now using |\ltx@ifpackageloaded| from the \xpackage{ltxcmds} package
4392 % to check (after |\begin{document}|) whether the \xpackage{hyperref}
4393 % package was loaded.
4394 % \item For the thumb marks |\parbox|es instead of |\makebox|es are used
4395 % (just in case somebody wants to place two lines into a thumb mark, e.\,g.\newline
4396 % |Sch |\newline
4397 % |St|\newline
4398 % in a phone book, where the other |S|es are placed in another chapter).
4399 % \end{Version}
4400 % \begin{Version}{2012/02/25 v1.0n}
4401 % \item Check for loading order of \xpackage{tikz} and \xpackage{hyperref} replaced
4402 % by robust method. (Thanks to \textsc{David Carlisle},
4403 % \url{https://tex.stackexchange.com/a/45654}!)\newline
4404 % (This was replaced in version 1.0r by a completely different method,
4405 % which does not test for the loading order of packages but for the
4406 % page number directly.)
4407 % \item Fixed \texttt{url}-handling in the example in case the \xpackage{hyperref}
4408 % package was not loaded.
4409 % \item In the index the line-numbers of definitions were not underlined; fixed.
4410 % \item In the \xfile{thumbs-example} there are now a few words about
4411 % \textquotedblleft paragraph-thumbs\textquotedblright{} %
4412 % (i.\,e.~text which is too long for the width of a thumb mark).
4413 % \end{Version}
4414 % \begin{Version}{2013/08/22 v1.0o}
4415 % \item \textit{This version was not released to the general public!}
4416 % \item \textsc{Stephanie Hein} requested the feature to be able to increase
4417 % the horizontal space between page edge and the text inside of the
4418 % thumb mark. Therefore options |evenindent| and |oddexdent| were
4419 % implemented (later renamed to |eventxtindent| and |oddtxtexdent|).
4420 % \item \textsc{Bjorn Victor} reported the same problem and also the one,
4421 % that two marks are not printed at the exact same vertical position
4422 % on recto and verso pages. Because this can be seen with a lot of
4423 % duplex printers, the new option |evenprintvoffset| allows to
4424 % vertically shift the marks on even pages by any length.
4425 % \end{Version}
4426 % \begin{Version}{2013/09/17 v1.0p}
4427 % \item \textit{This version was not released to the general public!}
4428 % \item The thumb mark text is now set in |\parbox|es everywhere.
4429 % \item \textsc{Heini Geiring} requested the feature to be able to
4430 % horizontally move the marks away from the page edge,
4431 % because this is useful when using brochure printing
4432 % where after the printing the physical page edge is changed
4433 % by cutting the paper. Therefore the options |evenmarkindent| and
4434 % |oddmarkexdent| were introduced and the options |evenindent| and
4435 % |oddexdent| were renamed to |eventxtindent| and |oddtxtexdent|.
4436 % \end{Version}
4437 % \begin{Version}{2014/03/09 v1.0q}
4438 % \item New version of the \xpackage{atveryend} package is now available at
4439 % \url{CTAN.org} (see entry in this history for
4440 % \xpackage{thumbs} version |[2011/08/22 v1.0i]|).
4441 % \item Support for SW(P) drastically reduced; no more testing is performed.
4442 % \item New option |txtcentered|: If it is set to |true|,
4443 % the thumb's text is centered, otherwise either |\raggedright| or
4444 % |\raggedleft| (depending on left or right page for double sided documents).
4445 % \item |\normalsize| added to prevent \textquotedblleft font size
4446 % leakage\textquotedblright{} from the respective page.
4447 % \item Handling of obsolete options (mainly from version 2013/08/22 v1.0o)
4448 % added.
4449 % \item This version has been archived at
4450 % \url{https://web.archive.org/web/20250808184843/https://ctan.math.illinois.edu/install/macros/latex/contrib/thumbs.tds.zip}.
4451 % \end{Version}
4452 % \begin{Version}{2015/05/25 v1.0r}
4453 % \item \textit{This version was, by mistake, not released to the general public!}
4454 % \item Replaced code suggestion for possible compatibility with SW(P)
4455 % by simple warning of possible incompatibility.
4456 % \item \textsc{bplasa} requested the possibility to remove the coloured rules
4457 % behind the entries on the overview pages and to print the text there
4458 % in the current colour (usually black). For this the option
4459 % |plainthumbsoverview| (|false| by default, but |true| if used)
4460 % was introduced (and a spuriouse |+20pt| removed).
4461 % (see \hbox{p. \pageref{sss:plainthumbsoverview})}
4462 % \item \textsc{Bjorn Victor} suggested to use thumb marks consisting only of frames
4463 % instead of filled rectangles. Options |frame| and |frameinnercolor| were
4464 % introduced to accomplish this. (see \hbox{p. \pageref{sss:frame})}
4465 % \item \textsc{Su Mei Goh} requested the feature to be able to change the colour
4466 % of a thumb mark (text and background). Explanation added to the documentation
4467 % and included in the example. Not requested but also explained is now
4468 % the possibility to change the thumb mark text.
4469 % (see \hbox{p. \pageref{ss:VariableThumb})}
4470 % \item Bugfix: One temporary counter for two different things screwed things up;
4471 % fixed and replaced the two temporary counters by two \hbox{|\newcounter|s.}
4472 % \item Bugfix: \textsc{Su Mei Goh} reported this bug: the order, in which the packages
4473 % \xpackage{atbegshi} and \xpackage{pageslts} were loaded, could have caused
4474 % thumb marks to be placed at the wrong edge of a page (details on
4475 % \hbox{p. \pageref{Labelpofffix}).} Fixed this by replacing the detection,
4476 % which packages had been loaded and in what order, by checking
4477 % |\c@CurrentPage| |\AtBeginShipoutFirst|.
4478 % \item Bugfix: In the thumb marks overview page (edge index) on right pages
4479 % the rules started immediately at the text. Now they start $1\unit{em}$
4480 % \emph{before} the text.
4481 % \item Bugfix: |\MakeUppercase| missed \hbox{\textquotedblleft |{|\textquotedblright} and
4482 % \hbox{\textquotedblleft |}|\textquotedblright ;} fixed.
4483 % \item Bug circumvention: In the thumb marks overview page (edge index) on left pages
4484 % the rules sometimes end a bit too early. While I did not determine yet
4485 % why they are behaving like this, option |leftindexruleplus| allows to add
4486 % e.\,g.~|\evensidemargin| (or~$20\unit{pt}$ or another length) to the
4487 % rules (see \hbox{p. \pageref{sss:leftindexruleplus}).}
4488 % \item Bugfix: Option |txtcentered| was broken; fixed.
4489 % \item Bugfix: Some |\voffset| were off; fixed.
4490 % \item Blank entries on the overview pages now use |\phantom| instead of |\thepagecolor|,
4491 % thus overwriting of e.\,g.~a~page number or other footer material is prevented.
4492 % \item Explanation about thumb index and edge index added to the introduction
4493 % \mbox{(p. \pageref{s:Introduction}).}
4494 % \item Explanations about \xpackage{crop} package added (for example at p.~\pageref{ss:crop}).
4495 % \end{Version}
4496 % \begin{Version}{2025-08-01 v1.1a}
4497 % \item \textit{This version was intentionally not released to the general public!}
4498 % \item Requires \TeX-Format \LaTeX2e\ 2025-06-01.
4499 % \item Removed code related to now obsolete SW(P).
4500 % \item |\AtBeginShipoutUpperLeft| needed to be replaced by |\AtBeginShipoutUpperLeftForeground|
4501 % (and that by |\@expl@@@shipout@add@foreground@picture@@n|) to work with new versions
4502 % of \xpackage{crop} package and kernel.
4503 % \item Updated to current kernel and packages; now using hooks where available.
4504 % \item Package \xpackage{morefloats}, \url{https://www.ctan.org/pkg/morefloats}, is no longer used.
4505 % \item Package \xpackage{hypdoc}, \url{https://www.ctan.org/pkg/hypdoc}, is no longer used.
4506 % \item Package \xpackage{atbegshi}, \url{https://www.ctan.org/pkg/atbegshi}, is no longer used.
4507 % \item Package \xpackage{atveryend}, \url{https://www.ctan.org/pkg/atveryend}, is no longer used.
4508 % \item Package \xpackage{infwarerr}, \url{https://www.ctan.org/pkg/infwarerr}, is no longer used
4509 % but \xpackage{hyperref} does use it anyway.
4510 % \item Package \xpackage{ltxcmds}, \url{https://www.ctan.org/pkg/ltxcmds}, is no longer used.
4511 % but current \xpackage{hyperref} does use it anyway.
4512 % \end{Version}
4513 % \begin{Version}{2025-08-11 v1.1b}
4514 % \item \textit{This version was intentionally not released to the general public!}
4515 % \item New option |righttoleft| for documents using right-to-left writing,
4516 % placing the thumb marks at the opposite edge of the page. The \xpackage{thumbs} package now
4517 % should be compatible with \xpackage{polyglossia} and |Arabic| (and \XeLaTeX ).
4518 % \item Package \xpackage{pageslts}, \url{https://www.ctan.org/pkg/pageslts}, is no longer required
4519 % and therefore not loaded by \xpackage{thumbs} -- if wanted,
4520 % load it explicitedly in your document!
4521 % \item Changed (hopefully improved) really a lot of details in the code.
4522 % \item Updates to really a lot of details in the documentation (manual \& README).
4523 % \end{Version}
4524 % \begin{Version}{2025-12-04 v1.1c}
4525 % \item Minimal change in output to \xfile{log}.
4526 % \item Finally uploaded to CTAN.
4527 % \end{Version}
4528 % \begin{Version}{2026-01-18 v1.1d}
4529 % \item Package \xpackage{kvoptions}, \url{https://www.ctan.org/pkg/kvoptions}, is no longer used
4530 % but the required \xpackage{rerunfilecheck} package loads it.
4531 % \item Provided alt-text for the used |picture|-environments for compatibility with tagging.
4532 % \item Cleaned up the index in the documentation.
4533 % \end{Version}
4534 % \end{History}
4535 %
4536 % When you find a mistake or have a suggestion for an improvement of this package,
4537 % please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.)
4538 % \PrintIndex
4539 % \Finale
4540 \endinput