# Splitting long equation in LaTeX

I am having the following equation:

$$\sum^{n}_{\stackrel{i=1}{(j,i)\in Q}} \left\{ w^{1}_{ijR}+\sum^{m=1}_{\stackrel{(m,i)\in Q}{m\neq j}} \left[ (w^{2}_{ijmR}+w^{2}_{ijm,R-1}) + \sum^{l=1}_{\stackrel{(l,i)\in Q}{i\neq j\neq m}} (w^{3}_{ijmlR}+w^{3}_{ijml,R-1}+w^{3}_{ijml,R-2}) \right] \right\}+ \sum^{n}_{\stackrel{j=1}{(l,i)\in Q}} \left\{ w^{1}_{jiR}+ \sum^{m=1}_{\stackrel{(m,j)\in Q}{m\neq i}} \left[ (w^{2}_{jimR}+w^{2}_{jmi,R-1}) +\sum^{l=1}_{\stackrel{(l,j)\in Q}{m\neq i\neq l}}(w^{3}_{jimlR}+w^{3}_{jmil,R-1}+w^{3}_{jmli,R-2}) \right] \right\}=1 ~ ~ ~ i=1,...,n ~ ~ ~ R=1,...,n-1$$


How can I split this over three lines??

Here is a solution, if you don't need margin notes, with two variants for the second equation. A small remark: for multiline indices, you should use \substack, not \stackrel which is designed to add something over a relation symbol, so that the two rows use the same font size. I also used smaller delimiters.

\documentclass{article}
\usepackage{geometry}
\usepackage{mathtools}

\begin{document}

\begin{multline}
\begin{aligned}
&\smashoperator{ \sumⁿ_{\substack{i=1\\(j,i) ∈ Q}}}\, \Biggl\{ w^{1}_{ijR}+\sum^{m=1}_{\substack{(m,i) ∈ Q\\m ≠ j}} \Biggl[ (w^{2}_{ijmR}+w^{2}_{ijm,R-1}) + \smashoperator{\sum^{l=1}_{\substack{(l,i) ∈ Q\\i ≠ j ≠ m}}} (w^{3}_{ijmlR}+w^{3}_{ijml,R-1}+w^{3}_{ijml,R-2}) \Biggr] \Biggr\} \\
+ & \smashoperator{\sumⁿ_{\substack{j=1\\(l,i) ∈ Q}}} \Biggl\{ w^{1}_{jiR}+ \sum^{m=1}_{\substack{(m,j) ∈ Q\\ m ≠ i}} \Biggl[ (w^{2}_{jimR}+w^{2}_{jmi,R-1}) + \smashoperator{\sum^{l=1}_{\substack{(l,j) ∈ Q\\ m ≠ i ≠ l}}}(w^{3}_{jimlR}+w^{3}_{jmil,R-1}+w^{3}_{jmli,R-2}) \Biggr] \Biggr\}
\end{aligned} \\
\end{multline}\\

\begin{multline} \smashoperator{\sum^{n}_{\substack{j=1\\ (j,i)\in Q}}} \Biggl\{w^{1}_{ijR}+w^{1}_{ij,R+1}+\smashoperator{\sum^{n}_{\substack{m=1 \\ (m,i)\in Q \\ m\neq j}}} \,\biggl[w^{2}_{ijm,R-1}+w^{2}_{ijmR}+w^{2}_{ijm,R+1} \\[-6ex]
+ \smashoperator{\sum^{n}_{\substack{l=1 \\ (l,i)\in Q \\ i\neq j\neq m}}}(w^{3}_{ijml,R-2}+w^{3}_{ijmlR}+w^{3}_{ijml,R+2}) \biggr] \Biggr\} \leq 1
\end{multline} \\

\begin{aligned}[b] \smashoperator{\sum^{n}_{\substack{j=1\\ (j,i)\in Q}}} \Biggl\{w^{1}_{ijR}+w^{1}_{ij,R+1}+\smashoperator{\sum^{n}_{\substack{m=1 \\ (m,i)\in Q \\ m\neq j}}} \,\biggl[w^{2}_{ijm,R-1} & + w^{2}_{ijmR}+w^{2}_{ijm,R+1} \\[-5.5ex] & + \smashoperator{\sum^{n}_{\substack{l=1 \\ (l,i)\in Q \\ i\neq j\neq m}}}(w^{3}_{ijml,R-2}+w^{3}_{ijmlR}+w^{3}_{ijml,R+2}) \biggr] \Biggr\} \leq 1 \end{aligned}

\end{document}


• many thanks but this is not working with this equation:
– mary
Commented Aug 11, 2018 at 14:53
• @mary: What do you mean with ‘not working’? What happens exactly? Commented Aug 11, 2018 at 16:19
• I mean erreur latex
– mary
Commented Aug 11, 2018 at 16:28
• Could you post the error message? Are the required packages installed? Commented Aug 11, 2018 at 16:32
• this is the equation: \begin{multline} \sum^{n}_{\stackrel{j=1}{(j,i)\in Q}}\left\{w^{1}_{ijR}+w^{1}_{ij,R+1}+\sum^{n}_{\stackrel{m=1}{\stackrel{(m,i)\in Q}{m\neq j}}} \left[w^{2}_{ijm,R-1}+w^{2}_{ijmR}+w^{2}_{ijm,R+1}+ \\ \sum^{n}_{\stackrel{l=1}{\stackrel{(l,i)\in Q}{i\neq j\neq m}}}(w^{3}_{ijml,R-2}+w^{3}_{ijmlR}+w^{3}_{ijml,R+2}) \right] \right\} \leq 1
– mary
Commented Aug 11, 2018 at 16:33
• assumed, that the page borders widths are 25mm
• with use of multlined math environment from the mathtools package:

(red lines indicate text bordes)

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{mathtools}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
$$\begin{multlined}[0.95\hsize] \sum^{n}_{\stackrel{i=1}{(j,i)\in Q}} \left\{ w^{1}_{ijR}+\smashoperator[l]{\sum^{m=1}_{\stackrel{(m,i)\in Q}{m\neq j}}} \left[ \Bigl(w^{2}_{ijmR}+w^{2}_{ijm,R-1}\Bigr) + \smashoperator[l]{\sum^{l=1}_{\stackrel{(l,i)\in Q}{i\neq j\neq m}}} \Bigl(w^{3}_{ijmlR}+w^{3}_{ijml,R-1}+w^{3}_{ijml,R-2} \Bigr) \right] \right\}+ \\ \sum^{n}_{\stackrel{j=1}{(l,i)\in Q}} \left\{ w^{1}_{jiR}+ \smashoperator[l]{\sum^{m=1}_{\stackrel{(m,j)\in Q}{m\neq i}}} \left[ \Bigl(w^{2}_{jimR}+w^{2}_{jmi,R-1}\Bigr) + \smashoperator[l]{\sum^{l=1}_{\stackrel{(l,j)\in Q}{m\neq i\neq l}}} \Bigl(w^{3}_{jimlR}+w^{3}_{jmil,R-1}+w^{3}_{jmli,R-2}\Bigr) \right] \right\}=1,\\ i=1,...,n ;\ R=1,...,n-1 \end{multlined}$$
\end{document}