1

I have a problem with multline command when I would like to handle long equation here is the code:

\begin{multline}
 \gamma(w_{i-1}, ..., w_{i-n+1}) = \frac{D_{1} N_{1}(w_{i-1}^{w_{i-n+1}} w') +   D_{2} N_{2}(w_{i-1}, ..., w_{i-n+1} w')    
\\ +  D_{3_{+}} N_{3_{+}}(w_{i-1}, ..., w_{i-n+1} w')                 }{\sum_{w_{i}}N(w_{i} ...w_{i-n+1}^{i})}
\end{multline}

the error is: extra "}"

But I dont find the mistake

Can you help me please?

Thank you

Kola B.
  • 690
Bio
  • 113
  • Welcome to TeX.SE! As far as I can see, you have fraction over two line. This is not allowed. And please, instead of code fragment provide complete, minimal (non)working example (MWE) which start with \documentclass{...} and end with \end{document}. With this you will help to people who like to help you ... – Zarko Jun 12 '16 at 07:46
  • Possibly related: http://tex.stackexchange.com/questions/186959/error-with-multline-but-not-equation?rq=1 – Richard Jun 12 '16 at 07:49

2 Answers2

4

I guess that you looking for something like this:

enter image description here

For this is used macro \splitfrac{...}{...} from package mathtools:

\documentclass{article}
\usepackage{mathtools}
\usepackage{geometry}

\begin{document}
\begin{equation}
\gamma(w_{i-1},\dots,w_{i-n+1})
    = \dfrac{\splitfrac{D_{1} N_{1}(w_{i-1}^{w_{i-n+1}} w') 
                        + D_{2} N_{2}(w_{i-1},\dots,w_{i-n+1} w')}   
                      { + D_{3_{+}} N_{3_{+}}(w_{i-1},\dots,w_{i-n+1} w')}
           }{\sum_{w_{i}}N(w_{i},\dots,w_{i-n+1}^{i})}
\end{equation}
\end{document}
Zarko
  • 296,517
1

Following up on egreg's answer here, the issue seems to be that you can't split lines in the middle of the numerator. (Though I'm making some assumptions on documentclass here...) Here's one possible fix, since the denominator is relatively short:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{multline}
  \gamma(w_{i-1}, ..., w_{i-n+1}) =
  \frac{1}{{\sum_{w_{i}}N(w_{i} ...w_{i-n+1}^{i})}} \Bigl(
  D_{1} N_{1}(w_{i-1}^{w_{i-n+1}} w') + \\ 
  D_{2} N_{2}(w_{i-1}, ..., w_{i-n+1} w') +
  D_{3_{+}} N_{3_{+}}(w_{i-1}, ..., w_{i-n+1} w')\Bigr)
\end{multline}

\end{document} 
Richard
  • 2,084