2
votes
1answer
261 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
22 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
729 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 ...
15
votes
2answers
6k 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
2k 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, ...