-
Notifications
You must be signed in to change notification settings - Fork 611
Expand file tree
/
Copy pathcodeblock.tex
More file actions
112 lines (101 loc) · 2.19 KB
/
codeblock.tex
File metadata and controls
112 lines (101 loc) · 2.19 KB
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
\ifdefined\HCode
\RecustomVerbatimEnvironment{Verbatim}{Verbatim}{
frame=single,
framesep=2mm,
baselinestretch=1,
fontsize=\footnotesize,
breaklines=true,
numbers=left
}
\DefineVerbatimEnvironment{code}{Verbatim}{
frame=single,
framesep=2mm,
baselinestretch=1,
fontsize=\footnotesize,
breaklines=true,
numbers=left
}
\DefineVerbatimEnvironment{codebash}{Verbatim}{
frame=single,
framesep=2mm,
baselinestretch=1.2,
fontsize=\footnotesize,
breaklines=true,
numbers=left
}
\NewDocumentCommand{\samplec}{oom}{%
\IfNoValueTF{#1}%
{%
\VerbatimInput[
frame=single,
framesep=2mm,
baselinestretch=1,
fontsize=\footnotesize,
breaklines=true,
numbers=left
]{#3}%
}%
{%
\IfNoValueTF{#2}%
{%
\VerbatimInput[
frame=single,
framesep=2mm,
baselinestretch=1,
fontsize=\footnotesize,
breaklines=true,
firstline=#1,
numbers=left
]{#3}%
}%
{%
\VerbatimInput[
frame=single,
framesep=2mm,
baselinestretch=1,
fontsize=\footnotesize,
breaklines=true,
firstline=#1,
lastline=#2,
numbers=left
]{#3}%
}%
}%
}
\NewDocumentCommand{\sh}{v}{\texttt{#1}}
\NewDocumentCommand{\cpp}{v}{\texttt{#1}}
\else
\newminted[code]{c}{frame=single,
framesep=2mm,
baselinestretch=1,
fontsize=\footnotesize,
breaklines,
breakafter=d,
linenos
}
\usemintedstyle{vs}
\NewDocumentCommand{\samplec}{oom}{%
\IfNoValueTF{#1}%
{%
\inputminted[frame=single, framesep=2mm, baselinestretch=1, fontsize=\footnotesize, breaklines, breakafter=d, linenos]{c}{#3}%
}%
{%
\IfNoValueTF{#2}%
{%
\inputminted[frame=single, framesep=2mm, baselinestretch=1, fontsize=\footnotesize, breaklines, breakafter=d, firstline=#1, linenos]{c}{#3}%
}%
{%
\inputminted[frame=single, framesep=2mm, baselinestretch=1, fontsize=\footnotesize, breaklines, breakafter=d, firstline=#1, lastline=#2, linenos]{c}{#3}%
}%
}%
}
\newminted[codebash]{bash}{frame=single,
framesep=2mm,
baselinestretch=1.2,
numbersep=8pt,
breaklines,
linenos
}
\newmintinline[sh]{bash}{}
\newmintinline[cpp]{c}{}
\fi