On 1/12/22 7:22 AM, Joseph Hesse via lyx-users wrote:
I am writing a programing book and want to have programs that have been prepared with a text editor included in the book.  This is what I have done so far.

Insert->File->Child Document

File: CodeListings/Test.cpp
Include Type: Program Listing
Caption: My Caption
Label: First Program

More Parameters: numbers=left, frame=tb, caption=b, float

It sort of works but I need assistance.
The caption I have set above does not appear on the bottom as "caption=b" would suggest.
The label I have set above does not appear anywhere.

I would like the text of the inserted program to have "typewriter" font and be colored green.  How do I do this.

Am I on the right track, is the above the correct way of doing what I want?

Thank you,
Joe Hesse

Your method of inserting the code is correct. To address your specific concerns:

 * putting the caption on the bottom requires the key/value pair
   "caption/pos/=b";
 * the label is not supposed to appear anywhere; it is used for
   cross-referencing the code elsewhere in the document;
 * the key/value pair to use the typewriter font family and color the
   code olive ("green" would be too hard to read, I think) would be
   "basicstyle={\color{olive}\ttfamily}".

You may need to load the xcolor package (or some alternative) explicitly in the preamble, if your LyX document does not already use colors elsewhere.

HTH,

Paul

-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to