As the title says I am trying to write a plus or minus as superscripts for various particle names in a bmatrix
, but it does not work. I have searched for solutions, but only came up with one, which should work, but doesn't. Now it really bothers why LaTeX
does not have this feature built in, that seems really silly, but maybe there is a good reason.
My code is:
%various packages
\newcommand{\minus}[1]{{#1}^{\scalebox{0.8}{-}}}
\newcommand{\plus}[1]{{#1}^{\scalebox{0.6}{\!+}}}
\begin{document}
\begin{bmatrix}
\pi^{\plus} & 0 & 0 \\
0 & 0 & 0 \\
0 & 0 & 0
\end{bmatrix}
\end{document}
the error i get is "Argument of \plus
has an extra }
. \par \pi^{\plus}
and the error repeats in my log – maybe 50 of the same errors but only on the same line.
Thank you for your time.
Best Answer
You should define
\plus
and\minus
to not take an argument:I've updated the definition slightly, ensuring that
+
and-
are taken as math binary operators.