如何对具有较大平方根项的大方程式进行换行?

如何对具有较大平方根项的大方程式进行换行?

我有一个大方程,其中平方根占了很大一部分。我需要在 latex 中将其换行成多行。我的原始代码如下:

\documentclass{article}
\usepackage{amsmath} 

\begin{document}

\begin{equation}
    \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{equation}

\end{document}

我尝试使用alignedsplitmultline和各种选项,例如\biggl\biggr\left.\right.但似乎都不起作用。将这样的等式拆分为多行的最佳方法是什么?在这方面的任何帮助都将真正有益。

答案1

我建议你 (a) 使用符号(例如,PQR)表示某些重复项,以及 (b) 用非自动调整大小的替代方案替换所有\left和指令。并且,对真正大的平方根项\right使用符号。最后(也是最不重要的)我会用替换。[...]^{1/2}\sqrt{\frac{3}{2}}\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{equation}
\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{equation}

\end{document}

答案2

我会用 [ ... ]^1/2 替换平方根,后者用 \frac 甚至 \nicefrac 替换https://ctan.org/pkg/nicefrac。然后手动分解方程,例如

\documentclass{文章} \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}

答案3

尽管这个包breqn与其他一些包发生冲突,但它在这种情况下还是派上了用场。

\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}

相关内容