
指定されている通り§3.20. 表と図のフローティング環境128ページの平方KOMA スクリプトのドキュメント、オプションlistof=withchapterentry
を追加することができます
マークの章は、フローティング環境のエントリを目次にコピーして、フローティング環境のリストから始まります。
つまり、この章に属する図の上に章のタイトルを追加します。
List of Figure
Chapter 1
1.1 My first figure.......................13
1.2 My second figure......................17
Chapter 42
42.1 My last figure.......................210
質問:このscrbook
クラスを使用する際に、章のタイトルではなくパートのタイトルで同じ動作をエミュレートしたいと考えます。つまり、オプションを作成するということですlistof=withpartentry
。
(章のタイトルではなくパートのタイトルのみを表示する必要があります)
どうすればこれができるでしょうか?
いくつかの質問はすでにこの問題を扱っています(例:LoF と LoT の中に章がありますか?、titletoc を使用して図表リストに章を含めますか?ただし、これらは標準クラス ( ) を対象としています。この機能はすでに章に実装されているため、クラスbook
では「汚い」回避策を回避できると思います。scrbook
答え1
\addparttocentry
LOF と LOT の各パーツのエントリを取得するには、次のようにパッチを適用します。
\documentclass{scrbook}
\unsettoc{lof}{chapteratlist}% remove the chapter gap in LOF
\unsettoc{lot}{chapteratlist}% % remove the chapter gap in LOT
\usepackage{xpatch}
\xapptocmd\addparttocentry{%
\addxcontentsline{lof}{part}[{#1}]{#2}% copy the part entry to LOF
\addxcontentsline{lot}{part}[{#1}]{#2}% copy the part entry to LOT
}{}{\PatchFailed}
\begin{document}
\listoffigures
\part{Part One}
\chapter{Chapter One}
\captionof{figure}{My first figure}
\captionof{figure}{My second figure}
\chapter{Chapter Two}
\captionof{figure}{A figure in Chapter Two}
\part{Part Two}
\chapter{Chapter Three}
\captionof{figure}{My next figure}
\chapter{Chapter Four}
\addpart{Unnumbered Part}
\chapter{Chapter Five}
\captionof{figure}{My last figure}
\end{document}
または、パッケージによって制御されるすべてのリストでtocbasic
:
\documentclass[listof=ignorechapter]{scrbook}
\usepackage{xpatch}
\makeatletter
\xapptocmd\addparttocentry{%
\doforeachtocfile{%
\ifstr{\@currext}{toc}{}{%
\addxcontentsline{\@currext}{part}[{#1}]{#2}%
}%
}%
}{}{\PatchFailed}
\makeatother
\begin{document}
\listoffigures
\part{Part One}
\chapter{Chapter One}
\captionof{figure}{My first figure}
\captionof{figure}{My second figure}
\chapter{Chapter Two}
\captionof{figure}{A figure in Chapter Two}
\part{Part Two}
\chapter{Chapter Three}
\captionof{figure}{My next figure}
\chapter{Chapter Four}
\addpart{Unnumbered Part}
\chapter{Chapter Five}
\captionof{figure}{My last figure}
\end{document}
結果:
リスト内のパーツエントリに新しいスタイルを宣言することもできます。パーツエントリにページ番号がない例:
\documentclass[listof=ignorechapter]{scrbook}
\usepackage{xpatch}
\makeatletter
\xapptocmd\addparttocentry{%
\doforeachtocfile{%
\ifstr{\@currext}{toc}{}{%
\addxcontentsline{\@currext}{partatlists}[{#1}]{#2}%
}%
}%
}{}{\PatchFailed}
\DeclareTOCStyleEntry[
pagenumberbox=\@gobble,
level=-1,
indent=0pt,
numwidth=0pt,
dynnumwidth
]{part}{partatlists}
\makeatother
\begin{document}
\listoffigures
\part{Part One}
\chapter{Chapter One}
\captionof{figure}{My first figure}
\captionof{figure}{My second figure}
\chapter{Chapter Two}
\captionof{figure}{A figure in Chapter Two}
\part{Part Two}
\chapter{Chapter Three}
\captionof{figure}{My next figure}
\chapter{Chapter Four}
\addpart{Unnumbered Part}
\chapter{Chapter Five}
\captionof{figure}{My last figure}
\end{document}