0

I have noticed that, for multiple single-column lines, flalign produces right-aligned formulas, while other alignment environments provided by amsmath produce center-aligned formulas. See the MWE below.

enter image description here

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document} \begin{gather} \int_{a}^{b} f(t) , dt = F(b) - F(a) \ a^2 = b^2 + c^2 \end{gather}

\begin{flalign} \int_{a}^{b} f(t) , dt = F(b) - F(a) \ a^2 = b^2 + c^2 \end{flalign} \end{document}

amsmath’s user’s guide does not explain this behavior.

How do I center-align formulas in flalign?

Note that I do not want to align lines at, for instance, the equal sign. I want formulas to be centered relative to the page’s full body width, and I need to achieve this using flalign (I’m doing this).

  • 2
    like all ams alignments flalign alternates between right and left alignment and as you have no & you get right alignment. specifying flalign but giving no alignment points is basically user error – David Carlisle Jul 31 '23 at 17:15
  • use gather* and set \mathindent to zero – David Carlisle Jul 31 '23 at 17:16
  • @DavidCarlisle I tried putting && before and after the formulas of each line inside flalign but the result is the same: right-aligned formulas. – donjuardo Jul 31 '23 at 17:17
  • 3
    yes naturally, if you put && before the formula you have two empty columns and the formula in column 3 so again right aligned – David Carlisle Jul 31 '23 at 17:18
  • 1
    the only ams multi line display that centers is gather as that does no alignment, so the answer here is to use gather – David Carlisle Jul 31 '23 at 17:22
  • @DavidCarlisle The issue is that when using gather I cannot type left-aligned text beside and on the same line as the formulas, as explained [here][1]. That is my end goal, but with center-aligned formulas.

    [1] https://tex.stackexchange.com/a/61340/301662

    – donjuardo Jul 31 '23 at 17:28
  • Is there a reason for your apparent refusal, or reluctance, to use & for the purpose of setting alignment points? – Mico Jul 31 '23 at 17:55
  • maybe you should ask a question about that, as as written there is no answer other than use gather. all alignment environments: align, aligned, flalign, split, ... have right alignment in odd columns and left alignment in even – David Carlisle Jul 31 '23 at 17:56
  • @Mico Yes. The formulas I’m working with have a lot of text and no specific anchor point for alignment that looks good (as is the case with equations), so having them centered would be more aesthetically pleasing. – donjuardo Jul 31 '23 at 18:00
  • @donjuardo - In that case, you should follow David Carlisle's earlier advice, which is to gather and gather* environments. – Mico Jul 31 '23 at 19:00

1 Answers1

1

It can be done using \nathclap (mathtools), but gather is easier.

\documentclass{article}
\usepackage{mathtools}

\begin{document} \begin{gather} \int_{a}^{b} f(t) , dt = F(b) - F(a) \ a^2 = b^2 + c^2 \end{gather}

\begin{flalign} && \mathclap{\int_{a}^{b} f(t) , dt = F(b) - F(a)} &&\ && \mathclap{a^2 = b^2 + c^2} && \end{flalign} \end{document}

demo

John Kormylo
  • 79,712
  • 3
  • 50
  • 120