6

I want to write this equation in LaTeX:

q1 = (Number of women who had their second birth in 1971) / ((Number of women who had their first birth in 1970) - (Number of women who had their second birth in 1970))

This my LaTeX code for the equation:

\begin{equation} \nonumber
 q^*_1  =\frac{\text{number of women who had their second birth in 1971}}{\text{number of women who had their first birth in 1970 \textbf{-} number of women had their second birth in 1970}}
  \end {equation}

How can write the denominator as given in the picture?

5 Answers5

11

A simple way is to use array for the denominator

\begin{equation} \nonumber
 q^*_1  =\frac{\text{number of women who had their second birth in 1971}}{
 \begin{array}{c}
   \text{number of women who had}\\
    \text{their first birth in 1970} 
 \end{array}
 -
 \begin{array}{c}
   \text{number of women who had}\\
    \text{their second birth in 1970} 
 \end{array}
 }
  \end{equation}  
Guido
  • 30,740
  • 5
    @statistician, there is a green check-mark-style button next to the question. And while seems that you tested/prefer/like this answer... you should click this button to accept the answer and to not leave your question be shown as a question that didn't found a good enough answer. – koleygr Mar 15 '19 at 20:24
8

I'd define a suitable notation, avoiding long verbal descriptions. I also added the verbose version, but adding parentheses for clarity.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

Let's denote by $W(n,y)$ the number of women who had their $n$th~birth
in the year~$y$. Then
\begin{equation*}
q^*_1 = \frac{W(2,1971)}{W(1,1970)-W(2,1970)}
\end{equation*}
We can also typeset this with words, but it comes out quite awful
unless we add parentheses
\begin{equation*}
q^*_1 =
\frac{
  \text{number of women who had their second birth in 1971}
}{
  \Bigl(
  \begin{tabular}{c}
  number of women who had \\
  their first birth in 1970
  \end{tabular}
  \Bigr)
  -
  \Bigl(
  \begin{tabular}{c}
  number of women who had \\
  their second birth in 1970
  \end{tabular}
  \Bigr)
}
\end{equation*}

\end{document}

enter image description here

Using equation* avoids the need for \nonumber.

egreg
  • 1,121,712
  • 4
    +1. That said, I prefer the verbose version unless you need the values of $W$ often elsewhere. (Differing with @egreg is rare on $\TeX$ SE.) – Ethan Bolker Mar 16 '19 at 12:37
6

An approach with parbox

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


\begin{equation} \nonumber
 q^*_1  =\frac{\text{number of women who had their second birth in 1971}}{\text{\parbox{4.5cm}{\centering number of women who had their first birth in 1970}} - \text{\parbox{4cm}{\centering number of women had their second birth in 1970}}}
  \end {equation} 

\end{document}

Of course the lengths could be different to fit your sizes...

koleygr
  • 20,105
5

Here is a competety different approach using variables instead of the text:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
  q^*_1  &=\frac{A}{B-C}  \\
  \text{where}~A &= \text{number of women who had their second birth in 1971} \\
               B &= \text{number of women who had their first birth in 1970} \\
               C &= \text{number of women who had their second birth in 1970} \\
\end{align*}  
\end{document}

enter image description here

For a horizontally centered equation one could use something like the following:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
  q^*_1  =\frac{A}{B-C} \nonumber
\end{equation} 
\begin{align*}
  \text{where}~A &= \text{number of women who had their second birth in 1971} \\
               B &= \text{number of women who had their first birth in 1970} \\
               C &= \text{number of women who had their second birth in 1970} \\
\end{align*}
\end{document}

enter image description here

leandriis
  • 62,593
  • 2
    I think you should declare the variables outside the align environment... or add this possibility as separate code in case the the equation should be centered or numbered etc. (+1) -for the answers before and after mine- and (-1) -if I could- to the down-voter who didn't even left a comment to a newcomer that at least provided some code – koleygr Mar 15 '19 at 19:36
  • 2
    @koleygr: Thanks for your suggestion. I have added another suggestion on how to achieve a horizontally centered equation. – leandriis Mar 15 '19 at 19:52
5

Just to throw in an alternative layman's view

\documentclass{standalone}
\usepackage{amsmath}
\begin{document}\huge
$q^*_1 =  \text{number of women who had their (} \frac {2^{nd}\text{ birth in 1971}} {1^{st}\text{ birth in 1970}~-~ 2^{nd}\text{ birth in 1970}}$)
\end{document}

  • 2
    Mathematically the abstraction of 1st birth -2nd berth of a woman are minus the years lived before give a birth! (+1 mostly for the imagination part of your solution) – koleygr Mar 15 '19 at 21:45
  • 2
    @koleygr I'm no mathmagician (only a very very poor TeXnician hence the Layman's tag line –  Mar 15 '19 at 21:48
  • 2
    My comment is just humor since means that a woman's second birth is when she is giving a birth (and these is a sentence with the female psychology of my male nature)... I never heard layman's low before... but thanks for noticing (learned something new). Goodnight and happy TeXing! – koleygr Mar 15 '19 at 21:54