Referring to this thread: Different titleformat style for different numberless chapters, I've the following code:
\begin{filecontents*}{\jobname.bib}
@book{ bottero:1992,
author = "Bottero, Jean and Kramer, Samuel N.",
title = "Uomini e dèi della Mesopotamia",
publisher = "Einaudi",
location = "Torino",
year = "1992",
}
\end{filecontents*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,twoside,12pt]{report}
\usepackage{fontspec}
\setmainfont{EB Garamond}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}
\PolyglossiaSetup{italian}{indentfirst=false}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titlesec,titletoc}
\usepackage{etoolbox}
\titleformat{\chapter}[display]
{\normalfont\fontsize{11pt}{12pt}\selectfont}{\thechapter}{0pt}{}
\newcommand{\tocformat}{%
\titleformat{name=\chapter,numberless}[display]
{\normalfont\filleft\fontsize{12pt}{13pt}\selectfont}
{}
{0pt}%
{}%
}
\pretocmd\tableofcontents{\tocformat}{}{}
\newcommand{\bibliographyformat}{%
\titleformat{name=\chapter,numberless}[display]
{\normalfont\itshape\fontsize{12pt}{13pt}\selectfont}
{}
{0pt}%
{}%
}
\pretocmd\printbibliography{\bibliographyformat}{}{}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[backend=biber,style=philosophy-verbose,scauthors=all,%
lowscauthors=true,giveninits,classical=true,volnumformat=strings,%
volumeformat=romansc,sorting=nyt,commacit=true,citepages=omit,%
editionformat=superscript,indexing]%
{biblatex}
\usepackage{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\chapter{Titolo}
\printbibliography
\end{document}
The first command works fine but the second one doesn't. The title of Bibliography inherits the style of Table of Contents. On the contrary, if I put the relevant code \newcommand{\bibliographyformat} just over \printbibliography, all works correctly. What is my mistake? Thanks!
PS
Please consider my code too:
\begin{filecontents*}{\jobname.bib}
@inbook{ boniolo:1999,
author = "Boniolo, Giovanni and Paolo Vidali",
title = "Scienza, filosofia e argomentazione",
booktitle = "Filosofia della scienza",
publisher = "B. Mondadori",
location = "Milano",
year = "1999",
pages = "627-708"
}
@book{ calabrese:2013,
author = "Calabrese, Stefano",
title = "Retorica e scienze neurocognitive",
publisher = "Carocci",
location = "Roma",
year = "2013",
}
@book{ meyer:1991,
author = "Meyer, Michel",
title = "Problematologia. Filosofia, scienza e linguaggio",
publisher = "Pratiche",
location = "Parma",
year = "1991",
}
\end{filecontents*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,twoside,12pt]{report}
\usepackage{fontspec}
\setmainfont{EB Garamond}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}
\PolyglossiaSetup{italian}{indentfirst=false}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{titlesec,titletoc}
\usepackage{etoolbox}
\titleformat{\chapter}[display]
{\normalfont\fontsize{11pt}{12pt}\selectfont}{\thechapter}{0pt}{}
\newcommand{\tocformat}{%
\titleformat{name=\chapter,numberless}[display]
{\normalfont\bfseries\filleft\fontsize{11pt}{12pt}\selectfont}
{}
{0pt}%
{}%
}
\newcommand{\bibliographyformat}{%
\titleformat{name=\chapter,numberless}[display]
{\normalfont\itshape\fontsize{11pt}{12pt}\selectfont}
{}
{0pt}%
{}%
}
\pretocmd\tableofcontents{\tocformat}{}{}
\AfterEndPreamble{\pretocmd\printbibliography{\bibliographyformat}{}{}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[backend=biber,style=philosophy-verbose,scauthors=all,%
lowscauthors=true,giveninits,classical=true,volnumformat=strings,%
volumeformat=romansc,sorting=nyt,commacit=true,citepages=omit,%
editionformat=superscript,indexing]%
{biblatex}
\usepackage{filecontents}
\addbibresource{\jobname.bib}
\nocite{*}
\DeclareBibliographyCategory{books01}
\DeclareBibliographyCategory{books02}
\DeclareBibliographyCategory{books03}
\addtocategory{books01}{boniolo:1999}
\addtocategory{books02}{calabrese:2013}
\addtocategory{books03}{meyer:1991}
\defbibheading{books01}{\section*{Studi 1}}
\defbibheading{books02}{\section*{Studi 2}}
\defbibheading{books03}{\section*{Studi 3}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\tableofcontents
\chapter{Titolo}
\chapter*{\bibname}
\addcontentsline{toc}{chapter}{\bibname}
\markboth{\scshape bibliografia}{\scshape bibliografia}
\printbibliography[heading=books01,category=books01]
\printbibliography[heading=books02,category=books02]
\printbibliography[heading=books03,category=books03]
\end{document}
There would be a more complex interaction, for if I set up the bibliography as in my second MWE, the differentiation fails
PS 2
In my first code,
\AfterEndPreamble{\pretocmd\printbibliography{\bibliographyformat}{}{}}
works even if I put that line before the bibliography settings, for it works because of the hook \AfterEndPreamble.
In my second code (a little more complex situation), if I'm not wrong, the title of Bibliography is produced by \chapter*{\bibname} and so etoolbox doesn't patch it. In fact it inherits the format of the Table of Contents. So the problem here is not where I put the etoolbox command.
\pretocmd\printbibliography{\bibliographyformat}{}{}after you loadbiblatex. In the MWE\pretocmd\printbibliography{\bibliographyformat}{}{}fails because at the time the patch is applied\printbibliographyis not even defined yet. – moewe Nov 02 '18 at 16:29