刪除目錄的標題

刪除目錄的標題

我想刪除目錄頁的標題,只保留標題:目錄。

在此輸入影像描述

和這個

在此輸入影像描述

我的程式碼是:

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

在此輸入影像描述

相關內容