1

In the code below, I typically start the bibliography on a new page.

I would like to be able to display "Bibliography", instead of the previous section number and name on the header, anytime the bibliography starts on an odd numbered page. After the bibliography section, I wanted to be able to revert back to the original header settings until the next bibliography section is encountered. I looked at the example found here, but could not get a proper solution. Thanks for your time and help.

Here is the MWE:

\documentclass[11pt,fleqn,table]{book}
\usepackage[top=3cm,bottom=3cm,left=3.2cm,right=3.2cm,headsep=10pt,a4paper]{geometry}
\usepackage{lipsum}
\usepackage[english]{babel}
\usepackage{etoolbox,fancyhdr}
\usepackage{filecontents}

\begin{filecontents}{chap1.bib}

@online{wiki_DS1,
 author = {Wikipedia},
 %editor = {{Henry W. Ott}},
 title = {Dynamical systems theory},
 url = {https://en.wikipedia.org/wiki/Dynamical_systems_theory},
 lastchecked = {03.09.2016},
 originalyear = {02.28.2016}
}

\end{filecontents}

\usepackage[refsection=chapter,defernumbers=true,sorting=none,sortcites=true,autopunct=true,babel=hyphen,abbreviate=false,backref=true,backend=biber]{biblatex}
\addbibresource{chap1.bib}

\defbibheading{bibempty}{}
\newcommand*{\refname}{Bibliography}

\newcommand{\mymark}{}
\makeatletter
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries \ #1}{}}
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}}
\fancyhf{} \fancyhead[LE,RO]{\textbf{\sffamily\normalsize\thepage}}
\fancyhead[LO]{\rightmark}
\fancyhead[RE]{\textbf{\sffamily\scshape\chaptername~\thechapter. \leftmark}}%
\renewcommand{\headrulewidth}{.5pt}
\addtolength{\headheight}{2.5pt}
\newcommand{\headrulecolor}[1]{\patchcmd{\headrule}{\hrule}{\color{#1}\hrule}{}{}}
\newcommand{\footrulecolor}[1]{\patchcmd{\footrule}{\hrule}{\color{#1}\hrule}{}{}}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}}
\renewcommand{\cleardoublepage}
\makeatother

\begin{document}

\tableofcontents
\newpage

\chapter{Test1}
\section{Name of Section One}
\lipsum[1]\cite{wiki_DS1}

\newpage
\section*{Bibliography}
\addcontentsline{toc}{section}{Bibliography}

\section*{Online}
\printbibliography[heading=bibempty,type=online,prefixnumbers={O}]

\newpage

\chapter{Test2}
\section{Name of Section Two}
\lipsum[1]\cite{wiki_DS1}

\newpage
\section*{Bibliography}
\addcontentsline{toc}{section}{Bibliography}

\newpage
\chapter{Test3}
\section{Name of Section Three}
\lipsum[1]\cite{wiki_DS1}
\lipsum

\newpage
\section*{Bibliography}
\addcontentsline{toc}{section}{Bibliography}

\end{document} 
Joe
  • 9,080
  • 1
    since you're entering the section header yourself, there is no timing issue. just insert \markboth{Bibliography}{Bibliography} immediately after the \section* and \addcontentsline instructions. – barbara beeton Mar 11 '16 at 15:32
  • @barbarabeeton, Thanks for your help. Your simple and elegant solution solved my problem. – Joe Mar 11 '16 at 16:27

1 Answers1

3

surely this has been answered before, but i couldn't find a good match.

the "basic" latex classes book and report do not reset the running heads for a starred chapter or section. so the easiest way to set them explicitly is to use \markboth{header text}{header text} to reset them manually. (if only one header needs to be reset, there is also \markright; \markleft would be possible but is not defined by these two classes.) the exact form that should appear in the running heads must be input; i.e., if the running heads should be all uppercase, that is how the text must be input.

timing is important, since this command takes effect on the current page. if possible, place the command immediately after \chapter* or \section*. if the affected "section" is handled as a unit, e.g. a bibliography, precede that instruction by a page break and then issue the \markxxx command; delaying this action until after the bibliography (or whatever) has been set will change the running head on only the last page, at best.

in the present question. \newpage has been issued before the affected \section*, so timing is not an issue.