# Removing italic formatting from if statement

I would like the if statement to have "current stage" in serif and "satisfies" as normal text. The following code produces both with italics:

\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
\begin{algorithm}

\If{\textsf{current\_state} \textrm{satisfies} \textsf{goal}}
{
return \textsf{existing\_plan}
}
\end{algorithm}
\end{document}


Any ideas?

-
With both of the solutions below, I would strongly recommend abstracting these concepts into new commands, e.g. \Var{current-state} \Satisfies \Var{goal}. If you use xparse and a tiny bit of expl3, you can auto-replace - to _. –  Sean Allred Jul 30 '14 at 18:33

The algorithm2e package uses \ArgSty to typeset the argument of \If. If you don't want italics, add

\SetArgSty{textup}


Complete example:

\documentclass{article}
\usepackage{algorithm2e}
\SetArgSty{textup}

\begin{document}

\begin{algorithm}
\If{\textsf{current\_state} satisfies \textsf{goal}}
{
return \textsf{existing\_plan}
}
\end{algorithm}

\end{document}


-

You can use \textup instead of \textrm as suggested by egreg. The code now reads like this:

\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
\begin{algorithm}

\If{\textsf{current\_state} \textup{satisfies} \textsf{goal}}
{
return \textsf{existing\_plan}
}
\end{algorithm}
\end{document}


and the output as required:

-
I'm sorry I couldn't mark yours as the answer too because it's definitely correct. I went for the other because it was visually exactly the effect I was after. I gave an upvote as compensation. Thanks for your help! –  Phlox Midas Jul 30 '14 at 20:08