Md. Golam Parvez wrote:
Hi
I am using lyx-1.5.6 in UBUNTU 8.04. Can anybody tell me how to insert
colored program listing. Thanks in advanced.

Golam Parvez


First, make sure you have the listings LaTeX package (listings.sty) installed, as well as one of the color packages (color.sty or xcolor.sty).

In LyX, use Document -> Settings -> Preamble to load the color package (e.g., \usepackage{xcolor}).

Now use Insert -> Program Listing to get a listing inset, into which you insert your code. Right-click the handle (the word "Listing") to get the settings dialog. In the Main Settings tab, use the lower left portion to select your language and, if necessary, dialect. In the Advanced tab, type in parameters from the listings.sty LaTeX package to control colors. For instance, 'keywordstyle=\color{blue}' will set keywords in a blue font. Consult the documentation of the listings package for possible color settings.

/Paul

Reply via email to