Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I redefine a custom environment of mine that uses "local variables":

\newenvironment{asdf}[3]{
  \def\argi{#1}
  \def\argii{#2}
  \def\argiii{#3}
  %....
}
{ }

But when I do:

\renewenvironment{asdf}[3]{
  \def\argi{#1}
  \def\argii{#2}
  \def\argiii{#3}
  %....
}
{ }

later on in the document, LaTeX claims

! Illegal parameter number in definition of \test

And also, I have no idea where \test comes from.

share|improve this question
    
Will's answer shows that in such cases you should always include a minimal working example, not just the code snippet. –  Hendrik Vogt Dec 6 '10 at 13:25
add comment

1 Answer

up vote 10 down vote accepted

Works for me:

\documentclass{article}
\begin{document}
I redefine a custom environment of mine that uses "local variables":
\newenvironment{asdf}[3]{
  \def\argi{#1}
  \def\argii{#2}
  \def\argiii{#3}
  %....
}
{ }
But when I do:
\renewenvironment{asdf}[3]{
  \def\argi{#1}
  \def\argii{#2}
  \def\argiii{#3}
  %....
}
{ }
\end{document}

I suspect here's more you're not telling us, such as that you have the \renewenvironment inside something else. Don't forget that if you have \renewenvironment inside another macro, you need to double the # signs:

\def\reset{%
  \renewenvironment{asdf}[3]{
    \def\argi{##1}
    \def\argii{##2}
    \def\argiii{##3}
  }
  { }
}
share|improve this answer
    
Would \def\foo{\def\bar{\renewenvironment{asdf}[3]... require ###1? –  Seamus Mar 22 '11 at 18:08
2  
@Seamus: No, ####1; you have to double each #. –  Hendrik Vogt Mar 22 '11 at 18:22
add comment

Your Answer

 
discard

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.