# LaTeX question

• Nov 8th 2008, 09:31 AM
Mathstud28
LaTeX question
How do you align a series of equations in the center like Krizalid does in this thread?

http://www.mathhelpforum.com/math-he...opic-sums.html

I tried to duplicate the appropriate LaTeX code but don't seem to be able to. Could someone tell me what I'm doing wrong?

\displaystyle \begin{aligned}\int{f(x)g(x)}dx& =f(x)+200g(x)& =5\end{aligned}

Code:

\begin{aligned}\int{f(x)g(x)}dx& =f(x)+200g(x)& =5\end{aligned}
• Nov 8th 2008, 09:46 AM
masters
Quote:

Originally Posted by Mathstud28
How do you align a series of equations in the center like Krizalid does in this thread?

http://www.mathhelpforum.com/math-he...opic-sums.html

I tried to duplicate the appropriate LaTeX code but don't seem to be able to. Could someone tell me what I'm doing wrong?

\displaystyle \begin{aligned}\int{f(x)g(x)}dx& =f(x)+200g(x)& =5\end{aligned}

\displaystyle \begin{aligned}\int{f(x)g(x)}dx& =f(x)+200g(x) \\ & =5\end{aligned}

You left out the "new line" code \\ after your &
• Nov 8th 2008, 10:10 AM
Moo
You can also use \hfill in case you want the parts between & & to be aligned to the left.

Another command to align things is \begin{gathered} \end{gathered} :
$\displaystyle \begin{gathered} p \text{ is a prime.} \hfill \\ \text{In } \mathbb{Z}/p \mathbb{Z},~ \forall \overline{n},~ \overline{n}^p-\overline{n}= \prod_{k=0}^{n-1} (\overline{n}-k) \hfill \end{gathered}$
Code:

\begin{gathered} p \text{ is a prime.} \hfill \\ \text{In } \mathbb{Z}/p \mathbb{Z},~ \forall \overline{n},~ \overline{n}^p-\overline{n}= \prod_{k=0}^{n-1} (\overline{n}-k) \hfill \end{gathered}
$\displaystyle \begin{gathered} p \text{ is a prime.} \\ \text{In } \mathbb{Z}/p \mathbb{Z},~ \forall \overline{n},~ \overline{n}^p-\overline{n}= \prod_{k=0}^{n-1} (\overline{n}-k) \end{gathered}$
Code:

\begin{gathered} p \text{ is a prime.} \hfill \\ \text{In } \mathbb{Z}/p \mathbb{Z},~ \forall \overline{n},~ \overline{n}^p-\overline{n}= \prod_{k=0}^{n-1} (\overline{n}-k) \end{gathered}
(without \hfill)
• Nov 8th 2008, 10:16 AM
Mathstud28
\displaystyle \begin{aligned}\int{f(x)g(x)}dx&\\ =f(x)+200g(x)&\\ =5 \end{aligned}

How do I get them lined up correctly?

Code:

\begin{aligned}\int{f(x)g(x)}dx&\\ =f(x)+200g(x)&\\ =5 \end{aligned}
• Nov 8th 2008, 10:37 AM
o_O
The &'s help you align them. Play around with them and you should be able to catch on:

\displaystyle \begin{aligned} & \int{f(x)g(x)}dx \\ & = f(x)+200g(x) \\ & = 5 \end{aligned}

Code:

\begin{aligned} & \int{f(x)g(x)}dx \\ &  =  f(x)+200g(x) \\ & = 5 \end{aligned}
__________________________________________________ ____

\displaystyle \begin{aligned} \int{f(x)g(x)}dx & = f(x)+200g(x) \\ & = 5 \end{aligned}

Code:

\begin{aligned} \int{f(x)g(x)}dx & = f(x)+200g(x) \\ & = 5 \end{aligned}
• Nov 8th 2008, 11:03 AM
Mathstud28
\displaystyle \begin{aligned} A_n&=\int{f(x)g(x)}dx\\ &=f(x)+200g(x)\\ &=5\\ &=4+1\\ &=\frac{5!}{4!}\\ &=\frac{\int_0^{\infty}t^5e^{-t}dt}{\int_0^{\infty}t^4e^{-t}dt} \end{aligned}
Thank you