I want to display the following equation:

The LaTeX code I have made is as follows:

\[PaD^{i}=\left [ \frac{(1-\frac{n_{1}}{N})\times M(i,1)}{m}+\frac{\sum_{t=2}^{m}[(1-\frac{n_{t}}{N}\times \frac{n_{t-1}}{N})\times M(i,t)\times M(i,t-1) )]}{m}+\\ \frac{\sum_{t=2}^{m}[(1-\frac{n_{t}}{N}\times \frac{N-n_{t-1}}{N})\times M(i,t)\times (1-M(i,t-1))]}{m}\right ]\times 100\%\]

Is there any way to break the right side of the equation into three lines so that it can fit the page?


Here are two possible solutions. The first is kind of minimal, in that it uses an align* environment and provides for two line breaks. (Well, I also replace most instances of \times with \cdot, and I eliminated a spurious ) in the middle row.)

The second solution goes further towards making it easy on your reader to actually read and comprehend the material. E.g., by writing \frac{1}{m} at the beginning of each of the three additive terms, the remaining material can be typeset using larger lettering. After all, the material that's being summed up is at least as important as the \frac{1}{m} term, right? The second solution also gets rid of all \cdot directives and places the 100\% block at the start, to give it more visual prominence.

enter image description here

\usepackage{amsmath} % for 'align*' env.

&=\biggl[ \frac{(1-\frac{n_{1}}{N})\cdot M(i,1)}{m}\\
&\qquad+\frac{\sum_{t=2}^{m}[(1-\frac{n_{t}}{N}\cdot \frac{n_{t-1}}{N})\cdot M(i,t)\cdot M(i,t-1) ]}{m}\\ 
&\qquad+\frac{\sum_{t=2}^{m}[(1-\frac{n_{t}}{N}\cdot \frac{N-n_{t-1}}{N})\cdot M(i,t)\cdot (1-M(i,t-1))]}{m}
\biggr] \times 100\,\% 

=100\,\% \times \biggl\{ \phantom{{}+{}}
&\frac{1}{m}\Bigl(1-\frac{n_{1}}{N}\Bigr) M(i,1)\\
+{}&\frac{1}{m}\sum_{t=2}^{m}\Bigl[\Bigl(1-\frac{n_{t}}{N} \frac{n_{t-1}}{N}\Bigr) M(i,t) M(i,t-1) \Bigr]\\ 
+{}&\frac{1}{m}\sum_{t=2}^{m}\Bigl[\Bigl(1-\frac{n_{t}}{N} \frac{N-n_{t-1}}{N}\Bigr) M(i,t) (1-M(i,t-1)) \Bigr]
| improve this answer | |
  • Of course, one could take the \frac{1}{m} term outside the curly braces. However, I didn't go that far since I don't know if the meaning of the three additive terms depends on them being scaled by \frac{1}{m}. For sure, additive terms 2 and 3 seem to be some kind of average... – Mico Feb 16 '17 at 7:53
  • While I am trying to use \begin{align*} \end{align*} inside \begin{equation} \end{equation} block, I am getting error @Mico – user5411115 Feb 16 '17 at 8:14
  • @user5411115 - Well, you must not nest these two particular environments. If want to create a nested structure, use split as the inner environment. – Mico Feb 16 '17 at 8:35
  • @user5411115 - If you want to become a proficient user of LaTeX and writer of mathy material, you should take the time to study the user guide of the ansmath package. – Mico Feb 16 '17 at 8:39
  • 1
    @user5411115 -- if you want a single equation number, then substitute aligned for align* and wrap the whole thing in \begin{equation} ... \end{equation}. (in this situation, aligned is very similar to split, which Mico has already suggested.) – barbara beeton Feb 16 '17 at 14:58

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