forked from XinzeZhang/HUST-PhD-Thesis-Latex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHUSTtils.sty
103 lines (89 loc) · 2.44 KB
/
HUSTtils.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
\ProvidesPackage{HUSTtils}[2024/01/23 3.0.1x any packages you would
like to use]
%%%%% Setting for python env.
\usepackage[utf8]{inputenc}
\usepackage{setspace}
% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{9} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{9} % for normal
% Custom colors
\usepackage{color}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\usepackage[final]{listings}
\usepackage{lstautogobble}
\usepackage[ruled,linesnumbered,algo2e]{algorithm2e}
\usepackage[export]{adjustbox}
% Python style for highlighting
\newcommand\pythonstyle{\lstset{
language=Python,
breaklines=true,
numbers=left,
numberstyle=\tiny,
basicstyle=\setstretch{0.7}\ttm, %
otherkeywords={self}, % Add keywords here
keywordstyle=\ttb\color{deepblue}, % \ttb
%emph={MyClass,__init__}, % Custom highlighting
emphstyle=\ttb\color{deepred}, % Custom highlighting style \ttb
stringstyle=\color{deepred},
commentstyle=\color{deepgreen},
frame=tb, % Any extra options here
showstringspaces=false, %
xleftmargin=2em,
framexleftmargin=2.5em,
autogobble=true,
literate={-}{-}1
}}
\newcommand\knote[1]{\textcolor{blue}{#1}}
%\newcommand\knote[1]{\textcolor{black}{#1}}
\newcommand\snote[1]{\textcolor{red}{#1}}
% Python environment
\lstnewenvironment{python}[1][]
{
\pythonstyle
\lstset{#1}
}
{}
% Python for external files
\newcommand\pythonexternal[2][]{{
\pythonstyle
\lstinputlisting[#1]{#2}}}
% Bash
%\def\backtick{\char768}
\def\backtick{\`{}}
\newcommand\bashstyle{\lstset{
language=bash,
breaklines=true,
numbers=left,
numberstyle=\tiny,
basicstyle=\setstretch{0.7}\ttm, %
otherkeywords={self}, % Add keywords here
keywordstyle=\ttb\color{deepblue}, % \ttb
%emph={MyClass,__init__}, % Custom highlighting
emphstyle=\ttb\color{deepred}, % Custom highlighting style \ttb
stringstyle=\color{deepred},
commentstyle=\color{deepgreen},
frame=tb, % Any extra options here
showstringspaces=false, %
xleftmargin=2em,
framexleftmargin=2.5em,
upquote=true,
autogobble=true,
%literate={`}{{$^{\backprime}$}}1
% literate={`}{\backtick}1
literate={-}{-}1
}}
% Python environment
\lstnewenvironment{bash}[1][]
{
\bashstyle
\lstset{#1}
}
{}
% Bash for external files
\newcommand\bashexternal[2][]{{
\bashstyle
\lstinputlisting[#1]{#2}}}
%%%%% Setting for python env.
\endinput