0

Creating ToC of parts using \parttoc, I'd like to be able to define pagestyle of ToC generated. In the next code, I have been able to define a pagestyle to every page I wanted, except to ToCs of parts. This is the code:

 \documentclass{report}
 \usepackage{fancyhdr}
 \usepackage{minitoc}

%Define general pagestyle
\fancyhf{}% Clear all headers/footers
\fancyhead[L]{Left header}\fancyhead[C]{Centre header}\fancyhead[R]{Right header}
\fancyfoot[L]{Left footer}\fancyfoot[C]{Centre footer}\fancyfoot[R]{Right footer}
\pagestyle{fancy}

%Define general ToC pagestyle
\fancypagestyle{toc}{
\fancyhead[R]{\nouppercase{mark}}
}

%Modifying part page pagestyle
\makeatletter
\renewcommand\part{%
\if@openright
\cleardoublepage
\else
\clearpage
\fi
\thispagestyle{toc}%
\if@twocolumn
\onecolumn
\@tempswatrue
\else
\@tempswafalse
\fi
\null\vfil
\secdef\@part\@spart}
\makeatother

\begin{document}
\doparttoc
\tableofcontents
\thispagestyle{toc} 
\part{part 1}
\parttoc
\section{section 1}
\section{section 2}
\part{part 2}
\parttoc
\section{section 3}
\section{section 4}

\end{document}

Could someone help me to define pagestyle of ToCs generated by \parttocas the other pages?

Thank you.

  • \renewcommand*\thispageparttocstyle{\pagestyle{toc}} changes the pagestyle of the first parttoc page to toc. BTW: Note that \tableofcontents\thispagestyle{toc} sets the pagestyle of the last TOC page to style toc. – esdd Jan 28 at 12:02
  • That works me, thanks! I add a \begingroup \endgroup to not affect the rest. – Daniel Jan 28 at 17:16

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.