I am trying to use the \foreach command to create something with the same effect as:
\begin{align*}
1 \\
2
\end{align*}
The following code fails to work:
\begin{align*}
\foreach \x in {1,2} {
\x \\
}
\end{align*}
The error message reads as follows:
! Extra }, or forgotten \endgroup.
I tried to do some research but cannot find anything useful (to me), so any suggestion or advice would be appreciated. Thanks!

