[Tex/LaTex] Using biblatex+memoir+refsection: Why are the references included in the ToC

biblatexmemoirtable of contents

Consider this example taken and modified from a previous question:

\begin{filecontents*}{references.bib}
@BOOK{childs_temperature,
  title = {Practical Temperature Measurement},
  publisher = {Butterworth - Heinemann},
  year = {2001},
  author = {Childs, Peter R N},
  address = {Great Britain},
  edition = {1},
  isbn = {0 7506 5080 X}
  }

  @PHDTHESIS{hashemian,
  author = {Hashemian, Hashem Mehrdad},
  title = {Measurements of dynamic temperatures and pressures in nuclear power plants},
  school = {{The University of Western Ontario}},
  year = {2011},
  type = {PhD {T}hesis}
  }
\end{filecontents*}

\documentclass{memoir}
 \usepackage[style=alphabetic,refsection=chapter]{biblatex}
 \addbibresource{references.bib}

 \begin{document}

 \tableofcontents
 % \begin{refsection}
 \chapter{First chapter}
 \section{Foo}
 Some text \cite{childs_temperature}.
\printbibliography[heading=subbibliography]
 % \end{refsection}

 % \begin{refsection}
 \chapter{Second chapter}
 \section{Bar}
 Some text \cite{hashemian}.
 \printbibliography[heading=subbibliography]
 % \end{refsection}

 \end{document}

According to the documentation of biblatex, the printbibliography command generates a section with the references of each chapter, since the refsection=chapter option was used, but it should not be included in the ToC, because the subbibliography heading does not add it to the ToC (see the following biblatex.def extract):

  \defbibheading{subbibliography}[\refname]{%
    \subsection*{#1}}
  \defbibheading{subbibintoc}[\refname]{%
    \subsection*{#1}%
    \addcontentsline{toc}{subsection}{#1}}

However, in this example, it is included in the ToC.

enter image description here

Moreover, if the refsection=chapter is not used and the \begin{refsection} \end{refsection} parts are uncommented, the reference section is not included in the ToC, as advertised by the docs.

Another interesting clue, and maybe the key clue for this enigma, is that when I use the book document class instead of memoir, the references and ToC work as expected.

Can anyone explain this behavior? I'm sure that I misunderstood or did not find my way in the vast biblatex and memoir documentation.

Best Answer

Look down further in biblatex.def and you will find

\or % memoir (book)
% ....
\defbibheading{subbibliography}[\refname]{%
    \section*{#1}%
    \ifmemoirbibintoc
      {\phantomsection
       \addcontentsline{toc}{section}{#1}}
      {}%
    \if@twoside\markright{\memUChead{#1}}\fi}

Thus if \memoirbibintoc is true, it will add a reference header to the toc.


And that variable is tied directly to \nobibintoc as mentioned by jon (in blx-compat.def)