5

My goal is to have a separate reference list for each chapter and to have custom headers and footers. For the former I am using biblatex and for the latter I am using titlesec. Using the attached tex file, a problem is manifest on the second page --- the references are corrupting my header and footer. Either I don't have the correct options or the there is an incompatibility between the two packages.

Help would be appreciated. All code is from TeX Live 2015. My OS is Linux Mint Rosa.

\documentclass[12pt]{book}
\begin{filecontents}{matrix.bib}
@book{golub.vanloan,
  author    = "Gene Golub and Charles {Van Loan}",
  title     = "Matrix Computations",
  edition   = "4th Edition",
  publisher = "The Johns Hopkins University Press",
  address   = "Baltimore, Maryland",
  year      = "2013",
  }
\end{filecontents}
\usepackage[bibencoding=ascii,sorting=none,backend=biber]{biblatex}
%\DefineBibliographyStrings{english}{references={Works Cited},}
\addbibresource{matrix.bib} 

\usepackage[explicit,pagestyles]{titlesec}
\titleformat{\section}                         % command
{\Large\bfseries}                              % format
{Section \thesection\ ---}                     % label
{.5em}                                         % sep
{\filright#1}                                  % before code
%\assignpagestyle{\chapter}{empty}
\newpagestyle{headingstyle}[\large\sffamily]{%
  \headrule
  \sethead[\sectiontitle][][\thesection]% even
          {\thesection}{}{\sectiontitle}% odd
  \setfoot{}{\usepage}{}%
}
\pagestyle{headingstyle}

\begin{document}
\begin{refsection}
\chapter{This is the chapter title.}
\section{A Big Matrix}
Now is the time for all good men to come to the aid of their county.
Golub and VanLoan \cite{golub.vanloan} is a good book.
Now is the time for all good men to come to the aid of their county.
\newpage
Now is the time for all good men to come to the aid of their county.
Now is the time for all good men to come to the aid of their county.
\printbibliography[heading=subbibliography]
%\printbibliography
\end{refsection}
\chapter{Another Chapter}
\section{A Little Matrix}
Now is the time for all good men to come to the aid of their county.
\newpage
Now is the time for all good men to come to the aid of their county.
\end{document}
6

The incompatibility between titlesec and biblatex is known: see the following text from the biblatex manual

The titlesec package redefines user-level document division commands such as \chapter or \section. This approach is not compatible with internal command changes applied by the BibLaTeX refsection and refsegment option settings described in § 3.1.2.1.

Accordingly, you have to look for a different solution. If I have understood correctly what you want, you can redefine the bibliography bibheading.

\defbibheading{bibliography}[\bibname]{%
  \section*{#1}}

This definition will use \section* to print the \bibname and does not save any values in the section marks (so they are no include in the header and footer). Also, you have remove the heading=subbibliogaphy from \printbibliography.

3

Guido's answer provides the right idea, but let's not throw the baby out with the bathwater without exhausting all the infant-preserving options first.

There is no need to switch to plain \printbibliography, abandoning subbibliography. All that is needed is to redefine the heading for the appropriate bibliography environment. In your case, that's subbibliography rather than bibliography. And \refname is probably more appropriate than bibname since people rarely want a bibliography - as opposed to a list of references - per chapter.

redefine subbibliography headings

\begin{filecontents}{\jobname.bib}
@book{golub.vanloan,
  author    = "Gene Golub and Charles {Van Loan}",
  title     = "Matrix Computations",
  edition   = "4th Edition",
  publisher = "The Johns Hopkins University Press",
  address   = "Baltimore, Maryland",
  year      = "2013",
  }
\end{filecontents}
\documentclass[12pt]{book}
\usepackage[bibencoding=ascii,sorting=none,backend=biber]{biblatex}
%\DefineBibliographyStrings{english}{references={Works Cited},}
\addbibresource{\jobname.bib}
\defbibheading{subbibliography}[\refname]{%
  \section*{#1}}
\usepackage[explicit,pagestyles]{titlesec}
\titleformat{\section}                         % command
{\Large\bfseries}                              % format
{Section \thesection\ ---}                     % label
{.5em}                                         % sep
{\filright#1}                                  % before code
%\assignpagestyle{\chapter}{empty}
\newpagestyle{headingstyle}[\large\sffamily]{%
  \headrule
  \sethead[\sectiontitle][][\thesection]% even
          {\thesection}{}{\sectiontitle}% odd
  \setfoot{}{\usepage}{}%
}
\pagestyle{headingstyle}

\begin{document}
\begin{refsection}
\chapter{This is the chapter title.}
\section{A Big Matrix}
Now is the time for all good men to come to the aid of their county.
Golub and VanLoan \cite{golub.vanloan} is a good book.
Now is the time for all good men to come to the aid of their county.
\newpage
Now is the time for all good men to come to the aid of their county.
Now is the time for all good men to come to the aid of their county.
\printbibliography[heading=subbibliography]
%\printbibliography
\end{refsection}
\chapter{Another Chapter}
\section{A Little Matrix}
Now is the time for all good men to come to the aid of their county.
\newpage
Now is the time for all good men to come to the aid of their county.
\end{document}
  • 2
    In any case you have to provide a new definition of a heading. – Guido May 18 '16 at 5:00
  • @Guido Oh, I completely agree. I upvoted your answer for precisely this reason ;). But you don't have to abandon the subbibliography environment. – cfr May 18 '16 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.