Is there any easy way of declaring a new command which emulates \hfill
in math mode. I don't want flalign
or something similar. I want to use the command in the same way (and with the same freedom) I use \hfill
.
Is that possible?
i.e. this is an example:
\begin{align*}
a + b + c &= a + b + c + d + e + f + g + h + i \\
& \mathhfill \text{(foo)}
\end{align*}
where I want (foo)
to be right aligned (under + h + i
and here
\begin{align*}
a + b + c + d + e + f + g + h + i &= a + b + c \\
\text{(foo)} \mathhfill &
\end{align*}
I want the text aligned on the left (just under the a + b +
. But I don't want flalign
or other solutions. Because there are lots of situations (this is a minimal example). And I would like to see a solution which work just as \hfill
.
EDIT: well, as Carlisle said, it works in $a \hfill b$
, but I would like to see it working in align
, i.e.
EDIT2: The answers solved my needs. But it would be great if somebody would give a command which works exactly like \hfill
or i.e. \dotfill
in align
.
Best Answer
You can do it, but not with
\hfill
, because of howalign
works. Here's a way:A slightly different implementation allows you to use
\hfill
where you want:I'd recommend against using the simple
\omit
.