Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%% Thumb indices consist of white text on a rectangular colored background. The
- %%% font-size is 75% of the size of thumb height.
- \newif\ifthumb
- \newlength\thumbheight
- \setlength\thumbheight{24pt}
- \newlength\thumbedge
- \setlength\thumbedge{4pt}
- \newlength\thumbhspace
- \setlength\thumbhspace{36pt}
- \newlength\thumbvspace
- \setlength\thumbvspace{2\thumbheight}
- \newlength\thumbwidth
- \setlength\thumbwidth{36pt}
- \newlength\thumbspacing
- \setlength\thumbspacing{2\thumbheight}
- %% We need the TikZ library calc to calculate the coordinates of the thumb
- %% indices.
- \usetikzlibrary{calc}
- %% The lthumb command prints the current chapter number in a thumb index on the
- %% left (even) page.
- \newcommand*\lthumb{%
- \ifthumb%
- \begin{tikzpicture}[remember picture,overlay]
- \coordinate (top margin) at (0pt,1in+\topmargin+\headheight+\headsep);
- \coordinate (left margin) at (1in+\evensidemargin,0pt);
- %% Calculate the corners of the thumb index based on the current
- %% chapter number.
- \coordinate (top left) at ($(current page.north west)-(top margin)-(0pt,\value{chapter}\thumbvspace-\thumbvspace)$);
- \coordinate (bottom right) at ($(top left)+(left margin)-(\thumbhspace,\thumbheight)$);
- %% Shift the left edge to prevent the rounded corner from showing.
- \coordinate (top left) at ($(top left)-(\thumbedge,0pt)$);
- %% Draw the thumb index.
- \fill[fill=thumb,rounded corners=\thumbedge](top left) rectangle (bottom right);
- %% Print the chapter number at the center right in the thumb index.
- \coordinate (center right) at ($(bottom right)+(0pt,0.5\thumbheight)$);
- \node at (center right)[anchor=east,inner sep=2\thumbedge]{
- \titlefont\bfseries\color{tudelft-white}
- \fontsize{0.75\thumbheight}{0.75\thumbheight}\selectfont
- \thechapter
- };
- \end{tikzpicture}%
- \fi%
- }
- %% rthumb draws a thumb index on the right (odd) page.
- \newcommand*\rthumb{%
- \ifthumb%
- \begin{tikzpicture}[remember picture,overlay]
- \coordinate (top margin) at (0pt,1in+\topmargin+\headheight+\headsep);
- \coordinate (right margin) at (1in+\evensidemargin,0pt);
- %% Calculate the corners of the thumb index based on the current
- %% chapter number.
- \coordinate (top right) at ($(current page.north east)-(top margin)-(0pt,\value{chapter}\thumbvspace-\thumbvspace)$);
- \coordinate (bottom left) at ($(top right)-(right margin)-(-\thumbhspace,\thumbheight)$);
- %% Shift the left right to prevent the rounded corner from showing.
- \coordinate (top right) at ($(top right)+(\thumbedge,0pt)$);
- %% Draw the thumb index.
- \fill[fill=thumb,rounded corners=\thumbedge](top right) rectangle (bottom left);
- %% Print the chapter number at the center right in the thumb index.
- \coordinate (center left) at ($(bottom left)+(0pt,0.5\thumbheight)$);
- \node at (center left)[anchor=west,inner sep=2\thumbedge]{
- \titlefont\bfseries\color{tudelft-white}
- \fontsize{0.75\thumbheight}{0.75\thumbheight}\selectfont
- \thechapter
- };
- \end{tikzpicture}%
- \fi%
- }
Add Comment
Please, Sign In to add comment