# Is there an elegent method to split a long formula like this?

I am formatting an equation and my code is:

$$\begin{split} &\bra{[\mu]_n+e_j}\bra{[\mu] _{n-1}+e_{j^\prime}} \Phi \ket{[\mu]_n}\ket{[\mu]_{n-1}}\\ &= \begin{cases}S(j^\prime - j) \left[\frac{\prod \limits_{s \in [d-1]\backslash j^\prime}(\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n-1})\prod\limits_{t \in [d]\backslash j}(\tilde{\mu}_{j^\prime,n-1}- \tilde{\mu}_{t,n}+1) }{\prod \limits_{s \in [d-1]\backslash j^\prime}(\tilde{\mu}_{j^\prime,n-1}-\tilde{\mu}_{s,n-1}+1) \prod\limits_{t \in [d]\backslash j}(\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n})}\right]^{\frac{1}{2} } & \text { if } j^{\prime} \in\{1, \ldots, d-1\} . \\ S(d-j) \left[\frac{\prod_{s \in [d-1]} (\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n-1})}{\prod_{t \in [d]\backslash j}(\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n})} \right]^{\frac{1}{2}} & \text { if } j^{\prime}=0 .\end{cases} \end{split}$$


and the output is:

It is overfull when put in a double folded format (actually I don't know how to call such a format and you can see the picture):

I try to split the formula and my solution is split it before "if". But the result is strange and confused. I don't know how to deal with this problem.

• Welcome. // Please try the following: 1) Copy your posted code into a new .tex file and compile. 2) While it fails, add the missing parts in a minimalistic way (we can't know, what you did in your preamble.) 3) While it compiles, make sure, it still shows your problem. 4) EDIT your question and replace your initial code. // Thank you May 24 at 5:53
• Elegant and elegant, but the best way here is probably to (locally) introduce some notation for the big square bracket term(s). May 24 at 6:17
• An addition to the comment from @mickep = there are several repeated subexpressions in your formulas. Locally name them first, then use them to shorten the long unreadable text you now impose on your reader. May 24 at 15:56

I'd like to suggest that you introduce just one extra line break, and that you do so by encasing the material in the cases environment in an aligned environment. And, I'd use \smashoperator[r] directives to "snug up" the multiplicative terms to their respective \prod symbols. Separately, I can see no valid reason for writing ^\prime instead of just '.

\documentclass{article}

\usepackage{mathtools} % for \smashoperator and \DeclarePairedDelimiter macros
\DeclarePairedDelimiter\bra\langle\rvert
\DeclarePairedDelimiter\ket\lvert\rangle

\begin{document}

\begin{split} &\bra[\big]{[\mu]_n+e_j} \bra[\big]{[\mu]_{n-1} +e_{j'}} \Phi \ket[\big]{[\mu]_n} \ket[\big]{[\mu]_{n-1}}\\ &= \begin{cases} \begin{aligned} S(j'-j) &\left[\frac{ \smashoperator[r]{\prod\limits_{s\in[d-1]\setminus j'}} (\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n-1}) \smashoperator[r]{\prod\limits_{t \in [d]\setminus j}} (\tilde{\mu}_{j',n-1}- \tilde{\mu}_{t,n}+1) }{ \smashoperator[r]{\prod\limits_{s\in[d-1]\setminus j'}} (\tilde{\mu}_{j',n-1}-\tilde{\mu}_{s,n-1}+1) \smashoperator[r]{\prod\limits_{t \in [d]\setminus j}} (\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n})} \right]^{\frac{1}{2} } \\[\jot] & \quad\text{if j' \in\{1, \ldots, d-1\};} \\[2\jot] S(d-j) &\left[\frac{ \prod_{s \in [d-1]} (\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n-1})}{ \prod_{t \in [d]\setminus j} (\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n})} \right]^{\frac{1}{2}} \qquad\text{if j'=0\,.} \end{aligned} \end{cases} \end{split}

\end{document}


I don't think that split and cases are the right tools.

Here I use a two-column array; in the first row the columns are merged and some additional space is added at the end (some visual formatting is necessary in cases like this); the side condition for the first case is set in the following line, but aligned with the side condition for the second case.

\documentclass{article}
\usepackage{amsmath,mathtools}
\usepackage{braket}
\usepackage{array,booktabs}

\usepackage{showframe}

\begin{document}

\begin{multline}
\bra{[\mu]_n+e_j}\bra{[\mu] _{n-1}+e_{j'}} \Phi  \ket{[\mu]_n}\ket{[\mu]_{n-1}}\\[1ex]
= \left\lbrace
\begin{array}{@{}>{\displaystyle}l@{\hspace{4em}}l@{}}
\multicolumn{2}{@{}>{\displaystyle}l@{}}{%
S(j' - j)
\left[
\frac{
\smashoperator[r]{\prod \limits_{s \in [d-1]\setminus\{j'\}}}
(\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n-1})
\smashoperator{\prod\limits_{t \in [d]\setminus\{j\}}}
(\tilde{\mu}_{j',n-1}- \tilde{\mu}_{t,n}+1)
}{
\smashoperator[r]{\prod \limits_{s \in [d-1]\setminus\{j'\}}}
(\tilde{\mu}_{j',n-1}-\tilde{\mu}_{s,n-1}+1)
\smashoperator{\prod\limits_{t \in [d]\setminus\{j\}}}
(\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n})
}
\right]^{1/2}\hspace*{2em}
}
&\text{if } j' \in\{1, \ldots, d-1\},
\\[3ex]
S(d-j)
\left[
\frac{
\smashoperator[r]{\prod\limits_{s \in [d-1]}}
(\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n-1})
}{
\smashoperator[r]{\prod\limits_{t \in [d]\setminus\{j\}}}
(\tilde{\mu}_{j,n}-\tilde{\mu}_{s,n})
}
\right]^{1/2}
&\text{if } j'=0.
\end{array}
\right.
\end{multline}

\end{document}


The showframe package is used just to visually format the result.

• ^\prime or ^{\prime} can be replaced by the easier ';
• \backslash produces an ordinary symbol, the operation symbol is called \setminus;
• I added braces in the operands after \setminus.