[OS X TeX] Problem with refs to label in algorithmic

Ari Stern ari at caltech.edu
Tue Apr 15 02:55:22 CEST 2008


Hi Christopher:

This doesn't seem to be valid code for the "algorithmic" style.  It
looks like you are actually using the "algorithmicx" package, which
you can invoke together with the "algorithm" environment using the
preamble command:
\usepackage{algorithm,algpseudocode}
Is this what you are doing?

After making that change, and adding a missing \Repeat statement
(which you probably edited out), I was able to get this to typeset
with no problem.  Here's a minimal file containing your code ... see
if you can get it to work on your system.

\documentclass{article}

\usepackage{algorithm,algpseudocode}

\begin{document}

\begin{algorithm}[t]
  \caption{The Abraxas Algorithm}\label{al:abraxas}
  \begin{algorithmic}[1]
    \Procedure{Abraxas}{$C_i, P_i, T_i$}
    \Repeat
    \State Increment iteration index:  $\{C_i, P_i, T_i| i = i + 1\}$
    \Until{\textbf{StoppingCriterion}}
    \EndProcedure
  \end{algorithmic}
\end{algorithm}

We can describe the procedure presented in Algorithm \ref{al:abraxas}
as follows: .....

\end{document}

Cheers,
Ari

On 13/04/2008, Christopher Brewster <C.Brewster at dcs.shef.ac.uk> wrote:
> I am using the 'algorithm' and 'algorithmic' styles to lay out an algorithm.
>  Using \ref{} to a label inside them produces an error:
>  "Latex Error: ./Chapters/chap10.tex:187 Undefined control sequence."
>
>  *However*, the references are correctly typeset.
>  Any suggestions?
>
>  Thanks,
>  Christopher
>
>
>  Example usage is this:
>  ------
>  \begin{algorithm}[t]
>         \caption{The Abraxas Algorithm}\label{al:abraxas}
>         \begin{algorithmic}[1]
>                 \Procedure{Abraxas}{$C_i, P_i, T_i$}
>  ....
>                 \State Increment iteration index:  $\{C_i, P_i, T_i| i = i +
> 1\}$
>                 \Until{\textbf{StoppingCriterion}}
>                 \EndProcedure
>         \end{algorithmic}
>  \end{algorithm}
>
>  We can describe the procedure presented in Algorithm \ref{al:abraxas} as
> follows: .....
>
>
>
>  *****************************************************
>  Department of Computer Science, University of Sheffield
>  Regent Court, 211 Portobello Street
>  Sheffield   S1 4DP   UNITED KINGDOM
>
>
>
>  -------------------------- Helpful Info --------------------------
>  TeX FAQ: http://www.tex.ac.uk/faq
>  List Reminders and Etiquette:
> http://www.esm.psu.edu/mac-tex/list/
>  List Info:
> http://email.esm.psu.edu/mailman/listinfo/macosx-tex
>  List Archive: http://tug.org/pipermail/macostex-archives/
>  Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>
>
>



More information about the macostex-archives mailing list