# Varying header by book part

I am trying to generate latex code that can be used to bring together minimally formatted chapters from many authors into a single report that has three parts. The section hierarchy that I am using is /part /chapter /section /subsection /subsubsection. Presently I have a single header throughout the document but I would like to have the partname in the header in parts 2 and 3 but not part 1 on every page except the part title page. I've tried with /thepart in the header and I think because I am using unnumbered parts it isn't working. I know I should be able to make this work from the examples that I've read here but no luck

My code for the project is here with a built PDF: https://github.com/trosendal/report_template

Thanks!

Thomas

Here is just the .tex code:

%%%%%%%%% The format of the report goes here %%%%%%%%%%%%%%%%%%%%%

%%A two sided book that has space for binding on the left side:
\documentclass[a4paper, twoside]{report}
\usepackage[top=4cm, bottom=2.5cm, left=2.5cm, right=2.5cm, bindingoffset=1cm]{geometry}
%use correct character encoding
\usepackage[utf8]{inputenc}

%Choose a font family:
%\usepackage{bookman}
%\usepackage{avant}
%\usepackage{chancery}
\usepackage{courier}
%\usepackage{newcent
%\usepackage{palatino}

\title{\textbf{\huge{Title of Report}}}
\author{The list of authors}

\usepackage{color}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{url}

%%Separated the columns by a 6 mm
\setlength{\columnsep}{0.6cm}

%%Sort out the spacing a style of the paragraph, section, subsection, subsubsection and chapter titles

\usepackage[compact]{titlesec}

\titleformat*{\section}{\normalfont\scshape\color{red}}
\titlespacing*{\section}{0pt}{12pt}{0pt}

\titleformat*{\subsection}{\small\bf}
\titlespacing*{\subsection}{0pt}{12pt}{0pt}

\titleformat*{\subsubsection}{\small\bf}
\titlespacing*{\subsubsection}{12pt}{12pt}{0pt}

\usepackage{fancyhdr}
\pagestyle{fancy}

%Even add the header on the plain pages like the first page of each chapter
\fancypagestyle{plain}{%

%%define the boxes around stuff:

\usepackage{tcolorbox}

\newtcolorbox{mybox}{colback=blue!5!white}

\newtcolorbox{mytitlebox}{colback=blue!5!white, valign=top, height=3.5cm,%
enlarge left by = -5cm, width=24cm}

%%%%%%%%% The content in the report goes after this break %%%%%%%%%%%%%%%%%%%%%

\begin{document}

%%The Title page
\maketitle

\begin{multicols}{2}
\tableofcontents
\end{multicols}

%%The Introduction (Part1)

\input{chapters/chapter1/input}

%The chapters in Part2

\newpage
\begin{mytitlebox}
\part*{PART2}
\end{mytitlebox}

\input{chapters/chapter2/input}
\input{chapters/chapter3/input}

%The chapters in Part3

\newpage
\begin{mytitlebox}
\part*{PART3}
\end{mytitlebox}

\input{chapters/chapter4/input}

\end{document}

-

I am not quite sure, but i think this should answer the question.

Redefine the part-pages to be empty, let plain be the same as pagestyle fance, define a command that makes inputting the new running headers more easy.

\documentclass[a4paper, twoside]{report}
\usepackage[top=4cm, bottom=2.5cm, left=2.5cm, right=2.5cm,
bindingoffset=1cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{multicol}

\title{Title of Report}
\author{The list of authors}

\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{etoolbox}
\tracingpatches
\patchcmd{\part}{plain}{empty}{}{}
\makeatletter
\let\ps@plain\ps@fancy
\makeatother
}

\usepackage{tcolorbox}
\usepackage{blindtext}

\newtcolorbox{mybox}{colback=blue!5!white}

\newtcolorbox{mytitlebox}{colback=blue!5!white,
valign=top, height=3.5cm,%
enlarge left by = -5cm, width=24cm}
\begin{document}

\maketitle

\begin{multicols}{2}
\tableofcontents
\end{multicols}

\blinddocument
\clearpage
\begin{mytitlebox}
\part*{PART2}
\end{mytitlebox}

\blinddocument

\clearpage
\begin{mytitlebox}