-
Notifications
You must be signed in to change notification settings - Fork 25
/
boxie.sty
511 lines (479 loc) · 16.9 KB
/
boxie.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
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
%%
%% This is file `indentfirst.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% indentfirst.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% The source is maintained by the LaTeX Project team and bug
%% reports for it can be opened at https://latex-project.org/bugs/
%% (but please observe conditions on bug reports sent to that address!)
%%
%%
%% Copyright 1993-2017
%% The LaTeX3 Project and any individual authors listed elsewhere
%% in this file.
%%
%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'.
%% --------------------------------------------------------------------------
%%
%% It may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%%
%% This file may only be distributed together with a copy of the LaTeX
%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle'
%% without such generated files.
%%
%% The list of all files belonging to the LaTeX `Tools Bundle' is
%% given in the file `manifest.txt'.
%%
%% File: indent.dtx Copyright (C) 1991-1994 David Carlisle
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{boxie}[2018/08/05v1.00 well-designed (TeX)]
\RequirePackage{fontawesome}
\RequirePackage{varwidth}
\RequirePackage{xcolor}
%------------------------------------------------------------------------------------
% color definition
%------------------------------------------------------------------------------------
\definecolor{mpurple}{RGB}{48,10,36}
\definecolor{mgray}{RGB}{70,72,67}
\definecolor{ogray}{RGB}{148,147,141}
\definecolor{oorange}{RGB}{233,101,56}
\definecolor{termimal}{RGB}{80,78,70}
\definecolor{linux}{RGB}{0,39,51}
\definecolor{cvgrayc}{RGB}{247,247,247}
\definecolor{cvgray}{RGB}{220,220,220}
\definecolor{cvgrayb}{RGB}{153,153,153}
\definecolor{cvblue}{RGB}{223,238,255}
\definecolor{zhanqing}{RGB}{0,51,113}
\definecolor{chengse}{RGB}{250,140,53}
\RequirePackage{multido}
\tcbuselibrary{skins, xparse, breakable}
%------------------------------------------------------------------------------------
% chinese fontsize definition
%------------------------------------------------------------------------------------
\makeatletter
\def\thu@def@fontsize#1#2{%
\expandafter\newcommand\csname #1\endcsname[1][1.3]{%
\fontsize{#2}{##1\dimexpr #2}\selectfont%
}%
}
\thu@def@fontsize{chuhao}{42bp}
\thu@def@fontsize{xiaochu}{36bp}
\thu@def@fontsize{yihao}{26bp}
\thu@def@fontsize{xiaoyi}{24bp}
\thu@def@fontsize{erhao}{22bp}
\thu@def@fontsize{xiaoer}{18bp}
\thu@def@fontsize{sanhao}{16bp}
\thu@def@fontsize{xiaosan}{15bp}
\thu@def@fontsize{sihao}{14bp}
\thu@def@fontsize{banxiaosi}{13bp}
\thu@def@fontsize{xiaosi}{12bp}
\thu@def@fontsize{dawu}{11bp}
\thu@def@fontsize{wuhao}{10.5bp}
\thu@def@fontsize{xiaowu}{9bp}
\thu@def@fontsize{liuhao}{7.5bp}
\thu@def@fontsize{xiaoliu}{6.5bp}
\thu@def@fontsize{qihao}{5.5bp}
\thu@def@fontsize{bahao}{5bp}
\makeatother
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}%
}
\newcommand{\UbuntuMin}{%
\begin{tikzpicture}[x=2.4ex,y=2.4ex,line width=0.15ex,scale=1]
\shade[shading=ball,left color=ogray,right color=ogray!50!white] (0,0) circle (0.5);
\draw[termimal](-0.3,0)--(0.3,0);
\end{tikzpicture}
}
\newcommand{\UbuntuClose}{%
\begin{tikzpicture}[x=2.4ex,y=2.4ex,line width=0.15ex,scale=1]
\shade[shading=ball,left color=oorange,right color=oorange!70!white] (0,0) circle (0.5);
\draw[termimal](-0.25,-0.25)--(0.25,0.25);
\draw[termimal](-0.25,0.25)--(0.25,-0.25);
\end{tikzpicture}
}
\newcommand{\UbuntuMax}{%
\begin{tikzpicture}[x=2.4ex,y=2.4ex,line width=0.15ex,scale=1]
\shade [shading=ball,left color=ogray,right color=ogray!50!white] (0,0) circle (0.5);
\draw[termimal](-0.25,-0.2)rectangle(0.25,0.2);
\end{tikzpicture}
}
%------------------------------------------------------------------------------------
% tcolorbox styles definition
%------------------------------------------------------------------------------------
\tcbset{%
skin=enhanced,%
gitexample/.style={%
halign title=center,%
skin=bicolor,%
boxrule=1mm,%
fonttitle=\bfseries,%
coltitle=black,%
frame style={%
draw=mgray,%
left color=mgray,%
right color=mgray%
},%
colback=mpurple,%
colupper=white,%
breakable,%
colframe=mgray,%
colbacktitle=mgray,%
overlay unbroken={%
\node[inner sep=0pt,anchor=north west,yshift=-5pt,xshift=10pt,text=white] at (frame.north west){\UbuntuClose~\UbuntuMin~\UbuntuMax};%
},
overlay first={%
\node[inner sep=0pt,anchor=north west,yshift=-5pt,xshift=10pt,text=white] at (frame.north west){\UbuntuClose~\UbuntuMin~\UbuntuMax};%
}%
}%
}
\tcbset{%
skin=enhanced,
pad after break=0mm,
lang/.style={%
breakable,%
drop shadow,%
colframe=blue!75!black,%
left=4.5mm,
enhanced,%
colframe=tcbcolback!60!black,%
colback=tcbcolback!30!white,%
colbacktitle=tcbcolback!5!yellow!10!white,%
fonttitle=\bfseries,%
coltitle=black,%
attach boxed title to top center={%
yshift=-0.25mm-\tcboxedtitleheight/2,%
yshifttext=2mm-\tcboxedtitleheight/2%
},%
attach boxed title to top left={%
xshift=1cm,%
yshift*=1mm-\tcboxedtitleheight%
},%
varwidth boxed title*=-3cm,%
boxed title style={%
frame code={%
\path[fill=tcbcolback!30!black]([yshift=-1mm,xshift=-1mm]frame.north west)%
arc[start angle=0,end angle=180,radius=1mm]([yshift=-1mm,xshift=1mm]frame.north east)%
arc[start angle=180,end angle=0,radius=1mm];
\path[left color=tcbcolback!60!black,right color=tcbcolback!60!black,middle color=tcbcolback!80!black]%
([xshift=-2mm]frame.north west)%
--([xshift=2mm]frame.north east)[rounded corners=1mm]%
--([xshift=1mm,yshift=-1mm]frame.north east)%
--(frame.south east)%
--(frame.south west)%
--([xshift=-1mm,yshift=-1mm]frame.north west)[sharp corners]%
--cycle;%
},%
interior engine=empty%
},%
% overlay={%
% \begin{tcbclipinterior}
% \fill[tcbcolback!80!black] (frame.south west) rectangle ([xshift=5mm]frame.north west);
% \end{tcbclipinterior}%
% }%
}%
}
% names of new added options might change
\tcbset{skin=enhanced,
cv/.style={
boxrule=0.4mm,
pad after break=-1.5ex,
breakable,top=0mm,boxsep=1mm,drop shadow,attach boxed title to top,
colframe=blue!75!black,
left=4.5mm,right=0mm,enhanced,
colframe=tcbcolback!60!black,colback=white,colbacktitle=cvgray,
fonttitle=\ttfamily,coltitle=black,
overlay broken = {\begin{tcbclipinterior}
\fill[cvblue] (frame.south west) rectangle ([xshift=5.9mm]frame.north west);
\end{tcbclipinterior}},
underlay boxed title = {\begin{tcbclipinterior}\fill[cvblue] (frame.south west) rectangle ([xshift=5.9mm,yshift=0mm]frame.north west);\end{tcbclipinterior}}
}}
%------ 这段代码借用林前辈的, --shell-escape 时调用 minted 不然就用 listings-----------
\ifnum\shellescape=1
\tcbuselibrary{minted}
%------------------------------------------------------------------------------------
% minted part
%------------------------------------------------------------------------------------
\makeatletter
\minted@def@optfv{highlightlinenumbercolor}
\minted@def@optfv{linenumberwidth}
\makeatother
% redefine the minted line number font
\renewcommand{\theFancyVerbLine}{%
\sffamily\textcolor[rgb]{0.5,0.5,1.0}{%
\scriptsize\oldstylenums{%
\arabic{FancyVerbLine}%
}%
}%
}
%===================================
% environment definition
%===================================
\DeclareTCBListing{GitExample}{ O{bash} m m }{%
listing engine=minted,%
minted style=trac,%
minted options={%
autogobble,%
breaklines,%
fontsize=\wuhao,%
numbersep=3mm%
},%
listing and comment,%
colbacklower=tcbcolback!5!yellow!10!white,%
collower=linux,%
gitexample,%
title={#3},%
comment={\small\sffamily#2},%
minted language=#1%
}
\DeclareTCBListing{GitExampla}{ O{bash} m }{%
listing engine=minted,%
minted style=trac,%
minted options={%
autogobble,%
breaklines,%
fontsize=\wuhao,%
numbersep=3mm%
},%
listing only,%
gitexample,%
title={#2},%
minted language=#1%
}
\DeclareTCBListing{langPyTwo}{ O{python} m m }{%
overlay={%
\begin{tcbclipinterior}
\fill[tcbcolback!80!black] (frame.south west) rectangle ([xshift=6mm]frame.north west);
\end{tcbclipinterior}%
},%
listing engine=minted,%
minted style=trac,%
minted options={%
highlightcolor={tcbcolback!30!white, tcbcolback!30!white},
highlightlinenumbercolor={tcbcolback!80!black, tcbcolback!80!black},
breaklines,%
fontsize=\wuhao,%
linenos,%
numbersep=1mm%
},%
listing and comment,%
colbacklower=tcbcolback!5!yellow!10!white,%
collower=tcbcolback!60!black,%
title={#3},%
lang,%
comment={\small\sffamily#2},%
minted language=#1%
}
\DeclareTCBListing{langPyOne}{ O{python} m }{%
overlay={%
\begin{tcbclipinterior}
\fill[tcbcolback!80!black] (frame.south west) rectangle ([xshift=6mm]frame.north west);
\end{tcbclipinterior}%
},%
listing engine=minted,%
minted style=trac,%
minted options={%
highlightcolor={tcbcolback!30!white, tcbcolback!30!white},
highlightlinenumbercolor={tcbcolback!80!black, tcbcolback!80!black},
breaklines,%
fontsize=\wuhao,%
linenos,%
numbersep=1mm%
},%
listing only,%
lang,%
title={#2},%
minted language=#1%
}
\newcounter{cvcounter}
\DeclareTCBListing[use counter=cvcounter]{langCVOne}{ O{python} o o m }{%
listing engine=minted,minted style=xcode,
minted options={highlightcolor={cvgray!50!white, white},
highlightlinenumbercolor={cvblue, cvblue!70},mathescape,breaklines,fontsize=\wuhao,linenos,
numbersep=1mm%
},
listing only,
cv,
minted language=#1,
title={程序清单\thecvcounter:~#4},%\thetcbcounter
label = #2,
overlay unbroken and first ={\begin{tcbclipinterior}
\node[inner sep=0pt,anchor=north east,yshift=-3pt,xshift=-5pt,text=cvgrayb] at (frame.north east){\ttfamily\faFileText\ \faCode\ \faCodeFork\ \faCopy\ \faExternalLink\ \IfNoValueTF{#3}{\MakeUppercase#1}{#3}};\end{tcbclipinterior}}}
%===================================
% command InputListing
%===================================
\DeclareTCBInputListing[use counter=cvcounter]{\langCVfile}{ O{python} o o m m}{%
listing engine=minted,minted style=xcode,
minted options={highlightcolor={cvgray!50!white, white},
highlightlinenumbercolor={cvblue, cvblue!70},mathescape,breaklines,fontsize=\wuhao,linenos,
numbersep=1mm},
listing only,
cv,
listing file={#5},
minted language=#1,
title={程序清单\thecvcounter:~#4},%\thetcbcounter
label = #2,
overlay unbroken and first ={\begin{tcbclipinterior}
\node[inner sep=0pt,anchor=north east,yshift=-3pt,xshift=-5pt,text=cvgrayb] at (frame.north east){\ttfamily\faFileText\ \faCode\ \faCodeFork\ \faCopy\ \faExternalLink\ \IfNoValueTF{#3}{\MakeUppercase#1}{#3}};\end{tcbclipinterior}}}
\DeclareTCBInputListing{\langPyfile}{ O{python} m m }{%
overlay={%
\begin{tcbclipinterior}
\fill[tcbcolback!80!black] (frame.south west) rectangle ([xshift=6mm]frame.north west);
\end{tcbclipinterior}%
},%
listing engine=minted,%
minted style=trac,%
minted options={%
highlightcolor={tcbcolback!30!white, tcbcolback!30!white},
highlightlinenumbercolor={tcbcolback!80!black, tcbcolback!80!black},
breaklines,%
fontsize=\wuhao,%
linenos,%
numbersep=1mm%
},%
listing only,%
lang,%
listing file={#3},
title={#2},%
minted language=#1%
}
\DeclareTCBInputListing{\gitfile}{ O{bash} m m }{%
listing engine=minted,%
minted style=trac,%
minted options={%
autogobble,%
breaklines,%
fontsize=\wuhao,%
numbersep=3mm%
},%
listing only,%
gitexample,%
listing file={#3},%
title={#2},%
minted language=#1%
}
\else
\tcbuselibrary{listings}
%------------------------------------------------------------------------------------
% listings part
%------------------------------------------------------------------------------------
\RequirePackage{lstlinebgrd} %% listings中cv盒子的行背景色
\newcounter{cvcounter}
% redefine the listings line number font
\renewcommand{\thelstnumber}{\oldstylenums{%
\arabic{lstnumber}%
}%
}
\lstset{% general command to set parameter(s)
basicstyle=\ttfamily\small, % print whole listing small
keywordstyle=\color{chengse}\bfseries,%
% \underbar underlined bold black keywords
identifierstyle=, % nothing happens
breaklines=true,
commentstyle=\itshape\color{gray},
stringstyle=\ttfamily, % typewriter type for strings
%showstringspaces=false, % no special string spaces
numbers=left,%
numberstyle=\scriptsize\sffamily\color[rgb]{0.5,0.5,1.0},%
% numbersep=3pt
}
%=====================================================================================
% Environment
%=====================================================================================
\DeclareTCBListing{GitExample}{ O{bash} m m }{%
listing and comment,%
colbacklower=tcbcolback!5!yellow!10!white,%
collower=linux,%
gitexample,%
title={#3},%
comment={\small\sffamily#2},%
listing options={language=#1,numbers=none},%
}
\DeclareTCBListing{GitExampla}{ O{bash} m }{%
listing only,%
gitexample,%
title={#2},%
listing options={language=#1,numbers=none},%
}
\DeclareTCBListing{langPyTwo}{ O{python} m m }{%
overlay={%
\begin{tcbclipinterior}
\fill[tcbcolback!80!black] (frame.south west) rectangle ([xshift=5mm]frame.north west);
\end{tcbclipinterior}%
},%
listing and comment,%
colbacklower=tcbcolback!5!yellow!10!white,%
collower=tcbcolback!60!black,%
title={#3},%
lang,%
comment={\small\sffamily#2},%
listing options={language=#1,numbersep=4pt},%
}
\DeclareTCBListing{langPyOne}{ O{python} m }{%
overlay={%
\begin{tcbclipinterior}
\fill[tcbcolback!80!black] (frame.south west) rectangle ([xshift=5mm]frame.north west);
\end{tcbclipinterior}%
},%
listing only,%
lang,%
title={#2},%
listing options={language=#1,numbersep=4pt},%
}
\DeclareTCBListing[use counter=cvcounter]{langCVOne}{ O{python} o o m }{%
listing only,%
cv,%
listing options={language=#1,numbersep=3pt,linebackgroundcolor={\ifodd\value{lstnumber}\color{cvgray}\fi}},%
title={程序清单\thecvcounter:~#4},%\thetcbcounter
label = #2,
overlay unbroken and first ={\begin{tcbclipinterior}
\node[inner sep=0pt,anchor=north east,yshift=-3pt,xshift=-5pt,text=cvgrayb] at (frame.north east){\ttfamily\faFileText\ \faCode\ \faCodeFork\ \faCopy\ \faExternalLink\ \IfNoValueTF{#3}{\MakeUppercase#1}{#3}};\end{tcbclipinterior}}}
%=====================================================================================
% Command InputListing
%=====================================================================================
\DeclareTCBInputListing{\langPyfile}{ O{python} m m }{%
overlay={%
\begin{tcbclipinterior}
\fill[tcbcolback!80!black] (frame.south west) rectangle ([xshift=5mm]frame.north west);
\end{tcbclipinterior}%
},%
listing only,%
lang,%
listing file={#3},
title={#2},%
listing options={language=#1,numbersep=4pt},%
}
\DeclareTCBInputListing{\gitfile}{ O{bash} m m }{%
listing only,%
gitexample,%
listing file={#3},%
title={#2},%
listing options={language=#1,numbers=none},%
}
\renewcommand{\thelstnumber}{\oldstylenums{%
\arabic{lstnumber}%
}%
}
\DeclareTCBInputListing[use counter=cvcounter]{\langCVfile}{ O{Python} o o m m}{%
listing only,
cv,
listing file={#5},
listing options={language=#1,numbersep=3pt,linebackgroundcolor={\ifodd\value{lstnumber}\color{cvgray}\fi}},
title={程序清单\thecvcounter:~#4},%\thetcbcounter
label = #2,
overlay unbroken and first ={\begin{tcbclipinterior}
\node[inner sep=0pt,anchor=north east,yshift=-3pt,xshift=-5pt,text=cvgrayb] at (frame.north east){\ttfamily\faFileText\ \faCode\ \faCodeFork\ \faCopy\ \faExternalLink\ \IfNoValueTF{#3}{\MakeUppercase#1}{#3}};\end{tcbclipinterior}}}
\fi
\endinput
%%
%% End of file `indentfirst.sty'.