I want to create a Python's code snippet which includes single quotes using minted package. I've put it altogether like this:

>>> D.mro()
[<class '__main__.D'>, <class '__main__.B'>, <class '__main__.C'>,
<class '__main__.A'>, <class 'object'>]

But the output does look a bit odd:

Minted handling single quotes

However changing single quotes to double quotes does not seem to work either. Does anyone know how to fix such behaviour? Thanks

  • Using listings doesn't lead to this issue so I think this is a bug of Pygments.
    – user156344
    Apr 6 '19 at 13:21
  • You're right, since the snippet represents the console output after the python's code execution, one workaround might be changing the language from python to bash.
    – marthin23
    Apr 6 '19 at 13:26
  • Have a look at tex.stackexchange.com/questions/36889/… (in short: test the pycon lexer).
    – TeXnician
    Apr 6 '19 at 13:26
  • 1
    Just a warning: The pycon lexer does output different classifications so your chosen vs style will not work (in case you wonder why everything is black) ;)
    – TeXnician
    Apr 6 '19 at 13:32
  • Did the link I provided help you (may we close this as duplicate)?
    – TeXnician
    Apr 7 '19 at 12:02

Browse other questions tagged or ask your own question.