[Tex/LaTex] How to center equations

equations

My code is:

onde
\begin{equation}
\pi(\textbf{x})=\frac{1}{1+e^{-(\beta_0+\sum_{i=1}^{p}\beta_ix_i)}}
\end{equation}

enter image description here

How can I put the equation in the middle?

Best Answer

I can more or less reproduce your screenshot with the following code (observe that the amsmath package is loaded with the option fleqn):

enter image description here

\documentclass{book}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage[fleqn]{amsmath}
\begin{document}
\setcounter{chapter}{2}
\setcounter{equation}{1}

\noindent
onde,
\begin{equation}
\pi(\textbf{x})=\frac{1}{1+e^{-(\beta_0+\sum_{i=1}^{p}\beta_ix_i)}}
\end{equation}
\end{document}

If you want to have the displayed equations centered rather than left-justified, don't specify the fleqn option while loading amsmath.

Separately, you should use \mathbf rather than \textbf in math mode. Also, do consider using \exp[...] notation instead of e^{...}; your readers will thank you.

enter image description here

\documentclass{book}
\usepackage[a4paper,margin=2.5cm]{geometry}
\usepackage{amsmath}
\begin{document}
\setcounter{chapter}{2}
\setcounter{equation}{1}

\noindent
onde,
\begin{equation}
\pi(\mathbf{x})=\frac{1}{1+\exp[-(\beta_0+\sum_{i=1}^p \beta_ix_i)]}
\end{equation}
\end{document}