-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblt.sty
109 lines (108 loc) · 3.55 KB
/
blt.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
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{blt}[2022/05/10 A package with useful Latex commands]
\RequirePackage{listings}
\RequirePackage{xcolor}
\RequirePackage{hyperref}
\RequirePackage[nameinlink]{cleveref}
\RequirePackage{fancyvrb}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{light}{RGB}{255,255,227}
\definecolor{lightblue}{rgb}{0.6,0.8,1.0}
\lstdefinestyle{code}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
breakindent=3ex
}
\lstdefinestyle{bash}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
language=bash,
breakindent=3ex
}
\lstdefinestyle{commandline}{
backgroundcolor=\color{black},
basicstyle=\ttfamily\small\color{white},
xleftmargin=0.05\textwidth,
xrightmargin=0.05\textwidth,
escapechar=§,
breakatwhitespace=false,
breaklines=true,
captionpos=t,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
language=bash,
prebreak={\textbackslash},
breakindent=3ex
}
\lstdefinestyle{result}{
backgroundcolor=\color{lightblue},
basicstyle=\ttfamily\small\color{black}\center,
xleftmargin=0.1\textwidth,
xrightmargin=0.1\textwidth,
escapechar=§,
breakatwhitespace=false,
breaklines=true,
captionpos=t,
keepspaces=true,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
breakindent=3ex,
}
\crefname{listing}{Lst.}{Lsts}
\crefname{figure}{Fig.}{Figs}
\crefname{section}{Sec.}{Secs}
\newcommand{\bltCode}[4]{
\lstinputlisting[style=code, language=#2, caption=#3, captionpos=t, label=#4]{#1}
}
\newcommand{\bltVerbFile}[3]{
\lstinputlisting[captionpos=t, caption=#2, label=#3, style=result]{#1}
}
\newcommand{\bltCommand}[3]{
\lstinputlisting[style=commandline, caption=#2, captionpos=t, label=#3]{#1}
}
\newcommand{\bltPrompt}[0]{\mbox{\space bash\$-\space}}
\newcommand{\bltGdbPrompt}[0]{\mbox{(gdb)}}
\newcommand{\bltRegex}[1]{\mbox{\colorbox{red!30}{\lowercase{#1}}}}
\newcommand{\bltResult}[3]{
\lstinputlisting[style=result, caption=#2, captionpos=t, label=#3]{#1}
}
\newcommand{\bltInlineVerb}[1]{\lstinline[breaklines=true,basicstyle=\ttfamily,breakindent=0pt]{#1}}