Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Apr 2 at 22:14

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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