I wish to add a few keywords to some python code inserted into a LaTeX document. I want to make True
& False
appear yellow and also some module calls such as ttk
appear red. I have tried using the morekeywords call, however, it is not working for me. Below is my LaTeX code:
\newcommand\pythonstyle{\lstset{
language=Python,
basicstyle=\ttm,
otherkeywords={self},
keywordstyle=\ttb\color{deepblue},
morekeywords={ttk}
emph={MyClass,__init__},
emphstyle=\ttb\color{deepred},
stringstyle=\color{deepgreen},
showstringspaces=false
}}
Best Answer
You can use
to add another set of keywords and then
to give a style for this new set.
Since I didn't have the original definitions for your colors nor of the \ttb command, in the example below I used some own settings, but you can easily use your own settings; the code was randomly taken, just for this example.
Please notice that "ttk" is being treated as a keyword with red color, as was also requested.