Code: Select all
\documentclass{article}
\usepackage{algorithm,algpseudocode}
\begin{document}
\begin{algorithm}
\caption{Euclid's algorithm}\label{euclid}
\begin{algorithmic}[1]
\Procedure{Euclid}{$a,b$}\Comment{The gcd of $a$ and $b$}
\State $r \gets a \bmod b$
\While{$r \neq 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}
\end{document}
Code: Select all
./test2.tex:6:\caption outside float. \caption