¿Cómo controlar el espaciado en toc para diferentes secciones?

¿Cómo controlar el espaciado en toc para diferentes secciones?

Necesito tener un TOC que tenga doble espacio entre los títulos de los capítulos pero un solo espacio entre las secciones y subsecciones. Sé que hay varias preguntas relacionadas con este tema, pero la diferencia es que cuando se usan algunas de las soluciones sugeridas como \setlength{\cftbeforesecskip}{-2pt} o \renewcommand\cftchapafterpnum{\vspace{}}que cambia el espacio antes o después de la sección o subsección, y si el título en cuestión tiene una sola línea, está bien. , pero si se trata de un título largo de tres líneas de una sección, entonces el espacio es muy irregular, con el espacio deseado encima del título de la sección, y luego lo que parece ser medio espacio y nuevamente un espacio simple después del número de página.
Otra solución que he probado es usar algo como dentro del texto real, \section[\singlespacing{\noindent Long title}]{Long title}pero luego, aunque obtengo líneas con espacio simple en el TOC, también obtengo un espacio vertical no deseado entre el número de sección y el comienzo del título de la sección. ¿Hay alguna forma de cambiar uniformemente el espaciado en el TOC mediante secciones jerárquicas o evitar el espacio vertical adicional en mi segundo enfoque? Además, vale la pena mencionar que estoy cargando el setspacepaquete y usándolo \onehalfspacingen el preámbulo de mi documento, ya que el cuerpo principal debe estar a medio espacio. Muchas gracias, así es como se ve lo que tengo:

\documentclass[12pt,reqno]{report}
\usepackage[titles]{tocloft}
\setlength{\cftbeforesecskip}{-2.5pt}
\setlength{\cftbeforesubsecskip}{-2.5pt}
\usepackage{setspace}
\onehalfspacing
\usepackage{blindtext}
\begin{document}
\tableofcontents
\newpage
\chapter{this is a really really long title that someone else wrote for all the penguins in the world}
\section{this is a really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really long title having more than three lines of text to appear on the toc.}
\subsection{this is a really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really long title having more than three lines of text to appear on the toc.}
\blinddocument
\blinddocument
\blinddocument
\blinddocument
\end{document}

En este MWE muestro una de las opciones que probé. Espero que alguien pueda comentar sobre esto. Gracias.

Respuesta1

Puede conectarse \cftchapafterpnumpara agregar algo de espacio vertical después del título de un capítulo en la tabla de contenido.

\documentclass[12pt,reqno]{report}
\usepackage[titles]{tocloft}
\usepackage{blindtext}

\renewcommand{\cftchapafterpnum}{\vspace{\cftbeforechapskip}}

\begin{document}
\tableofcontents
\newpage
\chapter{this is a really really long title that someone else wrote for all the penguins in the world}
\section{this is a really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really long title having more than three lines of text to appear on the toc.}
\subsection{this is a really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really long title having more than three lines of text to appear on the toc.}
\blinddocument
\blinddocument
\blinddocument
\blinddocument
\end{document}

ingrese la descripción de la imagen aquí

Sin embargo, los títulos largos no tienen nada que ver con el problema; parece que estás cargando setspace, \onehalfspacingprobablemente para cumplir con requisitos tontos de tu institución (si no, simplemente usa el espaciado estándar, saldrás más feliz).

Simplemente emita \singlespacingal hacer la tabla de contenido.

\documentclass[12pt,reqno]{report}
\usepackage[titles]{tocloft}
\usepackage{setspace}
\usepackage{blindtext}

\renewcommand{\cftchapafterpnum}{\vspace{\cftbeforechapskip}}

\onehalfspacing

\begin{document}

\begingroup\singlespacing
\tableofcontents
\endgroup

\chapter{this is a really really long title that someone else wrote 
for all the penguins in the world}
\section{this is a really really really really really really really
really really long title having more than three lines of text to appear on the toc.}
\subsection{this is a really really really really really really really
really really really long title having more than three lines of text to appear on the toc.}

\blinddocument

\end{document}

ingrese la descripción de la imagen aquí

información relacionada