diff options
author | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2011-08-02 19:24:13 +0000 |
---|---|---|
committer | Manuel Pégourié-Gonnard <mpg@elzevir.fr> | 2011-08-02 19:24:13 +0000 |
commit | d20740d22f94c2e08022bc2661f556f780d69b6e (patch) | |
tree | 434eef98ac2599c46d82ca9eaa2ca3470ee4b1fc /Master/texmf-dist/source/latex/thumbs/thumbs.dtx | |
parent | d95bf37641f0782c7c929b8977be9f84d45b0b3f (diff) |
thumbs 2011/06/24, v1.0g
git-svn-id: svn://tug.org/texlive/trunk@23344 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/thumbs/thumbs.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/thumbs/thumbs.dtx | 900 |
1 files changed, 692 insertions, 208 deletions
diff --git a/Master/texmf-dist/source/latex/thumbs/thumbs.dtx b/Master/texmf-dist/source/latex/thumbs/thumbs.dtx index f3650d90243..8d319613ed9 100644 --- a/Master/texmf-dist/source/latex/thumbs/thumbs.dtx +++ b/Master/texmf-dist/source/latex/thumbs/thumbs.dtx @@ -1,7 +1,7 @@ % \iffalse meta-comment % % File: thumbs.dtx -% Version: 2011/05/20 v1.0c +% Version: 2011/06/24 v1.0g % % Copyright (C) 2010, 2011 by % H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de> @@ -79,7 +79,7 @@ \input docstrip.tex \Msg{*************************************************************************} \Msg{* Installation} -\Msg{* Package: thumbs 2011/05/20 v1.0c Thumb marks and overwiew page(s) (HMM)} +\Msg{* Package: thumbs 2011/06/24 v1.0g Thumb marks and overwiew page(s) (HMM)} \Msg{*************************************************************************} \keepsilent @@ -91,7 +91,7 @@ This is a generated file. Project: thumbs -Version: 2011/05/20 v1.0c +Version: 2011/06/24 v1.0g Copyright (C) 2010, 2011 by H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de> @@ -175,7 +175,7 @@ and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e}[2009/09/24] \ProvidesFile{thumbs.drv}% - [2011/05/20 v1.0c Thumb marks and overwiew page(s) (HMM)]% + [2011/06/24 v1.0g Thumb marks and overwiew page(s) (HMM)]% \documentclass[landscape]{ltxdoc}[2007/11/11]% v2.0u \usepackage{geometry}[2010/09/12]% v5.6 \usepackage{holtxdoc}[2011/02/04]% v0.21 @@ -212,7 +212,7 @@ and the derived files % % \fi % -% \CheckSum{1678} +% \CheckSum{1995} % % \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 @@ -260,9 +260,12 @@ and the derived files % \DoNotIndex{\chapter,\section} % \DoNotIndex{\arabic,\c@th@mbs@tmpA,\endcsname,\ifnum,\newpage,\setcounter,\advance} % \DoNotIndex{\setlength,\the,\value,\textbackslash,\,} +% \DoNotIndex{\color,\copyright,\frac,\null,\thumbsinfo,\thumbsinfoa,\thumbsinfob} +% \DoNotIndex{\@PackageInfoNoLine,\addtocounter,\csname,\divide,\do,\empty} +% \DoNotIndex{\hspace,\thepage} % % \title{The \xpackage{thumbs} package} -% \date{2011/05/20 v1.0c} +% \date{2011/06/24 v1.0g} % \author{H.-Martin M\"{u}nch\\\xemail{Martin.Muench at Uni-Bonn.de}} % % \maketitle @@ -270,6 +273,11 @@ and the derived files % \begin{abstract} % This \LaTeX\ package allows to create one or more customizable thumb index(es), % providing a quick and easy reference methode 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 @@ -290,7 +298,7 @@ and the derived files % % \tableofcontents % -% \newpage +% \bigskip % % \section{Introduction} % \indent This package puts running, customizable thumb marks in the outer @@ -302,6 +310,14 @@ and the derived files % 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.} @@ -313,7 +329,36 @@ and the derived files % \begin{quote} % |\usepackage[<|\textit{options}|>]{thumbs}| % \end{quote} -% \noindent in the preamble of your \LaTeXe\ source file. +% \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 occure 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} @@ -350,6 +395,8 @@ and the derived files % marks. If smaller thumb marks are really wanted, choose a smaller |minheight| % (e.\,g.~$0\unit{pt}$). % +% \pagebreak +% % \subsubsection{width\label{sss:width}} % \DescribeMacro{width} % \indent Option |width| wants to know the horizontal extension of each thumb mark. @@ -357,7 +404,8 @@ and the derived files % 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!) +% 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} @@ -368,7 +416,7 @@ and the derived files % \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 |\voffset| plus |\topmargin|. Dimensions (e.\,g. $1\unit{cm}$) +% is 1 inch plus |\th@bmsvoffset| plus |\topmargin|. Dimensions (e.\,g. $1\unit{cm}$) % are also accepted. % % \subsubsection{bottomthumbmargin\label{sss:bottomthumbmargin}} @@ -376,9 +424,9 @@ and the derived files % \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+\voffset+\topmargin-\thumbs@distance+\th@mbheighty+\headheight+|% -% |\headsep+\textheight+\footskip|\newline% -% |-\thumbs@distance-\th@mbheighty|.\\ +% |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{thumblink\label{sss:thumblink}} @@ -401,7 +449,20 @@ and the derived files % \item[- |rule|] hyperlinks the whole \emph{rule}. % \end{description} % -% \pagebreak +% \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} @@ -412,7 +473,18 @@ and the derived files % 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 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.\\ +% +% \bigskip +% % \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} @@ -429,6 +501,7 @@ and the derived files % (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 @@ -441,21 +514,25 @@ and the derived files % \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} % \DescribeMacro{\thumbsoverview} % The command |\thumbsoverview| is used to place the overview page(s) for the thumb marks. % Its single parameter is used to mark this page/these pages (e.\,g. in the page header). % If these marks are not whished, |\thumbsoverview{}| will generate empty marks in the -% page header(s). |\thumbsoverview| could be used more than once (for example at the -% beginning and at the end of the document), but the label |TableOfThumbs| would than -% be multilpy defined (no great harm done, but hyperlinks will only link to one of the -% labels).\\ +% 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).\\ % +% \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 @@ -465,6 +542,7 @@ and the derived files % 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 @@ -569,7 +647,7 @@ and the derived files linktoc=all]{hyperref}[2011/04/17]% v6.82g \usepackage[pagecolor=white,thumblink=rule,linefill=dots,height={auto},minheight={47pt},% width={auto},distance={2mm},topthumbmargin={auto},bottomthumbmargin={auto},% - verbose=true]{thumbs}[2011/05/20]% v1.0c + ignorehoffset=true,ignorevoffset=true,verbose=true]{thumbs}[2011/06/24]% v1.0g \gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}% \listfiles \begin{document} @@ -579,13 +657,15 @@ and the derived files \markboth{Example for thumbs}{Example for thumbs} This example demonstrates the most common uses of package -\textsf{thumbs}, v1.0c as of 2011/05/20 (HMM). +\textsf{thumbs}, v1.0g as of 2011/06/24 (HMM). The used options were \texttt{pagecolor=white}, \texttt{thumblink=rule}, \texttt{linefill=dots}, \texttt{height=auto}, \texttt{minheight=\{47pt\}}, width={auto}, \texttt{distance=\{2mm\}}, \texttt{topthumbmargin=\{auto\}}, -\texttt{bottomthumbmargin=\{auto\}}, and \texttt{verbose=true}. -These are the default options, except \texttt{verbose=true}. +\texttt{bottomthumbmargin=\{auto\}}, \texttt{ignorehoffset=true}, +\texttt{ignorevoffset=true},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, @@ -596,7 +676,39 @@ the references in the overview page for the thumb marks are also hyperlinked {\color{green} 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.} +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 (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. + +\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 occure 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 @@ -727,22 +839,19 @@ and another. \addthumb{Huge Text}{\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.\label{HugeText} + \addthumb{bold text }{\textbf{Bf Text}}{pink}{blue} \addthumb{Huge Bold Text}{\Huge{\textbf{HBT}}}{black}{yellow} -When there is more than one thumb mark at one page, this is no problem. -When more than six (6) thumb marks are at one (1) page, -only the first six will be shown, -while all will appear in the thumbs overview page. -On the following pages the correct, last thumb mark will appear. -More than one thumb mark at one page probably does not make much sense. -This package was not created to create decorations at the page margin, -but if you really need more than six thumb marks at one page, -feel free to send an e-mail to the maintainer. -If you have got an idea how to dynamically create thumb -\textquotedblleft registers\textquotedblright\ (thereby overcomming -this limitation), please send an e-mail to the maintainer, too. +\bigskip + +When there is more than one thumb mark at one page, this is also no problem. \newpage @@ -764,6 +873,9 @@ Some text 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} @@ -773,14 +885,14 @@ I just need to add further thumb marks to get them reaching the bottom of the pa 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 colum is started +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 colum was started automatically! +There! A new thumb column was started automatically! \newpage @@ -818,7 +930,7 @@ Some text. \thumbnewcolumn \addthumb{New thumb marks column}{\Huge{\textit{NC}}}{magenta}{black} -There! A new thumb colum was started manually! +There! A new thumb column was started manually! \newpage @@ -830,11 +942,78 @@ Some text. I just added another thumb mark. +% \end{macrocode} +% +% \pagebreak +% +% \begin{macrocode} +\newpage + +\pagecolor{green} + +\makeatletter + \@ifundefined{Hy@Warning}{% hyperref not loaded + \let\url\verb% + }{% hyperref loaded + \phantomsection% + }% +\makeatother + +\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\ldots{}) + +\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 somwhere 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 version of the viewer (at same operating +system) at one PC shows white margins, and at another one does not. Strange. +Even stranger: The same document sometimes is presented with white lines +and sometimes without.\newline +But at least it does not influence the printed version. +% \end{macrocode} +% +% \pagebreak +% +% \begin{macrocode} + \newpage -Well, I think that are enough thumb marks. +\pagecolor{white} -Good bye! +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}. + +\thumbsoverview{Table of Thumbs again} \end{document} %</example> @@ -842,8 +1021,7 @@ Good bye! % % \pagebreak % -% \StopEventually{ -% } +% \StopEventually{} % % \section{The implementation} % @@ -855,8 +1033,8 @@ Good bye! % \end{macrocode} % % \begin{macrocode} -\NeedsTeXFormat{LaTeX2e}[1994/06/01]% or later -\ProvidesPackage{thumbs}[2011/05/20 v1.0c +\NeedsTeXFormat{LaTeX2e}[2009/09/24] +\ProvidesPackage{thumbs}[2011/06/24 v1.0g Thumb marks and overwiew page(s) (HMM)] % \end{macrocode} @@ -873,7 +1051,7 @@ Good bye! % For SW(P) users, we issue a warning. Unfortunately, we cannot check for the used % software (can we?), 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. (Thus: RTFM of thumbs!) +% even reach the users. (Thus: Read the manual of the \xpackage{thumbs} package!) % The options for those packages might be changed by the user -- I did not % test all available options, thus first test, whether the document can be compiled % with these options, and then try to change them according to your whishes. @@ -906,19 +1084,20 @@ Good bye! % as well as some other packages: % % \begin{macrocode} -\RequirePackage{atbegshi}[2011/01/30]% v1.15 -\RequirePackage{xcolor}[2007/01/21]% v2.11 -\RequirePackage{picture}[2009/10/11]% v1.3 -\RequirePackage{alphalph}[2010/04/18]% v2.3 +\RequirePackage{atbegshi}[2011/01/30]% v1.15 +\RequirePackage{xcolor}[2007/01/21]% v2.11 +\RequirePackage{picture}[2009/10/11]% v1.3 +\RequirePackage{alphalph}[2010/04/18]% v2.3 % \end{macrocode} % % \pagebreak % % For the total number of the current page we need the \xpackage{pagesLTS} -% package of myself (see subsection~\ref{ss:Downloads}): +% package of myself (see subsection~\ref{ss:Downloads}). It also loads +% the \xpackage{undolabl} package, which is needed for |\overridelabel|: % % \begin{macrocode} -\RequirePackage{pagesLTS}[2011/03/17]% v1.1o +\RequirePackage{pagesLTS}[2011/03/17]% v1.1o \RequirePackage{rerunfilecheck}[2011/04/15]% v1.7 \RequirePackage{infwarerr}[2010/04/08]% v1.3 \RequirePackage{atveryend}[2011/04/23]% v1.7 @@ -927,9 +1106,9 @@ Good bye! % A last information for the user: % % \begin{macrocode} -%% thumbs may work with earlier versions of those packages, -%% but this was not tested. Please consider updating your packages -%% to the most recent version (if they are not already the most +%% 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} @@ -948,12 +1127,64 @@ Good bye! \DeclareStringOption{distance}[2mm] \DeclareStringOption{topthumbmargin}[auto] \DeclareStringOption{bottomthumbmargin}[auto] +\DeclareBoolOption[true]{ignorehoffset} +\DeclareBoolOption[true]{ignorevoffset} \DeclareBoolOption[true]{verbose} +\DeclareComplementaryOption{silent}{verbose} +\DeclareBoolOption{draft} +\DeclareComplementaryOption{final}{draft} \ProcessKeyvalOptions* % \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 + \PackageWarningNoLine{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 + \PackageWarningNoLine{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 + \PackageWarningNoLine{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 + \PackageWarningNoLine{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{pagecolor} % We set the (background) page colour to |\thumbs@pagecolor|, because the % \texttt{xcolour} package needs a defined colour here (it~can be changed later). @@ -1015,22 +1246,11 @@ Good bye! \setlength{\th@mbsdistance}{\thumbs@distance} \fi -% \end{macrocode} -% -% When option |verbose| was choosen, information about the thumb marks dimensions -% (and top and bottom thumb marks margin) shall be presented, but -% |\the\something@something| does not work because of |@|. Therefore we need a -% |\thumbsinfodimen| dimen and a command to set it. -% -% \begin{macrocode} -\ifthumbs@verbose - \newdimen\thumbsinfodimen - \newcommand{\thumbs@info}[1]{% - \setlength{\thumbsinfodimen}{#1}% - }% +\ifthumbs@verbose% \relax \else - \PackageWarningNoLine{thumbs}{Option verbose=false found:\MessageBreak% - You will lose some information.} + \PackageWarningNoLine{thumbs}{% + Option verbose=false (or silent=true) found:\MessageBreak% + You will lose some information} \fi % \end{macrocode} @@ -1081,6 +1301,12 @@ Good bye! \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. @@ -1123,9 +1349,22 @@ Good bye! % \end{macrocode} % % 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 + \global\edef\th@mbpaperwidth{\the\paperwidth} \setlength{\th@mbposyA}{1pt} \ifdim \thumbs@minheight < \th@mbposyA% too small \setlength{\thumbs@minheight}{1pt} @@ -1195,8 +1434,8 @@ Good bye! % % \begin{macrocode} \ifthumbs@verbose - \thumbs@info{\th@mbheighty} - \PackageInfo{thumbs}{Now setting thumbs' height to \the\thumbsinfodimen .} + \edef\thumbsinfo{\the\th@mbheighty} + \PackageInfo{thumbs}{Now setting thumbs' height to \thumbsinfo .} \fi \setlength{\th@mbheighty}{\thumbs@height} \fi @@ -1217,37 +1456,71 @@ Good bye! \ifthumbs@verbose \message{^^J} \@PackageInfoNoLine{thumbs}{************** THUMB dimensions **************} - \thumbs@info{\th@mbheighty} - \@PackageInfoNoLine{thumbs}{The height of the thumb marks is \the\thumbsinfodimen} + \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} - \setlength{\th@mbwidthx}{\paperwidth} - \advance\th@mbwidthx-\textwidth - \divide\th@mbwidthx4 - \setlength{\th@mbposyA}{0sp} - \ifx\thumbs@width\empty% + \ifthumbs@draft + \setlength{\th@mbwidthx}{2pt} \else - \def\th@mbstest{auto} - \ifx\thumbs@width\th@mbstest% + \setlength{\th@mbwidthx}{\paperwidth} + \advance\th@mbwidthx-\textwidth + \divide\th@mbwidthx4 + \setlength{\th@mbposyA}{0sp} + \ifx\thumbs@width\empty% \else - \ifdim \thumbs@width > \th@mbposyA% OK - \setlength{\th@mbwidthx}{\thumbs@width} + \def\th@mbstest{auto} + \ifx\thumbs@width\th@mbstest% \else - \PackageError{thumbs}{Thumbs not wide enought}{% - Option width has value '\thumbs@width'.\MessageBreak% - This is not a valid dimension larger than zero.\MessageBreak% - Width will be set automatically.\MessageBreak% - } + \def\th@mbstest{autoauto} + \ifx\thumbs@width\th@mbstest% + \@ifundefined{th@mbmaxwidtha}{% + \if@filesw% + \gdef\th@mbmaxwidtha{0pt} + \setlength{\th@mbwidthx}{\th@mbmaxwidtha} + \AtVeryVeryEnd{ + \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 > \th@mbposyA% OK + \setlength{\th@mbwidthx}{\thumbs@width} + \else +% \end{macrocode} +% +% \pagebreak +% +% \begin{macrocode} + \PackageError{thumbs}{Thumbs not wide enought}{% + 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 - \thumbs@info{\th@mbwidthx} - \@PackageInfoNoLine{thumbs}{The width of the thumb marks is \the\thumbsinfodimen} + \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} % @@ -1258,22 +1531,20 @@ Good bye! % 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} -% \end{macrocode} -% -% \pagebreak -% -% \begin{macrocode} \ifx\thumbs@topthumbmargin\th@mbstest% \setlength{\th@mbposy}{1in} - \advance\th@mbposy+\voffset + \advance\th@mbposy+\th@bmsvoffset \advance\th@mbposy+\topmargin - \advance\th@mbposy-\thumbs@distance + \advance\th@mbposy-\th@mbsdistance \advance\th@mbposy+\th@mbheighty \else \setlength{\th@mbposyA}{-1pt} @@ -1286,16 +1557,16 @@ Good bye! \gdef\thumbs@topthumbmargin{-1pt} \fi \setlength{\th@mbposy}{\thumbs@topthumbmargin} - \advance\th@mbposy-\thumbs@distance + \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+\thumbs@distance - \thumbs@info{\@tempdimc} - \@PackageInfoNoLine{thumbs}{The top thumb margin is \the\thumbsinfodimen} + \advance\@tempdimc+\th@mbsdistance + \edef\thumbsinfo{\the\@tempdimc} + \@PackageInfoNoLine{thumbs}{The top thumb margin is \thumbsinfo} \fi % \end{macrocode} % @@ -1309,30 +1580,32 @@ Good bye! \def\th@mbstest{auto} \ifx\thumbs@bottomthumbmargin\th@mbstest% \setlength{\th@mbposybottom}{1in} - \advance\th@mbposybottom+\voffset + \ifthumbs@ignorevoffset% \relax + \else \advance\th@mbposybottom+\th@bmsvoffset + \fi \advance\th@mbposybottom+\topmargin - \advance\th@mbposybottom-\thumbs@distance + \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-\thumbs@distance + \advance\th@mbposybottom-\th@mbsdistance \advance\th@mbposybottom-\th@mbheighty \else \setlength{\th@mbposyA}{\paperheight} \advance\th@mbposyA-\thumbs@bottomthumbmargin \advance\th@mbposyA-\th@mbposytop - \advance\th@mbposyA-\thumbs@distance + \advance\th@mbposyA-\th@mbsdistance \advance\th@mbposyA-\th@mbheighty - \advance\th@mbposyA-\thumbs@distance + \advance\th@mbposyA-\th@mbsdistance \ifdim \th@mbposyA > 0sp%ok \else \setlength{\th@mbposyA}{\paperheight} \advance\th@mbposyA-\th@mbposytop - \advance\th@mbposyA-\thumbs@distance + \advance\th@mbposyA-\th@mbsdistance \advance\th@mbposyA-\th@mbheighty - \advance\th@mbposyA-\thumbs@distance + \advance\th@mbposyA-\th@mbsdistance \advance\th@mbposyA-1pt \PackageWarning{thumbs}{Thumbs column ending too high.\MessageBreak% Option bottomthumbmargin has value '\thumbs@bottomthumbmargin'.\MessageBreak% @@ -1355,8 +1628,8 @@ Good bye! \ifthumbs@verbose% \setlength{\@tempdimc}{\paperheight} \advance\@tempdimc-\th@mbposybottom - \thumbs@info{\@tempdimc} - \@PackageInfoNoLine{thumbs}{The bottom thumb margin is \the\thumbsinfodimen} + \edef\thumbsinfo{\the\@tempdimc} + \@PackageInfoNoLine{thumbs}{The bottom thumb margin is \thumbsinfo} \@PackageInfoNoLine{thumbs}{**********************************************} \message{^^J} \fi @@ -1393,7 +1666,7 @@ Good bye! \else% \advance\th@mbposy-\th@mbheighty% \advance\th@mbposy-\th@mbsdistance% - \addthumb{}{}{\thumbs@pagecolor}{\thumbs@pagecolor}% + \thumborigaddthumb{}{}{\thumbs@pagecolor}{\thumbs@pagecolor}% \th@mb@dvance% \fi% } @@ -1469,7 +1742,7 @@ Good bye! Thumbs column full, starting another column.\MessageBreak% }% \setlength{\th@mbposy}{\th@mbposytop}% - \advance\th@mbposy\thumbs@distance% + \advance\th@mbposy\th@mbsdistance% \ifx\th@mbcolumn\pagesLTS@zero% \global\edef\th@umbsperpagecount{\th@mbs}% \gdef\th@mbcolumn{1}% @@ -1480,18 +1753,9 @@ Good bye! \global\edef\th@mbs{\arabic{th@mbs@tmpA}}% % \end{macrocode} % -% We do not want any labels or index or glossary entries confusing the -% table of thumbs entries: -% -% \begin{macrocode} - {\let\label\@gobble% - \let\index\@gobble% - \let\glossary\@gobble% -% \end{macrocode} -% % The |\addthumb| command has four parameters: % \begin{enumerate} -% \item a title for the thumb mark(for the thumb marks overview page, +% \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), @@ -1503,11 +1767,35 @@ Good bye! % (parameters in this order). % % \begin{macrocode} - \gdef\th@mbtitle{#1}% - \gdef\th@mbtext{#2}% - \gdef\th@mbtextcolour{#3}% - \gdef\th@mbbackgroundcolour{#4}% - } + \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 dtermined 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). +% +% \begin{macrocode} + \edef\th@mbstmpwidth{\the\th@mbposyA}% + \settowidth{\th@mbposyA}{\th@mbtext\space}% + \ifdim\th@mbposyA>\th@mbmaxwidth% + \global\edef\th@mbmaxwidth{\the\th@mbposyA}% + \fi% + \ifdim\th@mbposyA>\th@mbwidthx% + \ifthumbs@draft% \relax + \else% + \edef\thumbsinfoa{\the\th@mbwidthx} + \edef\thumbsinfob{\the\th@mbposyA} + \PackageWarning{thumbs}{% + Thumb mark too small (width: \thumbsinfoa)\MessageBreak% + or its text too wide (width: \thumbsinfob)\MessageBreak% + }% + \fi% + \fi% + \setlength{\th@mbposyA}{\th@mbstmpwidth}% % \end{macrocode} % % |\@ifpackageloaded| cannot be used after |\AtBeginDocument|, so here @@ -1527,8 +1815,8 @@ Good bye! \@ifundefined{Hy@Warning}{% hyperref not loaded }{% hyperref loaded \phantomsection% - \label{thumbs.\th@mbs}% }% + \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}}% @@ -1554,13 +1842,13 @@ Good bye! \addtocounter{th@mbs@tmpA}{+1}% \global\edef\th@mbonpage{\arabic{th@mbs@tmpA}}% \fi% - \ifx\th@mbtoprint\pagesLTS@zero% - \else% % \end{macrocode} % % \pagebreak % % \begin{macrocode} + \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% @@ -1679,7 +1967,7 @@ Good bye! % \pagebreak % % \begin{macrocode} - \put(1in+\hoffset+\oddsidemargin,-\th@mbposy){% + \put(1in+\oddsidemargin,-\th@mbposy){% \begin{picture}(0,0)% % \end{macrocode} % @@ -1711,11 +1999,20 @@ Good bye! % % \begin{macrocode} \ifx\th@mb@tmp@column\pagesLTS@zero% + \setlength{\th@mbwidthxtoc}{\paperwidth}% + \advance\th@mbwidthxtoc-1in% + \advance\th@mbwidthxtoc-\hoffset% + \advance\th@mbwidthxtoc-\oddsidemargin% + \advance\th@mbwidthxtoc-\th@mbwidthx% + \advance\th@mbwidthxtoc-20pt% + \ifdim\th@mbwidthxtoc>\textwidth% + \setlength{\th@mbwidthxtoc}{\textwidth} + \fi \begin{picture}(0,0)(0,-0.5\th@mbheighty+384930sp)% \bgroup% \setlength{\parindent}{0pt}% - \vbox% to \textwidth - {\hsize=\textwidth {% + \vbox% + {\hsize=\th@mbwidthxtoc {% % \end{macrocode} % % Depending on the value of option |thumblink|, parts of the text are made into hyperlinks: @@ -1826,10 +2123,10 @@ Good bye! % is also presented here. % % \begin{macrocode} - \begin{picture}(0,0)(1in+\hoffset+\oddsidemargin-\th@mbxpos,-0.5\th@mbheighty+384930sp)% + \begin{picture}(0,0)(1in+\th@bmshoffset+\oddsidemargin-\th@mbxpos+20pt,-0.5\th@mbheighty+384930sp)% \bgroup% \setlength{\parindent}{0pt}% - \makebox[\th@mbwidthx][r]{{\color{\th@mb@tmp@textcolour}\th@mb@tmp@text \space}}% + \makebox[\th@mbwidthx][r]{{\color{\th@mb@tmp@textcolour}\th@mb@tmp@text}}% \egroup% \end{picture}% \fi% @@ -1857,8 +2154,6 @@ Good bye! % \end{macrocode} % -% \pagebreak -% % \DescribeMacro{\th@mbprint} % |\th@mbprint| places a |picture| containing the thumb mark on the page. % @@ -1867,23 +2162,23 @@ Good bye! \put(\th@mbxpos,-\th@mbposyA){% \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}% - \ifodd\c@CurrentPage% - \if@twoside% - \makebox[\th@mbwidthx][l]{{\color{#2}\hspace*{1pt}\space #1}}% - \else% - \makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% - \fi% - \else% - \makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% - \fi% - \egroup% - \end{picture}% - }% - } + \end{picture}% + \begin{picture}(0,0)(0,-0.5\th@mbheighty+384930sp)% + \bgroup% + \setlength{\parindent}{0pt}% + \ifodd\c@CurrentPage% + \if@twoside% + \makebox[\th@mbwidthx][l]{{\color{#2}\hspace*{1pt}\space #1}}% + \else% + \makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% + \fi% + \else% + \makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% + \fi% + \egroup% + \end{picture}% + }% + } % \end{macrocode} % @@ -1909,10 +2204,46 @@ Good bye! \fi% \setcounter{th@mbs@tmpA}{\value{CurrentPage}}% \addtocounter{th@mbs@tmpA}{-1}% because CurrentPage is already the one of the next page +% \end{macrocode} +% +% 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% + \global\edef\th@mbpaperwidth{\the\paperwidth}% + \fi% +% \end{macrocode} +% +% Determining the correct |\th@mbxpos|: +% +% \begin{macrocode} \def\th@mbxpos{\th@mbposx}% \ifodd\c@th@mbs@tmpA% \relax \else% - \if@twoside \def\th@mbxpos{-1pt}% \else \relax + \if@twoside% + \ifthumbs@ignorehoffset% + \def\th@mbxpos{-1pt-\hoffset}% + \else% + \def\th@mbxpos{-1pt}% + \fi% +% \end{macrocode} +% +% | \else \relax%| +% +% \begin{macrocode} \fi% \fi% \AtBeginShipoutUpperLeft{% @@ -1930,6 +2261,11 @@ Good bye! \th@mbprint{\th@mbtmpdeftext}{\th@mbtmpdefcolour}{\th@mbtmpdefbackgroundcolour}% }% \fi% +% \end{macrocode} +% +% \pagebreak +% +% \begin{macrocode} \setcounter{th@mbs@tmpA}{\th@mbonpage}% % \end{macrocode} % @@ -1952,6 +2288,8 @@ Good bye! % \end{macrocode} % % \DescribeMacro{\AfterLastShipout} +% |\AfterLastShipout| is executed after the last page has been shiped out. +% It is still possible to e.\,g. write to the \xfile{aux} file at this time. % % \begin{macrocode} \AfterLastShipout{% @@ -1970,9 +2308,9 @@ Good bye! \fi % \end{macrocode} % -% |\AfterLastShipout| the number of thumb marks per overview page -% and the total number of thumb marks are determined and saved -% for the next \LaTeX\ run via the \xfile{.aux} file. +% |\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 @@ -1982,11 +2320,41 @@ Good bye! \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% + \AtVeryVeryEnd{% + \PackageWarningNoLine{thumbs}{% + Rerun to get the thumb marks width right% + } + } + \else + \AtVeryVeryEnd{% + \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@umbsperpage{\th@umbsperpagecount}} - \immediate\write\@auxout{\string - \gdef\string\th@mbsmax{\th@mbs}} + \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} % @@ -2020,17 +2388,17 @@ Good bye! % \end{macrocode} % -% \pagebreak -% % \DescribeMacro{\thumbsoverview} % |\thumbsoverview| is used to place the overview page(s) for the thumb marks. % Its parameter is used to mark this page/these pages (e.\,g. in the page header). % If these marks are not whished, |\thumbsoverview{}| will generate empty marks in the -% page header(s). |\thumbsoverview| could be used more than once (for example at the -% beginning and at the end of the document), but the label |TableOfThumbs| would than -% be multilpy defined (no great harm done, but hyperlinks will only link to one of the -% labels). |\thumbsoverview| works by calling the internal command |\th@mbs@verview| -% (see below), repeating this until all thumb marks have been processed. +% 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).\\ +% |\thumbsoverview| works by calling the internal command |\th@mbs@verview| (see below), +% repeating this until all thumb marks have been processed. % % \begin{macrocode} \newcommand{\thumbsoverview}[1]{% @@ -2092,19 +2460,41 @@ Good bye! % % \begin{macrocode} \edef\th@mbprintingovertoc{\th@mbprinting}% - \stopthumb% - \markboth{\MakeUppercase #1 }{\MakeUppercase #1 } - \setlength{\th@mbsposytocy}{\th@mbposy} - \setlength{\th@mbposy}{\th@mbsposytocyy} - \newcounter{th@mblinea} - \setcounter{th@mblinea}{1} - \newcounter{th@mblineb} - \setcounter{th@mblineb}{\th@umbsperpage} - \newcounter{FileLine} - \setcounter{FileLine}{1} - \newcounter{thumbsstop} - \setcounter{thumbsstop}{1} - \addtocounter{thumbsstop}{\th@mbsmax} + \ifnum \th@mbsmax > \pagesLTS@zero% + \if@twoside \cleardoublepage% + \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% + \setcounter{th@mblinea}{\th@mbstable}% + \addtocounter{th@mblinea}{+1}% + \global\edef\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{macrocode} + \let\thumbsoriglabel\label% + \let\thumbsorigindex\index% + \let\thumbsorigglossary\glossary% + \let\label\@gobble% + \let\index\@gobble% + \let\glossary\@gobble% \@whilenum\value{FileLine}<\value{thumbsstop}\do% {\if@twoside \cleardoublepage% \else \clearpage% @@ -2112,14 +2502,30 @@ Good bye! % \end{macrocode} % % When the \xpackage{hyperref} package is used, one might like to refer to the -% thumb overview page(s), therefore a phantomsection is added and a label -% |TableOfThumbs| is placed here. When |\addthumbsoverviewtocontents| was used, -% the entry is placed into the table of contents. +% thumb overview page(s), therefore 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} \ifnum\value{FileLine}=1% - \@ifundefined{Hy@Warning}{}{\phantomsection \label{TableOfThumbs}}% - \ifx\th@mbs@toc@level\empty% + \@ifundefined{Hy@Warning}{}{\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% \fi% @@ -2133,15 +2539,21 @@ Good bye! }% % \end{macrocode} % -% \pagebreak -% -% After the overview, the current thumb mark (if there is any) is restored. +% 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} @@ -2187,11 +2599,6 @@ Good bye! \message{Executing \jobname.tmb line \arabic{FileLine}.^^J}% \fi% \@thumbsout% -% \end{macrocode} -% -% \pagebreak -% -% \begin{macrocode} \else% THIS SHOULD NEVER HAPPEN! \PackageError{thumbs}{Unexpected error! (Really!)}{% ! You are in trouble here.\MessageBreak% @@ -2254,11 +2661,33 @@ Good bye! % \end{macrocode} % +% \pagebreak +% +% 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% + +\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} +% % \begin{macrocode} %</package> % \end{macrocode} % -% \bigskip +% \pagebreak % % \section{Installation} % @@ -2306,8 +2735,6 @@ Good bye! % \item[-] package \xpackage{rerunfilecheck}, 2011/04/15, v1.7, \CTAN{macros/latex/contrib/oberdiek/rerunfilecheck.dtx} % \end{description} % -% \pagebreak -% % \DescribeMacro{SW/SWP} % When compiling with SWP 5.50 Build 2960 (\copyright~MacKichan Software, Inc.), % these additional packages are needed: @@ -2327,6 +2754,8 @@ Good bye! % thus first test, whether the document can be compiled with these options, and then try to change them % according to your whishes.)\\ % +% \pagebreak +% % \DescribeMacro{thumb-example.tex} % The |thumb-example.tex| requires the same files as all documents using the \xpackage{thumbs} % package and additionally: @@ -2337,7 +2766,7 @@ Good bye! % % \item[-] package \xpackage{hyperref}, 2011/04/17, v6.82g, \CTAN{macros/latex/contrib/hyperref/hyperref.dtx} % -% \item[-] package \xpackage{thumbs}, 2011/05/20, v1.0c, \CTAN{macros/latex/contrib/thumbs/thumbs.dtx}\\ +% \item[-] package \xpackage{thumbs}, 2011/06/24, v1.0g, \CTAN{macros/latex/contrib/thumbs/thumbs.dtx}\\ % (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?) @@ -2366,8 +2795,6 @@ Good bye! % \item[-] \xpackage{thumby}, 2010/01/14, v0.1, \CTAN{macros/latex/contrib/thumby/thumby.sty} % \end{description} % -% \pagebreak -% % \DescribeMacro{Oberdiek} % \DescribeMacro{holtxdoc} % \DescribeMacro{alphalph} @@ -2570,7 +2997,8 @@ Good bye! % (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 for their help in all things \TeX. +% newsgroups for their help in all things \TeX. Thanks for bug reports go +% to \textsc{Veronica Brandt}. % % \bigskip % @@ -2593,13 +3021,12 @@ Good bye! % \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, +% 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} files resulted +% reused, then reading from the then empty \xfile{.tmb} file resulted % in an endless loop. Fixed. % \item Minor details. % \end{Version} -% \pagebreak % \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, @@ -2616,13 +3043,70 @@ Good bye! % | \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, removed. +% \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, removed. Instead, +% \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 \xpackage{hyperref} is used. +% 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 stoped one page too early +% before the Table of Thumbs~- fixed. +% \item Some details changed. +% \end{Version} % \end{History} % % \bigskip @@ -2634,7 +3118,7 @@ Good bye! % but no command \emph{beginning} with any of these letters has been used in this % \xpackage{thumbs} package. % -% \pagebreak +% \bigskip % % \PrintIndex % |