-
Notifications
You must be signed in to change notification settings - Fork 1
/
morelull.sty
235 lines (208 loc) · 5.91 KB
/
morelull.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
%
% 个人自用文档样式
%
\ProvidesPackage{morelull}[2020/05/23 v0.2.0]
% 眉首眉脚
\RequirePackage{fancyhdr}
% 调色板
\RequirePackage{xcolor-material}
% 代码提示
\RequirePackage{listings}
% 版边边距
\RequirePackage[left=2cm, right=2cm, bottom=2cm]{geometry}
% 更加现代定理、引用提示
\RequirePackage{tcolorbox}
% 书签
\RequirePackage[open, openlevel=2, atend]{bookmark}
% 链接
\RequirePackage{hyperref}
%%% 自定义 %%%
% 主色调
\colorlet{PrimaryColor}{MaterialBlue900}
%%% CTEX格式设置 %%%
\ctexset{
today=big,
contentsname={最美的故事需要用最美的语言},
section/format=\Large\bfseries\centering\color{PrimaryColor},
subsection/number={\textcolor{PrimaryColor}{\thesubsection}},
}
%%% 链接设置 %%%
\hypersetup{
colorlinks=true,
linkcolor=MaterialPink,
urlcolor=MaterialBlue,
filecolor=MaterialGreen,
}
%%% 代码高亮设置 %%%
\tcbuselibrary{listings}
\lstset{
frame=single,
frameround=tttt,
framesep=1pt,
framextopmargin=6pt,
framexbottommargin=6pt,
tabsize=4,
breaklines=true,
upquote=true,
captionpos=b,
basicstyle=\footnotesize,
backgroundcolor=\color{MaterialBlue50},
rulecolor=\color{MaterialBlue},
identifierstyle=\color{MaterialBlue800},
commentstyle=\itshape\color{MaterialGrey600},
stringstyle=\bfseries\color{MaterialAmber800},
% 保留关键字
keywordstyle=[1]\bfseries\color{MaterialPurple700},
% 新类、新类型、新接口定义
keywordstyle=[2]\bfseries\color{MaterialTeal800},
% 原始类型
keywordstyle=[3]\bfseries\color{MaterialPink400},
% 模块
keywordstyle=[4]\bfseries\color{MaterialBlue900},
% 其他
keywordstyle=[5]\color{MaterialRed500},
numberstyle=\bfseries\color{MaterialGrey800},
}
% javascript语法定义
\lstdefinelanguage{javascript}{
morekeywords=[1]{const, let, function, if, else, while, do, return, break, async, await, yield},
morekeywords=[2]{class, extends, super, constructor, static, this, new, get, set},
morekeywords=[3]{Array, Object, Number, NaN, null, undefined, Set, Buffer},
morekeywords=[4]{module, exports, require},
otherkeywords={=>},
sensitive=true,
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]',
morestring=[b]",
morestring=[b]`,
}
\lstalias{js}{javascript}
% rust语法定义
\lstdefinelanguage{rust}{
morekeywords=[1]{const, let, mut, fn, unsafe, while, loop, if, else, \?, return, await, async},
morekeywords=[1]{as, dyn, Trait, impl, static, for},
morekeywords=[1]{break, continue, label},
morekeywords=[2]{trait, type, struct, newtype, enum, Self, self},
morekeywords=[3]{Vec, String, str, Box, Cell, Arc, Send, Sync, Error, Option, Result},
morekeywords=[4]{mod, use, crate, pub},
morekeywords=[5]{println!, dbg!, format!, panic!},
otherkeywords={::},
sensitive=true,
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[bd]",
}
\lstalias{rs}{rust}
%%% 页眉页脚设置 %%%
\pagestyle{fancy}
\fancyhead[L]{\textcolor{PrimaryColor}{\leftmark}}
\fancyhead[C]{\textcolor{PrimaryColor}{第\zhnumber{\thepage}页}}
\fancyhead[R]{\textcolor{PrimaryColor}{\rightmark}}
\fancyfoot{}
\renewcommand{\headrule}{\color{PrimaryColor}\hrule width\textwidth}
%%% tcolorbox %%%
\tcbuselibrary{theorems}
\tcbuselibrary{skins}
\tcbsetforeverylayer{enhanced}
%%% 自定义命令 %%%
% 专名号
\providecommand\专名[1]{%
\CJKunderline{#1}%
}
% 着重号
\providecommand\着重[1]{%
\CJKunderdot{\heiti{#1}}%
}
% 内联代码,单一颜色
\providecommand\代码[1]{%
\ttfamily\textcolor{MaterialPink}{#1}
}
%%% 自定义环境 %%%
% 引用
\newenvironment{引用}
{\begin{quote}\kaishu\small}
{\end{quote}}
\tcolorboxenvironment{引用}{
blanker,
borderline west={1mm}{0pt}{MaterialGrey200}
}
% 定理
\newtcbtheorem[number within=section]{定理}{定理}{
fonttitle=\heiti,
boxrule=0.1mm,
before upper={\parindent2em},
colback=MaterialGreen50,
colframe=MaterialGreen,
attach boxed title to top left={xshift=12pt, yshift*=-\tcboxedtitleheight/2},
boxed title style={colback=MaterialGreen}
}{定理}
% 结论
\newtcbtheorem[number within=section]{结论}{结论}{
fonttitle=\heiti,
boxrule=0.1mm,
before upper={\parindent2em},
colback=MaterialTeal50,
colframe=MaterialTeal,
attach boxed title to top left={xshift=12pt, yshift*=-\tcboxedtitleheight/2},
boxed title style={colback=MaterialTeal}
}{结论}
% 命题
\newtcbtheorem[number within=section]{命题}{命题}{
fonttitle=\heiti,
boxrule=0.1mm,
before upper={\parindent2em},
colback=MaterialBlueGrey50,
colframe=MaterialBlueGrey,
attach boxed title to top left={xshift=12pt, yshift*=-\tcboxedtitleheight/2},
boxed title style={colback=MaterialBlueGrey}
}{命题}
% 定义
\newtcbtheorem[number within=section]{定义}{定义}{
fonttitle=\heiti,
boxrule=0.1mm,
before upper={\parindent2em},
colback=MaterialGreen50,
colframe=MaterialGreen,
attach boxed title to top left={xshift=12pt, yshift*=-\tcboxedtitleheight/2},
boxed title style={colback=MaterialGreen}
}{定义}
% 命题
\newtcbtheorem[number within=section]{Kronecker}{Kronecker}{
fonttitle=\heiti,
boxrule=0.1mm,
before upper={\parindent2em},
colback=MaterialBlueGrey50,
colframe=MaterialBlueGrey,
attach boxed title to top left={xshift=12pt, yshift*=-\tcboxedtitleheight/2},
boxed title style={colback=MaterialBlueGrey}
}{Kronecker}
% 文本提示框
\newtcolorbox{文本提示框}[1]{
skin=empty,
top=0pt,
bottom=0pt,
toprule=0pt,
bottomrule=0pt,
leftrule=0pt,
rightrule=0pt,
borderline west={2pt}{0pt}{#1},
}
% 提示
\newenvironment{提示}
{\begin{文本提示框}{MaterialBlue}
\textcolor{MaterialBlue}{\heiti{提示:}}
}
{\end{文本提示框}}
% 提醒
\newenvironment{提醒}
{\begin{文本提示框}{MaterialDeepOrange}
\textcolor{MaterialDeepOrange}{\heiti{提醒:}}
}
{\end{文本提示框}}
% 注意
\newenvironment{注意}
{\begin{文本提示框}{MaterialRed}
\textcolor{MaterialRed}{\heiti{注意:}}
}
{\end{文本提示框}}