Using \documentclass[twoside]{report}
, I would like the following headers:
- on the left, for even pages
Part Title: Chapter Title
- on the right, for odd pages
Section Title
In the MWE, I'm mostly getting what I want, based on these questions:
However, as seen on pages 3 and 7, when a chapter begins on an odd-numbered page, the section title doesn't appear in the header. Given the behavior on page 6, headings are working for even-numbered chapter start pages.
How do I get the section title to appear in the header on odd-numbered pages where a chapter begins?
MWE
\documentclass[twoside]{report}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{etoolbox}
%https://tex.stackexchange.com/a/13395/56480
\let\Oldpart\part
\newcommand{\parttitle}{}
\renewcommand{\part}[1]{
\Oldpart{#1}
\renewcommand{\parttitle}{#1}
}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{\parttitle: #1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\fancyhead[RO]{\rightmark}
\fancyhead[LE]{\leftmark}
\fancyfoot[C]{\thepage}
%https://tex.stackexchange.com/a/19741/56480
\patchcmd{\chapter}{plain}{fancy}{}{}
\begin{document}
\tableofcontents
\part{First Part}
\chapter{First Chapter}
\blindtext[1]
\section{First Section}
\blindtext[5]
\section{Second Section}
\blindtext[7]
\chapter{Second Chapter}
\blindtext[1]
\section{Third Section}
\blindtext[2]
\chapter{Third Chapter}
\blindtext[1]
\section{Fourth Section}
\blindtext[5]\end{document}
report.cls
for this to be happening. one can see from the heading on the toc page that running head text is inserted, and if the first\chapter
is changed to\chapter*
, it gets text too. so there is something different between\@chapter
and\@schapter
that isn't obvious. the next place to look, it seems, is tolatex.ltx
, but that makes no sense (and also, i haven't got time to dig through that just now). i'll take another look later, but maybe this clue will help someone else.part name
: the word ‘part’, or the part title? All this should be easy to do withtitlesec/titleps
‘ at least for standard classes.