# [Tex/LaTex] Commands argmin and argmax in algorithm

algorithmsmacros

I am trying to use the argmin and the argmax commands that I defined in an algorithm but I keep getting the argument not in the middle but on the right. Does anyone have an idea how to put the argument in the middle.

I declare the operators:

\DeclareMathOperator*{\argmin}{\arg\!\min}
\DeclareMathOperator*{\argmax}{\arg\!\max}


and I use the following packages to write algorithms:

\usepackage[chapter]{algorithm}
\usepackage{algorithmic}


Full algorithm code:

\begin{algorithm}
\begin{algorithmic}
\STATE some statement here
\WHILE{!stop}
\STATE $s_{i} = \argmin_{p} \| l_{j} - s_{p} \|$
\ENDWHILE
\end{algorithmic}
\end{algorithm}

