我正在使用class{book}
,当我使用以下命令更改 Toc 的标题时
\renewcommand{\contentsname}{\Large TABLE OF CONTENTS}
显然,标题会相应改变,而我并不想这样。LoF、LoT 等也是如此。如果我使用命令进一步将标题居中
\renewcommand{\contentsname}{\hfill\Large TABLE OF CONTENTS\hfill}
我想要的是只更改标题,而不更改页眉。有什么建议吗?提前谢谢。
这是我正在使用的示例代码
\documentclass[12pt]{book}
\usepackage[affil-it]{authblk} % use affiliation
\usepackage[top = 2.3cm, bottom = 2.5cm, right = 2.2cm, left = 2.2cm]{geometry}
\usepackage{amsfonts, amsmath, amssymb, array}
\usepackage[none]{hyphenat}
\usepackage[nottoc, notlot, notlof]{tocbibind}
\usepackage{fancyhdr}
\fancyfoot{}
\fancyfoot[C]{\fontsize{10pt}{10pt}\selectfont\thepage}
\usepackage{tocloft}
\renewcommand\cftsecfont{\normalfont}
\renewcommand\cftsecpagefont{\normalfont}
\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}
\renewcommand\cftsecdotsep{\cftdot}
\renewcommand\cftsubsecdotsep{\cftdot}
\begin{document}
\renewcommand{\contentsname}{\hfill\Large TABLE OF CONTENTS\hfill}
\renewcommand{\listfigurename}{LIST OF FIGURES}
\renewcommand{\listtablename}{LIST OF TABLES}
\pagenumbering{gobble}
% \clearpage
\renewcommand{\baselinestretch}{2}\normalsize
\pagenumbering{roman}
% \addcontentsline{toc}{chapter}{Table of contents}
\tableofcontents
\clearpage
\listoffigures
\addcontentsline{toc}{chapter}{List of figures}
\clearpage
\phantomsection
\listoftables
\addcontentsline{toc}{chapter}{List of tables}
\clearpage
\pagenumbering{arabic}
\setcounter{page}{1}
\chapter{Hello}
\section{1.1}
\subsection{1.1}
\subsection{1.2}
\subsection{1.3}
\subsection{1.4}
\subsection{1.5}
\subsection{1.6}
\chapter{World}
\section{2.1}
\subsection{2.1}
\subsection{2.2}
\subsection{2.3}
\subsection{2.4}
\subsection{2.5}
\subsection{2.6}
\chapter{Good day}
\section{3.1}
\subsection{3.1}
\subsection{3.2}
\subsection{3.3}
\subsection{3.4}
\subsection{3.5}
\subsection{3.6}
\end{document}
答案1
我很高兴您使用这个tocloft
软件包。我对您的 MWE 进行了四处修改,让您得到了想要的结果。
% toctitleprob.tex SE 599174
\documentclass[12pt]{book}
\usepackage[affil-it]{authblk} % use affiliation
\usepackage[top = 2.3cm, bottom = 2.5cm, right = 2.2cm, left = 2.2cm]{geometry}
\usepackage{amsfonts, amsmath, amssymb, array}
\usepackage[none]{hyphenat}
\usepackage[nottoc, notlot, notlof]{tocbibind}
\usepackage{fancyhdr}
\fancyfoot{}
\fancyfoot[C]{\fontsize{10pt}{10pt}\selectfont\thepage}
\usepackage{tocloft}
\renewcommand\cftsecfont{\normalfont}
\renewcommand\cftsecpagefont{\normalfont}
\renewcommand{\cftsecleader}{\cftdotfill{\cftsecdotsep}}
\renewcommand\cftsecdotsep{\cftdot}
\renewcommand\cftsubsecdotsep{\cftdot}
\begin{document}
%\renewcommand{\contentsname}{\hfill\Large TABLE OF CONTENTS\hfill} % don't do this
\renewcommand{\contentsname}{TABLE OF CONTENTS} % but do these instead
\renewcommand{\cfttoctitlefont}{\hfill\Large}
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\listfigurename}{LIST OF FIGURES}
\renewcommand{\listtablename}{LIST OF TABLES}
\pagenumbering{gobble}
% \clearpage
\renewcommand{\baselinestretch}{2}\normalsize
\pagenumbering{roman}
% \addcontentsline{toc}{chapter}{Table of contents}
\tableofcontents
\clearpage
\listoffigures
\addcontentsline{toc}{chapter}{List of figures}
\clearpage
\phantomsection
\listoftables
\addcontentsline{toc}{chapter}{List of tables}
\clearpage
\pagenumbering{arabic}
\setcounter{page}{1}
\chapter{Hello}
\section{1.1}
\subsection{1.1}
\subsection{1.2}
\subsection{1.3}
\subsection{1.4}
\subsection{1.5}
\subsection{1.6}
\chapter{World}
\section{2.1}
\subsection{2.1}
\subsection{2.2}
\subsection{2.3}
\subsection{2.4}
\subsection{2.5}
\subsection{2.6}
\chapter{Good day}
\section{3.1}
\subsection{3.1}
\subsection{3.2}
\subsection{3.3}
\subsection{3.4}
\subsection{3.5}
\subsection{3.6}
\end{document}
阅读部分2.2 更改标题在tocloft
手册中描述了如何更改目录等标题。