# [Tex/LaTex] New to TeX; issue with compiling

errorsfractionsmath-mode

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}


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.

You won't be needing one big math environment for this. Further, it is a good idea to use siunitx package for typesetting your units. Here is a sample:

\documentclass[]{scrreprt}
\usepackage{amsmath}
\usepackage[per-mode=symbol,detect-weight]{siunitx}
\DeclareSIUnit{\inHg}{inHg}
\DeclareSIUnit{\mmHg}{mmHg}
\begin{document}
\noindent
Molar Mass of Nitrogen\\
Bulb Volume: $\SI{13.7}{\centi\meter^{3}} = \SI{0.2317}{\litre}$\\
Internal bulb pressure: $\SI{0}{\inHg} = \SI{508}{\mmHg} = \SI{0.508}{\bar}$\\
Temperature: \SI{294.2}{\kelvin}\\[0.5\baselineskip]
$M = \dfrac{\rho}{P}RT$ \\[0.5\baselineskip]
$\rho = \dfrac{\SI{0.158}{\gram}}{\SI{0.2137}{\litre}} = \SI{0.739}{\gram\per\litre}$ \\[0.5\baselineskip]
$M = \dfrac{\SI{0.739}{\gram\per\litre}}{\SI{0.508}{\bar}} * \SI{0.083144}{\litre\bar\per\mole\per\kelvin} * \SI{294.2}{\kelvin} = \SI{35.6}{\gram\per\mol}$\\[0.5\baselineskip]
Calculation of Volume by van der Waals Equation with Successive Approximations \\[0.5\baselineskip]
$V = \dfrac{nRT}{P + \dfrac{n^{2}a}{V^{2}}} + nb$\\[0.5\baselineskip]
$a = \SI{1.408}{\square\litre\bar\per\mol^{2}}$\\[0.5\baselineskip]
$b = \SI{0.03913}{\litre}$\\[0.5\baselineskip]
$V \approx \dfrac{nRT}{P} + nb \approx \dfrac{nRT}{P}$\\[0.5\baselineskip]
$n = \dfrac{m}{M} = \dfrac{\SI{0.158}{\gram}}{\SI{21.35}{\gram\per\mol}} = 7.4*10^{-3}\si{\mol}$\\[0.5\baselineskip]
$V = \dfrac{7.4*10^{-3}\si{\mol} * \SI{0.083144}{\litre\bar\per\mol\per\kelvin} * \SI{0294.2}{\kelvin}}{\SI{0.508}{\bar}} = \SI{0.2138}{\litre}$\\[0.5\baselineskip]
\begin{flalign*}
V &= \dfrac{7.4*10^{-3}\si{\mol} * \SI{0.083144}{\litre\bar\per\mol\per\kelvin} * \SI{294.2}{\kelvin}}{\SI{0.508}{\bar}}&& \\
& \quad + \dfrac{(7.4*10^{-3}\si{\mol})^{2}* \SI{1.408}{\square\litre\bar\per\square\mol}} {(\SI{0.2138}{\litre})^{2} + 7.4*10^{-3}\si{\mol} * \SI{0.03913}{litre}} &&\\
&= \SI{0.2137}{\litre}
\end{flalign*}
\end{document}


For details you can texdoc mathmode texdoc amsldoc and texdoc siunitx from the terminal.

As a side note, I would also use \cdot or \times to show multiplication, but not *. This, I didn't change in the above example.