删除目录的标题

删除目录的标题

我想删除目录页的页眉,只保留标题:目录。

在此处输入图片描述

和这个

在此处输入图片描述

我的代码是:

\documentclass{book}
\usepackage{fourier}
\usepackage{tikz}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{lipsum}
\usetikzlibrary{shadows.blur}
\usepackage{calc}
\usepackage[utf8]{inputenc}
\usepackage[frenchb]{babel}
\usepackage[french]{minitoc} 
\usepackage{titletoc} 
\usepackage{fancyhdr}

%chapter
\renewcommand\thechapter{\arabic{chapter}}

\titleformat{\chapter}
{\fontfamily{}\Huge\filleft}
{}
{20pt}
{\begin{tikzpicture}[remember picture,overlay]
    \draw [line width=2pt,blue] (-13,0) -- (1.5,0);
    \draw [line width=2pt,blue] (-13,4) -- (1.5,4);
    \draw [line width=2pt,blue] (1.5,4) -- (1.5,0);
% 
    \node[color=blue,xshift=-11cm,yshift=4.5cm,font=\fontsize{20}{20}\selectfont] {CHAPITRE}; 
% 
    \draw [fill=blue,blue,text=white] (-13,0) rectangle (-9cm,4cm)  node[pos=.5,font=\fontsize{100}{100}\fontfamily{pag}\bfseries\selectfont] {\thechapter}; % le numéro du chapitre   
    \node[anchor=north east,align=right,inner xsep=5pt,text=blue] at (2.4,4.1) 
    {\parbox{.9\textwidth}{\raggedright#1}};% le titre du partie
    \end{tikzpicture}%
}

\begin{document}
    \tableofcontents
    \chapter{A chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
\end{document}

答案1

要格式化目录标题,您可以使用键重新定义未编号章节的格式numberless。至于标题,只需\markboth{}在 toc 命令后添加一个命令并将整个放在一个组中即可。我添加了该lipsum 包用于测试目的,您可以将其删除。

\documentclass[french]{book}
\usepackage{fourier}
\usepackage{tikz}
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{lipsum}
\usetikzlibrary{shadows.blur}
\usepackage{calc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[french]{minitoc}
\usepackage{titletoc}
\usepackage{fancyhdr}
%chapter
\renewcommand\thechapter{\arabic{chapter}}

\titleformat{\chapter}
{\fontfamily{}\Huge\filleft}
{}
{20pt}
{\begin{tikzpicture}[remember picture,overlay]
    \draw [line width=2pt,blue] (-13,0) -- (1.5,0);
    \draw [line width=2pt,blue] (-13,4) -- (1.5,4);
    \draw [line width=2pt,blue] (1.5,4) -- (1.5,0);
%
    \node[color=blue,xshift=-11cm,yshift=4.5cm,font=\fontsize{20}{20}\selectfont] {CHAPITRE};
%
    \draw [fill=blue,blue,text=white] (-13,0) rectangle (-9cm,4cm) node[pos=.5,font=\fontsize{100}{100}\fontfamily{pag}\bfseries\selectfont] {\thechapter}; % le numéro du chapitre
    \node[anchor=north east,align=right,inner xsep=5pt,text=blue] at (2.4,4.1)
    {\parbox{.9\textwidth}{\raggedright#1}};% le titre du partie
    \end{tikzpicture}%
}

\titleformat{name=\chapter, numberless}
{\fontfamily{}\Huge\filright}
{}
{0pt}
{\color{blue}#1}

\begin{document}
\bgroup
    \tableofcontents
\markboth{}
\egroup

    \chapter{A chapter}
    \section{Section}
\lipsum[1-30]
    \section{Section 2}
    \section{test}
    \section{abc}
\lipsum
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}
    \section{Section}
    \section{Section 2}
    \section{test}
    \section{abc}
    \chapter{Second chapter}

\end{document} 

在此处输入图片描述

相关内容