Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

algorithm environment

290 views
Skip to first unread message

Harvey

unread,
Jul 24, 2008, 11:31:18 AM7/24/08
to
I am having a problem with the algpseudocode package. Following the
documentation
(for algorithmicx), I run the Euclid algorithm example:

\begin{algorithm}
\caption{Euclid’s algorithm}\label{euclid}
\begin{algorithmic}[1]
\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$
\EndWhile\label{euclidendwhile}
\State \textbf{return} $b$\Comment{The gcd is b}
\EndProcedure
\end{algorithmic}
\end{algorithm}

The resulted in the latex error:
! LaTeX Error: Environment algorithm undefined.

Help.

Ulrike Fischer

unread,
Jul 24, 2008, 11:52:13 AM7/24/08
to

You are probably not loading the package algorithm that defines the
environment (see the full example on page 22 of the documentation of
algorithmicx).


--
Ulrike Fischer

Harvey

unread,
Jul 24, 2008, 12:21:32 PM7/24/08
to

Thanks! that did it.

0 new messages