Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
    
Maybe, the following package can help you : tkz-linknodes –  projetmbc Sep 24 '11 at 20:04

2 Answers 2

up vote 9 down vote accepted

Do you mean something like this:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}
\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{equation}
\end{document}

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

share|improve this answer
    
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.