% chapterthumb.sty
% Copyright 2008 Markus Kohm
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
% 
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Markus Kohm.
% 
% This work consists of this file only.
%-----------------------------------------------------------------------
\ProvidesPackage{chapterthumb}%
  [2011/09/23 v0.2 unsupported LaTeX package]
\ProcessOptions\relax
\RequirePackage{graphics,color}
\RequirePackageWithOptions{scrpage2}
\newcommand*{\putchapterthumb}{%
  \begingroup
    \makebox[0pt][l]{%
      \hspace{-\oddsidemargin}\hspace{-1in}%
      \hspace{-\@oddheadshift}%
      \hspace{\paperwidth}%
      \parbox[t][0pt][t]{0pt}{%
        \vspace{-\topmargin}%
        \vspace{-1in}%
        \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{chapter}%
        \advance\@tempcntb by -1
        \divide\@tempcntb by \@tempcnta
        \multiply\@tempcntb by -\@tempcnta
        \advance\@tempcntb by \value{chapter}%
        \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}
\newcommand*{\chapterthumbheight}{2em}
\newcommand*{\chapterthumbwidth}{.2\paperheight}%
\newcommand*{\chapterthumbskip}{.1\paperheight}%
\newcommand*{\chapterthumbboxcolor}{black}%
\newcommand*{\chapterthumbcolor}{white}
\newcommand*{\chapterthumbformat}{\@chapapp~\thechapter}
\newcommand*{\chapterthumbfont}{\normalfont\Large\sffamily}
\newcommand*{\scr@fnt@chapterthumb}{\chapterthumbfont}
\endinput
%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "chapterthumbexample"
%%% End: 
