KOMA-Script LoF/LoT에 부품 제목 추가

KOMA-Script LoF/LoT에 부품 제목 추가

에 지정된대로§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하고 싶은 것은 장 1 대신에 부분 제목을 사용하여 동일한 동작을 에뮬레이트하는 것입니다. 즉, 일종의 listof=withpartentry옵션을 생성하는 것입니다.
(챕터 제목이 아닌 부분 제목만 표시되도록 하면 됩니다.)

어떻게 해야 합니까?


일부 질문은 이미 이 문제를 다루고 있습니다(예:LoF와 LoT 내부의 챕터?,titletoc을 사용하여 그림 목록에 장을 포함하시겠습니까?). 그러나 이는 표준 클래스( book)를 위한 것입니다. 내 생각에는 scrbook이 기능이 이미 각 장에 구현되어 있으므로 클래스 에서는 '더러운' 해결 방법을 피할 수 있을 것 같습니다 .

답변1

\addparttocentryLOF 및 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}

여기에 이미지 설명을 입력하세요

관련 정보