summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/thumbs
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/thumbs
Initial commit
Diffstat (limited to 'macros/latex/contrib/thumbs')
-rw-r--r--macros/latex/contrib/thumbs/README168
-rw-r--r--macros/latex/contrib/thumbs/thumbs-example.pdfbin0 -> 184988 bytes
-rw-r--r--macros/latex/contrib/thumbs/thumbs.dtx4106
-rw-r--r--macros/latex/contrib/thumbs/thumbs.pdfbin0 -> 531804 bytes
4 files changed, 4274 insertions, 0 deletions
diff --git a/macros/latex/contrib/thumbs/README b/macros/latex/contrib/thumbs/README
new file mode 100644
index 0000000000..e2bfce1c25
--- /dev/null
+++ b/macros/latex/contrib/thumbs/README
@@ -0,0 +1,168 @@
+README for thumbs package, 2014/03/09, v1.0q
+
+
+TABLE OF CONTENTS
+=================
+
+1 Introduction
+2 Download
+3 Installation
+4 Additional Packages
+5 Package Compatibility
+6 Author/Maintainer
+7 Bug Reports
+8 Known Problems
+
+
+1 INTRODUCTION
+==============
+
+This LaTeX package puts running, customizable thumb marks
+in the outer margin, moving downward as the chapter number
+(or whatever shall be marked by the thumb marks) increases.
+Additionally an overview page/table of thumb marks can be
+added automatically, which gives the respective names of the
+thumbed objects, the page where the object/thumb mark first
+appears, and the thumb mark itself at the respective
+position. The thumb marks are probably useful for documents,
+where a quick and easy way to find e.g. a chapter is needed,
+for example in reference guides, anthologies, or quite
+large documents. This material is subject to
+the LaTeX Project Public License (LPPL1.3).
+See http://www.ctan.org/license/lppl1.3 for the details.
+
+
+2 DOWNLOAD
+==========
+
+`thumbs' is available on CTAN:
+http://www.ctan.org/pkg/thumbs
+
+Running
+tex thumbs.dtx
+generates the files
+thumbs.ins, thumbs.drv, thumbs.sty,
+and thumbs-example.tex.
+
+Also a ZIP file is provided that contains these files,
+the manual (thumbs.pdf), the compiled example
+(thumbs-example.pdf), and this README, already
+sorted in a TDS tree:
+http://mirrors.ctan.org/install/macros/latex/
+contrib/thumbs.tds.zip
+
+
+3 INSTALLATION
+==============
+
+Installation with ZIP file in TDS format
+----------------------------------------
+The ZIP file `thumbs.tds.zip' contains the files
+sorted in a TDS tree. Thus you can directly unpack the
+ZIP file inside a TDS tree.
+See http://www.ctan.org/TDS-guidelines for an explanation
+of TDS.
+Example:
+ cd /...somewhere.../texmf
+ unzip /...downloadpath.../thumbs.tds.zip
+Do not forget to refresh the file name database of this
+TDS tree.
+Example:
+ texhash /...somewhere.../texmf
+
+Manual installation
+-------------------
+a) Download the thumbs files from CTAN.
+ If necessary, unpack them.
+b) Generate the package and driver files:
+ tex thumbs.dtx
+c) Install the file `*.sty' in your TDS tree:
+ cp *.sty TDS:tex/latex/thumbs/
+ Replace `TDS:' by the prefix of your TDS tree
+ (texmf directory).
+d) Create the documentation (if necessary), e.g.
+ pdflatex thumbs.dtx
+ makeindex -s gind.ist thumbs.idx
+ pdflatex thumbs.dtx
+ makeindex -s gind.ist thumbs.idx
+ pdflatex thumbs.dtx
+e) Update the databases if necessary, e.g. for teTeX:
+ mktexlsr .../texmf
+f) Create the thumbs-example.pdf (if necessary), e.g.
+ pdflatex thumbs-example.tex
+ pdflatex thumbs-example.tex
+ pdflatex thumbs-example.tex
+ pdflatex thumbs-example.tex
+g) Copy the documentation files to
+ "TDS:doc/latex/thumbs/":
+ README, thumbs.pdf, thumbs-example.tex,
+ thumbs-example.pdf.
+
+
+4 ADDITIONAL PACKAGES
+=====================
+
+Depending on the driver and option settings, thumbs loads
+other packages:
+kvoptions, atbegshi, xcolor, picture, alphalph, pageslts,
+pagecolor, rerunfilecheck, infwarerr, ltxcmds, and
+atveryend, which again load other packages
+(see the result of the \listfiles command in the log-file
+ of the example).
+
+
+5 PACKAGE COMPATIBILITY
+=======================
+
+thumbs should be loaded AFTER the required packages,
+but loding it before those packages should be possible, too.
+Thumbs MUST be loaded AFTER packages handling the page size,
+for example geometry.
+
+
+6 AUTHOR/MAINTAINER
+=====================
+
+* H.-Martin Münch
+
+
+7 BUG REPORTS
+==============
+
+A bug report should contain:
+* Comprehensive problem description. This includes error or
+ warning messages.
+* \errorcontextlines=\maxdimen can be added in the
+ TeX code to get more information in TeX error messages.
+* Minimal test file that shows the problem, but does not
+ contain any unnecessary packages and code.
+* Used drivers/programs.
+* Version information about used packages and programs.
+* If you are using LaTeX, then add "\listfiles". Then
+ a list of version information is printed at the end
+ of the LaTeX run.
+* Please no other files than the minimal test file.
+ The other files .log, .dvi, .ps, .pdf are seldom
+ necessary, so send them only on request.
+* Please .zip or .tar.gz your file(s) before sending them!
+
+Bug address
+-----------
+Bug reports can be send to the maintainer:
+ H.-Martin Münch
+ <Martin [dot] Muench [at] Uni-Bonn [dot] de>
+
+
+8 KNOWN PROBLEMS
+=================
+
+* When the text for a thumb mark is too wide,
+the text is either split over two lines or is written over
+the border of the thumb mark. When the text is too wide for
+the thumb mark and cannot be split, LaTeX might nevertheless
+place the text into the next line. By this the text is
+placed too low. Please see the example file for information
+about possible solutions.
+
+* Right-to-left-writing with Polyglossary is probably
+not compatible with thumbs.
diff --git a/macros/latex/contrib/thumbs/thumbs-example.pdf b/macros/latex/contrib/thumbs/thumbs-example.pdf
new file mode 100644
index 0000000000..2ec329741f
--- /dev/null
+++ b/macros/latex/contrib/thumbs/thumbs-example.pdf
Binary files differ
diff --git a/macros/latex/contrib/thumbs/thumbs.dtx b/macros/latex/contrib/thumbs/thumbs.dtx
new file mode 100644
index 0000000000..3039f0d310
--- /dev/null
+++ b/macros/latex/contrib/thumbs/thumbs.dtx
@@ -0,0 +1,4106 @@
+% \iffalse meta-comment
+%
+% File: thumbs.dtx
+% Version: 2014/03/09 v1.0q
+%
+% Copyright (C) 2010 - 2014 by
+% H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either
+% version 1.3c of this license or (at your option) any later
+% version. See http://www.ctan.org/license/lppl1.3 for the details.
+%
+% This work has the LPPL maintenance status "maintained".
+% The Current Maintainer of this work is H.-Martin Muench.
+%
+% This work consists of the main source file thumbs.dtx,
+% the README, and the derived files
+% thumbs.sty, thumbs.pdf,
+% thumbs.ins, thumbs.drv,
+% thumbs-example.tex, thumbs-example.pdf.
+%
+% Distribution:
+% http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.dtx
+% http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.pdf
+% http://mirror.ctan.org/install/macros/latex/contrib/thumbs.tds.zip
+%
+% see http://www.ctan.org/pkg/thumbs (catalogue)
+%
+% Unpacking:
+% (a) If thumbs.ins is present:
+% tex thumbs.ins
+% (b) Without thumbs.ins:
+% tex thumbs.dtx
+% (c) If you insist on using LaTeX
+% latex \let\install=y\input{thumbs.dtx}
+% (quote the arguments according to the demands of your shell)
+%
+% Documentation:
+% (a) If thumbs.drv is present:
+% (pdf)latex thumbs.drv
+% makeindex -s gind.ist thumbs.idx
+% (pdf)latex thumbs.drv
+% makeindex -s gind.ist thumbs.idx
+% (pdf)latex thumbs.drv
+% (b) Without thumbs.drv:
+% (pdf)latex thumbs.dtx
+% makeindex -s gind.ist thumbs.idx
+% (pdf)latex thumbs.dtx
+% makeindex -s gind.ist thumbs.idx
+% (pdf)latex thumbs.dtx
+%
+% The class ltxdoc loads the configuration file ltxdoc.cfg
+% if available. Here you can specify further options, e.g.
+% use DIN A4 as paper format:
+% \PassOptionsToClass{a4paper}{article}
+%
+% Installation:
+% TDS:tex/latex/thumbs/thumbs.sty
+% TDS:doc/latex/thumbs/thumbs.pdf
+% TDS:doc/latex/thumbs/thumbs-example.tex
+% TDS:doc/latex/thumbs/thumbs-example.pdf
+% TDS:source/latex/thumbs/thumbs.dtx
+%
+%<*ignore>
+\begingroup
+ \catcode123=1 %
+ \catcode125=2 %
+ \def\x{LaTeX2e}%
+\expandafter\endgroup
+\ifcase 0\ifx\install y1\fi\expandafter
+ \ifx\csname processbatchFile\endcsname\relax\else1\fi
+ \ifx\fmtname\x\else 1\fi\relax
+\else\csname fi\endcsname
+%</ignore>
+%<*install>
+\input docstrip.tex
+\Msg{**************************************************************************}
+\Msg{* Installation *}
+\Msg{* Package: thumbs 2014/03/09 v1.0q Thumb marks and overview page(s) (HMM)*}
+\Msg{**************************************************************************}
+
+\keepsilent
+\askforoverwritefalse
+
+\let\MetaPrefix\relax
+\preamble
+
+This is a generated file.
+
+Project: thumbs
+Version: 2014/03/09 v1.0q
+
+Copyright (C) 2010 - 2014 by
+ H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
+
+The usual disclaimer applies:
+If it doesn't work right that's your problem.
+(Nevertheless, send an e-mail to the maintainer
+ when you find an error in this package.)
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either
+version 1.3c of this license or (at your option) any later
+version. This version of this license is in
+ http://www.latex-project.org/lppl/lppl-1-3c.txt
+and the latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+and version 1.3c or later is part of all distributions of
+LaTeX version 2005/12/01 or later.
+
+This work has the LPPL maintenance status "maintained".
+
+The Current Maintainer of this work is H.-Martin Muench.
+
+This work consists of the main source file thumbs.dtx,
+the README, and the derived files
+ thumbs.sty, thumbs.pdf,
+ thumbs.ins, thumbs.drv,
+ thumbs-example.tex, thumbs-example.pdf.
+
+In memoriam Tommy Muench + 2014/01/02.
+
+\endpreamble
+\let\MetaPrefix\DoubleperCent
+
+\generate{%
+ \file{thumbs.ins}{\from{thumbs.dtx}{install}}%
+ \file{thumbs.drv}{\from{thumbs.dtx}{driver}}%
+ \usedir{tex/latex/thumbs}%
+ \file{thumbs.sty}{\from{thumbs.dtx}{package}}%
+ \usedir{doc/latex/thumbs}%
+ \file{thumbs-example.tex}{\from{thumbs.dtx}{example}}%
+}
+
+\catcode32=13\relax% active space
+\let =\space%
+\Msg{************************************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* file into a directory searched by TeX:}
+\Msg{*}
+\Msg{* thumbs.sty}
+\Msg{*}
+\Msg{* To produce the documentation run the file `thumbs.drv'}
+\Msg{* through (pdf)LaTeX, e.g.}
+\Msg{* pdflatex thumbs.drv}
+\Msg{* makeindex -s gind.ist thumbs.idx}
+\Msg{* pdflatex thumbs.drv}
+\Msg{* makeindex -s gind.ist thumbs.idx}
+\Msg{* pdflatex thumbs.drv}
+\Msg{*}
+\Msg{* At least three runs are necessary e.g. to get the}
+\Msg{* references right!}
+\Msg{*}
+\Msg{* Happy TeXing!}
+\Msg{*}
+\Msg{************************************************************************}
+
+\endbatchfile
+%</install>
+%<*ignore>
+\fi
+%</ignore>
+%
+% \section{The documentation driver file}
+%
+% The next bit of code contains the documentation driver file for
+% \TeX{}, i.\,e., the file that will produce the documentation you
+% are currently reading. It will be extracted from this file by the
+% \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip}
+% and specify the \texttt{driver} option when \texttt{docstrip}
+% asks for options.
+%
+% \begin{macrocode}
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}[2011/06/27]
+\ProvidesFile{thumbs.drv}%
+ [2014/03/09 v1.0q Thumb marks and overview page(s) (HMM)]
+\documentclass[landscape]{ltxdoc}[2007/11/11]% v2.0u
+\usepackage[maxfloats=20]{morefloats}[2012/01/28]% v1.0f
+\usepackage{geometry}[2010/09/12]% v5.6
+\usepackage{holtxdoc}[2012/03/21]% v0.24
+%% thumbs may work with earlier versions of LaTeX2e and those
+%% class and packages, but this was not tested.
+%% Please consider updating your LaTeX, class, and packages
+%% to the most recent version (if they are not already the most
+%% recent version).
+\hypersetup{%
+ pdfsubject={Thumb marks and overview page(s) (HMM)},%
+ pdfkeywords={LaTeX, thumb, thumbs, thumb index, thumbs index, index, H.-Martin Muench},%
+ pdfencoding=auto,%
+ pdflang={en},%
+ breaklinks=true,%
+ linktoc=all,%
+ pdfstartview=FitH,%
+ pdfpagelayout=OneColumn,%
+ bookmarksnumbered=true,%
+ bookmarksopen=true,%
+ bookmarksopenlevel=3,%
+ pdfmenubar=true,%
+ pdftoolbar=true,%
+ pdfwindowui=true,%
+ pdfnewwindow=true%
+}
+\CodelineIndex
+\hyphenation{printing docu-ment docu-menta-tion}
+\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}%
+\begin{document}
+ \DocInput{thumbs.dtx}%
+\end{document}
+%</driver>
+% \end{macrocode}
+%
+% \fi
+%
+% \CheckSum{2779}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+% \GetFileInfo{thumbs.drv}
+%
+% \begingroup
+% \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}%
+% \makeatletter
+% \@onelevel@sanitize\x
+% \expandafter\endgroup
+% \expandafter\DoNotIndex\expandafter{\x}
+% \expandafter\DoNotIndex\expandafter{\string\ }
+% \begingroup
+% \makeatletter
+% \lccode`9=32\relax
+% \lowercase{%^^A
+% \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A
+% }%^^A
+% \expandafter\endgroup\x
+%
+% \DoNotIndex{\\}
+% \DoNotIndex{\documentclass,\usepackage,\ProvidesPackage,\begin,\end}
+% \DoNotIndex{\MessageBreak}
+% \DoNotIndex{\NeedsTeXFormat,\DoNotIndex,\verb}
+% \DoNotIndex{\def,\edef,\gdef,\xdef,\global}
+% \DoNotIndex{\ifx,\listfiles,\mathord,\mathrm}
+% \DoNotIndex{\kvoptions,\SetupKeyvalOptions,\ProcessKeyvalOptions}
+% \DoNotIndex{\smallskip,\bigskip,\space,\thinspace,\ldots}
+% \DoNotIndex{\indent,\noindent,\newline,\linebreak,\pagebreak,\newpage}
+% \DoNotIndex{\textbf,\textit,\textsf,\texttt,\textsc,\textrm}
+% \DoNotIndex{\textquotedblleft,\textquotedblright}
+% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX}
+% \DoNotIndex{\chapter,\section}
+% \DoNotIndex{\Huge,\Large,\large}
+% \DoNotIndex{\arabic,\the,\value,\ifnum,\setcounter,\addtocounter,\advance,\divide}
+% \DoNotIndex{\setlength,\textbackslash,\,}
+% \DoNotIndex{\csname,\endcsname,\color,\copyright,\frac,\null}
+% \DoNotIndex{\@PackageInfoNoLine,\thumbsinfo,\thumbsinfoa,\thumbsinfob}
+% \DoNotIndex{\hspace,\thepage,\do,\empty,\ss}
+%
+% \title{The \xpackage{thumbs} package}
+% \date{2014/03/09 v1.0q}
+% \author{H.-Martin M\"{u}nch\\\xemail{Martin.Muench at Uni-Bonn.de}}
+%
+% \maketitle
+%
+% \begin{abstract}
+% This \LaTeX{} package allows to create one or more customizable thumb index(es),
+% providing a quick and easy reference method for large documents.
+% It must be loaded after the page size has been set,
+% when printing the document \textquotedblleft shrink to
+% page\textquotedblright{} should not be used, and a printer capable of
+% printing up to the border of the sheet of paper is needed
+% (or afterwards cutting the paper).
+% \end{abstract}
+%
+% \bigskip
+%
+% \noindent Disclaimer for web links: The author is not responsible for any contents
+% referred to in this work unless he has full knowledge of illegal contents.
+% If any damage occurs by the use of information presented there, only the
+% author of the respective pages might be liable, not the one who has referred
+% to these pages.
+%
+% \bigskip
+%
+% \noindent {\color{green} Save per page about $200\unit{ml}$ water,
+% $2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\\
+% Therefore please print only if this is really necessary.}
+%
+% \newpage
+%
+% \tableofcontents
+%
+% \newpage
+%
+% \section{Introduction}
+% \indent This \LaTeX{} package puts running, customizable thumb marks in the outer
+% margin, moving downward as the chapter number (or whatever shall be marked
+% by the thumb marks) increases. Additionally an overview page/table of thumb
+% marks can be added automatically, which gives the respective names of the
+% thumbed objects, the page where the object/thumb mark first appears,
+% and the thumb mark itself at the respective position. The thumb marks are
+% probably useful for documents, where a quick and easy way to find
+% e.\,g.~a~chapter is needed, for example in reference guides, anthologies,
+% or quite large documents.\\
+% \xpackage{thumbs} must be loaded after the page size has been set,
+% when printing the document \textquotedblleft shrink to
+% page\textquotedblright\ should not be used, a printer capable of
+% printing up to the border of the sheet of paper is needed
+% (or afterwards cutting the paper).\\
+% Usage with |\usepackage[landscape]{geometry}|,
+% |\documentclass[landscape]{|\ldots|}|, |\usepackage[landscape]{geometry}|,
+% |\usepackage{lscape}|, or |\usepackage{pdflscape}| is possible.\\
+% There \emph{are} already some packages for creating thumbs, but because
+% none of them did what I wanted, I wrote this new package.\footnote{Probably%
+% this holds true for the motivation of the authors of quite a lot of packages.}
+%
+% \section{Usage}
+%
+% \subsection{Loading}
+% \indent Load the package placing
+% \begin{quote}
+% |\usepackage[<|\textit{options}|>]{thumbs}|
+% \end{quote}
+% \noindent in the preamble of your \LaTeXe\ source file.\\
+% The \xpackage{thumbs} package takes the dimensions of the page
+% |\AtBeginDocument| and does not react to changes afterwards.
+% Therefore this package must be loaded \emph{after} the page dimensions
+% have been set, e.\,g. with package \xpackage{geometry}
+% (\url{http://ctan.org/pkg/geometry}). Of course it is also OK to just keep
+% the default page/paper settings, but when anything is changed, it must be
+% done before \xpackage{thumbs} executes its |\AtBeginDocument| code.\\
+% The format of the paper, where the document shall be printed upon,
+% should also be used for creating the document. Then the document can
+% be printed without adapting the size, like e.\,g. \textquotedblleft shrink
+% to page\textquotedblright . That would add a white border around the document
+% and by moving the thumb marks from the edge of the paper they no longer appear
+% at the side of the stack of paper. (Therefore e.\,g. for printing the example
+% file to A4 paper it is necessary to add |a4paper| option to the document class
+% and recompile it! Then the thumb marks column change will occur at another
+% point, of course.) It is also necessary to use a printer
+% capable of printing up to the border of the sheet of paper. Alternatively
+% it is possible after the printing to cut the paper to the right size.
+% While performing this manually is probably quite cumbersome,
+% printing houses use paper, which is slightly larger than the
+% desired format, and afterwards cut it to format.\\
+% Some faulty \xfile{pdf}-viewer adds a white line at the bottom and
+% right side of the document when presenting it. This does not change
+% the printed version. To test for this problem, a page of the example
+% file has been completely coloured. (Probably better exclude that page from
+% printing\ldots)\\
+% When using the thumb marks overview page, it is necessary to |\protect|
+% entries like |\pi| (same as with entries in tables of contents, figures,
+% tables,\ldots).\\
+%
+% \subsection{Options}
+% \DescribeMacro{options}
+% \indent The \xpackage{thumbs} package takes the following options:
+%
+% \subsubsection{linefill\label{sss:linefill}}
+% \DescribeMacro{linefill}
+% \indent Option |linefill| wants to know how the line between object
+% (e.\,g.~chapter name) and page number shall be filled at the overview
+% page. Empty option will result in a blank line, |line| will fill the distance
+% with a line, |dots| will fill the distance with dots.
+%
+% \subsubsection{minheight\label{sss:minheight}}
+% \DescribeMacro{minheight}
+% \indent Option |minheight| wants to know the minimal vertical extension
+% of each thumb mark. This is only useful in combination with option |height=auto|
+% (see below). When the height is automatically calculated and smaller than
+% the |minheight| value, the height is set equal to the given |minheight| value
+% and a new column/page of thumb marks is used. The default value is
+% $47\unit{pt}$\ $(\approx 16.5\unit{mm} \approx 0.65\unit{in})$.
+%
+% \subsubsection{height\label{sss:height}}
+% \DescribeMacro{height}
+% \indent Option |height| wants to know the vertical extension of each thumb mark.
+% The default value \textquotedblleft |auto|\textquotedblright\ calculates
+% an appropriate value automatically decreasing with increasing number of thumb
+% marks (but fixed for each document). When the height is smaller than |minheight|,
+% this package deems this as too small and instead uses a new column/page of thumb
+% marks. If smaller thumb marks are really wanted, choose a smaller |minheight|
+% (e.\,g.~$0\unit{pt}$).
+%
+% \subsubsection{width\label{sss:width}}
+% \DescribeMacro{width}
+% \indent Option |width| wants to know the horizontal extension of each thumb mark.
+% The default option-value \textquotedblleft |auto|\textquotedblright\ calculates
+% a width-value automatically: (|\paperwidth| minus |\textwidth|), which is the
+% total width of inner and outer margin, divided by~$4$. Instead of this, any
+% positive width given by the user is accepted. (Try |width={\paperwidth}|
+% in the example!) Option |width={autoauto}| leads to thumb marks, which are
+% just wide enough to fit the widest thumb mark text.
+%
+% \subsubsection{distance\label{sss:distance}}
+% \DescribeMacro{distance}
+% \indent Option |distance| wants to know the vertical spacing between
+% two thumb marks. The default value is $2\unit{mm}$.
+%
+% \subsubsection{topthumbmargin\label{sss:topthumbmargin}}
+% \DescribeMacro{topthumbmargin}
+% \indent Option |topthumbmargin| wants to know the vertical spacing between
+% the upper page (paper) border and top thumb mark. The default (|auto|)
+% is 1 inch plus |\th@bmsvoffset| plus |\topmargin|. Dimensions (e.\,g. $1\unit{cm}$)
+% are also accepted.
+%
+% \pagebreak
+%
+% \subsubsection{bottomthumbmargin\label{sss:bottomthumbmargin}}
+% \DescribeMacro{bottomthumbmargin}
+% \indent Option |bottomthumbmargin| wants to know the vertical spacing between
+% the lower page (paper) border and last thumb mark. The default (|auto|) for the
+% position of the last thumb is\\
+% |1in+\topmargin-\th@mbsdistance+\th@mbheighty+\headheight+\headsep+\textheight|
+% |+\footskip-\th@mbsdistance|\newline
+% |-\th@mbheighty|.\\
+% Dimensions (e.\,g. $1\unit{cm}$) are also accepted.
+%
+% \subsubsection{eventxtindent\label{sss:eventxtindent}}
+% \DescribeMacro{eventxtindent}
+% \indent Option |eventxtindent| expects a dimension (default value: $5\unit{pt}$,
+% negative values are possible, of course),
+% by which the text inside of thumb marks on even pages is moved away from the
+% page edge, i.e. to the right. Probably using the same or at least a similar value
+% as for option |oddtxtexdent| makes sense.
+%
+% \subsubsection{oddtxtexdent\label{sss:oddtxtexdent}}
+% \DescribeMacro{oddtxtexdent}
+% \indent Option |oddtxtexdent| expects a dimension (default value: $5\unit{pt}$,
+% negative values are possible, of course),
+% by which the text inside of thumb marks on odd pages is moved away from the
+% page edge, i.e. to the left. Probably using the same or at least a similar value
+% as for option |eventxtindent| makes sense.
+%
+% \subsubsection{evenmarkindent\label{sss:evenmarkindent}}
+% \DescribeMacro{evenmarkindent}
+% \indent Option |evenmarkindent| expects a dimension (default value: $0\unit{pt}$,
+% negative values are possible, of course),
+% by which the thumb marks (background and text) on even pages are moved away from the
+% page edge, i.e. to the right. This might be usefull when the paper,
+% onto which the document is printed, is later cut to another format.
+% Probably using the same or at least a similar value as for option |oddmarkexdent|
+% makes sense.
+%
+% \subsubsection{oddmarkexdent\label{sss:oddmarkexdent}}
+% \DescribeMacro{oddmarkexdent}
+% \indent Option |oddmarkexdent| expects a dimension (default value: $0\unit{pt}$,
+% negative values are possible, of course),
+% by which the thumb marks (background and text) on odd pages are moved away from the
+% page edge, i.e. to the left. This might be usefull when the paper,
+% onto which the document is printed, is later cut to another format.
+% Probably using the same or at least a similar value as for option |oddmarkexdent|
+% makes sense.
+%
+% \subsubsection{evenprintvoffset\label{sss:evenprintvoffset}}
+% \DescribeMacro{evenprintvoffset}
+% \indent Option |evenprintvoffset| expects a dimension (default value: $0\unit{pt}$,
+% negative values are possible, of course),
+% by which the thumb marks (background and text) on even pages are moved downwards.
+% This might be usefull when a duplex printer shifts recto and verso pages
+% against each other by some small amount, e.g. a~millimeter or two, which
+% is not uncommon. Please do not use this option with another value than $0\unit{pt}$
+% for files which you submit to other persons. Their printer probably shifts the
+% pages by another amount, which might even lead to increased mismatch
+% if both printers shift in opposite directions. Ideally the pdf viewer
+% would correct the shift depending on printer (or at least give some option
+% similar to \textquotedblleft shift verso pages by
+% \hbox{$x\unit{mm}$\textquotedblright{}.}
+%
+% \subsubsection{thumblink\label{sss:thumblink}}
+% \DescribeMacro{thumblink}
+% \indent Option |thumblink| determines, what is hyperlinked at the thumb marks
+% overview page (when the \xpackage{hyperref} package is used):
+%
+% \begin{description}
+% \item[- |none|] creates \emph{none} hyperlinks
+%
+% \item[- |title|] hyperlinks the \emph{titles} of the thumb marks
+%
+% \item[- |page|] hyperlinks the \emph{page} numbers of the thumb marks
+%
+% \item[- |titleandpage|] hyperlinks the \emph{title and page} numbers of the thumb marks
+%
+% \item[- |line|] hyperlinks the whole \emph{line}, i.\,e. title, dots%
+% (or line or whatsoever) and page numbers of the thumb marks
+%
+% \item[- |rule|] hyperlinks the whole \emph{rule}.
+% \end{description}
+%
+% \subsubsection{nophantomsection\label{sss:nophantomsection}}
+% \DescribeMacro{nophantomsection}
+% \indent Option |nophantomsection| globally disables the automatical placement of a
+% |\phantomsection| before the thumb marks. Generally it is desirable to have a
+% hyperlink from the thumbs overview page to lead to the thumb mark and not to some
+% earlier place. Therefore automatically a |\phantomsection| is placed before each
+% thumb mark. But for example when using the thumb mark after a |\chapter{...}|
+% command, it is probably nicer to have the link point at the top of that chapter's
+% title (instead of the line below it). When automatical placing of the
+% |\phantomsection|s has been globally disabled, nevertheless manual use of
+% |\phantomsection| is still possible. The other way round: When automatical placing
+% of the |\phantomsection|s has \emph{not} been globally disabled, it can be disabled
+% just for the following thumb mark by the command |\thumbsnophantom|.
+%
+% \subsubsection{ignorehoffset, ignorevoffset\label{sss:ignoreoffset}}
+% \DescribeMacro{ignorehoffset}
+% \DescribeMacro{ignorevoffset}
+% \indent Usually |\hoffset| and |\voffset| should be regarded,
+% but moving the thumb marks away from the paper edge probably
+% makes them useless. Therefore |\hoffset| and |\voffset| are ignored
+% by default, or when option |ignorehoffset| or |ignorehoffset=true| is used
+% (and |ignorevoffset| or |ignorevoffset=true|, respectively).
+% But in case that the user wants to print at one sort of paper
+% but later trim it to another one, regarding the offsets would be
+% necessary. Therefore |ignorehoffset=false| and |ignorevoffset=false|
+% can be used to regard these offsets. (Combinations
+% |ignorehoffset=true, ignorevoffset=false| and
+% |ignorehoffset=false, ignorevoffset=true| are also possible.)\\
+%
+% \subsubsection{verbose\label{sss:verbose}}
+% \DescribeMacro{verbose}
+% \indent Option |verbose=false| (the default) suppresses some messages,
+% which otherwise are presented at the screen and written into the \xfile{log}~file.
+% Look for\\
+% |************** THUMB dimensions **************|\\
+% in the \xfile{log} file for height and width of the thumb marks as well as
+% top and bottom thumb marks margins.
+%
+% \subsubsection{draft\label{sss:draft}}
+% \DescribeMacro{draft}
+% \indent Option |draft| (\emph{not} the default) sets the thumb mark width to
+% $2\unit{pt}$, thumb mark text colour to black and thumb mark background colour
+% to grey (|gray|). Either do not use this option with the \xpackage{thumbs} package at all,
+% or use |draft=false|, or |final|, or |final=true| to get the original appearance
+% of the thumb marks.\\
+%
+% \subsubsection{hidethumbs\label{sss:hidethumbs}}
+% \DescribeMacro{hidethumbs}
+% \indent Option |hidethumbs| (\emph{not} the default) prevents \xpackage{thumbs}
+% to create thumb marks (or thumb marks overview pages). This could be useful
+% when thumb marks were placed, but for some reason no thumb marks (and overview pages)
+% shall be placed. Removing |\usepackage[...]{thumbs}| would not work but
+% create errors for unknown commands (e.\,g. |\addthumb|, |\addtitlethumb|,
+% |\thumbnewcolumn|, |\stopthumb|, |\continuethumb|, |\addthumbsoverviewtocontents|,
+% |\thumbsoverview|, |\thumbsoverviewback|, |\thumbsoverviewverso|, and
+% |\thumbsoverviewdouble|). (A~|\jobname.tmb| file is created nevertheless.)~--
+% Either do not use this option with the \xpackage{thumbs}
+% package at all, or use |hidethumbs=false| to get the original appearance
+% of the thumb marks.\\
+%
+% \subsubsection{pagecolor (obsolete)\label{sss:pagecolor}}
+% \DescribeMacro{pagecolor}
+% \indent Option |pagecolor| is obsolete. Instead the \xpackage{pagecolor}
+% package is used.\\
+% Use |\pagecolor{...}| \emph{after} |\usepackage[...]{thumbs}|
+% and \emph{before} |\begin{document}| to define a background colour of the pages.\\
+%
+% \subsubsection{evenindent (obsolete)\label{sss:evenindent}}
+% \DescribeMacro{evenindent}
+% \indent Option |evenindent| is obsolete and was replaced by |eventxtindent|.\\
+%
+% \subsubsection{oddexdent (obsolete)\label{sss:oddexdent}}
+% \DescribeMacro{oddexdent}
+% \indent Option |oddexdent| is obsolete and was replaced by |oddtxtexdent|.\\
+%
+% \pagebreak
+%
+% \subsection{Commands to be used in the document}
+% \subsubsection{\textbackslash addthumb}
+% \DescribeMacro{\addthumb}
+% To add a thumb mark, use the |\addthumb| command, which has these four parameters:
+% \begin{enumerate}
+% \item a title for the thumb mark (for the thumb marks overview page,
+% e.\,g. the chapter title),
+%
+% \item the text to be displayed in the thumb mark (for example the chapter
+% number: |\thechapter|),
+%
+% \item the colour of the text in the thumb mark,
+%
+% \item and the background colour of the thumb mark
+% \end{enumerate}
+% (parameters in this order) at the page where you want this thumb mark placed
+% (for the first time).\\
+%
+% \subsubsection{\textbackslash addtitlethumb}
+% \DescribeMacro{\addtitlethumb}
+% When a thumb mark shall not or cannot be placed on a page, e.\,g.~at the title page or
+% when using |\includepdf| from \xpackage{pdfpages} package, but the reference in the thumb
+% marks overview nevertheless shall name that page number and hyperlink to that page,
+% |\addtitlethumb| can be used at the following page. It has five arguments. The arguments
+% one to four are identical to the ones of |\addthumb| (see above),
+% and the fifth argument consists of the label of the page, where the hyperlink
+% at the thumb marks overview page shall link to. The \xpackage{thumbs} package does
+% \emph{not} create that label! But for the first page the label
+% \texttt{pagesLTS.0} can be use, which is already placed there by the used
+% \xpackage{pageslts} package.\\
+%
+% \subsubsection{\textbackslash stopthumb and \textbackslash continuethumb}
+% \DescribeMacro{\stopthumb}
+% \DescribeMacro{\continuethumb}
+% When a page (or pages) shall have no thumb marks, use the |\stopthumb| command
+% (without parameters). Placing another thumb mark with |\addthumb| or |\addtitlethumb|
+% or using the command |\continuethumb| continues the thumb marks.\\
+%
+% \subsubsection{\textbackslash thumbsoverview/back/verso/double}
+% \DescribeMacro{\thumbsoverview}
+% \DescribeMacro{\thumbsoverviewback}
+% \DescribeMacro{\thumbsoverviewverso}
+% \DescribeMacro{\thumbsoverviewdouble}
+% The commands |\thumbsoverview|, |\thumbsoverviewback|, |\thumbsoverviewverso|, and/or
+% |\thumbsoverviewdouble| is/are used to place the overview page(s) for the thumb marks.
+% Their single parameter is used to mark this page/these pages (e.\,g. in the page header).
+% If these marks are not wished, |\thumbsoverview...{}| will generate empty marks in the
+% page header(s). |\thumbsoverview| can be used more than once (for example at the
+% beginning and at the end of the document, or |\thumbsoverview| at the beginning and
+% |\thumbsoverviewback| at the end). The overviews have labels |TableOfThumbs1|,
+% |TableOfThumbs2|, and so on, which can be referred to with e.\,g. |\pageref{TableOfThumbs1}|.
+% The reference |TableOfThumbs| (without number) aims at the last used Table of Thumbs
+% (for compatibility with older versions of this package).
+% \begin{description}
+% \item[-] |\thumbsoverview| prints the thumb marks at the right side
+% and (in |twoside| mode) skips left sides (useful e.\,g. at the beginning
+% of a document)
+%
+% \item[-] |\thumbsoverviewback| prints the thumb marks at the left side
+% and (in |twoside| mode) skips right sides (useful e.\,g. at the end
+% of a document)
+%
+% \item[-] |\thumbsoverviewverso| prints the thumb marks at the right side
+% and (in |twoside| mode) repeats them at the next left side and so on
+% (useful anywhere in the document and when one wants to prevent empty
+% pages)
+%
+% \item[-] |\thumbsoverviewdouble| prints the thumb marks at the left side
+% and (in |twoside| mode) repeats them at the next right side and so on
+% (useful anywhere in the document and when one wants to prevent empty
+% pages)
+% \end{description}
+% \smallskip
+%
+% \subsubsection{\textbackslash thumbnewcolumn}
+% \DescribeMacro{\thumbnewcolumn}
+% With the command |\thumbnewcolumn| a new column can be started, even if the current one
+% was not filled. This could be useful e.\,g. for a dictionary, which uses one column for
+% translations from language A to language B, and the second column for translations
+% from language B to language A. But in that case one probably should increase the
+% size of the thumb marks, so that $26$~thumb marks (in~case of the Latin alphabet)
+% fill one thumb column. Do not use |\thumbnewcolumn| on a page where |\addthumb| was
+% already used, but use |\addthumb| immediately after |\thumbnewcolumn|.\\
+%
+% \subsubsection{\textbackslash addthumbsoverviewtocontents}
+% \DescribeMacro{\addthumbsoverviewtocontents}
+% |\addthumbsoverviewtocontents| with two arguments is a replacement for
+% |\addcontentsline{toc}{<level>}{<text>}|, where the first argument of
+% |\addthumbsoverviewtocontents| is for |<level>| and the second for |<text>|.
+% If an entry of the thumbs mark overview shall be placed in the table of contents,
+% |\addthumbsoverviewtocontents| with its arguments should be used immediately before
+% |\thumbsoverview|.
+%
+% \subsubsection{\textbackslash thumbsnophantom}
+% \DescribeMacro{\thumbsnophantom}
+% When automatical placing of the |\phantomsection|s has \emph{not} been globally
+% disabled by using option |nophantomsection| (see subsection~\ref{sss:nophantomsection}),
+% it can be disabled just for the following thumb mark by the command |\thumbsnophantom|.
+%
+% \pagebreak
+%
+% \section{Alternatives\label{sec:Alternatives}}
+%
+% \begin{description}
+% \item[-] \xpackage{chapterthumb}, 2005/03/10, v0.1, by \textsc{Markus Kohm}, available at\\
+% \url{http://mirror.ctan.org/info/examples/KOMA-Script-3/Anhang-B/source/chapterthumb.sty};\\
+% unfortunately without documentation, which is probably available in the book:\\
+% Kohm, M., \& Morawski, J.-U. (2008): KOMA-Script. Eine Sammlung von Klassen und Paketen f\"{u}r \LaTeX2e,
+% 3.,~\"{u}berarbeitete und erweiterte Auflage f\"{u}r KOMA-Script~3,
+% Lehmanns Media, Berlin, Edition dante, ISBN-13:~978-3-86541-291-1,
+% \url{http://www.lob.de/isbn/3865412912}; in German.
+%
+% \item[-] \xpackage{eso-pic}, 2010/10/06, v2.0c by \textsc{Rolf Niepraschk}, available at
+% \url{http://www.ctan.org/pkg/eso-pic}, was suggested as alternative. If I understood its code right,
+% |\AtBeginShipout{\AtBeginShipoutUpperLeft{\put(...| is used there, too. Thus I do not see
+% its advantage. Additionally, while compiling the \xpackage{eso-pic} test documents with
+% \TeX Live2010 worked, compiling them with \textsl{Scientific WorkPlace}{}\ 5.50 Build 2960\ %
+% (\copyright~MacKichan Software, Inc.) led to significant deviations of the placements
+% (also changing from one page to the other).
+%
+% \item[-] \xpackage{fancytabs}, 2011/04/16 v1.1, by \textsc{Rapha\"{e}l Pinson}, available at
+% \url{http://www.ctan.org/pkg/fancytabs}, but requires TikZ from the
+% \href{http://www.ctan.org/pkg/pgf}{pgf} bundle.
+%
+% \item[-] \xpackage{thumb}, 2001, without file version, by \textsc{Ingo Kl\"{o}ckel}, available at\\
+% \url{ftp://ftp.dante.de/pub/tex/info/examples/ltt/thumb.sty},
+% unfortunately without documentation, which is probably available in the book:\\
+% Kl\"{o}ckel, I. (2001): \LaTeX2e.\ Tips und Tricks, Dpunkt.Verlag GmbH,
+% \href{http://amazon.de/o/ASIN/3932588371}{ISBN-13:~978-3-93258-837-2}; in German.
+%
+% \item[-] \xpackage{thumb} (a completely different one), 1997/12/24, v1.0,
+% by \textsc{Christian Holm}, available at\\
+% \url{http://www.ctan.org/pkg/thumb}.
+%
+% \item[-] \xpackage{thumbindex}, 2009/12/13, without file version, by \textsc{Hisashi Morita},
+% available at\\
+% \url{http://hisashim.org/2009/12/13/thumbindex.html}.
+%
+% \item[-] \xpackage{thumb-index}, from the \xpackage{fancyhdr} package, 2005/03/22 v3.2,
+% by~\textsc{Piet van Oostrum}, available at\\
+% \url{http://www.ctan.org/pkg/fancyhdr}.
+%
+% \item[-] \xpackage{thumbpdf}, 2010/07/07, v3.11, by \textsc{Heiko Oberdiek}, is for creating
+% thumbnails in a \xfile{pdf} document, not thumb marks (and therefore \textit{no} alternative);
+% available at \url{http://www.ctan.org/pkg/thumbpdf}.
+%
+% \item[-] \xpackage{thumby}, 2010/01/14, v0.1, by \textsc{Sergey Goldgaber},
+% \textquotedblleft is designed to work with the \href{http://www.ctan.org/pkg/memoir}{memoir}
+% class, and also requires \href{http://www.ctan.org/pkg/perltex}{Perl\TeX} and
+% \href{http://www.ctan.org/pkg/pgf}{tikz}\textquotedblright\ %
+% (\url{http://www.ctan.org/pkg/thumby}), available at \url{http://www.ctan.org/pkg/thumby}.
+% \end{description}
+%
+% \bigskip
+%
+% \noindent Newer versions might be available (and better suited).
+% You programmed or found another alternative,
+% which is available at \url{CTAN.org}?
+% OK, send an e-mail to me with the name, location at \url{CTAN.org},
+% and a short notice, and I will probably include it in the list above.
+%
+% \newpage
+%
+% \section{Example}
+%
+% \begin{macrocode}
+%<*example>
+\documentclass[twoside,british]{article}[2007/10/19]% v1.4h
+\usepackage{lipsum}[2011/04/14]% v1.2
+\usepackage{eurosym}[1998/08/06]% v1.1
+\usepackage[extension=pdf,%
+ pdfpagelayout=TwoPageRight,pdfpagemode=UseThumbs,%
+ plainpages=false,pdfpagelabels=true,%
+ hyperindex=false,%
+ pdflang={en},%
+ pdftitle={thumbs package example},%
+ pdfauthor={H.-Martin Muench},%
+ pdfsubject={Example for the thumbs package},%
+ pdfkeywords={LaTeX, thumbs, thumb marks, H.-Martin Muench},%
+ pdfview=Fit,pdfstartview=Fit,%
+ linktoc=all]{hyperref}[2012/11/06]% v6.83m
+\usepackage[thumblink=rule,linefill=dots,height={auto},minheight={47pt},%
+ width={auto},distance={2mm},topthumbmargin={auto},bottomthumbmargin={auto},%
+ eventxtindent={5pt},oddtxtexdent={5pt},%
+ evenmarkindent={0pt},oddmarkexdent={0pt},evenprintvoffset={0pt},%
+ nophantomsection=false,ignorehoffset=true,ignorevoffset=true,final=true,%
+ hidethumbs=false,verbose=true]{thumbs}[2014/03/09]% v1.0q
+\nopagecolor% use \pagecolor{white} if \nopagecolor does not work
+\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}
+\makeatletter
+\ltx@ifpackageloaded{hyperref}{% hyperref loaded
+}{% hyperref not loaded
+ \usepackage{url}% otherwise the "\url"s in this example must be removed manually
+}
+\makeatother
+\listfiles
+\begin{document}
+\pagenumbering{arabic}
+\section*{Example for thumbs}
+\addcontentsline{toc}{section}{Example for thumbs}
+\markboth{Example for thumbs}{Example for thumbs}
+
+This example demonstrates the most common uses of package
+\textsf{thumbs}, v1.0q as of 2014/03/09 (HMM).
+The used options were \texttt{thumblink=rule}, \texttt{linefill=dots},
+\texttt{height=auto}, \texttt{minheight=\{47pt\}}, \texttt{width={auto}},
+\texttt{distance=\{2mm\}}, \newline
+\texttt{topthumbmargin=\{auto\}}, \texttt{bottomthumbmargin=\{auto\}}, \newline
+\texttt{eventxtindent=\{5pt\}}, \texttt{oddtxtexdent=\{5pt\}},
+\texttt{evenmarkindent=\{0pt\}}, \texttt{oddmarkexdent=\{0pt\}},
+\texttt{evenprintvoffset=\{0pt\}},
+\texttt{nophantomsection=false},
+\texttt{ignorehoffset=true}, \texttt{ignorevoffset=true}, \newline
+\texttt{final=true},\texttt{hidethumbs=false}, and \texttt{verbose=true}.
+
+\noindent These are the default options, except \texttt{verbose=true}.
+For more details please see the documentation!\newline
+
+\textbf{Hyperlinks or not:} If the \textsf{hyperref} package is loaded,
+the references in the overview page for the thumb marks are also hyperlinked
+(except when option \texttt{thumblink=none} is used).\newline
+
+\bigskip
+
+{\color{teal} Save per page about $200\unit{ml}$ water, $2\unit{g}$ CO$_{2}$
+and $2\unit{g}$ wood:\newline
+Therefore please print only if this is really necessary.}\newline
+
+\bigskip
+
+\textbf{%
+For testing purpose page \pageref{greenpage} has been completely coloured!
+\newline
+Better exclude it from printing\ldots \newline}
+
+\bigskip
+
+Some thumb mark texts are too large for the thumb mark by intention
+(especially when the paper size and therefore also the thumb mark size
+is decreased). When option \texttt{width=\{autoauto\}} would be used,
+the thumb mark width would be automatically increased.
+Please see page~\pageref{HugeText} for details!
+
+\bigskip
+
+For printing this example to another format of paper (e.\,g. A4)
+it is necessary to add the according option (e.\,g. \verb|a4paper|)
+to the document class and recompile it! (In that case the
+thumb marks column change will occur at another point, of course.)
+With paper format equal to document format the document can be printed
+without adapting the size, like e.\,g.
+\textquotedblleft shrink to page\textquotedblright .
+That would add a white border around the document
+and by moving the thumb marks from the edge of the paper they no longer appear
+at the side of the stack of paper. It is also necessary to use a printer
+capable of printing up to the border of the sheet of paper. Alternatively
+it is possible after the printing to cut the paper to the right size.
+While performing this manually is probably quite cumbersome,
+printing houses use paper, which is slightly larger than the
+desired format, and afterwards cut it to format.
+
+\newpage
+
+\addtitlethumb{Frontmatter}{0}{white}{gray}{pagesLTS.0}
+
+At the first page no thumb mark was used, but we want to begin with thumb marks
+at the first page, therefore a
+\begin{verbatim}
+\addtitlethumb{Frontmatter}{0}{white}{gray}{pagesLTS.0}
+\end{verbatim}
+was used at the beginning of this page.
+
+\newpage
+
+\tableofcontents
+
+\newpage
+
+To include an overview page for the thumb marks,
+\begin{verbatim}
+\addthumbsoverviewtocontents{section}{Thumb marks overview}%
+\thumbsoverview{Table of Thumbs}
+\end{verbatim}
+is used, where \verb|\addthumbsoverviewtocontents| adds the thumb
+marks overview page to the table of contents.
+
+\smallskip
+
+Generally it is desirable to have a hyperlink from the thumbs overview page
+to lead to the thumb mark and not to some earlier place. Therefore automatically
+a \verb|\phantomsection| is placed before each thumb mark. But for example when
+using the thumb mark after a \verb|\chapter{...}| command, it is probably nicer
+to have the link point at the top of that chapter's title (instead of the line
+below it). The automatical placing of the \verb|\phantomsection| can be disabled
+either globally by using option \texttt{nophantomsection}, or locally for the next
+thumb mark by the command \verb|\thumbsnophantom|. (When disabled globally,
+still manual use of \verb|\phantomsection| is possible.)
+
+% \end{macrocode}
+% \pagebreak
+% \begin{macrocode}
+\addthumbsoverviewtocontents{section}{Thumb marks overview}%
+\thumbsoverview{Table of Thumbs}
+
+That were the overview pages for the thumb marks.
+
+\newpage
+
+\section{The first section}
+\addthumb{First section}{\space\Huge{\textbf{$1^ \textrm{st}$}}}{yellow}{green}
+
+\begin{verbatim}
+\addthumb{First section}{\space\Huge{\textbf{$1^ \textrm{st}$}}}{yellow}{green}
+\end{verbatim}
+
+A thumb mark is added for this section. The parameters are: title for the thumb mark,
+the text to be displayed in the thumb mark (choose your own format),
+the colour of the text in the thumb mark,
+and the background colour of the thumb mark (parameters in this order).\newline
+
+Now for some pages of \textquotedblleft content\textquotedblright\ldots
+
+\newpage
+\lipsum[1]
+\newpage
+\lipsum[1]
+\newpage
+\lipsum[1]
+\newpage
+
+\section{The second section}
+\addthumb{Second section}{\Huge{\textbf{\arabic{section}}}}{green}{yellow}
+
+For this section, the text to be displayed in the thumb mark was set to
+\begin{verbatim}
+\Huge{\textbf{\arabic{section}}}
+\end{verbatim}
+i.\,e. the number of the section will be displayed (huge \& bold).\newline
+
+Let us change the thumb mark on a page with an even number:
+
+\newpage
+
+\section{The third section}
+\addthumb{Third section}{\Huge{\textbf{\arabic{section}}}}{blue}{red}
+
+No problem!
+
+And you do not need to have a section to add a thumb:
+
+\newpage
+
+\addthumb{Still third section}{\Huge{\textbf{\arabic{section}b}}}{red}{blue}
+
+This is still the third section, but there is a new thumb mark.
+
+On the other hand, you can even get rid of the thumb marks
+for some page(s):
+
+\newpage
+
+\stopthumb
+
+The command
+\begin{verbatim}
+\stopthumb
+\end{verbatim}
+was used here. Until another \verb|\addthumb| (with parameters) or
+\begin{verbatim}
+\continuethumb
+\end{verbatim}
+is used, there will be no more thumb marks.
+
+\newpage
+
+Still no thumb marks.
+
+\newpage
+
+Still no thumb marks.
+
+\newpage
+
+Still no thumb marks.
+
+\newpage
+
+\continuethumb
+
+Thumb mark continued (unchanged).
+
+\newpage
+
+Thumb mark continued (unchanged).
+
+\newpage
+
+Time for another thumb,
+
+\addthumb{Another heading}{Small text}{white}{black}
+
+and another.
+
+\addthumb{Huge Text paragraph}{\Huge{Huge\\ \ Text}}{yellow}{green}
+
+\bigskip
+
+\textquotedblleft {\Huge{Huge Text}}\textquotedblright\ is too large for
+the thumb mark. When option \texttt{width=\{autoauto\}} would be used,
+the thumb mark width would be automatically increased. Now the text is
+either split over two lines (try \verb|Huge\\ \ Text| for another format)
+or (in case \verb|Huge~Text| is used) is written over the border of the
+thumb mark. When the text is too wide for the thumb mark and cannot
+be split, \LaTeX{} might nevertheless place the text into the next line.
+By this the text is placed too low. Adding a
+\hbox{\verb|\protect\vspace*{-| some lenght \verb|}|} to the text could help,
+for example\\
+\verb|\addthumb{Huge Text}{\protect\vspace*{-3pt}\Huge{Huge~Text}}...|.
+\label{HugeText}
+
+\addthumb{Huge Text}{\Huge{Huge~Text}}{red}{blue}
+
+\addthumb{Huge Bold Text}{\Huge{\textbf{HBT}}}{black}{yellow}
+
+\bigskip
+
+When there is more than one thumb mark at one page, this is also no problem.
+
+\newpage
+
+Some text
+
+\newpage
+
+Some text
+
+\newpage
+
+Some text
+
+\newpage
+
+\section{xcolor}
+\addthumb{xcolor}{\Huge{\textbf{xcolor}}}{magenta}{cyan}
+
+It is probably a good idea to have a look at the \textsf{xcolor} package
+and use other colours than used in this example.
+
+(About automatically increasing the thumb mark width to the thumb mark text
+width please see the note at page~\pageref{HugeText}.)
+
+\newpage
+
+\addthumb{A mark}{\Huge{\textbf{A}}}{lime}{darkgray}
+
+I just need to add further thumb marks to get them reaching the bottom of the page.
+
+Generally the vertical size of the thumb marks is set to the value given in the
+height option. If it is \texttt{auto}, the size of the thumb marks is decreased,
+so that they fit all on one page. But when they get smaller than \texttt{minheight},
+instead of decreasing their size further, a~new thumbs column is started
+(which will happen here).
+
+\newpage
+
+\addthumb{B mark}{\Huge{\textbf{B}}}{brown}{pink}
+
+There! A new thumb column was started automatically!
+
+\newpage
+
+\addthumb{C mark}{\Huge{\textbf{C}}}{brown}{pink}
+
+You can, of course, keep the colour for more than one thumb mark.
+
+\newpage
+
+\addthumb{$1/1.\,955\,83$\, EUR}{\Huge{\textbf{D}}}{orange}{violet}
+
+I am just adding further thumb marks.
+
+If you are curious why the thumb mark between
+\textquotedblleft C mark\textquotedblright\ and \textquotedblleft E mark\textquotedblright\ has
+not been named \textquotedblleft D mark\textquotedblright\ but
+\textquotedblleft $1/1.\,955\,83$\, EUR\textquotedblright :
+
+$1\unit{DM}=1\unit{D\ Mark}=1\unit{Deutsche\ Mark}$\newline
+$=\frac{1}{1.\,955\,83}\,$\euro $\,=1/1.\,955\,83\unit{Euro}=1/1.\,955\,83\unit{EUR}$.
+
+\newpage
+
+Let us have a look at \verb|\thumbsoverviewverso|:
+
+\addthumbsoverviewtocontents{section}{Table of Thumbs, verso mode}%
+\thumbsoverviewverso{Table of Thumbs, verso mode}
+
+\newpage
+
+And, of course, also at \verb|\thumbsoverviewdouble|:
+
+\addthumbsoverviewtocontents{section}{Table of Thumbs, double mode}%
+\thumbsoverviewdouble{Table of Thumbs, double mode}
+
+\newpage
+
+\addthumb{E mark}{\Huge{\textbf{E}}}{lightgray}{black}
+
+I am just adding further thumb marks.
+
+\newpage
+
+\addthumb{F mark}{\Huge{\textbf{F}}}{magenta}{black}
+
+Some text.
+
+\newpage
+\thumbnewcolumn
+\addthumb{New thumb marks column}{\Huge{\textit{NC}}}{magenta}{black}
+
+There! A new thumb column was started manually!
+
+\newpage
+
+Some text.
+
+\newpage
+
+\addthumb{G mark}{\Huge{\textbf{G}}}{orange}{violet}
+
+I just added another thumb mark.
+
+\newpage
+
+\pagecolor{green}
+
+\makeatletter
+\ltx@ifpackageloaded{hyperref}{% hyperref loaded
+\phantomsection%
+}{% hyperref not loaded
+}%
+\makeatother
+
+% \end{macrocode}
+% \pagebreak
+% \begin{macrocode}
+\label{greenpage}
+
+Some faulty pdf-viewer sometimes (for the same document!)
+adds a white line at the bottom and right side of the document
+when presenting it. This does not change the printed version.
+To test for this problem, this page has been completely coloured.
+(Probably better exclude this page from printing!)
+
+\textsc{Heiko Oberdiek} wrote at Tue, 26 Apr 2011 14:13:29 +0200
+in the \newline
+comp.text.tex newsgroup (see e.\,g. \newline
+\url{http://groups.google.com/group/de.comp.text.tex/msg/b3aea4a60e1c3737}):\newline
+\textquotedblleft Der Ursprung ist 0 0,
+da gibt es nicht viel zu runden; bei den anderen Seiten
+werden pt als bp in die PDF-Datei geschrieben, d.h.
+der Balken ist um 72.27/72 zu gro\ss{}, das
+sollte auch Rundungsfehler abdecken.\textquotedblright
+
+(The origin is 0 0, there is not much to be rounded;
+for the other sides the $\unit{pt}$ are written as $\unit{bp}$ into
+the pdf-file, i.\,e. the rule is too large by $72.27/72$, which
+should cover also rounding errors.)
+
+The thumb marks are also too large - on purpose! This has been done
+to assure, that they cover the page up to its (paper) border,
+therefore they are placed a little bit over the paper margin.
+
+Now I red somewhere in the net (should have remembered to note the url),
+that white margins are presented, whenever there is some object outside
+of the page. Thus, it is a feature, not a bug?!
+What I do not understand: The same document sometimes is presented
+with white lines and sometimes without (same viewer, same PC).\newline
+But at least it does not influence the printed version.
+
+\newpage
+
+\pagecolor{white}
+
+It is possible to use the Table of Thumbs more than once (for example
+at the beginning and the end of the document) and to refer to them via e.\,g.
+\verb|\pageref{TableOfThumbs1}, \pageref{TableOfThumbs2}|,... ,
+here: page \pageref{TableOfThumbs1}, page \pageref{TableOfThumbs2},
+and via e.\,g. \verb|\pageref{TableOfThumbs}| it is referred to the last used
+Table of Thumbs (for compatibility with older package versions).
+If there is only one Table of Thumbs, this one is also the last one, of course.
+Here it is at page \pageref{TableOfThumbs}.\newline
+
+Now let us have a look at \verb|\thumbsoverviewback|:
+
+\addthumbsoverviewtocontents{section}{Table of Thumbs, back mode}%
+\thumbsoverviewback{Table of Thumbs, back mode}
+
+\newpage
+
+Text can be placed after any of the Tables of Thumbs, of course.
+
+\end{document}
+%</example>
+% \end{macrocode}
+%
+% \pagebreak
+%
+% \StopEventually{}
+%
+% \section{The implementation}
+%
+% We start off by checking that we are loading into \LaTeXe{} and
+% announcing the name and version of this package.
+%
+% \begin{macrocode}
+%<*package>
+% \end{macrocode}
+%
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}[2011/06/27]
+\ProvidesPackage{thumbs}[2014/03/09 v1.0q
+ Thumb marks and overview page(s) (HMM)]
+
+% \end{macrocode}
+%
+% A short description of the \xpackage{thumbs} package:
+%
+% \begin{macrocode}
+%% This package allows to create a customizable thumb index,
+%% providing a quick and easy reference method for large documents,
+%% as well as an overview page.
+
+% \end{macrocode}
+%
+% For possible SW(P) users, we issue a warning. Unfortunately, we cannot check
+% for the used software (Can we? \xfile{tcilatex.tex} is \emph{probably} exactly there
+% when SW(P) is used, but it \emph{could} also be there without SW(P) for compatibility
+% reasons.), and there will be a stack overflow when using \xpackage{hyperref}
+% even before the \xpackage{thumbs} package is loaded, thus the warning might not
+% even reach the users. The options for those packages might be changed by the user~--
+% I~neither tested all available options nor the current \xpackage{thumbs} package,
+% thus first test, whether the document can be compiled with these options,
+% and then try to change them according to your wishes
+% (\emph{or just get a current \TeX{} distribution instead!}).
+%
+% \begin{macrocode}
+\IfFileExists{tcilatex.tex}{% Quite probably SWP/SW/SN
+ \PackageWarningNoLine{thumbs}{%
+ When compiling with SWP 5.50 Build 2960\MessageBreak%
+ (copyright MacKichan Software, Inc.)\MessageBreak%
+ and using an older version of the thumbs package\MessageBreak%
+ these additional packages were needed:\MessageBreak%
+ \string\usepackage[T1]{fontenc}\MessageBreak%
+ \string\usepackage{amsfonts}\MessageBreak%
+ \string\usepackage[math]{cellspace}\MessageBreak%
+ \string\usepackage{xcolor}\MessageBreak%
+ \string\pagecolor{white}\MessageBreak%
+ \string\providecommand{\string\QTO}[2]{\string##2}\MessageBreak%
+ especially before hyperref and thumbs,\MessageBreak%
+ but best right after the \string\documentclass!%
+ }%
+ }{% Probably not SWP/SW/SN
+ }
+
+% \end{macrocode}
+%
+% For the handling of the options we need the \xpackage{kvoptions}
+% package of \textsc{Heiko Oberdiek} (see subsection~\ref{ss:Downloads}):
+%
+% \begin{macrocode}
+\RequirePackage{kvoptions}[2011/06/30]% v3.11
+% \end{macrocode}
+%
+% as well as some other packages:
+%
+% \begin{macrocode}
+\RequirePackage{atbegshi}[2011/10/05]% v1.16
+\RequirePackage{xcolor}[2007/01/21]% v2.11
+\RequirePackage{picture}[2009/10/11]% v1.3
+\RequirePackage{alphalph}[2011/05/13]% v2.4
+% \end{macrocode}
+%
+% For the total number of the current page we need the \xpackage{pageslts}
+% package of myself (see subsection~\ref{ss:Downloads}). It also loads
+% the \xpackage{undolabl} package, which is needed for |\overridelabel|:
+%
+% \begin{macrocode}
+\RequirePackage{pageslts}[2014/01/19]% v1.2c
+\RequirePackage{pagecolor}[2012/02/23]% v1.0e
+\RequirePackage{rerunfilecheck}[2011/04/15]% v1.7
+\RequirePackage{infwarerr}[2010/04/08]% v1.3
+\RequirePackage{ltxcmds}[2011/11/09]% v1.22
+\RequirePackage{atveryend}[2011/06/30]% v1.8
+% \end{macrocode}
+%
+% A last information for the user:
+%
+% \begin{macrocode}
+%% thumbs may work with earlier versions of LaTeX2e and those packages,
+%% but this was not tested. Please consider updating your LaTeX contribution
+%% and packages to the most recent version (if they are not already the most
+%% recent version).
+
+% \end{macrocode}
+% See subsection~\ref{ss:Downloads} about how to get them.\\
+%
+% \LaTeXe{} 2011/06/27 changed the |\enddocument| command and thus
+% broke the \xpackage{atveryend} package, which was then fixed.
+% If new \LaTeXe{} and old \xpackage{atveryend} are combined,
+% |\AtVeryVeryEnd| will never be called.
+% |\@ifl@t@r\fmtversion| is from |\@needsf@rmat| as in
+% \texttt{File L: ltclass.dtx Date: 2007/08/05 Version v1.1h}, line~259,
+% of The \LaTeXe{} Sources
+% by \textsc{Johannes Braams, David Carlisle, Alan Jeffrey, Leslie Lamport, %
+% Frank Mittelbach, Chris Rowley, and Rainer Sch\"{o}pf}
+% as of 2011/06/27, p.~464.
+%
+% \begin{macrocode}
+\@ifl@t@r\fmtversion{2011/06/27}% or possibly even newer
+{\@ifpackagelater{atveryend}{2011/06/29}%
+ {% 2011/06/30, v1.8, or even more recent: OK
+ }{% else: older package version, no \AtVeryVeryEnd
+ \PackageError{thumbs}{Outdated atveryend package version}{%
+ LaTeX 2011/06/27 has changed \string\enddocument\space and thus broken the\MessageBreak%
+ \string\AtVeryVeryEnd\space command/hooking of atveryend package as of\MessageBreak%
+ 2011/04/23, v1.7. Package versions 2011/06/30, v1.8, and later work with\MessageBreak%
+ the new LaTeX format, but some older package version was loaded.\MessageBreak%
+ Please update to the newer atveryend package.\MessageBreak%
+ For fixing this problem until the updated package is installed,\MessageBreak%
+ \string\let\string\AtVeryVeryEnd\string\AtEndAfterFileList\MessageBreak%
+ is used now, fingers crossed.%
+ }%
+ \let\AtVeryVeryEnd\AtEndAfterFileList%
+ \AtEndAfterFileList{% if there is \AtVeryVeryEnd inside \AtEndAfterFileList
+ \let\AtEndAfterFileList\ltx@firstofone%
+ }
+ }
+}{% else: older fmtversion: OK
+% \end{macrocode}
+%
+% In this case the used \TeX{} format is outdated, but when\\
+% |\NeedsTeXFormat{LaTeX2e}[2011/06/27]|\\
+% is executed at the beginning of \xpackage{regstats} package,
+% the appropriate warning message is issued automatically
+% (and \xpackage{thumbs} probably also works with older versions).
+%
+% \begin{macrocode}
+}
+
+% \end{macrocode}
+%
+% The options are introduced:
+%
+% \begin{macrocode}
+\SetupKeyvalOptions{family=thumbs,prefix=thumbs@}
+\DeclareStringOption{linefill}[dots]% \thumbs@linefill
+\DeclareStringOption[rule]{thumblink}[rule]
+\DeclareStringOption[47pt]{minheight}[47pt]
+\DeclareStringOption{height}[auto]
+\DeclareStringOption{width}[auto]
+\DeclareStringOption{distance}[2mm]
+\DeclareStringOption{topthumbmargin}[auto]
+\DeclareStringOption{bottomthumbmargin}[auto]
+\DeclareStringOption[5pt]{eventxtindent}[5pt]
+\DeclareStringOption[5pt]{oddtxtexdent}[5pt]
+\DeclareStringOption[0pt]{evenmarkindent}[0pt]
+\DeclareStringOption[0pt]{oddmarkexdent}[0pt]
+\DeclareStringOption[0pt]{evenprintvoffset}[0pt]
+\DeclareBoolOption[false]{txtcentered}
+\DeclareBoolOption[true]{ignorehoffset}
+\DeclareBoolOption[true]{ignorevoffset}
+\DeclareBoolOption{nophantomsection}% false by default, but true if used
+\DeclareBoolOption[true]{verbose}
+\DeclareComplementaryOption{silent}{verbose}
+\DeclareBoolOption{draft}
+\DeclareComplementaryOption{final}{draft}
+\DeclareBoolOption[false]{hidethumbs}
+% \end{macrocode}
+%
+% \DescribeMacro{obsolete options}
+% The options |pagecolor|, |evenindent|, and |oddexdent| are obsolete now,
+% but for compatibility with older documents they are still provided
+% at the time being (will be removed in some future version).
+%
+% \begin{macrocode}
+%% Obsolete options:
+\DeclareStringOption{pagecolor}
+\DeclareStringOption{evenindent}
+\DeclareStringOption{oddexdent}
+
+\ProcessKeyvalOptions*
+
+% \end{macrocode}
+%
+% \pagebreak
+%
+% The (background) page colour is set to |\thepagecolor| (from the
+% \xpackage{pagecolor} package), because the \xpackage{xcolour} package
+% needs a defined colour here (it~can be changed later).
+%
+% \begin{macrocode}
+\ifx\thumbs@pagecolor\empty\relax
+ \pagecolor{\thepagecolor}
+\else
+ \PackageError{thumbs}{Option pagecolor is obsolete}{%
+ Instead the pagecolor package is used.\MessageBreak%
+ Use \string\pagecolor{...}\space after \string\usepackage[...]{thumbs}\space and\MessageBreak%
+ before \string\begin{document}\space to define a background colour\MessageBreak%
+ of the pages}
+ \pagecolor{\thumbs@pagecolor}
+\fi
+
+\ifx\thumbs@evenindent\empty\relax
+\else
+ \PackageError{thumbs}{Option evenindent is obsolete}{%
+ Option "evenindent" was renamed to "eventxtindent",\MessageBreak%
+ the obsolete "evenindent" is no longer regarded.\MessageBreak%
+ Please change your document accordingly}
+\fi
+
+\ifx\thumbs@oddexdent\empty\relax
+\else
+ \PackageError{thumbs}{Option oddexdent is obsolete}{%
+ Option "oddexdent" was renamed to "oddtxtexdent",\MessageBreak%
+ the obsolete "oddexdent" is no longer regarded.\MessageBreak%
+ Please change your document accordingly}
+\fi
+
+% \end{macrocode}
+%
+% \DescribeMacro{ignorehoffset}
+% \DescribeMacro{ignorevoffset}
+% Usually |\hoffset| and |\voffset| should be regarded, but moving the
+% thumb marks away from the paper edge probably makes them useless.
+% Therefore |\hoffset| and |\voffset| are ignored by default, or
+% when option |ignorehoffset| or |ignorehoffset=true| is used
+% (and |ignorevoffset| or |ignorevoffset=true|, respectively).
+% But in case that the user wants to print at one sort of paper
+% but later trim it to another one, regarding the offsets would be
+% necessary. Therefore |ignorehoffset=false| and |ignorevoffset=false|
+% can be used to regard these offsets. (Combinations
+% |ignorehoffset=true, ignorevoffset=false| and
+% |ignorehoffset=false, ignorevoffset=true| are also possible.)
+%
+% \begin{macrocode}
+\ifthumbs@ignorehoffset
+ \PackageInfo{thumbs}{%
+ Option ignorehoffset NOT =false:\MessageBreak%
+ hoffset will be ignored.\MessageBreak%
+ To make thumbs regard hoffset use option\MessageBreak%
+ ignorehoffset=false}
+ \gdef\th@bmshoffset{0pt}
+\else
+ \PackageInfo{thumbs}{%
+ Option ignorehoffset=false:\MessageBreak%
+ hoffset will be regarded.\MessageBreak%
+ This might move the thumb marks away from the paper edge}
+ \gdef\th@bmshoffset{\hoffset}
+\fi
+
+\ifthumbs@ignorevoffset
+ \PackageInfo{thumbs}{%
+ Option ignorevoffset NOT =false:\MessageBreak%
+ voffset will be ignored.\MessageBreak%
+ To make thumbs regard voffset use option\MessageBreak%
+ ignorevoffset=false}
+ \gdef\th@bmsvoffset{-\voffset}
+\else
+ \PackageInfo{thumbs}{%
+ Option ignorevoffset=false:\MessageBreak%
+ voffset will be regarded.\MessageBreak%
+ This might move the thumb mark outside of the printable area}
+ \gdef\th@bmsvoffset{\voffset}
+\fi
+
+% \end{macrocode}
+%
+% \DescribeMacro{linefill}
+% We process the |linefill| option value:
+%
+% \begin{macrocode}
+\ifx\thumbs@linefill\empty%
+ \gdef\th@mbs@linefill{\hspace*{\fill}}
+\else
+ \def\th@mbstest{line}%
+ \ifx\thumbs@linefill\th@mbstest%
+ \gdef\th@mbs@linefill{\hrulefill}
+ \else
+ \def\th@mbstest{dots}%
+ \ifx\thumbs@linefill\th@mbstest%
+ \gdef\th@mbs@linefill{\dotfill}
+ \else
+ \PackageError{thumbs}{Option linefill with invalid value}{%
+ Option linefill has value "\thumbs@linefill ".\MessageBreak%
+ Valid values are "" (empty), "line", or "dots".\MessageBreak%
+ "" (empty) will be used now.\MessageBreak%
+ }
+ \gdef\th@mbs@linefill{\hspace*{\fill}}
+ \fi
+ \fi
+\fi
+
+% \end{macrocode}
+%
+% \pagebreak
+%
+% We introduce new dimensions for width, height, position of and vertical distance
+% between the thumb marks and some helper dimensions.
+%
+% \begin{macrocode}
+\newdimen\th@mbwidthx
+
+\newdimen\th@mbheighty% Thumb height y
+\setlength{\th@mbheighty}{\z@}
+
+\newdimen\th@mbposx
+\newdimen\th@mbposy
+\newdimen\th@mbposyA
+\newdimen\th@mbposyB
+\newdimen\th@mbposytop
+\newdimen\th@mbposybottom
+\newdimen\th@mbwidthxtoc
+\newdimen\th@mbwidthtmp
+\newdimen\th@mbsposytocy
+\newdimen\th@mbsposytocyy
+
+% \end{macrocode}
+%
+% Horizontal indention of thumb marks text on odd/even pages
+% according to the choosen options:
+%
+% \begin{macrocode}
+\newdimen\th@mbHitO
+\setlength{\th@mbHitO}{\thumbs@oddtxtexdent}
+\newdimen\th@mbHitE
+\setlength{\th@mbHitE}{\thumbs@eventxtindent}
+
+% \end{macrocode}
+%
+% Horizontal indention of whole thumb marks on odd/even pages
+% according to the choosen options:
+%
+% \begin{macrocode}
+\newdimen\th@mbHimO
+\setlength{\th@mbHimO}{\thumbs@oddmarkexdent}
+\newdimen\th@mbHimE
+\setlength{\th@mbHimE}{\thumbs@evenmarkindent}
+
+% \end{macrocode}
+%
+% Vertical distance between thumb marks on odd/even pages
+% according to the choosen option:
+%
+% \begin{macrocode}
+\newdimen\th@mbsdistance
+\ifx\thumbs@distance\empty%
+ \setlength{\th@mbsdistance}{1mm}
+\else
+ \setlength{\th@mbsdistance}{\thumbs@distance}
+\fi
+
+% \end{macrocode}
+%
+% \begin{macrocode}
+\ifthumbs@verbose% \relax
+\else
+ \PackageInfo{thumbs}{%
+ Option verbose=false (or silent=true) found:\MessageBreak%
+ You will lose some information}
+\fi
+
+% \end{macrocode}
+%
+% We create a new |Box| for the thumbs and make some global definitions.
+%
+% \begin{macrocode}
+\newbox\ThumbsBox
+
+\gdef\th@mbs{0}
+\gdef\th@mbsmax{0}
+\gdef\th@umbsperpage{0}% will be set via .aux file
+\gdef\th@umbsperpagecount{0}
+
+\gdef\th@mbtitle{}
+\gdef\th@mbtext{}
+\gdef\th@mbtextcolour{\thepagecolor}
+\gdef\th@mbbackgroundcolour{\thepagecolor}
+\gdef\th@mbcolumn{0}
+
+\gdef\th@mbtextA{}
+\gdef\th@mbtextcolourA{\thepagecolor}
+\gdef\th@mbbackgroundcolourA{\thepagecolor}
+
+\gdef\th@mbprinting{1}
+\gdef\th@mbtoprint{0}
+\gdef\th@mbonpage{0}
+\gdef\th@mbonpagemax{0}
+
+\gdef\th@mbcolumnnew{0}
+
+\gdef\th@mbs@toc@level{}
+\gdef\th@mbs@toc@text{}
+
+\gdef\th@mbmaxwidth{0pt}
+
+\gdef\th@mb@titlelabel{}
+
+\gdef\th@mbstable{0}% number of thumb marks overview tables
+
+% \end{macrocode}
+%
+% It is checked whether writing to \jobname.tmb is allowed.
+%
+% \begin{macrocode}
+\if@filesw% \relax
+\else
+ \PackageWarningNoLine{thumbs}{No auxiliary files allowed!\MessageBreak%
+ It was not allowed to write to files.\MessageBreak%
+ A lot of packages do not work without access to files\MessageBreak%
+ like the .aux one. The thumbs package needs to write\MessageBreak%
+ to the \jobname.tmb file. To exit press\MessageBreak%
+ Ctrl+Z\MessageBreak%
+ .\MessageBreak%
+ }
+\fi
+
+% \end{macrocode}
+%
+% \begin{macro}{\th@mb@txtBox}
+% |\th@mb@txtBox| writes its second argument (most likely |\th@mb@tmp@text|)
+% in normal text size. Sometimes another text size could
+% \textquotedblleft leak\textquotedblright{} from the respective page,
+% |\normalsize| prevents this. If another text size is whished for,
+% it can always be changed inside |\th@mb@tmp@text|.
+% The colour given in the first argument (most likely |\th@mb@tmp@textcolour|)
+% is used and either |\centering| (depending on the |txtcentered| option) or
+% |\raggedleft| or |\raggedright| (depending on the third argument).
+% The forth argument determines the width of the |\parbox|.
+%
+% \begin{macrocode}
+\newcommand{\th@mb@txtBox}[4]{%
+ \parbox[c][\th@mbheighty][c]{#4}{%
+ \settowidth{\th@mbwidthtmp}{\normalsize #2}%
+ \addtolength{\th@mbwidthtmp}{-#4}%
+ \ifthumbs@txtcentered%
+ {\centering{\color{#1}\normalsize #2}}%
+ \else%
+ \def\th@mbstest{#3}%
+ \def\th@mbstestb{r}%
+ \ifx\th@mbstest\th@mbstestb%
+ \ifdim\th@mbwidthtmp >0sp\relax\hspace*{-\th@mbwidthtmp}\fi%
+ {\raggedleft\leftskip 0sp minus \textwidth{\hfill\color{#1}\normalsize{#2}}}%
+ \else% \th@mbstest = l
+ {\raggedright{\color{#1}\normalsize\hspace*{1pt}\space{#2}}}%
+ \fi%
+ \fi%
+ }%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\setth@mbheight}
+% In |\setth@mbheight| the height of a thumb mark
+% (for automatical thumb heights) is computed as\\
+% \textquotedblleft |((Thumbs extension) / (Number of Thumbs)) - (2|
+% $\times $\ |distance between Thumbs)|\textquotedblright.
+%
+% \begin{macrocode}
+\newcommand{\setth@mbheight}{%
+ \setlength{\th@mbheighty}{\z@}
+ \advance\th@mbheighty+\headheight
+ \advance\th@mbheighty+\headsep
+ \advance\th@mbheighty+\textheight
+ \advance\th@mbheighty+\footskip
+ \@tempcnta=\th@mbsmax\relax
+ \ifnum\@tempcnta>1
+ \divide\th@mbheighty\th@mbsmax
+ \fi
+ \advance\th@mbheighty-\th@mbsdistance
+ \advance\th@mbheighty-\th@mbsdistance
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak
+%
+% At the beginning of the document |\AtBeginDocument| is executed.
+% |\th@bmshoffset| and |\th@bmsvoffset| are set again, because
+% |\hoffset| and |\voffset| could have been changed.
+%
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifthumbs@ignorehoffset
+ \gdef\th@bmshoffset{0pt}
+ \else
+ \gdef\th@bmshoffset{\hoffset}
+ \fi
+ \ifthumbs@ignorevoffset
+ \gdef\th@bmsvoffset{-\voffset}
+ \else
+ \gdef\th@bmsvoffset{\voffset}
+ \fi
+ \xdef\th@mbpaperwidth{\the\paperwidth}
+ \setlength{\@tempdima}{1pt}
+ \ifdim \thumbs@minheight < \@tempdima% too small
+ \setlength{\thumbs@minheight}{1pt}
+ \else
+ \ifdim \thumbs@minheight = \@tempdima% small, but ok
+ \else
+ \ifdim \thumbs@minheight > \@tempdima% ok
+ \else
+ \PackageError{thumbs}{Option minheight has invalid value}{%
+ As value for option minheight please use\MessageBreak%
+ a number and a length unit (e.g. mm, cm, pt)\MessageBreak%
+ and no space between them\MessageBreak%
+ and include this value+unit combination in curly brackets\MessageBreak%
+ (please see the thumbs-example.tex file).\MessageBreak%
+ When pressing Return, minheight will now be set to 47pt.\MessageBreak%
+ }
+ \setlength{\thumbs@minheight}{47pt}
+ \fi
+ \fi
+ \fi
+ \setlength{\@tempdima}{\thumbs@minheight}
+% \end{macrocode}
+%
+% Thumb height |\th@mbheighty| is treated. If the value is empty,
+% it is set to |\@tempdima|, which was just defined to be $47\unit{pt}$
+% (by default, or to the value chosen by the user with package option
+% |minheight={...}|):
+%
+% \begin{macrocode}
+ \ifx\thumbs@height\empty%
+ \setlength{\th@mbheighty}{\@tempdima}
+ \else
+ \def\th@mbstest{auto}
+ \ifx\thumbs@height\th@mbstest%
+% \end{macrocode}
+%
+% If it is not empty but \texttt{auto}(matic), the value is computed
+% via |\setth@mbheight| (see above).
+%
+% \begin{macrocode}
+ \setth@mbheight
+% \end{macrocode}
+%
+% When the height is smaller than |\thumbs@minheight| (default: $47\unit{pt}$),
+% this is too small, and instead a now column/page of thumb marks is used.
+%
+% \begin{macrocode}
+ \ifdim \th@mbheighty < \thumbs@minheight
+ \PackageWarningNoLine{thumbs}{Thumbs not high enough:\MessageBreak%
+ Option height has value "auto". For \th@mbsmax\space thumbs per page\MessageBreak%
+ this results in a thumb height of \the\th@mbheighty.\MessageBreak%
+ This is lower than the minimal thumb height, \thumbs@minheight,\MessageBreak%
+ therefore another thumbs column will be opened.\MessageBreak%
+ If you do not want this, choose a smaller value\MessageBreak%
+ for option "minheight"%
+ }
+ \setlength{\th@mbheighty}{\z@}
+ \advance\th@mbheighty by \@tempdima% = \thumbs@minheight
+ \fi
+ \else
+% \end{macrocode}
+%
+% When a value has been given for the thumb marks' height, this fixed value is used.
+%
+% \begin{macrocode}
+ \ifthumbs@verbose
+ \edef\thumbsinfo{\the\th@mbheighty}
+ \PackageInfo{thumbs}{Now setting thumbs' height to \thumbsinfo .}
+ \fi
+ \setlength{\th@mbheighty}{\thumbs@height}
+ \fi
+ \fi
+% \end{macrocode}
+%
+% Read in the |\jobname.tmb|-file:
+%
+% \begin{macrocode}
+ \newread\@instreamthumb%
+% \end{macrocode}
+%
+% Inform the users about the dimensions of the thumb marks (look in the \xfile{log} file):
+%
+% \begin{macrocode}
+ \ifthumbs@verbose
+ \message{^^J}
+ \@PackageInfoNoLine{thumbs}{************** THUMB dimensions **************}
+ \edef\thumbsinfo{\the\th@mbheighty}
+ \@PackageInfoNoLine{thumbs}{The height of the thumb marks is \thumbsinfo}
+ \fi
+% \end{macrocode}
+%
+% Setting the thumb mark width (|\th@mbwidthx|):
+%
+% \begin{macrocode}
+ \ifthumbs@draft
+ \setlength{\th@mbwidthx}{2pt}
+ \else
+ \setlength{\th@mbwidthx}{\paperwidth}
+ \advance\th@mbwidthx-\textwidth
+ \divide\th@mbwidthx by 4
+ \setlength{\@tempdima}{0sp}
+ \ifx\thumbs@width\empty%
+ \else
+% \end{macrocode}
+% \pagebreak
+% \begin{macrocode}
+ \def\th@mbstest{auto}
+ \ifx\thumbs@width\th@mbstest%
+ \else
+ \def\th@mbstest{autoauto}
+ \ifx\thumbs@width\th@mbstest%
+ \@ifundefined{th@mbmaxwidtha}{%
+ \if@filesw%
+ \gdef\th@mbmaxwidtha{0pt}
+ \setlength{\th@mbwidthx}{\th@mbmaxwidtha}
+ \AtEndAfterFileList{
+ \PackageWarningNoLine{thumbs}{%
+ \string\th@mbmaxwidtha\space undefined.\MessageBreak%
+ Rerun to get the thumb marks width right%
+ }
+ }
+ \else
+ \PackageError{thumbs}{%
+ You cannot use option autoauto without \jobname.aux file.%
+ }
+ \fi
+ }{%\else
+ \setlength{\th@mbwidthx}{\th@mbmaxwidtha}
+ }%\fi
+ \else
+ \ifdim \thumbs@width > \@tempdima% OK
+ \setlength{\th@mbwidthx}{\thumbs@width}
+ \else
+ \PackageError{thumbs}{Thumbs not wide enough}{%
+ Option width has value "\thumbs@width".\MessageBreak%
+ This is not a valid dimension larger than zero.\MessageBreak%
+ Width will be set automatically.\MessageBreak%
+ }
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \ifthumbs@verbose
+ \edef\thumbsinfo{\the\th@mbwidthx}
+ \@PackageInfoNoLine{thumbs}{The width of the thumb marks is \thumbsinfo}
+ \ifthumbs@draft
+ \@PackageInfoNoLine{thumbs}{because thumbs package is in draft mode}
+ \fi
+ \fi
+% \end{macrocode}
+%
+% \pagebreak
+%
+% Setting the position of the first/top thumb mark. Vertical (y) position
+% is a little bit complicated, because option |\thumbs@topthumbmargin| must be handled:
+%
+% \begin{macrocode}
+ % Thumb position x \th@mbposx
+ \setlength{\th@mbposx}{\paperwidth}
+ \advance\th@mbposx-\th@mbwidthx
+ \ifthumbs@ignorehoffset
+ \advance\th@mbposx-\hoffset
+ \fi
+ \advance\th@mbposx+1pt
+ % Thumb position y \th@mbposy
+ \ifx\thumbs@topthumbmargin\empty%
+ \def\thumbs@topthumbmargin{auto}
+ \fi
+ \def\th@mbstest{auto}
+ \ifx\thumbs@topthumbmargin\th@mbstest%
+ \setlength{\th@mbposy}{1in}
+ \advance\th@mbposy+\th@bmsvoffset
+ \advance\th@mbposy+\topmargin
+ \advance\th@mbposy-\th@mbsdistance
+ \advance\th@mbposy+\th@mbheighty
+ \else
+ \setlength{\@tempdima}{-1pt}
+ \ifdim \thumbs@topthumbmargin > \@tempdima% OK
+ \else
+ \PackageWarning{thumbs}{Thumbs column starting too high.\MessageBreak%
+ Option topthumbmargin has value "\thumbs@topthumbmargin ".\MessageBreak%
+ topthumbmargin will be set to -1pt.\MessageBreak%
+ }
+ \gdef\thumbs@topthumbmargin{-1pt}
+ \fi
+ \setlength{\th@mbposy}{\thumbs@topthumbmargin}
+ \advance\th@mbposy-\th@mbsdistance
+ \advance\th@mbposy+\th@mbheighty
+ \fi
+ \setlength{\th@mbposytop}{\th@mbposy}
+ \ifthumbs@verbose%
+ \setlength{\@tempdimc}{\th@mbposytop}
+ \advance\@tempdimc-\th@mbheighty
+ \advance\@tempdimc+\th@mbsdistance
+ \edef\thumbsinfo{\the\@tempdimc}
+ \@PackageInfoNoLine{thumbs}{The top thumb margin is \thumbsinfo}
+ \fi
+% \end{macrocode}
+%
+% \pagebreak
+%
+% Setting the lowest position of a thumb mark, according to option |\thumbs@bottomthumbmargin|:
+%
+% \begin{macrocode}
+ % Max. thumb position y \th@mbposybottom
+ \ifx\thumbs@bottomthumbmargin\empty%
+ \gdef\thumbs@bottomthumbmargin{auto}
+ \fi
+ \def\th@mbstest{auto}
+ \ifx\thumbs@bottomthumbmargin\th@mbstest%
+ \setlength{\th@mbposybottom}{1in}
+ \ifthumbs@ignorevoffset% \relax
+ \else \advance\th@mbposybottom+\th@bmsvoffset
+ \fi
+ \advance\th@mbposybottom+\topmargin
+ \advance\th@mbposybottom-\th@mbsdistance
+ \advance\th@mbposybottom+\th@mbheighty
+ \advance\th@mbposybottom+\headheight
+ \advance\th@mbposybottom+\headsep
+ \advance\th@mbposybottom+\textheight
+ \advance\th@mbposybottom+\footskip
+ \advance\th@mbposybottom-\th@mbsdistance
+ \advance\th@mbposybottom-\th@mbheighty
+ \else
+ \setlength{\@tempdima}{\paperheight}
+ \advance\@tempdima by -\thumbs@bottomthumbmargin
+ \advance\@tempdima by -\th@mbposytop
+ \advance\@tempdima by -\th@mbsdistance
+ \advance\@tempdima by -\th@mbheighty
+ \advance\@tempdima by -\th@mbsdistance
+ \ifdim \@tempdima > 0sp \relax
+ \else
+ \setlength{\@tempdima}{\paperheight}
+ \advance\@tempdima by -\th@mbposytop
+ \advance\@tempdima by -\th@mbsdistance
+ \advance\@tempdima by -\th@mbheighty
+ \advance\@tempdima by -\th@mbsdistance
+ \advance\@tempdima by -1pt
+ \PackageWarning{thumbs}{Thumbs column ending too high.\MessageBreak%
+ Option bottomthumbmargin has value "\thumbs@bottomthumbmargin ".\MessageBreak%
+ bottomthumbmargin will be set to "\the\@tempdima".\MessageBreak%
+ }
+ \xdef\thumbs@bottomthumbmargin{\the\@tempdima}
+ \fi
+% \end{macrocode}
+% \pagebreak
+% \begin{macrocode}
+ \setlength{\@tempdima}{\thumbs@bottomthumbmargin}
+ \setlength{\@tempdimc}{-1pt}
+ \ifdim \@tempdima < \@tempdimc%
+ \PackageWarning{thumbs}{Thumbs column ending too low.\MessageBreak%
+ Option bottomthumbmargin has value "\thumbs@bottomthumbmargin ".\MessageBreak%
+ bottomthumbmargin will be set to -1pt.\MessageBreak%
+ }
+ \gdef\thumbs@bottomthumbmargin{-1pt}
+ \fi
+ \setlength{\th@mbposybottom}{\paperheight}
+ \advance\th@mbposybottom-\thumbs@bottomthumbmargin
+ \fi
+ \ifthumbs@verbose%
+ \setlength{\@tempdimc}{\paperheight}
+ \advance\@tempdimc by -\th@mbposybottom
+ \edef\thumbsinfo{\the\@tempdimc}
+ \@PackageInfoNoLine{thumbs}{The bottom thumb margin is \thumbsinfo}
+ \@PackageInfoNoLine{thumbs}{**********************************************}
+ \message{^^J}
+ \fi
+% \end{macrocode}
+%
+% |\th@mbposyA| is set to the top-most vertical thumb position~(y). Because it will be increased
+% (i.\,e.~the thumb positions will move downwards on the page), |\th@mbsposytocyy| is used
+% to remember this position unchanged.
+%
+% \begin{macrocode}
+ \advance\th@mbposy-\th@mbheighty% because it will be advanced also for the first thumb
+ \setlength{\th@mbposyA}{\th@mbposy}% \th@mbposyA will change.
+ \setlength{\th@mbsposytocyy}{\th@mbposy}% \th@mbsposytocyy shall not be changed.
+ }
+
+% \end{macrocode}
+%
+% \begin{macro}{\th@mb@dvance}
+% The internal command |\th@mb@dvance| is used to advance the position of the current
+% thumb by |\th@mbheighty| and |\th@mbsdistance|. If the resulting position
+% of the thumb is lower than the |\th@mbposybottom| position (i.\,e.~|\th@mbposy|
+% \emph{higher} than |\th@mbposybottom|), a~new thumb column will be started by the next
+% |\addthumb|, otherwise a blank thumb is created and |\th@mb@dvance| is calling itself
+% again. This loop continues until a new thumb column is ready to be started.
+%
+% \begin{macrocode}
+\newcommand{\th@mb@dvance}{%
+ \advance\th@mbposy+\th@mbheighty%
+ \advance\th@mbposy+\th@mbsdistance%
+ \ifdim\th@mbposy>\th@mbposybottom%
+ \advance\th@mbposy-\th@mbheighty%
+ \advance\th@mbposy-\th@mbsdistance%
+ \else%
+ \advance\th@mbposy-\th@mbheighty%
+ \advance\th@mbposy-\th@mbsdistance%
+ \thumborigaddthumb{}{}{\string\thepagecolor}{\string\thepagecolor}%
+ \th@mb@dvance%
+ \fi%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thumbnewcolumn}
+% With the command |\thumbnewcolumn| a new column can be started, even if the current one
+% was not filled. This could be useful e.\,g. for a dictionary, which uses one column for
+% translations from language~A to language~B, and the second column for translations
+% from language~B to language~A. But in that case one probably should increase the
+% size of the thumb marks, so that $26$~thumb marks (in~case of the Latin alphabet)
+% fill one thumb column. Do not use |\thumbnewcolumn| on a page where |\addthumb| was
+% already used, but use |\addthumb| immediately after |\thumbnewcolumn|.
+%
+% \begin{macrocode}
+\newcommand{\thumbnewcolumn}{%
+ \ifx\th@mbtoprint\pagesLTS@one%
+ \PackageError{thumbs}{\string\thumbnewcolumn\space after \string\addthumb }{%
+ On page \thepage\space (approx.) \string\addthumb\space was used and *afterwards* %
+ \string\thumbnewcolumn .\MessageBreak%
+ When you want to use \string\thumbnewcolumn , do not use an \string\addthumb\space %
+ on the same\MessageBreak%
+ page before \string\thumbnewcolumn . Thus, either remove the \string\addthumb , %
+ or use a\MessageBreak%
+ \string\pagebreak , \string\newpage\space etc. before \string\thumbnewcolumn .\MessageBreak%
+ (And remember to use an \string\addthumb\space*after* \string\thumbnewcolumn .)\MessageBreak%
+ Your command \string\thumbnewcolumn\space will be ignored now.%
+ }%
+ \else%
+ \PackageWarning{thumbs}{%
+ Starting of another column requested by command\MessageBreak%
+ \string\thumbnewcolumn.\space Only use this command directly\MessageBreak%
+ before an \string\addthumb\space - did you?!\MessageBreak%
+ }%
+ \gdef\th@mbcolumnnew{1}%
+ \th@mb@dvance%
+ \gdef\th@mbprinting{0}%
+ \gdef\th@mbcolumnnew{2}%
+ \fi%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\addtitlethumb}
+% When a thumb mark shall not or cannot be placed on a page, e.\,g.~at the title page or
+% when using |\includepdf| from \xpackage{pdfpages} package, but the reference in the thumb
+% marks overview nevertheless shall name that page number and hyperlink to that page,
+% |\addtitlethumb| can be used at the following page. It has five arguments. The arguments
+% one to four are identical to the ones of |\addthumb| (see immediately below),
+% and the fifth argument consists of the label of the page, where the hyperlink
+% at the thumb marks overview page shall link to. For the first page the label
+% \texttt{pagesLTS.0} can be use, which is already placed there by the used
+% \xpackage{pageslts} package.
+%
+% \begin{macrocode}
+\newcommand{\addtitlethumb}[5]{%
+ \xdef\th@mb@titlelabel{#5}%
+ \addthumb{#1}{#2}{#3}{#4}%
+ \xdef\th@mb@titlelabel{}%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak
+%
+% \begin{macro}{\thumbsnophantom}
+% To locally disable the setting of a |\phantomsection| before a thumb mark,
+% the command |\thumbsnophantom| is provided. (But at first it is not disabled.)
+%
+% \begin{macrocode}
+\gdef\th@mbsphantom{1}
+
+\newcommand{\thumbsnophantom}{\gdef\th@mbsphantom{0}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\addthumb}
+% Now the |\addthumb| command is defined, which is used to add a new
+% thumb mark to the document.
+%
+% \begin{macrocode}
+\newcommand{\addthumb}[4]{%
+ \gdef\th@mbprinting{1}%
+ \advance\th@mbposy\th@mbheighty%
+ \advance\th@mbposy\th@mbsdistance%
+ \ifdim\th@mbposy>\th@mbposybottom%
+ \PackageInfo{thumbs}{%
+ Thumbs column full, starting another column.\MessageBreak%
+ }%
+ \setlength{\th@mbposy}{\th@mbposytop}%
+ \advance\th@mbposy\th@mbsdistance%
+ \ifx\th@mbcolumn\pagesLTS@zero%
+ \xdef\th@umbsperpagecount{\th@mbs}%
+ \gdef\th@mbcolumn{1}%
+ \fi%
+ \fi%
+ \@tempcnta=\th@mbs\relax%
+ \advance\@tempcnta by 1%
+ \xdef\th@mbs{\the\@tempcnta}%
+% \end{macrocode}
+%
+% The |\addthumb| command has four parameters:
+% \begin{enumerate}
+% \item a title for the thumb mark (for the thumb marks overview page,
+% e.\,g. the chapter title),
+%
+% \item the text to be displayed in the thumb mark (for example a chapter number),
+%
+% \item the colour of the text in the thumb mark,
+%
+% \item and the background colour of the thumb mark
+% \end{enumerate}
+% (parameters in this order).
+%
+% \begin{macrocode}
+ \gdef\th@mbtitle{#1}%
+ \gdef\th@mbtext{#2}%
+ \gdef\th@mbtextcolour{#3}%
+ \gdef\th@mbbackgroundcolour{#4}%
+% \end{macrocode}
+%
+% The width of the thumb mark text is determined and compared to the width of the
+% thumb mark (rule). When the text is wider than the rule, this has to be changed
+% (either automatically with option |width={autoauto}| in the next compilation run
+% or manually by changing |width={|\ldots|}| by the user). It could be acceptable
+% to have a thumb mark text consisting of more than one line, of course, in which
+% case nothing needs to be changed. Possible horizontal movement (|\th@mbHitO|,
+% |\th@mbHitE|) has to be taken into account.
+%
+% \begin{macrocode}
+ \settowidth{\@tempdima}{\th@mbtext}%
+ \ifdim\th@mbHitO>\th@mbHitE\relax%
+ \advance\@tempdima+\th@mbHitO%
+ \else%
+ \advance\@tempdima+\th@mbHitE%
+ \fi%
+ \ifdim\@tempdima>\th@mbmaxwidth%
+ \xdef\th@mbmaxwidth{\the\@tempdima}%
+ \fi%
+ \ifdim\@tempdima>\th@mbwidthx%
+ \ifthumbs@draft% \relax
+ \else%
+ \edef\thumbsinfoa{\the\th@mbwidthx}
+ \edef\thumbsinfob{\the\@tempdima}
+ \PackageWarning{thumbs}{%
+ Thumb mark too small (width: \thumbsinfoa )\MessageBreak%
+ or its text too wide (width: \thumbsinfob )\MessageBreak%
+ }%
+ \fi%
+ \fi%
+% \end{macrocode}
+%
+% Into the |\jobname.tmb| file a |\thumbcontents| entry is written.
+% If \xpackage{hyperref} is found, a |\phantomsection| is placed (except when
+% globally disabled by option |nophantomsection| or locally by |\thumbsnophantom|),
+% a~label for the thumb mark created, and the |\thumbcontents| entry will be
+% hyperlinked to that label (except when |\addtitlethumb| was used, then the label
+% reported from the user is used -- the \xpackage{thumbs} package does \emph{not}
+% create that label!).
+%
+% \begin{macrocode}
+ \ltx@ifpackageloaded{hyperref}{% hyperref loaded
+ \ifthumbs@nophantomsection% \relax
+ \else%
+ \ifx\th@mbsphantom\pagesLTS@one%
+ \phantomsection%
+ \else%
+ \gdef\th@mbsphantom{1}%
+ \fi%
+ \fi%
+ }{% hyperref not loaded
+ }%
+ \label{thumbs.\th@mbs}%
+ \if@filesw%
+ \ifx\th@mb@titlelabel\empty%
+ \addtocontents{tmb}{\string\thumbcontents{#1}{#2}{#3}{#4}{\thepage}{thumbs.\th@mbs}{\th@mbcolumnnew}}%
+ \else%
+ \addtocounter{page}{-1}%
+ \edef\th@mb@page{\thepage}%
+ \addtocontents{tmb}{\string\thumbcontents{#1}{#2}{#3}{#4}{\th@mb@page}{\th@mb@titlelabel}{\th@mbcolumnnew}}%
+ \addtocounter{page}{+1}%
+ \fi%
+ %\else there is a problem, but the according warning message was already given earlier.
+ \fi%
+% \end{macrocode}
+%
+% Maybe there is a rare case, where more than one thumb mark will be placed
+% at one page. Probably a |\pagebreak|, |\newpage| or something similar
+% would be advisable, but nevertheless we should prepare for this case.
+% We save the properties of the thumb mark(s).
+%
+% \begin{macrocode}
+ \ifx\th@mbcolumnnew\pagesLTS@one%
+ \else%
+ \@tempcnta=\th@mbonpage\relax%
+ \advance\@tempcnta by 1%
+ \xdef\th@mbonpage{\the\@tempcnta}%
+ \fi%
+ \ifx\th@mbtoprint\pagesLTS@zero%
+ \else%
+ \ifx\th@mbcolumnnew\pagesLTS@zero%
+ \PackageWarning{thumbs}{More than one thumb at one page:\MessageBreak%
+ You placed more than one thumb mark (at least \th@mbonpage)\MessageBreak%
+ on page \thepage \space (page is approximately).\MessageBreak%
+ Maybe insert a page break?\MessageBreak%
+ }%
+ \fi%
+ \fi%
+ \ifnum\th@mbonpage=1%
+ \ifnum\th@mbonpagemax>0% \relax
+ \else \gdef\th@mbonpagemax{1}%
+ \fi%
+ \gdef\th@mbtextA{#2}%
+ \gdef\th@mbtextcolourA{#3}%
+ \gdef\th@mbbackgroundcolourA{#4}%
+ \setlength{\th@mbposyA}{\th@mbposy}%
+ \else%
+ \ifx\th@mbcolumnnew\pagesLTS@zero%
+ \@tempcnta=1\relax%
+ \edef\th@mbonpagetest{\the\@tempcnta}%
+ \@whilenum\th@mbonpagetest<\th@mbonpage\do{%
+ \advance\@tempcnta by 1%
+ \xdef\th@mbonpagetest{\the\@tempcnta}%
+ \ifnum\th@mbonpage=\th@mbonpagetest%
+ \ifnum\th@mbonpagemax<\th@mbonpage%
+ \xdef\th@mbonpagemax{\th@mbonpage}%
+ \fi%
+ \edef\th@mbtmpdef{\csname th@mbtext\AlphAlph{\the\@tempcnta}\endcsname}%
+ \expandafter\gdef\th@mbtmpdef{#2}%
+ \edef\th@mbtmpdef{\csname th@mbtextcolour\AlphAlph{\the\@tempcnta}\endcsname}%
+ \expandafter\gdef\th@mbtmpdef{#3}%
+ \edef\th@mbtmpdef{\csname th@mbbackgroundcolour\AlphAlph{\the\@tempcnta}\endcsname}%
+ \expandafter\gdef\th@mbtmpdef{#4}%
+ \fi%
+ }%
+ \else%
+ \ifnum\th@mbonpagemax<\th@mbonpage%
+ \xdef\th@mbonpagemax{\th@mbonpage}%
+ \fi%
+ \fi%
+ \fi%
+ \ifx\th@mbcolumnnew\pagesLTS@two%
+ \gdef\th@mbcolumnnew{0}%
+ \fi%
+ \gdef\th@mbtoprint{1}%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\stopthumb}
+% When a page (or pages) shall have no thumb marks, |\stopthumb| stops
+% the issuing of thumb marks (until another thumb mark is placed or
+% |\continuethumb| is used).
+%
+% \begin{macrocode}
+\newcommand{\stopthumb}{\gdef\th@mbprinting{0}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\continuethumb}
+% |\continuethumb| continues the issuing of thumb marks (equal to the one
+% before this was stopped by |\stopthumb|).
+%
+% \begin{macrocode}
+\newcommand{\continuethumb}{\gdef\th@mbprinting{1}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \pagebreak
+%
+% \begin{macro}{\thumbcontents}
+% The \textbf{internal} command |\thumbcontents| (which will be read in from the
+% |\jobname.tmb| file) creates a thumb mark entry on the overview page(s).
+% Its seven parameters are
+% \begin{enumerate}
+% \item the title for the thumb mark,
+%
+% \item the text to be displayed in the thumb mark,
+%
+% \item the colour of the text in the thumb mark,
+%
+% \item the background colour of the thumb mark,
+%
+% \item the first page of this thumb mark,
+%
+% \item the label where it should hyperlink to
+%
+% \item and an indicator, whether |\thumbnewcolumn| is just issuing blank thumbs
+% to fill a column
+% \end{enumerate}
+% (parameters in this order). Without \xpackage{hyperref} the $6^ \textrm{th} $ parameter
+% is just ignored.
+%
+% \begin{macrocode}
+\newcommand{\thumbcontents}[7]{%
+ \advance\th@mbposy\th@mbheighty%
+ \advance\th@mbposy\th@mbsdistance%
+ \ifdim\th@mbposy>\th@mbposybottom%
+ \setlength{\th@mbposy}{\th@mbposytop}%
+ \advance\th@mbposy\th@mbsdistance%
+ \fi%
+ \def\th@mb@tmp@title{#1}%
+ \def\th@mb@tmp@text{#2}%
+ \def\th@mb@tmp@textcolour{#3}%
+ \def\th@mb@tmp@backgroundcolour{#4}%
+ \def\th@mb@tmp@page{#5}%
+ \def\th@mb@tmp@label{#6}%
+ \def\th@mb@tmp@column{#7}%
+ \ifx\th@mb@tmp@column\pagesLTS@two%
+ \def\th@mb@tmp@column{0}%
+ \fi%
+ \setlength{\th@mbwidthxtoc}{\paperwidth}%
+ \advance\th@mbwidthxtoc-1in%
+% \end{macrocode}
+%
+% Depending on which side the thumb marks should be placed
+% the according dimensions have to be adapted.
+%
+% \begin{macrocode}
+ \def\th@mbstest{r}%
+ \ifx\th@mbstest\th@mbsprintpage% r
+ \advance\th@mbwidthxtoc-\th@mbHimO%
+ \advance\th@mbwidthxtoc-\oddsidemargin%
+ \setlength{\@tempdimc}{1in}%
+ \advance\@tempdimc+\oddsidemargin%
+ \else% l
+ \advance\th@mbwidthxtoc-\th@mbHimE%
+ \advance\th@mbwidthxtoc-\evensidemargin%
+ \setlength{\@tempdimc}{\th@bmshoffset}%
+ \advance\@tempdimc-\hoffset
+ \fi%
+ \setlength{\th@mbposyB}{-\th@mbposy}%
+ \if@twoside%
+ \ifodd\c@CurrentPage%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \else%
+ \setlength{\@tempdimb}{-\th@mbposy}%
+ \advance\@tempdimb-\thumbs@evenprintvoffset%
+ \setlength{\th@mbposyB}{\@tempdimb}%
+ \fi%
+ \else%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \setlength{\@tempdimb}{-\th@mbposy}%
+ \advance\@tempdimb-\thumbs@evenprintvoffset%
+ \setlength{\th@mbposyB}{\@tempdimb}%
+ \fi%
+ \fi%
+ \fi%
+ \def\th@mbstest{l}%
+ \ifx\th@mbstest\th@mbsprintpage% l
+ \advance\@tempdimc+\th@mbHimE%
+ \fi%
+ \put(\@tempdimc,\th@mbposyB){%
+ \ifx\th@mbstest\th@mbsprintpage% l
+% \end{macrocode}
+%
+% Increase |\th@mbwidthxtoc| by the absolute value of |\evensidemargin|.\\
+% With the \xpackage{bigintcalc} package it would also be possible to use:\\
+% |\setlength{\@tempdimb}{\evensidemargin}%|\\
+% |\@settopoint\@tempdimb%|\\
+% |\advance\th@mbwidthxtoc+\bigintcalcSgn{\expandafter\strip@pt \@tempdimb}\evensidemargin%|
+%
+% \begin{macrocode}
+ \ifdim\evensidemargin <0sp\relax%
+ \advance\th@mbwidthxtoc-\evensidemargin%
+ \else% >=0sp
+ \advance\th@mbwidthxtoc+\evensidemargin%
+ \fi%
+ \fi%
+ \begin{picture}(0,0)%
+% \end{macrocode}
+%
+% When the option |thumblink=rule| was chosen, the whole rule is made into a hyperlink.
+% Otherwise the rule is created without hyperlink (here).
+%
+% \begin{macrocode}
+ \def\th@mbstest{rule}%
+ \ifx\thumbs@thumblink\th@mbstest%
+ \ifx\th@mb@tmp@column\pagesLTS@zero%
+ {\color{\th@mb@tmp@backgroundcolour}%
+ \hyperref[\th@mb@tmp@label]{\rule{\th@mbwidthxtoc}{\th@mbheighty}}%
+ }%
+ \else%
+% \end{macrocode}
+%
+% When |\th@mb@tmp@column| is not zero, then this is a blank thumb mark from |thumbnewcolumn|.
+%
+% \begin{macrocode}
+ {\color{\th@mb@tmp@backgroundcolour}\rule{\th@mbwidthxtoc}{\th@mbheighty}}%
+ \fi%
+ \else%
+ {\color{\th@mb@tmp@backgroundcolour}\rule{\th@mbwidthxtoc}{\th@mbheighty}}%
+ \fi%
+ \end{picture}%
+% \end{macrocode}
+%
+% When |\th@mbsprintpage| is |l|, before the picture |\th@mbwidthxtoc| was changed,
+% which must be reverted now.
+%
+% \begin{macrocode}
+ \ifx\th@mbstest\th@mbsprintpage% l
+ \advance\th@mbwidthxtoc-\evensidemargin%
+ \fi%
+% \end{macrocode}
+%
+% When |\th@mb@tmp@column| is zero, then this is \textbf{not} a blank thumb mark from |thumbnewcolumn|,
+% and we need to fill it with some content. If it is not zero, it is a blank thumb mark,
+% and nothing needs to be done here.
+%
+% \begin{macrocode}
+ \ifx\th@mb@tmp@column\pagesLTS@zero%
+ \setlength{\th@mbwidthxtoc}{\paperwidth}%
+ \advance\th@mbwidthxtoc-1in%
+ \advance\th@mbwidthxtoc-\hoffset%
+ \ifx\th@mbstest\th@mbsprintpage% l
+ \advance\th@mbwidthxtoc-\evensidemargin%
+ \else%
+ \advance\th@mbwidthxtoc-\oddsidemargin%
+ \fi%
+ \advance\th@mbwidthxtoc-\th@mbwidthx%
+ \advance\th@mbwidthxtoc-20pt%
+ \ifdim\th@mbwidthxtoc>\textwidth%
+ \setlength{\th@mbwidthxtoc}{\textwidth}%
+ \fi%
+% \end{macrocode}
+%
+% \pagebreak
+%
+% Depending on which side the thumb marks should be placed the
+% according dimensions have to be adapted here, too.
+%
+% \begin{macrocode}
+ \ifx\th@mbstest\th@mbsprintpage% l
+ \begin{picture}(-\th@mbHimE,0)(-6pt,-0.5\th@mbheighty+384930sp)%
+ \bgroup%
+ \setlength{\parindent}{0pt}%
+ \setlength{\@tempdimc}{\th@mbwidthx}%
+ \advance\@tempdimc-\th@mbHitO%
+ \setlength{\@tempdimb}{\th@mbwidthx}%
+ \advance\@tempdimb-\th@mbHitE%
+ \ifodd\c@CurrentPage%
+ \if@twoside%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
+ \else%
+ \hspace*{+\th@mbHitE}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
+ \fi%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
+ \fi%
+ \else%
+ \if@twoside%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \hspace*{+\th@mbHitE}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
+ \fi%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
+ \fi%
+ \fi%
+ \egroup%
+ \end{picture}%
+ \setlength{\@tempdimc}{-1in}%
+ \advance\@tempdimc-\evensidemargin%
+ \else% r
+ \setlength{\@tempdimc}{0pt}%
+ \fi%
+ \begin{picture}(0,0)(\@tempdimc,-0.5\th@mbheighty+384930sp)%
+ \bgroup%
+ \setlength{\parindent}{0pt}%
+ \vbox%
+ {\hsize=\th@mbwidthxtoc {%
+% \end{macrocode}
+%
+% Depending on the value of option |thumblink|, parts of the text are made into hyperlinks:
+% \begin{description}
+% \item[- |none|] creates \emph{none} hyperlink
+%
+% \begin{macrocode}
+ \def\th@mbstest{none}%
+ \ifx\thumbs@thumblink\th@mbstest%
+ {\color{\th@mb@tmp@textcolour}\noindent \th@mb@tmp@title%
+ \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
+ }%
+ \else%
+% \end{macrocode}
+%
+% \item[- |title|] hyperlinks the \emph{titles} of the thumb marks
+%
+% \begin{macrocode}
+ \def\th@mbstest{title}%
+ \ifx\thumbs@thumblink\th@mbstest%
+ {\color{\th@mb@tmp@textcolour}\noindent%
+ \hyperref[\th@mb@tmp@label]{\th@mb@tmp@title}%
+ \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
+ }%
+ \else%
+% \end{macrocode}
+%
+% \item[- |page|] hyperlinks the \emph{page} numbers of the thumb marks
+%
+% \begin{macrocode}
+ \def\th@mbstest{page}%
+ \ifx\thumbs@thumblink\th@mbstest%
+ {\color{\th@mb@tmp@textcolour}\noindent%
+ \th@mb@tmp@title%
+ \leaders\box \ThumbsBox {\th@mbs@linefill \pageref{\th@mb@tmp@label}}%
+ }%
+ \else%
+% \end{macrocode}
+%
+% \item[- |titleandpage|] hyperlinks the \emph{title and page} numbers of the thumb marks
+%
+% \begin{macrocode}
+ \def\th@mbstest{titleandpage}%
+ \ifx\thumbs@thumblink\th@mbstest%
+ {\color{\th@mb@tmp@textcolour}\noindent%
+ \hyperref[\th@mb@tmp@label]{\th@mb@tmp@title}%
+ \leaders\box \ThumbsBox {\th@mbs@linefill \pageref{\th@mb@tmp@label}}%
+ }%
+ \else%
+% \end{macrocode}
+%
+% \item[- |line|] hyperlinks the whole \emph{line}, i.\,e. title, dots (or line or whatsoever)%
+% and page numbers of the thumb marks
+%
+% \begin{macrocode}
+ \def\th@mbstest{line}%
+ \ifx\thumbs@thumblink\th@mbstest%
+ {\color{\th@mb@tmp@textcolour}\noindent%
+ \hyperref[\th@mb@tmp@label]{\th@mb@tmp@title%
+ \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}}%
+ }%
+ \else%
+% \end{macrocode}
+%
+% \item[- |rule|] hyperlinks the whole \emph{rule}, but that was already done above,%
+% so here no linking is done
+%
+% \begin{macrocode}
+ \def\th@mbstest{rule}%
+ \ifx\thumbs@thumblink\th@mbstest%
+ {\color{\th@mb@tmp@textcolour}\noindent%
+ \th@mb@tmp@title%
+ \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
+ }%
+ \else%
+% \end{macrocode}
+%
+% \end{description}
+% Another value for |\thumbs@thumblink| should never be encountered here.
+%
+% \begin{macrocode}
+ \PackageError{thumbs}{\string\thumbs@thumblink\space invalid}{%
+ \string\thumbs@thumblink\space has an invalid value,\MessageBreak%
+ although it did not have an invalid value before,\MessageBreak%
+ and the thumbs package did not change it.\MessageBreak%
+ Therefore some other package (or the user)\MessageBreak%
+ manipulated it.\MessageBreak%
+ Now setting it to "none" as last resort.\MessageBreak%
+ }%
+ \gdef\thumbs@thumblink{none}%
+ {\color{\th@mb@tmp@textcolour}\noindent%
+ \th@mb@tmp@title%
+ \leaders\box \ThumbsBox {\th@mbs@linefill \th@mb@tmp@page}%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ }%
+ }%
+ \egroup%
+ \end{picture}%
+% \end{macrocode}
+%
+% The thumb mark (with text) as set in the document outside of the thumb marks overview page(s)
+% is also presented here, except when we are printing at the left side.
+%
+% \begin{macrocode}
+ \ifx\th@mbstest\th@mbsprintpage% l; relax
+ \else%
+ \begin{picture}(0,0)(1in+\oddsidemargin-\th@mbxpos+20pt,-0.5\th@mbheighty+384930sp)%
+ \bgroup%
+ \setlength{\parindent}{0pt}%
+ \setlength{\@tempdimc}{\th@mbwidthx}%
+ \advance\@tempdimc-\th@mbHitO%
+ \setlength{\@tempdimb}{\th@mbwidthx}%
+ \advance\@tempdimb-\th@mbHitE%
+ \ifodd\c@CurrentPage%
+ \if@twoside%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
+ \else%
+ \hspace*{+\th@mbHitE}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
+ \fi%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
+ \fi%
+ \else%
+ \if@twoside%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \hspace*{+\th@mbHitE}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{l}{\@tempdimb}%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
+ \fi%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{\th@mb@tmp@textcolour}{\protect\th@mb@tmp@text}{r}{\@tempdimc}%
+ \fi%
+ \fi%
+ \egroup%
+ \end{picture}%
+ \fi%
+ \fi%
+ }%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\th@mb@yA}
+% |\th@mb@yA| sets the y-position to be used in |\th@mbprint|.
+%
+% \begin{macrocode}
+\newcommand{\th@mb@yA}{%
+ \advance\th@mbposyA\th@mbheighty%
+ \advance\th@mbposyA\th@mbsdistance%
+ \ifdim\th@mbposyA>\th@mbposybottom%
+ \PackageWarning{thumbs}{You are not only using more than one thumb mark at one\MessageBreak%
+ single page, but also thumb marks from different thumb\MessageBreak%
+ columns. May I suggest the use of a \string\pagebreak\space or\MessageBreak%
+ \string\newpage ?%
+ }%
+ \setlength{\th@mbposyA}{\th@mbposytop}%
+ \fi%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \DescribeMacro{tikz, hyperref}
+% To determine whether to place the thumb marks at the left or right side of a
+% two-sided paper, \xpackage{thumbs} must determine whether the page number is
+% odd or even. Because |\thepage| can be set to some value, the |CurrentPage|
+% counter of the \xpackage{pageslts} package is used instead. When the current
+% page number is determined |\AtBeginShipout|, it is usually the number of the
+% next page to be put out. But when the \xpackage{tikz} package has been loaded
+% before \xpackage{thumbs}, it is not the next page number but the real one.
+% But when the \xpackage{hyperref} package has been loaded before the
+% \xpackage{tikz} package, it is the next page number. (When first \xpackage{tikz}
+% and then \xpackage{hyperref} and then \xpackage{thumbs} was loaded, it is
+% the real page, not the next one.) Thus it must be checked which package was
+% loaded and in what order.
+%
+% \begin{macrocode}
+\ltx@ifpackageloaded{tikz}{% tikz loaded before thumbs
+ \ltx@ifpackageloaded{hyperref}{% hyperref loaded before thumbs,
+ %% but tikz and hyperref in which order? To be determined now:
+ %% Code similar to the one from David Carlisle:
+ %% http://tex.stackexchange.com/a/45654/6865
+% \end{macrocode}
+% \url{http://tex.stackexchange.com/a/45654/6865}
+% \begin{macrocode}
+ \xdef\th@mbtikz{-1}% assume tikz loaded after hyperref,
+ %% check for opposite case:
+ \def\th@mbstest{tikz.sty}
+ \let\th@mbstestb\@empty
+ \@for\@th@mbsfl:=\@filelist\do{%
+ \ifx\@th@mbsfl\th@mbstest
+ \def\th@mbstestb{hyperref.sty}
+ \fi
+ \ifx\@th@mbsfl\th@mbstestb
+ \xdef\th@mbtikz{0}% tikz loaded before hyperref
+ \fi
+ }
+ %% End of code similar to the one from David Carlisle
+ }{% tikz loaded before thumbs and hyperref loaded afterwards or not at all
+ \xdef\th@mbtikz{0}%
+ }
+ }{% tikz not loaded before thumbs
+ \xdef\th@mbtikz{-1}
+ }
+
+% \end{macrocode}
+%
+% \newpage
+%
+% \begin{macro}{\th@mbprint}
+% |\th@mbprint| places a |picture| containing the thumb mark on the page.
+%
+% \begin{macrocode}
+\newcommand{\th@mbprint}[3]{%
+ \setlength{\th@mbposyB}{-\th@mbposyA}%
+ \if@twoside%
+ \ifodd\c@CurrentPage%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \else%
+ \setlength{\@tempdimc}{-\th@mbposyA}%
+ \advance\@tempdimc-\thumbs@evenprintvoffset%
+ \setlength{\th@mbposyB}{\@tempdimc}%
+ \fi%
+ \else%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \setlength{\@tempdimc}{-\th@mbposyA}%
+ \advance\@tempdimc-\thumbs@evenprintvoffset%
+ \setlength{\th@mbposyB}{\@tempdimc}%
+ \fi%
+ \fi%
+ \fi%
+ \put(\th@mbxpos,\th@mbposyB){%
+ \begin{picture}(0,0)%
+ {\color{#3}\rule{\th@mbwidthx}{\th@mbheighty}}%
+ \end{picture}%
+ \begin{picture}(0,0)(0,-0.5\th@mbheighty+384930sp)%
+ \bgroup%
+ \setlength{\parindent}{0pt}%
+ \setlength{\@tempdimc}{\th@mbwidthx}%
+ \advance\@tempdimc-\th@mbHitO%
+ \setlength{\@tempdimb}{\th@mbwidthx}%
+ \advance\@tempdimb-\th@mbHitE%
+ \ifodd\c@CurrentPage%
+ \if@twoside%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
+ \else%
+ \hspace*{+\th@mbHitE}%
+ \th@mb@txtBox{#2}{#1}{l}{\@tempdimb}%
+ \fi%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
+ \fi%
+ \else%
+ \if@twoside%
+ \ifx\th@mbtikz\pagesLTS@zero%
+ \hspace*{+\th@mbHitE}%
+ \th@mb@txtBox{#2}{#1}{l}{\@tempdimb}%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
+ \fi%
+ \else%
+ \hspace*{-\th@mbHitO}%
+ \th@mb@txtBox{#2}{#1}{r}{\@tempdimc}%
+ \fi%
+ \fi%
+ \egroup%
+ \end{picture}%
+ }%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \DescribeMacro{\AtBeginShipout}
+% |\AtBeginShipoutUpperLeft| calls the |\th@mbprint| macro for each thumb mark
+% which shall be placed on that page.
+% When |\stopthumb| was used, the thumb mark is omitted.
+%
+% \begin{macrocode}
+\AtBeginShipout{%
+ \ifx\th@mbcolumnnew\pagesLTS@zero% ok
+ \else%
+ \PackageError{thumbs}{Missing \string\addthumb\space after \string\thumbnewcolumn }{%
+ Command \string\thumbnewcolumn\space was used, but no new thumb placed with \string\addthumb\MessageBreak%
+ (at least not at the same page). After \string\thumbnewcolumn\space please always use an\MessageBreak%
+ \string\addthumb . Until the next \string\addthumb , there will be no thumb marks on the\MessageBreak%
+ pages. Starting a new column of thumb marks and not putting a thumb mark into\MessageBreak%
+ that column does not make sense. If you just want to get rid of column marks,\MessageBreak%
+ do not abuse \string\thumbnewcolumn\space but use \string\stopthumb .\MessageBreak%
+ (This error message will be repeated at all following pages,\MessageBreak%
+ \space until \string\addthumb\space is used.)\MessageBreak%
+ }%
+ \fi%
+ \@tempcnta=\value{CurrentPage}\relax%
+ \advance\@tempcnta by \th@mbtikz%
+% \end{macrocode}
+%
+% because |CurrentPage| is already the number of the next page,
+% except if \xpackage{tikz} was loaded before thumbs,
+% then it is still the |CurrentPage|.\\
+% Changing the paper size mid-document will probably cause some problems.
+% But if it works, we try to cope with it. (When the change is performed
+% without changing |\paperwidth|, we cannot detect it. Sorry.)
+%
+% \begin{macrocode}
+ \edef\th@mbstmpwidth{\the\paperwidth}%
+ \ifdim\th@mbpaperwidth=\th@mbstmpwidth% OK
+ \else%
+ \PackageWarningNoLine{thumbs}{%
+ Paperwidth has changed. Thumb mark positions become now adapted%
+ }%
+ \setlength{\th@mbposx}{\paperwidth}%
+ \advance\th@mbposx-\th@mbwidthx%
+ \ifthumbs@ignorehoffset%
+ \advance\th@mbposx-\hoffset%
+ \fi%
+ \advance\th@mbposx+1pt%
+ \xdef\th@mbpaperwidth{\the\paperwidth}%
+ \fi%
+% \end{macrocode}
+%
+% Determining the correct |\th@mbxpos|:
+%
+% \begin{macrocode}
+ \edef\th@mbxpos{\the\th@mbposx}%
+ \ifodd\@tempcnta% \relax
+ \else%
+ \if@twoside%
+ \ifthumbs@ignorehoffset%
+ \setlength{\@tempdimc}{-\hoffset}%
+ \advance\@tempdimc-1pt%
+ \edef\th@mbxpos{\the\@tempdimc}%
+ \else%
+ \def\th@mbxpos{-1pt}%
+ \fi%
+% \end{macrocode}
+%
+% | \else \relax%|
+%
+% \begin{macrocode}
+ \fi%
+ \fi%
+ \setlength{\@tempdimc}{\th@mbxpos}%
+ \if@twoside%
+ \ifodd\@tempcnta \advance\@tempdimc-\th@mbHimO%
+ \else \advance\@tempdimc+\th@mbHimE%
+ \fi%
+ \else \advance\@tempdimc-\th@mbHimO%
+ \fi%
+ \edef\th@mbxpos{\the\@tempdimc}%
+ \AtBeginShipoutUpperLeft{%
+ \ifx\th@mbprinting\pagesLTS@one%
+ \th@mbprint{\th@mbtextA}{\th@mbtextcolourA}{\th@mbbackgroundcolourA}%
+ \@tempcnta=1\relax%
+ \edef\th@mbonpagetest{\the\@tempcnta}%
+ \@whilenum\th@mbonpagetest<\th@mbonpage\do{%
+ \advance\@tempcnta by 1%
+ \edef\th@mbonpagetest{\the\@tempcnta}%
+ \th@mb@yA%
+ \def\th@mbtmpdeftext{\csname th@mbtext\AlphAlph{\the\@tempcnta}\endcsname}%
+ \def\th@mbtmpdefcolour{\csname th@mbtextcolour\AlphAlph{\the\@tempcnta}\endcsname}%
+ \def\th@mbtmpdefbackgroundcolour{\csname th@mbbackgroundcolour\AlphAlph{\the\@tempcnta}\endcsname}%
+ \th@mbprint{\th@mbtmpdeftext}{\th@mbtmpdefcolour}{\th@mbtmpdefbackgroundcolour}%
+ }%
+ \fi%
+% \end{macrocode}
+%
+% When more than one thumb mark was placed at that page, on the following pages
+% only the last issued thumb mark shall appear.
+%
+% \begin{macrocode}
+ \@tempcnta=\th@mbonpage\relax%
+ \ifnum\@tempcnta<2% \relax
+ \else%
+ \gdef\th@mbtextA{\th@mbtext}%
+ \gdef\th@mbtextcolourA{\th@mbtextcolour}%
+ \gdef\th@mbbackgroundcolourA{\th@mbbackgroundcolour}%
+ \gdef\th@mbposyA{\th@mbposy}%
+ \fi%
+ \gdef\th@mbonpage{0}%
+ \gdef\th@mbtoprint{0}%
+ }%
+ }
+
+% \end{macrocode}
+%
+% \DescribeMacro{\AfterLastShipout}
+% |\AfterLastShipout| is executed after the last page has been shipped out.
+% It is still possible to e.\,g. write to the \xfile{aux} file at this time.
+%
+% \begin{macrocode}
+\AfterLastShipout{%
+ \ifx\th@mbcolumnnew\pagesLTS@zero% ok
+ \else
+ \PackageWarningNoLine{thumbs}{%
+ Still missing \string\addthumb\space after \string\thumbnewcolumn\space after\MessageBreak%
+ last ship-out: Command \string\thumbnewcolumn\space was used,\MessageBreak%
+ but no new thumb placed with \string\addthumb\space anywhere in the\MessageBreak%
+ rest of the document. Starting a new column of thumb\MessageBreak%
+ marks and not putting a thumb mark into that column\MessageBreak%
+ does not make sense. If you just want to get rid of\MessageBreak%
+ thumb marks, do not abuse \string\thumbnewcolumn\space but use\MessageBreak%
+ \string\stopthumb %
+ }
+ \fi
+% \end{macrocode}
+%
+% |\AfterLastShipout| the number of thumb marks per overview page,
+% the total number of thumb marks, and the maximal thumb mark text width
+% are determined and saved for the next \LaTeX\ run via the \xfile{.aux} file.
+%
+% \begin{macrocode}
+ \ifx\th@mbcolumn\pagesLTS@zero% if there is only one column of thumbs
+ \xdef\th@umbsperpagecount{\th@mbs}
+ \gdef\th@mbcolumn{1}
+ \fi
+ \ifx\th@umbsperpagecount\pagesLTS@zero
+ \gdef\th@umbsperpagecount{\th@mbs}% \th@mbs was increased with each \addthumb
+ \fi
+ \ifdim\th@mbmaxwidth>\th@mbwidthx
+ \ifthumbs@draft% \relax
+ \else
+% \end{macrocode}
+%
+% \pagebreak
+%
+% \begin{macrocode}
+ \def\th@mbstest{autoauto}
+ \ifx\thumbs@width\th@mbstest%
+ \AtEndAfterFileList{%
+ \PackageWarningNoLine{thumbs}{%
+ Rerun to get the thumb marks width right%
+ }
+ }
+ \else
+ \AtEndAfterFileList{%
+ \edef\thumbsinfoa{\th@mbmaxwidth}
+ \edef\thumbsinfob{\the\th@mbwidthx}
+ \PackageWarningNoLine{thumbs}{%
+ Thumb mark too small or its text too wide:\MessageBreak%
+ The widest thumb mark text is \thumbsinfoa\space wide,\MessageBreak%
+ but the thumb marks are only \space\thumbsinfob\space wide.\MessageBreak%
+ Either shorten or scale down the text,\MessageBreak%
+ or increase the thumb mark width,\MessageBreak%
+ or use option width=autoauto%
+ }
+ }
+ \fi
+ \fi
+ \fi
+ \if@filesw
+ \immediate\write\@auxout{\string\gdef\string\th@mbmaxwidtha{\th@mbmaxwidth}}
+ \immediate\write\@auxout{\string\gdef\string\th@umbsperpage{\th@umbsperpagecount}}
+ \immediate\write\@auxout{\string\gdef\string\th@mbsmax{\th@mbs}}
+ \expandafter\newwrite\csname tf@tmb\endcsname
+% \end{macrocode}
+%
+% And a rerun check is performed: Did the |\jobname.tmb| file change?
+%
+% \begin{macrocode}
+ \RerunFileCheck{\jobname.tmb}{%
+ \immediate\closeout \csname tf@tmb\endcsname
+ }{Warning: Rerun to get list of thumbs right!%
+ }
+ \immediate\openout \csname tf@tmb\endcsname = \jobname.tmb\relax
+ %\else there is a problem, but the according warning message was already given earlier.
+ \fi
+ }
+
+% \end{macrocode}
+%
+% \begin{macro}{\addthumbsoverviewtocontents}
+% |\addthumbsoverviewtocontents| with two arguments is a replacement for
+% |\addcontentsline{toc}{<level>}{<text>}|, where the first argument of
+% |\addthumbsoverviewtocontents| is for |<level>| and the second for |<text>|.
+% If an entry of the thumbs mark overview shall be placed in the table of contents,
+% |\addthumbsoverviewtocontents| with its arguments should be used immediately before
+% |\thumbsoverview|.
+%
+% \begin{macrocode}
+\newcommand{\addthumbsoverviewtocontents}[2]{%
+ \gdef\th@mbs@toc@level{#1}%
+ \gdef\th@mbs@toc@text{#2}%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\clearotherdoublepage}
+% We need a command to clear a double page, thus that the following text
+% is \emph{left} instead of \emph{right} as accomplished with the usual
+% |\cleardoublepage|. For this we take the original |\cleardoublepage| code
+% and revert the |\ifodd\c@page\else| (i.\,e. if even |\c@page|) condition.
+%
+% \begin{macrocode}
+\newcommand{\clearotherdoublepage}{%
+\clearpage\if@twoside \ifodd\c@page% removed "\else" from \cleardoublepage
+\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi%
+}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\th@mbstablabeling}
+% When the \xpackage{hyperref} package is used, one might like to refer to the
+% thumb overview page(s), therefore |\th@mbstablabeling| command is defined
+% (and used later). First a~|\phantomsection| is added.
+% With or without \xpackage{hyperref} a label |TableOfThumbs1| (or |TableOfThumbs2|
+% or\ldots) is placed here. For compatibility with older versions of this
+% package also the label |TableOfThumbs| is created. Equal to older versions
+% it aims at the last used Table of Thumbs, but since version~1.0g \textbf{without}\\
+% |Error: Label TableOfThumbs multiply defined| - thanks to |\overridelabel| from
+% the \xpackage{undolabl} package (which is automatically loaded by the
+% \xpackage{pageslts} package).\\
+% When |\addthumbsoverviewtocontents| was used, the entry is placed into the
+% table of contents.
+%
+% \begin{macrocode}
+\newcommand{\th@mbstablabeling}{%
+ \ltx@ifpackageloaded{hyperref}{\phantomsection}{}%
+ \let\label\thumbsoriglabel%
+ \ifx\th@mbstable\pagesLTS@one%
+ \label{TableOfThumbs}%
+ \label{TableOfThumbs1}%
+ \else%
+ \overridelabel{TableOfThumbs}%
+ \label{TableOfThumbs\th@mbstable}%
+ \fi%
+ \let\label\@gobble%
+ \ifx\th@mbs@toc@level\empty%\relax
+ \else \addcontentsline{toc}{\th@mbs@toc@level}{\th@mbs@toc@text}%
+ \fi%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \DescribeMacro{\thumbsoverview}
+% \DescribeMacro{\thumbsoverviewback}
+% \DescribeMacro{\thumbsoverviewverso}
+% \DescribeMacro{\thumbsoverviewdouble}
+% For compatibility with documents created using older versions of this package
+% |\thumbsoverview| did not get a second argument, but it is renamed to
+% |\thumbsoverviewprint| and additional to |\thumbsoverview| new commands are
+% introduced. It is of course also possible to use |\thumbsoverviewprint| with
+% its two arguments directly, therefore its name does not include any |@|
+% (saving the users the use of |\makeatother| and |\makeatletter|).\\
+% \begin{description}
+% \item[-] |\thumbsoverview| prints the thumb marks at the right side
+% and (in |twoside| mode) skips left sides (useful e.\,g. at the beginning
+% of a document)
+%
+% \item[-] |\thumbsoverviewback| prints the thumb marks at the left side
+% and (in |twoside| mode) skips right sides (useful e.\,g. at the end
+% of a document)
+%
+% \item[-] |\thumbsoverviewverso| prints the thumb marks at the right side
+% and (in |twoside| mode) repeats them at the next left side and so on
+% (useful anywhere in the document and when one wants to prevent empty
+% pages)
+%
+% \item[-] |\thumbsoverviewdouble| prints the thumb marks at the left side
+% and (in |twoside| mode) repeats them at the next right side and so on
+% (useful anywhere in the document and when one wants to prevent empty
+% pages)
+% \end{description}
+%
+% The |\thumbsoverview...| commands are used to place the overview page(s)
+% for the thumb marks. Their parameter is used to mark this page/these pages
+% (e.\,g. in the page header). If these marks are not wished,
+% |\thumbsoverview...{}| will generate empty marks in the page header(s).
+% |\thumbsoverview...| can be used more than once (for example at the
+% beginning and at the end of the document). The overviews have labels
+% |TableOfThumbs1|, |TableOfThumbs2| and so on, which can be referred to with
+% e.\,g. |\pageref{TableOfThumbs1}|.
+% The reference |TableOfThumbs| (without number) aims at the last used Table of Thumbs
+% (for compatibility with older versions of this package).
+%
+% \begin{macro}{\thumbsoverview}
+% \begin{macrocode}
+\newcommand{\thumbsoverview}[1]{\thumbsoverviewprint{#1}{r}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\thumbsoverviewback}
+% \begin{macrocode}
+\newcommand{\thumbsoverviewback}[1]{\thumbsoverviewprint{#1}{l}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\thumbsoverviewverso}
+% \begin{macrocode}
+\newcommand{\thumbsoverviewverso}[1]{\thumbsoverviewprint{#1}{v}}
+
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\thumbsoverviewdouble}
+% \begin{macrocode}
+\newcommand{\thumbsoverviewdouble}[1]{\thumbsoverviewprint{#1}{d}}
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thumbsoverviewprint}
+% |\thumbsoverviewprint| works by calling the internal command |\th@mbs@verview|
+% (see below), repeating this until all thumb marks have been processed.
+%
+% \begin{macrocode}
+\newcommand{\thumbsoverviewprint}[2]{%
+% \end{macrocode}
+%
+% It would be possible to just |\edef\th@mbsprintpage{#2}|, but
+% |\thumbsoverviewprint| might be called manually and without valid second argument.
+%
+% \begin{macrocode}
+ \edef\th@mbstest{#2}%
+ \def\th@mbstestb{r}%
+ \ifx\th@mbstest\th@mbstestb% r
+ \gdef\th@mbsprintpage{r}%
+ \else%
+ \def\th@mbstestb{l}%
+ \ifx\th@mbstest\th@mbstestb% l
+ \gdef\th@mbsprintpage{l}%
+ \else%
+ \def\th@mbstestb{v}%
+ \ifx\th@mbstest\th@mbstestb% v
+ \gdef\th@mbsprintpage{v}%
+ \else%
+ \def\th@mbstestb{d}%
+ \ifx\th@mbstest\th@mbstestb% d
+ \gdef\th@mbsprintpage{d}%
+ \else%
+ \PackageError{thumbs}{%
+ Invalid second parameter of \string\thumbsoverviewprint %
+ }{The second argument of command \string\thumbsoverviewprint\space must be\MessageBreak%
+ either "r" or "l" or "v" or "d" but it is neither.\MessageBreak%
+ Now "r" is chosen instead.\MessageBreak%
+ }%
+ \gdef\th@mbsprintpage{r}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+% \end{macrocode}
+%
+% Option |\thumbs@thumblink| is checked for a valid and reasonable value here.
+%
+% \begin{macrocode}
+ \def\th@mbstest{none}%
+ \ifx\thumbs@thumblink\th@mbstest% OK
+ \else%
+ \ltx@ifpackageloaded{hyperref}{% hyperref loaded
+ \def\th@mbstest{title}%
+ \ifx\thumbs@thumblink\th@mbstest% OK
+ \else%
+ \def\th@mbstest{page}%
+ \ifx\thumbs@thumblink\th@mbstest% OK
+ \else%
+ \def\th@mbstest{titleandpage}%
+ \ifx\thumbs@thumblink\th@mbstest% OK
+ \else%
+ \def\th@mbstest{line}%
+ \ifx\thumbs@thumblink\th@mbstest% OK
+ \else%
+ \def\th@mbstest{rule}%
+ \ifx\thumbs@thumblink\th@mbstest% OK
+ \else%
+ \PackageError{thumbs}{Option thumblink with invalid value}{%
+ Option thumblink has invalid value "\thumbs@thumblink ".\MessageBreak%
+ Valid values are "none", "title", "page",\MessageBreak%
+ "titleandpage", "line", or "rule".\MessageBreak%
+ "rule" will be used now.\MessageBreak%
+ }%
+ \gdef\thumbs@thumblink{rule}%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ \fi%
+ }{% hyperref not loaded
+ \PackageError{thumbs}{Option thumblink not "none", but hyperref not loaded}{%
+ The option thumblink of the thumbs package was not set to "none",\MessageBreak%
+ but to some kind of hyperlinks, without using package hyperref.\MessageBreak%
+ Either choose option "thumblink=none", or load package hyperref.\MessageBreak%
+ When pressing Return, "thumblink=none" will be set now.\MessageBreak%
+ }%
+ \gdef\thumbs@thumblink{none}%
+ }%
+ \fi%
+% \end{macrocode}
+%
+% When the thumb overview is printed and there is already a thumb mark set,
+% for example for the front-matter (e.\,g. title page, bibliographic information,
+% acknowledgements, dedication, preface, abstract, tables of content, tables,
+% and figures, lists of symbols and abbreviations, and the thumbs overview itself,
+% of course) or when the overview is placed near the end of the document,
+% the current y-position of the thumb mark must be remembered (and later restored)
+% and the printing of that thumb mark must be stopped (and later continued).
+%
+% \begin{macrocode}
+ \edef\th@mbprintingovertoc{\th@mbprinting}%
+ \ifnum \th@mbsmax > \pagesLTS@zero%
+ \if@twoside%
+ \def\th@mbstest{r}%
+ \ifx\th@mbstest\th@mbsprintpage%
+ \cleardoublepage%
+ \else%
+ \def\th@mbstest{v}%
+ \ifx\th@mbstest\th@mbsprintpage%
+ \cleardoublepage%
+ \else% l or d
+ \clearotherdoublepage%
+ \fi%
+ \fi%
+ \else \clearpage%
+ \fi%
+ \stopthumb%
+ \markboth{\MakeUppercase #1 }{\MakeUppercase #1 }%
+ \fi%
+ \setlength{\th@mbsposytocy}{\th@mbposy}%
+ \setlength{\th@mbposy}{\th@mbsposytocyy}%
+ \ifx\th@mbstable\pagesLTS@zero%
+ \newcounter{th@mblinea}%
+ \newcounter{th@mblineb}%
+ \newcounter{FileLine}%
+ \newcounter{thumbsstop}%
+ \fi%
+% \end{macrocode}
+% \pagebreak
+% \begin{macrocode}
+ \setcounter{th@mblinea}{\th@mbstable}%
+ \addtocounter{th@mblinea}{+1}%
+ \xdef\th@mbstable{\arabic{th@mblinea}}%
+ \setcounter{th@mblinea}{1}%
+ \setcounter{th@mblineb}{\th@umbsperpage}%
+ \setcounter{FileLine}{1}%
+ \setcounter{thumbsstop}{1}%
+ \addtocounter{thumbsstop}{\th@mbsmax}%
+% \end{macrocode}
+%
+% We do not want any labels or index or glossary entries confusing the
+% table of thumb marks entries, but the commands must work outside of it:
+%
+% \begin{macro}{\thumbsoriglabel}
+% \begin{macrocode}
+ \let\thumbsoriglabel\label%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\thumbsorigindex}
+% \begin{macrocode}
+ \let\thumbsorigindex\index%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\thumbsorigglossary}
+% \begin{macrocode}
+ \let\thumbsorigglossary\glossary%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+ \let\label\@gobble%
+ \let\index\@gobble%
+ \let\glossary\@gobble%
+% \end{macrocode}
+%
+% Some preparation in case of double printing the overview page(s):
+%
+% \begin{macrocode}
+ \def\th@mbstest{v}% r l r ...
+ \ifx\th@mbstest\th@mbsprintpage%
+ \def\th@mbsprintpage{l}% because it will be changed to r
+ \def\th@mbdoublepage{1}%
+ \else%
+ \def\th@mbstest{d}% l r l ...
+ \ifx\th@mbstest\th@mbsprintpage%
+ \def\th@mbsprintpage{r}% because it will be changed to l
+ \def\th@mbdoublepage{1}%
+ \else%
+ \def\th@mbdoublepage{0}%
+ \fi%
+ \fi%
+ \def\th@mb@resetdoublepage{0}%
+ \@whilenum\value{FileLine}<\value{thumbsstop}\do%
+% \end{macrocode}
+%
+% \pagebreak
+%
+% For double printing the overview page(s) we just change between printing
+% left and right, and we need to reset the line number of the |\jobname.tmb| file
+% which is read, because we need to read things twice.
+%
+% \begin{macrocode}
+ {\ifx\th@mbdoublepage\pagesLTS@one%
+ \def\th@mbstest{r}%
+ \ifx\th@mbsprintpage\th@mbstest%
+ \def\th@mbsprintpage{l}%
+ \else% \th@mbsprintpage is l
+ \def\th@mbsprintpage{r}%
+ \fi%
+ \clearpage%
+ \ifx\th@mb@resetdoublepage\pagesLTS@one%
+ \setcounter{th@mblinea}{\theth@mblinea}%
+ \setcounter{th@mblineb}{\theth@mblineb}%
+ \def\th@mb@resetdoublepage{0}%
+ \else%
+ \edef\theth@mblinea{\arabic{th@mblinea}}%
+ \edef\theth@mblineb{\arabic{th@mblineb}}%
+ \def\th@mb@resetdoublepage{1}%
+ \fi%
+ \else%
+ \if@twoside%
+ \def\th@mbstest{r}%
+ \ifx\th@mbstest\th@mbsprintpage%
+ \cleardoublepage%
+ \else% l
+ \clearotherdoublepage%
+ \fi%
+ \else%
+ \clearpage%
+ \fi%
+ \fi%
+% \end{macrocode}
+%
+% When the very first page of a thumb marks overview is generated,
+% the label is set (with the |\th@mbstablabeling| command).
+%
+% \begin{macrocode}
+ \ifnum\value{FileLine}=1%
+ \ifx\th@mbdoublepage\pagesLTS@one%
+ \ifx\th@mb@resetdoublepage\pagesLTS@one%
+ \th@mbstablabeling%
+ \fi%
+ \else
+ \th@mbstablabeling%
+ \fi%
+ \fi%
+ \null%
+ \th@mbs@verview%
+ \pagebreak%
+% \end{macrocode}
+% \pagebreak
+% \begin{macrocode}
+ \ifthumbs@verbose%
+ \message{THUMBS: Fileline: \arabic{FileLine}, a: \arabic{th@mblinea}, %
+ b: \arabic{th@mblineb}, per page: \th@umbsperpage, max: \th@mbsmax.^^J}%
+ \fi%
+% \end{macrocode}
+%
+% When double page mode is active and |\th@mb@resetdoublepage| is one,
+% the last page of the thumbs mark overview must be repeated, but\\
+% | \@whilenum\value{FileLine}<\value{thumbsstop}\do|\\
+% would prevent this, because |FileLine| is already too large
+% and would only be reset \emph{inside} the loop, but the loop would
+% not be executed again.
+%
+% \begin{macrocode}
+ \ifx\th@mb@resetdoublepage\pagesLTS@one%
+ \setcounter{FileLine}{\theth@mblinea}%
+ \fi%
+ }%
+% \end{macrocode}
+%
+% After the overview, the current thumb mark (if there is any) is restored,
+%
+% \begin{macrocode}
+ \setlength{\th@mbposy}{\th@mbsposytocy}%
+ \ifx\th@mbprintingovertoc\pagesLTS@one%
+ \continuethumb%
+ \fi%
+% \end{macrocode}
+%
+% as well as the |\label|, |\index|, and |\glossary| commands:
+%
+% \begin{macrocode}
+ \let\label\thumbsoriglabel%
+ \let\index\thumbsorigindex%
+ \let\glossary\thumbsorigglossary%
+% \end{macrocode}
+%
+% and |\th@mbs@toc@level| and |\th@mbs@toc@text| need to be emptied,
+% otherwise for each following Table of Thumb Marks the same entry
+% in the table of contents would be added, if no new
+% |\addthumbsoverviewtocontents| would be given.
+% ( But when no |\addthumbsoverviewtocontents| is given, it can be assumed
+% that no |thumbsoverview|-entry shall be added to contents.)
+%
+% \begin{macrocode}
+ \addthumbsoverviewtocontents{}{}%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\th@mbs@verview}
+% The internal command |\th@mbs@verview| reads a line from file |\jobname.tmb| and
+% executes the content of that line~-- if that line has not been processed yet,
+% in which case it is just ignored (see |\@unused|).
+%
+% \begin{macrocode}
+\newcommand{\th@mbs@verview}{%
+ \ifthumbs@verbose%
+ \message{^^JPackage thumbs Info: Processing line \arabic{th@mblinea} to \arabic{th@mblineb} of \jobname.tmb.}%
+ \fi%
+ \setcounter{FileLine}{1}%
+ \AtBeginShipoutNext{%
+ \AtBeginShipoutUpperLeftForeground{%
+ \IfFileExists{\jobname.tmb}{% then
+ \openin\@instreamthumb=\jobname.tmb %
+ \@whilenum\value{FileLine}<\value{th@mblineb}\do%
+ {\ifthumbs@verbose%
+ \message{THUMBS: Processing \jobname.tmb line \arabic{FileLine}.}%
+ \fi%
+ \ifnum \value{FileLine}<\value{th@mblinea}%
+ \read\@instreamthumb to \@unused%
+ \ifthumbs@verbose%
+ \message{Can be skipped.^^J}%
+ \fi%
+ % NIRVANA: ignore the line by not executing it,
+ % i.e. not executing \@unused.
+ % % \@unused
+ \else%
+ \ifnum \value{FileLine}=\value{th@mblinea}%
+ \read\@instreamthumb to \@thumbsout% execute the code of this line
+ \ifthumbs@verbose%
+ \message{Executing \jobname.tmb line \arabic{FileLine}.^^J}%
+ \fi%
+ \@thumbsout%
+ \else%
+ \ifnum \value{FileLine}>\value{th@mblinea}%
+ \read\@instreamthumb to \@thumbsout% execute the code of this line
+ \ifthumbs@verbose%
+ \message{Executing \jobname.tmb line \arabic{FileLine}.^^J}%
+ \fi%
+ \@thumbsout%
+ \else% THIS SHOULD NEVER HAPPEN!
+ \PackageError{thumbs}{Unexpected error! (Really!)}{%
+ ! You are in trouble here.\MessageBreak%
+ ! Type\space \space X \string<Return\string>\space to quit.\MessageBreak%
+ ! Delete temporary auxiliary files\MessageBreak%
+ ! (like \jobname.aux, \jobname.tmb, \jobname.out)\MessageBreak%
+ ! and retry the compilation.\MessageBreak%
+ ! If the error persists, cross your fingers\MessageBreak%
+ ! and try typing\space \space \string<Return\string>\space to proceed.\MessageBreak%
+ ! If that does not work,\MessageBreak%
+ ! please contact the maintainer of the thumbs package.\MessageBreak%
+ }%
+ \fi%
+ \fi%
+ \fi%
+ \stepcounter{FileLine}%
+ }%
+ \ifnum \value{FileLine}=\value{th@mblineb}
+ \ifthumbs@verbose%
+ \message{THUMBS: Processing \jobname.tmb line \arabic{FileLine}.}%
+ \fi%
+ \read\@instreamthumb to \@thumbsout% Execute the code of that line.
+ \ifthumbs@verbose%
+ \message{Executing \jobname.tmb line \arabic{FileLine}.^^J}%
+ \fi%
+ \@thumbsout% Well, really execute it here.
+ \stepcounter{FileLine}%
+ \fi%
+ \closein\@instreamthumb%
+% \end{macrocode}
+%
+% And on to the next overview page of thumb marks (if there are so many thumb marks):
+%
+% \begin{macrocode}
+ \addtocounter{th@mblinea}{\th@umbsperpage}%
+ \addtocounter{th@mblineb}{\th@umbsperpage}%
+ \@tempcnta=\th@mbsmax\relax%
+ \ifnum \value{th@mblineb}>\@tempcnta\relax%
+ \setcounter{th@mblineb}{\@tempcnta}%
+ \fi%
+ }{% else
+% \end{macrocode}
+%
+% When |\jobname.tmb| was not found, we cannot read from that file, therefore
+% the |FileLine| is set to |thumbsstop|, stopping the calling of |\th@mbs@verview|
+% in |\thumbsoverview|. (And we issue a warning, of course.)
+%
+% \begin{macrocode}
+ \setcounter{FileLine}{\arabic{thumbsstop}}%
+ \AtEndAfterFileList{%
+ \PackageWarningNoLine{thumbs}{%
+ File \jobname.tmb not found.\MessageBreak%
+ Rerun to get thumbs overview page(s) right.\MessageBreak%
+ }%
+ }%
+ }%
+ }%
+ }%
+ }
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\thumborigaddthumb}
+% When we are in |draft| mode, the thumb marks are
+% \textquotedblleft de-coloured\textquotedblright{},
+% their width is reduced, and a warning is given.
+%
+% \begin{macrocode}
+\let\thumborigaddthumb\addthumb%
+
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\ifthumbs@draft
+ \setlength{\th@mbwidthx}{2pt}
+ \renewcommand{\addthumb}[4]{\thumborigaddthumb{#1}{#2}{black}{gray}}
+ \PackageWarningNoLine{thumbs}{thumbs package in draft mode:\MessageBreak%
+ Thumb mark width is set to 2pt,\MessageBreak%
+ thumb mark text colour to black, and\MessageBreak%
+ thumb mark background colour to gray.\MessageBreak%
+ Use package option final to get the original values.\MessageBreak%
+ }
+\fi
+
+% \end{macrocode}
+%
+% \pagebreak
+%
+% When we are in |hidethumbs| mode, there are no thumb marks
+% and therefore neither any thumb mark overview page. A~warning is given.
+%
+% \begin{macrocode}
+\ifthumbs@hidethumbs
+ \renewcommand{\addthumb}[4]{\relax}
+ \PackageWarningNoLine{thumbs}{thumbs package in hide mode:\MessageBreak%
+ Thumb marks are hidden.\MessageBreak%
+ Set package option "hidethumbs=false" to get thumb marks%
+ }
+ \renewcommand{\thumbnewcolumn}{\relax}
+\fi
+
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</package>
+% \end{macrocode}
+%
+% \pagebreak
+%
+% \section{Installation}
+%
+% \subsection{Downloads\label{ss:Downloads}}
+%
+% Everything is available on \url{http://www.ctan.org/}
+% but may need additional packages themselves.\\
+%
+% \DescribeMacro{thumbs.dtx}
+% For unpacking the |thumbs.dtx| file and constructing the documentation
+% it is required:
+% \begin{description}
+% \item[-] \TeX Format \LaTeXe{}, \url{http://www.CTAN.org/}
+%
+% \item[-] document class \xclass{ltxdoc}, 2007/11/11, v2.0u,
+% \url{http://ctan.org/pkg/ltxdoc}
+%
+% \item[-] package \xpackage{morefloats}, 2012/01/28, v1.0f,
+% \url{http://ctan.org/pkg/morefloats}
+%
+% \item[-] package \xpackage{geometry}, 2010/09/12, v5.6,
+% \url{http://ctan.org/pkg/geometry}
+%
+% \item[-] package \xpackage{holtxdoc}, 2012/03/21, v0.24,
+% \url{http://ctan.org/pkg/holtxdoc}
+%
+% \item[-] package \xpackage{hypdoc}, 2011/08/19, v1.11,
+% \url{http://ctan.org/pkg/hypdoc}
+% \end{description}
+%
+% \DescribeMacro{thumbs.sty}
+% The |thumbs.sty| for \LaTeXe{} (i.\,e. each document using
+% the \xpackage{thumbs} package) requires:
+% \begin{description}
+% \item[-] \TeX{} Format \LaTeXe{}, \url{http://www.CTAN.org/}
+%
+% \item[-] package \xpackage{xcolor}, 2007/01/21, v2.11,
+% \url{http://ctan.org/pkg/xcolor}
+%
+% \item[-] package \xpackage{pageslts}, 2014/01/19, v1.2c,
+% \url{http://ctan.org/pkg/pageslts}
+%
+% \item[-] package \xpackage{pagecolor}, 2012/02/23, v1.0e,
+% \url{http://ctan.org/pkg/pagecolor}
+%
+% \item[-] package \xpackage{alphalph}, 2011/05/13, v2.4,
+% \url{http://ctan.org/pkg/alphalph}
+%
+% \item[-] package \xpackage{atbegshi}, 2011/10/05, v1.16,
+% \url{http://ctan.org/pkg/atbegshi}
+%
+% \item[-] package \xpackage{atveryend}, 2011/06/30, v1.8,
+% \url{http://ctan.org/pkg/atveryend}
+%
+% \item[-] package \xpackage{infwarerr}, 2010/04/08, v1.3,
+% \url{http://ctan.org/pkg/infwarerr}
+%
+% \item[-] package \xpackage{kvoptions}, 2011/06/30, v3.11,
+% \url{http://ctan.org/pkg/kvoptions}
+%
+% \item[-] package \xpackage{ltxcmds}, 2011/11/09, v1.22,
+% \url{http://ctan.org/pkg/ltxcmds}
+%
+% \item[-] package \xpackage{picture}, 2009/10/11, v1.3,
+% \url{http://ctan.org/pkg/picture}
+%
+% \item[-] package \xpackage{rerunfilecheck}, 2011/04/15, v1.7,
+% \url{http://ctan.org/pkg/rerunfilecheck}
+% \end{description}
+%
+% \pagebreak
+%
+% \DescribeMacro{thumb-example.tex}
+% The |thumb-example.tex| requires the same files as all
+% documents using the \xpackage{thumbs} package and additionally:
+% \begin{description}
+% \item[-] package \xpackage{eurosym}, 1998/08/06, v1.1,
+% \url{http://ctan.org/pkg/eurosym}
+%
+% \item[-] package \xpackage{lipsum}, 2011/04/14, v1.2,
+% \url{http://ctan.org/pkg/lipsum}
+%
+% \item[-] package \xpackage{hyperref}, 2012/11/06, v6.83m,
+% \url{http://ctan.org/pkg/hyperref}
+%
+% \item[-] package \xpackage{thumbs}, 2014/03/09, v1.0q,
+% \url{http://ctan.org/pkg/thumbs}\\
+% (Well, it is the example file for this package, and because you are reading the
+% documentation for the \xpackage{thumbs} package, it~can be assumed that you already
+% have some version of it -- is it the current one?)
+% \end{description}
+%
+% \DescribeMacro{Alternatives}
+% As possible alternatives in section \ref{sec:Alternatives} there are listed
+% (newer versions might be available)
+% \begin{description}
+% \item[-] \xpackage{chapterthumb}, 2005/03/10, v0.1,
+% \CTAN{info/examples/KOMA-Script-3/Anhang-B/source/chapterthumb.sty}
+%
+% \item[-] \xpackage{eso-pic}, 2010/10/06, v2.0c,
+% \url{http://ctan.org/pkg/eso-pic}
+%
+% \item[-] \xpackage{fancytabs}, 2011/04/16 v1.1,
+% \url{http://ctan.org/pkg/fancytabs}
+%
+% \item[-] \xpackage{thumb}, 2001, without file version,
+% \url{ftp://ftp.dante.de/pub/tex/info/examples/ltt/thumb.sty}
+%
+% \item[-] \xpackage{thumb} (a completely different one), 1997/12/24, v1.0,
+% \url{http://ctan.org/pkg/thumb}
+%
+% \item[-] \xpackage{thumbindex}, 2009/12/13, without file version,
+% \url{http://hisashim.org/2009/12/13/thumbindex.html}.
+%
+% \item[-] \xpackage{thumb-index}, from the \xpackage{fancyhdr} package, 2005/03/22 v3.2,
+% \url{http://ctan.org/pkg/fancyhdr}
+%
+% \item[-] \xpackage{thumbpdf}, 2010/07/07, v3.11,
+% \url{http://ctan.org/pkg/thumbpdf}
+%
+% \item[-] \xpackage{thumby}, 2010/01/14, v0.1,
+% \url{http://ctan.org/pkg/thumby}
+% \end{description}
+%
+% \DescribeMacro{Oberdiek}
+% \DescribeMacro{holtxdoc}
+% \DescribeMacro{alphalph}
+% \DescribeMacro{atbegshi}
+% \DescribeMacro{atveryend}
+% \DescribeMacro{infwarerr}
+% \DescribeMacro{kvoptions}
+% \DescribeMacro{ltxcmds}
+% \DescribeMacro{picture}
+% \DescribeMacro{rerunfilecheck}
+% All packages of \textsc{Heiko Oberdiek}'s bundle `oberdiek'
+% (especially \xpackage{holtxdoc}, \xpackage{alphalph}, \xpackage{atbegshi}, \xpackage{infwarerr},
+% \xpackage{kvoptions}, \xpackage{ltxcmds}, \xpackage{picture}, and \xpackage{rerunfilecheck})
+% are also available in a TDS compliant ZIP archive:\\
+% \url{http://mirror.ctan.org/install/macros/latex/contrib/oberdiek.tds.zip}.\\
+% It is probably best to download and use this, because the packages in there
+% are quite probably both recent and compatible among themselves.\\
+%
+% \vspace{6em}
+%
+% \DescribeMacro{hyperref}
+% \noindent \xpackage{hyperref} is not included in that bundle and needs to be
+% downloaded separately,\\
+% \url{http://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\\
+%
+% \DescribeMacro{M\"{u}nch}
+% A hyperlinked list of my (other) packages can be found at
+% \url{http://www.ctan.org/author/muench-hm}.\\
+%
+% \subsection{Package, unpacking TDS}
+% \paragraph{Package.} This package is available on \url{CTAN.org}
+% \begin{description}
+% \item[\url{http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.dtx}]\hspace*{0.1cm} \\
+% The source file.
+% \item[\url{http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs.pdf}]\hspace*{0.1cm} \\
+% The documentation.
+% \item[\url{http://mirror.ctan.org/macros/latex/contrib/thumbs/thumbs-example.pdf}]\hspace*{0.1cm} \\
+% The compiled example file, as it should look like.
+% \item[\url{http://mirror.ctan.org/macros/latex/contrib/thumbs/README}]\hspace*{0.1cm} \\
+% The README file.
+% \end{description}
+% There is also a thumbs.tds.zip available:
+% \begin{description}
+% \item[\url{http://mirror.ctan.org/install/macros/latex/contrib/thumbs.tds.zip}]\hspace*{0.1cm} \\
+% Everything in \xfile{TDS} compliant, compiled format.
+% \end{description}
+% which additionally contains\\
+% \begin{tabular}{ll}
+% thumbs.ins & The installation file.\\
+% thumbs.drv & The driver to generate the documentation.\\
+% thumbs.sty & The \xext{sty}le file.\\
+% thumbs-example.tex & The example file.
+% \end{tabular}
+%
+% \bigskip
+%
+% \noindent For required other packages, please see the preceding subsection.
+%
+% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
+% \docstrip{} archive. The files are extracted by running the
+% \xext{dtx} through \plainTeX{}:
+% \begin{quote}
+% \verb|tex thumbs.dtx|
+% \end{quote}
+%
+% About generating the documentation see paragraph~\ref{GenDoc} below.\\
+%
+% \paragraph{TDS.} Now the different files must be moved into
+% the different directories in your installation TDS tree
+% (also known as \xfile{texmf} tree):
+% \begin{quote}
+% \def\t{^^A
+% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}}
+% thumbs.sty & tex/latex/thumbs/thumbs.sty\\
+% thumbs.pdf & doc/latex/thumbs/thumbs.pdf\\
+% thumbs-example.tex & doc/latex/thumbs/thumbs-example.tex\\
+% thumbs-example.pdf & doc/latex/thumbs/thumbs-example.pdf\\
+% thumbs.dtx & source/latex/thumbs/thumbs.dtx\\
+% \end{tabular}^^A
+% }^^A
+% \sbox0{\t}^^A
+% \ifdim\wd0>\linewidth
+% \begingroup
+% \advance\linewidth by\leftmargin
+% \advance\linewidth by\rightmargin
+% \edef\x{\endgroup
+% \def\noexpand\lw{\the\linewidth}^^A
+% }\x
+% \def\lwbox{^^A
+% \leavevmode
+% \hbox to \linewidth{^^A
+% \kern-\leftmargin\relax
+% \hss
+% \usebox0
+% \hss
+% \kern-\rightmargin\relax
+% }^^A
+% }^^A
+% \ifdim\wd0>\lw
+% \sbox0{\small\t}^^A
+% \ifdim\wd0>\linewidth
+% \ifdim\wd0>\lw
+% \sbox0{\footnotesize\t}^^A
+% \ifdim\wd0>\linewidth
+% \ifdim\wd0>\lw
+% \sbox0{\scriptsize\t}^^A
+% \ifdim\wd0>\linewidth
+% \ifdim\wd0>\lw
+% \sbox0{\tiny\t}^^A
+% \ifdim\wd0>\linewidth
+% \lwbox
+% \else
+% \usebox0
+% \fi
+% \else
+% \lwbox
+% \fi
+% \else
+% \usebox0
+% \fi
+% \else
+% \lwbox
+% \fi
+% \else
+% \usebox0
+% \fi
+% \else
+% \lwbox
+% \fi
+% \else
+% \usebox0
+% \fi
+% \else
+% \lwbox
+% \fi
+% \else
+% \usebox0
+% \fi
+% \end{quote}
+% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip{}'s
+% \xfile{TDS} installing feature, then some files can already be in the right
+% place, see the documentation of \docstrip{}.
+%
+% \subsection{Refresh file name databases}
+%
+% If your \TeX{}~distribution (\teTeX{}, \mikTeX{},\dots{}) relies on file name
+% databases, you must refresh these. For example, \teTeX{} users run
+% \verb|texhash| or \verb|mktexlsr|.
+%
+% \subsection{Some details for the interested}
+%
+% \paragraph{Unpacking with \LaTeX{}.}
+% The \xfile{.dtx} chooses its action depending on the format:
+% \begin{description}
+% \item[\plainTeX:] Run \docstrip{} and extract the files.
+% \item[\LaTeX:] Generate the documentation.
+% \end{description}
+% If you insist on using \LaTeX{} for \docstrip{} (really,
+% \docstrip{} does not need \LaTeX{}), then inform the autodetect routine
+% about your intention:
+% \begin{quote}
+% \verb|latex \let\install=y\input{thumbs.dtx}|
+% \end{quote}
+% Do not forget to quote the argument according to the demands
+% of your shell.
+%
+% \paragraph{Generating the documentation.\label{GenDoc}}
+% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate
+% the documentation. The process can be configured by a
+% configuration file \xfile{ltxdoc.cfg}. For instance, put the following
+% line into this file, if you want to have A4 as paper format:
+% \begin{quote}
+% \verb|\PassOptionsToClass{a4paper}{article}|
+% \end{quote}
+%
+% \noindent An example follows how to generate the
+% documentation with \pdfLaTeX{}:
+%
+% \begin{quote}
+%\begin{verbatim}
+%pdflatex thumbs.dtx
+%makeindex -s gind.ist thumbs.idx
+%pdflatex thumbs.dtx
+%makeindex -s gind.ist thumbs.idx
+%pdflatex thumbs.dtx
+%\end{verbatim}
+% \end{quote}
+%
+% \subsection{Compiling the example}
+%
+% The example file, \textsf{thumbs-example.tex}, can be compiled via\\
+% \indent |latex thumbs-example.tex|\\
+% or (recommended)\\
+% \indent |pdflatex thumbs-example.tex|\\
+% and will need probably at least four~(!) compiler runs to get everything right.
+%
+% \bigskip
+%
+% \section{Acknowledgements}
+%
+% I would like to thank \textsc{Heiko Oberdiek} for providing
+% the \xpackage{hyperref} as well as a~lot~(!) of other useful packages
+% (from which I also got everything I know about creating a file in
+% \xext{dtx} format, ok, say it: copying),
+% and the \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex}
+% newsgroups and everybody at \url{http://tex.stackexchange.com/}
+% for their help in all things \TeX{} (especially \textsc{David Carlisle}
+% for \url{http://tex.stackexchange.com/a/45654/6865}).
+% Thanks for bug reports go to \textsc{Veronica Brandt} and
+% \textsc{Martin Baute} (even two bug reports).
+%
+% \bigskip
+%
+% \phantomsection
+% \begin{History}\label{History}
+% \begin{Version}{2010/04/01 v0.01 -- 2011/05/13 v0.46}
+% \item Diverse $\beta $-versions during the creation of this package.\\
+% \end{Version}
+% \begin{Version}{2011/05/14 v1.0a}
+% \item Upload to \url{http://www.ctan.org/pkg/thumbs}.
+% \end{Version}
+% \begin{Version}{2011/05/18 v1.0b}
+% \item When more than one thumb mark is places at one single page,
+% the variables containing the values (text, colour, backgroundcolour)
+% of those thumb marks are now created dynamically. Theoretically,
+% one can now have $2\,147\,483\,647$ thumb marks at one page instead of
+% six thumb marks (as with \xpackage{thumbs} version~1.0a),
+% but I am quite sure that some other limit will be reached before the
+% $2\,147\,483\,647^ \textrm{th} $ thumb mark.
+% \item Bug fix: When a document using the \xpackage{thumbs} package was compiled,
+% and the \xfile{.aux} and \xfile{.tmb} files were created, and the
+% \xfile{.tmb} file was deleted (or renamed or moved),
+% while the \xfile{.aux} file was not deleted (or renamed or moved),
+% and the document was compiled again, and the \xfile{.aux} file was
+% reused, then reading from the then empty \xfile{.tmb} file resulted
+% in an endless loop. Fixed.
+% \item Minor details.
+% \end{Version}
+% \begin{Version}{2011/05/20 v1.0c}
+% \item The thumb mark width is written to the \xfile{log} file (in |verbose| mode
+% only). The knowledge of the value could be helpful for the user,
+% when option |width={auto}| was used, and one wants the thumb marks to be
+% half as big, or with double width, or a little wider, or a little
+% smaller\ldots\ Also thumb marks' height, top thumb margin and bottom thumb
+% margin are given. Look for\\
+% |************** THUMB dimensions **************|\\
+% in the \xfile{log} file.
+% \item Bug fix: There was a\\
+% | \advance\th@mbheighty-\th@mbsdistance|,\\
+% where\\
+% | \advance\th@mbheighty-\th@mbsdistance|\\
+% | \advance\th@mbheighty-\th@mbsdistance|\\
+% should have been, causing wrong thumb marks' height, thereby wrong number
+% of thumb marks per column, and thereby another endless loop. Fixed.
+% \item The \xpackage{ifthen} package is no longer required for the \xpackage{thumbs}
+% package, removed from its |\RequirePackage| entries.
+% \item The \xpackage{infwarerr} package is used for its |\@PackageInfoNoLine| command.
+% \item The \xpackage{warning} package is no longer used by the \xpackage{thumbs}
+% package, removed from its |\RequirePackage| entries. Instead,
+% the \xpackage{atveryend} package is used, because it is loaded anyway
+% when the \xpackage{hyperref} package is used.
+% \item Minor details.
+% \end{Version}
+% \begin{Version}{2011/05/26 v1.0d}
+% \item Bug fix: labels or index or glossary entries were gobbled for the thumb marks
+% overview page, but gobbling leaked to the rest of the document; fixed.
+% \item New option |silent|, complementary to old option |verbose|.
+% \item New option |draft| (and complementary option |final|), which
+% \textquotedblleft de-coloures\textquotedblright\ the thumb marks
+% and reduces their width to~$2\unit{pt}$.
+% \end{Version}
+% \begin{Version}{2011/06/02 v1.0e}
+% \item Gobbling of labels or index or glossary entries improved.
+% \item Dimension |\thumbsinfodimen| no longer needed.
+% \item Internal command |\thumbs@info| no longer needed, removed.
+% \item New value |autoauto| (not default!) for option |width|, setting the thumb marks
+% width to fit the widest thumb mark text.
+% \item When |width={autoauto}| is not used, a warning is issued, when the thumb marks
+% width is smaller than the thumb mark text.
+% \item Bug fix: Since version v1.0b as of 2011/05/18 the number of thumb marks at one
+% single page was no longer limited to six, but the example still stated this.
+% Fixed.
+% \item Minor details.
+% \end{Version}
+% \begin{Version}{2011/06/08 v1.0f}
+% \item Bug fix: |\th@mb@titlelabel| should be defined |\empty| at the beginning
+% of the package: fixed. (Bug reported by \textsc{Veronica Brandt}. Thanks!)
+% \item Bug fix: |\thumbs@distance| versus |\th@mbsdistance|: There should be only
+% two times |\thumbs@distance|, the value of option |distance|,
+% otherwise it should be the length |\th@mbsdistance|: fixed.
+% (Also this bug reported by \textsc{Veronica Brandt}. Thanks!)
+% \item |\hoffset| and |\voffset| are now ignored by default,
+% but can be regarded using the options |ignorehoffset=false|
+% and |ignorevoffset=false|.
+% (Pointed out again by \textsc{Veronica Brandt}. Thanks!)
+% \item Added to documentation: The package takes the dimensions |\AtBeginDocument|,
+% thus later the page dimensions should not be changed.
+% Now explicitly stated this in the documentation. |\paperwidth| changes
+% are probably possible.
+% \item Documentation and example now give a lot more details.
+% \item Changed diverse details.
+% \end{Version}
+% \begin{Version}{2011/06/24 v1.0g}
+% \item Bug fix: When \xpackage{hyperref} was \textit{not} used,
+% then some labels were not set at all~- fixed.
+% \item Bug fix: When more than one Table of Tumbs was created with the
+% |\thumbsoverview| command, there were some
+% |counter ... already defined|-errors~- fixed.
+% \item Bug fix: When more than one Table of Tumbs was created with the
+% |\thumbsoverview| command, there was a
+% |Label TableofTumbs multiply defined|-error and it was not possible
+% to refer to any but the last Table of Tumbs. Fixed with labels
+% |TableofTumbs1|, |TableofTumbs2|,\ldots\ (|TableofTumbs| still aims
+% at the last used Table of Thumbs for compatibility.)
+% \item Bug fix: Sometimes the thumb marks were stopped one page too early
+% before the Table of Thumbs~- fixed.
+% \item Some details changed.
+% \end{Version}
+% \begin{Version}{2011/08/08 v1.0h}
+% \item Replaced |\global\edef| by |\xdef|.
+% \item Now using the \xpackage{pagecolor} package. Empty thumb marks now
+% inherit their colour from the pages's background. Option |pagecolor|
+% is therefore obsolete.
+% \item The \xpackage{pagesLTS} package has been replaced by the
+% \xpackage{pageslts} package.
+% \item New kinds of thumb mark overview pages introduced additionally to
+% |\thumbsoverview|: |\thumbsoverviewback|, |\thumbsoverviewverso|,
+% and |\thumbsoverviewdouble|.
+% \item New option |hidethumbs=true| to hide thumb marks (and their
+% overview page(s)).
+% \item Option |ignorehoffset| did not work for the thumb marks overview page(s)~-
+% neither |true| nor |false|; fixed.
+% \item Changed a huge number of details.
+% \end{Version}
+% \begin{Version}{2011/08/22 v1.0i}
+% \item Hot fix: \TeX{} 2011/06/27 has changed |\enddocument| and
+% thus broken the |\AtVeryVeryEnd| command/hooking
+% of \xpackage{atveryend} package as of 2011/04/23, v1.7.
+% Version 2011/06/30, v1.8, fixed it, but this version was not available
+% at \url{CTAN.org} yet. Until then |\AtEndAfterFileList| was used.
+% \end{Version}
+% \begin{Version}{2011/10/19 v1.0j}
+% \item Changed some Warnings into Infos (as suggested by \textsc{Martin Baute}).
+% \item The SW(P)-warning is now only given |\IfFileExists{tcilatex.tex}|,
+% otherwise just a message is given. (Warning questioned by
+% \textsc{Martin Baute}, thanks.)
+% \item New option |nophantomsection| to \emph{globally} disable the automatical
+% placement of a |\phantomsection| before \emph{all} thumb marks.
+% \item New command |\thumbsnophantom| to \emph{locally} disable the automatical
+% placement of a |\phantomsection| before the \emph{next} thumb mark.
+% \item README fixed.
+% \item Minor details changed.
+% \end{Version}
+% \begin{Version}{2012/01/01 v1.0k}
+% \item Bugfix: Wrong installation path given in the documentation, fixed.
+% \item No longer uses the |th@mbs@tmpA| counter but uses |\@tempcnta| instead.
+% \item No longer abuses the |\th@mbposyA| dimension but |\@tempdima|.
+% \item Update of documentation, README, and \xfile{dtx} internals.
+% \end{Version}
+% \begin{Version}{2012/01/07 v1.0l}
+% \item Bugfix: Used a |\@tempcnta| where a |\@tempdima| should have been.
+% \end{Version}
+% \begin{Version}{2012/02/23 v1.0m}
+% \item Bugfix: Replaced |\newcommand{\QTO}[2]{#2}| (for SWP) by
+% |\providecommand{\QTO}[2]{#2}|.
+% \item Bugfix: When the \xpackage{tikz} package was loaded before \xpackage{thumbs},
+% in |twoside|-mode the thumb marks were printed at the wrong side
+% of the page. (Bug reported by \textsc{Martin Baute}, thanks!) With
+% \xpackage{hyperref} it really depends on the loading order of the
+% three packages.
+% \item Now using |\ltx@ifpackageloaded| from the \xpackage{ltxcmds} package
+% to check (after |\begin{document}|) whether the \xpackage{hyperref}
+% package was loaded.
+% \item For the thumb marks |\parbox|es instead of |\makebox|es are used
+% (just in case somebody wants to place two lines into a thumb mark, e.\,g.\\
+% |Sch |\\
+% |St|\\
+% in a phone book, where the other |S|es are placed in another chapter).
+% \item Minor details changed.
+% \end{Version}
+% \begin{Version}{2012/02/25 v1.0n}
+% \item Check for loading order of \xpackage{tikz} and \xpackage{hyperref} replaced
+% by robust method. (Thanks to \textsc{David Carlisle},
+% \url{http://tex.stackexchange.com/a/45654/6865}!)
+% \item Fixed \texttt{url}-handling in the example in case the \xpackage{hyperref}
+% package was not loaded.
+% \item In the index the line-numbers of definitions were not underlined; fixed.
+% \item In the \xfile{thumbs-example} there are now a few words about
+% \textquotedblleft paragraph-thumbs\textquotedblright{}
+% (i.\,e.~text which is too long for the width of a thumb mark).
+% \end{Version}
+% \begin{Version}{2013/08/22 v1.0o, not released to the general public}
+% \item \textsc{Stephanie Hein} requested the feature to be able to increase
+% the horizontal space between page edge and the text inside of the
+% thumb mark. Therefore options |evenindent| and |oddexdent| were
+% implemented (later renamed to |eventxtindent| and |oddtxtexdent|).
+% \item \textsc{Bjorn Victor} reported the same problem and also the one,
+% that two marks are not printed at the exact same vertical position
+% on recto and verso pages. Because this can be seen with a lot of
+% duplex printers, the new option |evenprintvoffset| allows to
+% vertically shift the marks on even pages by any length.
+% \end{Version}
+% \begin{Version}{2013/09/17 v1.0p, not released to the general public}
+% \item The thumb mark text is now set in |\parbox|es everywhere.
+% \item \textsc{Heini Geiring} requested the feature to be able to
+% horizontally move the marks away from the page edge,
+% because this is useful when using brochure printing
+% where after the printing the physical page edge is changed
+% by cutting the paper. Therefore the options |evenmarkindent| and
+% |oddmarkexdent| were introduced and the options |evenindent| and
+% |oddexdent| were renamed to |eventxtindent| and |oddtxtexdent|.
+% \item Changed a lot of internal details.
+% \end{Version}
+% \begin{Version}{2014/03/09 v1.0q}
+% \item New version of the \xpackage{atveryend} package is now available at
+% \url{CTAN.org} (see entry in this history for
+% \xpackage{thumbs} version |[2011/08/22 v1.0i]|).
+% \item Support for SW(P) drastically reduced. No more testing is performed.
+% Get a current \TeX{} distribution instead!
+% \item New option |txtcentered|: If it is set to |true|,
+% the thumb's text is placed using |\centering|,
+% otherwise either |\raggedright| or |\raggedleft|
+% (depending on left or right page for double sided documents).
+% \item |\normalsize| added to prevent
+% \textquotedblleft font size leakage\textquotedblright{}
+% from the respective page.
+% \item Handling of obsolete options (mainly from version 2013/08/22 v1.0o)
+% added.
+% \item Changed (hopefully improved) a lot of details.
+% \end{Version}
+% \end{History}
+%
+% \bigskip
+%
+% When you find a mistake or have a suggestion for an improvement of this package,
+% please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.)\\
+%
+% \bigskip
+%
+% Note: \textsf{X} and \textsf{Y} are not missing in the following index,
+% but no command \emph{beginning} with any of these letters has been used in this
+% \xpackage{thumbs} package.
+%
+% \pagebreak
+%
+% \PrintIndex
+%
+% \Finale
+\endinput \ No newline at end of file
diff --git a/macros/latex/contrib/thumbs/thumbs.pdf b/macros/latex/contrib/thumbs/thumbs.pdf
new file mode 100644
index 0000000000..9aadb33a69
--- /dev/null
+++ b/macros/latex/contrib/thumbs/thumbs.pdf
Binary files differ