I use minted to style my codes in a document. But in some cases, there is a weird box in the code in which most of the time a quotation mark is encircled.

The following MWE shows my problematic issue.




>>> str
<class 'str'>
>>> str.count
<method 'count' of 'str' objects>


enter image description here

closed as off-topic by TeXnician, Stefan Pinnow, Troy, dexteritas, Marijn Aug 4 '18 at 14:27

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – TeXnician, Stefan Pinnow, Troy
If this question can be reworded to fit the rules in the help center, please edit the question.

  • It is not weird, but the lexer recognizes class as a keyword for the declaration of a class (which has a name and not a quoted string), not as terminal output. So you have to create your own lexer (which is not related to minted, but pygmentize) or search for a python console lexer (which seems to exist in pygments.lexers.python.PythonConsoleLexer). – TeXnician Aug 4 '18 at 9:00
  • 3
  • For highlighting console output, you want the pycon lexer, not python. – G. Poore Aug 6 '18 at 13:22
  • @G.Poore OK. How can do it?! I've used minted and it does everything! Is there any option for applying it to get a better result? – javadr Aug 7 '18 at 7:12
  • @javadr \begin{minted}{python} -> \begin{minted}{pycon} – G. Poore Aug 7 '18 at 10:46

Browse other questions tagged or ask your own question.