
Conforme especificado em§3.20. Ambientes Flutuantes de Tabelas e Figurasna página 128 sq.Documentação do script KOMA, pode-se adicionar a opção listof=withchapterentry
de
O capítulo de marcas começa nas listas de ambientes flutuantes por meio de uma cópia de suas entradas no índice.
Ou seja, adiciona o título do capítulo acima das figuras pertencentes 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
Pergunta:Ao usar a scrbook
classe, o que gostaria de fazer é emular o mesmo comportamento, mas com títulos de partes, em vez de títulos de capítulos. Ou seja, para criar a listof=withpartentry
opção.
(Eu só preciso fazer aparecer os títulos das partes, não os dos capítulos)
Como eu poderia fazer isso?
Algumas perguntas já tratam desse assunto (por exemplo,Capítulos dentro de LoF e LoT?,Incluir capítulos na Lista de Figuras com titletoc?). No entanto, eles são destinados a classes padrão ( book
). Acho que soluções alternativas 'sujas' poderiam ser evitadas com a scrbook
classe, uma vez que o recurso já está implementado para os capítulos.
Responder1
Você poderia corrigir \addparttocentry
para obter uma entrada para cada parte em LOF e 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}
Ou em todas as listas controladas por package 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:
Também é possível declarar um novo estilo para as entradas de peças nas listas. Exemplo sem números de página para as entradas de peças:
\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}