# Formatting list of custom floats in classic thesis

I am writing a document using classicthesis package, where I have some algorithms written with the clrscode package. I used package float to create a new float named "algorithm". However when I print the list of algorithms using \listof{algorithm}{List of algorithms} I either get a wrongly formatted list (i.e. with the long series of dots ..........., which is different from the other ones in classicthesis), or a correctly formatted one, but where algorithms are called "figure".

I trimmed down my document so that I got this minimal working example:

\documentclass[english]{scrreprt}

\usepackage{scrhack}

\usepackage{float}

\floatstyle{ruled}
\newfloat{algorithm}{thp}{loa}[chapter]
\floatname{algorithm}{Algorithm}

\usepackage[pdfspacing,floatperchapter]{classicthesis}

\begin{document}

\begingroup
\let\clearpage\relax
\let\cleardoublepage\relax

\tableofcontents
\listoffigures
\listoftables
\listof{algorithm}{List of algorithms}
\endgroup

\chapter{Test chapter}\label{ch:algotest}

\section{Some tests}

Algorithm \ref{alg:first} shows a plain algorithm. Figures \ref{fig:first} and \ref{fig:second} show a couple figures, and a table is shown in table \ref{tab:first}.

\begin{algorithm}
\caption{A plain algorithm\label{alg:first}}
\begin{verbatim}
while not finished:
do stuff
\end{verbatim}
\end{algorithm}

\begin{figure}
\caption{First figure\label{fig:first}}
This one is a figure.
\end{figure}

\begin{figure}
\caption{Second figure\label{fig:second}}
This one is a figure too.
\end{figure}

\begin{table}
\caption{Table figure\label{tab:first}}
This one is a table.
\end{table}

\end{document}


If the line \usepackage{scrhack} is used I got the "figure" name instead of "algorithm", whereas if it is commented out I got the wrongly formatted list.

From what I found on the web it seems that scrreprt and float packages are incompatible, thus the need for scrhackpackage, but I could not find anything related to classicthesis.

Is there a way to properly format a list of custom floats?

-

Here's a hack:

\documentclass[english]{scrreprt}

\usepackage{float}

\floatstyle{ruled}
\newfloat{algorithm}{thp}{loa}[chapter]
\floatname{algorithm}{Algorithm}

\usepackage[pdfspacing,floatperchapter]{classicthesis}

\begin{document}

\begingroup
\let\clearpage\relax
\let\cleardoublepage\relax

\tableofcontents
\listoffigures
\listoftables

\renewcommand{\figurename}{Algorithm}
\listof{algorithm}{List of algorithms}
\endgroup

\chapter{Test chapter}\label{ch:algotest}

\section{Some tests}

Algorithm \ref{alg:first} shows a plain algorithm. Figures \ref{fig:first} and \ref{fig:second} show a couple figures, and a table is shown in table \ref{tab:first}.

\begin{algorithm}
\caption{A plain algorithm\label{alg:first}}
\begin{verbatim}
while not finished:
do stuff
\end{verbatim}
\end{algorithm}

\begin{figure}
\caption{First figure\label{fig:first}}
This one is a figure.
\end{figure}

\begin{figure}
\caption{Second figure\label{fig:second}}
This one is a figure too.
\end{figure}

\begin{table}
\caption{Table figure\label{tab:first}}
This one is a table.
\end{table}

\end{document}


Thanks to @lockstep for pointing out the correct loading order of the packages.

-
That's a good workaround, but it would not allow to use "Algorithm" as autoref for instance. I tried a more complete solution be defining a new list using tocloft (similar to what classicthesis does with listings), but I could not get the "Algorithm" label to show properly in the list. So something like \newlistof{algorithms}{loa}{\lstlistalgorithmname}...\renewcommand{\cftlistings‌​presnum}{\lstalgorithmname~} does not work because the command lstalgorithmname is not processed. –  Jörg Nov 7 '12 at 13:59
@Jörg Just do \newcommand{\algorithmautorefname}{Algorithm} after loading classicthesis –  egreg Nov 7 '12 at 14:07