Search code examples
lyx

Insert programming code in a Lyx document


What is the best way of inserting python/C++ code in a Lyx document? The code is small examples less than 20 lines.

My Lyx document is using the Book document class.

Orjanp


Solution

  • There should be an Insert -> Program Listing option. That uses listings Latex package, so you should have that installed. The support seems to have been added in Lyx 1.5, and from their screenshot, it seems it gives you a lot of customization options.