Como controlar o espaçamento no toc para diferentes seções?

Como controlar o espaçamento no toc para diferentes seções?

Preciso ter um sumário que tenha espaço duplo entre os títulos dos capítulos, mas espaço único entre seções e subseções. Eu sei que existem várias questões relacionadas sobre este assunto, mas a diferença é que ao usar algumas das soluções sugeridas como \setlength{\cftbeforesecskip}{-2pt} ou \renewcommand\cftchapafterpnum{\vspace{}}que altera o espaçamento antes ou depois da seção ou subseção, e se o título em questão tiver uma linha, tudo bem , mas se for um título longo de três linhas de uma seção, ele fornecerá um espaçamento muito irregular, com o espaço desejado acima do título da seção e, em seguida, o que parece ser meio espaçamento e novamente espaçamento simples após o número da página.
Outra solução que tentei é usar algo como, no texto real, \section[\singlespacing{\noindent Long title}]{Long title}mas embora eu obtenha linhas com espaçamento simples no sumário, também recebo algum espaço vertical indesejado entre o número da seção e o início do título da seção. Existe alguma maneira de alterar uniformemente o espaçamento no TOC por seções hierárquicas ou evitar o espaço vertical extra na minha segunda abordagem? Além disso, vale ressaltar que estou carregando o setspacepacote e utilizando \onehalfspacingno preâmbulo do meu documento, já que o corpo principal dele deve estar com espaçamento meio. Muito obrigado, aqui está o que tenho:

\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}

Neste MWE mostro uma das opções que experimentei. Espero que alguém possa comentar sobre isso. Obrigado.

Responder1

Você pode \cftchapafterpnumadicionar algum espaço vertical após o título de um capítulo no índice analítico.

\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}

insira a descrição da imagem aqui

Contudo, títulos longos não têm nada a ver com o problema; você parece estar carregando setspace, \onehalfspacingprovavelmente para cumprir requisitos bobos de sua instituição (caso contrário, use apenas o espaçamento padrão, você sairá mais feliz).

Apenas emita \singlespacingao fazer o índice.

\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}

insira a descrição da imagem aqui

informação relacionada