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

amsmathhorizontal alignmentlyx

How can I left align an AMS flalign block in LyX?

The answers in Use flalign or alignat or align or similar environment to align to the left say that to left align a set of equations one should use

The formula is
\begin{flalign*}
a &= b+c &\\
  &= 1+1 &\\
  &= 2  &
\end{flalign*}

and that it is important to have an & as the last character of the line.

The problem is that LyX will produce the following LaTeX code:

\begin{flalign*}
a & =b+c\\
 & =1+1
\end{flalign*}

I see two problems here:

  1. there is no & at the end of the lines,
  2. there is a space after the first &.

How can one make LyX create code that will display as a left-aligned block of equations?

Best Answer

You have to add a new column to the flalign, and it seems there must be something in that column, so you can for example add an empty group, i.e. {}, in the second column.

You can add a new column by clicking the enter image description here button on the table toolbar (I guess this pops up e.g. at the the bottom of the LyX window when you're in a flalign.), or using the keyboard shortcut Alt + MCI. That is, hold down Alt and press M, release both and press C followed by I.

In this column hit Ctrl + L (or Cmd + L in OSX) to add an ERT, and type a {. The closing brace is added automatically, I think.

Below is a screenshot of how it may appear in LyX, with the source view at the bottom, and below that a screenshot of the PDF.

enter image description here

enter image description here