[Tex/LaTex] \hfill in math mode revisited

alignhorizontal alignmentmath-mode

I would like to push an element to the right of a displayed equation (with numbering), without changing the position of the equation.

This can be achieved by abusing the label functionality of amsart, using \tag* in an align environment:

\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath}

\begin{document}
\lipsum*[1]
\begin{align}
    a = b \tag*{$b \in B$}
\end{align}
The equation number was replaced.
\end{document}

I would like to achieve the same result in a document with left equation numbering, ideally with the option of having an equation number on the left.

\documentclass[leqno]{article}
\usepackage{lipsum}
\usepackage{amsmath}

\begin{document}
\lipsum*[1]
\begin{align}
    a = b \tag*{$b \in B$}
\end{align}
The description should be on the right.

\begin{align*}
    a = b \hskip \textwidth minus \textwidth b \in B
\end{align*}
Here the displayed equation is pushed to the left.

\end{document}

Best Answer

You can use flalign for this, but I don't recommend it. The condition is part of the statement, so it should be next to it.

\documentclass[leqno]{article}
\usepackage{lipsum}
\usepackage{amsmath,mathtools}

\begin{document}
\lipsum*[2]
\begin{flalign}
&&    a = b &&b \in B
\end{flalign}
\lipsum*[2]
\begin{flalign}
&&    a = b &&\mathllap{b \in B}
\end{flalign}
The description should be on the right; but actually
the condition should be next to the equation, as pushing
it far away from it would make the reading very awkward
\begin{equation}
a=b \qquad (b\in B)
\end{equation}

\end{document}

In the example I show how to center the main part without taking the condition into account. But, really, the right way is the final one, which is also independent on the placement of the equation number.

enter image description here