[Tex/LaTex] How to avoid printing the algorithm number in algorithm captions

algorithm2ealgorithmscaptions

I am using the algorithm2e package to write algorithms. However, when i write three algorithms one after another, the algorithms are automatically numbered 1,2 and 3 in the caption. I am using following code:

\begin{algorithm}[H]
 \SetAlgoLined
 \KwData{this text}
 \KwResult{how to write algorithm with \LaTeX2e }
 initialization\;
 \While{not at end of this document}{
  read current\;
 \eIf{understand}{
  go to next section\;
 current section becomes this one\;
 }{
 go back to the beginning of current section\;
 }
}
\caption{How to write algorithms}
\end{algorithm}

I am getting the resulting algorithm to be
enter image description here

The caption of algorithm mentions "Algorithm 3" if this package is used three times. I want that for every caption it just mentions "Algorithm" and not "Algorithm 3". How can it be done?

Best Answer

If you're willing to use \TitleOfAlgo instead (which, for algorithms, is more flexible than \caption in many ways), then see John Wickerson's answer.

Otherwise, if you really want to use \caption but remove algorithm numbering, simply insert \renewcommand{\thealgocf}{} in your preamble.

enter image description here

\documentclass[10pt]{report} 
\usepackage{algorithm2e}

\renewcommand{\thealgocf}{}

\begin{document}

\begin{algorithm}[H]
 \SetAlgoLined
 \KwData{this text}
 \KwResult{how to write algorithm with \LaTeX2e }
 initialization\;
 \While{not at end of this document}{
  read current\;
 \eIf{understand}{
  go to next section\;
 current section becomes this one\;
 }{
 go back to the beginning of current section\;
 }
}
\caption{How to write algorithms}
\end{algorithm}

\end{document}