-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmylistings.sty
88 lines (75 loc) · 2.17 KB
/
mylistings.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
\ProvidesPackage{mylistings}
\RequirePackage{listings}
\RequirePackage{kvoptions}
% \DeclareStringOption[init]{key}[default]
% `init` : value used if no option specified, i.e., \usepackage{...}
% `default` : value used if option called but undefined, i.e., \usepackage[path]{...}
% Otherwise uses the value specified in the option, i.e., \usepackage[path=...]{...}
\DeclareStringOption[
./chapter_0/STOPS% /media/justin/Transcend/STOPS/src/STOPS
]{path}[
/media/justin/Transcend/Writeup/chapter_0/STOPS% ../../STOPS/src/STOPS% ../../STOPS
]
\ProcessKeyvalOptions*
% Allow for custom symbols in code
\def\mybacktick{\`{}}
\def\mytilde{\raisebox{0.5ex}{\texttildelow}}
% Allow insertion of syntax highlighted code
\lstloadlanguages{bash, Python}
% Set defaults
\lstset{%
basicstyle=\ttfamily\footnotesize,
inputpath=\mylistings@path,
literate=
{~}{\mytilde}1%
{`}{\mybacktick}1,
backgroundcolor=\color{gray!10!white},
frame={lines},
showstringspaces=false,
escapeinside={(*@}{@*)},
}
% - Line break behaviour
\lstset{%
breaklines=true,
breakatwhitespace=true,
breakautoindent=false,
breakindent=0pt,
postbreak=\mbox{\larger[1]\texttt{>\->\->}\space},
}
% - Range behaviour
\lstset{%
rangeprefix=\#----------,
rangesuffix=----------,
includerangemarker=false,
}
% % Define custom style for IRAF Database
\lstdefinestyle{IRAF_DB}{%
basicstyle=\ttfamily\tiny,
frame={single},
}
% % Define custom style for terminal
% \lstdefinestyle{term}{%
% }
% Define custom style for STOPS
\lstdefinestyle{STOPS}{%
basicstyle=\ttfamily\scriptsize,
belowcaptionskip=1\baselineskip,
identifierstyle=\color{blue},
keywordstyle=\bfseries\color{green!40!black},
morecomment=[s]{"""}{"""},
numbers=left,
numbersep=5pt,
numberstyle=\tiny\textcolor{gray},
stringstyle=\ttfamily\color{red!50!brown},
breakautoindent=true,
postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
tabsize=4,
}
% Define custom style for STOPS docstrings
\lstdefinestyle{STOPS_docs}{%
% style=STOPS,
basicstyle=\ttfamily\tiny,
% framexleftmargin=-16pt,
% numbersep=-8pt,
% xleftmargin=-18pt,
}