Imita o layout ToC do livro de memórias na saída do titletoc

Imita o layout ToC do livro de memórias na saída do titletoc

Eu com a ajuda de uma resposta anterior aquiProfundidade de toc diferente para toc principal e toc na seção, eu fiz isso para que meu titletocseja capaz de conter subsectionsenquanto meu principal tocnão os possui. Porém, percebi que a formatação do titletoctoc possui espaçamento diferente.

Se eu mesmo tivesse definido o formato principal toc, copiaria os parâmetros para imitá-los no titletoctoc. Mas como é o formato padrão de memórias, não sei como replicá-lo.

Aqui está um 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}

Aqui está um segundo MWE mostrando a sugestão em etapas e agora o novo problema de espaçamento. Ele usa o DoubleSpacinge SingleSpacingtambém do memoirpacote

\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}

Responder1

Você está alterando o \parskipcomprimento para 12pt e parece que - ao contrário do ToC normal - o ToC parcial é afetado por isso. Solução alternativa: problema

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

no início do corpo do documento. Além disso, você pode querer adicionar algum espaço vertical (por exemplo, \bigskip) antes do início do ToC parcial.

EDIT: Em seu segundo MWE, você muda (por qualquer motivo) do \DoubleSpacingmeio \SingleSpacingdo documento eambosas configurações afetam o ToC resp. o ToC parcial. Sugiro adicionar, por exemplo, \protect\OnehalfSpacingao .tocarquivo.

\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}

informação relacionada