Guest User

Untitled

a guest
Jan 17th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. %%% Thumb indices consist of white text on a rectangular colored background. The
  2. %%% font-size is 75% of the size of thumb height.
  3. \newif\ifthumb
  4. \newlength\thumbheight
  5. \setlength\thumbheight{24pt}
  6. \newlength\thumbedge
  7. \setlength\thumbedge{4pt}
  8. \newlength\thumbhspace
  9. \setlength\thumbhspace{36pt}
  10. \newlength\thumbvspace
  11. \setlength\thumbvspace{2\thumbheight}
  12.  
  13. \newlength\thumbwidth
  14. \setlength\thumbwidth{36pt}
  15. \newlength\thumbspacing
  16. \setlength\thumbspacing{2\thumbheight}
  17.  
  18. %% We need the TikZ library calc to calculate the coordinates of the thumb
  19. %% indices.
  20. \usetikzlibrary{calc}
  21.  
  22. %% The lthumb command prints the current chapter number in a thumb index on the
  23. %% left (even) page.
  24. \newcommand*\lthumb{%
  25. \ifthumb%
  26. \begin{tikzpicture}[remember picture,overlay]
  27. \coordinate (top margin) at (0pt,1in+\topmargin+\headheight+\headsep);
  28. \coordinate (left margin) at (1in+\evensidemargin,0pt);
  29. %% Calculate the corners of the thumb index based on the current
  30. %% chapter number.
  31. \coordinate (top left) at ($(current page.north west)-(top margin)-(0pt,\value{chapter}\thumbvspace-\thumbvspace)$);
  32. \coordinate (bottom right) at ($(top left)+(left margin)-(\thumbhspace,\thumbheight)$);
  33. %% Shift the left edge to prevent the rounded corner from showing.
  34. \coordinate (top left) at ($(top left)-(\thumbedge,0pt)$);
  35. %% Draw the thumb index.
  36. \fill[fill=thumb,rounded corners=\thumbedge](top left) rectangle (bottom right);
  37. %% Print the chapter number at the center right in the thumb index.
  38. \coordinate (center right) at ($(bottom right)+(0pt,0.5\thumbheight)$);
  39. \node at (center right)[anchor=east,inner sep=2\thumbedge]{
  40. \titlefont\bfseries\color{tudelft-white}
  41. \fontsize{0.75\thumbheight}{0.75\thumbheight}\selectfont
  42. \thechapter
  43. };
  44. \end{tikzpicture}%
  45. \fi%
  46. }
  47.  
  48. %% rthumb draws a thumb index on the right (odd) page.
  49. \newcommand*\rthumb{%
  50. \ifthumb%
  51. \begin{tikzpicture}[remember picture,overlay]
  52. \coordinate (top margin) at (0pt,1in+\topmargin+\headheight+\headsep);
  53. \coordinate (right margin) at (1in+\evensidemargin,0pt);
  54. %% Calculate the corners of the thumb index based on the current
  55. %% chapter number.
  56. \coordinate (top right) at ($(current page.north east)-(top margin)-(0pt,\value{chapter}\thumbvspace-\thumbvspace)$);
  57. \coordinate (bottom left) at ($(top right)-(right margin)-(-\thumbhspace,\thumbheight)$);
  58. %% Shift the left right to prevent the rounded corner from showing.
  59. \coordinate (top right) at ($(top right)+(\thumbedge,0pt)$);
  60. %% Draw the thumb index.
  61. \fill[fill=thumb,rounded corners=\thumbedge](top right) rectangle (bottom left);
  62. %% Print the chapter number at the center right in the thumb index.
  63. \coordinate (center left) at ($(bottom left)+(0pt,0.5\thumbheight)$);
  64. \node at (center left)[anchor=west,inner sep=2\thumbedge]{
  65. \titlefont\bfseries\color{tudelft-white}
  66. \fontsize{0.75\thumbheight}{0.75\thumbheight}\selectfont
  67. \thechapter
  68. };
  69. \end{tikzpicture}%
  70. \fi%
  71. }
Add Comment
Please, Sign In to add comment