# Line-breaking a long numerator in a fraction expression

I have a problem with splitting this long equation . i tried aligned env and split of amsmath package but nothing worked !! Any help .

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


i want it to look this way :

• 12 SYM_{\mathrm{horizontal}} = ... Apr 24 '17 at 15:08

I made the numerator a left-aligned \Longstack (in math mode). I also had to change a few \\+ to +\\ and made the left side of the equation in \mathrm.

Mico was right to point out that \mids should be replaced with \lvert, \rvert pairs, and ^{'} is redundant and should be just employed as '.

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


If term alignment is useful, the a TABstack can be used, instead.

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


The mathtools package provides the macros \splitfrac and \splitdfrac for just your use case. You may prefer the solution with either four or three split lines.

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


Use a fraction in front of the expression:

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


An alternative with the plus signs at the left side.

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


• other than it's how the op showed it, why would you not place the plus signs at the beginning of the continuation lines? Apr 24 '17 at 18:21
• @barbarabeeton That's a possible choice, I'll add it: your wish is my command, as you know. Apr 24 '17 at 19:42