Can you help me on this one?
The word min in the line \If{ $c (\mathbf{x}) < c^{\text{min}} $}
is coming out in math mode, while in the others, in text mode.
\documentclass{article}
\usepackage{amsmath,amssymb}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}
\usepackage[ruled]{algorithm2e}
\begin{document}
\begin{algorithm}
\DontPrintSemicolon
\KwIn{Blalalala.}
\KwOut{Blalalala}
\For{$t = 1$ \text{to} $T$}{
Fit $\Psi_{t+1}$ to $\mathcal{H}_{t}$\\
$\mathbf{x} \leftarrow \argmax_{\mathbf{x} \in \mathcal{X}} a(\mu (\Psi_{t+1} (\mathbf{x})) ,\sigma(\Psi_{t+1} (\mathbf{x})) , J^{\text{min}} )$\\
Check $c=J(\mathbf{x})$\\
$\mathcal{H}_{t+1} \leftarrow \mathcal{H}_{t} \cup \left\lbrace (\mathbf{x},c) \right\rbrace $\\
\If{ $c (\mathbf{x}) < c^{\text{min}} $}{
$\mathbf{x}^{\text{min}},c^{\text{min}} \leftarrow \mathbf{x},c $
}
}
\Return $\mathbf{x}^{\text{min}}$
\caption{Testing}
\end{algorithm}
\end{document}
mathmode
totextmode
that often, don't you? Did you try to do this algorithm all in onemathmode
(defining/substituting the necessary commands, …)?\begin{math}
before\For
and\end{math}
after\caption
gives me. Maybe this helps you further. This probably has something to do with the\If
statement.\text{min}
with the already existing\min
operator which seems to provide the desired result ?min
with an accent oni