Here's one possible solution:
\documentclass{scrreprt}
\usepackage[american]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[algoruled]{algorithm2e}
\usepackage[format=hang]{caption}
\usepackage{etoolbox}
\usepackage{newfloat}
\usepackage{classicthesis}
\usepackage{arsclassica}
% Un-define ''algorithm'' as defined by the algorithm package
\let\algorithm\relax
\let\endalgorithm\relax
\expandafter\let\csname algorithm*\endcsname\relax
\expandafter\let\csname endalgorithm*\endcsname\relax
\let\listofalgorithms\relax
% Define the new algorithm environment
\DeclareFloatingEnvironment{algorithm}
\makeatletter
% Definition for the style ruled
% First add the rules enclosing the captiom
\DeclareCaptionFormat{algrule}{%
\rule{\textwidth}{0.8pt}\par
{\@hangfrom{#1#2}%
\advance\caption@parindent\hangindent
\advance\caption@hangindent\hangindent
\caption@@par#3\par}%
\vspace*{-8pt}\rule{\textwidth}{0.4pt}\vspace*{-5pt}
}
% Now add the rules after the algorithm
\AtEndEnvironment{algorithm}{\vspace*{-9pt}\rule{\textwidth}{0.4pt}}
% Apply the new format to the algorithm environment
\captionsetup[algorithm]{format=algrule}
% Settings for the list of algorithms
\let\oldlistofalgorithms\listofalgorithms
\renewcommand\listofalgorithms{
\begingroup
\renewcommand{\cftfigpresnum}{\algorithmname~}
\oldlistofalgorithms
\clearpage
\endgroup
}
\makeatletter
\begin{document}
\listofalgorithms
\begin{algorithm}[htb]
\caption{Morbi blandit vehicula leo a consectetur. Aliquam a lacus posuere, consectetur tortor at, mollis erat.}
\While{true}
{
}
\end{algorithm}
\begin{figure}
\centering
\Huge
A
\caption{Morbi blandit vehicula leo a consectetur. Aliquam a lacus posuere, consectetur tortor at, mollis erat.}
\end{figure}
\begin{table}
\centering
\Huge
A
\caption{Morbi blandit vehicula leo a consectetur. Aliquam a lacus posuere, consectetur tortor at, mollis erat.}
\end{table}
\end{document}
An image of the list of algorithms:

An image of the document showing the new environment in action:

The algorithm
environment defined by algorithm2e
is defined internally using the float
package, so it's behaviour is not exactly the same as the one for standard floats and the environment is not 100% compatible with some of the features of the caption
package.
One possible solution is then to un-define the algorithm
environment defined by the algorithm2e
package and define a new algorithm
float with the help of the newfloat
package. This new environment is fully compatible with the caption
package, so one can use all the features offered by the package; in particular, settings like the hanging indentation will now apply directly (notice how nicely the new object inherits the settings from classicthesis
/arsclassica
).
An algrule
format was used to imitate the look and feel of the ruled
style of the original environment. The \caption
command inside the new algorithm
environment has to be used before the actual algorithm.
The solution also takes care of producing a "List of Algorithms" following the settings of the other standard lists.
The procedure used is, in fact, recommended in the documentation of the caption
package:
Note: Only one single caption can be typeset inside environments
defined with \newfloat
or \restylefloat
, furthermore these
environments are not behaving exactly like the pre-defined floats
figure
and table
. As a consequence many packages do not cooperate
well with these.
Furthermore the float
package has some caveats & limitations, so if
you just want to define a new simple floating environment—behaving
like figure or table—I recommend using \DeclareFloatingEnvironment
offered by the newfloat
package instead.