# Customizing font used by algorithmicx

I am using algorithmicx to typeset my algorithms in XeTeX. Using fontspec, I set the default font to be Linux Libertine with historical ligatures (e.g., ct, st). Unfortunately, this is also the font used by algorithmicx to typeset my algorithms and historical ligatures look very much out of place there.

This is likely a newbie question, but is there any way to customize the font used within the algorithmic environment without specifying the custom font at the beginning of each such environment?

A simple solution is to define a new environment

\newenvironment{halgorithmic}
{ \begin{algorithmic}\algofont }
{ \end{algorithmic} }


and use halgorithmic instead of algorithmic. Is there a cleaner method that comes to mind?

• Not much else, unless you want to include it in the definition of algorithmic. This would allow you to use leave your code unchanged. – Werner Oct 28 '13 at 3:27

\let\algorithmicOLD\algorithmic

Now you can use \begin{algorithmic} directly. The advantage is that it can't happen to you that you'd use the wrong one, getting the wrong fonts.