]> git.lyx.org Git - features.git/blob - lib/examples/minted.lyx
Rename the minted 'lang' external template option as 'language'
[features.git] / lib / examples / minted.lyx
1 #LyX 2.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 543
3 \begin_document
4 \begin_header
5 \save_transient_properties true
6 \origin /systemlyxdir/examples/
7 \textclass article
8 \begin_preamble
9 \usemintedstyle{bw}
10 \usepackage{xcolor}
11 \definecolor{lgray}{rgb}{0.95, 0.95, 0.95}
12 \usepackage{eso-pic}
13 \newlength{\boxwidth}
14 \newlength{\boxheight}
15 \setlength{\boxwidth}{\paperwidth}
16 \setlength{\boxheight}{\paperheight}
17 \addtolength{\boxwidth}{-1.2cm}
18 \addtolength{\boxheight}{-2.5cm}
19 \AddToShipoutPicture{%
20    \setlength{\@tempdimb}{0.5cm}%
21    \setlength{\@tempdimc}{1.0cm}%
22    \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
23      \hbox{\fboxrule=0.6pt\fbox{\vbox to \boxheight{%
24      \vss\hbox to \boxwidth{\hss}\vss}}}}%
25    \addtolength{\@tempdimc}{\boxheight}%
26    \addtolength{\@tempdimc}{6.5pt}%
27    \put(\strip@pt\@tempdimb,\strip@pt\@tempdimc){%
28      \hbox{\fboxrule=0.6pt\fcolorbox{black}{lgray}{\vbox to 3.5mm{%
29      \vss\hbox to \boxwidth{\hss\textbf{\textsf{\small\titlename}}\hss%
30      \hbox to 0pt{\hss\textsf{\footnotesize Page \arabic{page}/\pageref{lastpage}~}}}\vss}}}}%
31 }
32 \end_preamble
33 \use_default_options true
34 \maintain_unincluded_children false
35 \language english
36 \language_package default
37 \inputencoding auto
38 \fontencoding global
39 \font_roman "times" "DejaVu Sans Mono"
40 \font_sans "helvet" "DejaVu Sans"
41 \font_typewriter "courier" "DejaVu Sans Mono"
42 \font_math "auto" "default"
43 \font_default_family default
44 \use_non_tex_fonts true
45 \font_sc false
46 \font_osf false
47 \font_sf_scale 95 95
48 \font_tt_scale 110 110
49 \use_microtype false
50 \use_dash_ligatures true
51 \graphics default
52 \default_output_format pdf4
53 \output_sync 0
54 \bibtex_command default
55 \index_command default
56 \paperfontsize 12
57 \spacing single
58 \use_hyperref false
59 \papersize default
60 \use_geometry true
61 \use_package amsmath 1
62 \use_package amssymb 1
63 \use_package cancel 1
64 \use_package esint 1
65 \use_package mathdots 1
66 \use_package mathtools 1
67 \use_package mhchem 1
68 \use_package stackrel 1
69 \use_package stmaryrd 1
70 \use_package undertilde 1
71 \cite_engine basic
72 \cite_engine_type default
73 \biblio_style plain
74 \use_bibtopic false
75 \use_indices false
76 \paperorientation landscape
77 \suppress_date false
78 \justification true
79 \use_refstyle 1
80 \index Index
81 \shortcut idx
82 \color #008000
83 \end_index
84 \leftmargin 0.5cm
85 \topmargin 1.35cm
86 \rightmargin 0.5cm
87 \bottommargin 1.05cm
88 \secnumdepth 3
89 \tocdepth 3
90 \paragraph_separation indent
91 \paragraph_indentation default
92 \is_math_indent 0
93 \math_numbering_side default
94 \quotes_style english
95 \dynamic_quotes 0
96 \papercolumns 2
97 \papersides 1
98 \paperpagestyle empty
99 \tracking_changes false
100 \output_changes false
101 \html_math_output 0
102 \html_css_as_file 0
103 \html_be_strict false
104 \end_header
105
106 \begin_body
107
108 \begin_layout Standard
109 \begin_inset Note Note
110 status open
111
112 \begin_layout Plain Layout
113 This example shows a possible use of the minted package (version 2.1 or later)
114  for typesetting listings containing unicode characters.
115  For this reason, the default output format is 
116 \family typewriter
117 PDF (XeTeX)
118 \family default
119 .
120  The listing is typeset using the DejaVu font.
121  If this font is not installed on your system, you need to choose a different
122  one in Document\SpecialChar menuseparator
123 Settings\SpecialChar menuseparator
124 Fonts.
125 \end_layout
126
127 \begin_layout Plain Layout
128 Other than the minted latex package, you also need the pygments python module.
129  See the minted documentation for directions on how to install it.
130  If you use a linux system, you can possibly install a suitable package
131  through your package manager.
132  Look for python packages named 
133 \family typewriter
134 python-pygments
135 \family default
136  or similar.
137 \end_layout
138
139 \begin_layout Plain Layout
140 Another required package is the 
141 \family typewriter
142 eso-pic
143 \family default
144  latex package, so you also need to install it.
145  It is used to draw a page frame around the listing.
146 \end_layout
147
148 \begin_layout Plain Layout
149 Remember to add the -shell-escape option to the xelatex command in the Preferenc
150 es\SpecialChar menuseparator
151 File Handling\SpecialChar menuseparator
152 Converters\SpecialChar menuseparator
153 LaTeX(XeTeX)->PDF(XeTeX) converter.
154 \end_layout
155
156 \end_inset
157
158
159 \end_layout
160
161 \begin_layout Standard
162 \begin_inset ERT
163 status open
164
165 \begin_layout Plain Layout
166
167
168 \backslash
169 def
170 \backslash
171 titlename{lyxpak.py}
172 \end_layout
173
174 \end_inset
175
176
177 \begin_inset Note Note
178 status open
179
180 \begin_layout Plain Layout
181 This is the title of the listing appearing in the headers.
182 \end_layout
183
184 \end_inset
185
186
187 \end_layout
188
189 \begin_layout Standard
190 \begin_inset External
191         template MintedSource
192         filename ../scripts/lyxpak.py
193         display false
194         extra LaTeX "fontsize=\tiny,baselinestretch=1.05,frame=leftline,framesep=10pt,breaklines,breakanywhere,language=python"
195         extra PDFLaTeX "fontsize=\tiny,baselinestretch=1.05,frame=leftline,framesep=10pt,breaklines,breakanywhere,language=python"
196
197 \end_inset
198
199
200 \end_layout
201
202 \begin_layout Standard
203 \begin_inset CommandInset label
204 LatexCommand label
205 name "lastpage"
206
207 \end_inset
208
209
210 \begin_inset Note Note
211 status open
212
213 \begin_layout Plain Layout
214 This label is needed to show the total number of pages in upper-right corner
215  of the PDF.
216 \end_layout
217
218 \end_inset
219
220
221 \end_layout
222
223 \end_body
224 \end_document