如何将“目录”移至页面中间

如何将“目录”移至页面中间

我需要将“内容”一词移至页面中间。
在此处输入图片描述

照片中它显示在页面左侧。可以将其移动到页面中间吗?

这是我的代码:

\documentclass[a4paper,12pt]{book}
\usepackage[margin=1.4in]{geometry}
\usepackage{titlesec}
\titleformat{\section}[block]{\Large\bfseries\filcenter}{}{1em}{}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tocloft}
\usepackage{setspace}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand\cftsecfont{\large}
\title{Title}
\author{Author}
\begin{document}
\maketitle
\doublespacing
\begingroup
\let\cleardoublepage\clearpage
\tableofcontents
\endgroup
\singlespacing
\newpage
\pagestyle{plain}
\section*{Test}
\addcontentsline{toc}{section}{Test}
\section*{Test}
\addcontentsline{toc}{section}{Test}
\section*{Test}
\addcontentsline{toc}{section}{Test}

答案1

这个怎么样?

\documentclass[a4paper,12pt]{book}
\usepackage[margin=1.4in]{geometry}
\usepackage{titlesec}
\titleformat{\section}[block]{\Large\bfseries\filcenter}{}{1em}{}
\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tocloft}
\usepackage{setspace}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand\cftsecfont{\large}
\title{Title} % <-- add this line to make the file compilable
\author{Author} % <-- add this line to make the file compilable
\begin{document} 
\maketitle
\doublespacing
\begingroup
\let\cleardoublepage\clearpage

\renewcommand{\contentsname}{\hfill Contents\hfill}   % <-- centering the title

\tableofcontents
\endgroup
\singlespacing
\newpage
\pagestyle{plain}
\section*{Test}
\addcontentsline{toc}{section}{Test}
\section*{Test}
\addcontentsline{toc}{section}{Test}
\section*{Test}
\addcontentsline{toc}{section}{Test}
\end{document}

在此处输入图片描述

相关内容