3
votes
1answer
51 views

Customize Color for lstset morekeywords

I have done some extensive searching and have yet to find the answer to changing the color for lstset morekeywords. I want them to be a different color than my regular keywords. Here is what I have ...
3
votes
1answer
41 views

Problem with listings package for Python syntax coloring

I am implementing the method I learned here for putting Python code in Latex. Everything works great except that I have problems with comments. Here's the code from the link I mentioned: ...
3
votes
1answer
640 views

How to define default 'program listing' title and parameters in Lyx

I'm using LyX software and need to embed python code snippets and the option I found is to put snippet in a file and then use: insert> file> Child Document ----> choose the snippet file ----> set ...
1
vote
0answers
26 views

How to use \lstinline inside figure environment's caption argument [duplicate]

Here is the code that I have (I have removed parts which I think are not relevant): \documentclass[12pt]{article} \usepackage{listings} % Python style for highlighting ...
6
votes
1answer
1k views

Adding words to lstlisting for Python langaue

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 ...
19
votes
2answers
9k views

How to highlight Python syntax in LaTeX Listings \lstinputlistings command

I am using package listings to import my Python source code into my LaTeX document. I use the command \lstinputlistings. I have a Python source like class MyClass(Yourclass): def __init__(self, ...
8
votes
2answers
3k views

Python code in LaTeX document

I want to include some Python code into LaTex document, so I "imported" the listings package with \usepackage{listings} and \lstdefinelanguage{Python}{ keywords={typeof, null, catch, switch, in, ...