Inside an equation-like environment, I'd like to have some text that is aligned to the left margin of the text block, something like \intertext
, but in the same line as the equation
Something like this:
\usepackage{amsmath,mathtools}
\newcommand*{\midmathskip}{\hskip0.5\displaywidth\hskip-0.5\totwidth@}
\newcommand*{\lefttext}[1]{\llap{\rlap{#1}\midmathskip}}
\begin{align}
\lefttext{and similarly}
\hphantom{nn-nn}
\mathllap{hwnn} &= H+hw. \\
\lefttext{Thus}
nn-nn &= 1.
\end{align}
of course, the \hphantom
and \mathllap
are just hacks to make it look right in this case, but I'm looking for something that would work in a gather environment too. flalign
could help, for it alters the alignment of the equations (they are not in the center of the text block any more), and it doesn't help with gather
anyway.
As a bonus, it would also be nice if it worked with aligned
and alignedat
.
Best Answer
This is a variant, which works with math-environments which understand
\tag
. Together with the class-optionleqno
it doesn't work thou. I learned this approach from Philipp Stephani. It works the same way asamsmath
s intertext, but puts the text on the same line as the equation.Output: