我怎样才能正确地将目录居中?

我怎样才能正确地将目录居中?

我正在尝试用 LaTeX 排版一本书,但在设置目录格式时遇到了麻烦。我能够成功地将标题和章节编号居中,但我不知道如何将章节标题和章节起始页码居中。

此代码重现了该问题:

\documentclass{scrbook}
\usepackage{titletoc, tocloft, lipsum, fmtcount}
\renewcommand{\thechapter}{\Numberstring{chapter}}

% Centers the table of contents title:
\renewcommand{\cfttoctitlefont}{\hfill}
\renewcommand{\cftaftertoctitle}{\hfill}

% Eliminates the space between the chapter title and the page number:
\renewcommand{\cftchapleader}{}
\renewcommand{\cftchapafterpnum}{\cftparfillskip}
\renewcommand{\cftchapfillnum}[1]{~$\cdot$~#1\cftparfillskip\par} 
% ^Puts a small dot between the chapter and the page number.

% Here's where I need help:
\renewcommand{\cftchapaftersnumb}{\\} 
% ^Puts the chapter title below the chapter number. How do I increase this space?
\renewcommand{\cftchapfont}{\centering} 
% ^Centers the chapter numbers. How do I center the chapter titles/pages?

\begin{document}
\tableofcontents
\chapter{Chapter Title}
\lipsum
\chapter{Another Chapter Title}
\lipsum
\end{document}

这是一张图片:

在此处输入图片描述

这是我第一次提问,如果我的 MWE 不清楚或者我需要提供更多信息,请告诉我。谢谢!

答案1

我找到解决方案了!太棒了!

正如 Christian Hupfer 和 Johannes_B 在评论中指出的那样,将scrbook和结合起来toclofttitletoc个糟糕的想法;因此,我完全放弃了原来的方法,将文档类改为memoir。我怀疑为了解决一个问题而进行如此彻底的修改无异于用核武器消灭跳蚤,所以我将这个问题留待以后再讨论,因为可能存在更优雅的解决方案。

无论如何,这就是我想出的:

\documentclass{memoir}
\let\ordinal\relax
\usepackage{fmtcount}
    \renewcommand{\thechapter}{\Numberstring{chapter}}
\renewcommand{\cftchapterleader}{}
\renewcommand{\cftchapterfillnum}[1]{~$\cdot$~#1\cftparfillskip\par}
\renewcommand*{\cftchapterfont}{}

% This code centers the table of contents title.
\renewcommand*{\printtoctitle}[1]{\centering#1} 

% This code centers the rest of my table of contents. Huzzah!
\setrmarg{0em}
\setlength\cftchapternumwidth{0pt}
\renewcommand\chapternumberline[1]{\hfil#1\hfil\strut\par\nopagebreak\hfil}

\setlength{\cftbeforechapterskip}{10pt} % Controls distance between TOC entries.

\linespread{1.25}\selectfont % Controls line-spacing in the whole document. 

\begin{document}
\tableofcontents*
\chapter{Title}
\chapter{Another Title}
\end{document}

谢谢大家的帮助!

相关内容