[Tex/LaTex] 0: file ended while scanning use of \@genfrac

kiletex-core

The code is here

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{equation}
  \begin{array}{ll}
    \hat{\mu_1}&=\dfrac{\sum_{i=1}^nX_{i,1}}{n}\\
    \hat{\mu_2}&=\dfrac{\sum_{i=m+1}^nX_{i,2}}{n-m}\\
    \hat{\sigma_1^2}&=\dfrac{\sum_{i=1}^n(X_{i,1}-\hat{\mu_1})^2}{n}\\
    \hat{\sigma_2^2}&=\dfrac{\sum_{i=m+1}^n(X_{i,2}-\hat{\mu_2})^2}{n-m}\\  
    \hat{p}&=\dfrac{\sum_{i=m+1}^n(X_{i,1}-\hat{\mu_1})(X_{i,2}-\hat{\mu_2})}{n-m}
  \end{array}
\end{equation}

\end{document}

I try to reproduce the problem,and check whether missing bracket.But the error is still there.

Best Answer

The error message you mention is triggered by a missing closing brace in \dfrac (or one of its variants), as the following simple example illustrates:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\dfrac{a}{b$
\end{document}

Processing the above document yields

Runaway argument?
{b$ \end {document} 
! File ended while scanning use of \@genfrac.
<inserted text> 
                \par 
<*> a.tex

The solution is to add the missing brace:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$\dfrac{a}{b}$
\end{document}