[Tex/LaTex] Splitting the equation on two lines

equationsline-breaking

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

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

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.

Best Answer

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

enter image description here

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.