Adapted chapter thumb package

I have made an adaption to the chapter thumb example in the book. It is now using an internal counter instead of the normal chapter counter and thus avoids problems with environments which reset the chapter counter (e.g. \begin{appendices} ).
Well it was a problem for me, may be someone else needs it too - here it is. On my installation, it only wokred correctly with pdfetex and not for creating a dvi. (with using the \ifpdfoutput command I assured that the chapter thumbs are only used for creating a pdf and not for creating a dvi)

Instructions:
-------------

1) Copy the code below in a file, e.g. chapterthumb.sty and make sure your LaTex distribution is using it.

2) Add the following command to your document (before the \begin{document} command):

\usepackage{chapterthumb}
%create chapter thumb index on outer right side of pages (only works correct for pdfs)

3) In your document, for starting to use the chapter thumbs e.g. after the table of contents, change your header for using the \putchapterthumb command. One example is:

\ifpdfoutput{\ihead[\putchapterthumb]{\putchapterthumb}}{}
% turn now chapter thumbs on, if creating pdf

4) In your document, for stopping to use chapter thumbs reset the header, e.g. with:

\ifpdfoutput{\ihead[]{}}{}
% now stop using chapter thumbs

Additional functions:
---------------------

For using a special text in the chapter thumb, you can renew the text in the thumbs, e.g.:

\ifpdfoutput{
\renewcommand{\chapterthumbformat}{End section}
% just show "`End section"' as label of chapter thumb
}{}

For getting back the normal text in the chapter thumbs use:

\renewcommand{\chapterthumbformat}{\chapapp~\thechapter}

ToDos:
------
- there is a slight difference of position of chapter thumbs for normal pages and pages which are the start of a chapter
- it seems the package is not using the correct chapter names for index, nomenclature etc.
- maybe there is a more elegant way to include the chapterthumbs only if a pdf is created (and not having the user manually to test that)

The source code:
----------------

%------------------------------------------------------------------------------
%
% Package to make chapter thumbs on the outer right of pages
%
% Copyright (c) 2005 Markus Kohm
% Michael Bierkandt
%
% This program is free software; you can redistribute it and/or modify it under
% the terms of the GNU General Public License as published by the Free Software
% Foundation; either version 2 of the License, or (at your option) any later
% version.
%
% This program is distributed in the hope that it will be useful, but WITHOUT
% ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
% FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License along with
% this program; if not, write to the Free Software Foundation, Inc., 59 Temple
% Place, Suite 330, Boston, MA 02111-1307, USA.
%
% v0.1. By Markus Kohm
% v0.2 Adapted by Michael Bierkandt, September, 13th 2005
% introduced own counter for chapter thumbs to avoid problems with
% environements which reset the chapter numbers (e.g. the \begin{appendices} )
%------------------------------------------------------------------------------
\ProvidesPackage{chapterthumb}%
[2005/03/10 v0.2 unsupported LaTeX package chapterthumb]%
\DeclareOption*{%
\PassOptionsToPackage{\CurrentOption}{scrpage2}}%
\ProcessOptions\relax%
\RequirePackage{graphics,color}%
\RequirePackage{scrpage2}%
\RequirePackage{ifthen}%
\newcounter{chapterthumb}
\newcounter{oldchapterthumb}%
\setcounter{chapterthumb}{0}%
\setcounter{oldchapterthumb}{0}%
\newcommand*{\putchapterthumb}{%
\begingroup%
% if a new chapter started increment value of chapterthumb counter
\ifthenelse{\value{chapter} > \value{oldchapterthumb}}{%
\addtocounter{chapterthumb}{1}%
\setcounter{oldchapterthumb}{\value{chapter}}%
}{
\ifthenelse{\value{chapter} < \value{oldchapterthumb}}{%
\addtocounter{chapterthumb}{1}%
\setcounter{oldchapterthumb}{\value{chapter}}%
}{}}%
\makebox[0pt][l]{%
\hspace{-\oddsidemargin}%\hspace{-1in}}% maybe this has to be adapted according to your
% \hoffset setting for having the chapter thumbs at the outmost right border
\hspace{-\@oddheadshift}%
\hspace{\paperwidth}%
\parbox[t][0pt][t]{0pt}{%
\vspace{-\topmargin}%
\vspace{-0.2in}%normally -1in, maybe this has to be adapted according to
% your \voffset setting for starting the chapter thumbs at the top of the page
\vspace{-\headheight}%
\vspace{\dp\strutbox}%
\vspace{\firstchapterthumbskip}%

\setlength{\@tempdima}{\paperheight}%
\addtolength{\@tempdima}{-\chapterthumbwidth}%
\addtolength{\@tempdima}{1pt}%
\setlength{\@tempdimb}{\chapterthumbskip}%
\divide\@tempdima by\@tempdimb%
\@tempcnta=\@tempdima%
\advance\@tempcnta by 1%
\@tempcntb=\value{chapterthumb}%
\advance\@tempcntb by -1%
\divide\@tempcntb by \@tempcnta%
\multiply\@tempcntb by -\@tempcnta%
\advance\@tempcntb by \value{chapterthumb}%
\advance\@tempcntb by -1%
\setlength{\@tempdima}{\chapterthumbskip}%
\vspace{\@tempcntb\@tempdima}%
\makebox[0pt][r]{%
\rotatebox{90}{%
\colorbox{\chapterthumbboxcolor}{%
\parbox[t][\chapterthumbheight][c]%
{\chapterthumbwidth}{%
\centering%
\color{\chapterthumbcolor}%
\chapterthumbfont{\chapterthumbformat}}}}}%
}%
}%
\endgroup%
}%
\newcommand*{\firstchapterthumbskip}{0pt}%to move first chapter thumb down change this
\newcommand*{\chapterthumbheight}{2em}%height of chapter thumbs
\newcommand*{\chapterthumbwidth}{.2\paperheight}%width of chapter thumbs
\newcommand*{\chapterthumbskip}{.1\paperheight}%distance between chapter thumbs
\newcommand*{\chapterthumbboxcolor}{black}%
\newcommand*{\chapterthumbcolor}{white}%
\newcommand*{\chapterthumbformat}{\@chapapp~\thechapter}%content of the chapter thumbs
\newcommand*{\chapterthumbfont}{\normalfont\Large\sffamily}%
\newcommand*{\scr@fnt@chapterthumb}{\chapterthumbfont}%
\endinput%
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "chapterthumbexample"
%%% End:
%

Kommentare

Darstellungsoptionen

Wählen Sie hier Ihre bevorzugte Anzeigeart für Kommentare und klicken Sie auf „Einstellungen speichern“ um die Änderungen zu übernehmen.

Can't get v0.2 to work, v0.1 works fine

Hi,

tried the chapter thumb example from http://www.komascript.de/komascriptbuchexamples with chapterthumb.sty v0.1 by Markus which worked right out the box. When I use v0.2 instead, I don't see any chapter thumb at all. Any ideas?

\ihead weiter verwenden.

Durch die Benutzung der chapterthumbs wird \ihead unbrauchbar. Ich würde da aber gerne ein Logo unterbringen.

Ist das irgendwie möglich?

Danke,

Jan.

Darstellungsoptionen

Wählen Sie hier Ihre bevorzugte Anzeigeart für Kommentare und klicken Sie auf „Einstellungen speichern“ um die Änderungen zu übernehmen.
Inhalt abgleichen