Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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? –  Andrew Swann Dec 18 '12 at 14:27
add comment

1 Answer

up vote 3 down vote accepted

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 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

share|improve this answer
    
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 '12 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? –  Torbjørn T. Dec 19 '12 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 '12 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. –  Torbjørn T. Dec 19 '12 at 18:24
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.