2

I would like to align multiple equations (with one rather long one) within one line of my document with \begin{align}. But using "&" for spacing causes rather too long spaces and weird right alignment for some parts. It causes my equation enumeration in the document to be placed in the next empty line. I am using amsmath with the fleqn option.

I hope my problem gets clearer with my code: Many thanks in advance.

\documentclass[]{scrbook}
\usepackage[fleqn]{amsmath}
\usepackage{amssymb}

\begin{document}
{\setlength{\mathindent}{0cm}

\begin{subequations}\label{eq:MINLP}

   \begin{align}
     \mathrm{min} \quad &\sum_{j=1}^{NE}(y_{j}-V_{1,j})^{2} 
     \tag{\ref{eq:MINLP}}\\

     \mathrm{s.t.} \quad & f_{j,k}(V_{n,j},V_{2n,j},V_{2n+1,j}) \le
     M_{n,j,k}^{up}(1-\delta_{n,k}) && n \,  \epsilon \, \mathcal{N}_{b},\,
     k \,  \epsilon \,  \mathcal{F},\, j \,  \epsilon  \, \mathcal{E} \\

     & f_{j,k}(V_{n,j},V_{2n,j},V_{2n+1,j}) \ge M_{n,j,k}^{lo}
    (1-\delta_{n,k}) && n=a+b \\

   \end{align}
\end{subequations}}
\end{document}

I would like to push the part starting with "n..." further to the left but still be aligned, such that the equation enumeration 3.1a will be in the same line.

Align right equation further to the left such than 3.1a is in the same line

  • Welcome to TeX.SE. Can you provide to edit your code to have one complete form? Thank. – Sebastiano Jul 5 '18 at 10:24
  • you may prefer to use alignat rather than align but also \min not \mathrm{min} and \in not \,\epsilon\, – David Carlisle Jul 5 '18 at 10:33
  • Sorry, I should have done it right away. I just completed the code such that it can be run in LaTEX directly. – eyjohey Jul 5 '18 at 10:33
  • as posted it generates errors due to the blank lines., and if the blank lines are removed the second column does fit so the equation numbers are on same line. Please post an example document that produces the image shown. – David Carlisle Jul 5 '18 at 10:39
2

The posted code does not have the spacing shown, but generates errors due to the blank lines, this version runs without error

enter image description here

\documentclass[]{scrbook}
\usepackage[fleqn]{amsmath}
\usepackage{amssymb}

\begin{document}
%\setlength{\mathindent}{0cm}

\begin{subequations}\label{eq:MINLP}

   \begin{align}
     \min &\sum_{j=1}^{NE}(y_{j}-V_{1,j})^{2} 
     \tag{\ref{eq:MINLP}}\\
     \mathrm{s.t.} \quad & f_{j,k}(V_{n,j},V_{2n,j},V_{2n+1,j}) \le
     M_{n,j,k}^{\mathrm{up}}(1-\delta_{n,k}) && n \in \mathcal{N}_{b},\,
     k \in  \mathcal{F},\, j \in \mathcal{E} \\
     & f_{j,k}(V_{n,j},V_{2n,j},V_{2n+1,j}) \ge M_{n,j,k}^{\mathrm{lo}}
    (1-\delta_{n,k}) && n=a+b 
   \end{align}
\end{subequations}
\end{document}
  • Thanks for your quick help, I found my mistake. I had other equations further down that were even longer that caused the middle column to be extended and push my upstream alignments further to the right. – eyjohey Jul 5 '18 at 10:50
  • @eyjohey glad you got something working, but next time please post an image that is generated from the code you post, otherwise it makes it very difficult for anyone offering help to understand the problem. – David Carlisle Jul 5 '18 at 10:51

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.