Take the 2-minute tour ×

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
add comment

1 Answer

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}
        \State $r\gets a\bmod b$
        \State $a\gets b$
        \State $b\gets r$
        \State $r\gets a\bmod 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! –  msh Nov 15 '12 at 7:26
add comment

Your Answer


