LOF 内の図を章ごとにグループ化します (章番号は付けますが、ページ番号は付けません)

LOF 内の図を章ごとにグループ化します (章番号は付けますが、ページ番号は付けません)

解決できない問題があります:

私の図表リストは、各章の図表の間にスペースを入れて章ごとにまとめられています。しかし、私が欲しいのは、スペースだけでなく、章の番号とタイトルを示す章見出しも必要です。ない章のページ。

これを実行する方法はありますか? できれば、tocloft何らかの理由で TOC と LOF の上部に大きなスペースが追加され、それを削除できないパッケージを使用しない方法が望ましいです。また、パッケージを含めると、LOF が TOC に表示されません。

何か案は?

編集: これが最小限の例に該当するかどうかはわかりませんが、これは問題を示すための私の例です。

\documentclass[12pt,headsepline,toc=bibliography,toc=listof]{scrreprt}

\begin{document}
\chapter{Chapter 1}
\begin{figure}
\caption{Figure 1}
\end{figure}
\begin{figure}
\caption{Figure 2}
\end{figure}

\chapter{Chapter 2}
\begin{figure}
\caption{Figure 3}
\end{figure}

\listoffigures

\end{document}

次の結果が生成されます。 ここに画像の説明を入力してください 図は、間にスペースを挟んで章ごとにグループ分けしてリストされていることがわかります。各グループの上に「(章番号) (スペース) (章タイトル)」と表示し、その横にページ番号は表示しないようにします (ただし、図の横のページ番号は表示される必要があります)。(スペース) とは、章タイトルの最初の文字が、リストされている図の番号とまったく同じ余白から始まるように、十分なスペースを意味します。

答え1

すべてのリストにすべての章を挿入するKOMAオプションがあります: chapteratlists=entry(またはchapteratlistsまたはlistof=chapterentry)

図表一覧 (lof) に章のページ番号を表示しない場合は、 を使用できます\AfterTOCHead[lof]{\addtokomafont{chapterentrypagenumber}{\nullfont}}

ここに画像の説明を入力してください

コード:

\documentclass[12pt,headsepline,toc=bibliography,toc=listof,chapteratlists=entry]{scrreprt}

\AfterTOCHead[lof]{\addtokomafont{chapterentrypagenumber}{\nullfont}}

\begin{document}
\chapter{Chapter 1}
\begin{figure}
\caption{Figure 1}
\end{figure}
\begin{figure}
\caption{Figure 2}
\end{figure}

\chapter{Chapter 2}
\begin{figure}
\caption{Figure 3}
\end{figure}

\listoffigures
\tableofcontents

\end{document}

アップデート

私は見つけたMarkus Kohm の提案この章に少なくとも 1 つの図 (表など) がある場合、図 (表など) のリストにのみ章を挿入します。

\documentclass[12pt,headsepline,toc=bibliography,toc=listof,chapteratlists=entry]{scrreprt}

\AfterTOCHead[lof]{\addtokomafont{chapterentrypagenumber}{\nullfont}}
\AfterTOCHead[lot]{\addtokomafont{chapterentrypagenumber}{\nullfont}}

%%%%% from http://www.komascript.de/comment/5070#comment-5070 (Markus Kohm)
\makeatletter
\let\chapterhas@original@addcontentsline\addcontentsline
\renewcommand*{\addcontentsline}[1]{%
  \immediate\write\@auxout{\string\chapterhas{\thechapter}{#1}}%
  \chapterhas@original@addcontentsline{#1}%
}
\newcommand*{\chapterhas}[2]{%
  \global\@namedef{chapterhas@#1@#2}{true}%
}
\renewcommand*{\addchaptertocentry}[2]{%
  \addtocentrydefault{chapter}{#1}{#2}%
  \if@chaptertolists
    \doforeachtocfile{%
      \iftocfeature{\@currext}{chapteratlist}{%
        \ifundefinedorrelax{chapterhas@\thechapter @\@currext}{%
        }{%
          \addxcontentsline{\@currext}{chapteratlist}[{#1}]{#2}%
        }%
      }{}%
    }%
    \@ifundefined{float@addtolists}{}{\scr@float@addtolists@warning}%
  \fi
}
\makeatother
%%%%

\begin{document}
\chapter{Chapter 1}
\begin{figure}
\caption{Figure 1}
\end{figure}
\begin{figure}
\caption{Figure 2}
\end{figure}

\chapter{Chapter 2}

\chapter{Chapter 3}
\begin{figure}
\caption{Figure 3}
\end{figure}
\begin{table}
\caption{Table 1}
\end{table}

\listoffigures
\listoftables
\tableofcontents

\end{document}

3回走って

ここに画像の説明を入力してください

関連情報