2

In the code below, I wanted to get the chapter names to show up on the right of the pages as done in the QuickGuide.tex file:

enter image description here

Here is my code:

\documentclass[11pt,fleqn]{book}

\usepackage{etex}
\reserveinserts{28}

\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}

\usepackage{graphicx}
\usepackage{lipsum} 
\usepackage{tikz}
\usepackage[english]{babel} 
\usepackage{enumitem}
\setlist{nolistsep} 
\usepackage{booktabs} 
\usepackage{xcolor} 
\usepackage{avant} 
\usepackage{mathptmx} 
\usepackage{microtype}
\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc}

\usepackage{xcolor}
\definecolor{ocre}{RGB}{52,177,201}
\definecolor{ultramarine}{RGB}{0,45,97}
\definecolor{cpiOrange}{RGB}{241,85,44}
\definecolor{cpiGray}{RGB}{106,100,100}

\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{chapter1.bib}
 \defbibheading{bibempty}{}

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

\usepackage{fancyhdr} 

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries \ #1}{}} 
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} 
\fancyhf{} \fancyhead[LE,RO]{\sffamily\normalsize\thepage} 
\fancyhead[LO]{\rightmark} 
\fancyhead[RE]{\leftmark} 
\renewcommand{\headrulewidth}{0.5pt} 
\addtolength{\headheight}{2.5pt} 
\renewcommand{\footrulewidth}{0pt} 
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}} 
\makeatletter
\renewcommand{\cleardoublepage}{
\clearpage\ifodd\c@page\else
\hbox{}
\vspace*{\fill}
\thispagestyle{empty}
\newpage
\fi}


\begin{document}

%----------------------------------------------------------------------------------------
%   TITLE PAGE
%----------------------------------------------------------------------------------------


\begingroup
\thispagestyle{empty}
\centering
\vspace*{5cm}
\par\normalfont\fontsize{25}{35}\sffamily\selectfont
\textbf{Test Subject}\\
\par\normalfont\fontsize{20}{35}\sffamily\selectfont(EEL XXXX - XXXX)\\
{\LARGE Assignment 1}\par % Book title
\vspace*{1cm}
{\Huge Johnny Boy}\par % Author name

\frontmatter

\endgroup

%----------------------------------------------------------------------------------------
%   COPYRIGHT PAGE
%----------------------------------------------------------------------------------------
\newpage
~\vfill
\thispagestyle{empty}

Just some text for the copyright page.

%----------------------------------------------------------------------------------------
%   TABLE OF CONTENTS
%----------------------------------------------------------------------------------------

\pagestyle{empty} % No headers

\tableofcontents % Print the table of contents itself

\listoffigures

\pagestyle{fancy} % Print headers again

%========================================================================================
%   MAINMATTER
%========================================================================================

\mainmatter

\chapter{This is the first chapter}
\lipsum \lipsum\cite{egan}

\chapter{This is the second chapter}
\lipsum \lipsum

%===============================================================================

\backmatter

\newpage
\chapter{Bibliography}

\addcontentsline{toc}{section}{Bibliography}
\subsection*{Books}

\printbibliography[heading=bibempty,type=book,prefixnumbers={B}]
\subsection*{Articles}

\printbibliography[heading=bibempty,type=article,prefixnumbers={A}]
\subsection*{Online}

\printbibliography[heading=bibempty,type=misc,prefixnumbers={O}]


%========================================================================================

\end{document} 

This is the chapterthumb.sty that is used in the QuickGuide.tex file:

\ProvidesPackage{chapterthumb}%
  [2005/03/10 v0.1 unsupported LaTeX package]
\DeclareOption*{%
  \PassOptionsToPackage{\CurrentOption}{scrpage2}}
\ProcessOptions\relax
\RequirePackage{graphics,color}
\RequirePackage{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

In order to implement this chapterthumb index, the code used is as follows:

% chapters with thumb index

    \usepackage{chapterthumb}
    \renewcommand*{\chapterthumbboxcolor}{Navy}
    \renewcommand*{\chapterthumbfont}{\normalfont\Large\sffamily\bfseries}
    \renewcommand{\chapterthumbwidth}{.125\paperheight}
       \lohead[\putchapterthumb]{\putchapterthumb}
       \addtokomafont{chapterthumb}{\small{\bfseries}} 

As in the QuickGuide PDF, the chapter thumb index shifts as the chapter number progresses.

  • Is this possible only with the scrbook class? – Joe Aug 20 '15 at 15:04
  • You appear to have a very outdated copy of chapterthumb.sty. Is your TeX distribution up to date? The copy I have is dated 2014-01-15 and marked version 0.3. It is updated to work with current versions of the KOMA classes. The 2005 version you are using requires the obsolete scrpage2 package. – cfr Aug 20 '15 at 21:21
1

Package chapterthumb is written by Markus Kohm for the use with KOMA-Script. So you should use document class scrbook.

Do you understand German? If yes please have a look to the url http://www.komascript.de/node/289 where Markus Kohm remarked that chapterthumb needs to use scrpage2 and you can find a running minimal example. In your given code (not really a MWE) you are using fancyhdr. Therefor that could not work ...

Here a MWE that compiles if you have copied file chapterthumb.sty into the same directory:

\documentclass[paper=a4,11pt]{scrbook} 

\usepackage[english]{babel} 
\usepackage[T1]{fontenc}

\usepackage{blindtext} % to generate a dummy text

\usepackage{chapterthumb} 
\usepackage{hyperref} 

\pagestyle{scrheadings}
\lohead[\putchapterthumb]{\putchapterthumb}
\lehead[The Title]{The Title}
\setkomafont{pagehead}{\footnotesize\bfseries}
\setkomafont{pagenumber}{\normalfont}


\begin{document}

\pagenumbering{arabic}
\Blinddocument   % Generates dummy document

\end{document}

And here the original MWE by Markus Kohm (I changed it to english language, the original is in german) with the new package scrlayer-scrpage that you should use instead of scrpage2:

\documentclass{scrbook}
\usepackage[english]{babel}
\usepackage{chapterthumb} % copy chapterthumb.sty in the same directory!
\usepackage{scrlayer-scrpage} % instead obsolete scrpage2
\usepackage{blindtext}        % to create dummy text
\pagestyle{scrheadings}
\AddLayersToPageStyle{@everystyle@}{chapterthumb}
\addtokomafont{chapterthumb}{\bfseries}


\begin{document}
\chapter{The beginning}\dots

\Blinddocument

\chapter{next}\dots
\chapter{and next}\dots
\chapter{and the next}\dots
\chapter{and so on}\dots
\chapter{until the end}
\end{document}
  • scrpage2 is obsolete. The style has not been updated for the current versions of KOMA. – cfr Aug 20 '15 at 21:12
  • I think that getting the current version of chapterthumb is key here. The version given in the OP itself loads scrpage2 so your MWE will just add the replacement package as well, which doesn't seem a good solution. The current version of chapterthumb uses the updated KOMA packages so there is no need to also load them in your document. – cfr Aug 21 '15 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.