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 have the sample below, When I compile and run, each step of the equation is left aligned with smaller fonts. What I'm trying to achieve is, each step of the equation should appear on a line by itself, normal fonts aligned at = sign.

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\begin{document}
\begin{align*}
\sum_{i=1}^{k+1} i^{3} = \left(\sum_{i=1}^{n} i^{3}\right) +  i^3\\
&=& \frac{k^{2}(k+1)^{2}}{4} + (k+1)^3 
&=& \frac{k^{2}(k+1)^{2} + 4(k+1)^3}{4}\\
&=& \frac{(k+1)^{2}(k^{2} + 4k + 4)}{4}\\
&=& \frac{(k+1)^{2}(k+2)^{2}}{4}\\
\end{align*}

This proves that Eq. (3) holds.  By induction, Eq (1) holds for all positive integers $n$
\end{document}
share|improve this question
    
Welcome to TeX.SE. Instead of equation* use align* and use a single & before the =. Also, please post a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Jan 31 at 14:58
    
This code will produce several error messages and typeset a single line that goes beyond the page boundary, but no “smaller font size”. – egreg Jan 31 at 15:02
    
@PeterGrill I posted a MWE. After applying align* I still get the error – hello Jan 31 at 15:05
1  
Use a single & and you need the ams math package, – Peter Grill Jan 31 at 15:15
up vote 6 down vote accepted

You're using the syntax of eqnarray, and are forgetting to load amsmath; compiling your example produces scores of errors and the output is almost arbitrary.

\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{amsmath}

\begin{document}

\begin{align*}
\sum_{i=1}^{k+1} i^{3}
&= \biggl(\sum_{i=1}^{n} i^{3}\biggr) +  i^3\\
&= \frac{k^{2}(k+1)^{2}}{4} + (k+1)^3 \\
&= \frac{k^{2}(k+1)^{2} + 4(k+1)^3}{4}\\
&= \frac{(k+1)^{2}(k^{2} + 4k + 4)}{4}\\
&= \frac{(k+1)^{2}(k+2)^{2}}{4}
\end{align*}

\end{document}

enter image description here

Note that the trailing i^3 in the first row should be (k+1)^3

share|improve this answer
    
Thanks for pointing out the maths. It works. – hello Jan 31 at 15:21

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.