# How to remove the tab from the listofalgorithms (ToA)

How can I remove the tab from the \listofalgorithms so that it always starts without indent?

\documentclass[12pt,a4paper,twoside]{book}
\usepackage{algorithm}
\usepackage{algorithmic}

\begin{document}
\frontmatter
\pagestyle{plain}\listofalgorithms         % print LOA

\mainmatter
\chapter{Chapter}

\section{Algorithm section}

\begin{algorithm*}[t!]
\caption{Name of Algorithm}
\begin{algorithmic}[1]
\item{test}
\end{algorithmic}
\end{algorithm*}

\end{document}

• Provide a working document please – user31729 Mar 19 '16 at 15:29
• @ChristianHupfer you can check it out – Kostas Mar 19 '16 at 16:55
• If the example would be compilable I would check it out – user31729 Mar 19 '16 at 17:10
• @ChristianHupfer now it does compile. Forgot to include a package – Kostas Mar 19 '16 at 17:16
• No, it does not compile. algorithmic environment seems to be unknown – user31729 Mar 19 '16 at 17:19

You have to override the way the ToC-entry is set by forcing a 0pt indent. The default is 1.5em, which is set as part of the macro \listofalgorithms (since algorithm uses the float package):

\documentclass{book}

\usepackage{algorithm,algorithmic}

\begin{document}

\frontmatter
\pagestyle{plain}
\begingroup
\makeatletter
\let\old@dottedtocline\@dottedtocline
\renewcommand{\@dottedtocline}[5]{\old@dottedtocline{#1}{0pt}{#3}{#4}{#5}}
\listofalgorithms
\endgroup

\mainmatter
\chapter{Chapter}

\section{Algorithm section}

\begin{algorithm}[ht]
\caption{Name of Algorithm}
\begin{algorithmic}[1]
\STATE test
\end{algorithmic}
\end{algorithm}

\end{document}


In principle, each algorithm entry is set in the ToC using \l@algorithm which, based on float.sty, is defined as

\@dottedtocline{1}{1.5em}{2.3em}


While \@dottedtocline actually takes 5 arguments, the first three are set by default to the above choices. The second argument - 1.5em sets the indentation of each entry, which I've forced to be 0pt within a group in the above code.

• But this creates a bigger indentation between the numbering and the text compare to the list of figures or tables. How to make it the same? and also increase the number of dots? – Kostas Mar 19 '16 at 20:45
• @Kostas: I get exactly the same space for all three (see this image). If you're not getting this, then you must be doing something different I don't know about. I am able to adjust all the dots using a single command: \makeatletter \renewcommand{\@dotsep}{1} \makeatother (where you can change the value of 1 to suit your needs. – Werner Mar 20 '16 at 5:58