[Tex/LaTex] How to break the fraction

fractions

How to write the below fraction in two lines?

    \begin{align}
    a = \sqrt{\frac{(20,1-20,06)^2 + (20-20,06)^2+(20-20,06)^2+(20-20,06)^2+(20,2-20,06)^2}{5}} = 0,0289
    \end{align}

I tried using amsmath, but bottom side of fraction disappears.
Is there other way to do that?

Best Answer

You could load the mathtools package and use its \splitdfrac macro to split the numerator across two lines.

A separate comment: Do encase all six decimal commas in curly braces, in order to prevent TeX from interpreting as punctuation marks.

enter image description here

\documentclass{article}
\usepackage{mathtools} % for '\splitdfrac' macro
\begin{document}
\begin{equation}
a = \sqrt{\frac{\splitdfrac{(20{,}1-20{,}06)^2 + (20-20{,}06)^2+(20-20{,}06)^2}{%
+(20-20{,}06)^2+(20{,}2-20{,}06)^2}}{5}} 
= 0{,}0289
\end{equation}
\end{document}

Addendum: You may also want to consider replacing \frac with inline-fraction notation and replacing \sqrt{...} with \{...\}^{1/2} notation. This would allow you to use a multline environment.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for 'multline' env.
\begin{document}
\begin{multline}
a = \smash[b]{\Bigl\{}\bigl[
    (20{,}1-20{,}06)^2 + (20-20{,}06)^2+(20-20{,}06)^2\\
    +(20-20{,}06)^2+(20{,}2-20{,}06)^2\bigr]\big/5
    \smash[t]{\Bigr\}^{1/2}} % \smash[b]{...} and \smash[t]{...} for more compact appearance
= 0{,}0289
\end{multline}
\end{document}