# Dividing Long Equation using Split

I have a long equation as below,

As the equation is too long, I am working to split it. Unfortunately it was not successful. Confused where could be the mistake. Could you assist to point it.

MWE:

\documentclass{article}
\usepackage{dsfont}
\usepackage{amsmath}
\begin{document}

$$\label{eq:1b} \begin{split} Index & = \sum_{\forall a,b \in set, a \neq b}{\left[ \\ & 5*k_{X}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{X}\right]} + \\ & 3*k_{Y}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Y}\right]} + \\ & 2*k_{Z}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Z}\right]}\right]} \end{split}$$

\end{document}


Update1:

Thanks to all for your help. I tried all and the below works like a charm.

$$\label{eq:1c} \begin{split} Index = \sum_{\forall a,b \in set, a \neq b} &\Bigg[ 5*k_{X}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{X}\right]} + \\ &\mbox{ }\hspace{0.35in} 3*k_{Y}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Y}\right]} + \\ &\mbox{ }\hspace{1in} 2*k_{Z}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Z}\right]}\Bigg] \end{split}$$


Update2:

Thanks Bernard and Egreg. I learnt many news ways to succinctly write an equation. Sorry if I had abused \left and \right. I am bookmarking this page for future reference. I do not have enough reputation to Vote Up the answers. Will revert back to this soonest once I have enough reputation.

As I am using 2 columns per page and if i(a,b) has to fulfill additional conditions such that for example,

[i_{a,b} \in E_{Z}\ \&\ i_{a,b} \notin E_{Y}\ \&\ i_{a,b} \notin E_{X}]


Hope it is ok to divide those line if too long.

MWE:

\documentclass{article}
\usepackage{dsfont}
\usepackage{amsmath}
\begin{document}

$$\label{eq:1b} \begin{split} \mathit{Index} = \smash[b]{\sum_{\substack{a,b \in \mathit{set}\\a\neq b}}} \;\bigl[ & 5k_{X}(i_{a,b})\mathds{I}_{[i_{a,b} \in E_{X}]} +{} \\ & 3k_{Y}(i_{a,b})\mathds{I}_{[i_{a,b} \in E_{Y}\ \&\ i_{a,b} \notin E_{X}]} +{} \\ & 2k_{Z}(i_{a,b})\mathds{I}_{[i_{a,b} \in E_{Z}\ \&\ i_{a,b} \notin E_{Y}\ \&\ i_{a,b} \notin E_{X}]} \bigr] \end{split}$$

\end{document}

-

You're abusing \left and \right, to begin with. None of their occurrences in your code is needed, actually.

Here's my proposal, using \substack for avoiding a too long subscript to the summation and “smashing” its bottom. I omitted \forall that's usually implied in the notation and also *, that is not frequently used in mathematics to denote multiplication (it usually has other meanings, for instance the convolution product).

\documentclass{article}
\usepackage{dsfont}
\usepackage{amsmath}
\begin{document}

$$\label{eq:1b} \begin{split} \mathit{Index} = \smash[b]{\sum_{\substack{a,b \in \mathit{set}\\a\neq b}}} \;\bigl[ & 5k_{X}(i_{a,b})\mathds{I}_{[i_{a,b} \in E_{X}]} +{} \\ & 3k_{Y}(i_{a,b})\mathds{I}_{[i_{a,b} \in E_{Y}]} +{} \\ & 2k_{Z}(i_{a,b})\mathds{I}_{[i_{a,b} \in E_{Z}]} \bigr] \end{split}$$

\end{document}


Note also \mathit that's recommended for multiletter variable names.

-

I would cut the equations in one of these two ways — two lines is enough. I changed the summation index to what I think it is really, and used the \mathclap and \MoveEqLeft commands from mathtools to prevent too much horizontal spacing around the equal sign. Also, writing ‘Index’ in math mode makes this word look as the succession of 5 variables, not as a word; use mathrm (or \mathit if you wish) instead.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{dsfont}
\usepackage{mathtools}
\begin{document}

\label{eq:1b} \begin{aligned} \MoveEqLeft[8]\mathrm{Index} = \sum_{\mathclap{\{( a,b) \in \mathrm{set},\; a \neq b\}}}\left[ 5*k_{X}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{X}\right]}\right. +\\[-2ex] & 3*k_{Y}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Y}\right]} + \left. 2*k_{Z}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Z}\right]}\right] \end{aligned}
\vskip 1cm
\label{eq:1b} \begin{alignedat}{2} \mathrm{Index} & = \sum_{\mathclap{\{( a,b) \in \mathrm{set},\; a \neq b\}}}\left[ 5*k_{X}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{X}\right]}\right. & & + 3*k_{Y}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Y}\right]}\\[-2ex] & & & +\left. 2*k_{Z}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Z}\right]}\right] \end{alignedat}

\end{document}


-

You must have \left[ and \right] in the same line or you separate by \right. in the first line and \left. in the last line.

$$\label{eq:1b} \begin{split} Index & = \sum_{\forall a,b \in set, a \neq b}\left[ \right.\\ & 5*k_{X}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{X}\right]} + \\ & 3*k_{Y}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Y}\right]} + \\ & \left.2*k_{Z}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Z}\right]} \right] \end{split}$$

-
It's better to size delimiters that span multiple lines manually using \big, \Big etc. Using \left. and \right. can result in inconsistent sizes. – Ian Thompson Aug 10 '14 at 10:37
For another way in the same idea of @Ian Thompson $$\label{eq:1b} \begin{split} Index = \sum_{\forall a,b \in set, a \neq b}&\Bigg[ 5*k_{X}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{X}\right]} + \\ &\mbox{ }\hspace{0.35in} 3*k_{Y}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Y}\right]} + \\ &\mbox{ }\hspace{1in} 2*k_{Z}\left(i_{a,b}\right)*\mathds{I}_{\left[i_{a,b} \in E_{Z}\right]}\Bigg] \end{split}$$ – somkiat_t Aug 10 '14 at 10:46

Use instead align

\begin{align*}
Index  = &\sum_{\forall a,b \in set, a \neq b} \left[
5*k_{X}\left(i_{a,b}\right)*{I}_{\left[i_{a,b} \in E_{X}\right]} +  \right. \\
&  \left. + 3*k_{Y}\left(i_{a,b}\right) * {I}_{\left[i_{a,b} \in E_{Y}\right]} +
2*k_{Z}\left(i_{a,b}\right)* {I}_{\left[i_{a,b} \in E_{Z}\right]}\right]
\end{align*}

-
I think, if use align numbered of equation not in middle way. – somkiat_t Aug 10 '14 at 10:57
@somkiat_t definitely! – c.p. Aug 10 '14 at 15:49