# Warning when using a command as label argument for a list?

I'm having difficulties with a list where the label is defined as a command. Below is a minimal example:

\documentclass[a4paper, 11pt]{article}

\usepackage{enumerate}

\newcommand{\myLabel}{1)}

\newenvironment{myList}%
{%
\begin{enumerate}[\myLabel]
}
{%
\end{enumerate}
}

\begin{document}

\begin{myList}
\item Item 1
\item Item 2
\item Item 3
\end{myList}

\end{document}


When I compile this, I get the following warning

LaTeX Warning: The counter will not be printed.
The label is: \myLabel  on input line 19.


and the generated list only has 1, 1, 1 as labels instead of 1, 2, 3.

Any idea how to work around this problem?

-

You have to expand \myLabel before using it

\documentclass[a4paper, 11pt]{article}

\usepackage{enumerate}
\newcommand\myLabel{1)}

\newenvironment{myList}%
{\expandafter\enumerate\expandafter[\myLabel]}
{\endenumerate}

\begin{document}

\begin{myList}
\item Item 1
\item Item 2
\item Item 3
\end{myList}

\end{document}

-
Ah thanks! That fixed it. =) – gablin Aug 18 '11 at 8:57