0

for example, if I want to write:

\usepackage{minted}

My parents gave me some money. I walked in the shop and found some sweets that I liked. I decided to buy them.

In the above text how do I used minted package to highlight like the above

8
  • 2
    Isn't \texttt{found some sweets} enough? Why do you want to use minted?
    – CarLaTeX
    Aug 18, 2019 at 8:29
  • @CarLaTeX to get the nice grey background
    – piccolo
    Aug 18, 2019 at 8:58
  • There is soul package for that, as in leandris's answer.
    – CarLaTeX
    Aug 18, 2019 at 9:56
  • 2
    Do you actually absolutely need to use minted for a specific reason or was your question about the font shape change and the highlighting? Because then tags and title should be adapted to reflect that.
    – thymaro
    Aug 18, 2019 at 17:14
  • 1
    @piccolo no, it's clear enough. It's just that minted is completely overkill for this specific task. (Which is also the reason for which the provided answer doesn't use minted.)
    – thymaro
    Aug 18, 2019 at 17:26

1 Answer 1

3

If you are also interested in the light gray background, you might find one of the two following methods useful:

enter image description here

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

Please note that the first example will not allow line breaks inside of the gray box.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .