I want to disable globally the italics style in the program names.
I have seen this post which is on a similar question, and which suggests to use \SetArgSty{upshape} to disable globally italics in if conditions of algorithm2e.
I want to do the same, but for program names.
On the algorithm2e manual, I have seen that there exists a similar \SetProgSty command, however it does not seem to solve my problem:
\documentclass{article}
\usepackage[vlined,boxed,linesnumbered]{algorithm2e}
\SetProgSty{upshape}
\SetKwProg{Operation}{operation}{ is}{}
\begin{document}
\begin{algorithm}[ht]
\Operation{add_one$(x)$}{\textsf{return} $x+1$}
\end{algorithm}
\end{document}
What I get:
What I want:
I have tried all other \Set...Sty commands, and I have also tried relax and textnormal instead of upshape, but nothing seems to work.
How to do that please?



algorithm2eis a really good package but it is funny in the same breath, defines things itself without using other packages likecaptionetc, it is not the easiest package but does work when you know how to go through the source code, I highly recommend going throughalgorithm2e.stycontained on Overleaf, TeXlive or whichever you use as you get more confident with the code/styles etc. Hope my answer helps! – JamesT Apr 12 '23 at 13:39\Operation{$\mathrm{add\_one}(x)$}{\textsf{return} $x+1$}– egreg Apr 12 '23 at 13:45