3

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?

enter image description here

2

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}

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.