1

For my PhD thesis I would like to use chapter thumbs. I have found some code that provides this, and I have been able to make some changes (size and color of the mark, color of text). However, I cannot figure out how to do all the changes that I would like to have. How do I:

  • Show only the chapter number in the thumb mark?
  • Place the mark for Chapter 1 a bit lower (at the position of the current Chapter 2 mark)?

.

\documentclass[10pt,twoside,openright]{book}
\usepackage{geometry}
\geometry{
    vmarginratio=7:5,
    hmarginratio=1:1,
    papersize={170mm,240mm},
    total={130mm,190mm}
}
\usepackage[T1]{fontenc}

% package voor de laatste versie van het standaard lettertype
\usepackage{lmodern}
\renewcommand{\familydefault}{\sfdefault}

\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}

\pagestyle{plain}

% auxiliary counter
\newcounter{chapshift}
\addtocounter{chapshift}{-1}

% the list of colors to be used (add more if needed)
\newcommand\BoxColor{%
  \ifcase\thechapshift gray!30\else gray!30\fi}


% redefinition of \chaptermark to contain only the title
\renewcommand\chaptermark[1]{\markboth{\thechapter.~#1}{}}

%======================================================================================
%   PAGE HEADERS
%======================================================================================

\usepackage{etoolbox,fancyhdr} % Required for header and footer configuration

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries \ #1}{}} % Chapter text font settings
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} % Section text font settings
\fancyhf{} \fancyhead[LE,RO]{\sffamily\normalsize\thepage} % Font setting for the page number in the header
\fancyhead[LO]{\rightmark%  
\begin{tikzpicture}[overlay,remember picture]
  \node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm,
    text height=2cm,align=center,anchor=north east]
  at ($ (current page.north east) + (-0cm,-2*\thechapshift cm) $)
  {\rotatebox{90}{\parbox{2cm}{%
    \centering\textcolor{white}{\scshape\leftmark}}}};
  \end{tikzpicture}} % Print the nearest section name on the left side of odd pages
\fancyhead[RE]{\leftmark%
  \begin{tikzpicture}[overlay,remember picture]
  \node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm,
    text height=2cm,align=center,anchor=north west]
  at ($ (current page.north west) + (-0cm,-2*\thechapshift cm) $)
  {\rotatebox{90}{\parbox{2cm}{%
    \centering\textcolor{white}{\scshape\leftmark}}}};
  \end{tikzpicture}} % Print the current chapter name on the right side of even pages
\renewcommand{\headrulewidth}{0pt} % Width of the rule under the header
\addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
% \newcommand{\headrulecolor}[1]{\patchcmd{\headrule}{\hrule}{\color{#1}\hrule}{}{}}
% \headrulecolor{blue!70}% Set header rule colour to 70% red.
\newcommand{\footrulecolor}[1]{\patchcmd{\footrule}{\hrule}{\color{#1}\hrule}{}{}}
\renewcommand{\footrulewidth}{0pt} % Removes the rule in the footer
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}} % Style for when a plain pagestyle is specified

% Removes the header from odd empty pages at the end of chapters
\makeatletter
\renewcommand{\cleardoublepage}{
\clearpage\ifodd\c@page\else
\hbox{}
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\fi}
\patchcmd{\@makechapterhead}
  {\vskip 40\p@}
  {\vskip 40\p@\stepcounter{chapshift}}{}{}
\makeatother

\begin{document}

\frontmatter

\tableofcontents

\mainmatter
\chapter{Introduction}
\lipsum[1-7]
\section{This is how we do it}
\lipsum[1-7]

\chapter{Results}
\lipsum[1-7]

\appendix
\renewcommand{\thesection}{Appendix \Alph{chapter}.\arabic{section}}
\renewcommand\chaptermark[1]{\markboth{\sffamily\normalsize\bfseries \appendixname~\thechapter}{}}


\chapter{Appendices for Chapter 1}

Here we present two subappendices.

\cleardoublepage

\section{Training delivery methods}
\thispagestyle{plain}
\lipsum[1-8]

\cleardoublepage

\section{This is how we do it too}
\thispagestyle{plain}
\lipsum[1-8]



\end{document}

Chapter 1 Chapter 2

0

1 Answer 1

0

With some tinkering I have found the answers to my questions.

How do I show only the chapter number in the thumb mark?

This is done by finding the code (twice)

\centering\textcolor{white}{\scshape\leftmark}}}};

and replacing \leftmark with \thechapter.

How do I place the mark for Chapter 1 a bit lower (at the position of the current Chapter 2 mark)?

This is done by playing with the value of chapshift.

% auxiliary counter
\newcounter{chapshift}
\addtocounter{chapshift}{-1}

Changing the -1 to 0 or a higher number moves the mark down.

To make the marks smaller, so more marks fit on the page, play with the text height=2cm and the \parbox{2cm}. You should keep these values the same.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .