TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My question is about algorithmic package. I have an algorithm which I called A1.

\caption{\bf A1:}

I have something like this:

Algorithm 1 A1

How can I make that I will get

Algorithm A1

And another question how I can labelling so that when I use \ref{algorithm-A1}, then link will appear as A1 in a text.

share|improve this question
While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. – Peter Grill Nov 14 '12 at 4:04
Using \renewcommand{\thealgorithm}{A\arabic{algorithm}} should modify the \label-\ref you're using. However, the bigger question is the use of {\bf A1}. What does this represent? – Werner Nov 14 '12 at 4:11
up vote 3 down vote accepted

The following works for me, note in particular the line


which @Werner mentioned in his comment. Note also that this code is an example of a MWE

enter image description here




    \caption{Euclid’s algorithm}
        \Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
        \State $r\gets a\bmod b$
        \While{$r\not=0$}\Comment{We have the answer if r is 0}
        \State $a\gets b$
        \State $b\gets r$
        \State $r\gets a\bmod b$
        \State \textbf{return} $b$\Comment{The gcd is b}

Test reference: \ref{alg:euclid}

share|improve this answer
could please comments why does it work. I want to understand what should I change so that I will have various numeration like "Algorihtm A0", "Algorihtm A0M". thank you! – ashim Nov 15 '12 at 7:26

Your Answer


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.