-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatex-compact-pre.tex
More file actions
134 lines (119 loc) · 4.12 KB
/
latex-compact-pre.tex
File metadata and controls
134 lines (119 loc) · 4.12 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
132
133
134
\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=1.5cm, right=1.5cm, top=2cm, bottom=2cm} % 减小边距
\setlength{\footskip}{20pt} % 减小页脚间距
% 字体设置
\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} % 无首行缩进
\setstretch{1.0} % 行距调整为 1.0
% 页眉页脚紧凑设置
\setlength{\headheight}{13pt}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[L]{\leftmark} % 页眉左侧显示章节名
\fancyfoot[C]{\thepage} % 页脚中间显示页码
% 代码样式设置
\lstdefinestyle{cppstyle}{
language=C++, % 语言设置为 C++
basicstyle=\ttfamily\small\linespread{1.0}\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.0}\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.0}\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}{\normalsize\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\small\bfseries}{\thesubsubsection}{1em}{}
% 目录样式设置
\usepackage{tocloft}
\cftsetindents{subsection}{1.2em}{2.5em}
\cftsetindents{subsubsection}{2.5em}{3.5em}
% 封面设置
\title{{PLACEHOLDER:TITLE}}
\author{{PLACEHOLDER:AUTHOR}}
\date{\today}
\begin{document}
% 封面内容
\maketitle
{
\hypersetup{linkcolor=black}
\tableofcontents
}
\newpage