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?

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

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}
  • I have used also splitdfrac. I have not seen your code. – Sebastiano Apr 13 '18 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 '18 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 '18 at 22:12
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}
  • Don't worry :-). I upvote also your answer. – Sebastiano Apr 14 '18 at 21:48
1

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

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.