]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/test/test-minted.lyx.lyx
tex2lyx: complete minted support (inputminted)
[lyx.git] / src / tex2lyx / test / test-minted.lyx.lyx
1 #LyX file created by tex2lyx 2.4
2 \lyxformat 547
3 \begin_document
4 \begin_header
5 \save_transient_properties true
6 \origin roundtrip
7 \textclass article
8 \begin_preamble
9 %% Do not edit unless you really know what you are doing.
10
11
12
13 \end_preamble
14 \use_default_options false
15 \maintain_unincluded_children false
16 \language english
17 \language_package none
18 \inputencoding iso8859-15
19 \fontencoding T1
20 \font_roman "default" "default"
21 \font_sans "default" "default"
22 \font_typewriter "default" "default"
23 \font_math "auto" "auto"
24 \font_default_family default
25 \use_non_tex_fonts false
26 \font_sc false
27 \font_osf false
28 \font_sf_scale 100 100
29 \font_tt_scale 100 100
30 \use_microtype false
31 \use_dash_ligatures true
32 \graphics default
33 \default_output_format default
34 \output_sync 0
35 \bibtex_command default
36 \index_command default
37 \paperfontsize 12
38 \spacing single
39 \use_hyperref false
40 \papersize a4paper
41 \use_geometry false
42 \use_package amsmath 1
43 \use_package amssymb 0
44 \use_package cancel 0
45 \use_package esint 1
46 \use_package mathdots 0
47 \use_package mathtools 0
48 \use_package mhchem 0
49 \use_package stackrel 0
50 \use_package stmaryrd 0
51 \use_package undertilde 0
52 \cite_engine basic
53 \cite_engine_type default
54 \biblio_style plain
55 \use_bibtopic false
56 \use_indices false
57 \paperorientation portrait
58 \suppress_date false
59 \justification true
60 \use_refstyle 0
61 \use_minted 1
62 \index Index
63 \shortcut idx
64 \color #008000
65 \end_index
66 \secnumdepth 3
67 \tocdepth 3
68 \paragraph_separation indent
69 \paragraph_indentation default
70 \is_math_indent 0
71 \math_numbering_side default
72 \quotes_style english
73 \dynamic_quotes 0
74 \papercolumns 1
75 \papersides 1
76 \paperpagestyle default
77 \tracking_changes false
78 \output_changes false
79 \html_math_output 0
80 \html_css_as_file 0
81 \html_be_strict false
82 \end_header
83
84 \begin_body
85
86 \begin_layout Standard
87
88 \begin_inset CommandInset toc
89 LatexCommand lstlistoflistings
90
91 \end_inset
92
93
94 \end_layout
95
96 \begin_layout Section
97 Minted Listings
98 \end_layout
99
100 \begin_layout Standard
101 Inline: 
102 \begin_inset listings
103 lstparams "style=bw,language=C++"
104 inline true
105 status open
106
107 \begin_layout Plain Layout
108 int a=5;
109 \end_layout
110
111 \end_inset
112
113
114 \begin_inset Newline newline
115 \end_inset
116
117  Float (Listing
118 \begin_inset space ~
119
120 \end_inset
121
122
123 \begin_inset CommandInset ref
124 LatexCommand ref
125 reference "Example-Listing"
126 plural "false"
127 caps "false"
128 noprefix "false"
129
130 \end_inset
131
132 ):
133 \end_layout
134
135 \begin_layout Standard
136
137 \begin_inset listings
138 lstparams "language=Python,float=h"
139 inline false
140 status open
141
142 \begin_layout Plain Layout
143 # Example listing float
144 \end_layout
145
146 \begin_layout Plain Layout
147 def func(param):
148 \end_layout
149
150 \begin_layout Plain Layout
151     'this is a python function'
152 \end_layout
153
154 \begin_layout Plain Layout
155     pass
156 \end_layout
157
158 \begin_layout Plain Layout
159
160 \begin_inset Caption Standard
161
162 \begin_layout Plain Layout
163 Example Listing float
164 \begin_inset CommandInset label
165 LatexCommand label
166 name "Example-Listing"
167
168 \end_inset
169
170  
171
172 \end_layout
173
174 \end_inset
175
176
177 \end_layout
178
179 \end_inset
180
181
182 \end_layout
183
184 \begin_layout Standard
185 Here is an example listing with left line numbering, language 
186 \begin_inset Quotes eld
187 \end_inset
188
189 Python
190 \begin_inset Quotes erd
191 \end_inset
192
193  and 
194 \begin_inset Quotes eld
195 \end_inset
196
197 Space
198 \begin_inset space ~
199
200 \end_inset
201
202 as
203 \begin_inset space ~
204
205 \end_inset
206
207 symbol
208 \begin_inset Quotes erd
209 \end_inset
210
211 , range lines from 4 to end:
212 \end_layout
213
214 \begin_layout Standard
215
216 \begin_inset listings
217 lstparams "firstline=4,numbers=left,showspaces=true,language=Python"
218 inline false
219 status open
220
221 \begin_layout Plain Layout
222 def func(param):
223 \end_layout
224
225 \begin_layout Plain Layout
226     'this is a python function'
227 \end_layout
228
229 \begin_layout Plain Layout
230     pass
231 \end_layout
232
233 \begin_layout Plain Layout
234 def func(param):
235 \end_layout
236
237 \begin_layout Plain Layout
238     'This is a German word: Tschüß'
239 \end_layout
240
241 \begin_layout Plain Layout
242     pass
243 \end_layout
244
245 \end_inset
246
247
248 \end_layout
249
250 \begin_layout Standard
251 A floating one-liner with [h] placement and without caption: 
252 \begin_inset listings
253 lstparams "fontfamily=tt,fontsize={\large},bgcolor=lightgray,language=ABAP,float=h"
254 inline false
255 status open
256
257 \begin_layout Plain Layout
258 hello
259 \end_layout
260
261
262 \end_inset
263
264
265 \end_layout
266
267 \begin_layout Standard
268 Another inline listing: 
269 \begin_inset listings
270 lstparams "language=TeX"
271 inline true
272 status open
273
274 \begin_layout Plain Layout
275
276 \backslash
277 begin{centering} hello
278 \end_layout
279
280 \end_inset
281
282
283 \end_layout
284
285 \begin_layout Standard
286 A non-floating listing with line frames and a top caption (Listing
287 \begin_inset space ~
288
289 \end_inset
290
291
292 \begin_inset CommandInset ref
293 LatexCommand ref
294 reference "hello-world"
295 plural "false"
296 caps "false"
297 noprefix "false"
298
299 \end_inset
300
301 ): 
302 \begin_inset listings
303 lstparams "numbers=left,frame=lines,language=C"
304 inline false
305 status open
306
307 \begin_layout Plain Layout
308
309 \begin_inset Caption Standard
310
311 \begin_layout Plain Layout
312 An example C program
313 \begin_inset CommandInset label
314 LatexCommand label
315 name "hello-world"
316
317 \end_inset
318
319
320
321 \end_layout
322
323 \end_inset
324
325
326 \end_layout
327
328 \begin_layout Plain Layout
329 int main()
330 \end_layout
331
332 \begin_layout Plain Layout
333 {
334 \end_layout
335
336 \begin_layout Plain Layout
337     printf("Hello world!
338 \backslash
339 n");
340 \end_layout
341
342 \begin_layout Plain Layout
343     return 0;
344 \end_layout
345
346 \begin_layout Plain Layout
347 }
348 \end_layout
349
350 \end_inset
351
352
353 \end_layout
354
355 \begin_layout Standard
356 A non-floating listing with line frames and a bottom caption (Listing
357 \begin_inset space ~
358
359 \end_inset
360
361
362 \begin_inset CommandInset ref
363 LatexCommand ref
364 reference "func"
365 plural "false"
366 caps "false"
367 noprefix "false"
368
369 \end_inset
370
371 ): 
372 \begin_inset listings
373 lstparams "numbers=left,frame=lines,language=Fortran"
374 inline false
375 status open
376
377 \begin_layout Plain Layout
378 subroutine incr(i)
379 \end_layout
380
381 \begin_layout Plain Layout
382   integer :: i
383 \end_layout
384
385 \begin_layout Plain Layout
386   i = i + 1 
387 \end_layout
388
389 \begin_layout Plain Layout
390   return 
391 \end_layout
392
393 \begin_layout Plain Layout
394 end subroutine function
395 \end_layout
396
397 \begin_layout Plain Layout
398
399 \begin_inset Caption Standard
400
401 \begin_layout Plain Layout
402
403 \begin_inset CommandInset label
404 LatexCommand label
405 name "func"
406
407 \end_inset
408
409 A Fortran subroutine
410
411 \end_layout
412
413 \end_inset
414
415
416 \end_layout
417
418 \end_inset
419
420 A framed floating listing with a caption and a label (Listing
421 \begin_inset space ~
422
423 \end_inset
424
425
426 \begin_inset CommandInset ref
427 LatexCommand ref
428 reference "python1"
429 plural "false"
430 caps "false"
431 noprefix "false"
432
433 \end_inset
434
435 ): 
436 \begin_inset listings
437 lstparams "frame=single,language=Python,float=h"
438 inline false
439 status open
440
441 \begin_layout Plain Layout
442 def boring(args = None):
443 \end_layout
444
445 \begin_layout Plain Layout
446     pass
447 \end_layout
448
449 \begin_layout Plain Layout
450
451 \begin_inset Caption Standard
452
453 \begin_layout Plain Layout
454 A Python function.
455 \begin_inset CommandInset label
456 LatexCommand label
457 name "python1"
458
459 \end_inset
460
461  
462
463 \end_layout
464
465 \end_inset
466
467
468 \end_layout
469
470 \end_inset
471
472
473 \end_layout
474
475 \begin_layout Standard
476 The same framed floating listing with a caption, a label and a stray math equation (Listing
477 \begin_inset space ~
478
479 \end_inset
480
481
482 \begin_inset CommandInset ref
483 LatexCommand ref
484 reference "python2"
485 plural "false"
486 caps "false"
487 noprefix "false"
488
489 \end_inset
490
491 ): \begin_inset listings
492 lstparams "frame=single,language=Python,float=h"
493 inline false
494 status open
495
496 \begin_layout Plain Layout
497 def boring(args = None):
498 \end_layout
499
500 \begin_layout Plain Layout
501     pass
502 \end_layout
503
504 \begin_layout Plain Layout
505
506 \begin_inset Caption Standard
507
508 \begin_layout Plain Layout
509 The previous Python function.
510 \begin_inset CommandInset label
511 LatexCommand label
512 name "python2"
513
514 \end_inset
515
516  
517
518 \begin_inset Formula $y=f(x)$
519 \end_inset
520
521  
522
523
524 \end_layout
525
526 \end_inset
527
528
529 \end_layout
530
531 \end_inset
532
533
534 \end_layout
535
536 \end_body
537 \end_document