File ended while scanning use of frac ошибка

The main issue is that you mustn’t have blank lines in an equation environment — or any display-math environment, for that matter.

An additional concern: If you use Times Roman as the text font, you should probably also load a Times Roman math font. The mathptmx and newtxtext/newtxmath packages may be suitable.

enter image description here

\documentclass[12pt]{report}
\usepackage[doublespacing,nodisplayskipstretch]{setspace}
\usepackage{newtxtext,newtxmath} % Times Roman text and math fonts
\usepackage[vmargin=3cm, left=4cm, right=2cm]{geometry}
\usepackage{graphicx}
\usepackage{amsmath,amssymb}

% For tighter spacing around \left/\right pairs of parentheses:
\usepackage{mleftright}  \mleftright 

\begin{document}
\begin{equation} \label{eq2}
\frac{\partial N}{\partial t}+\frac{\partial}{\partial x}\left(\frac{MN}{D}\right)
 +\frac{\partial}{\partial y}\left(\frac{N^2}{D}\right)+ gD\frac{\partial z}{\partial y}
 +\frac{\tau_{y}}{p}=0
\end{equation}

\end{document}

I am unable to generate the error message you say you’re getting. I would like to suggest, though, that you rewrite some of the code to use \left and \right much more sparingly than you do at present. If you compare the LaTeX codes for the first and second groups of equations, you will hopefully agree that the second group’s code is much simpler and easier to read.

A separate comment: The IEEEeqnarray environment is extremely powerful and flexible. However, at present you don’t really seem to be making use of the package’s machinery. You may therefore wish to look into making use of the simpler align environment, which is provided by the amsmath package. As the second and third groups of equations in the following screenshot demonstrate, the output is identical — though, arguably, the syntax of the align environment is simpler.

enter image description here

\documentclass{article}  
\usepackage{IEEEtrantools} % for 'IEEEeqnarray' env.
\usepackage{geometry,amsmath}
\begin{document}

OP's original form
\begin{IEEEeqnarray}{rCl}\label{key1}
E_{k,k}&=&\frac{1}{2}\left[\mathcal{B}_{x}^{\left(e\right)}+
    \mathcal{B}_{y}^{\left(e\right)}\right]J\left(J+1\right)+
    \left(\mathcal{B}_{z}^{\left(e\right)}-\frac{1}{2}
    \left[\mathcal{B}_{x}^{\left(e\right)}+\mathcal{B}_{y}^{\left(e\right)}
    \right]\right)\kappa^{2}  \\
E_{k\pm2,k}&=&\frac{1}{4}[\mathcal{B}_{x}^{(e)}-\mathcal{B}_{y}^{(e)}]
    {[J(J+1)-k(k\pm1)]\times[J(J+1)-k(k\pm1)(k\pm2)]}^{\frac{1}{2}}
\end{IEEEeqnarray}

\bigskip
Suggested edits
\begin{IEEEeqnarray}{rCl}\label{key2}
E_{k,k}&=& \tfrac{1}{2}
    [\mathcal{B}_{x}^{(e)}+\mathcal{B}_{y}^{(e)}]J(J+1)
    +\bigl( \mathcal{B}_{z}^{(e)} -\tfrac{1}{2}
    [\mathcal{B}_{x}^{(e)}+\mathcal{B}_{y}^{(e)}]
    \bigr)\kappa^{2}  \\
E_{k\pm2,k}&=& \tfrac{1}{4}
    [\mathcal{B}_{x}^{(e)}-\mathcal{B}_{y}^{(e)}]
    [J(J+1)-k(k\pm1)]\times
    \bigl[J(J+1)-k(k\pm1)(k\pm2)\bigr]^{1/2}
\end{IEEEeqnarray}

\bigskip
Solution that uses an \texttt{align} environment
\begin{align}\label{key3}
E_{k,k} &= \tfrac{1}{2}
    [\mathcal{B}_{x}^{(e)}+\mathcal{B}_{y}^{(e)}]J(J+1)
    +\bigl( \mathcal{B}_{z}^{(e)} -\tfrac{1}{2}
    [\mathcal{B}_{x}^{(e)}+\mathcal{B}_{y}^{(e)}]
    \bigr)\kappa^{2}  \\
E_{k\pm2,k} &= \tfrac{1}{4}
    [\mathcal{B}_{x}^{(e)}-\mathcal{B}_{y}^{(e)}]
    [J(J+1)-k(k\pm1)]\times
    \bigl[J(J+1)-k(k\pm1)(k\pm2)\bigr]^{1/2}
\end{align}
\end{document}

I am unable to generate the error message you say you’re getting. I would like to suggest, though, that you rewrite some of the code to use \left and \right much more sparingly than you do at present. If you compare the LaTeX codes for the first and second groups of equations, you will hopefully agree that the second group’s code is much simpler and easier to read.

A separate comment: The IEEEeqnarray environment is extremely powerful and flexible. However, at present you don’t really seem to be making use of the package’s machinery. You may therefore wish to look into making use of the simpler align environment, which is provided by the amsmath package. As the second and third groups of equations in the following screenshot demonstrate, the output is identical — though, arguably, the syntax of the align environment is simpler.

enter image description here

\documentclass{article}  
\usepackage{IEEEtrantools} % for 'IEEEeqnarray' env.
\usepackage{geometry,amsmath}
\begin{document}

OP's original form
\begin{IEEEeqnarray}{rCl}\label{key1}
E_{k,k}&=&\frac{1}{2}\left[\mathcal{B}_{x}^{\left(e\right)}+
    \mathcal{B}_{y}^{\left(e\right)}\right]J\left(J+1\right)+
    \left(\mathcal{B}_{z}^{\left(e\right)}-\frac{1}{2}
    \left[\mathcal{B}_{x}^{\left(e\right)}+\mathcal{B}_{y}^{\left(e\right)}
    \right]\right)\kappa^{2}  \\
E_{k\pm2,k}&=&\frac{1}{4}[\mathcal{B}_{x}^{(e)}-\mathcal{B}_{y}^{(e)}]
    {[J(J+1)-k(k\pm1)]\times[J(J+1)-k(k\pm1)(k\pm2)]}^{\frac{1}{2}}
\end{IEEEeqnarray}

\bigskip
Suggested edits
\begin{IEEEeqnarray}{rCl}\label{key2}
E_{k,k}&=& \tfrac{1}{2}
    [\mathcal{B}_{x}^{(e)}+\mathcal{B}_{y}^{(e)}]J(J+1)
    +\bigl( \mathcal{B}_{z}^{(e)} -\tfrac{1}{2}
    [\mathcal{B}_{x}^{(e)}+\mathcal{B}_{y}^{(e)}]
    \bigr)\kappa^{2}  \\
E_{k\pm2,k}&=& \tfrac{1}{4}
    [\mathcal{B}_{x}^{(e)}-\mathcal{B}_{y}^{(e)}]
    [J(J+1)-k(k\pm1)]\times
    \bigl[J(J+1)-k(k\pm1)(k\pm2)\bigr]^{1/2}
\end{IEEEeqnarray}

\bigskip
Solution that uses an \texttt{align} environment
\begin{align}\label{key3}
E_{k,k} &= \tfrac{1}{2}
    [\mathcal{B}_{x}^{(e)}+\mathcal{B}_{y}^{(e)}]J(J+1)
    +\bigl( \mathcal{B}_{z}^{(e)} -\tfrac{1}{2}
    [\mathcal{B}_{x}^{(e)}+\mathcal{B}_{y}^{(e)}]
    \bigr)\kappa^{2}  \\
E_{k\pm2,k} &= \tfrac{1}{4}
    [\mathcal{B}_{x}^{(e)}-\mathcal{B}_{y}^{(e)}]
    [J(J+1)-k(k\pm1)]\times
    \bigl[J(J+1)-k(k\pm1)(k\pm2)\bigr]^{1/2}
\end{align}
\end{document}

Related videos on Youtube

LaTeX Tutorial 7 - Errors and Debugging

07 : 32

LaTeX Tutorial 7 — Errors and Debugging

Well Stimulation: The Process of Hydraulic Fracturing

03 : 35

Well Stimulation: The Process of Hydraulic Fracturing

Groundtech Discovery - 3D Ground Scanner - English usage video

30 : 17

Groundtech Discovery — 3D Ground Scanner — English usage video

Hydraulic Fracturing Course 1/3

01 : 03 : 15

Hydraulic Fracturing Course 1/3

Introduction to Hydraulic Fracturing (ENG)

01 : 16 : 10

Introduction to Hydraulic Fracturing (ENG)

Comments

  • I’m sure I made a mistake here somewhere, which didn’t allow me to compile the PDF file in order to see what I’m doing. Sure enough, I’ve been looking at the \frac, trying to catch some rule violation, but there seems to be none! If you wish to contribute to make this equation beautiful, that helps too!

    \begin{IEEEeqnarray}{rCl}
    \label{key}
    E_{k,k}&=&\frac{1}{2}\left[\mathcal{B}_{x}^{\left(e\right)}
        +\mathcal{B}_{y}^{\left(e\right)}\right]J\left(J+1\right)
        +\left(\mathcal{B}_{z}^{\left(e\right)}-\frac{1}{2}
      \left[\mathcal{B}_{x}^{\left(e\right)}
           +\mathcal{B}_{y}^{\left(e\right)}\right]\right)\kappa^{2}  \\
    E_{k\pm2,k}&=&\frac{1}{4}[\mathcal{B}_{x}^{(e)}-\mathcal{B}_{y}^{(e)}]
        {[J(J+1)-k(k\pm1)]\times[J(J+1)-k(k\pm1)(k\pm2)]}^{\frac{1}{2}}
    \end{IEEEeqnarray}
    

    • Put this snippet in a small document with your preamble and no other text in the body. If it shows the error you can post this complete test document (try to shorten the preamble), if not the error is somewhere else.

    • I have no problem except the second line is too long.

    • Welcome to TeX.SX! Could you add a minimal working example (MWE), that illustrates your problem? Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass and ending with \end{document}.

    • That’s because you’ve forgotten «}»!!!

Recents

Related

I keep getting the compiling error >file ended while scanning use of \frac. I can’t see any missing {}, so I’m not sure what to do.

\documentclass[]{scrreprt}
\usepackage{geometry}
\begin{document}

Molar Mass of Nitrogen
\begin{math}
\\ Bulb Volume: 213.7 cm^{3} = .2317 L
\\ Internal bulb pressure: 20 inHg = 508 mmHg = .508 bar
\\ Temperature: 294.2 K
\\ M = \frac{\rho}{P}RT
\\ \rho = \frac{.158 g}{.2137 L} = .739\frac{g}{L}
\\ M = \frac{.739 \frac{g}{L}}{.508 bar} * .083144 \frac{L*bar}{mol*K} * 294.2 K = 35.6 \frac{g}{mol}

\\ Calculation of Volume by van der Waals Equation with Successive Approximations
\\ V = \frac{nRT}{P + \frac{n^{2}a}{V^{2}}} + nb
\\ a = 1.408 \frac{L^{2}*bar}{mol^{2}}
b = .03913 L
\\ V \approx \frac{nRT}{P} + nb \approx \frac{nRT}{P}
\\ n = \frac{m}{M} = \frac{.158 g}{21.35 \frac{g}{mol}} = 7.4*10^{-3} mol
\\ V = \frac{7.4*10^{-3} mol * .083144 \frac{L*bar}{mol*K} * 294.2 K}{.508 bar} = .2138 L
\\ V = \frac{7.4*10^{-3} mol * .083144 \frac{L*bar}{mol*K} * 294.2 K}{.508 bar + \frac{(7.4*10^{-3} mol)^{2}*1.408 \frac{L^{2}*bar}{mol^{2}}} {(.2138 L)^{2}} + 7.4*10^{-3} mol * .03913 L = .2137 L
\end{math}
\end{document}          

EDIT: This is for a calculations addendum to an undergraduate chemistry lab. I figured it would be worth the time investment to learn laTeX. It’s already significantly faster to do calculations in it than word, if only I can get around these compiling errors.

Relevant log text:

Runaway argument? {.508 bar + \frac {(7.4*10{-3} mol){2}*1.408 \frac {L{2}*bar}{mol\ETC. >! File ended while scanning use of \frac.

Latex Error: File ended while scanning use of \frac

Solution:

When marking important points, \frac{}, one missing}.

Similar Posts:

  • Latex common errors summary and Solutions
  • Latex: “missing $inserted” solution
  • LaTex Error:Unknown graphics extension:.eps (la…
  • [Solved] Springboot Start main program service error: required a single, but 2 were found
  • [Solved] was server Upgrade log4j to 2.17.0 error
  • Install texlive 2018 in Ubuntu and complete macro package update (some screenshots and code are 2016 version)
  • Text (latex) output PDF setting us letter or letter paper method
  • Python—— EOL while scanning string literal
  • Solutions for scanning for working copies

Понравилась статья? Поделить с друзьями:
  • File pro ошибка при установке
  • File not found exception ошибка
  • File is not a database ошибка
  • File has vanished rsync ошибка
  • File crc error ошибка при распаковке