TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

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

up vote 9 down vote accepted

You should consider using amsmath:

enter image description here

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

Try this:

 x^2+2x+1 &=& 0      \nonumber \\
 (x+1)^2  &=& 0 \nonumber \\
  x & = & -1

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
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

Your Answer


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.