# LaTeX math mode error [duplicate]

I have to following code:

\begin{align*}
r^2  = \left[\frac  {23604,7 - \frac{1}{22} \cdot 253 \cdot 1942.5}  {\sqrt{[3795 - \frac{1}{22} \cdot 253^2]  [173348.4 - \frac{1}{22} \cdot 1942.5^2]  }} \right]^2 \\ \\

r^2  = \left[\frac{1265.95}{\sqrt{885.5 \cdot 1834.51}} \right]^2 \\ \\

r^2  = \left[\frac{1265.95}{\sqrt{1624458.2}} \right]^2 \\ \\

r^2  = \left[\frac{1265.95}{1274.54} \right]^2 \\ \\

r^2  = [0.99356]^2 = 0.9866
\end{align*}


and got the error:

! Paragraph ended before \align* was complete.

! Missing \$ inserted.

and a few more...can somebody spot the mistake? :<

-

## marked as duplicate by Werner, Thorsten Donig, karlkoeller, Sean Allred, Andrew SwannNov 3 '13 at 17:12

The align* environment doesn't like blank lines inside. – Thorsten Donig Nov 3 '13 at 16:31
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Nov 3 '13 at 16:32

A recommended solution just for fun!

\documentclass[preview,border=12pt,varwidth]{standalone}% change this line back to your own document class (article)
\usepackage{amsmath}
\begin{document}
\abovedisplayskip=0pt\relax% remove this line in  your production
\begin{align*}
r^2
&= \left(\frac{23604.7 -\frac{1}{22} \cdot 253 \cdot 1942.5}{\sqrt{(3795 -\frac{1}{22} \cdot 253^2)(173348.4 -\frac{1}{22} \cdot 1942.5^2)}}\right)^2 \\
&= \left(\frac{1265.95}{\sqrt{885.5 \cdot 1834.51}} \right)^2 \\
&= \left(\frac{1265.95}{\sqrt{1624458.2}} \right)^2 \\
&= \left(\frac{1265.95}{1274.54} \right)^2\\
&= 0.99356^2 \\
&= 0.9866
\end{align*}
\end{document}


-

Some code improvement:

\documentclass{article}

\usepackage{amsmath}
\usepackage[
locale=DE  % comma as decimal separator
%  locale=UK  % full stop as decimal separator
]{siunitx}

\begin{document}

\begin{align*}
r^2
&= \left[\frac{\num{23604.7} - \frac{1}{22} \cdot 253 \cdot \num{1942.5}}{\sqrt{[3795 - \frac{1}{22} \cdot 253^2] [\num{173348.4} - \frac{1}{22} \cdot \num{1942.5}^2]}}\right]^2\\
&= \left[\frac{\num{1265.95}}{\sqrt{\num{885.5} \cdot \num{1834.51}}}\right]^2\\
&= \left[\frac{\num{1265.95}}{\sqrt{\num{1624458.2}}}\right]^2\\
&= \left[\frac{\num{1265.95}}{\num{1274.54}}\right]^2\\
&= \num{0.99356}^2\\
&= \num{0.9866}
\end{align*}

\end{document}


-