私は、次のような投稿や質問をいくつか見つけました。取り除く垂直方向の間隔は図のリストに自動的に追加されますが、私の問題は(まったく)逆です。
scrartcl
最高レベルの区切りとしてセクションを含むドキュメント クラスを使用しています。図のリストでは、異なるセクションの図の間に区切りがありません。
このような視覚的な分離を追加するにはどうすればよいでしょうか?
次の最小限の動作例と出力を参照してください。
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{amsmath}
\numberwithin{figure}{section}
\begin{document}
\listoffigures
\section{Section}
\begin{figure}[ht]\caption{Figure}\end{figure}
\begin{figure}[ht]\caption{Figure}\end{figure}
\section{Section}
\begin{figure}[ht]\caption{Figure}\end{figure}
\end{document}
答え1
コマンドにパッチを適用する必要があります\@startsection
。パッチを適用する\section
ことも可能ですが、 にもスペース コマンドが追加されます\section*
。大した問題ではありませんが、回避できるのであれば、その方がよいでしょう。
\documentclass[11pt,a4paper]{scrartcl}
\usepackage{amsmath}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@startsection}
{\@dblarg}
{\artemis@space@loft{#2}\@dblarg}
{}{}
\newcommand{\artemis@space@loft}[1]{%
\ifnum#1=\sectionnumdepth
\doforeachtocfile[float]{%
\addtocontents{\@currext}{\protect\addvspace{\@sectionlistsgap}}%
}%
\fi
}
\newcommand{\@sectionlistsgap}{5pt} % <-- change here the desired gap
\makeatother
\numberwithin{figure}{section}
\begin{document}
\listoffigures
\section{Section}
\begin{figure}[ht]\caption{Figure}\end{figure}
\begin{figure}[ht]\caption{Figure}\end{figure}
\section{Section}
\subsection{SUB}
\begin{figure}[ht]\caption{Figure}\end{figure}
\end{document}
説明:はがない\@dblarg
場合にのみ実行されます。そのため、TeX が を実行する前に を追加します。これは、およびファイルに垂直スペース注釈を追加します。これは、 クラスが に対して行うのと同じです(ここでは 10pt が使用されていますが、記事ではより小さなスペースの方が適切と思われます)。これは、 によって提案された手法を使用します。\section
*
\artemis@space@loft
.lof
.lot
book
\chapter
ヨハネスBこれは Koma-Script の機能を活用します。この方法では、新しく定義された float 型も同様に処理されます。
#2
へのパラメータは\@startsection
セクション レベルなので、 と同じであることを確認します\sectionnumdepth
。 の場合、の本文ではの代わりにarticle
を使用する必要があります。\@ne
\sectionnumdepth
\artemis@space@loft
\subsection
セクションに対してのみスペースが追加されていることを確認するために追加しました(実際に追加されています)。
KoMaScript バージョン 3.14 の重要な更新
新しくリリースされた KoMaScript クラスとパッケージのバージョン 3.14 がインストールされている場合、上記のパッチは機能しなくなります。
このバージョンでは変更が必要です
\patchcmd{\@startsection}
{\@dblarg}
{\artemis@space@loft{#2}\@dblarg}
{}{}
の中へ
\patchcmd{\scr@startsection}
{\scr@section@dblarg}
{\artemis@space@loft{#2}\scr@section@dblarg}
{}{}
これに早く気づいてくれた Johannes_B に感謝します (新しいバージョンは 2014 年 12 月 8 日に TeX Live にアップロードされました)。
片方がまだKoMaScriptを更新していないときに、両方のパッチが協力ジョブに必要な場合は、
\makeatletter
\ifdefined\scr@startsection
\patchcmd{\scr@startsection}
{\scr@section@dblarg}
{\artemis@space@loft{#2}\scr@section@dblarg}
{}{}
\else
\patchcmd{\@startsection}
{\@dblarg}
{\artemis@space@loft{#2}\@dblarg}
{}{}
\fi
\newcommand{\artemis@space@loft}[1]{%
...
すべきです。