Alterar o espaçamento entre a numeração interna do sumário e os títulos das subseções

Alterar o espaçamento entre a numeração interna do sumário e os títulos das subseções

Nas minhas informações de suporte chapter, tenho meu subsectionsdefinido como

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

Qual é o formato que meu professor me pediu.

Isso torna a numeração da minha subseção bastante ampla, uma vez que estou na 3ª seção (por causa dos algarismos romanos). Este é apenas um problema no meu segundo interno tocque gero com o titletocpacote. Seguindo a respostaaquiusando:

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

Segui o mesmo caminho para alterar o espaçamento entre o section numbere o titleno meu toc, mas descobri que isso altera o espaçamento entre o section numbere subsection titletanto para o meu principal tocquanto para o interno.

Quero apenas alterar o espaçamento para o 2º, menor tocdentro do meu capítulo.

Estou usando outros truques mostrados anteriormente, como adicionar o comando ao tocwith protecte addtocontentsmas não tive sucesso.

Aqui está meu MWE:

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

\end{document}

Responder1

Inseri a redefinição de \l@subsectionexatamente onde é necessário e dentro de um grupo. Isso torna a redefinição local, revertendo ao que era antes após o grupo ser fechado:

%...
\section{Chap3Sec2}
\bigskip
\startcontents
\printcontents{}{2}{\addtocontents{ptc}{\setcounter{tocdepth}{2}}}
\lipsum[1-2]

\makeatletter
\addtocontents{toc}{%
  \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}
\addtocontents{toc}{%
  \protect\endgroup%
}
%...

Você ainda tem o espaçamento original da subseção no ToC principal:

insira a descrição da imagem aqui

No entanto, o seu mini-ToC no Capítulo de Apoio tem um espaçamento muito maior:

insira a descrição da imagem aqui

Aqui está o MWE original, agora atualizado:

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

\makeatletter
\addtocontents{toc}{%
  \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}
\addtocontents{toc}{%
  \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}

informação relacionada