
En mi información de soporte chapter
, tengo mi subsections
definición como
\renewcommand{\thesubsection}{\thechapter-\Roman{section}.\arabic{subsection}}
Que es el formato que me pidió mi profesor.
Esto hace que la numeración de mi subsección sea bastante amplia, una vez que estoy en la tercera sección (debido a los números romanos). Esto es solo un problema en mi segundo interno toc
que genero con el titletoc
paquete. siguiendo la respuestaaquíusando:
\makeatletter
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.9em}}
\makeatother
Seguí la misma ruta para cambiar el espacio entre el section number
y el title
en mi toc
, pero descubrí que cambia tanto el espacio entre el section number
y subsection title
tanto para el principal toc
como para el interno.
Sólo quiero que cambie el espaciado del segundo, más pequeño toc
dentro de mi capítulo.
Utilicé otros trucos que me mostraron anteriormente, como agregar el comando toc
with protect
and addtocontents
but, pero no tuve éxito.
Aquí está mi 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}
Respuesta1
He insertado la redefinición \l@subsection
exactamente donde se necesita y dentro de un grupo. Esto hace que la redefinición sea local, volviendo a ser lo que era antes después de cerrar el grupo:
%...
\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%
}
%...
Todavía tienes el espaciado de subsección original en el ToC principal:
Sin embargo, su mini-ToC en el Capítulo de Apoyo tiene un espacio mucho más amplio:
Aquí está el MWE original, ahora actualizado:
\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}