-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmintedUtil.sty
380 lines (352 loc) · 10.8 KB
/
mintedUtil.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mintedUtil}[2018 v1.0 John Berlin utility macros]
\RequirePackage{xparse}
\@ifpackageloaded{minted}{}%
{\PackageError{mintedUtil}{The package "mintedUtil" may not be loaded before "minted"}{Load "mintedUtil" only when "minted" has been loaded previously}}
%%%
% Macro to add just the vspacing (-1em) between a input minted or macro in this file and \caption
% Usage:
% \begin{figure}
% \inputHTML{<path to html>}
% \vspaceMinted
% \caption{Sup}
% \end{figure}
%%%
\NewDocumentCommand{\vspaceMinted}{}{\vspace{-1em}}
%%%
% Mint a HTML file indenting the left margin by 1.5em, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to HTML file to be minted
%%%
\NewDocumentCommand{\inputHTML}{+O{linenos=false}+m}{%
\inputminted[frame=lines,
xleftmargin=1.5em,
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{html}{#2}
}
%%%
% Mint a HTML file indenting the left margin by 1.5em, fontsize: \scriptsize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to HTML file to be minted
%%%
\NewDocumentCommand{\inputHTMLSmall}{+O{linenos=false}+m}{%
\inputminted[frame=lines,
xleftmargin=1.5em,
fontsize=\scriptsize,
showtabs=false,
autogobble=true,
breakanywhere=true,
breaklines=true,
#1]{html}{#2}
}
%%%
% Mint a HTML file indenting the left margin by 1.5em, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to HTML file to be minted
%%%
\NewDocumentCommand{\inputHTMLBM}{+O{linenos=false}+m}{%
\inputminted[frame=lines,
xleftmargin=1em,
xrightmargin=1em,
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{html}{#2}
}
%%%
% Mint a HTML file, no margin indenting, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to HTML file to be minted
%%%
\NewDocumentCommand{\inputHTMLNM}{+O{linenos=false}+m}{%
\inputminted[frame=lines,
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{html}{#2}
}
%%%
% Mint a HTML file, no margin indenting, fontsize: \scriptsize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to HTML file to be minted
%%%
\NewDocumentCommand{\inputHTMLSmallNM}{+O{linenos=false}+m}{%
\inputminted[frame=lines,
fontsize=\scriptsize,
showtabs=false,
autogobble=true,
breakanywhere=true,
breaklines=true,
#1]{html}{#2}
}
%%%
% Mint a HTML file, no margin indenting, no linewrap symbol, fontsize: \scriptsize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to HTML file to be minted
%%%
\NewDocumentCommand{\inputHTMLSmallTNM}{+O{linenos=false}+m}{%
\inputminted[frame=lines,
fontsize=\scriptsize,
breaksymbolleft=,
showtabs=false,
autogobble=true,
breakanywhere=true,
breaklines=true,
#1]{html}{#2}
}
%%%
% Mint a CSS file, left margin indented by 1em, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to CSS file to be minted
%%%
\NewDocumentCommand{\inputCSS}{+O{linenos=false}+m}{%
\inputminted[#1,
frame=lines,
xleftmargin=1em,
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breakanywhere=true,
breaklines=true]{css}{#2}
}
%%%
% Mint a CSS file, no margin indenting, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to CSS file to be minted
%%%
\NewDocumentCommand{\inputCSSNM}{+O{linenos=false}+m}{%
\inputminted[#1,
frame=lines,
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breakanywhere=true,
breaklines=true]{css}{#2}
}
%%%
% Mint a JavaScript file, left margin indented by 1.5em, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to JavaScript file to be minted
%%%
\NewDocumentCommand{\inputJS}{O{linenos=false}+ m}{%
\inputminted[frame=lines,
fontsize=\footnotesize,
xleftmargin=1.5em,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{js}{#2}
}
%%%
% Mint a JavaScript file, both margins indented by 1em, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to JavaScript file to be minted
%%%
\NewDocumentCommand{\inputJSBM}{O{linenos=false}+ m}{%
\inputminted[frame=lines,
fontsize=\footnotesize,
xleftmargin=1em,
xrightmargin=1em,
showtabs =false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{js}{#2}
}
%%%
% Mint a JavaScript file, left margin indented by 1.5em, fontsize: \scriptsize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to JavaScript file to be minted
%%%
\NewDocumentCommand{\inputJSSmall}{O{linenos=false}+ m}{%
\inputminted[frame=lines,
fontsize=\scriptsize,
xleftmargin=1.5em,
showtabs =false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{js}{#2}
}
%%%
% Mint a JavaScript file with line numbers, left margin indented by 1em, fontsize: \scriptsize
% Args Required: Path to JavaScript file to be minted
%%%
\NewDocumentCommand{\inputJSSmallLN}{m}{%
\inputminted[frame=lines,
linenos=true,
numbersep=5pt,
fontsize=\scriptsize,
xleftmargin=1em,
showtabs =false,
autogobble=true,
breaklines=true,
breakanywhere=true]{js}{#1}
}
%%%
% Mint a JavaScript file with line numbers, left margin indented by 1.5em, fontsize: \scriptsize
% Args Required: Path to JavaScript file to be minted
%%%
\NewDocumentCommand{\inputJSSmallLNApend}{m}{%
\inputminted[frame=lines,
xleftmargin=1.5em,
linenos=true,
numbersep=5pt,
fontsize=\scriptsize,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true]{js}{#1}
}
%%%
% Mint a JavaScript file, no margin indent, fontsize: \scriptsize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to JavaScript file to be minted
%%%
\NewDocumentCommand{\inputJSSmallNM}{O{linenos=false}+ m}{%
\inputminted[frame=lines,
fontsize=\scriptsize,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{js}{#2}
}
%%%
% Mint a JSON file, both margins indented by 1em
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers, fontsize: \footnotesize
% Args Required: Path to JSON file to be minted
%%%
\NewDocumentCommand{\inputJSON}{O{linenos=false,fontsize=\footnotesize} m}{%
\inputminted[frame=lines,
xleftmargin=1em,
xrightmargin=1em,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{json}{#2}
}
%%%
% Mint a JSON file, no margins indenting
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers, fontsize: \scriptsize
% Args Required: Path to JSON file to be minted
%%%
\NewDocumentCommand{\inputJSONSmall}{O{linenos=false,fontsize=\scriptsize} m}{%
\inputminted[frame=lines,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{json}{#2}
}
%%%
% Mint a JSON file, no margins indenting, line wrap symbol
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers, fontsize: \tiny
% Args Required: Path to JSON file to be minted
%%%
\NewDocumentCommand{\inputJSONTiny}{O{linenos=false,fontsize=\tiny} m}{%
\inputminted[frame=lines,
breaksymbolleft=,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true,
#1]{json}{#2}
}
%%%
% Mint a Shell file (not windows), no margin indenting, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to Shell file to be minted
%%%
\NewDocumentCommand{\inputBash}{+O{linenos=false}+m}{%
\inputminted[#1,
frame=lines,
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breakanywhere=true,
breaklines=true]{bash}{#2}
}
%%%
% Mint a Shell file (not windows), let margin indented by 1.5em, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to Shell file to be minted
%%%
\NewDocumentCommand{\inputBashM}{+O{linenos=false}+m}{%
\inputminted[#1,
frame=lines,
xleftmargin=1.5em,
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breakanywhere=true,
breaklines=true]{bash}{#2}
}
%%%
% Mint a .http file, let margin indented by 1.5em, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to .http file to be minted
%%%
\NewDocumentCommand{\inputHTTP}{+O{linenos=false}+m}{
\inputminted[#1,
frame=lines,
xleftmargin=1.5em,
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breakanywhere=true,
breaklines=true]{HTTP}{#2}
}
%%%
% Mint a Python file using the python3 lexer, no margin indent, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to Python file to be minted
%%%
\NewDocumentCommand{\inputPY}{+O{linenos=false}+m}{%
\inputminted[
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true
#1]{python3}{#2}
}
%%%
% Mint a Java file, no margin indent, fontsize: \footnotesize
% Args Optional: Optional arguments supplied to minted directly, defaults to no line numbers
% Args Required: Path to Java file to be minted
%%%
\NewDocumentCommand{\inputJava}{+O{linenos=false}+m}{%
\inputminted[
fontsize=\footnotesize,
showtabs=false,
autogobble=true,
breaklines=true,
breakanywhere=true
#1]{java}{#2}
}
%%%
% Mint a HTML inline
% Args Required: HTML code to be minted inline
%%%
\NewDocumentCommand{\inlineHTML}{m}{\mintinline{html}{#1}}
%%%
% Mint a JavaScript inline
% Args Required: JavaScript code to be minted inline
%%%
\NewDocumentCommand{\inlineJS}{m}{\mintinline[breakanywhere]{js}{#1}}
%%%
% Mint a CSS inline
% Args Required: CSS code to be minted inline
%%%
\NewDocumentCommand{\inlineCSS}{m}{\mintinline{css}{#1}}