1

I am trying to generate a report document, where I would like to add a separate chapter title page as shown by CFR https://tex.stackexchange.com/a/183613/45116.

Her code works for me, but I am facing some troubles since I have chapterthumbs. The trouble is that on Chapter title page I am getting chapterthumb with wrong chapter number. Ex. On title page of chapter 1, chapterthumb is showing chapter 0.

I will be okay with any of one following scenario: 1. Removing chapterthumb from (only) chapter title page OR 2. Having correct chapterthumb on chapter title page

Below is my code:

\documentclass[11pt,a4paper,openright,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
%\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage[document]{ragged2e}
\usepackage{pdfpages}
\usepackage[paperheight=24cm,paperwidth=17cm,left=2.5cm,right=2cm,top=2cm,bottom=2cm, footskip=1cm]{geometry}
\usepackage{blindtext}
\usepackage{lipsum}
\usepackage{indentfirst}
\setlength\parindent{1cm}
\usepackage{CormorantGaramond}
\usepackage[T1]{fontenc}

% Adding box to the chapter
\usepackage{rotating}
\usepackage{eso-pic,xcolor}
\definecolor{chapterthumbbg}{HTML}{6F7170}
\AddToShipoutPictureFG{%
  \AtPageLowerLeft{%
    \ifshowchapterthumb\ifodd\value{page}
      \makebox[\paperwidth][r]{%
        \raisebox{\dimexpr.5\paperheight-.5\height}{%
          \setlength{\fboxsep}{\baselineskip}%
          \colorbox{chapterthumbbg}{\textcolor{white}{\begin{turn}{0}\textbf{{\LARGE \thechapter}}\end{turn}}}%
        }%
      }%
    \else\fi\fi
  }
}


\newif\ifshowchapterthumb

\renewcommand{\baselinestretch}{1.1}
\newcommand*\chem[1]{\ensuremath{\mathrm{#1}}}
\renewcommand{\theequation}{Eq. \arabic{equation}}



%%
\usepackage{xparse, adforn}
\let\origchapter\chapter
\DeclareDocumentCommand\chapter{s o m}{%
  \IfNoValueTF{#2}{\def\myshortchtitle{#3}}{\def\myshortchtitle{#2}}%
  \clearpage
  \thispagestyle{empty}%
  \vspace*{.25\textheight}%
  {\centering
  \stepcounter{chapter}%
  \LARGE\bfseries
  \IfBooleanTF{#1}{%
    \phantom{\chaptername\ \thechapter}}{%
    \chaptername\ \thechapter}\par
  \vskip .025\textheight
  \Huge #3\par
  \adforn{22}\adforn{50}\par}
  \addtocounter{chapter}{-1}%
  \clearpage
  \IfBooleanTF{#1}{%
    \origchapter*{#3}}{%
    \origchapter[\myshortchtitle]{#3}}}
%%

\begin{document}


%\showchapterthumbfalse
%
%\input{Frontmatter/Title}
%\pagebreak
%\input{Frontmatter/committe}
%\pagebreak
%\input{Frontmatter/official_title}
%\pagebreak
%\input{Frontmatter/approvedby}
%\newpage
%\thispagestyle{empty}
%\mbox{}

\let\oldchapter\chapter% if you don't want the ToC to have a page before it
\let\chapter\origchapter% if you don't want the ToC to have a page before it
\tableofcontents
\let\chapter\oldchapter% if you don't want the ToC to have a page before it


%\newpage
%\thispagestyle{empty}
%\mbox{}

\part{Name 1}

\showchapterthumbtrue
\chapter{First chapter}\lipsum[1-5]
\section{First section}\lipsum[6-10]
\section{Second section}\lipsum[11-15]
\section{Third section}\lipsum[16-20]
\section{Last section}\lipsum[21-27]

\newpage
\thispagestyle{empty}
\mbox{}

\showchapterthumbfalse
\showchapterthumbtrue
\chapter{Second chapter}\lipsum[1-5]
\section{First section}\lipsum[6-10]
\section{Second section}\lipsum[11-15]
\section{Third section}\lipsum[16-20]
\section{Last section}\lipsum[21-25]
\showchapterthumbfalse

\part{Name 2}
\showchapterthumbtrue
\chapter{Third chapter}\lipsum[1-5]
\section{First section}\lipsum[6-10]
\section{Second section}\lipsum[11-15]
\section{Third section}\lipsum[16-20]
\section{Last section}\lipsum[21-25]

\chapter{Last chapter}\lipsum[1-5]
\section{First section}\lipsum[6-10]
\section{Second section}\lipsum[11-15]
\section{Third section}\lipsum[16-20]
\section{Last section}\lipsum[21-25]
\showchapterthumbfalse

%\include{Mainmatter/Chapter_1}
%%\newpage
%%\thispagestyle{empty}
%%\mbox{}
%\include{Mainmatter/Chapter_2}
%%\newpage
%%\thispagestyle{empty}
%%\mbox{}
%
%\part{Name}
%\include{Mainmatter/Chapter_3}



\end{document}

Some help on this issue will be highly appreciated. :) Thanks in advance.

Your Answer

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

Browse other questions tagged or ask your own question.