# a logit equation

I am trying to create a logit equation for my paper. I have 12 covariates and thus shortened the equation. With the code below makes a equation number appear below my equation and not on the right side of it. Any help with making this equation more presentable will be greatly appreciated.

Thank You.

\newline
$$\begin{math} \tiny{Pr}(\text{Vote} = 1 | \text{S, P, I}) &= \frac{\text{exp}(\beta_0 + \beta_1 \text{Gender} + \beta_2 \text{Age} + ... \beta_12 \text{immigration)} }{1 + \text{exp}(\beta_0 + \beta_1 \text{Gender} + \beta_2 \text{Age} +... \beta_12 \text{immigration})} \label{eq:glm1} \end{math}$$

• you must get error messages from  \begin{math} but no one can help make an equation fit the page if you do not show how big the page is, Please make a small (10 or so line) but complete document not just a fragment Jan 1, 2017 at 0:28

\documentclass{article}
\begin{document}
\newline
$$\begin{math} \tiny{Pr}(\text{Vote} = 1 | \text{S, P, I}) &= \frac{\text{exp}(\beta_0 + \beta_1 \text{Gender} + \beta_2 \text{Age} + ... \beta_12 \text{immigration)} }{1 + \text{exp}(\beta_0 + \beta_1 \text{Gender} + \beta_2 \text{Age} +... \beta_12 \text{immigration})} \label{eq:glm1} \end{math}$$
\end{document}


Almost every part of this is in error.

the \newline produces

! LaTeX Error: There's no line here to end.


The \begin{math} produces

! LaTeX Error: Bad math environment delimiter.


as math mode has already been started by equation

\tiny produces

LaTeX Font Warning: Command \tiny invalid in math mode on input line 6.


as size changes are not allowed in math mode

the & produces

 ! Misplaced alignment tab character &.


as you can only have & in alignments not in equation or math environments.

After an error TeX only recovers enough to syntax check the rest of the document, it makes no attempt to make reasonable PDF output.

I also get

! Undefined control sequence.
<argument> \text


but perhaps you had used amsmath

Perhaps

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{multline}
\operatorname{Pr}(\text{Vote} = 1 \mid \text{S, P, I})\\
= \frac{\exp(\beta_{0} + \beta_{1} \text{Gender} + \beta_{2} \text{Age} + \dots +
\beta_{12} \text{immigration)} }{1 + \exp(\beta_{0} + \beta_{1} \text{Gender} + \beta_{2} \text{Age} +
\dots + \beta_{12 }\text{immigration})} \label{eq:glm1}
\end{multline}
\end{document}


note subscripts should be marked as _{...}

• I think the OP probably wanted \beta_{12} either with the meaning twelve, or perhaps more likely one, two Jan 1, 2017 at 0:41
• Mind you, I don't really know either Jan 1, 2017 at 0:42
• Thank you kindly. I tried with 'amsmath' and corrected the errors. However, I am unable to get the number to become subscript that way it reads beta 12 (the 12 in subscript). Jan 1, 2017 at 0:44
• @Rafael As I commented just above you. Indeed it's commonly recommended to always use _{...}, even for one character subscripts (e.g. _{1}), although you can get away without them for one character subscripts. They are essential if you have more than one character Jan 1, 2017 at 0:44
• @Au101 oops didn't notice that, fixed, thanks Jan 1, 2017 at 0:58

Your code was incorrect. One doesn't have to add a math environment inside an equation environment. Also, don't insert a newline before a display equation. For a correct pacing, use \mid instead of | in this context. Finally, don't code Pr a probability: it will appear as the product of ttwo italic variables. Define it as a math operator: it will be typed in roma and have a correct spacing.

I propose two solutions: one consists in reducing the font size before entering the equation environment, the other keeps the normal font size, but displays the equation on two lines, with a \shortintertext command, from mathtools. In this case, needless to load amsmath, since mathtools is an extension thereof.

\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\Prb}{Pr}
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.3pt}

\begin{document}

Text text text tex. More text more text more text more text. More text more text more text more text.More text more text more text more text. More text more text more text more text.

{\small$$\Prb(\text{Vote} = 1 \mid \text{S, P, I}) = \frac{\text{exp}(\beta_0 + \beta_1 \text{Gender} + \beta_2 \text{Age} + ... \beta_{12} \text{immigration)} }{1 + \text{exp}(\beta_0 + \beta_1 \text{Gender} + \beta_2 \text{Age} + ... \beta_{12} \text{immigration})} \label{eq:glm1}$$
}
%%
\begin{gather}
\shortintertext{\quad$\Prb(\text{Vote} = 1 \mid \text{S, P, I}) =$} \frac{\text{exp}(\beta_0 + \beta_1 \text{Gender} + \beta_2 \text{Age} + ... \beta_{12} \text{immigration)} }{1 + \text{exp}(\beta_0 + \beta_1 \text{Gender} + \beta_2 \text{Age} + ... \beta_{12} \text{immigration})} \label{eq:glm2}
\end{gather}
\end{document}


• Happy New Year! @Mico: I promise I'll do my best! This one was particularly rich (about as many unicode-only characters as pips in a mandarin). And – icing on the cake – whereas I recommended to use \mid preferably to|, my editor displayed \mid as | ;o) Jan 1, 2017 at 11:03