From ab3cc094064444f0ca192823496de66c71d06710 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 24 Feb 2012 23:45:03 +0000 Subject: thumbs (24feb12) git-svn-id: svn://tug.org/texlive/trunk@25498 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/thumbs/thumbs.sty | 140 +++++++++++++++++++------- 1 file changed, 106 insertions(+), 34 deletions(-) (limited to 'Master/texmf-dist/tex/latex/thumbs') diff --git a/Master/texmf-dist/tex/latex/thumbs/thumbs.sty b/Master/texmf-dist/tex/latex/thumbs/thumbs.sty index e990f8e4287..658ff8bbb9e 100644 --- a/Master/texmf-dist/tex/latex/thumbs/thumbs.sty +++ b/Master/texmf-dist/tex/latex/thumbs/thumbs.sty @@ -9,7 +9,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 @@ -39,7 +39,7 @@ %% thumbs-example.tex, thumbs-example.pdf. %% \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)] %% This package allows to create a customizable thumb index, @@ -57,7 +57,7 @@ \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!% }% @@ -71,7 +71,7 @@ \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% @@ -84,12 +84,13 @@ \RequirePackage{picture}[2009/10/11]% v1.3 \RequirePackage{alphalph}[2010/04/18]% v2.3 \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 %% 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 @@ -104,13 +105,12 @@ \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% } @@ -600,17 +600,17 @@ }% \fi% \fi% - \@ifundefined{Hy@Warning}{% hyperref not loaded - }{% hyperref loaded - \ifthumbs@nophantomsection% \relax - \else% - \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% @@ -852,6 +852,60 @@ \fi% } +\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} + } + \newcommand{\th@mbprint}[3]{% \put(\th@mbxpos,-\th@mbposyA){% \begin{picture}(0,0)% @@ -862,12 +916,30 @@ \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}% @@ -889,7 +961,7 @@ }% \fi% \@tempcnta=\value{CurrentPage}\relax% - \advance\@tempcnta by -1% because CurrentPage is already the one of the next page + \advance\@tempcnta by \th@mbtikz% \edef\th@mbstmpwidth{\the\paperwidth}% \ifdim\th@mbpaperwidth=\th@mbstmpwidth% OK \else% @@ -1015,7 +1087,7 @@ } \newcommand{\th@mbstablabeling}{% - \@ifundefined{Hy@Warning}{}{\phantomsection}% + \ltx@ifpackageloaded{hyperref}{\phantomsection}{}% \let\label\thumbsoriglabel% \ifx\th@mbstable\pagesLTS@one% \label{TableOfThumbs}% @@ -1070,15 +1142,7 @@ \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% @@ -1106,7 +1170,15 @@ \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% \edef\th@mbprintingovertoc{\th@mbprinting}% \ifnum \th@mbsmax > \pagesLTS@zero% -- cgit v1.2.3