I have this snippet:
\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
\begin{document}
\begin{algorithm}
\While{$|\text{OPEN}| > 0$}{
$u = \textsc{ExtractMinimum}(\text{OPEN})$ \\
}
\caption{\textsc{$A*$}$(s, t, w, h)$}
\end{algorithm}
\end{document}
which produces the following output:
My problem is that I cannot find a way to make LaTeX typeset on the first line "OPEN" instead of "OPEN"? Any advice?
Best Answer
The
algorithm2e
environment sets the first argument to\While
usingArgSty
, which is, by default,\emph
. When you use\text
in math mode, the font which was current when the formula started is used, italics, in this case.The style that by default is rendered in italics is
FuncArgSty
.