我在拆分这个长方程时遇到了问题。我尝试了aligned
env 和split
of amsmath
package,但都不起作用!!有任何帮助吗?
$ Sym_{vertical} = \frac { \mid X^{'}_{UL} - X^{'}_{UR}\mid
+ \mid X^{'}_{LL} - X^{'}_{LR}\mid
+ \mid Y^{'}_{UL} - Y^{'}_{UR}\mid \\
+\mid Y^{'}_{LL} - Y^{'}_{LR} \mid
+ \mid H^{'}_{UL} - X^{'}_{UR} \mid
+ \mid H^{'}_{LL} - H^{'}_{LR} \mid \\
+\mid B^{'}_{UL} - B^{'}_{UR} \mid
+ \mid B^{'}_{LL} - B^{'}_{LR} \mid
+ \mid \Theta^{'}_{UL} - \Theta^{'}_{UR} \mid \\
+ \mid \Theta^{'}_{LL} - \Theta^{'}_{LR} \mid
+ \mid R^{'}_{UL} - R^{'}_{UR} \mid
+ \mid R^{'}_{LL} - R^{'}_{LR} \mid}
{12}$
答案1
我把分子设为左对齐\Longstack
(在数学模式下)。我还必须将一些内容更改\\+
为+\\
,并将等式的左侧设为\mathrm
。
Mico 正确地指出,\mid
s 应该被 替换\lvert
,\rvert
对,和^{'}
是多余的,应该被用作'
。
\documentclass{article}
\usepackage[usestackEOL]{stackengine}
\usepackage{amsmath}
\stackMath
\begin{document}
\[
\mathrm{Sym}_\mathrm{vertical} = \frac
{ \Longstack[l]{\lvert X'_{UL} - X'_{UR}\rvert
+ \lvert X'_{LL} - X'_{LR}\rvert
+ \lvert Y'_{UL} - Y'_{UR}\rvert +\\
\lvert Y'_{LL} - Y'_{LR} \rvert
+ \lvert H'_{UL} - X'_{UR} \rvert
+ \lvert H'_{LL} - H'_{LR} \rvert +\\
\lvert B'_{UL} - B'_{UR} \rvert
+ \lvert B'_{LL} - B'_{LR} \rvert
+ \lvert \Theta'_{UL} - \Theta'_{UR} \rvert +\\
\lvert \Theta'_{LL} - \Theta'_{LR} \rvert
+ \lvert R'_{UL} - R'_{UR} \rvert
+ \lvert R'_{LL} - R'_{LR} \rvert}}
{12}
\]
\end{document}
如果术语对齐有用,则可以改用 TABstack。
\documentclass{article}
\usepackage{tabstackengine}
\usepackage{amsmath}
\stackMath
\begin{document}
\[
\TABbinary
\mathrm{Sym}_\mathrm{vertical} = \frac
{ \tabbedLongstack[l]{\lvert X'_{UL} - X'_{UR}\rvert
&+ \lvert X'_{LL} - X'_{LR}\rvert
&+ \lvert Y'_{UL} - Y'_{UR}\rvert & +\\
\lvert Y'_{LL} - Y'_{LR} \rvert
&+ \lvert H'_{UL} - X'_{UR} \rvert
&+ \lvert H'_{LL} - H'_{LR} \rvert &+\\
\lvert B'_{UL} - B'_{UR} \rvert
&+ \lvert B'_{LL} - B'_{LR} \rvert
&+ \lvert \Theta'_{UL} - \Theta'_{UR} \rvert &+\\
\lvert \Theta'_{LL} - \Theta'_{LR} \rvert
&+ \lvert R'_{UL} - R'_{UR} \rvert
&+ \lvert R'_{LL} - R'_{LR} \rvert&}}
{12}
\]
\end{document}
答案2
该mathtools
软件包提供了宏\splitfrac
,\splitdfrac
仅供您使用。您可能更喜欢使用四条或三条分割线的解决方案。
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\begin{document}
\[ \textit{Sym}_{\mathrm{vertical}} =
\frac {%
\splitdfrac{\abs{X'_{UL} - X'_{UR}}
+ \abs{X'_{LL} - X'_{LR}}
+ \abs{Y'_{UL} - Y'_{UR}}}{%
\splitdfrac{{}+ \abs{Y'_{LL} - Y'_{LR}}
+ \abs{H'_{UL} - X'_{UR}}
+ \abs{H'_{LL} - H'_{LR}}}{%
\splitdfrac{{}+ \abs{B'_{UL} - B'_{UR}}
+ \abs{B'_{LL} - B'_{LR}}
+ \abs{\Theta'_{UL} - \Theta'_{UR}}}{%
+ \abs{\Theta'_{LL} - \Theta'_{LR}}
+ \abs{R'_{UL} - R'_{UR}}
+ \abs{R'_{LL} - R'_{LR}} }}} }
{12}
\]
\begin{multline*}
\textit{Sym}_{\mathrm{vertical}} = \\
\frac {%
\splitdfrac{
\abs{X'_{UL} - X'_{UR}}+ \abs{X'_{LL} - X'_{LR}}
+ \abs{Y'_{UL} - Y'_{UR}}+ \abs{Y'_{LL} - Y'_{LR}}}{%
\splitdfrac{{}
+ \abs{H'_{UL} - X'_{UR}}+ \abs{H'_{LL} - H'_{LR}}
+ \abs{B'_{UL} - B'_{UR}}+ \abs{B'_{LL} - B'_{LR}}}{%
+ \abs{\Theta'_{UL} - \Theta'_{UR}} + \abs{\Theta'_{LL} - \Theta'_{LR}}
+ \abs{R'_{UL} - R'_{UR}} + \abs{R'_{LL} - R'_{LR}} }}}
{12}
\end{multline*}
\end{document}
答案3
在表达式前使用分数:
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\begin{document}
\[
\mathit{Sym}_{\mathrm{vertical}} =
\tfrac{1}{12}(\,
\begin{alignedat}[t]{3}
& \abs{ X'_{UL} - X'_{UR} } &&+ \abs{ X'_{LL} - X'_{LR} } &&+ {}\\
& \abs{ Y'_{UL} - Y'_{UR} } &&+ \abs{ Y'_{LL} - Y'_{LR} } &&+ {}\\
& \abs{ H'_{UL} - X'_{UR} } &&+ \abs{ H'_{LL} - H'_{LR} } &&+ {}\\
& \abs{ B'_{UL} - B'_{UR} } &&+ \abs{ B'_{LL} - B'_{LR} } &&+ {}\\
& \abs{ \Theta'_{UL} - \Theta'_{UR} } &&+ \abs{ \Theta'_{LL} - \Theta'_{LR} } &&+ {}\\
& \abs{ R'_{UL} - R'_{UR} } &&+ \abs{ R'_{LL} - R'_{LR} }\,)
\end{alignedat}
\]
\end{document}
左侧带有加号的另一种选择。
\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\begin{document}
\[
\begin{split}
\mathit{Sym}_{\mathrm{vertical}} =
\tfrac{1}{12}(\,
& \abs{ X'_{UL} - X'_{UR} } + \abs{ X'_{LL} - X'_{LR} } \\
&+ \abs{ Y'_{UL} - Y'_{UR} } + \abs{ Y'_{LL} - Y'_{LR} } \\
&+ \abs{ H'_{UL} - X'_{UR} } + \abs{ H'_{LL} - H'_{LR} } \\
&+ \abs{ B'_{UL} - B'_{UR} } + \abs{ B'_{LL} - B'_{LR} } \\
&+ \abs{ \Theta'_{UL} - \Theta'_{UR} } + \abs{ \Theta'_{LL} - \Theta'_{LR} } \\
&+ \abs{ R'_{UL} - R'_{UR} } + \abs{ R'_{LL} - R'_{LR} }\,)
\end{split}
\]
\end{document}