When I change the behavior of \leftmark in the Reference section, it only changes on the second odd page of that section (by default, both \leftmark and \rightmark is set as \bibname). Compile the MWE below with
pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex|bibtex bu1.aux|bibtex bu2.aux|pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex|pdflatex -synctex=1 -interaction=nonstopmode -shell-escape %.tex
What is the reason for this?
\documentclass[b5paper, twoside, 11pt]{book}
\usepackage{fancyhdr} % needed for fancy headers
\setlength{\headheight}{13.6pt} % to avoid lame warning ...
\usepackage[sectionbib]{bibunits} % enable several bibliography. The sectionbib sets bibliography titles at section level
\usepackage{blindtext}
\begin{filecontents}{test.bib}
@article{test,
author={A Dummy Reference},
title = {\blindtext[7]},
journal = {Some random Journal},
year = {2013}
}
\end{filecontents}
\defaultbibliography{test} % source for references
\renewcommand\bibname{References} % rename bibliography as references
\newtoks\paperTitle
\usepackage{titlesec}
\newcommand{\includePaper}[1]{
\begin{bibunit}
\part{\the\paperTitle}
\vspace*{50pt}
{\noindent\raggedright\normalfont\LARGE\bfseries\the\paperTitle\par\nobreak}
\vspace*{40pt}
\chaptermark{\the\paperTitle}
#1 % contents
\clearpage
\putbib
\sectionmark{References} % <- I want this as \rightmark
\chaptermark{\the\paperTitle} % <- I want this as \leftmark
\cleardoublepage
\end{bibunit}
}
\makeatletter
\renewcommand\thesection{\@arabic\c@section}
\@addtoreset{section}{part}
\makeatother
\titleformat{\section}[hang]{\bfseries\Large}{\thesection.\quad}{0pt}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\nouppercase{\leftmark}}
\fancyhead[LO]{\nouppercase{\rightmark}}
\begin{bibunit}
\chapter*{Introduction}
\chaptermark{Introduction}
\section{First section in introduction}
\blindtext[10]\cite{test}
\clearpage
\putbib
\sectionmark{References} % <- I want this as \rightmark
\chaptermark{Introduction} % <- I want this as \leftmark
\cleardoublepage
\end{bibunit}
\paperTitle{First paper title}%
\includePaper{\section{First section in paper}\blindtext[8]\cite{test}}
\end{document}