Search code examples
latexbeamer

how to make minted to do bold keywords?


I would like to have bold font for minted rendered source code like in minted package manual. Currently keywords are in usual font.

\usepackage[table]{xcolor}
\usepackage{minted}
\definecolor{lightlightgray}{gray}{0.9}

\begin{document}
\begin{minted}
{cpp}
  // class A
  class A {
    int boo;
  };
\end{minted}
\end{document}

Result:
enter image description here


Solution

  • The problem is that there is no bold tt family in the Computer Modern Typewriter font. Try lmodern instead:

    \documentclass{article}
    \usepackage[T1]{fontenc}
    \usepackage{lmodern}
    \usepackage{minted}
    
    \begin{document}
    \begin{minted}{cpp}
      // class A
      class A {
        int boo;
      };
    \end{minted}
    \end{document}
    

    enter image description here

    See Using \ttfamily with \bfseries (or how to enable bold in fixed-width font) for details.