在 titletoc 输出中模仿回忆录 ToC 布局

在 titletoc 输出中模仿回忆录 ToC 布局

我在之前的回答的帮助下主目录和分段目录的目录深度不同,我已将其设置为我的目录titletoc可以包含,subsections而我的主目录toc不包含它们。但是,我注意到titletoc目录的格式具有不同的间距。

如果我自己设置了主toc格式,我会复制参数以模仿目录titletoc。但由于这是默认的回忆录格式,我不确定如何复制它。

这是 MWE

\documentclass{memoir}
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}
\linespread{1.3}
\usepackage{titletoc}
\usepackage{lipsum}
\setpnumwidth{2.5em}
\setrmarg{3.5em}
\begin{document}
\tableofcontents*
\setsecnumdepth{subsection}
\maxsecnumdepth{subsection}
\settocdepth{subsection}    
\chapter{Chap1}
\section{Chap1Sec1}
\section{Chap1Sec2}
\chapter{Chap2}
\section{Chap2Sec1}
\section{Chap2Sec2}
\subsection{Chap2Sec2Subsec1}
\chapter{Chap3}
\settocdepth{section}
\renewcommand{\thesection}{\thechapter-\Roman{section}}
\renewcommand{\thesubsection}{\thechapter-\Roman{section}.\arabic{subsection}}
\renewcommand{\thepage}{S-\arabic{page}}
\section{Chap3Sec1}
\clearpage
\section{Chap3Sec2}

\startcontents
\printcontents{}{2}{\addtocontents{ptc}{\setcounter{tocdepth}{2}}}
\lipsum[1-2]
\subsection{Chap3Sec2Subsec1}\clearpage
\subsection{Chap3Sec2Subsec2}\clearpage
\subsection{Chap3Sec2Subsec3}\lipsum[1]
\subsection{Chap3Sec2Subsec4}
\stopcontents
\section{Chap3Sec3}\clearpage
\section{Chap3Sec4}\clearpage
\section{Chap3Sec5}\clearpage
\section{Chap3Sec6}\clearpage
\section{Chap3Sec7}\clearpage
\renewcommand{\thepage}{A-\arabic{page}}
\setcounter{page}{9}
\chapter{Chap4}
\settocdepth{subsection}
\section{Chap4Sec1}\clearpage
\section{Chap4Sec2}\clearpage
\subsection{Chap4Sec2Subsec1}

\end{document}

这是第二个 MWE,展示了 lockstep 的建议,以及现在的新间距问题。它使用了包中的DoubleSpacingSingleSpacing使用memoir

\documentclass{memoir}
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}
\linespread{1.3}
\usepackage{titletoc}
\usepackage{lipsum}
\setpnumwidth{2.5em}
\setrmarg{3.5em}
\begin{document}
\addtocontents{toc}{\protect\setlength{\parskip}{0pt}}
\frontmatter
\tableofcontents*
\setsecnumdepth{subsection}
\maxsecnumdepth{subsection}
\settocdepth{subsection} 
\mainmatter
\DoubleSpacing   
\chapter{Chap1}
\section{Chap1Sec1}
\section{Chap1Sec2}
\chapter{Chap2}
\section{Chap2Sec1}
\section{Chap2Sec2}
\subsection{Chap2Sec2Subsec1}
\SingleSpacing
\chapter{Chap3}
\settocdepth{section}
\renewcommand{\thesection}{\thechapter-\Roman{section}}
\renewcommand{\thesubsection}{\thechapter-\Roman{section}.\arabic{subsection}}
\renewcommand{\thepage}{S-\arabic{page}}
\section{Chap3Sec1}
\clearpage
\section{Chap3Sec2}
\bigskip
\startcontents
\printcontents{}{2}{\addtocontents{ptc}{\setcounter{tocdepth}{2}}}
\lipsum[1-2]
\subsection{Chap3Sec2Subsec1}\clearpage
\subsection{Chap3Sec2Subsec2}\clearpage
\subsection{Chap3Sec2Subsec3}\lipsum[1]
\subsection{Chap3Sec2Subsec4}
\stopcontents
\section{Chap3Sec3}\clearpage
\section{Chap3Sec4}\clearpage
\section{Chap3Sec5}\clearpage
\section{Chap3Sec6}\clearpage
\section{Chap3Sec7}\clearpage
\renewcommand{\thepage}{A-\arabic{page}}
\setcounter{page}{9}
\chapter{Chap4}
\settocdepth{subsection}
\section{Chap4Sec1}\clearpage
\section{Chap4Sec2}\clearpage
\subsection{Chap4Sec2Subsec1}

\end{document}

答案1

您正在将\parskip长度更改为 12pt,似乎与正常目录相反,部分目录会受到影响。解决方法:问题

\addtocontents{toc}{\protect\setlength{\parskip}{0pt}}

在文档主体的开头。此外,您可能希望\bigskip在部分目录的开头之前添加一些垂直空间(例如)。

编辑:在你的第二个 MWE 中,你(无论出于什么原因)从 切换\DoubleSpacing\SingleSpacing文档中间,并且两个都设置会影响目录和部分目录。我建议将其添加\protect\OnehalfSpacing.toc文件中。

\documentclass{memoir}
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}
\linespread{1.3}
\usepackage{titletoc}
\usepackage{lipsum}
\setpnumwidth{2.5em}
\setrmarg{3.5em}
\begin{document}
\addtocontents{toc}{\protect\setlength{\parskip}{0pt}\protect\OnehalfSpacing}
\frontmatter
\tableofcontents*
\setsecnumdepth{subsection}
\maxsecnumdepth{subsection}
\settocdepth{subsection} 
\mainmatter
\DoubleSpacing   
\chapter{Chap1}
\section{Chap1Sec1}
\section{Chap1Sec2}
\chapter{Chap2}
\section{Chap2Sec1}
\section{Chap2Sec2}
\subsection{Chap2Sec2Subsec1}
\SingleSpacing
\chapter{Chap3}
\settocdepth{section}
\renewcommand{\thesection}{\thechapter-\Roman{section}}
\renewcommand{\thesubsection}{\thechapter-\Roman{section}.\arabic{subsection}}
\renewcommand{\thepage}{S-\arabic{page}}
\section{Chap3Sec1}
\clearpage
\section{Chap3Sec2}
\bigskip
\startcontents
\printcontents{}{2}{\addtocontents{ptc}{\setcounter{tocdepth}{2}}}
\lipsum[1-2]
\subsection{Chap3Sec2Subsec1}\clearpage
\subsection{Chap3Sec2Subsec2}\clearpage
\subsection{Chap3Sec2Subsec3}\lipsum[1]
\subsection{Chap3Sec2Subsec4}
\stopcontents
\section{Chap3Sec3}\clearpage
\section{Chap3Sec4}\clearpage
\section{Chap3Sec5}\clearpage
\section{Chap3Sec6}\clearpage
\section{Chap3Sec7}\clearpage
\renewcommand{\thepage}{A-\arabic{page}}
\setcounter{page}{9}
\chapter{Chap4}
\settocdepth{subsection}
\section{Chap4Sec1}\clearpage
\section{Chap4Sec2}\clearpage
\subsection{Chap4Sec2Subsec1}

\end{document}

相关内容