I'd like to typeset an algorithm as an enumerated list, and I need
control of the label that is being used, as in
Step 1. (This is step 1)
Step 2. (Here is step 2)
etc.
I tried enumitem.sty with
\begin{enumerate}[label=Step \arabic*.]
\item (This is step 1) \label{step1}
\item (Here is step2) \label{step2}
\end{enumerate}
but I ended up with a raft of error messages and no labels (although
the reference to \ref{step1} and \ref{step2} works beautifully).
Obviously I am doing something wrong, but I can't figure out what. Can
anyone help?
Thanks
\documentclass{article}
\begin{document}
\begin{enumerate}
\def\makelabel{Step~}
\item{asdf}
\item{qewrty}
\item{zxdcv}
\end{enumerate}
\end{document}
> Forgive me if this is a FAQ. I have consulted the TeX archive at
> http://www.tex.ac.uk but I have not been able to find anything useful.
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=askquestion
>
> I'd like to typeset an algorithm as an enumerated list, and I need
> control of the label that is being used, as in
>
> Step 1. (This is step 1)
> Step 2. (Here is step 2)
> etc.
>
> I tried enumitem.sty with
>
> \begin{enumerate}[label=Step \arabic*.]
> \item (This is step 1) \label{step1}
> \item (Here is step2) \label{step2}
> \end{enumerate}
>
> but I ended up with a raft of error messages and no labels (although
> the reference to \ref{step1} and \ref{step2} works beautifully).
> Obviously I am doing something wrong, but I can't figure out what.
Works fine for me:
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=Step \arabic*.]
\item (This is step 1) \label{step1}
\item (Here is step2) \label{step2}
\end{enumerate}
\ref{step1}, \ref{step2}
\end{document}
*File List*
article.cls 2005/09/16 v1.4f Standard LaTeX document class
size10.clo 2005/09/16 v1.4f Standard LaTeX file (size option)
enumitem.sty 2007/06/30 v2.1 Customized lists
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
--
Ulrike Fischer
Alright. Fair enough. The input I use:
\documentclass[11pt]{article}
\usepackage{graphics,graphicx}
\DeclareGraphicsExtensions{.ps,.jpg,.eps,.pdf,.png}
\usepackage{boxedminipage,amsmath,amsfonts}
\usepackage{url}
\usepackage{verbatim}
\usepackage{enumitem}
\bibliographystyle{plain}
\begin{document}
\begin{enumerate}[label=Step \arabic*]
\item {This is the first step} \label{step1}
\item {This is the second step} \label{step2}
\item {This is the third step}
\end{enumerate}
As seen in the crucial step~\ref{step2}, the enumitem package is quite
useful.
\end{document}
This produces output like this:
gt;L
This is the first step
This is the second step
This is the third step
As seen in the crucial step , the enumitem package is quite
useful.
and the error messages
! Missing = inserted for \ifnum.
<to be read again>
&
l.12 \begin{enumerate}[label=Step \arabic*]
?
! Missing number, treated as zero.
<to be read again>
&
l.12 \begin{enumerate}[label=Step \arabic*]
?
! Misplaced alignment tab character &.
<recently read> &
l.12 \begin{enumerate}[label=Step \arabic*]
?
! LaTeX Error: Too deeply nested.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.12 \begin{enumerate}[label=Step \arabic*]
?
! LaTeX Error: Lonely \item--perhaps a missing list environment.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.13 \item T
his is the first step \label{step1}
? r
OK, entering \nonstopmode...
! LaTeX Error: Lonely \item--perhaps a missing list environment.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.14 \item T
his is the second step \label{step2}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Lonely \item--perhaps a missing list environment.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.15 \item T
his is the third step
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Undefined control sequence.
\enit@endenumerate ->\enit@after
\endlist \enit@toks \expandafter
{\enit@sav...
l.16 \end{enumerate}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\enit@endenumerate ...expandafter {\enit@savekeys
}\xdef
\enit@afterlist {\d...
l.16 \end{enumerate}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\enit@endenumerate ...csname {\csname c@\@listctr
\endcsname \the
\csname c@...
l.16 \end{enumerate}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! Undefined control sequence.
\enit@endenumerate ...me \the \csname c@\@listctr
\endcsname }}
\aftergroup \...
l.16 \end{enumerate}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.
! You can't use `\relax' after \the.
<recently read> \c@
l.16 \end{enumerate}
I'm forgetting what you said and using zero instead.
[1
] (test.aux) )
Output written on test.dvi (1 page, 404 bytes).
>> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxamplhttp://www.tex.ac.uk/cgi-bin/texfaq2html?label=askquestion
>
> Alright. Fair enough. The input I use:
>
> \documentclass[11pt]{article}
> \usepackage{graphics,graphicx}
That doesn't make sense. You only need to load graphicx.
> \DeclareGraphicsExtensions{.ps,.jpg,.eps,.pdf,.png}
Hm. I hope you know what you are doing.
> \usepackage{boxedminipage,amsmath,amsfonts}
> \usepackage{url}
> \usepackage{verbatim}
> \usepackage{enumitem}
> \bibliographystyle{plain}
>
> \begin{document}
>
> \begin{enumerate}[label=Step \arabic*]
> \item {This is the first step} \label{step1}
> \item {This is the second step} \label{step2}
> \item {This is the third step}
> \end{enumerate}
>
> As seen in the crucial step~\ref{step2}, the enumitem package is quite
> useful.
>
> \end{document}
>
>
> This produces output like this:
>
>
> gt;L
> This is the first step
> This is the second step
> This is the third step
> As seen in the crucial step , the enumitem package is quite
> useful.
>
>
> and the error messages
>
>
>
> ! Missing = inserted for \ifnum.
No problem here. Put \listfiles at the start and then compare the file
list in the log:
*File List*
article.cls 2005/09/16 v1.4f Standard LaTeX document class
size11.clo 2005/09/16 v1.4f Standard LaTeX file (size option)
graphics.sty 2006/02/20 v1.0o Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive
dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
boxedminipage.sty
amsmath.sty 2000/07/18 v2.13 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
amsfonts.sty 2001/10/25 v2.2f
url.sty 2006/04/12 ver 3.3 Verb mode for urls, etc.
verbatim.sty 2003/08/22 v1.5q LaTeX2e package for verbatim
enhancements
enumitem.sty 2007/06/30 v2.1 Customized lists
***********
--
Ulrike Fischer
The only major difference that I can see is that you use teTeX for the
graphics.cfg, while mine is MikTeX. Don't know why that should make a
difference, though.
*File List*
article.cls 2004/02/16 v1.4f Standard LaTeX document class
size11.clo 2004/02/16 v1.4f Standard LaTeX file (size option)
graphics.sty 2001/07/07 v1.0n Standard LaTeX Graphics (DPC,SPQR)
trig.sty 1999/03/16 v1.09 sin cos tan (DPC)
graphics.cfg 2003/03/12 v1.1 MiKTeX 'graphics' configuration
dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
graphicx.sty 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 1999/03/16 v1.13 key=value parser (DPC)
boxedminipage.sty
amsmath.sty 2000/07/18 v2.13 AMS math features
amstext.sty 2000/06/29 v2.01
amsgen.sty 1999/11/30 v2.0
amsbsy.sty 1999/11/29 v1.2d
amsopn.sty 1999/12/14 v2.01 operator names
amsfonts.sty 2001/10/25 v2.2f
url.sty 2004/03/15 ver 3.1 Verb mode for urls, etc.
>> No problem here. Put \listfiles at the start and then compare the file
>> list in the log:
>
> The only major difference that I can see is that you use teTeX for the
> graphics.cfg, while mine is MikTeX. Don't know why that should make a
> difference, though.
Does my document also trigger the error?
\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label=Step \arabic*.]
\item (This is step 1) \label{step1}
\item (Here is step2) \label{step2}
\end{enumerate}
\ref{step1}, \ref{step2}
\end{document}
If no: add one after one the other packages until you find the culprit,
then delete all other packages until you have a very minimal document
that triggers the error. Then sent the complete log.
If yes: Sent the complete log directly.
--
Ulrike Fischer
Please try this:
\usepackage{enumerate}
\begin{enumerate}[Step 1.]
\item (This is step 1)\label{step1}
\item (Here is step 2)\label{step2}
\end{enumerate}
Krishnan