-
Notifications
You must be signed in to change notification settings - Fork 3
/
Settings.tex
164 lines (151 loc) · 5.54 KB
/
Settings.tex
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
% -----------------------------------------------------
% 加边框的命令
% 参考:https://tex.stackexchange.com/questions/531559/how-to-add-the-page-border-for-first-two-pages-in-latex
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{eso-pic}
\AddToShipoutPictureBG{%
\begin{tikzpicture}[overlay,remember picture]
\draw[line width=0.6pt] % 边框粗细
($ (current page.north west) + (0.6cm,-0.6cm) $)
rectangle
($ (current page.south east) + (-0.6cm,0.6cm) $); % 边框位置
\end{tikzpicture}}
\usepackage{xcolor}
\definecolor{c1}{HTML}{2752C9} % 目录颜色
\definecolor{c2}{RGB}{190,20,83} % 引用颜色
\usepackage{ctex}
\usepackage[top=28mm,bottom=28mm,left=15mm,right=15mm]{geometry} % 调整边距
\usepackage{hyperref}
\hypersetup{
colorlinks,
linktoc = section, % 给目录加的超链接位置,选项有 section, page, all
linkcolor = c1, % linkcolor 目录颜色
citecolor = c1 % citecolor 引用颜色
}
\usepackage{amsmath,enumerate,multirow,float}
\usepackage{tabularx}
\usepackage{tabu}
\usepackage{subfig}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{physics}
\usepackage{appendix}
\usepackage{amsfonts}
\usepackage{annotate-equations} % 公式标注
\usepackage{pgfplots} % pgf 绘图
% ---------------------------------------------------------------------
% 定义了两类colorbox
\usepackage{tcolorbox}
\tcbuselibrary{skins,breakable}
\newtcolorbox{tbox}[2][]{
colframe=black!70!,
breakable,
enhanced, % 跨页后不会显示下边框
boxrule =0.5pt,
title = {#2},
fonttitle = \large\bfseries,
drop fuzzy shadow,
#1
}
\newtcolorbox[auto counter,number within=section]{question}[1][]{
top=2pt,bottom=2pt,arc=1mm,
boxrule=0.5pt,
breakable,
enhanced, % 跨页后不会显示下边框
coltitle=c1!80!gray,
colframe=c1,
colback=c1!3!white,
drop fuzzy shadow,
title={思考题~\thetcbcounter:\quad},
fonttitle=\bfseries,
attach title to upper,
#1
}
% ---------------------------------------------------------------------
% 利用 cleveref 改变引用格式,\cref 是引用命令
\usepackage{cleveref}
\crefformat{figure}{#2{\textcolor{c2}{图 #1}}#3} % 图片的引用格式
\crefformat{equation}{#2{(\textcolor{c2}{#1})}#3} % 公式的引用格式
\crefformat{table}{#2{\textcolor{c2}{表 #1}}#3} % 表格的引用格式
% ---------------------------------------------------------------------
% 页眉页脚设置
\fancypagestyle{plain}{\pagestyle{fancy}}
\pagestyle{fancy}
\lhead{\kaishu 中山大学物理与天文学院物理实验\uppercase\expandafter{\romannumeral3}} % 左边页眉,学院 + 课程
\rhead{\kaishu Template 实验报告模板} % 右边页眉,实验报告标题
\cfoot{\thepage} % 页脚,中间添加页码
\setlength{\headheight}{13.6pt}
% ---------------------------------------------------------------------
% 对目录、章节标题的设置
\renewcommand{\contentsname}{\centerline{\huge 目录}}
\usepackage{titlesec}
\usepackage{titletoc}
% \titleformat{章节}[形状]{格式}{标题序号}{序号与标题间距}{标题前命令}[标题后命令]
\titleformat{\section}{\centering\LARGE}{}{1em}{}
\newcommand{\nsection}[3]{%
\section{#1 #2 \hspace{11pt} \textbf{#3}}%
}
% ---------------------------------------------------------------------
% listing代码环境设置
\usepackage{listings}
\lstloadlanguages{python}
\lstdefinestyle{pythonstyle}{
backgroundcolor=\color{gray!5},
language=python,
frameround=tftt,
frame=shadowbox,
keepspaces=true,
breaklines,
columns=spaceflexible,
basicstyle=\ttfamily\small, % 基本文本设置,字体为 teletype,大小为 small
keywordstyle=[1]\color{c1}\bfseries,
keywordstyle=[2]\color{Red!70!black},
stringstyle=\color{Purple},
showstringspaces=false,
commentstyle=\ttfamily\scriptsize\color{green!40!black}, % 注释文本设置,字体为 teletype,大小为 scriptsize
tabsize=2,
morekeywords={as},
morekeywords=[2]{np, plt, sp},
numbers=left, % 代码行数,位置在左
numberstyle=\it\tiny\color{gray}, % 代码行数的数字字体设置
stepnumber=1,
rulesepcolor=\color{gray!30!white}
}
% ---------------------------------------------------------------------
% 将表格封装起来
\newcommand{\scoresTable}[8]{
\begin{table}
\renewcommand\arraystretch{1.7}
\begin{tabularx}{\textwidth}{
|X|X|X|X
|X|X|X|X|}
\hline
\multicolumn{2}{|c|}{预习报告} & \multicolumn{2}{|c|}{实验记录} & \multicolumn{2}{|c|}{分析讨论} & \multicolumn{2}{|c|}{总成绩} \\
\hline
\centering#1&\centering#2 &\centering#3 &\centering#4 &\centering#5 &\centering#6 &\centering#7 &{\centering#8} \\
\hline
\end{tabularx}
\end{table}
}
\newcommand{\infoTable}[6]{
\begin{table}
\renewcommand\arraystretch{1.7}
\begin{tabularx}{\textwidth}{|X|X|X|X|}
\hline
专业:& #1 &年级:& #2\\
\hline
姓名:& #3 & 学号:\\
\hline
实验时间: & 教师签名: \\
\hline
\end{tabularx}
\end{table}
}
% ---------------------------------------------------------------------
% 其他设置
\def\degree{${}^{\circ}$} % 角度
\graphicspath{{./images/}} % 插入图片的相对路径
\allowdisplaybreaks[4] %允许公式跨页
\usetikzlibrary{patterns,decorations.markings,arrows.meta,bending} % TikZ 包的拓展