不同无编号章节的标题格式不同(第二部分)

不同无编号章节的标题格式不同(第二部分)

参考这个帖子:不同无编号章节的标题格式不同,我有以下代码:

\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}

第一个命令运行正常,但第二个命令不正常。参考书目的标题继承了目录的样式。相反,如果我将相关代码放在\newcommand{\bibliographyformat}上面\printbibliography,则一切正常。我的错误是什么?谢谢!

附言

请也考虑我的代码:

   \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}

将会有一个更复杂的交互,因为如果我像在第二个 MWE 中那样设置参考书目,区分就会失败

PS2 游戏

在我的第一个代码中,

\AfterEndPreamble{\pretocmd\printbibliography{\bibliographyformat}{}{}}

即使我把那行放进去也可以书目设置,因为它因为钩子而起作用\AfterEndPreamble

在我的第二个代码中(情况稍微复杂一些),如果我没记错的话,参考书目的标题是由\chapter*{\bibname}and 生成的,因此 etoolbox 不会对其进行修补。事实上,它继承了目录的格式。所以这里的问题不在于我将 etoolbox 命令放在哪里。

相关内容