# Aligning equations by row and column — with vertical lines

I want to include two sets of equations side-by-side in a table. Here is my example:

\documentclass{article}
\usepackage{amsmath}
\newcommand{\eqnbox}[2]{
\begin{minipage}[c]{#1\linewidth}\begin{equation*}\begin{aligned}
#2
\end{aligned}\end{equation*}\end{minipage}
}
\begin{document}
\begin{center}
\begin{tabular}{c|c}
first set & second set\\
\hline
\eqnbox{.3}{
x &= \frac{1}{2}\\
y &= \frac{1}{3}\\
z &= 3
} &
\eqnbox{.3}{
x &= 2\\
y &= 3\\
z &= 3
}
\end{tabular}
\end{center}
\end{document}


I have tried

1. aligning the rows but putting each equation in , but then I cannot align vertically by the = sign.
2. laying out the entire table using align, but then cannot put a vertical line down the middle.
3. adjusting the height of the box by using the height argument to minipage, e.g. \begin{minipage}[c][30pt]{#1\linewidth}, or enclosing the minipage environment within raisebox, e.g., \raisebox{0pt}[30pt][30pt]{}.

No luck so far -- any suggestions?

-

## migrated from stackoverflow.comFeb 14 '11 at 19:42

This question came from our site for professional and enthusiast programmers.

Use an array instead of the tabular and put the single equations side by side, not the blocks.

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
$\begin{array}{rl!{\quad\vline\quad}rl} \MCA{first set} & \MCB{second set}\\\hline x &= \frac{1}{2} & x &= 2\\ y &= \frac{1}{3} & y &= 3\\ z &= 3 & z &= 3 \end{array}$

Ah, I like this for the position arguments permitted by array and the vline specifications which I did not know about -- very awesome. –  crippledlambda Feb 15 '11 at 12:09