I am trying to do something like this,
\DeclareRobustCommand{\col}[1]{
\begin{bmatrix}
\foreach \i in {#1} {\i \\}
\end{bmatrix}
}
Which unfortunately does not work, while this works,
\DeclareRobustCommand{\col}[1]{
\begin{bmatrix}
\foreach \i in {#1} {\i, }
\end{bmatrix}
}
Could someone suggest a fix? I tried looking up this issue but am having a hard time understanding any of the answers.

\colmight get called. – Mico Mar 06 '23 at 06:10\col{0, 1}to write\begin{bmatrix} 0 \\ 1 \end{bmatrix}. Which is a column vector. – scribe Mar 06 '23 at 06:31\foreachwill have issues with grouping, as each cell in an alignment forms an implicit group your\foreachstarts in one group and should end in another, which doesn't work as intended. – Skillmon Mar 06 '23 at 08:25