[Tex/LaTex] Align equal signs of equations in array

alignarrays

I have an array of equations which looks like this:

\documentclass{article}

\begin{document}

$$
\begin{array}{cc}
x=1 & y=1 \\
x=10 & y=20
\end{array}
$$

\end{document}

I'd like to align the equals sign vertically. I tried doing this, which I felt should work:

\documentclass{article}
\usepackage{amsmath}    

\begin{document}

$$
\begin{array}{cc}
\begin{align} x&=1 \\ x&=10 \end{align} & 
\begin{align} y&=1 \\ y&=10 \end{align} \\
\end{array}
$$

\end{document}

However, that did not work at all and threw me a million errors. Does anyone have any suggestions for me?

Best Answer

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}

align
\begin{align*}
x&=1 & y&=1 \\
x&=10 & y&=20
\end{align*}

alignat
\begin{alignat*}{2}
x&=1 &\qquad y&=1 \\
x&=10 & y&=20
\end{alignat*}


\end{document}

array is intended for arrays of values, not for aligned expressions. (The terms are set in inline math mode, and the spacing is all wrong). Also $$ is not LaTeX syntax.

You can use align (or for more control over the space between the two equations, alignat)

Related Question