diff options
author | Karl Berry <karl@freefriends.org> | 2012-02-24 23:45:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-02-24 23:45:03 +0000 |
commit | ab3cc094064444f0ca192823496de66c71d06710 (patch) | |
tree | f21d2d16e85e15848255e9a4798e202cc8de3f09 /Master/texmf-dist/source/latex/thumbs/thumbs.dtx | |
parent | 63adbb64d2b9021aad1f190588588f3d47dfe8a2 (diff) |
thumbs (24feb12)
git-svn-id: svn://tug.org/texlive/trunk@25498 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 | 250 |
1 files changed, 179 insertions, 71 deletions
diff --git a/Master/texmf-dist/source/latex/thumbs/thumbs.dtx b/Master/texmf-dist/source/latex/thumbs/thumbs.dtx index d68b26f0a8d..b88d1f269ee 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: 2012/01/07 v1.0l +% Version: 2012/02/23 v1.0m % % Copyright (C) 2010 - 2012 by % H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de> @@ -83,7 +83,7 @@ \input docstrip.tex \Msg{**************************************************************************} \Msg{* Installation *} -\Msg{* Package: thumbs 2012/01/07 v1.0l Thumb marks and overview page(s) (HMM)*} +\Msg{* Package: thumbs 2012/02/23 v1.0m Thumb marks and overview page(s) (HMM)*} \Msg{**************************************************************************} \keepsilent @@ -95,7 +95,7 @@ This is a generated file. Project: thumbs -Version: 2012/01/07 v1.0l +Version: 2012/02/23 v1.0m Copyright (C) 2010 - 2012 by H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de> @@ -179,9 +179,9 @@ the README, and the derived files %<*driver> \NeedsTeXFormat{LaTeX2e}[2011/06/27] \ProvidesFile{thumbs.drv}% - [2012/01/07 v1.0l Thumb marks and overview page(s) (HMM)] + [2012/02/23 v1.0m Thumb marks and overview page(s) (HMM)] \documentclass[landscape]{ltxdoc}[2007/11/11]% v2.0u -\usepackage[maxfloats=20]{morefloats}[2011/07/10]% v1.0e +\usepackage[maxfloats=20]{morefloats}[2012/01/28]% v1.0f \usepackage{geometry}[2010/09/12]% v5.6 \usepackage{holtxdoc}[2011/02/04]% v0.21 %% thumbs may work with earlier versions of LaTeX2e and those @@ -217,7 +217,7 @@ the README, and the derived files % % \fi % -% \CheckSum{2367} +% \CheckSum{2501} % % \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 @@ -272,13 +272,13 @@ the README, and the derived files % \DoNotIndex{\hspace,\thepage,\do,\empty} % % \title{The \xpackage{thumbs} package} -% \date{2012/01/07 v1.0l} +% \date{2012/02/23 v1.0m} % \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), +% This \LaTeX2e{} 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 @@ -698,7 +698,7 @@ the README, and the derived files %% \usepackage[math]{cellspace} % %% \usepackage{xcolor} % %% \pagecolor{white} % -%% \newcommand{\QTO}[2]{#2} % +%% \providecommand{\QTO}[2]{#2} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{lipsum}[2011/04/14]% v1.2 \usepackage{eurosym}[1998/08/06]% v1.1 @@ -712,18 +712,18 @@ the README, and the derived files pdfsubject={Example for the thumbs package},% pdfkeywords={LaTeX, thumbs, thumb marks, H.-Martin Muench},% pdfview=Fit,pdfstartview=Fit,% - linktoc=all]{hyperref}[2011/12/04]% v6.82m + linktoc=all]{hyperref}[2012/02/06]% v6.82o \usepackage[thumblink=rule,linefill=dots,height={auto},minheight={47pt},% width={auto},distance={2mm},topthumbmargin={auto},bottomthumbmargin={auto},% nophantomsection=false,ignorehoffset=true,ignorevoffset=true,final=true,% - hidethumbs=false,verbose=true]{thumbs}[2012/01/07]% v1.0l + hidethumbs=false,verbose=true]{thumbs}[2012/02/23]% v1.0m \nopagecolor% use \pagecolor{white} if \nopagecolor does not work \gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}% \makeatletter - \@ifundefined{Hy@Warning}{% hyperref not loaded - \@ifundefined{\url}{\let\url\verb}% neither url - }{% hyperref loaded - }% +\ltx@ifpackageloaded{hyperref}{% hyperref loaded +}{% hyperref not loaded +\@ifundefined{\url}{\let\url\verb}% neither url +}% \makeatother \listfiles \begin{document} @@ -733,7 +733,7 @@ the README, and the derived files \markboth{Example for thumbs}{Example for thumbs} This example demonstrates the most common uses of package -\textsf{thumbs}, v1.0l as of 2012/01/07 (HMM). +\textsf{thumbs}, v1.0m as of 2012/02/23 (HMM). The used options were \texttt{thumblink=rule}, \texttt{linefill=dots}, \texttt{height=auto}, \texttt{minheight=\{47pt\}}, \texttt{width={auto}}, \texttt{distance=\{2mm\}}, \newline @@ -1053,9 +1053,10 @@ I just added another thumb mark. \pagecolor{green} \makeatletter - \@ifundefined{Hy@Warning}{% hyperref not loaded - }{\phantomsection% hyperref loaded - }% +\ltx@ifpackageloaded{hyperref}{% hyperref loaded +\phantomsection% +}{% hyperref not loaded +}% \makeatother % \end{macrocode} @@ -1136,7 +1137,7 @@ Text can be placed after any of the Tables of Thumbs, of course. % % \begin{macrocode} \NeedsTeXFormat{LaTeX2e}[2011/06/27] -\ProvidesPackage{thumbs}[2012/01/07 v1.0l +\ProvidesPackage{thumbs}[2012/02/23 v1.0m Thumb marks and overview page(s) (HMM)] % \end{macrocode} @@ -1172,7 +1173,7 @@ Text can be placed after any of the Tables of Thumbs, of course. \string\usepackage[math]{cellspace}\MessageBreak% \string\usepackage{xcolor}\MessageBreak% \string\pagecolor{white}\MessageBreak% - \string\newcommand{\string\QTO}[2]{\string##2}\MessageBreak% + \string\providecommand{\string\QTO}[2]{\string##2}\MessageBreak% especially before hyperref and thumbs,\MessageBreak% but best right after the \string\documentclass!% }% @@ -1186,7 +1187,7 @@ Text can be placed after any of the Tables of Thumbs, of course. \string\usepackage[math]{cellspace}^^J% \string\usepackage{xcolor}^^J% \string\pagecolor{white}^^J% - \string\newcommand{\string\QTO}[2]{\string##2}^^J% + \string\providecommand{\string\QTO}[2]{\string##2}^^J% especially before hyperref and thumbs,^^J% but best right after the \string\documentclass!^^J% ^^J% @@ -1217,12 +1218,13 @@ Text can be placed after any of the Tables of Thumbs, of course. % % \begin{macrocode} \RequirePackage{pageslts}[2011/08/08]% v1.2a -\RequirePackage{pagecolor}[2011/08/08]% v1.0c +\RequirePackage{pagecolor}[2012/02/23]% v1.0e \RequirePackage{rerunfilecheck}[2011/04/15]% v1.7 \RequirePackage{infwarerr}[2010/04/08]% v1.3 +\RequirePackage{ltxcmds}[2011/04/18]% v1.20 \RequirePackage{atveryend}[2011/04/23]% v1.7 %% \RequirePackage{atveryend}[2011/06/30]% v1.8 -%% would be needed but is currently (2012/01/07) not available at CTAN yet +%% would be needed but is currently (2012/02/23) not available at CTAN yet % \end{macrocode} % % A last information for the user: @@ -1259,13 +1261,12 @@ Text can be placed after any of the Tables of Thumbs, of course. \string\AtVeryVeryEnd\space command/hooking of atveryend package as of\MessageBreak% 2011/04/23, v1.7. New package version 2011/06/30, v1.8, works with\MessageBreak% the new LaTeX format, but some older package version was loaded.\MessageBreak% - (As of 2012/01/07, the new version is NOT available at CTAN yet.)\MessageBreak% + (As of 2012/02/23, the new version is NOT available at CTAN yet.)\MessageBreak% For fixing this problem until the update is available,\MessageBreak% \string\let\string\AtVeryVeryEnd\string\AtEndAfterFileList\MessageBreak% is used now, fingers crossed.% }% \let\AtVeryVeryEnd\AtEndAfterFileList% - \RequirePackage{ltxcmds}[2011/04/18]% v1.20, for \ltx@firstofone \AtEndAfterFileList{% if there is \AtVeryVeryEnd inside \AtEndAfterFileList \let\AtEndAfterFileList\ltx@firstofone% } @@ -1307,6 +1308,8 @@ Text can be placed after any of the Tables of Thumbs, of course. \DeclareBoolOption[false]{hidethumbs} % \end{macrocode} % +% \pagebreak +% % \DescribeMacro{pagecolor} % The |pagecolor| option is obsolete now, but for compatibility with older % documents we still provide it at the time being (might be removed @@ -1984,13 +1987,7 @@ Text can be placed after any of the Tables of Thumbs, of course. \fi% % \end{macrocode} % -% |\@ifpackageloaded| cannot be used after |\AtBeginDocument|, so here -% it is not checked for the \xpackage{hyperref} package, but for its -% |\Hy@Warning| command. If some other package or user is defining |\Hy@Warning|, -% \xpackage{thumbs} will falsely assume, that \xpackage{hyperref} has been loaded, -% but by my humble opinion, defining |\Hy@Warning| does not make sense and -% is bad style (except definition by the \xpackage{hyperref} package itself, -% of course). Into the |\jobname.tmb| file a |\thumbcontents| entry is written. +% 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 @@ -1999,22 +1996,17 @@ Text can be placed after any of the Tables of Thumbs, of course. % create that label!). % % \begin{macrocode} - \@ifundefined{Hy@Warning}{% hyperref not loaded - }{% hyperref loaded - \ifthumbs@nophantomsection% \relax - \else% -% \end{macrocode} -% -% \pagebreak -% -% \begin{macrocode} - \ifx\th@mbsphantom\pagesLTS@one% - \phantomsection% - \else% - \gdef\th@mbsphantom{1}% - \fi% - \fi% - }% + \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% @@ -2397,6 +2389,80 @@ Text can be placed after any of the Tables of Thumbs, of course. \fi% } + +% \end{macrocode} +% +% \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. +% +% \pagebreak +% +% \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 Joseph Wright: +%% http://tex.stackexchange.com/questions/45533/how-to-determine-which-register-a-count-uses/ +\def\th@mbhalt{\th@mbhalt} + +\def\registernumber#1{% + \expandafter\registernumberauxi\meaning#1\th@mbhalt\stop% + } + +\def\registernumberauxi#1#2\stop{% + \ifx\th@mbhalt#1% + \expandafter\ltx@gobbletwo% + \else% + \expandafter\registernumberauxii% + \fi% + {#1}{#2}% + } + +\def\registernumberauxii#1#2{% + \ifnum`#1<48% + \else% + \ifnum`#1>57% + \else% + #1% + \fi% + \fi% + \registernumberauxi#2\stop% + } + +%% End of code similar to the one from Joseph Wright + +\def\thumbs@gobblesix#1#2#3#4#5#6#7{#7} + +\edef\wrighta{\registernumber\Hy@linkcounter} +\edef\wrightb{\expandafter\thumbs@gobblesix\wrighta} +\@tempcnta=\wrightb\relax% +\edef\wrighta{\registernumber\tikztreelevel} +\edef\wrightb{\expandafter\thumbs@gobblesix\wrighta} +\@tempcntb=\wrightb\relax% +\ifnum\@tempcntb>\@tempcnta% tikz, hyperref + \xdef\th@mbtikz{-1}% tikz loaded after hyperref +\else + \xdef\th@mbtikz{0}% tikz loaded before hyperref +\fi% + +}{% 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} % % \DescribeMacro{\th@mbprint} @@ -2413,12 +2479,30 @@ Text can be placed after any of the Tables of Thumbs, of course. \setlength{\parindent}{0pt}% \ifodd\c@CurrentPage% \if@twoside% - \makebox[\th@mbwidthx][l]{{\color{#2}\hspace*{1pt}\space #1}}% + \ifx\th@mbtikz\pagesLTS@zero% + %\makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% + \parbox{\th@mbwidthx}{{\raggedleft{\hfill \color{#2}#1\space}}}% + \else% + %\makebox[\th@mbwidthx][l]{{\color{#2}\hspace*{1pt}\space #1}}% + \parbox{\th@mbwidthx}{{\raggedright{\color{#2}\hspace*{1pt}\space #1}}}% + \fi% \else% - \makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% + %\makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% + \parbox{\th@mbwidthx}{{\raggedleft{\hfill \color{#2}#1\space}}}% \fi% \else% - \makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% + \if@twoside% + \ifx\th@mbtikz\pagesLTS@zero% + %\makebox[\th@mbwidthx][l]{{\color{#2}\hspace*{1pt}\space #1}}% + \parbox{\th@mbwidthx}{{\raggedright{\color{#2}\hspace*{1pt}\space #1}}}% + \else% + %\makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% + \parbox{\th@mbwidthx}{{\raggedleft{\hfill \color{#2}#1\space}}}% + \fi% + \else% + %\makebox[\th@mbwidthx][r]{{\color{#2}#1\space}}% + \parbox{\th@mbwidthx}{{\raggedleft{\hfill \color{#2}#1\space}}}% + \fi% \fi% \egroup% \end{picture}% @@ -2448,9 +2532,12 @@ Text can be placed after any of the Tables of Thumbs, of course. }% \fi% \@tempcnta=\value{CurrentPage}\relax% - \advance\@tempcnta by -1% because CurrentPage is already the one of the next page + \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.) @@ -2652,7 +2739,7 @@ Text can be placed after any of the Tables of Thumbs, of course. % % \begin{macrocode} \newcommand{\th@mbstablabeling}{% - \@ifundefined{Hy@Warning}{}{\phantomsection}% + \ltx@ifpackageloaded{hyperref}{\phantomsection}{}% \let\label\thumbsoriglabel% \ifx\th@mbstable\pagesLTS@one% \label{TableOfThumbs}% @@ -2721,6 +2808,8 @@ Text can be placed after any of the Tables of Thumbs, of course. % \end{macrocode} % +% \pagebreak +% % \DescribeMacro{\thumbsoverviewprint} % |\thumbsoverviewprint| works by calling the internal command |\th@mbs@verview| % (see below), repeating this until all thumb marks have been processed. @@ -2765,21 +2854,13 @@ Text can be placed after any of the Tables of Thumbs, of course. % % \pagebreak % -% Option |\thumbs@thumblink| is checked for a valid and resonable value here. +% 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% - \@ifundefined{Hy@Warning}{% hyperref not loaded - \PackageError{thumbs}{Option thumblink != 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}% - }{% hyperref loaded + \ltx@ifpackageloaded{hyperref}{% hyperref loaded \def\th@mbstest{title}% \ifx\thumbs@thumblink\th@mbstest% OK \else% @@ -2807,7 +2888,15 @@ Text can be placed after any of the Tables of Thumbs, of course. \fi% \fi% \fi% - }% + }{% hyperref not loaded + \PackageError{thumbs}{Option thumblink != 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} % @@ -2984,7 +3073,7 @@ Text can be placed after any of the Tables of Thumbs, of course. % 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.) +% that no |thumbsoverview|-entry shall be added to contents.) % % \begin{macrocode} \addthumbsoverviewtocontents{}{}% @@ -3154,7 +3243,7 @@ Text can be placed after any of the Tables of Thumbs, of course. % \item[-] document class \xclass{ltxdoc}, 2007/11/11, v2.0u, % \url{http://ctan.org/pkg/ltxdoc} % -% \item[-] package \xpackage{morefloats}, 2011/07/10, v1.0e, +% \item[-] package \xpackage{morefloats}, 2012/01/28, v1.0f, % \url{http://ctan.org/pkg/morefloats} % % \item[-] package \xpackage{geometry}, 2010/09/12, v5.6, @@ -3218,7 +3307,7 @@ Text can be placed after any of the Tables of Thumbs, of course. %\usepackage[math]{cellspace} %\usepackage{xcolor} %\pagecolor{white} -%\newcommand{\QTO}[2]{#2} +%\providecommand{\QTO}[2]{#2} %\end{verbatim} % \end{quote} % @@ -3237,10 +3326,10 @@ Text can be placed after any of the Tables of Thumbs, of course. % \item[-] package \xpackage{lipsum}, 2011/04/14, v1.2, % \url{http://ctan.org/pkg/lipsum} % -% \item[-] package \xpackage{hyperref}, 2011/12/04, v6.82m, +% \item[-] package \xpackage{hyperref}, 2012/02/06, v6.82o, % \url{http://ctan.org/pkg/hyperref} % -% \item[-] package \xpackage{thumbs}, 2012/01/07, v1.0l, +% \item[-] package \xpackage{thumbs}, 2012/02/23, v1.0m, % \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 @@ -3484,7 +3573,8 @@ Text can be placed after any of the Tables of Thumbs, of course. % \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{}. -% Thanks for bug reports go to \textsc{Veronica Brandt} and \textsc{Martin Baute}. +% Thanks for bug reports go to \textsc{Veronica Brandt} and \textsc{Martin Baute} +% (even two bug reports). % % \bigskip % @@ -3637,6 +3727,24 @@ Text can be placed after any of the Tables of Thumbs, of course. % \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} % \end{History} % % \bigskip |