# argmin doesn't work in algorithmic table [duplicate]

I'm using \DeclareMathOperator*{\argmin}{argmin} for getting the argmin parameter. Every thing is Ok expect if I type it inside algorithmic table, it fails to show the correct output. In the below picture, the scenario is shown

The code for this picture is

\documentclass{article}
\usepackage{algorithm,algpseudocode,float}
\usepackage{amsmath}

\DeclareMathOperator*{\argmin}{argmin}

%-----------
\makeatletter
\newenvironment{breakablealgorithm}
{% \begin{breakablealgorithm}
\begin{center}
\refstepcounter{algorithm}% New algorithm
\hrule height.8pt depth0pt \kern2pt% \@fs@pre for \@fs@ruled
\renewcommand{\caption}[2][\relax]{% Make a new \caption
{\raggedright\textbf{\ALG@name~\thealgorithm} ##2\par}%
\ifx\relax##1\relax % #1 is \relax
\else % #1 is not \relax
\fi
\kern2pt\hrule\kern2pt
}
}{% \end{breakablealgorithm}
\kern2pt\hrule\relax% \@fs@post for \@fs@ruled
\end{center}
}
\makeatother

\begin{document}

$$a = \argmin_s$$

\begin{breakablealgorithm}
\caption{XXXXXXXXX}
\begin{algorithmic}[1]
\State{$\text{A} = \argmin_s B$}
\end{algorithmic}
\end{breakablealgorithm}

\end{document}


My question is now why it doesn't work properly inside the algorithm.

• – Werner Feb 25 '15 at 1:56
• @Werner, thanks for that. I usually don't use it but here just for the example. – CroCo Feb 25 '15 at 1:57

Inside the algorithmic environment you're in regular text-style when entering math mode. And operators in text-style have their limits displayed in that way rather than underneath/over top. You have to force an explicit \displaystyle to have it set in the same way:

\documentclass{article}
\usepackage{algorithm,algpseudocode,amsmath}

\DeclareMathOperator*{\argmin}{argmin}

\begin{document}

$a = \argmin_s$

\begin{algorithm}
\caption{XXXXXXXXX}
\begin{algorithmic}[1]
\State $\text{A} = \displaystyle\argmin_s B$
\end{algorithmic}
\end{algorithm}

\end{document}


I wouldn't do it though.

• I'd suggest \argmin\limits instead. However it's a duplicate. – egreg Feb 25 '15 at 8:03