9

The following MWE prints a cumulative bibliography, subdivided by chapter, using biblatex. Since there is a reference in the appendix the corresponding heading in the bibliography should read "References Appendix A" but I'm getting "References Chapter A". If I change \chaptername for \appendixname in the bibheading definition I get chapters headings in the bibliography as "References Appendix 1" which is also incorrect.

\documentclass{book}
\usepackage[refsegment=chapter, backend=bibtex]{biblatex}
\defbibheading{bibbook}[\bibname]{\chapter{#1}}
\defbibheading{subbib}[\refname\space\chaptername\space     % try \appendixname here
  \ref*{refsegment:\therefsection\therefsegment}]{%
  \setcounter{secnumdepth}{0}%
  \section{#1}}
\addbibresource{biblatex-examples.bib}

\usepackage{hyperref}
\begin{document}

\mainmatter
\chapter{Bar}
\nocite{cms}

\appendix
\chapter{Fooo}
\nocite{glashow}

\backmatter
\printbibheading[heading=bibbook]
\bibbysegment[heading=subbib]

\end{document}

Edit: I tried using \chaptertitlename instead of \chaptername but that also didn't work.

5

You can hook code into \appendix to save the current reference segment number:

\newcounter{lastmainsegment}
\setcounter{lastmainsegment}{1000}
\appto{\appendix}{\setcounter{lastmainsegment}{\value{refsegment}}}

Then your bibliography heading definition can select the appropriate name:

\ifnumgreater{\therefsegment}{\value{lastmainsegment}}{\appendixname}{\chaptername}
  • Audrey that works perfectly well. How can you extend it (maybe by adding a conditional) so I can use the same bibheading definition even when an appendix is not defined? – petobens Jun 5 '13 at 20:45
  • 1
    @petobens Initialize the new counter with a large value. For example: \setcounter{lastmainsegment}{1000}. – Audrey Jun 5 '13 at 21:02

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.