-
Pagestyles are defined with titlesec. A two-sided template is used, and in the main pagestyle
\chaptertitle
is shown in the header of even pages and\sectiontitle
in the odd ones. -
natbib is used to allow for author citation (
\citeauthor
). In addition, the\bibsection
command is provided, which I renewed to have\section*{}
titles when showing partial lists and\chapter*{}
when showing the global references list. -
bibunits is used to define and show partial references lists.
I want \sectiontitle
and \chaptertitle
to be updated with \putbib
or \bibliography
so that the headers show \bibname
, instead of the previous section/chapter. But, since starred variants are used, I can't get it done.
I've tried renewing them by hand just before calling \putbib
or \bibliography
:
\renewcommand{\sectiontitle}{\bibname}
\renewcommand{\chaptertitle}{\bibname}
but I get no difference.
Do you know how to update the headers when starred chapters or sections are created?
MWE:
\documentclass[a4paper,titlepage,10pt,twoside,openright]{report}
\usepackage{etoolbox}
\usepackage[]{natbib}
\usepackage[globalcitecopy]{bibunits}
\defaultbibliography{IEEEfull,IEEEexample}
\defaultbibliographystyle{IEEEtranSN}
\renewcommand{\bibsection}{\section*{\bibname}}
\usepackage[pagestyles,explicit]{titlesec}
\newpagestyle{main}{ \headrule \footrule %head and foot rules
\sethead[][][\chaptertitle] %head-even
{\sectiontitle}{}{} %head-odd
\setfoot[][\thepage][] %foot-even
{}{\thepage}{} %foot-odd
}
\usepackage{lipsum}
\begin{document}
\pagestyle{main}
\assignpagestyle{\chapter}{main}
\begin{bibunit}
\chapter{Introduction}
\lipsum[1-5] \cite{IEEEexample:article_typical}
\section{First section}
\cite{IEEEexample:shellCTANpage} \lipsum[1-4]
\section{Second section}
\lipsum[2-6] \cite{IEEEexample:IEEEwebsite} \lipsum[7-11]
\nocite*{IEEEexample:book_typical,IEEEexample:articledualmonths}
\renewcommand*{\sectiontitle}{\bibname}
\putbib
\end{bibunit}
\cleardoublepage
\renewcommand{\bibsection}{\chapter*{\bibname}}
\bibliographystyle{IEEEtranSN}
\bibliography{IEEEfull,IEEEexample}
\cleardoublepage
\end{document}
I would like the headers in pages 5, 7 and 8 to display \bibname
. Page 6 is correct, since it is the even page of the first chapter (Introduction).
After the answer by @cfr, y tried the next change:
\renewcommand{\bibsection}{\section*{\bibname}\sectionmark{\bibname}}
instead of
\renewcommand{\bibsection}{\section*{\bibname}}
and
\renewcommand{\bibsection}{\chapter*{\bibname}\chaptermark{\bibname}}
instead of
\renewcommand{\bibsection}{\chapter*{\bibname}}
And it works!
If biblatex is used instead of natbib, it may be accomplished with:
\defbibheading{bibliography}[\bibname]{\chapter*{#1}\chaptermark{#1}}
\defbibheading{subbibliography}[\bibname]{\section*{#1}\sectionmark{#1}}
Best Answer
Not fully tested as I can't compile the MWE properly: