# How do you center equations?

I can't seem to center equations without causing some weird formatting problem. The following results in the R being dropped:

\begin{center}
E(R_{i,t})=E(\alpha_i)+E(\beta_{i,F_1 } F_{1,t})+E(\beta_{i,F_2 } F_{2,t})+\ldots+E(\beta_{i,F_m } F_{m,t})\linebreak
\bar{R}_{i,t}=a+\hat{\beta}_{i,F_1 } E(F_{1,t})+\hat{\beta}_{i,F_2 } E(F_{2,t})+\ldots+\hat{\beta}_{i,F_m } E(F_{m,t})\linebreak
\bar{R}_{i,t}=a+\gamma_1\hat{\beta}_{i,F_1 } +\gamma_2\hat{\beta}_{i,F_2 } F_{2,t}+\ldots+\gamma_m\hat{\beta}_{i,F_m }
\end{center}


Any ideas? Is {center} the wrong thing to use?

-
Equations in displayed math environments are centered by default, See, e.g., $2+2=4$. Are you using the fleqn option to your document class? Please edit your question to show a complete minimal document. Besides document class options, it's isn't clear what math environment the above occurs in (if any!) But, yes \begin{center} ... \end{center} is definitely the wrong thing to use. – frabjous Jan 7 '11 at 3:46

For a series of centered equations use the gather environment of amsmath:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{gather*}
E(R_{i,t})=E(\alpha_i)+E(\beta_{i,F_1 } F_{1,t})+E(\beta_{i,F_2 } F_{2,t})+
\ldots+E(\beta_{i,F_m } F_{m,t})\\
\bar{R}_{i,t}=a+\hat{\beta}_{i,F_1 } E(F_{1,t})+\hat{\beta}_{i,F_2 } E(F_{2,t})+
\ldots+\hat{\beta}_{i,F_m } E(F_{m,t})\\
\bar{R}_{i,t}=a+\gamma_1\hat{\beta}_{i,F_1 } +\gamma_2\hat{\beta}_{i,F_2 } F_{2,t}+
\ldots+\gamma_m\hat{\beta}_{i,F_m }
\end{gather*}
\end{document}


Instead of centering you may consider to align all equations at the equal sign and center the whole multiline environment. For this, use the align or align* environment, see the amsmath user's guide (or type texdoc amsldoc at the command prompt).

In any case, use amsmath. That package provides many kinds of multiline diplayed formula environments.

-
how do I have single equation number exactly in the middle? I don't want to use \nonumber' – John Smith Jan 7 '13 at 2:48
@JohnSmith Use an equation environment, within that use an aligned or split environment. – Stefan Kottwitz Jan 7 '13 at 6:56
I tried that before but with aligned or split within equation environment the equations are aligned to the right. I want centering+single equation number. Any ideas? – John Smith Jan 7 '13 at 8:29
@JohnSmith With aligned or split use & for marking an alignment position (relation symbol). For centering, use gathered within equation. – Stefan Kottwitz Jan 7 '13 at 9:20

The center environment is for text, not math. What you want here is (this also lines up the equals signs):

\begin{align*}
E(R_{i,t})    &= E(\alpha_i)+E(\beta_{i,F_1 } F_{1,t})+E(\beta_{i,F_2 } F_{2,t})+\ldots+E(\beta_{i,F_m } F_{m,t}) \\
\bar{R}_{i,t} &= a+\hat{\beta}_{i,F_1 } E(F_{1,t})+\hat{\beta}_{i,F_2 } E(F_{2,t})+\ldots+\hat{\beta}_{i,F_m } E(F_{m,t}) \\
\bar{R}_{i,t} &= a+\gamma_1\hat{\beta}_{i,F_1 } +\gamma_2\hat{\beta}_{i,F_2 } F_{2,t}+\ldots+\gamma_m\hat{\beta}_{i,F_m }
\end{align*}


You need the amsmath package for align*, so make sure you have the line \usepackage{amsmath} in your preamble (before \begin{document}`).

-
Thanks dude. This is perfect. – Vish Jan 10 '11 at 3:27