# Error in a LaTeX formula

$$\hat{\alpha} = \begin{cases} \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}, \, if \hat{\alpha_1}>0 \, \hat{\alpha_2}>0 \\ \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}+\pi, \, if \hat{\alpha_1}<0\\ \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}+2\pi, \, if \hat{\alpha_2}<0 \, \hat{\alpha_1} >0 \\ undefined, \hat{\alpha_2}=0 \, \hat{\alpha_1}=0 \\ \end{cases}$$


This message appears

Paragraph ended before \cases was complete
\par


What does it mean? how i can write in latex programme

• Hi @rita-ana, welcome to tex.sx. I have formatted a bit your question to make it understandable. The direct problem is that you can't put blank lines (which are paragraph delimiters in LaTeX) in formulas. The more general problem is that you need to read some intro document to LaTeX, see for example tex.stackexchange.com/questions/11/… and tex.stackexchange.com/questions/297463/…. Moreover, a "help tour" of this site will be useful for the future – Rmano Feb 13 '18 at 11:35

You can leave no blank line in a math display.

I take the occasion for suggesting some improvements:

1. never use $$, see Why is $…$ preferable to $$?

2. with dcases* the input is easier

3. even if \hat{\alpha_2} could be logically justified, the hat would fall in an awkward position and \hat{\alpha}_2 looks much better

Here's the code

\documentclass{article}
\usepackage{amsmath,mathtools}

\begin{document}

\begin{equation*}
\hat{\alpha} =
\begin{dcases*}
\tan^{-1}\frac{\hat{\alpha}_1}{\hat{\alpha}_2},        & if $\hat{\alpha}_1>0$ and $\hat{\alpha}_2>0$} \\
\tan^{-1}\frac{\hat{\alpha}_1}{\hat{\alpha}_2} + \pi,  & if $\hat{\alpha}_1<0$}\\
\tan^{-1}\frac{\hat{\alpha}_1}{\hat{\alpha}_2} + 2\pi, & if $\hat{\alpha}_2<0$ and $\hat{\alpha}_1 >0$} \\
\text{undefined},                                      & if $\hat{\alpha}_2=0$ and $\hat{\alpha}_1=0$
\end{dcases*}
\end{equation*}

\end{document}


• However, one can leave a blank line in cases (of course we completely agree that one shouldn't), though I've never noticed until today (since I'm a good boy and never leave blank lines in formulas :-)). The code in the question, as bad as it is, compiles fine (well, horribly, but no errors). – campa Feb 13 '18 at 11:54
• iam new student in this programme @ca – Rita ana Feb 13 '18 at 12:13