1

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.

  • Do you need the equation to be numbered? – Werner May 18 '16 at 20:30
  • @Werner: No I don't. – qsp May 18 '16 at 20:31
3

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.