3

I am using LyX and I want a multiline and multicolumn display formula with each column aligned to the left.

But when I add a formula and add columns, some are aligned to the right and some are aligned to the left.

How do I control it and make all columns aligned to the left?

  • 3
    Short answer: Leave the first, third, fifth etc. column empty, place the content in the second, fourth etc. – Torbjørn T. Mar 12 '13 at 10:00
  • @TorbjørnT.: Thanks. That works, but now there is a big gap between the columns I do use. Can it be eliminated or narrowed? – user302099 Mar 12 '13 at 10:57
5

When you use the align environment (Insert --> Math --> AMS Align), the columns are aligned as rlrlrl..., as the usual use case is alignment around a relation. If you leave the odd columns (first, third, etc.) empty and place the content in the even columns, you will have just left alignment. This will, however, distribute the columns evenly over the text width, so if you have few/narrow columns, there may be a lot of white space between them.

An alternative then is to first add a normal display math environment (Ctrl + Shift + M) and within this add an aligned environment: Insert --> Math --> Aligned. This has the same alignment as align, so you would have to leave columns empty, but there won't be the extra space between them.

enter image description here enter image description here

  • The AMS Aligned method solves my problem well. – user302099 Mar 12 '13 at 11:52
1

It sounds as if LyX is creating an align environment, or one of its cousins. This is one of a handful of multiline math environments provided by the amsmath package.

As far as I'm aware, no package provides a math environment in which all columns are left-aligned. However, the alignat environment will probably allow you to do what you are looking to do. You have to specify how many pairs of (right-aligned, left-aligned) columns you want with the alignat environment, but all of these column pairs will be flush with one another, so that it will look like just a sequence of left-aligned columns if you leave the right-aligned ones empty. Try the following on for size:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{alignat}{3}
  & a+b+c && = d+e && = f \\
  & E         && = \tfrac{1}{2}mv^2 - \frac{GMm}{r}
\end{alignat}
\end{document}

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.