0

I am not an expert with equations on latex. I have wrote these ones within a chapter of a book, but I missed how to write the label on the left with the equation number. Moreover, the text after the equations is italic for a couples of lines and I did not find the way to fix it. What is wrong?

(Edit with suggestions proposed)

\documentclass[a4paper,11pt,  twoside, openright]{book}
\usepackage[T1]{fontenc}                
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[a4paper,top=3.5cm,bottom=3cm,left=3cm,right=3cm]{geometry}
\usepackage{fancyhdr}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{caption}
\captionsetup{font=small}
\usepackage{topfront}
\usepackage{emptypage}
\usepackage{natbib, authoryear}
\graphicspath{figure}
\usepackage{longtable}
\usepackage{chngcntr}
\usepackage{rotating}
\usepackage{mathtools}
\usepackage{textgreek}
\usepackage{hyperref}

\begin{document}

yi \in Y_{i} \sim mathrm{Multinom}(\pi^1_i , \pi^2_i , \pi^3_i ) 
\pi^k_i = \frac{exp(\eta^k_i)} {1+ \exp(\eta^2i) + exp(\eta^3i)}\hfill     k= 1,...,3

\eta^k_i = ln(\frac{\pi^k_i }{\pi^1_i}) = \beta^k_0 + x_i_1\beta^k_1 +    \sum^11_{j_=_3 } x_i_j\beta^k_j \hfill k= 2,3
\eta^1_i = 0 

some text which is italic
\end{document}

i have not solved the issue substituing with $\pi$

ggg
  • 37
  • if you get a tex error then you should ask about the error message (the pdf output after any error isn't designed for use,it may possibly be useful for debugging but nothing else) – David Carlisle Oct 23 '18 at 17:37
  • You need to start the math mode with (for example) \[ and end it with \] (and remove the \bigskip) also exp should be \exp and Multinom should be \mathrm{Multinom} – David Carlisle Oct 23 '18 at 17:39
  • @DavidCarlisle you mean i have to add [ and ] for each line or just once at the beginning and at the end of the equations?thank you – ggg Oct 23 '18 at 17:40
  • 1
    really you should start with a basic tutorial on latex, as there are so many errors here in so few lines... I'll post something as an answer too long for a comment. – David Carlisle Oct 23 '18 at 17:41
  • @DavidCarlisle thank you, i read a lot about equations but still i was not able to solve the problem – ggg Oct 23 '18 at 17:42
  • surely anything you read must have told you that math expressions need to be in a math environment \[ or equation or align etc. – David Carlisle Oct 23 '18 at 17:50
  • @ggg: Fundamentally your problem is solved when placing the math content in a math environment ($...$, \[...\], \begin{equation}...\end{equation}, ...). Of course, the use of a math environment depends on what you're wanting to display and how. For example, you may need an align environment to stack equations on top of one another and have them aligned at some horizontal mark, but that's a different question than what you asked here... – Werner Oct 23 '18 at 19:11
  • @Werner do you mean one among the three options($...$, [...], \begin{equation}...\end{equation}, ... or all of them? – ggg Oct 23 '18 at 19:34
  • @ggg: One of them, but it depends on the output you're after. Each has their own place - $...$ for in-line, text-style math; \[...\] for single-line display-style math without an equation number, \begin{equation}...\end{equation} for single-line display-style math with an equation number, \begin{align}...\end{align} (and others) for multi-line display-style math with/without equation numbers... – Werner Oct 23 '18 at 19:43

1 Answers1

3

enter image description here

I had to take some guesses as to the intended meaning in some cases...

\documentclass[a4paper,11pt,  twoside, openright]{book}
\usepackage[T1]{fontenc}                
\usepackage[utf8]{inputenc}

\usepackage{mathtools}

\DeclareMathOperator\Multinom{Multinom}

\begin{document}

some text
\begin{equation}
yi \in Y_{i} \sim \Multinom(\pi^1_i , \pi^2_i , \pi^3_i ) 
\end{equation}

some more text ${x_i}_1$ ?? $\sum^1$ ???
\begin{align}
\pi^k_i &= \frac{\exp(\eta^k_i)} {1+ \exp(\eta^2i) + \exp(\eta^3i)}  &&  k= 1,\dots,3\\
\eta^k_i &= \ln(\frac{\pi^k_i }{\pi^1_i}) = \beta^k_0 + x_{i1}\beta^k_1 +    \sum^11_{j=3 } x_{ij}\beta^k_j &&k= 2,3\\
\eta^1_i &= 0 
\end{align}

some text which is italic
\end{document}
David Carlisle
  • 757,742
  • Thank you very much. This solved all the issues but not the one of italic. could it be because i'm using texshop on a mac? just a couple of questions: there is a way to left align the first equation? and can i used just one numbered label for all this lines (instead of a number for each line)? – ggg Oct 23 '18 at 18:12
  • 1
    @ggg you can left align everything by using fleqn option on \documentclass and you can replace align by \begin{equation}\begin{aligned}...\end{aligned}\end{equation} if you want a single number. If you need more help then ask a new question not comments under an existing answer, but please take some time to read the amsmath user guile (amsldoc.pdf) first, there are many examples of all these things. – David Carlisle Oct 23 '18 at 18:16