I'm using Lyx's Insert|Program Listing to insert a code listing into my document. Unfortunately, Lyx seems to ignore the Typewriter font selection I made in DocumentOptions under Fonts ⇒ Typewriter. Interestingly enough, typewriter font does come out correctly elsewhere, but not in program linstings.
Can someone help me figure out why? I'm using Lyx 2.0.2 and am using XeTeX for output.
Best Answer
Program listings does not actually use the typewriter font family by default, so you have to change this in the settings. To change it for a single listing, right click it, choose Settings and select Typewriter as Font family.
To make it a global change, go to Document --> Settings --> Listings, and type in the following option:
For the spacing, try adding
to the options list for listings. I'm not entirely sure about this, though the different choices for
columns
is described in thelistings
manual (listings
is the package used for these program listings), section 2.10 Fixed and flexible columns.