Horizontal Line Separating Steps in Aligned Equation

I have an equation that I'm trying to display with horizontal line separation. The result I'm looking for is similar to this question, but I'm not sure how to apply it to my equation (below).

\begin{equation*}
\begin{aligned}
x + 3& = &7\\
-3 & = &-3\\
x& = &4\\
\end{aligned}
\end{equation*}


Thanks!

-

It's quite easy, actually: aligned is a special form of array, so \hline works. But I suggest to load the package booktabs:

\usepackage{booktabs}

...

\begin{equation*}
\begin{aligned}
x + 3& = 7\\
\midrule
-3 & = -3\\
\midrule
x& = 4\\
\end{aligned}
\end{equation*}


\midrule produce better spacing than \hline.

aligned (like align) requires a & before the alignment point (usually a relation), but not after it.

As Herbert points out, the vertical spacing may be not optimal. In case this is a real problem, one can resort to array (this requires the array package):

\begin{equation*}
\setlength{\arraycolsep}{0pt}
\begin{array}{r>{{}}l}
x + 3& =  7 \\
\midrule
-3   & = -3 \\
\midrule
x    & = 4
\end{array}
\end{equation*}


The intercolumn space is reduced to zero and before the relation symbol we put an empty group, so that TeX finds {}=7 in the cell, that produces the correct horizontal spacing.

-
\midrule works great. Wondering if there is something that works as well in an align environment? –  Peter Grill Jul 14 '11 at 1:16
works with \cline or \cmidrule but has problems with vertical spacing –  Herbert Jul 14 '11 at 6:56
This works great - thanks! –  Shane Fulmer Jul 14 '11 at 13:33
\documentclass{article}
\usepackage{booktabs}
\begin{document}

$\renewcommand\arraystretch{1.4} \arraycolsep=1.4pt \begin{array}{rl}\toprule[1pt] x + 3& = 7 \\\midrule -3 & = -3 \\\midrule x& = 4 \\\bottomrule[1pt] \end{array}$
\end{document}

-