4

I defined a custom float and I want to print its list at the beginning of my document. However, the spacing before and after the float number (in the list) is different from the one for "regular" floats such as figure, and it is too small. This is more evident when there are more than 10 chapters, because the float number overlaps with the caption.

Why is the spacing different, and how do I set it uniformly?

This is a small MWE:

enter image description here

\documentclass[oneside]{scrbook}

\DeclareNewTOC[%
    type=myfloat,
    float,
    floatpos=tbph,
    counterwithin=chapter,
    name=Custom,
    listname={List of Custom Floats}
]{listofmyfloats}
\setuptoc{listofmyfloats}{chapteratlist}

\begin{document}

\clearpage\listoffigures
\clearpage\listofmyfloats

\chapter{First Chapter}

\begin{figure}
\caption{A figure}
\end{figure}

\begin{myfloat}
\caption{A custom float}
\end{myfloat}


\chapter{Second Chapter}
\chapter{Third Chapter}
\chapter{Fourth Chapter}
\chapter{Fifth Chapter}
\chapter{Sixth Chapter}
\chapter{Seventh Chapter}
\chapter{Eight Chapter}
\chapter{Ninth Chapter}


\chapter{Tenth Chapter}

\begin{figure}
\caption{Another figure}
\end{figure}

\begin{myfloat}
\caption{Another custom float}
\end{myfloat}

\end{document}
5

You could use

\makeatletter
\let\l@myfloat\l@figure
\makeatother

or add

tocentryindent=1.5em,% default is 1em, figure uses 1.5em
tocentrynumwidth=2.3em% default is 1.5em, figure uses 2.3em

to the options of \DeclareNewTOC (see the documentation).

Example:

\documentclass[oneside]{scrbook}

\DeclareNewTOC[%
    type=myfloat,
    float,
    floatpos=tbph,
    counterwithin=chapter,
    name=Custom,
    listname={List of Custom Floats},
    tocentryindent=1.5em,% <- added
    tocentrynumwidth=2.3em% <- added
]{listofmyfloats}
\setuptoc{listofmyfloats}{chapteratlist}

\begin{document}
\listoffigures
\listofmyfloats
\chapter{First Chapter}
\begin{figure}
\caption{A figure}
\end{figure}

\begin{myfloat}
\caption{A custom float}
\end{myfloat}

\chapter{Second Chapter}
\chapter{Third Chapter}
\chapter{Fourth Chapter}
\chapter{Fifth Chapter}
\chapter{Sixth Chapter}
\chapter{Seventh Chapter}
\chapter{Eight Chapter}
\chapter{Ninth Chapter}

\chapter{Tenth Chapter}
\begin{figure}
\caption{Another figure}
\end{figure}
\begin{myfloat}
\caption{Another custom float}
\end{myfloat}
\end{document}

enter image description here

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.