使用 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}

請注意,第一個範例不允許在灰色框中換行。

相關內容