3

I have a one-line equation that I want to use just like a statement in algorithmic. I tried with flalign and the equation still goes into the center. Could you please tell me how to fix that? Here is my MWE:

\begin{algorithm}
\begin{algorithmic}
   \State
    \begin{flalign}
    E_i &= \arg\!\max_{E\in \mathcal{E}} F(E)
    \end{flalign}
\end{algorithmic}
\end{algorithm}

The reason I want to use equation instead of simple math mode is that I want {E\in \mathcal{E} to be properly under argmax, rather than a subscript. So if there is a way to do that, I'm happy with the simple $ instead of equation.

Werner
  • 603,163
sean
  • 1,065

1 Answers1

5

Use \displaystyle to force content to be set similar to display math:

enter image description here

\documentclass{article}

\usepackage{algpseudocode,amsmath}

\DeclareMathOperator*{\argmax}{arg\,max}% https://tex.stackexchange.com/q/5223/5764

\begin{document}

\begin{algorithmic}[1]
  \State $\displaystyle E_i = \argmax_{E \in \mathcal{E}} F(E)$
  \State $E_i = \argmax_{E \in \mathcal{E}} F(E)$
\end{algorithmic}

\end{document}

Related: Always using \displaystyle only for \lim

Werner
  • 603,163