# Splitting the equation on two lines

I have the following equation (as you can see I have used split):

$$\label{testequation} \begin{split} d_{m}^{\phi}\left(A,f\right)=\sqrt[m]{\mid A\left(pi\right)-f\left(pi\right)\mid^{4}+\sum_{i=1;i\neq pi}^{length\left(R\right)}\mid M\left(i\right)- \\ f\left(i\right)\mid^{7}} \end{split}$$


I want this part of the equation to be on a new line:

-f\left(i\right)\mid^{7}


And, as you can see, I have used \\. But, it didn't work, although I have used the same method for another formula in the same LaTex document and it worked.

What would be the issue here?

Thanks.

-

It is because you can not split a square root. One way of resolve the problem is to use ()^{1/m} instead of \sqrt[m]{}:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$$\begin{split} d_{m}^{\phi}\left(A,f\right) = \left( \mid A\left(pi\right) - f\left(pi\right)\mid^{4} + \sum_{i=1;i\neq pi}^{length\left(R\right)} \mid M\left(i\right)+\right. \\ \left. \vphantom{\sum_{i=1;i\neq pi}^{length\left(R\right)}} -f\left(i\right)\mid^{7}\right)^{1/m} \end{split}$$
\end{document}


You can not either split parenthesis in two different rows, for this reason I used \right. and \left. to close and open the parenthesis without typing them. I also used the \vphantom command to insert an invisible sum in the second row in order to have the parenthesis with the same high in the two row.

By the way, in your situation I will split the equation just before the sum.

-

Another solution is as follows:

\documentclass{article}

\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclareMathOperator*\length{length}

\begin{document}

$$\begin{split} d_{m}^{\phi}(A,f) &= \Biggl(\abs{A(ip) - f(ip)}^{4}\\ &\hphantom{{}= \Biggl(} + \sum_{i = 1 \neq p}^{\length(R)} \abs{M(i) \underbrace{+-}_{?} f(i)}^{7}\Biggr)^{\mkern -4mu 1/m} \end{split}$$

\end{document}


(1) The point of the linebreak is not good.

(2) Don't use \mid as delimiter for absolute values; use \lvert and \rvert.

(3) I assume length is an operator; if I'm wrong, use \text{length} instead.

(4) Only use \left/\right constructions when needed; when add some extra horizontal space.

(5) In the summand, you have +-; this is a pointless statement.

(6) The statement i=1;i\neq pi seems rather wierd to me. If I'm not mistaken, this is the same as i = 1 \neq p.

(7) Use ip instead of pi; the latter can easily mislead one to think that you actually mean \pi but have forgotten the frontslash (\).

-