-2
\documentclass{article}
\usepackage{amsmath}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
    \begin{align}

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

    \end{align}

\end{document}

I need to numbering of this cases but when i put align code , the file not compiling because \par .... what is wrong please help me i attempt every probability to solve this

Franck Pastor
  • 18,756
Rita ana
  • 1
  • 2
  • 2
    My answer to your previous question started by telling that you should not have blank lines in a math display. – egreg Feb 15 '18 at 09:14

1 Answers1

3

Do not insert blank lines inside math environments. (And, by the way, please communicate complete minimal examples, that is to say examples that reproduce your problem and can be executed “out of the box”, with \documentclass{}, \begin{document}, and so on.)

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
   \hat{\alpha} &= 
   \begin{cases} 
     \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}},  \,    &\text{if }  \hat{\alpha_1}>0 \, \hat{\alpha_2}>0 \\
     \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}+\pi,  \,  &\text{if }  \hat{\alpha_1}<0 \\
     \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}+2\pi,   \, &\text{if  }\hat{\alpha_2}<0 \,  \hat{\alpha_1} >0 \\
     \text{undefined}, & \hat{\alpha_2}=0 \, \hat{\alpha_1}=0
   \end{cases}
\end{align}
\end{document}

enter image description here

I would also suggest some improvements for this formula, as below:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
   \hat{\alpha} &= 
   \begin{cases} 
      \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}} &\text{if }  \hat{\alpha_1}>0\ \hat{\alpha_2}>0, \\
      \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}+\pi &\text{if }  \hat{\alpha_1}<0, \\
      \tan^{-1}\frac{\hat{\alpha_1}}{\hat{\alpha_2}}+2\pi  &\text{if  }\hat{\alpha_2}<0\  \hat{\alpha_1} >0, \\
      \text{undefined} & \text{if }\hat{\alpha_2}=0,\ \hat{\alpha_1}=0.
   \end{cases}
\end{align}
\end{document}

enter image description here

It can be still improved, I guess, but there are participants here that are (much) more competent than me to point out these improvements!

Franck Pastor
  • 18,756
  • i write the code you written ... but the problem exist also – Rita ana Feb 15 '18 at 08:35
  • i asked about why the \par appear as problem – Rita ana Feb 15 '18 at 08:35
  • @Ritaana There are still blank lines inside your align environment, and besides some other errors I corrected (\begin{document} instead of \end{document}, \usepackage at the wrong places). Once these errors corrected, your example works fine in my installation. – Franck Pastor Feb 15 '18 at 08:45
  • i copy the code you written the problem is still in \par @F – Rita ana Feb 15 '18 at 08:55
  • Then I can't see where the problem is yet, since the same code works flawlessly with my installation, without any error messages or warnings. What are precisely the error messages you get? What is your own TeX installation? – Franck Pastor Feb 15 '18 at 08:58
  • the message appear {paragraph ended befor \align was complete. \par 1.88 – Rita ana Feb 15 '18 at 09:00
  • 1
    Then there are still blank lines inserted inside your align environments. Maybe they are automatically inserted during your copy-paste… Blank lines (which are the same as \par commands) are forbidden in every math environments. – Franck Pastor Feb 15 '18 at 09:01
  • thnx alot you are wondefull @F – Rita ana Feb 15 '18 at 09:12