-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcode.sty
118 lines (106 loc) · 2.67 KB
/
code.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
\usepackage{minted}
% Chargement du package minted via tcolorbox
\tcbuselibrary{minted}
% Pareil, mais avec listing
\tcbuselibrary{listings}
\newcommand{\Language}{java}
\newtcbinputlisting[use counter=codeCounter, number format=\arabic]{\codeFromFile}[4]{%
listing engine=minted,
minted language=#1,
listing file={#2},
minted style=colorful,
minted options={fontsize=\small, autogobble,linenos,breaklines},
listing only,
size=title,
arc=1.5mm,
breakable,
enhanced jigsaw,
colframe=blued,
coltitle=whitel,
boxrule=0.5mm,
colback=whitel,
coltext=blackd,
title=\faCode\hspace{0.5em}\textbf{Code \thetcbcounter\hspace{0.4em}: #3},
label=code:#4
}
\newtcbinputlisting{\codeFromFileSimple}[2]{%
listing engine=minted,
minted language=#1,
listing file={#2},
minted options={autogobble,linenos,breaklines},
listing only,
size=title,
arc=1.5mm,
breakable,
enhanced jigsaw,
colframe=blued,
boxrule=0.5mm,
colback=whitel,
coltext=blackd,
}
\newtcbinputlisting{\codeFromFileSimpleContinuousLine}[2]{%
listing engine=minted,
minted language=#1,
listing file={#2},
minted options={autogobble,linenos,breaklines,firstnumber=last},
listing only,
size=title,
arc=1.5mm,
breakable,
enhanced jigsaw,
colframe=blued,
boxrule=0.5mm,
colback=whitel,
coltext=blackd,
}
\newtcblisting[use counter=codeCounter, number format=\arabic]{code}[1]{%
colback=red!5!whitel,
colframe=red!75!black,
fonttitle=\bfseries,
listing only,
listing engine=minted,
minted language=\Language,
title=#1}
\DeclareTotalTCBox{\iCode}{ O{\Language} v }{%
verbatim,
colupper=white,
coltitle=whitel,
boxrule=0.1mm,
colback=whitel,
coltext=blackd,
listing engine=minted,
minted language=#1,
minted options={autogobble,linenos,breaklines},}{%
\lstinline^#2^}
\DeclareTotalTCBox{\iShell}{ O{\Language} v }{%
verbatim,
colupper=white,
coltitle=whitel,
boxrule=0.1mm,
colback=blackd,
coltext=whitel,
listing engine=minted,
minted language=#1,
minted options={autogobble,linenos,breaklines},}{%
\lstinline^\$ #2^}
\newtcbinputlisting{\shellFromFile}[3]{%
verbatim,
listing file={#1},
listing options={language=command.com,keywordstyle=\color{blue!35!white}\bfseries},
listing only,
size=title,
arc=1.5mm,
breakable,
enhanced jigsaw,
colframe=black,
coltitle=whitel,
boxrule=0.5mm,
colback=black!75!white,
coltext=white,
title=\faCode\hspace{0.5em}\textbf{#2},
label=code:#3
}
\DeclareTotalTCBox{\commandbox}{ s v }
{verbatim,colupper=white,colback=black!75!white,colframe=black}
{\IfBooleanT{#1}{\textcolor{red}{\ttfamily\bfseries > }}%
\lstinline[language=command.com,keywordstyle=\color{blue!35!white}\bfseries ,morekeywords={java ,javac, javadoc}]^#2^}