This is a followup to this thread. I basically followed the construction offered by @egreg. The following construction throws an error when I have a & b in the line with \pushright. If I omit the b the code runs. Is there a way that I can use \pushright and have symbols to the right of the & sign?
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newcommand{\pushright}[1]{\ifmeasuring@#1\else\omit$\displaystyle#1$\ignorespaces\fi}
\makeatother
\begin{document}
\begin{align}
a & b \pushright{\hfill\text{(foo)}}
\end{align}
\end{document}
Ultimately, what I want to do is have lines like:
\begin{align}
x_{t+1} = & x_t + f(x_t) - c_t \pushright{\hfill\text{(eq of motion)}} \\
x_0 = & \bar{x} \pushright{\hfill\text{(initial condition)}}
\end{align}
and have the phrases eq of motion and initial condition right aligned just to the left of the equation numbers. Thanks!



&=not=&– David Carlisle Dec 30 '17 at 10:16