# algorithmic, referring using the name and inputs

I'm using the algorithmicx package, but I would like my algorithm to look like:

Algorithm My Algo $(\lambda,\beta)$

i.e., the algorithm should accept inputs as shown. I then want refer to this algorithm from the main text as follows:

We run algorithm My Algo $(\lambda_1,\beta_1)$ and also My Algo $(\lambda_1,\beta_2)$ ...

-
Welcome to TeX.SX! –  Papiro Jul 20 '13 at 23:37
What would you want the interface to be, given that you want to accommodate for variable referencing? –  Werner Jul 21 '13 at 4:50

The following example will do:

\documentclass{article}

\usepackage{algorithm}
\begin{document}

% Redefine the Algorithm number as below: Check \arabic{algorithm}
\def\thealgorithm{My Algo $(\lambda_{1},\beta_{\arabic{algorithm}})$}

\begin{algorithm}
\caption{First algorithm}\label{alg1}
\begin{algorithmic}[1]
\Procedure{Test}{$\lambda,\beta$}
\EndProcedure
\end{algorithmic}
\end{algorithm}

\begin{algorithm}
\caption{Second algorithm}\label{alg2}
\begin{algorithmic}[1]
\Procedure{Test}{$\lambda,\beta$}
\EndProcedure
\end{algorithmic}
\end{algorithm}

We run algorithm \ref{alg1} and \ref{alg2}.

\end{document}


Hope, this helps.

-