
質問に基づいてKOMA スクリプトのリストと LOF の見出しの下には不均等なスペースがあります例を TOC で拡張しました。ドキュメントでは etoc パッケージを使用しており、KOMA オプションによってparskip=half
TOC 章タイトルと TOC エントリ間の垂直間隔が変更されます。LOF、LOF などの間隔は同じままです。この非互換性を回避するにはどうすればよいでしょうか? 画像で問題が説明されているはずです。どうぞよろしくお願いいたします。
編集: xelatexでコンパイルします
MWE:
\documentclass[
10pt,
oneside,
listof=totoc,
bibliography=totoc,
]{scrbook}
\usepackage{scrhack}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{etoc}
\onehalfspacing
\KOMAoptions{parskip=half}
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\lstlistoflistings
\chapter{A Chapter}
\begin{figure}
\centering\includegraphics[width=0.5\linewidth]{example-image}
\caption{First figure}
\end{figure}
\begin{table}
\caption{First table}
\centering
\begin{tabular}[width=0.5\linewidth]{ccc}
Cell 1 & Cell 2 & Cell 3
\end{tabular}
\end{table}
\begin{lstlisting}[caption={First listing}]
Some code
\end{lstlisting}
\end{document}
答え1
(lof, lot, lol)の制御下にあるリストでは、段落間隔をオフにする前にtocbasic
末尾が挿入されます。この挿入は次のように無効にできます。\parskip
\doforeachtocfile{\setuptoc{#1}{noparskipfake}}
ただし、リストの見出しと最初のエントリの間の垂直方向のスペースは、通常の章の見出しと通常のテキストの間のスペースよりも小さくなります。
\parskip
したがって、段落の間隔がオフになる前に、 の制御下にある目次 (toc) にこの final を追加する方がよいでしょうetoc
。 は\etocscrbookstyle
これを考慮しません。ただし、これに関連するコード( からコピー)を追加する\parskip
パッチを適用できます。\etocscrbookstyle
\parskip
tocbasic
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\etocscrbookstyle}
{\setlength {\parskip }{\z@ }}
{%
\etoc@Iftocfeature{\@currext}{noparskipfake}{}{%
\ifvmode
\@tempskipa\lastskip
\vskip-\lastskip
\addtolength{\@tempskipa}{\parskip}%
\vskip\@tempskipa
\fi
}%
\setlength {\parskip }{\z@ }%
}{}{\PatchFailed}
\makeatother
\etocstandarddisplaystyle
例:
\documentclass[
10pt,
oneside,
listof=totoc,
bibliography=totoc,
]{scrbook}
\usepackage{scrhack}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{etoc}
\onehalfspacing
\KOMAoptions{parskip=half}
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\etocscrbookstyle}
{\setlength {\parskip }{\z@ }}
{%
\etoc@Iftocfeature{\@currext}{noparskipfake}{}{%
\ifvmode
\@tempskipa\lastskip
\vskip-\lastskip
\addtolength{\@tempskipa}{\parskip}%
\vskip\@tempskipa
\fi
}%
\setlength {\parskip }{\z@ }%
}{}{\PatchFailed}
\makeatother
\etocstandarddisplaystyle
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\lstlistoflistings
\chapter{A Chapter}
Some text
\begin{figure}
\centering\includegraphics[width=0.5\linewidth]{example-image}
\caption{First figure}
\end{figure}
\begin{table}
\caption{First table}
\centering
\begin{tabular}[width=0.5\linewidth]{ccc}
Cell 1 & Cell 2 & Cell 3
\end{tabular}
\end{table}
\begin{lstlisting}[caption={First listing}]
Some code
\end{lstlisting}
\end{document}