使用 minted 突出显示单个单词

使用 minted 突出显示单个单词

例如,如果我想写:

\usepackage{minted}

我父母给了我一些钱。我走进商店,found some sweets看到了我喜欢的东西。我决定买下它们。

在上面的文本中,我如何使用 minted 包来突出显示上面的内容

答案1

如果您也对浅灰色背景感兴趣,您可能会发现以下两种方法之一很有用:

在此处输入图片描述

\documentclass{article}
\usepackage{geometry}
\usepackage{xcolor} % For the first and second example
\definecolor{mylightgray}{RGB}{239,240,241}
\usepackage{soul} % For the second example
\sethlcolor{mylightgray}

\begin{document}
My parents gave me some money. I walked in the shop and \colorbox{mylightgray}{\texttt{found some sweets}} that I liked. I decided to buy them.

My parents gave me some money. I walked in the shop and \hl{\texttt{found some sweets}} that I liked. I decided to buy them.
\end{document}

请注意,第一个示例不允许在灰色框内换行。

相关内容