5

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?

1
  • Point 2. is not a problem, the space does not affect the output. For 1., is the problem that LyX gobbles the second &? If so, could write &{} instead? Dec 18, 2012 at 14:27

1 Answer 1

5

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

7
  • Your solution does not seem to work if there are 3 columns with content instead of 2. If I use 3 columns I get the first two columns aligned on the left and the third on the right. Is the the normal behaviour of flaling?
    – gioele
    Dec 19, 2012 at 16:54
  • @gioele I think I was a bit inaccurate. In the above image there is in fact three columns, the two that are there by default, and the third one I added manually. In flalign, if you have more than one pair of columns, the first pair will be flush left, the last one flush right, and the rest distributed between them. So with three pairs, i.e. six columns total, the first pair will be on the left, the second pair in the middle, and the third pair on the right. Did that answer your question? Dec 19, 2012 at 17:04
  • Well, I was referring to 3 columns with content. Anyway, thank you for your explanation. Now I see what was the issue I was experiencing.
    – gioele
    Dec 19, 2012 at 18:12
  • @gioele Yes, but the image above has got three columns with content, but the content in the third column is just an empty group, which doesn't appear in the PDF. Dec 19, 2012 at 18:24
  • Can you clarify the C+L followed by { (I am getting this instead of {empty square}): is it the trick to specify the deliminator with & or do I mistunderstand this thread? Are you able to instruct here?
    – hhh
    Mar 6, 2016 at 11:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .