[Tex/LaTex] How to left align a set of equations

alignequations

I wanted to left align a set of equations. I've tried the solution provided in
aligning to the left.
It worked. But, I wanted to have a single equation number for the entire flalign in order to refer to it later. Like in case of equation+split. While using equation+align, I am able to get it. But, if I use equation+flalign the equations are still being centered. Is there a way to do it?

Example using equation+align,

\begin{equation}
     \begin{align}
      \mbox{Minimize } & x_1+x_2+x_3 \\
      \mbox{Subject to} & \\
       & x_1+x_2 \leq 10 \\
       & x_2+x_3 \leq 8 \\
       & x_1+x_3 \leq 5 
     \end{align}
\end{equation}

I would like to do this while the equations are left aligned.
It will be even better if the equations can be spaced a little (for example, 1 cm) from the left margin instead
of starting from the left margin.

Thanks in advance

Best Answer

One option will be to use

\usepackage[fleqn]{amsmath}

On the other hand, this option ([fleqn]) can be passed to \documentclass also as

\documentclass[fleqn]{article}
\usepackage{amsmath}

The MWE will be

\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage{txfonts}
\usepackage{showframe}% to show frames
\begin{document}
\begin{equation}
     \begin{aligned}
      \text{Minimize } & x_1+x_2+x_3  \\
      \text{Subject to} &\\
       & x_1+x_2 \leq 10 \\
       & x_2+x_3 \leq 8 \\
       & x_1+x_3 \leq 5 
     \end{aligned}
\end{equation}
\end{document}

The output will be

enter image description here

But all the equations in the document will be left aligned by this approach.

The equation environment will put the equation in display mode by definition. To space only one equation left aligned, as you wish, one way is to use \phantom as below:

\documentclass{article}
\usepackage{amsmath}
\usepackage{txfonts}
\usepackage{showframe}% to show frames
\begin{document}
\begin{equation}
     \begin{aligned}
      \text{Minimize } & x_1+x_2+x_3   \\
      \text{Subject to} &\\
       & x_1+x_2 \leq 10 \\
       & x_2+x_3 \leq 8 \\
       & x_1+x_3 \leq 5 
     \end{aligned}
     \phantom{\hspace{6cm}} %%<---adjust the value as you want
\end{equation}
\end{document}

enter image description here