This is over a single line. I honestly thought it would be very simple but so far I have tried:

  • \hfill
  • \hspace*{\fill}
  • \null\hfill
  • \hspace*{0pt}\hfill
  • \mbox{}\hfill

In the following line:

$$g(x) = \underset{c \in \mathcal{Y}}{\operatorname{arg max}} \mathcal{P}(f(x + \epsilon)=c), \hfill \epsilon \sim \mathcal{N}(0, \sigma^2I)$$

All of them result in:

enter image description here

If I just use inline math-mode with a new line, it results in the main equation being left-aligned. I want the main equation to be centrally aligned, with the noise right-aligned.

  • flalign does something like this.
    – Someone
    Commented Aug 20, 2023 at 14:40
  • What if you have a right-aligned equation tag?
    – Stephen
    Commented Aug 20, 2023 at 14:54
  • @Someone flalign only works over multiple lines I believe? At least in this case using an ampersand doesn't move the noise to the right.
    – Somniare
    Commented Aug 20, 2023 at 15:34
  • 1
    You seem to want something like \begin{equation} g(x)...c), \tag{\epsilon \sim ...} \end{equation}. I'm pretty sure this is a duplicate. Commented Aug 20, 2023 at 17:40
  • @barbarabeeton ah yes, that works, thank you! I couldn't find any the same question anywhere.
    – Somniare
    Commented Aug 20, 2023 at 17:55

1 Answer 1


enter image description here

I'd use the last realization, as there is no reason for shoving the side condition to the right margin.

In any case, $$ should never be used in a LaTeX document environment. Also note \operatorname* instead of \underset.


% these two packages just for the example


\hspace{1000pt minus 1fill}
g(x) = \operatorname*{arg\,max}_{c \in \mathcal{Y}}\mathcal{P}(f(x + \epsilon)=c), 
\hspace{1000pt minus 1fill}
\epsilon \sim \mathcal{N}(0, \sigma^2I)
\hspace{1000pt minus 1fill}
g(x) = \operatorname*{arg\,max}_{c \in \mathcal{Y}}\mathcal{P}(f(x + \epsilon)=c), 
\hspace{1000pt minus 1fill}
\makebox[0pt][r]{$\displaystyle \epsilon \sim \mathcal{N}(0, \sigma^2I)$}
g(x) = \operatorname*{arg\,max}_{c \in \mathcal{Y}}\mathcal{P}(f(x + \epsilon)=c), 
\qquad \epsilon \sim \mathcal{N}(0, \sigma^2I)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .