# How to line-break a big equation with a big square root term?

I have a big equation which has a square root encompassing a major portion. I need to line-break it into multiple lines in latex. The original code that I have is given below:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$$\lambda = \sqrt{\frac{3}{2}}\left(\frac{1}{\tilde{r} \left(\tilde{g}^2+\tilde{r}^2\right)^{7/4} \tilde{r_h}}\right)\sqrt{\left(-\left(\left(-\frac{\tilde{r}^2 \left(\tilde{r_h}{}^2+1\right) \left(\frac{\tilde{g}^2+\tilde{r_h}{}^2}{\tilde{g}^2+\tilde{r}^2}\right){}^{3/2}}{\tilde{r_h}{}^2}+\tilde{r}^2+1\right) \left(2 \tilde{g}^6 \sqrt{\tilde{g}^2+\tilde{r}^2} \tilde{r_h}{}^2+\tilde{g}^4 \left(\tilde{r}^4 \left(\tilde{r_h}{}^2+1\right) \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+6 \tilde{r}^2 \sqrt{\tilde{g}^2+\tilde{r}^2} \tilde{r_h}{}^2\right)+\tilde{g}^2 \tilde{r}^4 \left(\tilde{r_h}{}^4 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+\tilde{r_h}{}^2 \left(-4 \tilde{r}^2 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+\sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+6 \sqrt{\tilde{g}^2+\tilde{r}^2}\right)-4 \tilde{r}^2 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}\right)+2 \tilde{r}^6 \tilde{r_h}{}^2 \left(-2 \tilde{r_h}{}^2 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}-2 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+\sqrt{\tilde{g}^2+\tilde{r}^2}\right)\right)\right)\right)}$$

\end{document}


I tried using aligned, split, multline, with various option like \biggl, \biggr, \left., \right. but none of them seem to work. What is the best way to break such an equation across multiple lines? Any help in this regard would be truly beneficial.

• $\lambda^2=[square of your expression]$ and divide it like any multiplication. Feb 21 at 8:35
• When something like this shows up, I rethink my notation. Perhaps write G^2=g^2+r^2 and G_h^2 = g^2+r_h^2 to start with. Feb 21 at 9:03
• Whatever else you do, I believe you should replace all instances of \tilde{r_h} with \tilde{r}_h..
– Mico
Feb 21 at 13:45
• @Mico will keep that in mind. Thanks! Feb 21 at 13:46

I suggest you (a) use symbols -- say, P, Q, and R -- for some of the repeated terms and (b) replace all \left and \right directives with non-autosizing alternatives. And, do use [...]^{1/2} notation for the really large square-root term. Last (and definitely least) I'd replace \sqrt{\frac{3}{2}} with \sqrt{1.5}.

\documentclass{article}
\usepackage{amsmath}
\newcommand\TR{\tilde{r}}
\newcommand\TG{\tilde{g}}

\begin{document}

\noindent
Put $P=\sqrt{\TG^2+\TR^2}$, $Q=\sqrt{\TG^2+\TR_h^2}$, and $R=\TR_h^2+1$. Then
$$\begin{split} \lambda &= \sqrt{1.5} \Bigl(\frac{1}{\TR (P^2)^{7/4} \TR_h}\Bigr) \Bigl\{- %\Bigl[ \Bigl[-\bigl(\TR^2 R (Q^2/P^2)^{3/2}\bigr)\big/ \TR_h^2+\TR^2+1\Bigr] \\ &\quad \times\Bigl[2 \TG^6 P \TR_h^2 +\TG^4 (\TR^4 R Q+6 \TR^2 P \TR_h^2) +\TG^2 \TR^4 \bigl(\TR_h^4 Q+\TR_h^2 (-4 \TR^2 Q \\ &\qquad +Q+6P) -4 \TR^2 Q\bigr) +2 \TR^6\TR_h^2 (-2 \TR_h^2 Q-2 Q+P) \Bigr] %\Bigr] \Bigr\}^{1/2} \end{split}$$

\end{document}


I would replace the square root by [ ... ]^1/2, the latter with \frac or even \nicefrac from https://ctan.org/pkg/nicefrac. And then manually break the equation, e.g.

\documentclass{article} \usepackage{amsmath}

\begin{document}
\begin{multline}
\lambda = \sqrt{\frac{3}{2}}\left( \frac{1}{\tilde{r}
\left( \tilde{g}^2+\tilde{r}^2\right)^{7/4} \tilde{r_h}}\right)
\\
\cdot \Bigg[
-\Bigg( -
\tilde{r}^2  \left( \frac{\tilde{r_h}{}^2  + 1}{\tilde{r_h}{}^2}\right)
\left(\frac{\tilde{g}^2+\tilde{r_h}{}^2}
{\tilde{g}^2 +\tilde{r}^2}\right){}^{3/2}%}{\tilde{r_h}{}^2}
+ \tilde{r}^2 + 1 \Bigg)
\\
\cdot
\Bigg( 2 \tilde{g}^6 \sqrt{\tilde{g}^2+\tilde{r}^2}
\tilde{r_h}{}^2+\tilde{g}^4 \left(\tilde{r}^4
\left(\tilde{r_h}{}^2+1\right) \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+6
\tilde{r}^2 \sqrt{\tilde{g}^2+\tilde{r}^2}
\tilde{r_h}{}^2\right)
\\
+\tilde{g}^2 \tilde{r}^4 \Big( \tilde{r_h}{}^4 \sqrt{\tilde{g}^2
+\tilde{r_h}{}^2}+\tilde{r_h}{}^2 \left(-4 \tilde{r}^2
\sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+\sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+6
\sqrt{\tilde{g}^2+\tilde{r}^2}\right)
\\
-4 \tilde{r}^2 \sqrt{\tilde{g}^2 +\tilde{r_h}{}^2}\Big)+2 \tilde{r}^6
\tilde{r_h}{}^2 \left(-2 \tilde{r_h}{}^2 \sqrt{\tilde{g}^2
+\tilde{r_h}{}^2}-2 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}
+\sqrt{\tilde{g}^2 +\tilde{r}^2} \right) \Bigg) \Bigg]^{\frac{1}{2}}
\end{multline}
\end{document}

• I am not sure why the bracket error, they seem to be equal in number. Feb 21 at 12:14
• \left and \right pairs can not be used when on different lines. Feb 21 at 13:06

The package breqn came in handy in this situation although it caused conflicts with some other packages.

\documentclass{article}
\usepackage{breqn}
\begin{document}
\begin{dmath}
\lambda = \sqrt{\frac{3}{2}}\left(\frac{1}{\tilde{r}
\left(\tilde{g}^2+\tilde{r}^2\right)^{7/4} \tilde{r_h}}\right)\left(-\left(\left(-\frac{\tilde{r}^2 \left(\tilde{r_h}{}^2+1\right)
\left(\frac{\tilde{g}^2+\tilde{r_h}{}^2}{\tilde{g}^2+\tilde{r}^2}\right){}^{3/2}}{\tilde{r_h}{}^2}+\tilde{r}^2+1\right)\\
\left(2 \tilde{g}^6 \sqrt{\tilde{g}^2+\tilde{r}^2}
\tilde{r_h}{}^2+\tilde{g}^4 \left(\tilde{r}^4 \left(\tilde{r_h}{}^2+1\right) \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+6 \tilde{r}^2 \sqrt{\tilde{g}^2+\tilde{r}^2}
\tilde{r_h}{}^2\right)\\
+\tilde{g}^2 \tilde{r}^4\left(\tilde{r_h}{}^4 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+\tilde{r_h}{}^2 \left(-4 \tilde{r}^2\sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+\sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+6 \sqrt{\tilde{g}^2+\tilde{r}^2}\right)\\
-4 \tilde{r}^2 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}\right)+2 \tilde{r}^6\tilde{r_h}{}^2 \left(-2 \tilde{r_h}{}^2 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}-2 \sqrt{\tilde{g}^2+\tilde{r_h}{}^2}+\sqrt{\tilde{g}^2+\tilde{r}^2}\right)\right)\right)\right)^{\frac{1}{2}}
\end{dmath}
\end{document}