KoMaScript バージョン 3.14 の重要な更新

KoMaScript バージョン 3.14 の重要な更新

私は、次のような投稿や質問をいくつか見つけました。取り除く垂直方向の間隔は図のリストに自動的に追加されますが、私の問題は(まったく)逆です。

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}

mweの出力

答え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.lotbook\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]{%
...

すべきです。

関連情報