5

The following MWE prints a cumulative bibliography, subdivided by chapter, using biblatex. However there seems to be a problem with the \therefsegment counter because I'm getting "References Chapter 2" instead of "References Chapter 1".

\documentclass{book}
\usepackage[refsegment=chapter, backend=bibtex]{biblatex}
\defbibheading{bibbook}[\bibname]{\chapter{#1}}
\defbibheading{subbib}[\refname\space\chaptername\space\therefsegment]{\section{#1}}
\addbibresource{biblatex-examples.bib}

\begin{document}

\frontmatter
\tableofcontents
\chapter{Preface}

\mainmatter
\chapter{First}
\nocite{*}

\backmatter
\setcounter{secnumdepth}{0} 
\printbibheading[heading=bibbook]
\bibbysegment[heading=subbib]

\end{document}
  • refsegment=chapter is the rough equivalent of invoking \newrefsegment before \chapter. Part of this issue was brought up in another question. For an example that achieves correct numbering see the manual or this post. – Audrey May 30 '13 at 0:31
  • @Audrey That solved my problem! Should I delete my question or you prefer to post your comment as an answer? – petobens May 30 '13 at 20:00
4

Reference segment numbering starts at zero. The option setting refsegment=chapter is the rough equivalent of invoking \newrefsegment before \chapter. This ensures that citations in the chapter titles don't get assigned to the previous reference segment.

The section entitled "Multiple Bibliographies" in the biblatex manual demonstrates how the chapter and reference segment/section numbering can be kept in sync. Here is an excerpt, adapted to your example.

\documentclass[openany]{book}
\usepackage[defernumbers,backend=bibtex]{biblatex}
\usepackage{hyperref}

\defbibheading{subbibintoc}
  [\refname\ for Chapter \ref{refsegment:\therefsection\therefsegment}]
  {\section*{#1}\addcontentsline{toc}{section}{#1}}

\addbibresource{biblatex-examples.bib}

\begin{document}
\frontmatter
\tableofcontents
\chapter{Preface}

\mainmatter

\chapter{First chapter}
\begin{refsegment}
\nocite{glashow,bertram,markey}
\end{refsegment}

\chapter{Second chapter}
\begin{refsegment}
\nocite{companion,ctan,cms}
\end{refsegment}

\backmatter
\chapter{Appendix}
\printbibheading[heading=bibintoc]
\bibbysegment[heading=subbibintoc]
\end{document}

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.