2

I want to write three equations in the \begin{align}\end{align}

\begin{aligned}
\min_{x \in \mathbb{R}} &f_i(x), & \qquad \left(i=1,\,2,\,\,\dots,\,M\right),\\
\text{sujeita a } &\phi_j(x)=0,&  \left(i=1,\,2,\,\,\dots,\,J\right),\\
&\psi_k(x)\leq 0,  & \left(i=1,\,2,\,\,\dots,\,K\right),
\end{aligned}
\end{align} 

This is my output: enter image description here

But I want that $f_i(x)$ be left aligned with $\phi_j(x)=0,$ and $\psi_k(x)\leq 0,$ Any suggestion? I will be very greatful.

Thank in advance

2
  • I don't think \min and f_i(x) should be aligned separately. – hesham Aug 21 '20 at 23:11
  • Thank you for all the answers. All of you helped me a lot. I'm very grateful! – guiprado Aug 22 '20 at 18:51
2

You appear to have cropped out the equation number align would have provided - if you are looking for just one equation number, you can uncomment the commented lines here and comment out the alignat ones - or you can have the three equation numbers with alignat. (The excessive spacing in the code is for readability purposes here - no need for it in your actual document)

The extra braces around the min are to show it aligned with the text below - again, for illustrative purposes - I'd be inclined to agree with hesham that this may not be the best alignment for this display.

I have left the \left( and \right) on the first line to highlight the undesirable effect they have on the spacing. Please avoid them if possible.

\documentclass{article}
\usepackage{amsmath,amssymb}
\begin{document}
%\begin{align}
%\begin{aligned}
\begin{alignat}{3}
&{\min_{x \in \mathbb{R}}} &\quad &f_i(x),          &\quad &\left(i=1,\,2,\,\,\dots,\,M\right),
\\
&\text{sujeita a }       &\quad &\phi_j(x)=0,     &\quad &(i=1,\,2,\,\,\dots,\,J),
\\
&                        &      &\psi_k(x)\leq 0, &\quad &(i=1,\,2,\,\,\dots,\,K),
\end{alignat}
%\end{aligned}
%\end{align}
\end{document}

Alignat example

3
  • Excuse me. What package do you have used, starting from \documentclass{..}? – Sebastiano Aug 22 '20 at 11:20
  • Apologies - homebrewed documentclass - replaced now. Thanks. – Fintan Aug 22 '20 at 11:26
  • No apologies :-)...don't worry. – Sebastiano Aug 22 '20 at 11:29
2

The tool of choise to have full control on the alignment columns spacing is alignat:

\documentclass{article}
\usepackage{amsmath, amssymb}

\begin{document}
\begin{alignat*}{3}
 &\min_{x \in \mathbb{R}}&&f_i(x), & (i & =1,2,\ldots, M),\\
 &\text{sujeita a }&&\phi_j(x)=0, & (j & =1,2,\ldots, J), \\
&&\quad&\psi_k(x)\leq 0, &\qquad (k & =1,2,\ldots K), 
\end{alignat*}

\end{document} 

enter image description here

1

Something of similar using flalign? I will use an array or alignat enviroments.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}


\begin{document}
\begin{flalign}
 &\min_{x \in \mathbb{R}}&&f_i(x),\quad  (i=1,2,\ldots, M),&&\notag\\
 &\text{sujeita a }&&\phi_j(x)=0,\quad    (i=1,2,\ldots, J),&&\\
&&&\psi_k(x)\leq 0, \quad (i=1,2,\ldots K),&&\notag
\end{flalign}

\end{document}

enter image description here

Using alignat enviroment:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{alignat*}{2}
&\!\min_{x \in \mathbb{R}} &\quad& f_i(x), \quad  (i=1,2,\ldots, M),\\
&\text{sujeita a }& & \phi_j(x)=0, \quad (i=1,2,\ldots, J),\\
& & & \psi_k(x)\leq 0, \quad (i=1,2,\ldots K),
\end{alignat*}


\end{document}

enter image description here

2
  • 1
    If you used alignedat within equation, you wouldn't need \notag. Also, on the first line, the last element should be aligned with the similar elements in the other two lines. – barbara beeton Aug 22 '20 at 0:01
  • @barbarabeeton Approved! 😊 – Sebastiano Aug 22 '20 at 11:13
1

My preference would go to alignedat:

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{equation}
\begin{alignedat}{3}
&\!\min_{x \in \mathbb{R}} 
  &\quad& f_i(x),          &\qquad& (i=1,2,\dots,M),\\
&\text{sujeita a} 
  &\quad& \phi_j(x)=0,     &\qquad& (i=1,2,\dots,J),\\
&
  &\quad& \psi_k(x)\leq 0, &\qquad& (i=1,2,\dots,K),
\end{alignedat}
\end{equation}

\begin{equation}
\begin{alignedat}{3}
&\!\min_{x \in \mathbb{R}} f_i(x),
  &\quad&                  &\qquad& (i=1,2,\dots,M),\\
&\text{sujeita a} 
  &\quad& \phi_j(x)=0,     &\qquad& (i=1,2,\dots,J),\\
&
  &\quad& \psi_k(x)\leq 0, &\qquad& (i=1,2,\dots,K),
\end{alignedat}
\end{equation}

\end{document}

In the second display, the objective function is not aligned with the bounds, which is more usual, I believe.

enter image description here

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.