I am using the mtpro2 package for math. Recently I changed the pmatrix enviroment like the MWE shows, in order to use the \PARENS command for the parenthesis of the matrix.
\documentclass[11pt]{article}
\usepackage[lite]{mtpro2}
\usepackage[no-math,cm-default]{fontspec}
\usepackage{xunicode}
\usepackage{xgreek}
\usepackage{amsmath}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\setmainfont[Mapping=tex-text,Numbers=Lining,Scale=1.0,BoldFont={Minion Pro Bold}]{Minion Pro}
\usepackage{environ}
\let\pmatrix\relax
\let\endpmatrix\relax
\NewEnviron{pmatrix}{\PARENS{\begin{matrix}\BODY\end{matrix}}}
\expandafter\let\csname pmatrix*\endcsname\relax
\expandafter\let\csname endpmatrix*\endcsname\relax
\NewEnviron{pmatrix*}[1][c]{\PARENS{\begin{matrix*}[#1]\BODY\end{matrix*}}}
\begin{document}
\begin{gather*}
\begin{pmatrix}
1&2&1\\0&1&1\\0&0&0
\end{pmatrix}
\end{gather*}
\end{document}
If I place the pmatrix enviroment inside \[ \] then everything works fine. The pmatrix inside the gather, gather* or any other math enviroment does not compile an gives the following error:
Argument of \pmatrix has an extra }. \end{gather}
and a bunch of other errors.
{\begin{pmatrix}...\end{pmatrix}}will work. Maybe it's solvable in a different way. – egreg Jan 11 '17 at 18:29