1

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?

  • 3
    it would be centred by default, you presumably have fleqn option or a non standard class in use. – David Carlisle Jul 2 '16 at 13:31
  • 3
    You should post a fully compilable code that produces this result (document class, packages and options thereof). – Bernard Jul 2 '16 at 13:32
3

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}
  • isn't e very different from exp? e is the number 2,718…, while exp would be an general exponent, albeit a rather unusual way of writing it. I am, however, not a mathematician, so I could very well be wrong here. – Runar Jul 2 '16 at 14:07
  • 1
    @RunarTrollet - I'm not a mathematician either, but I've taken a fair number of math courses over the years. The only sensible base for the \exp expression is, you guessed it, e\approx 2.718. The reason I recommend \exp is typographic: the elements \beta, x, \sum, - and + will by typeset in scriptstyle rather than scriptscriptstyle -- much appreciated by anyone over 45 (or otherwise not blessed with keen eyesight of youth). – Mico Jul 2 '16 at 14:13
  • 2
    You are perfectly correct, I have just never seen it written in that way, but you do make a very good case. I also found an interesting post on Math.SE, about this very topic. math.stackexchange.com/questions/1226089/is-expx-the-same-as-ex – Runar Jul 2 '16 at 14:26
  • @RunarTrollet - Correction to what I wrote earlier: Most of the material in the denominator of the second equation is rendered in textstyle, not scriptstyle. (The subscript and superscript terms in the second version of the equation are in scriptstyle, whereas they are in scriptscriptstyle in the first version.) Either way, the size difference is rather significant. – Mico Jul 2 '16 at 14:43
  • @Ana - Please confirm or disconfirm my conjecture that you were specifying the option fleqn in your document. – Mico Jul 2 '16 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.