I want to redefine the pmatrix environment provided by the amsmath package (and changed by the mathtools package) for adding good-looking delimiters. The code is below:


The \PARENS command is provided by the mtpro2 package to get curved left/right parentheses. But it does not work. Furthermore, there's a starred version pmatrix* (with an optional arg l/c/r): I don't have any idea either. The code I can give is below:


I mailed to environ package's author Will Robertson, but there's no reply. He may come here usually. So I logged in and posted.

(The question is copied from https://stackoverflow.com/questions/4802117/how-to-redifine-via-environ-package-the-pmatrix-environment.)

  • I edited your post. Please don't just put a link there.
    – Leo Liu
    Jan 27 '11 at 7:53

\NewEnviron can define a environment that is never defined before, and \RenewEnviron can only redefine a environment that is defined by \NewEnviron. If we use \RenewEnviron to redefine a predefined environment, we'll get an error:

! LaTeX Error: \env@pmatrix@save@env undefined.

It seems a bug of environ. Here is the solution:



\expandafter\let\csname pmatrix*\endcsname\relax
\expandafter\let\csname endpmatrix*\endcsname\relax
  • 2
    the environ package uses the same internal command to define an environment or to redefine one. To do that, it has a placeholder for \(re)newcommand and \(re)newenvironment. In a \NewEnviron, everything is defined using \new.... In a \RenewEnviron, everything is defined using \renew.... What we would like here is renew some macros (\pmatrix and \endpmatrix), but create new (internal) macros. Jan 27 '11 at 7:24
  • @Bruno: Thanks, I got it. But it seems a bug (or unpleasing feature) of environ.
    – Leo Liu
    Jan 27 '11 at 7:34
  • These worked perfectly. Thanks you for your efforts on my problem! Jan 27 '11 at 8:27

My solution is based on Leo Liu's, but quicker if you want to redefine many environments in such a way:

  \expandafter\let\csname #1\endcsname\relax%
  \expandafter\let\csname end#1\endcsname\relax%
  \expandafter\let\csname env@#1@parse\endcsname\relax%
  \expandafter\let\csname env@#1@save@env\endcsname\relax%
  \expandafter\let\csname env@#1@process\endcsname\relax%


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.