# Change Spacing Between Internal TOC numbering and subsection titles

In my Supporting Info chapter, I have my subsections defined as

\renewcommand{\thesubsection}{\thechapter-\Roman{section}.\arabic{subsection}}

Which is the format requested of me by my professor.

This makes my subsection numbering quite wide, once I'm at the 3rd section (because of the roman numerals). This is only a problem in my internal 2nd toc which I generate with the titletoc package. Following the answer here using:

\makeatletter
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.9em}}
\makeatother


I followed the same route to change the spacing betweeen the section number and the title in my toc, but found that it changes both the spacing between the section number and subsection title for both my main toc and my internal one.

I only want it to change the spacing for the 2nd, smaller toc within my chapter.

I using other tricks shown to me earlier such as adding the command to the toc with protect and addtocontents but was not successful.

Here is my MWE:

\documentclass{memoir}
\setlength{\parskip}{12pt plus2pt}
\def\baselinestretch{1.6}
\usepackage{titletoc}
\usepackage{lipsum}
\setpnumwidth{2.5em}
\setrmarg{3.5em}
\makeatletter
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.9em}}
\makeatother
\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
\renewcommand{\thepage}{A-\arabic{page}}
\setcounter{page}{9}
\chapter{Chap4}
\settocdepth{subsection}
\section{Chap4Sec1}\clearpage
\section{Chap4Sec2}\clearpage
\subsection{Chap4Sec2Subsec1}

\end{document}

-

I've inserted the redefinition of \l@subsection exactly where it's needed and inside a group. This makes the redefinition local, reverting back to what it was before after the group is closed:

%...
\section{Chap3Sec2}
\bigskip
\startcontents
\lipsum[1-2]

\makeatletter
\protect\begingroup%
\protect\makeatletter
\protect\def\protect\l@subsection{\protect\@dottedtocline{2}{4.0em}{3.9em}}
\protect\makeatother
}
\makeatother

\subsection{Chap3Sec2Subsec1}\clearpage
\subsection{Chap3Sec2Subsec2}\clearpage
\subsection{Chap3Sec2Subsec3}\lipsum[1]
\subsection{Chap3Sec2Subsec4}
\protect\endgroup%
}
%...


You still have the original subsection spacing in the main ToC:

Yet your mini-ToC in the Supporting Chapter has a much wider spacing:

Here's the original, now updated, MWE:

\documentclass{memoir}% http://ctan.org/pkg/memoir
\setlength{\parskip}{12pt plus2pt}
\usepackage{titletoc}% http://ctan.org/pkg/titletoc
\usepackage{lipsum}% http://ctan.org/pkg/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]

\makeatletter
\protect\begingroup%
\protect\makeatletter
\protect\def\protect\l@subsection{\protect\@dottedtocline{2}{4.0em}{3.9em}}
\protect\makeatother
}
\makeatother

\subsection{Chap3Sec2Subsec1}\clearpage
\subsection{Chap3Sec2Subsec2}\clearpage
\subsection{Chap3Sec2Subsec3}\lipsum[1]
\subsection{Chap3Sec2Subsec4}
\protect\endgroup%
}
\stopcontents
\section{Chap3Sec3}\clearpage
\section{Chap3Sec4}\clearpage
\section{Chap3Sec5}\clearpage
\section{Chap3Sec6}\clearpage
\renewcommand{\thepage}{A-\arabic{page}}
\setcounter{page}{9}
\chapter{Chap4}
\settocdepth{subsection}
\section{Chap4Sec1}\clearpage
\section{Chap4Sec2}\clearpage
\subsection{Chap4Sec2Subsec1}

\end{document}

-
Works great, thanks for such a quick response! –  J M Sep 3 '12 at 15:25