Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a long equation as below,

enter image description here

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}

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

\end{document}

Update1:

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

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

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}

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

\end{document}
share|improve this question

4 Answers 4

up vote 2 down vote accepted

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}

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

\end{document}

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

enter image description here

share|improve this answer

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}

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

\end{document} 

enter image description here

share|improve this answer

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.

\begin{equation} \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} 
\end{equation} 
share|improve this answer
1  
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 at 10:37
1  
For another way in the same idea of @Ian Thompson \begin{equation} \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} \end{equation} –  somkiat_t Aug 10 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*}
share|improve this answer
    
I think, if use align numbered of equation not in middle way. –  somkiat_t Aug 10 at 10:57
    
@somkiat_t definitely! –  c.p. Aug 10 at 15:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.