Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LaTeX lstlisting not highlighting keywords when basic style is ttfamily

I'm working on a LaTeX document and using lstlisting to display my Java source code. My setup looks like this:

\lstset{
  basicstyle=\ttfamily,
  keywordstyle=\bfseries,
  language=Java,
  frame=single,
  aboveskip=11pt,
  belowskip=11pt,
  breaklines=true,
  breakatwhitespace=false,
  showspaces=false,
  showstringspaces=false
}

The keywords are not highlighted bold when using ttfamily, but if I use small or don't specify the basic style, they're highlighted fine.

What am I missing?

like image 485
Lex Avatar asked Mar 25 '10 11:03

Lex


Video Answer


1 Answers

The default font in LaTeX, Computer Modern, does not provide a bold version of the teletype family. You can install this as the bold-extra package; see this FAQ entry for details.

like image 92
Thomas Avatar answered Oct 28 '22 22:10

Thomas