I'm facing a problem with KOMA-Script and algorithm2e
: algorithm captions in the list of algorithms collide with the numbers preceding them. See the image for an impression. How would I go about fixing this?
-
1Related/duplicate: KOMA-Script scrbook: width of chapter and section number or Extra space for numbered titles in table of contents– Werner ♦Commented Aug 27, 2013 at 19:04
Add a comment
|
1 Answer
To typeset the entries in the list of algorithms, algorithm2e
uses
\renewcommand*\l@algocf{\@dottedtocline{1}{1em}{2.3em}}
To add some extra spacing between the number and the title, you can redefine \l@algocg
and use a greater value for the third argument:
\documentclass{scrbook}
\usepackage{algorithm2e}
\usepackage{chngcntr}% for the example
\counterwithin{algocf}{section}% for the example I assumed you subordinate algorithm counter to that of the sections
\makeatletter
\renewcommand*\l@algocf{\@dottedtocline{1}{1em}{3.2em}}% Original {1}{1em}{2.3em}
\makeatother
\begin{document}
\listofalgorithms
\setcounter{chapter}{5}% just for the example
\chapter{Test chapter}
\setcounter{section}{1}% just for the example
\section{Test section}
\setcounter{algocf}{13}% just for the example
\begin{algorithm}[H]
A
\caption{Test algorithm}
\end{algorithm}
\end{document}