我正在尝试实现以下目录设计(但使用回忆录类):
基本上只显示章节号、名称和页码以及小节号、名称和页码。回忆录中的标准目录结构在名称和页码之间添加了点,我要删除这些点。
我能够找到部分解决方案,我设法删除了小节中的点,但未能删除章节或小节中的点(MWE):
\documentclass{memoir}
\usepackage{lipsum}
\renewcommand*{\cftsectionleader}{}
\tableofcontents*
\begin{document}
\chapter{Introduction}
\section{lipsum}
\lipsum[1-10]
\end{document}
但是,这种方法会在目录中生成格式错误的行:
- 我怎样才能仅使用回忆录实用程序来实现这一点?
答案1
我知道你想重现这个:https://logic.rwth-aachen.de/~ummels/diss.pdf
一种选择是重新定义l@chapter
等等:
\documentclass{memoir}
\usepackage{fontspec}
\setmainfont{Minion Pro}
\renewcommand\chapternumberline[1]{\numberline{#1}} %not necessary when using the book class
\makeatletter
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1ex \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@
\rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \large % added for large font for chapters
%\advance\leftskip\@tempdima
\hskip -\leftskip %\@chapapp~ \par % added \@chapapp~ \par
#1\nobreak \raggedright % originally \hfil
%added for leaders (dots) in chapter in toc
%\xleaders\hbox{$\m@th
% \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
% mu$}\hfill%
%%
\nobreak\hb@xt@\@pnumwidth{\hss ~\textbullet~#2}\par\vspace{.5ex} % ADDED VSPACE
\penalty\@highpenalty
\endgroup
\fi}
\renewcommand*\l@section[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
%\vskip .5ex \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent 3em
\rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \normalsize %
\advance\leftskip\@tempdima
\hskip -\leftskip %
#1\nobreak \raggedright % originally \hfil
%added for leaders (dots) in chapter in toc
%\xleaders\hbox{$\m@th
% \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
% mu$}\hfill%
%%%
\nobreak\hb@xt@\@pnumwidth{\hss \textbullet~#2}\par%\vspace{.5ex} % ADDED VSPACE
\penalty\@highpenalty
\endgroup
\fi}
\renewcommand*\l@subsection[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
%\vskip .5ex \@plus\p@
\setlength\@tempdima{2.3em}%
\begingroup
\parindent 5.3em
\rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \normalsize %
\advance\leftskip\@tempdima
\hskip -\leftskip %
#1\nobreak \raggedright % originally \hfil
%added for leaders (dots) in chapter in toc
%\xleaders\hbox{$\m@th
% \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
% mu$}\hfill%
%%%
\nobreak\hb@xt@\@pnumwidth{\hss \textbullet~#2}\par\vspace{1ex} % ADDED VSPACE
\penalty\@highpenalty
\endgroup
\fi}
\makeatother
\begin{document}
\tableofcontents
\chapter{title}
\section{section name}
\subsection{section name}
\chapter{title}
\section{section name}
\subsection{section name}
\chapter{title}
\section{section name}
\subsection{section name}
\chapter{title}
\section{section name}
\subsection{section name}
\end{document}
您可以根据自己的喜好调整长度。
如果你希望子部分出现在目录中,memoir
你应该添加
\setcounter{tocdepth}{2}
\setcounter{secnumdepth}{2}
答案2
这里是一样的,memoir
仅使用(主要来自手册第 155 页memoir
)
\documentclass{memoir}
\usepackage{lipsum}
\renewcommand*{\cftchapterleader}{}
\renewcommand*{\cftsectionleader}{}
\renewcommand*{\cftsubsectionleader}{}
\renewcommand{\cftchapterpagefont}{}
\renewcommand*{\cftchapterformatpnum}[1]{~\textbullet~#1}
\renewcommand*{\cftsectionformatpnum}[1]{~\textbullet~#1}
\renewcommand*{\cftsubsectionformatpnum}[1]{~\textbullet~#1}
\renewcommand{\cftchapterafterpnum}{\cftparfillskip}
\renewcommand{\cftsectionafterpnum}{\cftparfillskip}
\renewcommand{\cftsubsectionafterpnum}{\cftparfillskip}
\setrmarg{3.55em plus 1fil}
\setsecnumdepth{subsection}
\maxsecnumdepth{subsection}
\settocdepth{subsection}
\begin{document}
\tableofcontents*
\chapter{Introduction}
\section{lipsum}
\subsection{lipsum 2}
\end{document}
另外,这里有一些额外的代码来处理缩进
\setlength\cftsectionindent{0pt}
\setlength\cftsubsectionindent{0pt}
\setlength\cftchapternumwidth{3em}
\setlength\cftsectionnumwidth{3em}
\setlength\cftsubsectionnumwidth{3em}
还使数字框的大小相同