LyXColor formatted Python code.

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
wookie1
Posts: 1
Joined: Wed Apr 13, 2011 1:16 pm

Color formatted Python code.

Post by wookie1 »

Hi I hope someone is able to help me with this.
I'm trying to get colored python code to work in Lyx.
So far I'm inserting file - child document - program listing and would prefer to continue to use this method as I may well need to edit some of my python files and it would be nice to have it update.
In the parameters box I have put in.
backgroundcolor={\color{parchment}}
breaklines=true
frame=tb
language=Python

Where parchment is a color I have defined in the preamble.

I currently get code which uses bold and italics in the correct places but would like them to also be color formatted. I presume I have to edit the language definition for python but have no idea where or how to do so.

Any help would be much appreciated, this has been driving me nuts.
Thanks.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

CSMR
Posts: 44
Joined: Fri Oct 10, 2008 10:44 pm

Re: Color formatted Python code.

Post by CSMR »

Hmm, is there no way to insert html or other formatted text in LaTeX / LyX?
Post Reply