Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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[hidelinks]{hyperref}
\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}

%%Add a header on eack page

\usepackage{fancyhdr}
\renewcommand\headrule{}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\fancyhead[LE,RO]{\textcolor{red}{\uppercase{HEADER TEXT}}}

%Even add the header on the plain pages like the first page of each chapter
\fancypagestyle{plain}{%
\fancyhead[LE, RO]{\textcolor{red}{\uppercase{HEADER TEXT}}}}

%%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

%%The table of contents
\begin{multicols}{2}
  \tableofcontents
\end{multicols}

%%The Introduction (Part1)

\input{chapters/chapter1/input}

%The chapters in Part2

\newpage
\begin{mytitlebox}
\part*{PART2}
\addcontentsline{toc}{part}{\bf{PART2}}
\end{mytitlebox}

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

%The chapters in Part3

\newpage
\begin{mytitlebox}
\part*{PART3}
\addcontentsline{toc}{part}{\bf{PART3}}
\end{mytitlebox}

\input{chapters/chapter4/input}

\end{document}
share|improve this question

1 Answer 1

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}
\renewcommand\headrule{}
\pagestyle{fancy}
\fancyhead{} % clear all header fields
\usepackage{etoolbox}
\tracingpatches
\patchcmd{\part}{plain}{empty}{}{}
\makeatletter
\let\ps@plain\ps@fancy
\makeatother
\newcommand{\setheadmark}[1]{
\fancyhead[LE,RO]{\textcolor{red}{\uppercase{#1}}}
}



\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}
    \setheadmark{part2}
    \part*{PART2}
    \addcontentsline{toc}{part}{\bf{PART2}}
\end{mytitlebox}

\blinddocument

\clearpage
\begin{mytitlebox}
    \setheadmark{part3}
    \part*{PART3}
    \addcontentsline{toc}{part}{\bf{PART3}}
\end{mytitlebox}

\blinddocument

\end{document}
share|improve this answer
    
Thanks for this response. I am actually working on this project again now. I will shortly test your solution and then let you know if it worked. –  trosendal Mar 11 at 19:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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