4

I use the \DeclareNewTOC command from the KOMA classes because it automatically produces hanging indents for the caption, same as the builtin floating environments like figure. However, unlike figure, the number of my newly defined float does not include the chapter number. The level option that is mentioned in the KOMA manual does not seem to do anything.

How can I fix it to show e.g. 1.1? Alternative solutions that produce the same result are also welcome.

Wrong numbering

\documentclass[paper=A6]{scrreprt}
\DeclareNewTOC[
    float, type=floatlisting, types=floatlistings,
    %level=2, % Doesn't do anything
    name=Listing, listname={List of Listings}
]{lol}

\begin{document}
\chapter{Topic}
\begin{floatlisting}[h]
Foo
\caption{Some really long caption that leads to a line break.}
\end{floatlisting}
\begin{figure}[h]
Foo
\caption{Some really long caption that leads to a line break.}
\end{figure}
\end{document}
2
6

Use the option counterwithin=chapter.

\documentclass[paper=A6]{scrreprt}
\DeclareNewTOC[
    float, type=floatlisting, types=floatlistings,
    counterwithin=chapter,%<-%%%%%%%%%%%%%%%%%%%%
    name=Listing, listname={List of Listings}
]{lol}

\begin{document}
\chapter{Topic}
\begin{floatlisting}[h]
    Foo
    \caption{Some really long caption that leads to a
    line break.}
\end{floatlisting}
\begin{figure}[h]
    Foo
    \caption{Some really long caption that leads to a
    line break.}
\end{figure}
\end{document} 
3
  • Thanks. I don't really know how I did miss that in the manual... -.-
    – Fritz
    Sep 9 '14 at 16:29
  • 1
    Of by the way, the key is called counterwithin, not counterwith. I see that it is correct in the code but not in the opening text.
    – Fritz
    Sep 9 '14 at 16:30
  • @Fritz I was in a hurry, thanks for fixing this.
    – Johannes_B
    Sep 9 '14 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.