1 #LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
13 \font_typewriter default
14 \font_default_family default
21 \paperfontsize default
29 \paperorientation portrait
32 \paragraph_separation indent
34 \quotes_language english
37 \paperpagestyle default
38 \tracking_changes false
46 Three types of listings
49 \begin_layout Standard
50 There are three types of listings, in listings package terms:
53 \begin_layout Description
54 lstinline short piece of program code like
56 lstparams "language=C++,basicstyle=\ttfamily,showspaces=true"
60 \begin_layout Standard
71 \begin_layout Description
72 lstlisting long program listing in its own paragraphs and decorations, For
75 lstparams "language=Python,numbers=left,numberstyle=\tiny,basicstyle=\ttfamily,numbersep=5pt"
79 \begin_layout Standard
85 \begin_layout Standard
86 'this is a python function'
89 \begin_layout Standard
98 \begin_layout Description
99 lstinputlisting read program listing from a file.
100 Parameters can be given to list only given lines.
101 For example, the following listings list line 10 - 15 of this lyx file.
104 \begin_layout Standard
105 \begin_inset Include \lstinputlisting{listings.lyx}[firstline=10,lastline=15,language=TeX,breaklines=true,caption={Line 10 - 15 of this listings.lyx file}]
113 \begin_layout Section
114 How to enter listings
117 \begin_layout Standard
118 Inline and normal listings are entered through listings inset (introduced
120 To insert a program listing, choose
122 Insert->Program Listing
125 inline listing is selected by choosing
136 \begin_layout Standard
137 File listing is inserted using
139 Insert->File->Child Document
145 from the type combo box.
149 \begin_layout Section
153 \begin_layout Standard
154 The listings package is a very powerful latex packaging, providing more
155 than 130 parameters that customize the look of your program listings.
156 Lyx provides direct support for a few most commonly used parameters through
157 the listings dialog, and an
161 edit box to enter all other parameters.
164 \begin_layout Subsection
165 Global listings options
168 \begin_layout Standard
169 It is likely that your document will have several listings of the same type
170 so it makes sense to customize all of them using global listings options.
171 To enter these options, choose
173 Document -> Settings -> Text Layouts
175 and enter listings parameters in the given edit box.
176 The editbox to the left of the input box can provide valuable information
177 such as allowed values of a parameter but you may still need to consult
178 the listings manual for the meanings of the parameters.
181 \begin_layout Standard
182 Parameters set via this dialog will output as
191 \begin_layout Subsection
192 Parameters of the listings inset
195 \begin_layout Standard
196 If you right-click a listings inset, a listings dialog will be shown that
197 allows you to customize your listings.
198 The most commonly used parameters are displayed on the first tab, including
199 placement, language, numbering and basic style of the code.
200 More advanced options can be entered at the second
207 \begin_layout Subsection
208 Parameters of listings child document
211 \begin_layout Standard
212 The child document dialog provides less support for commonly used listings
213 parameters so you will have to enter them manually.
217 \begin_layout Subsection
221 \begin_layout Standard
230 are handled separately from other listings parameters.
235 dialog, caption ad label should be entered in the given caption and label
237 In a listing inset, you can insert caption through
254 parameters entered through the
258 edit box are allowed, but if both
266 are entered, the latter will be ignored.