如何使 minted 做粗体关键字?

how to make minted to do bold keywords?

我想像 minted 包手册中那样为 minted 呈现的源代码使用粗体字体。当前关键字使用通常的字体。

\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}

结果:

问题是 Computer Modern Typewriter 字体中没有粗体 tt 系列。请尝试 lmodern

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{minted}

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

详情见Using \ttfamily with \bfseries (or how to enable bold in fixed-width font)