A journal has asked me to change the font of my algorithm to Courier New. I'm able to change all except the keywords (if, then, else, etc.). My best solution looks like this:
\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
\begin{algorithm}[H]
{{\fontfamily{pcr}
\If {{\fontfamily{pcr}\selectfont condition}}
}}
\end{algorithm}
\end{document}
Best Answer
You can set each of the algorithm components individually (through settings like
\SetKwStyle
,\SetArgSty
,\SetDataSty
, ...), or change the font at the start of everyalgorithm
automatically by adjusting\textnormal
:etoolbox
was used to tap into\begin{algorithm}
.