26

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

  • 1
    Change align into aligned. – egreg May 5 '12 at 12:29
  • Another hint: Since you're already using the amsmath package, you may want to use the package's command \text instead of the basic-LaTeX \mbox. In the present case, the outcome is the same. However, in more general math settings, \mbox may give you undesired results because it sets its argument always in \textstyle, whereas \text adapts the size of its output to the surrounding math mode (which could be \scriptstyle or \scriptscriptstyle). – Mico May 5 '12 at 13:08
28

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

  • 2
    Using flalign environment with an extra & at the end of the last equation line also will align the system of equations to the left. – Mehran Ebrahimian Jun 17 '15 at 17:40
  • 1
    There are cases when the flalign environment does not work (due to a certain package). In those cases, the above is a very neat solution. – Ioannis Filippidis Dec 2 '16 at 0:55

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.