我正在嘗試實現以下目錄設計(但使用回憶錄類):
基本上只顯示章節號、名稱和頁碼以及小節號、名稱和頁碼。回憶錄中的標準目錄結構在名稱和頁面之間添加了點,我將其刪除。
我能夠找到一個部分解決方案,我設法刪除了小節中的點,但沒有刪除章節或小節中的點(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
僅使用(主要來自memoir
手冊第155頁)
\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}
也使數字框大小相同