さまざまなセクションの目次の間隔を制御するにはどうすればよいでしょうか?

さまざまなセクションの目次の間隔を制御するにはどうすればよいでしょうか?

章のタイトル間にダブルスペース、セクションとサブセクション間にシングルスペースがある目次が必要です。この件については関連する質問がいくつかあることは承知していますが、違いは、またはなどの提案されたソリューションを使用すると、\setlength{\cftbeforesecskip}{-2pt} セクション\renewcommand\cftchapafterpnum{\vspace{}}またはサブセクションの前後のスペースが変更されることです。問題のタイトルが1行の場合は問題ありませんが、セクションのタイトルが3行に及ぶ場合は、セクションのタイトルの上に必要なスペースがあり、その後に半分のスペースのように見え、ページ番号の後には再びシングルスペースになるという、非常に不規則なスペースになります。
私が試した別の解決策は、実際のテキスト内で次のようなものを使用することです\section[\singlespacing{\noindent Long title}]{Long title}が、その場合、目次にシングルスペースの行が作成されますが、セクション番号とセクションタイトルの先頭の間に不要な垂直スペースも作成されます。階層化されたセクションごとに目次のスペースを均一に変更する方法や、2番目のアプローチで余分な垂直スペースを回避する方法はありますか? また、パッケージをロードしてドキュメントのプリアンブルでsetspace使用していることも言及する価値があります\onehalfspacing。ドキュメントの本体は半分のスペースにする必要があるためです。どうもありがとうございます。私が持っているものは以下のとおりです。

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

この MWE では、私が試したオプションの 1 つを示します。誰かがこれについてコメントしてくれることを願っています。ありがとうございます。

答え1

\cftchapafterpnum目次の章タイトルの後に垂直方向のスペースを追加するために、これをフックすることができます。

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

ここに画像の説明を入力してください

ただし、長いタイトルは問題とは何の関係もありません。 を読み込んでいるようですが、これはsetspaceおそらく\onehalfspacing、所属機関のばかげた要件に準拠するためでしょう (そうでない場合は、標準のスペースを使用するだけで、満足して去ることができます)。

\singlespacing目次を作成するときに発行します。

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

ここに画像の説明を入力してください

関連情報