How can I left-justify text in centered math mode? [duplicate]

If I want to achieve something like the following:

where the text before the equaions is left-justified, how can I do that? So far I've been using stuff like

\llap{ Which gives us \hspace{3cm}} f;g;h = fg;h = fgh = f;gh


where I have to tweak the amount of hspace each time. I'm often, but not always, doing this inside the gather environment.

I suppose I could make an array with lcc columns, and put some \hfill in the left column, but how do I tell it to center the line on the middle column?

• The \hspace{3cm}within \rlap does nothing. Try an flalign environment, with the text in the first column, and the math alignment in the middle column. But why don't you simply use \(short)intertext? Nov 14 '16 at 2:11
• often in a situation like this, \intertext is used (or \shortintertext from mathtools). of course, that puts the text on a separate line. Nov 14 '16 at 2:12
• @Bernard Sorry, I met \llap. Is there a way not to put the text on a separate line? Nov 14 '16 at 2:13
• \llap should be used only at the right margin. Nov 14 '16 at 2:39
• @Bernard Why not? Nov 14 '16 at 3:05

1 Answer

Here is a solution with flalign*:

\documentclass{article}
\usepackage[showframe]{geometry} %
\usepackage{mathtools}

\begin{document}

\begin{flalign*}
&  & f; gh &  = f\,gh  &  &\llap{from side  $(0,1,3)$} \\
&  & f; g &  = gh &  &\llap{from side  $(0,1,2)$} \\
&\rlap{Which gives us}  & f; g; h = f\,g; h &  = f\,gh  =  f; gh \\
&\rlap{And inverting  $f$  gives us}  &    g; h &  = gh &  &
\end{flalign*}

\end{document}