TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)$ ...

Please suggest!

share|improve this question
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:


\usepackage{algpseudocode}% loads algorithmicx automatically

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

\caption{First algorithm}\label{alg1}

\caption{Second algorithm}\label{alg2}

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


Hope, this helps.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.