Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

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}
share|improve this answer
    
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
    
@petobens Initialize the new counter with a large value. For example: \setcounter{lastmainsegment}{1000}. –  Audrey Jun 5 '13 at 21:02
    
Brilliant. Thanks –  petobens Jun 5 '13 at 21:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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