
scrbook クラス (xelatex) とパッケージのリスト リストで予期しない動作がいくつか見られましたlistings
。LOF とリスト リストの章見出しと各リストの最初のエントリ間の間隔が同じではありません。リスト パッケージでは、MWE のように章見出しの外観をカスタマイズしなくても、はるかに大きなギャップが生じます。この問題の原因と解決方法をご存知の方はいらっしゃいますか? よろしくお願いします!
MWE:
\documentclass[
10pt,
oneside,
listof=totoc,
bibliography=totoc,
]{scrbook}
\usepackage{calc}
\usepackage{graphicx}
\usepackage{listings}
\setkomafont{chapter}{\Large\bfseries\MakeUppercase}
\renewcommand*{\chapterheadstartvskip}{\vspace*{-\topskip+2pt}}
\begin{document}
\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
コードのログ ファイルには 2 つの警告があります。
クラス scrbook 警告:
\float@listhead
検出されました! の実装は\float@listhead
KOMA-Script v3.01 2008/11/14 で非推奨となり、パッケージ のいくつかのより柔軟な機能に置き換えられましたtocbasic
。 の実装は\float@listhead
まもなく KOMA-Script から削除される可能性があります。入力行 18 でscrhack
非推奨のインターフェースをまだ実装しているパッケージを使用している場合は、パッケージ をロードすると、この警告を回避できる場合があります。\float@listhead
そして
クラス scrbook 警告:
\float@addtolists
検出されました! の実装は\float@addtolist
KOMA-Script v3.01 2008/11/14 で非推奨となり、パッケージ のいくつかのより柔軟な機能に置き換えられましたtocbasic
。バージョン 3.12 以降、非推奨の\float@addtolist
インターフェースのサポートは KOMA-Script 機能の一部に制限され、他の機能からは削除されました。scrhack
非推奨のインターフェースをまだ実装しているパッケージを使用している場合は、パッケージ をロードすると、この警告を回避できる場合があります\float@addtolist
。
scrhack
警告に従ってパッケージをロードします
\documentclass[
10pt,
oneside,
listof=totoc,
bibliography=totoc,
]{scrbook}
\usepackage{scrhack}% <- added
\usepackage{calc}
\usepackage{graphicx}
\usepackage{listings}
\setkomafont{chapter}{\Large}
\RedeclareSectionCommand[
beforeskip=\dimexpr-\topskip+2pt\relax,
afterindent=false
]{chapter}
\makeatletter
\renewcommand\chapterlinesformat[3]{%
\@hangfrom{#2}{\MakeUppercase{#3}}%
}
\makeatother
\begin{document}
\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}