Agregar título de pieza en KOMA-Script LoF/LoT

Agregar título de pieza en KOMA-Script LoF/LoT

Como se especifica en§3.20. Entornos flotantes de tablas y figurasen la página 128 m2 deDocumentación de KOMA-Script, se puede agregar la opción listof=withchapterentrya

El capítulo de marcas comienza en las listas de entornos flotantes mediante una copia de sus entradas en la tabla de contenido.

Es decir, añade el título del capítulo encima de las figuras pertenecientes a este capítulo:

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

Pregunta:Mientras uso la scrbookclase, lo que me gustaría hacer es emular el mismo comportamiento pero con títulos de partes, en lugar de capítulos. Es decir, para crear la listof=withpartentryopción.
(Solo necesito que aparezcan los títulos de las partes, no los de los capítulos)

¿Cómo podría hacer esto?


Algunas preguntas ya abordan este tema (p. ej.,¿Capítulos dentro de LoF y LoT?,¿Incluir capítulos en Lista de figuras con título?). Sin embargo, están destinados a clases estándar ( book). Creo que se podrían evitar soluciones alternativas "sucias" con la scrbookclase, ya que la función ya está implementada para los capítulos.

Respuesta1

Podrías parchear \addparttocentrypara obtener una entrada para cada parte en LOF y 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}

O en todas las listas controladas por paquete 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}

Resultado:

ingrese la descripción de la imagen aquí


También es posible declarar un nuevo estilo para las entradas de piezas en las listas. Ejemplo sin números de página para las entradas de piezas:

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

ingrese la descripción de la imagen aquí

información relacionada