1

I'm using titlesec to set my page style and biblatex to print a cumulative bibliography subdivided by chapter. There seems to be some problem with the \ifthesection command because in the following MWE the headers in the odd pages of the bibliography should say, for instance, "References Chapter 1" but I'me getting "Bibliography" instead.

\documentclass{book}

\usepackage[pagestyles]{titlesec}  
\newpagestyle{main}[\scshape]{%
  \headrule
  \sethead
  [\thepage][][\chaptertitlename\space\thechapter. \chaptertitle]
  {\ifthesection{\thesection\space\,\sectiontitle}
  {\chaptertitlename\space\thechapter. \chaptertitle}}{}{\thepage}
}
\newpagestyle{special}[\scshape]{%
  \headrule
  \sethead
  [\thepage][][\chaptertitle]
  {\ifthesection{\sectiontitle}{\chaptertitle}}{}{\thepage}
}

\usepackage{etoolbox}
\appto{\mainmatter}{\pagestyle{main}}
\appto{\backmatter}{\pagestyle{special}}

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

\usepackage{lipsum}
\usepackage{hyperref}

\begin{document}

\mainmatter
\chapter{Foo}
\lipsum
\section{Baz} 
\lipsum
\nocite{*}
\chapter{Bar}
\nocite{*}

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

\end{document}

One workaround is to define a new pagestyle that doesn't use the \ifthesection command and do the following in the preamble:

\newpagestyle{bibatend}[\scshape]{%
  \headrule
  \sethead
  [\thepage][][\chaptertitle]
  {\sectiontitle}{}{\thepage}
}
\appto{\backmatter}{\pagestyle{bibatend}}

However I would like to use the pagestyle special in the backmatter (because I have also an index that doesn't have sections and therefore the heading should always be the chapter title). So my question is: why is the \ifthesection command not working properly?

  • 1
    titlesec isn't compatible with refsegment=chapter. The option setting has biblatex patch low-level chapter commands. titlesec ignores these; it redefines the user-level \chapter command. – Audrey Jun 3 '13 at 1:01
  • @Audrey Thanks, I didn't know that. Can you post your comment as an answer? – petobens Jun 3 '13 at 1:16
2

The titlesec package isn't compatible with any of the biblatex refsegment or refsection option settings. biblatex patches the low-level section/chapter commands. titlesec ignores all of these changes because it redefines the user-level section/chapter commands.

To workaround this you should omit the refsegment=chapter setting and create reference segments manually with:

\chapter{<title>}
\begin{refsegment}
...
\end{refsegment}

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.