[Tex/LaTex] How to remove “Algorithm #” caption prefix but keep list of algorithms

algorithmscaptionstable of contents

I am using the algorithm-package and would like to name my algorithms without any generated prefix. So I would like to remove "Algorithm #" as prefix from my caption, but still keep the list of algorithms listing the captions.

I have two minimal working examples, each one doing only a part of the required job.

\documentclass[11pt]{article}

\usepackage{caption}
\usepackage{algorithm}

\begin{document}

\begin{algorithm}
\caption*{My Algorithm}
\end{algorithm}

\listofalgorithms

\end{document}

This removes the caption prefix, but the algorithm is not included in the list.

\documentclass[11pt]{article}

\usepackage{caption}
\usepackage{algorithm}

\begin{document}

\begin{algorithm}
\floatname{algorithm}{}
\caption{My Algorithm}
\end{algorithm}

\listofalgorithms

\end{document}

This removes the caption prefix partially, (the number "1" still remains), but the algorithm is included in the list.

Best Answer

Here's one possibility, defining a format with the help of the caption package:

\documentclass[11pt]{article}
\usepackage{caption}
\usepackage{algorithm}

\DeclareCaptionFormat{myformat}{#3}
\captionsetup[algorithm]{format=myformat}

\begin{document}

\begin{algorithm}
\caption{My Algorithm}
\end{algorithm}
\listofalgorithms

\end{document}

enter image description here

As egreg has pointed out, the caption package already offers the empty format, so there's no need to define a new one:

\documentclass[11pt]{article}
\usepackage{caption}
\usepackage{algorithm}

\captionsetup[algorithm]{labelformat=empty}

\begin{document}

\begin{algorithm}
\caption{My Algorithm}
\end{algorithm}
\listofalgorithms

\end{document}