There are two parts to this question. Mainly, I'm interested in implementing a \newcommand that can take an arbitrary number of arguments to be set in a single column of a matrix.
I tried the following, but it throws a missing \endgroup error (and it seems to be a result of \\, because taking out \\ eliminates the error, but then the desired result is not achieved):
\documentclass{article}
\usepackage{pgffor}
\usepackage{amsmath}
\newcommand*{\Features}[1]{%
\(%
\begin{bmatrix}%
\foreach \entry in {#1} {\text{\entry}\\}
\end{bmatrix}%
\)%
}
\begin{document}
\Features{--ACC, +PL}
\end{document}
Is there an easy way to fix this to make it work as desired?
The second part of the question is why this is happening. I'm curious for the sake of learning and for the sake of being able to write better macros in the future, but I haven't been able to figure out what's causing the missing \endgroup error.



\foreachexecutes each cycle in a group, so\\is seen inside that group and the alignment process is messed up. – egreg Nov 22 '13 at 22:53pgffor? If not, is there a better way to do this? – Adam Liter Nov 22 '13 at 23:00