In the code developed here, I was attempting to use it with a fancy header. For some reason, the "CHAPTER THUMB" code does not work as originally intended. That is, the chapter thumb does not increment down the page as dictated by the chapters.
- Can you assist me in getting this code to work with the fancy "CHAPTER HEADINGS"?
- Also, how to get the just "Chapter 1, Chapter 2..." to be displayed in the chapter thumbs for the normal chapters (i.e. the chapters prior to the appendix) instead of the chapter names?
Here is the code:
\documentclass{book}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{lipsum}
%======================================================================================
% CHAPTER THUMB
%======================================================================================
\pagestyle{plain}
% auxiliary counter
\newcounter{chapshift}
\addtocounter{chapshift}{-1}
% the list of colors to be used (add more if needed)
\newcommand\BoxColor{%
%\ifcase\thechapshift blue!30\or red!30\or olive!30\or magenta!30\else yellow!30\fi}
ultramarine}
% redefinition of \chaptermark to contain only the title
\renewcommand\chaptermark[1]{\markboth{\thechapter.~#1}{}}
\newcommand\ChapterBox{%
\begin{tikzpicture}[overlay,remember picture]
\node[fill=\BoxColor,inner sep=0pt,rectangle,text width=1cm,
text height=4cm,align=center,anchor=north east]
at ($ (current page.north east) + (-0cm,-2*\thechapshift cm) $)
{\rotatebox{90}{\parbox{4cm}{%
\centering\textcolor{white}{\scshape\leftmark}}}};
\end{tikzpicture}%
}
%======================================================================================
% 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\ChapterBox} % Print the nearest section name on the left side of odd pages
\fancyhead[RE]{\leftmark\ChapterBox} % Print the current chapter name on the right side of even pages
\renewcommand{\headrulewidth}{.5pt} % 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}{.5pt} % Removes the rule in the footer
\cfoot[\fancyplain{}{}] {\fancyplain{}{\footnotesize\bfseries{Center Foot}}} \lfoot[\fancyplain{}{}]
{\fancyplain{}{\footnotesize\bfseries\itshape{Left Foot}}}
\rfoot[\fancyplain{}{}]
{\fancyplain{}{\footnotesize\bfseries\itshape{Right Foot}}}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}} % Style for when a plain pagestyle is specified
\fancypagestyle{plain}{%
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{0pt}% No header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule
}
% 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
%======================================================================================
% CHAPTER HEADINGS
%======================================================================================
\usepackage{fourier}% change to lmodern if fourier is no available
\usepackage[explicit]{titlesec}
\usepackage{xcolor} % Required for specifying colors by name
\definecolor{ocre}{RGB}{52,177,201}
\definecolor{ultramarine}{RGB}{0,45,97}
\definecolor{mybluei}{RGB}{0,173,239}
\definecolor{myblueii}{RGB}{63,200,244}
\definecolor{myblueiii}{RGB}{199,234,253}
\renewcommand\thechapter{\arabic{chapter}}
\newcommand\chapnumfont{% font specification for the number
\fontsize{380}{130}\color{myblueii}\selectfont%
}
\newcommand\chapnamefont{% font specification for the name "PART"
\normalfont\color{white}\scshape\small\bfseries
}
\titleformat{\chapter}
{\normalfont\huge\filleft}
{}
{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\fill[myblueiii]
(current page.north west) rectangle ([yshift=-13cm]current page.north east);
\node[
fill=mybluei,
text width=2\paperwidth,
rounded corners=6cm,
text depth=18cm,
anchor=center,
inner sep=0pt] at (current page.north east) (chaptop)
{\thechapter};%
%{};%
\node[
anchor=south east,
inner sep=0pt,
outer sep=0pt] (chapnum) at ([xshift=-20pt]chaptop.south)
{\chapnumfont\thechapter};
%{};
\node[
anchor=south,
inner sep=0pt] (chapname) at ([yshift=2pt]chapnum.south)
%{\chapnamefont PROBLEM};
{};
\node[
anchor=north east,
align=right,
inner xsep=0pt] at ([yshift=-0.5cm]chapname.east|-chapnum.south)
{\parbox{.7\textwidth}{\raggedleft#1}};
\end{tikzpicture}%
}
\titleformat{name=\chapter,numberless}
{\normalfont\huge\filleft}
{}
{0pt}
{\begin{tikzpicture}[remember picture,overlay]
\fill[myblueiii]
(current page.north west) rectangle ([yshift=-13cm]current page.north east);
\node[
fill=mybluei,
text width=2\paperwidth,
rounded corners=6cm,
text depth=18cm,
anchor=center,
inner sep=0pt] at (current page.north east) (chaptop)
{};%
\node[
anchor=south east,minimum width=2in,
inner sep=0pt,
outer sep=0pt] (chapnum) at ([xshift=-20pt]chaptop.south)
{};
\node[
anchor=south,
inner sep=0pt] (chapname) at ([yshift=2pt]chapnum.south)
{};
\node[
anchor=north east,
align=right,
inner xsep=0pt] at ([yshift=-0.5cm]chapname.east|-chapnum.south)
{\parbox{.7\textwidth}{\raggedleft#1}};
\end{tikzpicture}%
}
\titlespacing*{\chapter}{0pt}{0pt}{3.5in}
\titlespacing*{name=\chapter,numberless}{0pt}{0pt}{3.5in}
%======================================================================================
% MAINMATTER
%======================================================================================
\begin{document}
\part{Part One}
\mainmatter
\chapter{This is Where We Begin}
\lipsum[1-7]
\section{Test 1}
\lipsum[1-7]
\chapter{This is Some Middle Matter}
\lipsum[1-7]
\section{Test 2}
\lipsum[1-7]
\chapter{This is a Conclusion}
\lipsum[1-7]
\section{Test 3}
\lipsum[1-7]
\part{Part Two}
\appendix
\renewcommand\chaptermark[1]{\markboth{\sffamily\normalsize\bfseries \appendixname~\thechapter}{}}
\chapter{Appendix of stuff in A}
\lipsum[1-7]
\lipsum[1-7]
\chapter{Appendix of stuff in B}
\lipsum[1-7]
\lipsum[1-7]
\end{document}
