I'm a new user of minted, and I have a LaTeX fragment that looks like this:

`s` = input(`prompt`)

I was previously using the listings package:

`s` = input(`prompt`)

In that package (with appropriate settings), the effect of the single back-quotes was to italicize the code between them, as follows: enter image description here

At least using the default settings, this doesn't work in minted. Is it possible to achieve the same effect using single-character delimiters? If not, what would be the simplest command to use instead?

The purpose is to distinguish between actual code and placeholder arguments or variables.

EDIT: In addition, I would like to be able to underline snippets of code within longer lines, so answers that address both needs (underlining and italicizing) would be appreciated.


Since posting the above, I found the escapeinside option, which allows the following:

|\emph{s}| = input(|\emph{prompt}|)

This sort of works, but it appears to override the color assigned by minted, and it requires much messier code than I would like.

In short, a solution, but not as nice as I'd like. Also, while it works in the vast majority of case, it occasionally fails for reasons I don't understand:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.