I really like the pxfont
package for displaying code in listings. I would usually just do this to load pxfont
for the entire document;
\usepackage{pxfonts}
.
However, this time I am required to use a template with mandatory fonts for the text. I would still like to use pxfonts for the code listings, but can not set it globally, as it would overwrite the mandatory non-listings font settings.
Is there any way to isolate the usage of pxfonts to listings only? I have tried various combinations of \newcommand
and \renewcommand
to 'capture' the font settings, reset them to default, and use the captured version to set the listings' basicstyle. Sadly, I lack the experience and I didn't get anything working.
Any ideas?
\ttfamily
or in the default waylistings
works? Side remark: Very, very recently a new packagenewpx
was published “meant to be a replacement for Young Ryu’spxfonts
”.pxfonts
, it's a matter of saying\renewcommand{\ttdefault}{pxtt}
in your preamble.