3

I have a long square root equation that walks off the edge of the page. See the following picture where the end of the equation is cutoff.

\[
S=\sqrt{\frac{306.250+240.250+156.250+110.250+90.250+56.250+30.250+30.250+30.250+56.250+132.250+156.250+380.250+756.250}{14-1}}
\]

Square root that is cutoff

I would like to collapse it so that all of the values can be visible. I understand I can decrease the font size, or mathematically decrease the size of the square root, but I would like a solution that keeps the same font size, and keeps all of the values together under the square root.

How can I move half of the values to the next line so that they remain under the square root? See the following illustration as an example.

 --------------------
 | x + x + x + x + ...
 | x + x + x + x + x
 | ------------------
\|         y

I've tried the obvious \newline, however, it does not pair well with \sqrt. The following is the result of that.

Square root with new line

I am a LaTeX newbie. Does anyone know how I can achieve this? Thanks.

3
  • 3
    Is it splitfrac/splitdfrac from mathtools you look for?
    – mickep
    Oct 2, 2022 at 20:15
  • @mickep Yep. Appreciate the answer
    – Jaan
    Oct 2, 2022 at 20:22
  • @Jaan Try to think to your future readers... I am not sure that the output wanted is the better one to understand your formula.
    – projetmbc
    Oct 2, 2022 at 21:07

1 Answer 1

8

As @mickep has already suggested in a comment, the \splitfrac and \splitdfrac macros (provided by the mathtools package, a superset of the amsmath package) are your friends. The d in \splitdfrac indicates that its arguments will be processed in display-style math mode.

As the following example code shows, one can split a long numerator (or denominator) term into 3 or more parts by nesting the macros.

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools} % for \splitfrac and \splitdfrac macros

\begin{document}
\begin{align*}
S&=\sqrt{\frac{%
   \splitfrac{306.250+240.250+156.250+110.250+90.250+56.250+30.250}%
             {+30.250+30.250+56.250+132.250+156.250+380.250+756.250}}%
             {14-1}}\\
 &=\sqrt{\frac{%
   \splitdfrac{\splitdfrac{306.250+240.250+156.250+110.250+90.250}%
                          {+56.250+30.250+30.250+30.250+56.250}}%
                          {+132.250+156.250+380.250+756.250}}%
             {14-1}}
\end{align*}
\end{document}
2
  • 1
    \splitdfrac also increases the vertical separation. So the choice between two and three lines isn't quite so simple. Oct 2, 2022 at 21:11
  • @barbarabeeton - Thanks for this addition.
    – Mico
    Oct 3, 2022 at 6:43

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.