2

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?

1
  • 2
    Could you be a bit more precise? It's not clear where you want things broken...
    – Werner
    Apr 13, 2018 at 21:31

4 Answers 4

6

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}
3
  • I have used also splitdfrac. I have not seen your code.
    – Sebastiano
    Apr 13, 2018 at 21:44
  • @Sebastiano - No worries -- I'll upvote your answer in a sec. Just to be clear, though: Your answer uses \splitfrac, not \splitdfrac...
    – Mico
    Apr 13, 2018 at 21:46
  • There is into your code a \end{document} out the code. I not edited the best users. Thanks a lot.
    – Sebastiano
    Apr 13, 2018 at 22:12
2

A (square) root is something that you possibly don't really want to break between lines, but always can replaced by a power (if square -> 1/2).

So, may be this is what you are after:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
    a = &\Bigg(\frac{(20,1-20,06)^2+(20-20,06)^2+}{5} +\\ &+\frac{(20-20,06)^2+(20-20,06)^2+(20,2-20,06)^2}{5}\Bigg)^{\dfrac{1}{2}} =\\ 
    &0,0289
    \end{align*}
\end{document}

enter image description here

2

Sorry, I could not resist to answer, although this does not break anything (but indeed it is another way to do it).

\documentclass{article}
\usepackage{amsmath}
\begin{document}
Being $x=2,06$, then: 
    \begin{align}
    a = \sqrt{\frac{(20,1-x)^2 + (3\times(20-x)^2) +(20,2-x)^2}{5}} = 0,0289
    \end{align}
\end{document}
1
  • Don't worry :-). I upvote also your answer.
    – Sebastiano
    Apr 14, 2018 at 21:48
1

Here my code using \splitfrac.

enter image description here

\documentclass{article}

\usepackage{mathtools}

\begin{document}


\[a=\sqrt{\frac{\splitfrac{(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{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .