如何删除“内容”标题

如何删除“内容”标题

我正在用 LaTeX 撰写我的博士论文并尝试使其符合大学标准。

我的标题需要分为两行,目录也是如此。我设法包含了它,但无法摆脱使用 自动创建的“目录”标题ToC

\documentclass[12pt,a4paper]{article}
\begin{document}

\section*{Table of Contents} %heading I do want

\tableofcontents %heading I don't want or want to change to "Table of Contents"
\setcounter{tocdepth}{4}

\end{document}

答案1

一种解决方案(稍后将被删除),无需额外的包(除了虚拟生成器),通过在命令之前和之后blindtext“注入”一个命令,假设类,如在 OP 中并重新定义。 \rule\section*article\contentsname

\documentclass[12pt,a4paper]{article}

\usepackage{blindtext}

\makeatletter
\renewcommand{\contentsname}{Table of Contents}

\newlength{\tocheaderrulewidth}
\setlength{\tocheaderrulewidth}{2pt}

\renewcommand\tableofcontents{%
  \begingroup
  \parindent=0em
  \rule{\linewidth}{\tocheaderrulewidth}% Rule drawing
  \section*{\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
   \rule{\linewidth}{\tocheaderrulewidth}
   \endgroup

  \@starttoc{toc}%
 }
\makeatother

\begin{document}

\tableofcontents %heading I don't want or want to change to "Table of Contents"
\setcounter{tocdepth}{4}

\blinddocument
\end{document}

enter image description here

答案2

解决方案如下titlesec + titletoc

\documentclass[12pt, a4paper, english]{report}
\usepackage[utf8]{inputenc}%
\usepackage{babel}
\usepackage{titlesec, titletoc}
\setcounter{tocdepth}{4}

\addto\captionsenglish{\renewcommand*\contentsname{Table of contents}}
\titleformat{\chapter}[block]{\thispagestyle{empty}\bfseries\Large\filcenter}{\thechapter. }{0.5em}{}
\titleformat{name=\chapter, numberless}[block]{\thispagestyle{empty}\bfseries\Large\titlerule[1pt]\bigskip\filcenter}{}{0pt}{\MakeUppercase}[\medskip{\titlerule[1pt]}]

\titlecontents{chapter}
[0em] %
{\bigskip\bfseries\large}
{\thecontentslabel.\enspace \MakeUppercase}%\thecontentslabel
{\centerline}
{\hfill\contentspage}[\smallskip]

\begin{document}

\tableofcontents %heading I don't want or want to change to "Table of Contents"
\chapter{Looking-Glass House}
\chapter{The Garden of Live Flowers}
\chapter{Looking-Glass Insects}
\chapter{Tweedledum and Tweedledee}
\chapter{Wool and Water}
\chapter{Humpty Dumpty}
\chapter{The Lion and the Unicorn}
\chapter{‘It’s my own Invention’}
\chapter{Queen Alice}
\chapter{Shaking}
\chapter{Waking}
\chapter{Which Dreamed it?}

\end{document} 

enter image description here

相关内容