-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatex-pre.tex
More file actions
131 lines (117 loc) · 4.03 KB
/
Copy pathlatex-pre.tex
File metadata and controls
131 lines (117 loc) · 4.03 KB
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
\documentclass{article}
\usepackage[fontset=none]{ctex}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{lmodern}
\usepackage{listings,xcolor}
\usepackage{geometry}
\usepackage{fontspec}
\usepackage{graphicx}
\usepackage[colorlinks, linkcolor=blue, anchorcolor=blue, citecolor=green]{hyperref} % 超链接颜色设置
\usepackage{setspace}
\usepackage{fancyhdr}
\usepackage{titletoc}
% 页面布局设置
\geometry{a4paper, left=2cm, right=2cm, top=2.5cm, bottom=2.5cm} % 页面大小和边距
% 字体设置
\setCJKmainfont{Source Han Sans HW SC}[
ItalicFont={Source Han Sans HW SC},
ItalicFeatures={FakeSlant=0.2}
]
\setCJKsansfont{Source Han Sans HW SC}[
ItalicFont={Source Han Sans HW SC},
ItalicFeatures={FakeSlant=0.2}
]
\setCJKmonofont{Source Han Sans HW SC}[
ItalicFont={Source Han Sans HW SC},
ItalicFeatures={FakeSlant=0.2}
]
\setmainfont{Inconsolata LGC Nerd Font Mono}
\setsansfont{Inconsolata LGC Nerd Font Mono}
\setmonofont{Inconsolata LGC Nerd Font Mono}
% 取消首行缩进和设置行间距
\setlength{\parindent}{0pt}
% 页眉页脚设置
\setlength{\headheight}{13pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\leftmark} % 页眉左侧显示章节名
\fancyfoot[C]{\thepage} % 页脚中间显示页码
% 代码样式设置
\lstdefinestyle{cppstyle}{
language=C++, % 语言设置为 C++
basicstyle=\ttfamily\small\linespread{1.1}\selectfont,
keywordstyle=\color{blue}\bfseries, % 关键字颜色
commentstyle=\color{gray}\itshape, % 注释颜色,斜体
stringstyle=\color{red}, % 字符串颜色
numbers=left, % 行号显示在左侧
numberstyle=\small\color{gray}, % 行号样式
stepnumber=1, % 行号递增
numbersep=10pt, % 行号和代码的间隔
backgroundcolor=\color{gray!5},
showspaces=false, % 不显示空格
showstringspaces=false, % 字符串中不显示空格
breaklines=true, % 自动换行
frame=single, % 给代码添加边框
rulecolor=\color{black!30}, % 边框颜色
tabsize=4, % 设置 Tab 宽度
captionpos=b % 标题位置
}
\lstdefinestyle{pythonstyle}{
language=Python, % 语言设置为 Python
basicstyle=\ttfamily\small\linespread{1.1}\selectfont,
keywordstyle=\color{blue}\bfseries, % 关键字颜色
commentstyle=\color{gray}\itshape, % 注释颜色,斜体
stringstyle=\color{red}, % 字符串颜色
numbers=left, % 行号显示在左侧
numberstyle=\small\color{gray}, % 行号样式
stepnumber=1, % 行号递增
numbersep=10pt, % 行号和代码的间隔
backgroundcolor=\color{gray!5},
showspaces=false, % 不显示空格
showstringspaces=false, % 字符串中不显示空格
breaklines=true, % 自动换行
frame=single, % 给代码添加边框
rulecolor=\color{black!30}, % 边框颜色
tabsize=4, % 设置 Tab 宽度
captionpos=b % 标题位置
}
\lstdefinestyle{javastyle}{
language=Java, % 语言设置为 Java
basicstyle=\ttfamily\small\linespread{1.1}\selectfont,
keywordstyle=\color{blue}\bfseries, % 关键字颜色
commentstyle=\color{gray}\itshape, % 注释颜色,斜体
stringstyle=\color{red}, % 字符串颜色
numbers=left, % 行号显示在左侧
numberstyle=\small\color{gray}, % 行号样式
stepnumber=1, % 行号递增
numbersep=10pt, % 行号和代码的间隔
backgroundcolor=\color{gray!5},
showspaces=false, % 不显示空格
showstringspaces=false, % 字符串中不显示空格
breaklines=true, % 自动换行
frame=single, % 给代码添加边框
rulecolor=\color{black!30}, % 边框颜色
tabsize=4, % 设置 Tab 宽度
captionpos=b % 标题位置
}
% 标题样式设置
\usepackage{titlesec}
\titleformat{\section}{\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\large\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\normalsize\bfseries}{\thesubsubsection}{1em}{}
% 目录样式设置
\usepackage{tocloft}
\cftsetindents{subsection}{1.5em}{3em}
\cftsetindents{subsubsection}{3em}{4em}
% 封面设置
\title{{PLACEHOLDER:TITLE}}
\author{{PLACEHOLDER:AUTHOR}}
\date{\today}
\begin{document}
% 封面内容
\maketitle
{
\hypersetup{linkcolor=black}
\tableofcontents
}
\newpage