I am trying to have pseudocode similar to that in this article. I am currently using the algorithmicx package. My problem is that I would like to have the caption look like below:
So in caps and complete with arguments. I can't seem to figure out how to do this. Below is an example. Basically I would want the "Euclid(a,b)" to be in the caption, instead of the body after procedure.
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{algorithm}
\usepackage[noend]{algpseudocode}
\floatname{algorithm}{Procedure}
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}
\renewcommand\thealgorithm{}
\begin{document}
\begin{algorithm}
\caption{Euclid’s algorithm}
\begin{algorithmic}[1]
\Require Integers $a$ and $b$
\Ensure The g.c.d of $a$ and $b$
\Procedure{Euclid}{$a,b$}
\State $r\gets a\bmod b$
\While{$r\not=0$}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile
\State \textbf{return} $b$
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}
Best Answer
The trick is to use
\textproc
, as below:This results in
Incidentally, this is also useful when you wish to refer to an algorithm in the text.