如何从定义的章节样式中排除目录和目录框?

如何从定义的章节样式中排除目录和目录框?

我为该book课程定义了章节风格,如下所示:

\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{epigraph}
\usepackage{xpatch}
\usepackage{lmodern}

\titleformat{\chapter}[display]
  {\normalfont\filcenter\sffamily}
  {\tikz[remember picture,overlay]
    {
    \node[
        fill=gray,
        font=\fontsize{80}{92}\selectfont\color{white},
        anchor=north east,
        minimum size=3cm] 
      at ([xshift=-2.5cm,yshift=-3cm]current page.north east) 
      (numb) {\thechapter};
    \node[
        rotate=90,
        anchor=south,
        inner sep=0.8pt,
        font=\fontsize{20}{1}\selectfont\color{black}
        ] at (numb.west) {\chaptertitlename};
    }
  }
  {15pt}{\titlerule[2pt]\vskip3pt\titlerule\vskip4pt\fontsize{33}{40}\selectfont\color{gray}#1}[\vskip10pt]
\titlespacing*{\chapter} 
  {0pt}{50pt}{10pt}

我想排除\titlerule目录和目录行并将标题移到左侧。我该怎么做?

答案1

如何定义两种章节样式,一种用于目录和书目,另一种用于主文档。使用方式如下:

\documentclass...
\begin{document}
\titleformat{\chapter}... % For ToC
...
\tableofcontents
\titleformat{\chapter}... % for main document
\chapter...

\titleformat{\chapter}... % repeat the ToC one

% your bibliography

\end{document}

相关内容