-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbook-setting.tex
More file actions
241 lines (206 loc) · 9.44 KB
/
book-setting.tex
File metadata and controls
241 lines (206 loc) · 9.44 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
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
236
237
238
239
240
241
% pdf 设置区
%---------------------------------纸张大小设置---------------------------------%
\usepackage{geometry}
\geometry{a4paper,left=2.05cm,right=2.05cm,top=2.5cm,bottom=2.5cm}
%------------------------------------------------------------------------------%
%----------------------------------必要库支持----------------------------------%
\usepackage{xcolor}
\usepackage{tikz}
\usepackage{layouts}
\usepackage[numbers,sort&compress]{natbib}
\usepackage{clrscode}
\usepackage{gensymb}
\usepackage{varwidth}
%------------------------------------------------------------------------------%
%--------------------------------设置标题与目录--------------------------------%
\usepackage[sf]{titlesec}
\usepackage{titletoc}
%------------------------------------------------------------------------------%
%--------------------------------添加书签超链接--------------------------------%
\usepackage[unicode=true,colorlinks=false,pdfborder={0 0 0}]{hyperref}
% 在此处修改打开文件操作
\hypersetup{
bookmarks=true, % show bookmarks bar?
pdftoolbar=true, % show Acrobat’s toolbar?
pdfmenubar=true, % show Acrobat’s menu?
pdffitwindow=true, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdfnewwindow=true, % links in new PDF window
}
% 在此处添加文章基础信息
\hypersetup{
pdftitle={},
pdfauthor={shen, cfrpg},
pdfsubject={},
pdfcreator={XeLaTeX},
pdfproducer={XeLaTeX},
pdfkeywords={},
}
%------------------------------------------------------------------------------%
%---------------------------------设置字体大小---------------------------------%
\usepackage{type1cm}
% 字号与行距,统一前缀s(a.k.a size)
\newcommand{\sChuhao}{\fontsize{42pt}{63pt}\selectfont} % 初号, 1.5倍
\newcommand{\sYihao}{\fontsize{26pt}{36pt}\selectfont} % 一号, 1.4倍
\newcommand{\sErhao}{\fontsize{22pt}{28pt}\selectfont} % 二号, 1.25倍
\newcommand{\sXiaoer}{\fontsize{18pt}{18pt}\selectfont} % 小二, 单倍
\newcommand{\sSanhao}{\fontsize{16pt}{24pt}\selectfont} % 三号, 1.5倍
\newcommand{\sXiaosan}{\fontsize{15pt}{22pt}\selectfont} % 小三, 1.5倍
\newcommand{\sSihao}{\fontsize{14pt}{21pt}\selectfont} % 四号, 1.5倍
\newcommand{\sHalfXiaosi}{\fontsize{13pt}{19.5pt}\selectfont} % 半小四, 1.5倍
\newcommand{\sXiaosi}{\fontsize{12pt}{14.4pt}\selectfont} % 小四, 1.25倍
\newcommand{\sLargeWuhao}{\fontsize{11pt}{11pt}\selectfont} % 大五, 单倍
\newcommand{\sWuhao}{\fontsize{10.5pt}{10.5pt}\selectfont} % 五号, 单倍
\newcommand{\sXiaowu}{\fontsize{9pt}{9pt}\selectfont} % 小五, 单倍
%------------------------------------------------------------------------------%
%---------------------------------设置中文字体---------------------------------%
\usepackage{fontspec}
\usepackage[SlantFont,BoldFont,CJKchecksingle]{xeCJK}
\usepackage{CJKnumb}
% 使用 Adobe 字体
\newcommand\adobeSog{Adobe Song Std}
\newcommand\adobeHei{Adobe Heiti Std}
\newcommand\adobeKai{Adobe Kaiti Std}
\newcommand\adobeFag{Adobe Fangsong Std}
\newcommand\codeFont{Consolas}
% 设置字体
\defaultfontfeatures{Mapping=tex-text}
\setCJKmainfont[ItalicFont=\adobeKai, BoldFont=\adobeHei]{\adobeSog}
\setCJKsansfont[ItalicFont=\adobeKai, BoldFont=\adobeHei]{\adobeSog}
\setCJKmonofont{\adobeSog}
\setmonofont{\codeFont}
% 设置字体族
\setCJKfamilyfont{song}{\adobeSog} % 宋体
\setCJKfamilyfont{hei}{\adobeHei} % 黑体
\setCJKfamilyfont{kai}{\adobeKai} % 楷体
\setCJKfamilyfont{fang}{\adobeFag} % 仿宋体
% 用于页眉学校名,特殊字体,powerby https://github.com/ecomfe/fonteditor
\setCJKfamilyfont{nwpu}{nwpuname}
% 新建字体命令,统一前缀f(a.k.a font)
\newcommand{\fSong}{\CJKfamily{song}}
\newcommand{\fHei}{\CJKfamily{hei}}
\newcommand{\fFang}{\CJKfamily{fang}}
\newcommand{\fKai}{\CJKfamily{kai}}
\newcommand{\fNWPU}{\CJKfamily{nwpu}}
%------------------------------------------------------------------------------%
%------------------------------添加插图与表格控制------------------------------%
\usepackage{graphicx}
\usepackage[font=small,labelsep=quad]{caption}
\usepackage{wrapfig}
\usepackage{multirow,makecell}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{setspace}
%------------------------------------------------------------------------------%
%---------------------------------添加列表控制---------------------------------%
\usepackage{enumerate}
\usepackage{enumitem}
%------------------------------------------------------------------------------%
%---------------------------------设置引用格式---------------------------------%
\renewcommand\figureautorefname{图}
\renewcommand\tableautorefname{表}
\renewcommand\equationautorefname{式}
\newcommand\myreference[1]{[\ref{#1}]}
\newcommand\eqrefe[1]{式(\ref{#1})}
\renewcommand\theequation{\thechapter.\arabic{equation}}
% 增加 \ucite 命令使显示的引用为上标形式
\newcommand{\ucite}[1]{$^{\mbox{\scriptsize \cite{#1}}}$}
%------------------------------------------------------------------------------%
%--------------------------设置中文段落缩进与正文版式--------------------------%
\XeTeXlinebreaklocale "zh" %使用中文的换行风格
\XeTeXlinebreakskip = 0pt plus 1pt %调整换行逻辑的弹性大小
%------------------------------------------------------------------------------%
%----------------------------设置段落标题与目录格式----------------------------%
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
% 正文中标题格式,毋需标号
% \titleformat{\section}[hang]{\fHei \sf \sSihao}
% {\sSihao }{0.5em}{}{}
% \titleformat{\subsection}[hang]{\fHei \sf \sHalfXiaosi}
% {\sHalfXiaosi }{0.5em}{}{}
% \titleformat{\subsubsection}[hang]{\fHei \sf}
% {\thesubsubsection }{0.5em}{}{}
% 正文中标题格式,需要标号
\newcommand\chapterID[1]{第\CJKnumber{#1}章}
\renewcommand{\chaptername}{第\CJKnumber{\thechapter}章}
\renewcommand{\figurename}{图}
\renewcommand{\tablename}{表}
\renewcommand{\bibname}{参考文献}
\renewcommand{\contentsname}{目~录}
\titleformat{\chapter}[hang]{\normalfont\sErhao\filcenter\fHei\bf}{\sErhao{\chaptertitlename}}{20pt}{\sErhao}
\titleformat{\section}[hang]{\fHei \bf \sSanhao}{\sSanhao \thesection}{0.5em}{}{}
\titleformat{\subsection}[hang]{\fHei \bf \sSihao}{\sSihao \thesubsection}{0.5em}{}{}
\titleformat{\subsubsection}[hang]{\fHei \bf}{\thesubsubsection }{0.5em}{}{}
% 缩小正文中各级标题之间的缩进
\titlespacing{\chapter}{0pt}{3em plus .1em minus .2em}{0.25em}
\titlespacing{\section}{0pt}{-0.2em}{0em}
\titlespacing{\subsection}{0pt}{0.5em}{0em}
\titlespacing{\subsubsection}{0pt}{0.25em}{0pt}
% 定义目录中各级标题之间的格式以及缩进
% \dottedcontents{chapter}[0.0em]{\fHei\vspace{0.5em}}{0.0em}{5pt}
\dottedcontents{section}[1.16cm]{}{1.8em}{5pt}
\dottedcontents{subsection}[2.00cm]{}{2.7em}{5pt}
\dottedcontents{subsubsection}[2.86cm]{}{3.4em}{5pt}
\titlecontents{chapter}[0pt]{\fHei\vspace{0.5em}}%
{\contentsmargin{0pt}\fHei\makebox[0pt][l]{\chapterID{\thecontentslabel}}\hspace{3.8em}}%
{\contentsmargin{0pt}\fHei}%
{\titlerule*[.5pc]{.}\contentspage}[\vspace{0em}]
% 删除 chapter 分页
\usepackage{xpatch}
\makeatletter
\xpatchcmd{\chapter}
{\if@openright\cleardoublepage\else\clearpage\fi}{\par\relax}
{}{}
\makeatother
%------------------------------------------------------------------------------%
%---------------------------------设置页眉页脚---------------------------------%
\usepackage{fancyhdr}
\usepackage{fancyref}
\pagestyle{fancy}
\chead{{\it \shorttitle}}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\headwidth}{\textwidth}
\renewcommand{\footrulewidth}{0pt}
%------------------------------------------------------------------------------%
%-------------------------------数学特殊符号控制-------------------------------%
\input{math-symbols}
%------------------------------------------------------------------------------%
%---------------------------------添加列表控制---------------------------------%
\usepackage{enumerate}
\numberwithin{equation}{section}
\renewcommand\theequation{\thesection.\arabic{equation}}
%------------------------------------------------------------------------------%
%---------------------------------添加代码控制---------------------------------%
\usepackage{listings}
\lstset{
basicstyle=\footnotesize\ttfamily,
numbers=left,
numberstyle=\tiny,
numbersep=5pt,
tabsize=4,
extendedchars=true,
breaklines=true,
keywordstyle=\color{blue}\bfseries,
numberstyle=\color{purple},
commentstyle=\color[rgb]{0, 0.4, 0}\bfseries,
stringstyle=\color{violet}\ttfamily\bfseries,
rulesepcolor=\color{red!20!green!20!blue!20},
showspaces=false,
showtabs=false,
frame=shadowbox,
framexrightmargin=5pt,
framexbottommargin=4pt,
showstringspaces=false,
escapeinside=`', %逃逸字符(1左面的键),用于显示中文
}
\renewcommand{\lstlistingname}{CODE}
\lstloadlanguages{% Check Dokumentation for further languages, page 12
Pascal, C++, Java, Ruby, Python, Matlab, R
}
%------------------------------------------------------------------------------%
\endinput
%这是简单的 article 的导言区设置,不能单独编译。