Equation Alignment With Steps

I'm trying to show all of the steps for solving a linear equation like this:

\begin{aligned}
-4(6x - 5) & = 188 \\
(-4*6x)+(-4*-5) &  \\
-24x + 20 & = 188 \\
-20 & = -20 \\
-24x & = 168 \\
/-24 & = /-24 \\
x & = -7
\end{aligned}


This renders as I would expect it to, but if I remove the = sign from the -20 step (and /-24), the -20 no longer aligns correctly on the right side. Is there any way to have it still align without putting the equals sign in there? Thanks!

-

Do you mean something like this:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{aligned} -4(6x - 5) & = 188 \\ (-4*6x)+(-4*-5) & \\ -24x + 20 & = 188 \\ -20 &\mathrel{\phantom{=}} -20 \\ -24x & = 168 \\ /-24 & = /-24 \\ x & = -7 \end{aligned}
\end{document}


I use the command phantom to tell LaTeX there is a equal sign and \mathrel for the correct sep.

-
Awesome! This appears to work perfectly. Thank you! –  Shane Fulmer Sep 24 '11 at 18:14
On the second-to-last line of the aligned environment, shouldn't it say \div rather than - (subtraction)? :-) –  Mico Sep 24 '11 at 21:44

if i understand correctly what you want to do, then i suggest replacing the line

-20 & = -20 \\


by

-20 & \phantom{{}={}} -20 \\


the extra braces around the = are needed to get the correct spacing since it's "hidden" from the adjacent characters that would otherwise force the correct spacing for a relation.

EDIT: as Werner points out, this gets the spacing wrong -- the minus becomes binary, not unary. to force a unary minus, you need

-20 & \phantom{{}={}} {-20} \\


Marco's answer is much nicer, and shows a sophisticated understanding of how to apply the symbol classes.

-