According to the titlesec
documentation (§4.2) one is not supposed to play around with starred sectioning commands, \addcontentsline
and \mark...
commands. Instead the documentation suggests locally modifying the secnumdepth
counter to achieve the same effect.
The examples in the documentation define an environment for that, but it appears to be easier to use to have a dedicated command \addchap
that generates the desired section heading. \addchap
could be defined as follows
\newcommand*{\addchap}{\@dblarg\addchap@i}
\newcommand*{\addchap@i}[2][]{%
\begingroup
\c@secnumdepth\m@ne
\chapter[#1]{#2}%
\endgroup
}
Essentially this definition locally changes the counter secnumdepth
(that is responsible for the section numbering) to -1
(with \c@secnumdepth\m@ne
), which causes the command to produce an unnumbered sectioning. The setup with the auxiliary command and \@dblarg
is just to handle the optional argument correctly.
In the code below this definition is done automatically with \MkAddSectioningCMD
to avoid having to repeat the same construction several times.
So we change the bibintoc
and subbibintoc
heading definition to use a local version of \addchap
and \addsec
that suppress chapter and section numbers by changing secnumdepth
.
\documentclass[british]{book}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear]{biblatex}
\usepackage{lipsum}
\usepackage[pagestyles]{titlesec}
\newpagestyle{thesis}[\small]{%
\setheadrule{.55pt}%
\sethead[\thepage]% even-left
[\chaptertitle]% even-center
[]% even-right
{}% odd-left
{\sectiontitle}% odd-center
{\thepage}% odd-right
}
\makeatletter
\newcommand*{\MkAddSectioningCMD}[2]{%
\expandafter\newcommand\expandafter*\expandafter{\csname #1\endcsname}{%
\expandafter\@dblarg\expandafter{\csname #1@i\endcsname}}%
\expandafter\newcommand\expandafter*\expandafter{\csname #1@i\endcsname}[2][]{%
\begingroup
\c@secnumdepth\m@ne
#2[##1]{##2}%
\endgroup}%
}
\makeatother
\MkAddSectioningCMD{addchap}{\chapter}
\MkAddSectioningCMD{addsec}{\section}
\defbibheading{bibintoc}[\bibname]{%
\addchap{#1}}
\defbibheading{subbibintoc}[\refname]{%
\addsec{#1}}
\addbibresource{biblatex-examples.bib}
\begin{document}
\pagestyle{thesis}
\tableofcontents
\chapter{Lorem}
\section{Florem}
Lorem \autocite{sigfridsson,worman,geer}
\lipsum[1-12]
\nocite{*}
\addchap{Ipsum}
\addchap[Dolor]{Dolor Sit}
\addchap{\bibname}
\printbibliography[heading=subbibintoc, title={Book references}, type=book]
\printbibliography[heading=subbibintoc, title={Article references}, type=article]
\printbibliography[heading=subbibintoc, title={Other references}, nottype=article, nottype=book]
\end{document}

If you prefer LaTeX3 the definition of \addchap
can be changed to
\NewDocumentCommand{\addchap}{om}{%
\begingroup
\c@secnumdepth\m@ne
\IfNoValueTF{#1}
{\chapter{#2}}
{\chapter[#1]{#2}}%
\endgroup}
in which case we'd change \MkAddSectioningCMD
to
\makeatletter
\newcommand*{\MkAddSectioningCMD}[2]{%
\NewDocumentCommand{#1}{om}{%
\begingroup
\c@secnumdepth\m@ne
\IfNoValueTF{##1}
{#2{##2}}
{#2[##1]{##2}}%
\endgroup}%
}
\makeatother
and use it as
\MkAddSectioningCMD{\addchap}{\chapter}
\MkAddSectioningCMD{\addsec}{\section}
(You will need a current version of the LaTeX kernel when you want to use this without \usepackage{xparse}
.)