# How to create an unnumbered algorithm with a caption?

I want to do something like:

\begin{algorithm*}
\caption{My unnumbered algorithm}
% etc. etc.
\end{algorithm*}


or

\begin{algorithm}
\nonumbercaption{My unnumbered algorithm}
% etc. etc.
\end{algorithm}


Of course, the above is not LaTeX, just wishful thinking. What can I do to get an unnumbered algorithm with a caption?

Actually, the specific motivation is that I've split an algorithm in the middle since it's too long (using algorithmicx's \algstore); I want the second part to have a caption saying it's the second part, but I don't want it to have a new algorithm number.

If I understand your question correctly, you could use the \caption* command from the caption package to typeset the caption without label; a little example:

\documentclass{article}
\usepackage{caption}
\usepackage{algorithm}
\usepackage{algpseudocode}

\begin{document}
\begin{algorithm}
\caption{A test algorithm (Part I)}
\begin{algorithmic}
\Procedure {BellmanKalaba}{$G$, $u$, $l$, $p$}
\ForAll {$v \in V(G)$}
\State $l(v) \leftarrow \infty$
\EndFor
\algstore{bkbreak}
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\caption*{A test algorithm (Part II)}
\begin{algorithmic}
\algrestore{bkbreak}
\State $p(i) \leftarrow v_j$
\State $l’(i) \leftarrow min$
\State $changed \leftarrow l \not= l’$
\EndProcedure
\end{algorithmic}
\end{algorithm}

\end{document} I suggest using the \ContinuedFloat command from the caption package instead and marking the second part as "continued":

\documentclass{article}

\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{caption}

\begin{document}

\begin{algorithm}
\caption{Test}
\begin{algorithmic}
\State $i \gets 42$
\algstore{test}
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\ContinuedFloat
\caption{Test (cont.)}
\begin{algorithmic}
\algrestore{test}
\State $j \gets 24$
\end{algorithmic}
\end{algorithm}

\end{document} See the caption manual if you want the label, not caption, text to hold the "(continued)" word.

• Hmm, even better than Gonzalo's suggestion, which also works. Having the bolded 'Algorithm X.Y' is a plus. – einpoklum Oct 29 '11 at 22:36
• Of course, this is just for my specific motivation. In general, not everything is a \ContinuedFloat... so I have to accept Gonzalo's answer. – einpoklum Oct 29 '11 at 22:50

To follow on @Gonzalo's answer, I would duplicate the caption of the second (continued) part of the algorithm in full (using \caption*). Credit to him for the answer: \documentclass{article}
\usepackage{caption}% http://ctan.org/pkg/caption
\usepackage{algorithm}% http://ctan.org/pkg/algorithm
\usepackage{algpseudocode}% http://ctan.org/pkg/algorithmicx

\begin{document}
\begin{algorithm}
\caption{BellmanKalaba algorithm} \label{alg:first}
\begin{algorithmic}
\Procedure {BellmanKalaba}{$G$, $u$, $l$, $p$}
\ForAll {$v \in V(G)$}
\State $l(v) \leftarrow \infty$
\EndFor
\algstore{bkbreak}
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\caption*{\textbf{Algorithm~\ref{alg:first}}\ BellmanKalaba algorithm (continued)}
\begin{algorithmic}
\algrestore{bkbreak}
\State $p(i) \leftarrow v_j$
\State $l’(i) \leftarrow min$
\State $changed \leftarrow l \not= l’$
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}


With a little work it would probably be possible to supply modify \caption so that an additional argument to \caption* could be the previous algorithm label, so as to produce the above result automatically.