# Flushed-left and flushed-right text in align or alignat environment

Using the align or alignat environment, how do I achieve something that looks like the below?

I want the equations and equals signs to be, as usual, all nicely aligned at the center and also whatever custom text I want flushed left and right on both sides of each line, whenever I want it.

• This is probably easier with tabularx instead of align. – Peter Grill Apr 20 '18 at 2:41
• @PeterGrill: How would I do that? – dtcm840 Apr 20 '18 at 2:50

Here is an attempt with align* and tabularx:

## Code:

\documentclass{article}
\usepackage{mathtools}
\usepackage{tabularx}
\usepackage{showframe}

\newcolumntype{Y}{>{\raggedleft\arraybackslash}X}

\begin{document}
\noindent
With \verb|align*|
\begin{align*}
&\text{Hi}        &    1+1 &=2  &\text{I}                                 \\
&\text{can have}  &  1+1+1 &=2  &\text{whatever text}                     \\
&\text{I like}    &      1 &=1  &\text{flushed left}                      \\
&\text{and right} &      1 &=1  &\text{with tabularx, equation at center} \\
\end{align*}
%
With \verb|tabularx*| (left and right columns of same size)
\medskip\par\noindent
\begin{tabularx}{\linewidth}{@{}X r@{}l Y@{}}
Hi         & $1+1$ & ${}=2$ & I                                 \\
can have   & $1+1 +1$ & ${}=2$ & whatever text                     \\
I like     & $1$ & ${}=1$ & flushed left                      \\
and right  & $1$ & ${}=1$ & with tabularx, equation at center \\
\end{tabularx}
\end{document}