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
.
\hfill
worked. – Manuel Nov 20 '12 at 13:28align
-- only later did I learn that I did not properly understand how to fully usealign
and the relatedalignat
(and eventabular
/array
). So, if you show (in perhaps a different question) exactly what you want to achieve (as opposed to how you want to achieve it) you may get better answers. If I am mistaken, please ignore this comment. – Peter Grill Nov 20 '12 at 18:57\mathhfill
). But I thought What if we could simply, without head ache, usehfill
,dotfill
, etc. inalign
exactly as we use in text mode? At this moment the @egreg answer fits me, but my real objective is to have a command\mathhfill
and\mathdotfill
which work exactly like the normal ones, but inalign
. – Manuel Nov 20 '12 at 19:24