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 am new to LaTex and I am trying to type a document where I show the steps I took to solve an equation however I do not know how to do this in LaTex. I am trying to display something like this:

x^2+2x+1 = 0
(x+1)^2 = 0
x = -1

Is there a way to do this (or something similar) in LaTex? Any suggestions would be much appreciated!

share|improve this question
add comment

migrated from stackoverflow.com May 5 '12 at 13:35

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

2 Answers

up vote 8 down vote accepted

You should consider using amsmath:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
  x^2 + 2x + 1 &= 0 \\
  (x+1)^2 &= 0 \\
  \llap{$\rightarrow$\hspace{50pt}} x &= -1
\end{align*}
\end{document}
share|improve this answer
    
Perhaps \implies would be a better then using \rightarrow. –  Peter Grill May 5 '12 at 18:01
add comment

Try this:

\begin{eqnarray}
 x^2+2x+1 &=& 0      \nonumber \\
 (x+1)^2  &=& 0 \nonumber \\
  x & = & -1
\end{eqnarray}

You might want to number each step by removing the \nonumber commands; I only numbered the last one.

More examples here.

share|improve this answer
5  
eqnarray should never be used, see e.g. \eqnarray vs \align –  Torbjørn T. May 5 '12 at 14:10
    
Welcome to TeX.sx! Your answer was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or edit your answer. –  Werner May 5 '12 at 14:23
    
There we go! Guess my Latex-Fu is outdated, thanks for the heads up! –  dario_ramos May 6 '12 at 22:17
add comment

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.