3

I've got the following problem: I want to print a listing with the listings package and lstlisting:

\documentclass{scrreprt}

\usepackage{listings}


\begin{document}

\begin{lstlisting}[language=Haskell,basicstyle=\ttfamily,keywordstyle=\bfseries]
class Show a where
  show :: a -> String
\end{lstlisting}

\end{document} 

But in the result I get, the keywords are not printed in bold font! This problem does not occur when I remove the basic style key-value-pair, but without this style, the listings look ugly.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Related: tex.stackexchange.com/a/33041/21891 – jub0bs Aug 13 '13 at 11:00
  • Standard CM fonts does not include boldface tt – daleif Aug 13 '13 at 11:11
  • 1
    Just add \usepackage{lmodern}. – Mensch Aug 13 '13 at 14:26
  • Do you want the keywords in bold typewriter font or just bold? – karlkoeller Aug 13 '13 at 15:57
  • Both in typewriter and bold – M.B. Aug 14 '13 at 10:16
3

Add

\usepackage{courier}

in the preamble.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.