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 am attempting to construct a new environment which will allow me to format arbitrary list types (itemize, enumerate, description etc.) with the new environment. As such I am passing it as a parameter to the new environment but it complains when I attempt the following:

#Environment definition here

I get the following error:

! Illegal parameter number in definition of \endmylist. 1 l.15 {\end{#1}}

How can I pass my parameters into the end block?

share|improve this question
The reason why you can't use arguments in the "end" part of the definition of a new environment and some possible solutions are given in Why can't the end code of an environment contain an argument?. – Gonzalo Medina Jun 13 '11 at 2:03
up vote 19 down vote accepted

One possibility is to use the xparse package:

  % other code
share|improve this answer
Thank you, very useful package. As a side note for everyone who, like me, doesn't know xparse the {m} parameter is specified just like table columns. The m stands for "mandatory parameter". – Riccardo Oct 29 '11 at 14:00

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.