How can I use bold text inside a code listing? I wanted to make some parts of the code bold.
[Tex/LaTex] Using bold/italic text inside listings
bolditaliclistings
bolditaliclistings
How can I use bold text inside a code listing? I wanted to make some parts of the code bold.
Best Answer
As per Mico's answer, there is no boldfaced monospaced font in the Computer Modern font family, so you need to use a font that has bold monospaced font. Below is an example using
listings
that make the keywords bold using thepxfonts
. Here is a comparison of the results without and with the\usepackage{pxfonts}
:Alternate Solution:
You could also use the the courier font form ttfamily with bfseries or how to enable bold in fixed width font: