This repository has been archived by the owner on Jun 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
codespace.sty
84 lines (76 loc) · 1.71 KB
/
codespace.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
\ProvidesPackage{codespace}
% Options can be used to add more predefined colors (see Section 4)
% e.g.: dvipsnames, svgnames, x11names
\RequirePackage{xcolor}
\RequirePackage{tikz}
\RequirePackage[framemethod=tikz]{mdframed}
\RequirePackage{listings,lstautogobble}
\RequirePackage{minted,verbatim}
% Configurations
\colorlet{codebackground}{magenta!10}
\definecolor{codebasic}{RGB}{106,106,106}
\definecolor{codeidentifier}{RGB}{0,0,0}
\definecolor{codecomment}{RGB}{0,136,0}
\definecolor{codestring}{RGB}{187,68,68}
\definecolor{codekeyword}{RGB}{170,34,255}
\lstdefinestyle{codeframe}{
float=H,
frame=lines,
backgroundcolor=\color{codebackground},
}
\lstdefinestyle{codestyle}{
basicstyle=\color{codebasic}\ttfamily,
identifierstyle=\color{codeidentifier},
commentstyle=\color{codecomment}\itshape,
stringstyle=\color{codestring},
keywordstyle=\color{codekeyword},
numbers=left,
%firstnumber=1,
numbersep=2pt,
numberstyle=\tiny,
autogobble=true,
breaklines=true,
showstringspaces=false,
tabsize=2
}
\lstset{
style=codeframe,
style=codestyle
}
\mdfsetup{
leftline=false,
rightline=false,
backgroundcolor=codebackground,
nobreak=false
}
\usemintedstyle{emacs}
\setminted{
linenos=true,
numbers=left,
%firstnumber=1,
autogobble=true,
breaklines=true,
breaksymbolleft={},
tabsize=2
}
\newenvironment{code}[1]{
\VerbatimEnvironment%
\begin{mdframed}%
\begin{minted}{#1}%
}{
\end{minted}%
\end{mdframed}%
}
\newenvironment{altcode}[1]{
\VerbatimEnvironment%
\begin{mdframed}[backgroundcolor=gray!10]%
\begin{minted}{#1}%
}{
\end{minted}%
\end{mdframed}%
}
\newcommand{\inputcode}[3][]{
\begin{mdframed}%
\inputminted[#1]{#2}{#3}%
\end{mdframed}%
}