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.

My problem is that I do not know how to disable the numbering for algorithms. I have created an algoritm and its number is "Algorithm 1", but I want to have "Algorithm".

\documentclass{article}

\usepackage[noend]{algorithmic} 
% Hide endif .etc

\usepackage{algorithm}

\algsetup{indent=2em} 
% Default 1 em

\renewcommand{\algorithmiccomment}[1]{\hspace{2em}// #1} 
% Change to C-style comments, though still ugly

\begin{document}
\begin{algorithm}
    \caption{MyAlgorithm} \label{alg:MyAlgorithm}
    \begin{algorithmic}[1]
    % Default no line numbering



    \end{algorithmic}
\end{algorithm}

\end{document}
share|improve this question
1  
how do you create the caption? Give a complete example –  Herbert May 16 '11 at 7:28
    
@Herbert - added –  colinfang May 16 '11 at 7:57
add comment

2 Answers 2

up vote 6 down vote accepted

posting working examples would be a nice idea ... ;-) Now only page references make sense:

\documentclass{article}
\usepackage[noend]{algorithmic} 
\usepackage{algorithm,caption}
\algsetup{indent=2em} 
\renewcommand{\algorithmiccomment}[1]{\hspace{2em}// #1} 

\begin{document}
\begin{algorithm}
\caption*{MyAlgorithm} \label{alg:MyAlgorithm}
\begin{algorithmic}[1]
\item foo
\end{algorithmic}
\end{algorithm}

see algorithm on Page~\pageref{alg:MyAlgorithm}
\end{document}
share|improve this answer
    
A-HA, it works. thx –  colinfang May 16 '11 at 9:31
    
Actually I didn't know we have to add caption package before using * –  colinfang May 16 '11 at 9:32
add comment

Setting the counter to nothing also works fine

\renewcommand{\thealgorithm}{}
share|improve this answer
add comment

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.