7

I want algorithm to NOT show the number in caption. How can i do that? Below is the code:

\begin{algorithm}
\begin{algorithmic}
\caption{ My Algorithm}
\IF
\ELSE
\end{algorithmic}
\end{algorithm}

Please let me know.

10

If this is for just one algorithm environment, you can locally redefine \thealgorithm:

\documentclass{article}
\usepackage{algorithmic,algorithm}

\begin{document}

\begin{algorithm}
\renewcommand\thealgorithm{}
\caption{A numberless algorithm}
\begin{algorithmic}
\STATE do something 
\end{algorithmic}
\addtocounter{algorithm}{-1}
\end{algorithm}

\end{document}

enter image description here

If you want this to be the global behaviour, you can add

\renewcommand\thealgorithm{}

to the preamble.

Another option is to use the caption package and declare a new label format for algorithms, suppressing the numbering:

\documentclass{article}
\usepackage{algorithmic,algorithm}
\usepackage{caption}

\makeatletter
\DeclareCaptionLabelFormat{numberless}{\ALG@name#1}
\captionsetup[algorithm]{labelformat=numberless} 
\makeatother

\begin{document}

\begin{algorithm}
\caption{A numberless algorithm}
\begin{algorithmic}
\STATE do something 
\end{algorithmic}
\end{algorithm}

\end{document}

enter image description here

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.