# Mimic memoir ToC layout in titletoc output

I with the help of a previous answer on here Different tocdepth for main toc and in-section toc, I have made it so my titletoc is able to contain subsections while my main toc does not have them. However, I noticed that the formatting for the titletoc toc has different spacing.

If I had set the main toc format myself, I would copy the parameters to mimic them for the titletoc toc. But since it is the default memoir format, I'm not sure how to replicate it.

Here is a MWE

\documentclass{memoir}
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}
\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
\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}


Here is a 2nd MWE showing the suggestion by lockstep, and now the new spacing issue. It uses the DoubleSpacing and SingleSpacing use as well from the memoir package

\documentclass{memoir}
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}
\usepackage{titletoc}
\usepackage{lipsum}
\setpnumwidth{2.5em}
\setrmarg{3.5em}
\begin{document}
\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
\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}

-

You are changing the \parskip length to 12pt, and it seems that -- contrary to the normal ToC -- the partial ToC is affected hereby. Workaround: Issue

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


at the start of the document body. Additonally, you might want to add some vertical space (e.g., \bigskip) before the start of the partial ToC.

EDIT: In your second MWE, you switch (for whatever reason) from \DoubleSpacing to \SingleSpacing mid-document, and both settings affect the ToC resp. the partial ToC. I suggest to add, e.g., \protect\OnehalfSpacing to the .toc file.

\documentclass{memoir}
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}
\usepackage{titletoc}
\usepackage{lipsum}
\setpnumwidth{2.5em}
\setrmarg{3.5em}
\begin{document}
\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
\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}

-
Now it appears that the space is too small compared to the normal TOC –  J M Aug 31 '12 at 16:01
@JM Which space in the normal ToC do you refer to? –  lockstep Aug 31 '12 at 16:03
Hmmm, I'm sorry it seems in the MWE it is correct, however in my full document, the skip between lines of the partial TOC are now very compressed compared to the rest of my document. In the memoir package I am using the \SingleSpacing command, and am wondering if that is affecting the output. I've updated my original post to show how I pull together the sections of my document. I'm trying compiling it with the doublespacing and singlespacing components commented out –  J M Aug 31 '12 at 16:31
@JM You need to provide a compilable example (i.e., one that doesn't \input files not available to others) that shows the problematic behaviour. –  lockstep Aug 31 '12 at 16:39
I understand, I'll try and work on getting one available to you shortly. I did just compile my work, removing the two commands DoubleSpacing and SingleSpacing, and the spacing in the two TOCs are the same. So I am quite sure that it is how memoir is implementing me using the SingleSpacing command. I'll try and get the example up soon –  J M Aug 31 '12 at 16:47