1

I would like to change the way the formulas are written in my thesis. As it can be seen, I have both equation and eqnarray. Sometimes, the option \\ is used to start a new line. If this option is used for the equation, then the option begin{split} is added.

\begin{equation}
\begin{split}
x_{nmk}\in\{0,1\}, f_{kn},u_{kn},r_{ink},y_{in},t_{k}\geq 0, \\ \ i=1,...,N, k=1,...,K,n=1,...,N, \label{nnb8}
\end{split}
\end{equation}
\begin{eqnarray}
f_{kn}\geq f_{km}-\sum_{i=1}^N r_{inkl}-(1-x_{mnk})M, \nonumber \\ \ k=1,...,K,m=0,...,N,n=1,...,N\label{loadbalance8}\\
f_{k0}= \sum_{i=1}^N \sum_{n=1}^N r_{ink},\ k=1,...,K\label{loadbalance9}
\end{eqnarray}

I would like to change the way the first line of the formula is displayed when there are more than one line. In that case, the first line of the equation and only the first line of the equation should move to the left. The second line should start as it is suposed from the right. Thank you for your help

2
  • 3
    Welcome to TeX SX! You shouldn't use eqnarray, which has been deprecated for more than 20 years and can lead to bad spacing. You should replace it with align from amsmath.
    – Bernard
    May 17 '17 at 9:45
  • @Francesco Zangaro, any news?
    – Zarko
    May 23 '17 at 18:35
2

For single equations split opver more than one line you can use multline which gives the staggered layout automatically. Otherewise use align not eqnarray, also \dots not ...

enter image description here

\documentclass{article}

\usepackage{amsmath}

\begin{document}
aaaa
\begin{multline}
x_{nmk}\in\{0,1\}, f_{kn},u_{kn},r_{ink},y_{in},t_{k}\geq 0, \\
 i=1,\dots,N, k=1,\dots,K,n=1,\dots,N, \label{nnb8}
\end{multline}

bbb
\begin{align}
f_{kn}&\geq f_{km}-\sum_{i=1}^N r_{inkl}-(1-x_{mnk})M, \nonumber \\ 
&\qquad k=1,\dots,K,m=0,\dots,N,n=1,\dots,N\label{loadbalance8}\\
f_{k0}&= \sum_{i=1}^N \sum_{n=1}^N r_{ink}, k=1,\dots,K\label{loadbalance9}
\end{align}
\end{document}
2

Like this?

enter image description here

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{equation}
\begin{split}\label{nnb8}
x_{nmk}\in\{0,1\},
    \quad   & f_{kn},u_{kn},r_{ink},y_{in},t_{k}\geq 0, \\ 
            & \ i=1,...,N, k=1,...,K,n=1,...,N, 
\end{split}
\end{equation}

\begin{align}
f_{kn}\geq f_{km}-
    & \sum_{i=1}^N r_{\mathit{inkl}}-(1-x_{mnk})M,   \nonumber \\ 
    & k=1,\dotsc,K,m=0,\dotsc,N,n=1,\dotsc,N
                                            \label{loadbalance8}\\
    & f_{k0}= \sum_{i=1}^N \sum_{n=1}^N r_{ink},\ k=1,\dotsc,K
                                            \label{loadbalance9}
\end{align}
\end{document}

In your MWE is not clear where you have separate variables or text in subscripts. Maybe is my correction of inkl wrong (if this is set of four variables). Also I discourage you to use eqnarray, instead it is better align from amsmath or mathtools package.

Addendum: It seem that probably desired form of equations is:

enter image description here

In eq. 2 is used multlined environment defined in mathtools:

\documentclass{article}
\usepackage{mathtools}

\begin{document}
\begin{equation}
\begin{split}\label{nnb8}
x_{nmk}\in\{0,1\},
    \quad   & f_{kn},u_{kn},r_{ink},y_{in},t_{k}\geq 0, \\
            & \ i=1,...,N, k=1,...,K,n=1,...,N,
\end{split}
\end{equation}

\begin{align}
f_{kn}
    & \begin{multlined}[t][0.6\hsize]
        \geq f_{km} - \sum_{i=1}^N r_{\mathit{inkl}}-(1-x_{mnk})M,   \\
        k=1,\dotsc,K,m=0,\dotsc,N,n=1,\dotsc,N
        \end{multlined}                     \label{loadbalance8}\\
f_{k0} & = \sum_{i=1}^N \sum_{n=1}^N r_{ink},\ k=1,\dotsc,K
                                            \label{loadbalance9}
\end{align}
\end{document}
1

I just used your first few set of equations, and tried to attain what you want,

\documentclass[10pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
    x_{nmk}\in\{0,1\}, f_{kn},u_{kn},r_{ink},y_{in},t_{k}\geq 0,& \\ \ 
    &i=1,...,N, k=1,...,K,n=1,...,N, 
\end{align}
\end{document}

using this will give you enter image description here

as you asked with one and only the first line of equation on the left, and the rest of the lines starting from right. This you can achieve with the \align equation environment that is available in amsmath package. By following this notion you can set the rest of your equations at your will.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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