1

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.

6
  • flalign does something like this.
    – Someone
    Aug 20, 2023 at 14:40
  • What if you have a right-aligned equation tag?
    – Stephen
    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
    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. Aug 20, 2023 at 17:40
  • @barbarabeeton ah yes, that works, thank you! I couldn't find any the same question anywhere.
    – Somniare
    Aug 20, 2023 at 17:55

1 Answer 1

0

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.

\documentclass{article}
\usepackage{amsmath}

% these two packages just for the example
\usepackage{lipsum}
\usepackage{showframe}

\begin{document}

\lipsum[1][1-4]
\[
\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)
\]
\lipsum[2][1-4]
\[
\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)$}
\]
\lipsum[3][1-4]
\[
g(x) = \operatorname*{arg\,max}_{c \in \mathcal{Y}}\mathcal{P}(f(x + \epsilon)=c), 
\qquad \epsilon \sim \mathcal{N}(0, \sigma^2I)
\]
\lipsum[4][1-4]

\end{document}

You must log in to answer this question.

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