使用 latex 包 tocloft 将 ToC 标题居中

使用 latex 包 tocloft 将 ToC 标题居中

在我的 LaTex 论文中,我需要制作这样的目录、图表列表和表格列表,所有这些的标题均居中且大写,并且还有其他特殊添加内容(例如插入带有单词“章节”、“图表”和“表格”的行)。到目前为止,我对这个项目的阐述产生了这个 latex 代码(见下文)。

但是,对我来说唯一不起作用的是将目录标题居中,标题标记为一个单词“Contents”。请参见下面的 pdf 输出文件图片。我应该在代码中修复什么?对于我的操作,我使用了两个包:titlesectocloft

\documentclass[11pt]{article}
% Set the page margins as required
\usepackage[left=1.25in,right=1in,top=1in,bottom=1in]{geometry}
\usepackage{graphicx}     % Required for inserting images
\usepackage{setspace}\doublespacing % Double space 
\usepackage{endnotes}     % All notes 2b place at a separate section 'Endnotes'
\usepackage{soul}
\usepackage{afterpage}
\usepackage{mwe}
\usepackage{tikz}
\usepackage{acro}         % Acronyms/abbreviations
\include{00-Acronyms}     % List of acronyms, 2b updated
%--> acro manual: https://mirror2.sandyriver.net/pub/ctan/macros/latex/contrib/acro/acro-manual.pdf
% Managing sections
\usepackage{titlesec}     % To modify the section titles
\renewcommand\thesection{\arabic{section}} % CHAPTER 1 [New Line] TITLE
\titleformat{\section}[display]            % each chapter has two lines...
  {\normalfont\Large\filcenter}{\MakeUppercase{Chapter~\thesection}}{0pt}{}
% Capitalizing the titles of the respective sections:
\renewcommand{\notesname}{\centering \MakeUppercase{Endnotes}}
\renewcommand{\contentsname}{\centering \MakeUppercase{Contents}}
\renewcommand{\refname}{\centering \MakeUppercase{References}}
\renewcommand{\listfigurename}{\centering \MakeUppercase{List of Illustrations}}
\renewcommand{\listtablename}{\centering \MakeUppercase{List of Tables}}
\usepackage{tocloft}      % <-- ...to modify ToC, LoF, and LoT
\renewcommand{\cfttoctitlefont}{\hfill\Large} % ToC = Table of Contents
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand{\cftloftitlefont}{\hfill\Large} % LoF = List of Figures
\renewcommand{\cftafterloftitle}{\hfill}
\renewcommand{\cftlottitlefont}{\hfill\Large} % LoT = List of Tables
\renewcommand{\cftafterlottitle}{\hfill}
\usepackage{natbib}       % Bibliography management
\bibliographystyle{apalike}
% My info
\date{October 14th, 2023}

% ----- Start of the document --------------------------------------------------
\begin{document}
% All notes to be in the separate section 'Endnotes'
\let\footnote=\endnote

% Table of Contents + making TOC not in bold font
{\let\bfseries\mdseries \tableofcontents} \newpage

% List of Figures/Illustrations
\listoffigures 
\addtocontents{lof}{{~Figure}~\hfill{Page}\par} % <- inserting a line w/"Figure"
\addcontentsline{toc}{section}{\uppercase{List of Illustrations}}
\newpage

% List of Tables
\listoftables
\addtocontents{lot}{{~Table}~\hfill{Page}\par} % <- inserting a line w/ "Table"
\addcontentsline{toc}{section}{\uppercase{List of Tables}}
\newpage 

% List of Acronyms/Abbreviations
\printacronyms[pages = {display=all,seq/use=false},
           name  = \uppercase{List of Acronyms}]
\addcontentsline{toc}{section}{\uppercase{List of Acronyms}}

%
% ... some latex code
%

\end{document}
% ----- End of the document ----------------------------------------------------

在此处输入图片描述

答案1

我的问题的答案是更改上面这行代码:

 \usepackage[titles]{tocloft} 

而且它运行得很好!

相关内容