我有一份带有自定义目录间距的回忆录文件:
\documentclass[oneside]{memoir}
\renewcommand{\cftchapteraftersnum} {\quad}
\renewcommand{\cftchapterdotsep} {\cftsectiondotsep}
\renewcommand{\cftchapterfont} {\cftsectionfont}
\renewcommand{\cftchapterleader} {\cftsectionleader}
\renewcommand{\cftchapterpagefont} {\cftsectionpagefont}
\renewcommand{\cftchapterpresnum} {\hfill}
\setlength {\cftbeforechapterskip}{0.5em}
\setlength {\cftchapternumwidth} {10em}
\begin{document}
\frontmatter
\chapter{Preface}
\tableofcontents*
\mainmatter
\chapter{Alpha}
\chapter{Beta}
\end{document}
这将生成如下目录:
我找不到任何回忆录选项来为非编号条目在开头留出空格,以便我可以将序言条目与编号章节名称对齐(即序言与 Alpha 左对齐)。有什么办法吗?
答案1
加载类后添加以下几行memoir
。
\usepackage{xpatch}
\makeatletter
\xpatchcmd\@chapter
{\addcontentsline{toc}{chapter}{\f@rtoc}}%
{\addcontentsline{toc}{chapter}{\protect\chapternumberline{}\f@rtoc}}%
{}%
{}
\makeatother
这只会处理前言。\chapter*
主要部分的标题处理方式不同。对于这些,只需添加以下行即可
\renewcommand\memchapstarinfo[2]{\addcontentsline{toc}{chapter}{\protect\chapternumberline{}#1}}
\documentclass[oneside]{memoir}
\usepackage{xpatch}
\makeatletter
\xpatchcmd\@chapter
{\addcontentsline{toc}{chapter}{\f@rtoc}}%
{\addcontentsline{toc}{chapter}{\protect\chapternumberline{}\f@rtoc}}%
{}%
{}
\makeatother
\renewcommand\memchapstarinfo[2]{\addcontentsline{toc}{chapter}{\protect\chapternumberline{}#1}}
\renewcommand{\cftchapteraftersnum} {\quad}
\renewcommand{\cftchapterdotsep} {\cftsectiondotsep}
\renewcommand{\cftchapterfont} {\cftsectionfont}
\renewcommand{\cftchapterleader} {\cftsectionleader}
\renewcommand{\cftchapterpagefont} {\cftsectionpagefont}
\renewcommand{\cftchapterpresnum} {\hfill}
\setlength {\cftbeforechapterskip}{0.5em}
\setlength {\cftchapternumwidth} {10em}
\begin{document}
\frontmatter
\chapter{Preface}
\tableofcontents*
\mainmatter
\chapter{Alpha}
\section{Alpha 1}
\section{Alpha 2}
\chapter*{Beta}
\section{Beta 1}
\section{Beta 2}
\end{document}