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