0

I would like to use a custom TOC declared by the \DeclareNewTOC command. Unfortunately the counter created with it does not resets itself upon the appendix.

While the counter within figure gets reset and the \Alph{<counter>} representation is being used. It does not get applied on the custom TOC which I declared.

I have already searched for solutions and read the koma documentation about the \DeclareNewTOC command but could not find anything. I found the tocentrystyle option key but couldn't make it to work. I mostly came across questions the other way around that they want to remove the reset etc.

A MWE:

\documentclass{scrbook}

\DeclareNewTOC[% type=listing, types=listings, float, name=Listing, listname={List of Listings} ]{lol}

\begin{document}

\frontmatter

\listoffigures \listoflistings

\mainmatter

\appendix

\chapter{Figures}

\begin{figure} \caption{Example figure} \end{figure}

\chapter{Listings}

\begin{listing} \caption{This is an example} \end{listing}

\backmatter

\end{document}

The output is

List of Figures

A.1 Example figure

List of Listings

1. This is an example

I would like to have:

List of Listings

B.1 This is an example

Edit (from the answer of gusbrs): using the option counterwithin=chapter inside the DeclareNewTOC or outside produces the correct numbering, however it does not update the padding between the number and the toc text as seen in this picture:

List of Listings in appendix


Edit 2: This answer: counterwithin problems with table of content Helped me to find the options:

tocentrynumwidth=2em,
tocentryindent=2em

But currently tocentryindent does not match the default indent of List of Figures.

Sens4
  • 207

1 Answers1

2

If the indent and the number width for listing entries should be the same as for figure entries, use options tocentryindent:=figure and tocentrynumwidth:=figure.

Example:

\documentclass{scrbook}

\DeclareNewTOC[% type=listing, types=listings, float, name=Listing, listname={List of Listings}, counterwithin=chapter,% <- added tocentryindent:=figure,% <- added tocentrynumwidth:=figure% <- added ]{lol}

\begin{document} \frontmatter \listoffigures \listoflistings \mainmatter \appendix \chapter{Figures} \begin{figure} \caption{Example figure} \end{figure} \chapter{Listings} \begin{listing} \caption{This is an example} \end{listing} \end{document}

enter image description here

esdd
  • 85,675