0
  • 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}}
4
  • I can't compile without error due to missing bibfile.bib.
    – cfr
    Sep 17, 2014 at 2:06
  • I've updated the question to provide it's content. You can download the remaining files (IEEEfull.bib and IEEEtranSN.bst) from IEEEtran/bibtex
    – umarcor
    Sep 17, 2014 at 2:24
  • Lots of people won't download files just to answer questions. Fortunately, most people will have those already. You could simplify your question by sticking to references from IEEEfull.bib which everyone already has.
    – cfr
    Sep 17, 2014 at 2:36
  • I've modified it to use the references in IEEEexample.bib, which is given with IEEEtran. Apart from that, since bibunits is used, each *.aux file has to be processed. In the exmaple: pdflatex mwe.tex | biblatex bu.aux | biblatex bu1.aux | biblatex mwe.aux | pdflatex mwe.tex | pdflatex mwe.tex
    – umarcor
    Sep 17, 2014 at 3:02

1 Answer 1

0

Not fully tested as I can't compile the MWE properly:

\documentclass[a4paper,titlepage,10pt,twoside,openright]{report}
\usepackage[]{natbib}
\usepackage[globalcitecopy]{bibunits}
\defaultbibliography{IEEEfull,bibfile}
\defaultbibliographystyle{IEEEtranSN}
\renewcommand{\bibsection}{\section*{\bibname}\markboth{\leftmark}{\bibname}}

\usepackage[pagestyles,explicit]{titlesec}
\usepackage{fancyhdr}
\fancypagestyle{main}{%
  \fancyhf{}
  \renewcommand{\footrulewidth}{.4pt}
  \fancyhf[reh]{\leftmark}%
  \fancyhf[loh]{\rightmark}%
  \fancyhf[cf]{\thepage}%
}

\usepackage{lipsum}

\begin{document}

\pagestyle{main}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\assignpagestyle{\chapter}{main}

 \begin{bibunit}
  \chapter{Introduction}

  \lipsum[1-5] \cite{schreiber86}

  \section{First section}
  \cite{hestenes58} \lipsum[1-4]

  \section{Second section}
  \lipsum[2-6] \cite{rutishauser66} \lipsum[7-10]

  \nocite{brent85,cavallaro88}

 \renewcommand*{\sectiontitle}{\bibname}
  \putbib
 \end{bibunit}

 \cleardoublepage
 \renewcommand{\bibsection}{\chapter*{\bibname}}
 \bibliographystyle{IEEEtranSN}
 \bibliography{IEEEfull,bibfile}
 \cleardoublepage

\end{document}
3
  • I tried this answer, but it changes many of the heads/foots I want to maintain. What I actually get with the posted MWE: 1(?), 2(chaptitle head-right), 3(sectitle head-left), 4(chaptitle head-right), 5(sectitle! head-right), 6(?), 7(empty head), 8(chaptitle! head-right), where ? means I don't mind, because the chapter pages will have a diferent pagestyle, and ! means I want \bibname instead. On the other hand, with the answer you posted I get the sectiontile correctly updated, but it is shown on the left part of the header & footer in both even & odd. I'd like it to be done only in odd-heads
    – umarcor
    Sep 17, 2014 at 12:48
  • Since I'm using titlesec, I don't have to include those \markright and \markboth, because they get mixed. However, updating \sectionmark and \chaptermark made the trick. Thank you for your example.
    – umarcor
    Sep 17, 2014 at 18:52
  • @U.Martinez-Corral Glad it helped. I don't know titlesec very well, to be honest, as I've never used it myself.
    – cfr
    Sep 17, 2014 at 20:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .