Debian Codegraph @

texmf-dist/source/latex/bithesis/bithesis-thesis.dtx

raw
1 % \subsection{bithesis.cls 文档类}
2 %
3 % \subsubsection{全局变量与临时变量}
4 %
5 % 定义全局变量。
6 % \begin{variable}{\g_@@_thesis_type_int}
7 % 论文类型,取值从 1 开始,分别对应:
8 % \begin{enumerate}
9 % \item 本科生毕业设计(论文)
10 % \item 本科生毕业设计(论文)外文翻译
11 % \item 本科生全英文专业毕业设计(论文)
12 % \item 硕士学位论文
13 % \item 博士学位论文
14 % \end{enumerate}
15 % \begin{macrocode}
16 \int_new:N \g_@@_thesis_type_int
17 % \end{macrocode}
18 % \end{variable}
19 %
20 % \begin{variable}{\g_@@_head_zihao_int}
21 % 页眉字号。研究生论文使用 5 号字,本科生论文使用 4 号字。
22 % \begin{macrocode}
23 \int_new:N \g_@@_head_zihao_int
24 % \end{macrocode}
25 % \end{variable}
26 %
27 % \begin{variable}{\g_@@_twoside_bool}
28 % 是否双面打印。默认单面打印。
29 % \begin{macrocode}
30 \bool_new:N \g_@@_twoside_bool
31 % \end{macrocode}
32 % \end{variable}
33 %
34 % \begin{variable}{\g_@@_thesis_type_english_bool}
35 % 是否为英文模板。目前只有本科生全英文专业的模板会将此变量设置为 true。
36 % \begin{macrocode}
37 \bool_new:N \g_@@_thesis_type_english_bool
38 % \end{macrocode}
39 % \end{variable}
40 %
41 % \begin{variable}{\g_@@_blind_mode_bool}
42 % 是否为盲审模式。默认为 false。
43 % \begin{macrocode}
44 \bool_new:N \g_@@_blind_mode_bool
45 % \end{macrocode}
46 % \end{variable}
47 %
48 % \begin{variable}{\g_@@_quirks_mode_bool}
49 % 是否兼容更符合北理工官方模板或规范,但不太符合一般排版要求的模式。默认为 false。
50 % 目前此选项包括:
51 % \begin{itemize}
52 % \item \pkg{biblatex} 的专利格式不再使用国标格式,而采用北理工自定义格式。
53 % \end{itemize}
54 % \begin{macrocode}
55 \bool_new:N \g_@@_quirks_mode_bool
56 % \end{macrocode}
57 % \end{variable}
58 %
59 % \begin{variable}{\g_@@_label_divide_char_tl}
60 % 用于分隔标签的字符。默认为「-」或者「.」。
61 % \begin{macrocode}
62 \tl_new:N \g_@@_label_divide_char_tl
63 % \end{macrocode}
64 % \end{variable}
65 %
66 % \begin{variable}{\l_@@_right_seq, \l_@@_left_seq}
67 % 定义临时变量。
68 % \begin{macrocode}
69 \seq_new:N \l_@@_right_seq
70 \seq_new:N \l_@@_left_seq
71 % \end{macrocode}
72 % \end{variable}
73 %
74 % \begin{variable}{\l_@@_input_clist}
75 % 定义渲染信息所用临时列表,每次使用前必须 |\clist_set|。
76 % \begin{macrocode}
77 \clist_new:N \l_@@_input_clist
78 % \end{macrocode}
79 % \end{variable}
80 %
81 % \subsubsection{辅助函数与常量}
82 %
83 % \begin{macro}[added=2023-05-06,updated=2023-07-04]{\@@_secret_info:nn,\@@_secret_info:N,\@@_secret_info:n}
84 % 普通模式下显示参数一,盲审模式下显示参数二。
85 % 无参数二时,替换为等量 |\g_@@_const_substitute_symbol_tl|,换行也会被替换。
86 % \begin{macrocode}
87 \cs_new:Npn \@@_hide:n #1 {
88 \g_@@_const_substitute_symbol_tl
89 }
90
91 \cs_new:Npn \@@_secret_info:nn #1 #2 {
92 \bool_if:NTF \g_@@_blind_mode_bool {
93 #2
94 } {
95 #1
96 }
97 }
98
99 \cs_new:Npn \@@_secret_info:N #1 {
100 \@@_secret_info:nn {#1} {\tl_map_function:NN #1 \@@_hide:n }
101 }
102 \cs_new:Npn \@@_secret_info:n #1 {
103 \@@_secret_info:nn {#1} {\tl_map_function:NN {#1} \@@_hide:n }
104 }
105 % \end{macrocode}
106 % \end{macro}
107 %
108 % \begin{macro}[added=2025-04-30]{\@@_secret_info_fixed:Nn}
109 % 普通模式下显示参数一,盲审模式下显示参数二个数的 |\g_@@_const_substitute_symbol_tl|。
110 % 例外:若参数一为空,也输出空。这样允许 |\@@_render_cover_entry:nn| 隐藏此项。
111 % 为了实现例外,参数一必须是 N 而非 n,不然难以检测是否真正为空。
112 %
113 % \begin{macrocode}
114 \cs_new:Npn \@@_secret_info_fixed:Nn #1 #2 {
115 \tl_if_blank:VF #1 {
116 \@@_secret_info:nn {#1} {
117 \prg_replicate:nn {#2} {\g_@@_const_substitute_symbol_tl}
118 }
119 }
120 }
121 % \end{macrocode}
122 % \end{macro}
123 %
124 % \begin{macro}[added=2023-03-16, updated=2025-04-04]{\@@_get_const:n} 获取标题、章节、表格、图形等的常量名称。
125 % 会区别英文模式和中文模式。
126 % \begin{macrocode}
127 \cs_new:Npn \@@_get_const:n #1 {
128 \@@_if_thesis_english:TF {
129 \use:c {c_@@_label_ #1 _en_tl}
130 } {
131 \use:c {c_@@_label_ #1 _tl}
132 }
133 }
134 % \end{macrocode}
135 % \end{macro}
136 %
137 % \begin{macro}[added=2023-03-16]{\@@_set_english_mode:}
138 % 设置为英文模式。
139 % \begin{macrocode}
140 \cs_new:Npn \@@_set_english_mode: {
141 \bool_gset_true:N \g_@@_thesis_type_english_bool
142 }
143 % \end{macrocode}
144 % \end{macro}
145 %
146 % \begin{macro}{\tl_if_empty:xTF,\seq_set_split:Nnx}
147 % 生成变体。
148 % \begin{macrocode}
149 \cs_generate_variant:Nn \tl_if_empty:nTF {x}
150 \cs_generate_variant:Nn \seq_set_split:Nnn {Nnx}
151 % \end{macrocode}
152 %
153 % 为兼容旧版生成变体。
154 % \begin{macrocode}
155 % 兼容 TeX Live 2022/2023 及更早版本(l3msg 与 TeX Live 并不同步更新,2023 支持与否均有可能)
156 \cs_if_exist:NF \msg_warning:nnV {
157 \cs_generate_variant:Nn \msg_warning:nnn { nnV }
158 }
159 % \end{macrocode}
160 % \end{macro}
161 %
162 % \begin{macro}{\@@_warning_footer:n}
163 % 用 l3msg 创建警告时,需后缀的内容。
164 % 参数建议为 ⟨message⟩,即 |\msg_new:nnn| 系列函数的第二个参数。
165 %
166 % 之所以设置此函数,是因为 VS Code 插件 LaTeX Workshop 无法识别随意放置的 |\msg_line_context:|,只好专门适配。
167 % \url{https://github.com/James-Yu/LaTeX-Workshop/blob/c62e327b8233e20d61814bfda305811bea1ae83f/src/parse/parser/latexlog.ts#L17}
168 % \begin{macrocode}
169 \cs_new:Npn \@@_warning_footer:n #1 {
170 —The~“#1”\\warning~on~input~line~\msg_line_number:.
171 }
172 % \end{macrocode}
173 % \end{macro}
174 %
175 % \begin{macro}{\@@_same_page:}
176 % 取消换页。
177 % \begin{macrocode}
178 \cs_new:Npn \@@_same_page: {
179 \let\clearpage\relax
180 \let\cleardoublepage\relax
181 }
182 % \end{macrocode}
183 % \end{macro}
184
185 % \begin{macro}{\@@_if_thesis_int_type:nTF,\@@_if_thesis_int_type:nT}
186 % 是否某一特定模板。
187 % \begin{macrocode}
188 \cs_new:Npn \@@_if_thesis_int_type:nTF #1#2#3 {\int_compare:nNnTF {\g_@@_thesis_type_int} = {#1} {#2} {#3}}
189 \cs_new:Npn \@@_if_thesis_int_type:nT #1#2 {\@@_if_thesis_int_type:nTF {#1} {#2} {}}
190 % \end{macrocode}
191 % \end{macro}
192
193 % \begin{macro}{\@@_if_thesis_english:T,\@@_if_thesis_english:F,\@@_if_thesis_english:TF}
194 % 是否为英文模板,这里包括全英文专业和研究生模板的英文模式。
195 % \begin{macrocode}
196 \cs_new:Npn \@@_if_thesis_english:TF #1#2 {\bool_if:nTF {\g_@@_thesis_type_english_bool} {#1} {#2}}
197 \cs_new:Npn \@@_if_thesis_english:T #1 {\@@_if_thesis_english:TF {#1}{}}
198 \cs_new:Npn \@@_if_thesis_english:F #1 {\@@_if_thesis_english:TF {}{#1}}
199 % \end{macrocode}
200 % \end{macro}
201 %
202 % \begin{macro}{\@@_if_graduate:TF,\@@_if_graduate:T,\@@_if_bachelor:T}
203 % 是否为本科或硕博学位论文。二者互为对立事件。
204 % \begin{macrocode}
205 \cs_new:Npn \@@_if_graduate:TF #1#2 {\int_compare:nNnTF {3} < {\g_@@_thesis_type_int} {#1} {#2}}
206 \cs_new:Npn \@@_if_graduate:T #1 {\@@_if_graduate:TF {#1} {}}
207 \cs_new:Npn \@@_if_bachelor:T #1 {\@@_if_graduate:TF {} {#1}}
208 % \end{macrocode}
209 % \end{macro}
210 %
211 % \begin{variable}{\c_@@_thesis_type_clist}
212 % 定义论文类型的列表。
213 % \begin{macrocode}
214 \clist_const:Nn \c_@@_thesis_type_clist
215 { bachelor, bachelor_translation, bachelor_english, master, doctor}
216 % \end{macrocode}
217 % \end{variable}
218 %
219 % \begin{macro}{\@@_define_label:nn,\@@_define_label_by_thesis_type:nnn,\@@_define_label:nnn,\@@_define_label_by_thesis_type:nnnn}
220 % 定义常量(标签)的辅助函数。
221 % \begin{macrocode}
222 \cs_new_protected:Npn \@@_define_label:nn #1#2
223 { \tl_const:cn { c_@@_label_ #1 _tl } {#2} }
224
225 \cs_new_protected:Npn \@@_define_label_by_thesis_type:nnn #1#2#3
226 {
227 \tl_const:cn { c_@@_ #1 _label_ #2 _tl } {#3}
228 }
229
230 \cs_new_protected:Npn \@@_define_label:nnn #1#2#3
231 {
232 \tl_const:cn { c_@@_label_ #1 _tl } {#2}
233 \tl_const:cn { c_@@_label_ #1 _en_tl } {#3}
234 }
235
236 \cs_new_protected:Npn \@@_define_label_by_thesis_type:nnnn #1#2#3#4
237 {
238 \tl_const:cn { c_@@_ #1 _label_ #2 _tl } {#3}
239 \tl_const:cn { c_@@_ #1 _label_ #2 _en_tl } {#4}
240 }
241 % \end{macrocode}
242 % \end{macro}
243 %
244 % \begin{macro}{\@@_smallgap:}
245 % 标签文字之间的间距。
246 % \begin{macrocode}
247 \cs_new:Npn \@@_smallgap: {
248 \hspace{0.45ex}
249 }
250 % \end{macrocode}
251 % \end{macro}
252 %
253 % \begin{macro}{\@@_boxempty:}
254 % 空的选框。
255 % \begin{macrocode}
256 \cs_new:Npn \@@_boxempty:
257 {
258 \makebox[1em][l]
259 {
260 % 为保证与打了勾的一致,也需套盒子
261 \makebox[0pt][l]
262 {
263 % 默认比基线略高,向下降降
264 \raisebox{-1pt}{$\square$}
265 }
266 }
267 }
268 % \end{macrocode}
269 % \end{macro}
270 %
271 % \begin{macro}{\@@_boxcheck:}
272 % 打了勾的选框。
273 % \begin{macrocode}
274 \cs_new:Npn \@@_boxcheck:
275 {
276 \makebox[1em][l]
277 {
278 \makebox[0pt][l]
279 {
280 % 默认比基线略高,向下降降
281 \raisebox{-1pt}{$\square$}
282 }
283 $\checkmark$
284 }
285 }
286 % \end{macrocode}
287 % \end{macro}
288 %
289 % \begin{macro}{\@@_label_space:}
290 % 标签与内容之间的空白间距。
291 % \begin{macrocode}
292 \cs_new:Npn \@@_label_space: {
293 \@@_if_bachelor:T {
294 \quad
295 }
296 }
297 % \end{macrocode}
298 % \end{macro}
299 %
300 % \begin{variable}{\c_@@_label_code_tl,\c_@@_label_udc_tl,
301 % \c_@@_label_classification_tl,\c_@@_label_classified_level_tl,\c_@@_label_type_tl}
302 % 没有对应英文的常量。
303 % \begin{macrocode}
304 \clist_map_inline:nn
305 {
306 {code} {代码},
307 {udc} {UDC分类号:},
308 {classification} {中图分类号:},
309 {university_code} {学校代码:},
310 {classified_level} {密级},
311 {type} {种类},
312 {special_type} {学生类型},
313 {engineering_special_plan} {工程硕博士专项},
314 {cross_research} {交叉研究方向},
315 {international_student_ugp} {政府项目留学生},
316 }
317 {\@@_define_label:nn #1}
318 % \end{macrocode}
319 % \end{variable}
320 %
321 % \begin{variable}{\c_@@_bachelor_label_xxx_tl}
322 % 本科毕设的常量。
323 % \begin{macrocode}
324 \clist_map_inline:nn
325 {
326 {originality} {原创性声明},
327 {originality_clause} {本人郑重声明:所呈交的毕业设计(论文),
328 是本人在指导老师的指导下独立进行研究所取得的成果。除文中已经注明引用的内容外,
329 本文不包含任何其他个人或集体已经发表或撰写过的研究成果。
330 对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。\par~特此申明。},
331 {authorization} {关于使用授权的声明},
332 {authorization_clause} {本人完全了解北京理工大学有关保管、使用毕业设计(论文)的规定,
333 其中包括:\circled{1}~学校有权保管、并向有关部门送交本毕业设计(论文)的原件与复印件;
334 \circled{2}~学校可以采用影印、缩印或其它复制手段复制并保存本毕业设计(论文);
335 \circled{3}~学校可允许本毕业设计(论文)被查阅或借阅;\circled{4}~学校可以学术交流为目的,
336 复制赠送和交换本毕业设计(论文);\circled{5}~学校可以公布本毕业设计(论文)的全部或部分内容。},
337 {originality_author_signature}
338 {本人签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{13mm}年\hspace{8mm}月\hspace{8mm}日},
339 {originality_supervisor_signature}
340 {指导老师签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{13mm}年\hspace{8mm}月\hspace{8mm}日},
341 } {\@@_define_label_by_thesis_type:nnn {bachelor} #1}
342 % \end{macrocode}
343 % \end{variable}
344 %
345 % \begin{variable}{\c_@@_bachelor_english_label_xxx_tl}
346 % 全英文专业的常量。
347 % \begin{macrocode}
348 \clist_map_inline:nn
349 {
350 {originality} {原创性声明~Statement~of~Originality},
351 {originality_clause} {
352 本人郑重声明:所呈交的毕业设计(论文),
353 是本人在指导老师的指导下独立进行研究所取得的成果。除文中已经注明引用的内容外,
354 本文不包含任何其他个人或集体已经发表或撰写过的研究成果。
355 对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式标明。特此申明。\par
356 \arialfamily I,\@@_dunderline:n{\makebox[18mm]{}},~solemnly~
357 declare:~the~submitted~graduation~design~(thesis),~
358 is~the~research~achievement~completed~independently~by~myself~
359 under~the~guidance~of~the~supervisor.~This~article~does~not~contain~
360 any~research~published~or~written~by~any~other~individual~or~group,~
361 except~as~already~referenced~in~this~paper.~Individuals~and~groups~
362 that~have~made~important~contributions~to~the~study~of~this~paper~
363 are~clearly~indicated~and~cited~in~the~paper.\par
364 },
365 {authorization} {关于使用授权的声明~State~of~Use~Authorization},
366 {authorization_clause} {
367 本人完全了解北京理工大学有关保管、使用毕业设计(论文)的规定,
368 其中包括:\circled{1}学校有权保管、并向有关部门送交本毕业设计(论文)的原件与复印件;
369 \circled{2}学校可以采用影印、缩印或其它复制手段复制并保存本毕业设计(论文);
370 \circled{3}学校可允许本毕业设计(论文)被查阅或借阅;
371 \circled{4}学校可以学术交流为目的,复制赠送和交换本毕业设计(论文);
372 \circled{5}学校可以公布本毕业设计(论文)的全部或部分内容。\par
373 I~fully~understand~the~regulations~on~the~storage,~
374 use~of~graduation~design~(thesis)~in~Beijing~Institute~of~Technology.~
375 Beijing~Institute~of~Technology~has~the~right~to~(1)~keep,~
376 and~to~the~relevant~departments~to~send~the~original~or~copy~
377 of~this~graduation~design~(thesis);~(2)~copy~and~preserve~this~
378 graduation~design~(thesis)~by~photocopying,~miniature~or~other~
379 means~of~reproduction;~(3)~allow~this~graduation~design~(thesis)~
380 to~be~read~or~borrowed;~(4)~for~the~purpose~of~academic~exchange,~
381 copy,~give~and~exchange~this~graduation~design~(thesis);~(5)~
382 publish~all~or~part~of~the~contents~of~this~graduation~design~(thesis).~
383 },
384 } {\@@_define_label_by_thesis_type:nnn {bachelor_english} #1}
385 % \end{macrocode}
386 % \end{variable}
387 %
388 % \begin{variable}{\c_@@_graduate_label_xxx_tl}
389 % 研究生模板的常量。
390 % \begin{macrocode}
391 \clist_map_inline:nn
392 {
393 {originality} {研究成果声明},
394 {originality_clause} {本人郑重声明:所提交的学位论文是我本人在指导教师的指导下独立完成的研究成果。文中所撰写内容符合以下学术规范(请勾选):
395 \par \@@_boxcheck:\hspace{0.5em} 论文综述遵循“适当引用”的规范,全部引用的内容不超过50\%。
396 \par \@@_boxcheck:\hspace{0.5em} 论文中的研究数据及结果不存在篡改、剽窃、抄袭、伪造等学术不端行为,并愿意承担因学术不端行为所带来的一切后果和法律责任。
397 \par \@@_boxcheck:\hspace{0.5em} 文中依法引用他人的成果,均已做出明确标注或得到许可。
398 \par \@@_boxcheck:\hspace{0.5em} 论文内容未包含法律意义上已属于他人的任何形式的研究成果,也不包含本人已用于其他学位申请的论文或成果。
399 \par \@@_boxcheck:\hspace{0.5em} 与本人一同工作的合作者对此研究工作所做的任何贡献均已在学位论文中作了明确的说明并表示了谢意。
400 \par~特此声明。},
401 {authorization} {关于学位论文使用权的说明},
402 {authorization_clause} {本人完全了解北京理工大学有关保管、使用学位论文的规定,其中包括:
403 \par~\circled{1}~学校有权保管、并向有关部门送交学位论文的原件与复印件;
404 \par~\circled{2}~学校可以采用影印、缩印或其它复制手段复制并保存学位论文;
405 \par~\circled{3}~学校可允许学位论文被查阅或借阅;
406 \par~\circled{4}~学校可以学术交流为目的,复制赠送和交换学位论文;
407 \par~\circled{5}~学校可以公布学位论文的全部或部分内容(保密学位论文在解密后遵守此规定)。},
408 {originality_author_signature}
409 {签\qquad 名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{30mm}\quad},
410 {originality_supervisor_signature}
411 {导师签名:\hspace{40mm}日\hspace{2.5mm}期:\hspace{30mm}\quad},
412 } {\@@_define_label_by_thesis_type:nnn {graduate} #1}
413 % \end{macrocode}
414 % \end{variable}
415 %
416 % \begin{variable}{\c_@@_graduate_label_xxx_tl,\c_@@_graduate_label_xxx_en_tl}
417 % 研究生模板的中英常量。
418 % \begin{macrocode}
419 \clist_map_inline:nn
420 {
421 % TODO: 自动实现汉字均排
422 {author} {作\quad 者\quad 姓\quad 名} {Candidate~Name},
423 {school} {二\@@_smallgap: 级\@@_smallgap: 培\@@_smallgap: 养\@@_smallgap: 单\@@_smallgap: 位} {School~or~Department},
424 {supervisor} {指\quad 导\quad 教\quad 师} {Faculty~Mentor},
425 {industrial_mentor} {行\@@_smallgap: 业\@@_smallgap: 合\@@_smallgap: 作\@@_smallgap: 导\@@_smallgap: 师} {Industry~Collaboration~Mentor},
426 {chairman} {答辩委员会主席} {Chair,~Thesis~Committee},
427 % degree、major 的中文与 degreeType 有关,此处以 academic 为准,其余情况通过 \c_@@_auto_tl 处理
428 % 英文倒是无关。
429 {degree} {申\quad 请\quad 学\quad 位} {Degree~Applied},
430 {major} {一\quad 级\quad 学\quad 科} {Major},
431 {institute}
432 {学\@@_smallgap: 位\@@_smallgap: 授\@@_smallgap: 予\@@_smallgap: 单\@@_smallgap: 位}
433 {Degree~by},
434 {submission_date}
435 {论\@@_smallgap: 文\@@_smallgap: 提\@@_smallgap: 交\@@_smallgap: 日\@@_smallgap: 期}
436 {Submission~date},
437 } {\@@_define_label_by_thesis_type:nnnn {graduate} #1}
438 % \end{macrocode}
439 % \end{variable}
440 %
441 % \begin{variable}{\c_@@_label_xxx_tl,\c_@@_label_xxx_en_tl}
442 % 常用的中英常量。
443 % \begin{macrocode}
444 \clist_map_inline:nn
445 {
446 {school} {学\qquad 院} {School},
447 {major} {专\qquad 业} {Degree},
448 {course} {课程名称} {Course},
449 {class} {班\qquad{}级} {Class},
450 {author} {学生姓名} {Author},
451 {student_id} {学\qquad 号} {Student~ID},
452 {supervisor} {指导教师} {Supervisor},
453 {co_supervisor} {校外指导教师} {Co-Supervisor},
454 {teacher} {任课教师} {Teacher},
455 {semester} {上课学期} {Semester},
456 {keywords} {关键词:} {Key~Words:~},
457 {abstract} {摘\@@_label_space: 要} {Abstract},
458 {conclusion} {结\@@_label_space: 论} {Conclusions},
459 % 附录部分的总标题
460 {appendix} {附\@@_label_space: 录} {Appendices},
461 {ack} {致\@@_label_space: 谢} {Acknowledgements},
462 {figure} {插\@@_label_space: 图} {Illustrations},
463 {table} {表\@@_label_space: 格} {Tables},
464 % 附录下各部分编号的前缀
465 {appendix_prefix} {附录} {Appendix},
466 {reference} {参考文献} {References},
467 {university} {北京理工大学} {Beijing~Institute~of~Technology},
468 {publications} {攻读学位期间发表论文与研究成果清单}
469 {Publications~During~Studies},
470 % TODO: Not so sure about the translation.
471 {resume} {作者简介} {Author~Biography},
472 {symbols} {主要符号对照表} {Nomenclature},
473 {algo} {算法} {Algorithm},
474 {them} {定理} {Theorem},
475 {lem} {引理} {Lemma},
476 {prop} {命题} {Proposition},
477 {cor} {推论} {Corollary},
478 {axi} {公理} {Axiom},
479 {defn} {定义} {Definition},
480 {conj} {猜想} {Conjecture},
481 {exmp} {例} {Example},
482 {case} {情形} {Case},
483 {rem} {注} {Remark},
484 {fig} {图} {Figure},
485 {tab} {表} {Table},
486 {equ} {式} {Equation},
487 }
488 {\@@_define_label:nnn #1}
489 % \end{macrocode}
490 % \end{variable}
491 %
492 % \begin{variable}{\c_@@_bachelor_thesis_header_clist,\c_@@_bachelor_thesis_headline_clist}
493 % 本科生模板的页眉标题与封面大标题常量列表,其中封面大标题不适用于硕士、博士学位论文,只适用于本科生毕业设计(论文)及其衍生物。
494 % \begin{macrocode}
495 \clist_const:Nn \c_@@_bachelor_thesis_header_clist
496 {
497 北京理工大学本科生毕业设计(论文),
498 北京理工大学本科生毕业设计(论文)外文翻译,
499 Beijing~Institute~of~Technology~Bachelor's~Thesis,
500 北京理工大学硕士学位论文,
501 北京理工大学博士学位论文,
502 }
503 \clist_const:Nn \c_@@_bachelor_thesis_headline_clist
504 {
505 本科生毕业设计(论文),
506 本科生毕业设计(论文)外文翻译,
507 Beijing\nobreak{~}Institute\nobreak{~}of\nobreak{~}Technology~Bachelor's~Thesis,
508 }
509 % \end{macrocode}
510 % \end{variable}
511 %
512 % \subsubsection{BITSetup l3keys 接口键值对定义}
513 %
514 % \begin{macro}{\c_@@_auto_tl}
515 % 定义 |\c_@@_auto_tl|
516 % 选项设为它时,表示智能默认值,稍后由 |\@@_resolve_auto_values:| 根据其它信息自动填充。
517 % 参考 https://typst.app/docs/reference/foundations/auto/ 的设计。
518 % \begin{macrocode}
519 \tl_const:Nn \c_@@_auto_tl { BIThesis-auto-magic }
520 % \end{macrocode}
521 % \end{macro}
522 %
523 % 定义 |bithesis| 键值对类。
524 % \begin{macrocode}
525 \keys_define:nn { bithesis }
526 {
527 info .meta:nn = { bithesis / info } {#1},
528 misc .meta:nn = { bithesis / misc } {#1},
529 cover .meta:nn = { bithesis / cover } {#1},
530 style .meta:nn = { bithesis / style } {#1},
531 option .meta:nn = { bithesis / option } {#1},
532 TOC .meta:nn = { bithesis / TOC } {#1},
533 appendices .meta:nn = { bithesis / appendices } {#1},
534 publications .meta:nn = { bithesis / publications } {#1},
535 acknowledgements .meta:nn = { bithesis / acknowledgements } {#1},
536 const .meta:nn = { bithesis / const } {#1},
537 }
538 % \end{macrocode}
539 %
540 % 定义 |bithesis/option| 键值对类。
541 % \begin{macrocode}
542 \keys_define:nn { bithesis / option }
543 {
544 type .choice:,
545 type .value_required:n = true,
546 type .choices:Vn =
547 \c_@@_thesis_type_clist
548 {
549 \int_set_eq:NN \g_@@_thesis_type_int \l_keys_choice_int
550 \int_case:nn {\l_keys_choice_int} {
551 % 本科全英文也是英文模板。
552 {3} {\@@_set_english_mode:}
553 }
554 },
555 type .initial:n = bachelor,
556 twoside .bool_gset:N = \g_@@_twoside_bool,
557 blindPeerReview .bool_gset:N = \g_@@_blind_mode_bool,
558 ctex .tl_set:N = \l_@@_options_to_ctex_tl,
559 quirks .bool_gset:N = \g_@@_quirks_mode_bool,
560 % xeCJK
561 autoFakeBold .tl_set:N = \g_@@_auto_fake_bold_tl,
562 autoFakeBold .initial:n = {3},
563 % 是否开启英文模式。目前在设计上,这个选项仅对研究生模板生效。
564 % 本科生模板的英文模式是根据 |type| 选项自动判断的。
565 english .code:n = { \@@_set_english_mode: } ,
566 }
567 % \end{macrocode}
568 %
569 % 定义 |bithesis/cover| 键值对类。
570 % \begin{macrocode}
571 % Declare variables used by keys
572 \tl_new:N \l_@@_cover_delimiter_tl
573 \tl_new:N \l_@@_cover_label_align_tl
574 \dim_new:N \l_@@_cover_label_max_width_dim
575 \dim_new:N \l_@@_cover_value_max_width_dim
576 \dim_new:N \l_@@_cover_auto_width_padding_dim
577 \dim_new:N \l_@@_cover_underline_offset_dim
578 %
579 % Declare keys
580 \keys_define:nn { bithesis / cover }
581 {
582 date .tl_set:N = \l_@@_cover_date_tl,
583 headerImage .tl_set:N = \l_bit_coverheaderimage_tl,
584 xiheiFont .tl_set:N = \l_@@_cover_xihei_font_path_tl,
585 xiheiFont .default:n = {STXihei},
586 %% cover entry
587 delimiter .tl_set:N = \l_@@_cover_delimiter_tl,
588 labelAlign .tl_set:N = \l_@@_cover_label_align_tl,
589 labelAlign .initial:n = {r},
590 valueAlign .tl_set:N = \l_@@_cover_value_align_tl,
591 valueAlign .initial:n = {c},
592 labelMaxWidth .dim_set:N = \l_@@_cover_label_max_width_dim,
593 valueMaxWidth .dim_set:N = \l_@@_cover_value_max_width_dim,
594 autoWidthPadding .dim_set:N = \l_@@_cover_auto_width_padding_dim,
595 autoWidthPadding .initial:n = {0.25em},
596 autoWidth .bool_set:N = \l_@@_cover_auto_width_bool,
597 autoWidth .initial:n = {true},
598 underlineThickness .dim_set:N = \l_@@_cover_underline_thickness_dim,
599 underlineThickness .initial:n = {1pt},
600 underlineOffset .dim_set:N = \l_@@_cover_underline_offset_dim,
601 underlineOffset .initial:n = { -10pt },
602 hideCoverInPeerReview .bool_set:N = \l_@@_cover_hide_cover_in_peer_review_bool,
603 % 此处暂且填充默认值为`false`,待确定`\g_@@_thesis_type_int`后再根据论文类型覆盖默认值
604 hideCoverInPeerReview .initial:n = {false},
605 % 研究生的「特殊类型」
606 showSpecialTypeBox .bool_set:N = \l_@@_cover_show_special_type_box_bool,
607 showSpecialTypeBox .initial:n = {true},
608 % 本科英文模板也可以使用中文封面
609 prefer-zh .bool_set:N = \l_@@_cover_prefer_zh_bool,
610 prefer-zh .initial:n = {false},
611 % 本科英文模板使用中文封面时可能需要调换中英文标题顺序
612 reverse-titles .bool_set:N = \l_@@_cover_reverse_titles_bool,
613 reverse-titles .initial:n = {false},
614 % 本科英文模板可加入中文标题
615 addTitleZh .bool_set:N = \l_@@_cover_add_titlezh_bool,
616 addTitleZh .initial:n = {true},
617 }
618 % \end{macrocode}
619 %
620 % 定义 |bithesis/info| 键值对类。
621 % \begin{macrocode}
622 % Declare variables used by keys
623 \tl_new:N \l_@@_value_vertical_title_tl
624 \tl_new:N \l_@@_value_classified_level_tl
625 %
626 % Declare keys
627 \keys_define:nn { bithesis / info }
628 {
629 title .tl_set:N = \l_@@_value_title_tl,
630 title .initial:n = {形状记忆聚氨酯的合成及其在织物中的应用(示例)},
631 titleEn .tl_set:N = \l_@@_value_title_en_tl,
632 titleEn .initial:n = {Synthesis~and~Application~on~Texttiles~of~the~Shape~Memory~Polyurethane~(example)},
633 % 因为是覆盖选项,所以不需要设置初始值。
634 verticalTitle .tl_set:N = \l_@@_value_vertical_title_tl,
635 school .tl_set:N = \l_@@_value_school_tl,
636 major .tl_set:N = \l_@@_value_major_tl,
637 class .tl_set:N = \l_@@_value_class_tl,
638 % 课程名称,读书报告使用
639 course .tl_set:N = \l_@@_value_course_tl,
640 author .tl_set:N = \l_@@_value_author_tl,
641 studentId .tl_set:N = \l_@@_value_student_id_tl,
642 % 指导教师
643 supervisor .tl_set:N = \l_@@_value_supervisor_tl,
644 % 因为默认不显示,所以不需要设置初始值。
645 externalSupervisor .tl_set:N = \l_@@_value_external_supervisor_tl,
646 % 任课教师,读书报告使用
647 teacher .tl_set:N = \l_@@_value_teacher_tl,
648 % 上课学期,读书报告使用
649 semester .tl_set:N = \l_@@_value_semester_tl,
650 keywords .tl_set:N = \l_@@_value_keywords_tl,
651 keywords .initial:n = {聚氨酯;形状记忆;织物(示例)},
652 keywordsEn .tl_set:N = \l_@@_value_keywords_en_tl,
653 keywordsEn .initial:n = {Polyurethane,Shape Memory,Textiles (example)},
654 translationTitle .tl_set:N = \l_@@_value_trans_title_tl,
655 translationOriginTitle .tl_set:N = \l_@@_value_trans_origin_title_tl,
656 % 中图分类号,研究生学位论文使用
657 classification .tl_set:N = \l_@@_value_classification_tl,
658 classification .initial:n = {TQ~028.1(示例)},
659 % UDC 分类号,研究生学位论文使用
660 UDC .tl_set:N = \l_@@_value_udc_tl,
661 UDC .initial:n = {540(示例)},
662 % 学校代码,研究生学位论文使用
663 universityCode .tl_set:N = \l_@@_value_university_code_tl,
664 universityCode .initial:n = {10007},
665 % 学术型/专业型,研究生学位论文使用
666 degreeType .choice:,
667 degreeType .choices:nn = {professional, academic} {
668 \tl_set:Nn \l_@@_value_degree_type_tl {#1}
669 },
670 degreeType .initial:n = academic,
671 chairman .tl_set:N = \l_@@_value_chairman_tl,
672 industrialMentor .tl_set:N = \l_@@_value_industrial_mentor_tl,
673 industrialMentorEn .tl_set:N = \l_@@_value_industrial_mentor_en_tl,
674 degree .tl_set:N = \l_@@_value_degree_tl,
675 degreeEn .tl_set:N = \l_@@_value_degree_en_tl,
676 institute .tl_set:N = \l_@@_value_institute_tl,
677 institute .initial:n = {\tl_use:N \c_@@_label_university_tl},
678 submissionDate .tl_set:N = \l_@@_value_submission_date_tl,
679 authorEn .tl_set:N = \l_@@_value_author_en_tl,
680 schoolEn .tl_set:N = \l_@@_value_school_en_tl,
681 supervisorEn .tl_set:N = \l_@@_value_supervisor_en_tl,
682 chairmanEn .tl_set:N = \l_@@_value_chairman_en_tl,
683 majorEn .tl_set:N = \l_@@_value_major_en_tl,
684 instituteEn .tl_set:N = \l_@@_value_institute_en_tl,
685 instituteEn .initial:n = {\c_@@_label_university_en_tl},
686 submissionDateEn .tl_set:N = \l_@@_value_submission_date_en_tl,
687 % 因为默认不显示,所以不需要设置初始值。
688 classifiedLevel .tl_set:N = \l_@@_value_classified_level_tl,
689 % 学生类型-工程硕博士专项
690 工程硕博士专项 .bool_set:N = \l_@@_value_engineering_special_plan_bool,
691 工程硕博士专项 .initial:n = {false},
692 % 学生类型-交叉研究方向
693 crossResearch .bool_set:N = \l_@@_value_cross_research_bool,
694 crossResearch .initial:n = {false},
695 % 学生类型-政府项目留学生
696 internationalStudentUGP .bool_set:N = \l_@@_value_international_student_ugp_bool,
697 internationalStudentUGP .initial:n = {false},
698 }
699 % \end{macrocode}
700 %
701 % 定义 |bithesis/misc| 键值对类。
702 % \begin{macrocode}
703 \keys_define:nn { bithesis / misc }
704 {
705 % 表格字体大小,默认为 5 号字体。
706 tabularFontSize .tl_set:N = \l_@@_misc_tabular_font_size_tl,
707 tabularFontSize .initial:n = {5},
708 arialFont .tl_set:N = \l_@@_misc_arial_font_path_tl,
709 autoref / algo .tl_set:N = \l_@@_misc_autoref_algo_tl,
710 autoref / algo .initial:n = {\g_@@_const_autoref_algo_tl},
711 autoref / them .tl_set:N = \themautorefname,
712 autoref / them .initial:n = {\g_@@_const_autoref_them_tl},
713 autoref / lem .tl_set:N = \lemautorefname,
714 autoref / lem .initial:n = {\g_@@_const_autoref_lem_tl},
715 autoref / prop .tl_set:N = \propautorefname,
716 autoref / prop .initial:n = {\g_@@_const_autoref_prop_tl},
717 autoref / cor .tl_set:N = \corautorefname,
718 autoref / cor .initial:n = {\g_@@_const_autoref_cor_tl},
719 autoref / axi .tl_set:N = \axiautorefname,
720 autoref / axi .initial:n = {\g_@@_const_autoref_axi_tl},
721 autoref / defn .tl_set:N = \defnautorefname,
722 autoref / defn .initial:n = {\g_@@_const_autoref_defn_tl},
723 autoref / conj .tl_set:N = \conjautorefname,
724 autoref / conj .initial:n = {\g_@@_const_autoref_conj_tl},
725 autoref / exmp .tl_set:N = \exmpautorefname,
726 autoref / exmp .initial:n = {\g_@@_const_autoref_exmp_tl},
727 autoref / case .tl_set:N = \caseautorefname,
728 autoref / case .initial:n = {\g_@@_const_autoref_case_tl},
729 autoref / rem .tl_set:N = \remautorefname,
730 autoref / rem .initial:n = {\g_@@_const_autoref_rem_tl},
731 hideLinks .bool_set:N = \l_@@_misc_hide_links_bool,
732 hideLinks .initial:n = {true},
733 autoref / figure .tl_set:N = \figureautorefname,
734 autoref / figure .initial:n = {\g_@@_const_autoref_fig_tl},
735 autoref / table .tl_set:N = \tableautorefname,
736 autoref / table .initial:n = {\g_@@_const_autoref_tab_tl},
737 autoref / equ .tl_set:N = \equationautorefname,
738 autoref / equ .initial:n = {\g_@@_const_autoref_equ_tl},
739 % 浮动体相关的各种间距
740 floatSeparation .tl_set:N = \l_@@_misc_float_separation_tl,
741 floatSeparation .initial:n = {0},
742 algorithmSeparation .tl_set:N = \l_@@_misc_algorithm_separation_tl,
743 algorithmSeparation .initial:n = {12pt plus 4pt minus 4pt},
744 tabularRowSeparation .tl_set:N = \l_@@_misc_tabular_row_separation_tl,
745 tabularRowSeparation .initial:n = {1},
746 }
747 % \end{macrocode}
748 %
749 % 定义 |bithesis/const| 键值对类。
750 % \begin{macrocode}
751 \keys_define:nn { bithesis / const }
752 {
753 autoref .meta:nn = { bithesis / const / autoref } { #1 },
754 style .meta:nn = { bithesis / const / style } { #1 },
755 info .meta:nn = { bithesis / const / info } { #1 },
756 heading .meta:nn = { bithesis / const / heading } { #1 },
757 }
758 \keys_define:nn { bithesis / const / autoref }
759 {
760 algo .tl_set:N = \g_@@_const_autoref_algo_tl,
761 algo .initial:n = {\@@_get_const:n {algo}},
762 them .tl_set:N = \g_@@_const_autoref_them_tl,
763 them .initial:n = {\@@_get_const:n {them}},
764 lem .tl_set:N = \g_@@_const_autoref_lem_tl,
765 lem .initial:n = {\@@_get_const:n {lem}},
766 prop .tl_set:N = \g_@@_const_autoref_prop_tl,
767 prop .initial:n = {\@@_get_const:n {prop}},
768 cor .tl_set:N = \g_@@_const_autoref_cor_tl,
769 cor .initial:n = {\@@_get_const:n {cor}},
770 axi .tl_set:N = \g_@@_const_autoref_axi_tl,
771 axi .initial:n = {\@@_get_const:n {axi}},
772 defn .tl_set:N = \g_@@_const_autoref_defn_tl,
773 defn .initial:n = {\@@_get_const:n {defn}},
774 conj .tl_set:N = \g_@@_const_autoref_conj_tl,
775 conj .initial:n = {\@@_get_const:n {conj}},
776 exmp .tl_set:N = \g_@@_const_autoref_exmp_tl,
777 exmp .initial:n = {\@@_get_const:n {exmp}},
778 case .tl_set:N = \g_@@_const_autoref_case_tl,
779 case .initial:n = {\@@_get_const:n {case}},
780 rem .tl_set:N = \g_@@_const_autoref_rem_tl,
781 rem .initial:n = {\@@_get_const:n {rem}},
782 figure .tl_set:N = \g_@@_const_autoref_fig_tl,
783 figure .initial:n = {\@@_get_const:n {fig}},
784 table .tl_set:N = \g_@@_const_autoref_tab_tl,
785 table .initial:n = {\@@_get_const:n {tab}},
786 equ .tl_set:N = \g_@@_const_autoref_equ_tl,
787 equ .initial:n = {\@@_get_const:n {equ}},
788 }
789 \keys_define:nn { bithesis / const / style }
790 {
791 substituteSymbol .tl_set:N = \g_@@_const_substitute_symbol_tl,
792 substituteSymbol .initial:n = {*},
793 }
794 \keys_define:nn { bithesis / const / info }
795 {
796 degree .tl_set:N = \g_@@_const_info_degree_tl,
797 degree .initial:n = {\c_@@_auto_tl},
798 major .tl_set:N = \g_@@_const_info_major_tl,
799 major .initial:n = {\c_@@_auto_tl},
800 }
801 \keys_define:nn { bithesis / const / heading }
802 {
803 acknowledgements .tl_set:N = \g_@@_const_heading_acknowledgements_tl,
804 acknowledgements .initial:n = {
805 \@@_get_const:n {ack}
806 },
807 }
808 % \end{macrocode}
809 %
810 % 定义 |bithesis/style| 键值对类。
811 % \begin{macrocode}
812 % Declare variables used by keys
813 \tl_new:N \l_@@_style_head_tl
814 %
815 % Declare keys
816 \keys_define:nn { bithesis / style }
817 {
818 head .tl_set:N = \l_@@_style_head_tl,
819 head .initial:n = {
820 \clist_item:Nn \c_@@_bachelor_thesis_header_clist \g_@@_thesis_type_int
821 },
822 headline .tl_set:N = \l_@@_style_headline_tl,
823 headline .initial:n = {
824 \clist_item:Nn \c_@@_bachelor_thesis_headline_clist \g_@@_thesis_type_int
825 },
826 bibliographyIndent .bool_set:N = \l_@@_style_bibliography_indent_bool,
827 bibliographyIndent .initial:n = {true},
828 pageVerticalAlign .choices:nn = {top, scattered} {
829 \tl_if_eq:NnTF \l_keys_choice_tl {top}
830 { \raggedbottom }
831 { \flushbottom }
832 },
833 pageVerticalAlign .initial:n = {top},
834 non-CJK-font-in-headings .choice:,
835 non-CJK-font-in-headings / serif .code:n = { \bool_set_false:N \l_@@_arial_as_title_font_bool },
836 non-CJK-font-in-headings / sans .code:n = { \bool_set_true:N \l_@@_arial_as_title_font_bool },
837 non-CJK-font-in-headings .initial:n = {serif},
838 % 数学字体配置
839 mathFont .choices:nn = {
840 asana, bonum, cm, concrete, dejavu, erewhon, euler,
841 fira, garamond, gfsneohellenic, kp, libertinus, lm, newcm,
842 pagella, schola, stix, stix2, termes, xcharter, xits, none,
843 } { \tl_set_eq:NN \l_@@_style_math_font_tl \l_keys_choice_tl },
844 mathFont .initial:n = {cm},
845 % Options that will be pass to `unicode-math` pkgs.
846 unicodeMathOptions .tl_set:N = \l_@@_unicode_math_options_tl,
847 % Windows 平台开启宋体伪粗体。
848 windowsSimSunFakeBold .bool_set:N = \l_@@_style_windows_simsum_fake_bold,
849 windowsSimSunFakeBold .initial:n = {false},
850 % 控制英文是否使用 hyphen 进行换行
851 hyphen .bool_set:N = \l_@@_style_hyphen_bool,
852 hyphen .initial:n = {true},
853 % 控制公式和上下文的距离
854 mathAboveDisplaySkip .dim_set:N = \l_@@_style_math_above_display_skip_dim,
855 mathAboveDisplaySkip .initial:n = {10pt},
856 mathBelowDisplaySkip .dim_set:N = \l_@@_style_math_below_display_skip_dim,
857 mathBelowDisplaySkip .initial:n = {10pt},
858 betterTimesNewRoman .bool_set:N = \l_@@_style_better_new_roman_bool,
859 betterTimesNewRoman .initial:n = {false},
860 }
861 % \end{macrocode}
862 %
863 % 定义 |bithesis/TOC| 键值对类。
864 % \begin{macrocode}
865 \keys_define:nn { bithesis / TOC }
866 {
867 title .tl_set:N = \l_@@_toc_title_tl,
868 title .initial:n = {
869 \@@_if_thesis_english:TF {
870 Table~of~Contents
871 } {
872 \@@_if_graduate:TF {目次} {目\@@_label_space: 录}
873 }
874 },
875 abstract .bool_set:N = \l_@@_add_abstract_to_toc_bool,
876 abstract .initial:n = {true},
877 abstractEn .bool_set:N = \l_@@_add_abstract_en_to_toc_bool,
878 abstractEn .initial:n = {true},
879 TOC .bool_set:N = \l_@@_add_toc_to_toc_bool,
880 TOC .initial:n = {false},
881 symbols .bool_set:N = \l_@@_add_symbols_to_toc_bool,
882 symbols .initial:n = {true},
883 }
884 % \end{macrocode}
885 %
886 % 定义 |bithesis/appendices| 键值对类。
887 % \begin{macrocode}
888 % Declare variables used by keys
889 \tl_new:N \l_@@_appendices_title_tl
890 \tl_new:N \l_@@_appendix_toc_title_tl
891 %
892 % Declare keys
893 \keys_define:nn { bithesis / appendices }
894 {
895 chapterLevel .bool_set:N = \l_@@_appendices_chapter_level_bool,
896 title .tl_set:N = \l_@@_appendices_title_tl,
897 TOCTitle .tl_set:N = \l_@@_appendix_toc_title_tl,
898 }
899 % \end{macrocode}
900 %
901 % 定义 |bithesis/publications| 键值对类。
902 % \begin{macrocode}
903 \keys_define:nn { bithesis / publications }
904 {
905 sorting .bool_set:N = \l_@@_publications_sorting_bool,
906 sorting .initial:n = {true},
907 omit .bool_set:N = \l_@@_publications_omit_bool,
908 omit .initial:n = {false},
909 maxbibnames .int_set:N = \l_@@_publications_maxbibnames_int,
910 maxbibnames .initial:n = {10},
911 minbibnames .int_set:N = \l_@@_publications_minbibnames_int,
912 minbibnames .initial:n = {10},
913 }
914 % \end{macrocode}
915 %
916 % 定义 |bithesis/acknowledgements| 键值对类。
917 % \begin{macrocode}
918 \keys_define:nn { bithesis / acknowledgements }
919 {
920 showTitleInPeerReview .bool_set:N = \l_@@_acknowledgements_show_title_in_peer_review_bool,
921 % 此处暂且填充默认值为`false`,待确定`\g_@@_thesis_type_int`后再根据论文类型覆盖默认值
922 showTitleInPeerReview .initial:n = {false},
923 }
924 % \end{macrocode}
925 %
926 % \subsubsection{内部 l3keys 接口键值对定义}
927 %
928 % 除了 |\BITSetup|,有些用户接口也是键值对,在此通过 |bithesis-internal| 实现。
929 % 约定它只用于内部解析用户命令传入的参数,不直接面向最终作者,而且每个用户命令都不记忆之前设置的值。
930 % 此处只定义数据结构,默认值等逻辑由各命令自行处理。
931 %
932 % 定义 |bithesis-internal / pre-frontmatter|,用于设置 |\frontmatter| 之前的 |\MakeCover|、|\MakeTitle| 等。
933 % 目前这些部分的接口相同,故共用 |pre-frontmatter|。
934 % \begin{macrocode}
935 \keys_define:nn { bithesis-internal / pre-frontmatter }
936 {
937 % 是否将标题加入PDF书签
938 bookmarked .bool_set:N = \l_@@_internal__pre_frontmatter__bookmarked_bool,
939 }
940 % \end{macrocode}
941 %
942 % 定义 |bithesis-internal / conclusion|,用于设置 |conclusion| 环境。
943 % \begin{macrocode}
944 \keys_define:nn { bithesis-internal / conclusion }
945 {
946 title .tl_set:N = \l_@@_internal__conclusion__title_tl,
947 }
948 % \end{macrocode}
949 %
950 %
951 % \subsubsection{BITSetup l3keys 接口键值对预处理}
952 %
953 % 在宏加载时,处理 |bithesis/option| 中的值。使得 |bithesis|
954 % 宏包的模板选项可以在宏加载时生效。
955 % \begin{macrocode}
956 \ProcessKeysOptions { bithesis / option }
957 % \end{macrocode}
958 %
959 % 确定 |bithesis/option| 中的 |\g_@@_thesis_type_int| 后,根据论文类型自动覆盖某些选项的默认值。
960 % \begin{macrocode}
961 \@@_if_graduate:TF {
962 \keys_set:nn {bithesis} {
963 cover / hideCoverInPeerReview = false,
964 acknowledgements / showTitleInPeerReview = true,
965 }
966 } {
967 \keys_set:nn {bithesis} {
968 cover / hideCoverInPeerReview = true,
969 acknowledgements / showTitleInPeerReview = false,
970 }
971 }
972 % \end{macrocode}
973 %
974 % \begin{macro}{\@@_resolve_auto_values:}
975 % 计算 auto 并替换为标准的值
976 % \begin{macrocode}
977 \cs_new:Npn \@@_resolve_auto_values: {
978 \tl_if_eq:NnT \g_@@_const_info_degree_tl {\c_@@_auto_tl} {
979 \tl_if_eq:NnTF \l_@@_value_degree_type_tl {academic} {
980 \keys_set:nn {bithesis} {const/info/degree = \c_@@_graduate_label_degree_tl}
981 } {
982 \keys_set:nn {bithesis} {const/info/degree = 申\quad 请\quad 类\quad 别}
983 }
984 }
985 \tl_if_eq:NnT \g_@@_const_info_major_tl {\c_@@_auto_tl} {
986 \@@_if_graduate:TF {
987 \tl_if_eq:NnTF \l_@@_value_degree_type_tl {academic} {
988 \keys_set:nn {bithesis} {const/info/major = \c_@@_graduate_label_major_tl}
989 } {
990 \keys_set:nn {bithesis} {const/info/major = 学\quad 位\quad 领\quad 域}
991 }
992 } {
993 \keys_set:nn {bithesis} {const/info/major = \@@_get_const:n {major}}
994 }
995 }
996 }
997 % \end{macrocode}
998 % \end{macro}
999 %
1000 % \subsubsection{应用模板选项}
1001 %
1002 % 英文模板需要开启 ctexbook 宏包的英文选项。
1003 % \begin{macrocode}
1004 \@@_if_thesis_english:T {
1005 \PassOptionsToClass{scheme=plain}{ctexbook}
1006 }
1007 % \end{macrocode}
1008 % 如果设置 blindPeerReview 选项,则抑制 twoside 选项。
1009 % \begin{macrocode}
1010 \bool_if:NT \g_@@_blind_mode_bool {
1011 \bool_set_false:N \g_@@_twoside_bool
1012 }
1013 % \end{macrocode}
1014 %
1015 % 如果没有开启双面打印选项,则在 ctexbook 中开启单面打印选项。
1016 % 允许 chapter 直接另起一页(即使是偶数(左手)页)。
1017 % \begin{macrocode}
1018 \bool_if:NTF \g_@@_twoside_bool {} {
1019 \PassOptionsToClass{oneside}{ctexbook}
1020 }
1021 \PassOptionsToClass{openany}{ctexbook}
1022 % \end{macrocode}
1023 %
1024 % 将 |bithesis/option/ctex| 中的值传递给 ctexbook 模板类。
1025 % \begin{macrocode}
1026 % Any extra option passed by user will be passed to ctexbook.
1027 \DeclareOption*{
1028 \PassOptionsToClass{\l_@@_options_to_ctex_tl}{ctexbook}
1029 }
1030 % \end{macrocode}
1031 %
1032 % 抑制 fontspec 宏包关于字体的警告信息。
1033 % 手动开启伪粗体、伪斜体。
1034 % \begin{macrocode}
1035 \PassOptionsToPackage{quiet,AutoFakeBold=\g_@@_auto_fake_bold_tl,AutoFakeSlant}{xeCJK}
1036 % \end{macrocode}
1037 % 加载 ctexbook 模板类。
1038 % \begin{macrocode}
1039 \ProcessOptions\relax
1040 \LoadClass[zihao=-4,]{ctexbook}
1041 % \end{macrocode}
1042 %
1043 % \subsubsection{定义模板类样式}
1044 %
1045 % 加载所需的宏包。
1046 %
1047 % 在加载宏包之前,尽量不使用 AtBeginDocument 等 hook。
1048 % 因为 listings 等宏包也会用这些 hook。若在加载它们之前使用 hook,会导致我们所有 hook 在这些宏包“之前”运行。
1049 %
1050 % \begin{macrocode}
1051 \RequirePackage{geometry}
1052 \RequirePackage[table,xcdraw]{xcolor}
1053 % 恢复数学行距(restoremathleading),同时避免改变正文行距。
1054 % (ctex 默认 linespread 1.3 × LaTeX 默认倍数 1.2 = 1.56)
1055 \RequirePackage[bodytextleadingratio=1.56]{zhlineskip}
1056 \RequirePackage{titletoc}
1057 \RequirePackage{graphicx}
1058 \RequirePackage{fancyhdr}
1059 \RequirePackage[nodisplayskipstretch]{setspace}
1060 \RequirePackage{booktabs}
1061 \RequirePackage{multirow}
1062 \RequirePackage{tikz}
1063 \RequirePackage{etoolbox}
1064 % Hide color and border in hyperref.
1065 \RequirePackage[bookmarksnumbered]{hyperref}
1066 % 详见 `caption` 宏包手册和
1067 % https://github.com/CTeX-org/forum/issues/86
1068 \RequirePackage[strut=off]{caption}
1069 \RequirePackage{array}
1070 \RequirePackage{amsmath}
1071 \RequirePackage{amssymb}
1072 \RequirePackage{pifont}
1073 \RequirePackage{amsthm}
1074 \RequirePackage{pdfpages}
1075 \RequirePackage{listings}
1076 \RequirePackage{enumitem}
1077 \RequirePackage{fmtcount}
1078 % \end{macrocode}
1079 %
1080 % 抑制 \pkg{hyperref} 中对 |\hskip| 的 warning 信息。
1081 % \begin{macrocode}
1082 \pdfstringdefDisableCommands{%
1083 \let\quad\empty
1084 }
1085 % \end{macrocode}
1086 %
1087 % 设置页眉字号,页边距。
1088 %
1089 % 需要注意的是,根据 \pkg{geometry} 的规则,
1090 % |headsep| 和 |footskip| 分别受到 |top| 与 |bottom| 的影响。
1091 % 所以你能看到在计算 |headsep| 与 |footskip| 时,我们
1092 % 首先计算了相应的偏移量。
1093 % \begin{macrocode}
1094 \@@_if_graduate:TF {
1095 \int_gset:Nn \g_@@_head_zihao_int {5}
1096 \geometry{
1097 a4paper,
1098 left=2.7cm,
1099 bottom=2.5cm + 7bp,
1100 top=3.5cm + 7bp,
1101 right=2.7cm,
1102 % `headsep' is affected by `top' option.
1103 headsep = 3.5cm + 7bp - 2.5cm - 15bp,
1104 headheight = 15 bp,
1105 % `footskip' is affected by `bottom' option.
1106 footskip = 2.5cm + 7bp - 1.8cm,
1107 }
1108 } {
1109 \int_gset:Nn \g_@@_head_zihao_int {4}
1110 \geometry{
1111 a4paper,
1112 left=3cm,
1113 bottom=2.6cm + 7bp,
1114 top=3.5cm + 7bp,
1115 right=2.6cm,
1116 % `headsep' is affected by `top' option.
1117 headsep = 3.5cm + 7bp - 2.4cm - 20bp,
1118 headheight = 20 bp,
1119 % `footskip' is affected by `bottom' option.
1120 footskip = 2.6cm + 7bp - 2cm,
1121 }
1122 }
1123 % \end{macrocode}
1124 %
1125 % \subsubsection{定义字体相关选项}
1126 %
1127 % 设置 Times New Roman 字体。
1128 % 根据学校规范要求,默认情况下也使用 Times New Roman 字体。
1129 % \begin{macrocode}
1130 \ctex_at_end_preamble:n {
1131 \bool_if:NTF \l_@@_style_better_new_roman_bool {
1132 \defaultfontfeatures[TeX~Gyre~Termes]
1133 {
1134 Extension = .otf ,
1135 UprightFont = texgyretermes-regular,
1136 BoldFont = texgyretermes-bold,
1137 ItalicFont = texgyretermes-italic,
1138 BoldItalicFont = texgyretermes-bolditalic,
1139 }
1140 \setmainfont{TeX~Gyre~Termes}
1141 }{
1142 \setmainfont{Times~New~Roman}
1143 \setromanfont{Times~New~Roman}
1144 }
1145 }
1146 % \end{macrocode}
1147 %
1148 % \begin{macro}{\@@_load_unicode_math_pkg:}
1149 % 加载\pkg{unicode-math}宏包。
1150 % \begin{macrocode}
1151 \cs_new:Npn \@@_load_unicode_math_pkg:
1152 {
1153 \PassOptionsToPackage { \l_@@_unicode_math_options_tl } { unicode-math }
1154 \RequirePackage { unicode-math }
1155 }
1156 % \end{macrocode}
1157 % \end{macro}
1158 %
1159 % \begin{macro}{\@@_define_math_font:nn}
1160 % 批量定义数学字体配置。
1161 % \begin{arguments}
1162 % \item 配置名称。
1163 % \item 字体名称。
1164 % \end{arguments}
1165 % \begin{macrocode}
1166 \cs_new:Npn \@@_define_math_font:nn #1#2
1167 {
1168 \cs_new:cpn { @@_load_math_font_ #1 : }
1169 {
1170 \@@_load_unicode_math_pkg:
1171 \setmathfont { #2 }
1172 }
1173 }
1174 \clist_map_inline:nn
1175 {
1176 { asana } { Asana-Math.otf },
1177 { concrete } { Concrete-Math.otf },
1178 { erewhon } { Erewhon-Math.otf },
1179 { euler } { Euler-Math.otf },
1180 { fira } { FiraMath-Regular.otf },
1181 { garamond } { Garamond-Math.otf },
1182 { gfsneohellenic } { GFSNeohellenicMath.otf },
1183 { kp } { KpMath-Regular.otf },
1184 { libertinus } { LibertinusMath-Regular.otf },
1185 { lm } { latinmodern-math.otf },
1186 { newcm } { NewCMMath-Regular.otf },
1187 { stix } { STIXMath-Regular.otf },
1188 { stix2 } { STIXTwoMath-Regular.otf },
1189 { xcharter } { XCharter-Math.otf },
1190 { xits } { XITSMath-Regular.otf },
1191 { bonum } { texgyrebonum-math.otf },
1192 { dejavu } { texgyredejavu-math.otf },
1193 { pagella } { texgyrepagella-math.otf },
1194 { schola } { texgyreschola-math.otf },
1195 { termes } { texgyretermes-math.otf }
1196 }
1197 { \@@_define_math_font:nn #1 }
1198 % \end{macrocode}
1199 % \end{macro}
1200 %
1201 % \begin{macro}{\@@_load_math_font_cm:}
1202 % 数学字体配置 |cm|。
1203 % \begin{macrocode}
1204 \cs_new:Npn \@@_load_math_font_cm: { }
1205 % \end{macrocode}
1206 % \end{macro}
1207 %
1208 % \begin{macro}{\@@_load_math_font_none:}
1209 % 数学字体配置 |none|。
1210 % \begin{macrocode}
1211 \cs_new:Npn \@@_load_math_font_none: { }
1212 % \end{macrocode}
1213 % \end{macro}
1214 %
1215 % \begin{macro}{\@@_load_font:}
1216 % 加载数学字体
1217 % \begin{macrocode}
1218 \cs_new:Npn \@@_load_font:
1219 {
1220 \use:c { @@_load_math_font_ \l_@@_style_math_font_tl : }
1221 }
1222 % \end{macrocode}
1223 % \end{macro}
1224 %
1225 % \paragraph{定义导言区末尾加载内容}
1226 %
1227 % 在 |preamble| 中,加载各个模板需要的字体。
1228 % \begin{macrocode}
1229 \ctex_at_end_preamble:n {
1230 % 针对 Windows 字体采用 Fake Bold 宋体
1231 \bool_if:NT \l_@@_style_windows_simsum_fake_bold
1232 {
1233 \RequirePackage{ifplatform}
1234 \ifwindows
1235 \setCJKmainfont{SimSun}[AutoFakeBold,AutoFakeSlant]
1236 \fi
1237 }
1238
1239 % 在导言区末尾加载数学字体。
1240 \@@_load_font:
1241
1242 % misc / hideLinks 选项
1243 \bool_if:NTF \l_@@_misc_hide_links_bool
1244 {
1245 \hypersetup { hidelinks }
1246 } {
1247 \definecolor{blue}{RGB}{10,10,110}
1248 \hypersetup{
1249 colorlinks=true,
1250 }
1251 }
1252
1253 \bool_if:NTF \l_@@_arial_as_title_font_bool {
1254 % 手动指定时要加载 Arial
1255 \newfontfamily\arialfamily{Arial}
1256 } {
1257 % 即使未指定,本科全英文专业模板的声明也需要 Arial
1258 \@@_if_thesis_int_type:nT {3} {
1259 \newfontfamily\arialfamily{Arial}
1260 }
1261 }
1262 % 无论中英文,封面都可能需要细黑体。
1263 \tl_if_blank:VTF \l_@@_cover_xihei_font_path_tl {}
1264 {
1265 \setCJKfamilyfont{xihei}[AutoFakeBold,AutoFakeSlant]
1266 {\l_@@_cover_xihei_font_path_tl}
1267 }
1268
1269 % 对于本科全英文专业模板,需要自定义日期格式。
1270 \@@_if_thesis_int_type:nT {3} {
1271 \RequirePackage[en-US]{datetime2}
1272 \RequirePackage{indentfirst}
1273 \DTMlangsetup[en-US]{dayyearsep={\space}}
1274 }
1275
1276 % Define biblatex category if it was imported.
1277 % 这部分是给研究生模板中的
1278 % 「攻读学位期间发表论文与研究成果清单」使用的。
1279 \cs_if_exist:NT \DeclareBibliographyCategory {
1280 \DeclareBibliographyCategory{mypub}
1281 }
1282
1283 % Define biblatex strings if it was imported.
1284 % 这部分是给研究生模板中的
1285 % gbpunctin = false 时使用的。
1286 \cs_if_exist:NT \DefineBibliographyStrings {
1287 \DefineBibliographyStrings{english}{in={}}
1288 \DefineBibliographyStrings{english}{incn={}}
1289 }
1290
1291 % 修改 biblatex 中「专利」(patent)部分的著录格式。
1292 % 主要根据北理工自定义的规范,参考 biblatex 和
1293 % biblatex-gb7714-2015 的实现修改而成。
1294 %
1295 % 默认不开启,因为此修改可能会产生其他边界问题。
1296 \bool_if:NT \g_@@_quirks_mode_bool {
1297 \cs_if_exist:NT \DeclareBibliographyDriver {
1298 %
1299 % 重设专利title的输出,将文献类型标识符输出出去
1300 %
1301 \newbibmacro*{patenttitle}{%原输出来自biblatex.def文件
1302 \ifboolexpr{%
1303 test{\iffieldundef{title}}%
1304 and%
1305 test{\iffieldundef{subtitle}}%
1306 }%
1307 {}%
1308 {\printtext[title]{\bibtitlefont%
1309 \printfield[titlecase]{title}%
1310 \ifboolexpr{test {\iffieldundef{subtitle}}}%这里增加了对子标题的判断,解决不判断多一个点的问题
1311 {}{\setunit{\subtitlepunct}%
1312 \printfield[titlecase]{subtitle}}%
1313 \iftoggle{bbx:gbtype}{\printfield[gbtypeflag]{usera}}{}%
1314 \iffieldundef{titleaddon}{}%判断一下titleaddon,否则直接加可能多一个空格
1315 {\setunit{\subtitlepunct}\printfield{titleaddon}}%
1316 % :地区
1317 \setunit{\subtitlepunct}\iflistundef{location}
1318 {}
1319 {\setunit*{\subtitlepunct}%
1320 \printtext{%[parens]
1321 \printlist[][-\value{listtotal}]{location}}}%
1322 % ,专利号
1323 \setunit{\addcomma\addspace}\printfield{number}%写专利号
1324 \setunit{\addcomma\addspace}
1325 \usebibmacro{newsdate}%
1326 }%
1327 }%
1328 }
1329
1330 %
1331 % 重定义专利文献驱动
1332 %
1333 \DeclareBibliographyDriver{patent}{%源来自standard.BBX
1334 \usebibmacro{bibindex}%
1335 \usebibmacro{begentry}%
1336 \usebibmacro{author}%
1337 \ifnameundef{author}{}{\setunit{\labelnamepunct}\newblock}%这一段用于去除作者不存在时多出的标点
1338 \usebibmacro{patenttitle}%给出专利专用的标题输出
1339 \iftoggle{bbx:gbstrict}{}{%
1340 \newunit%
1341 \printlist{language}%
1342 \newunit\newblock
1343 \usebibmacro{byauthor}
1344 }%
1345 \newunit\newblock
1346 \printfield{type}%
1347 \setunit*{\addspace}%
1348 \newunit\newblock
1349 \usebibmacro{byholder}%
1350 \newunit\newblock
1351 \printfield{note}%
1352 \newunit\newblock
1353 \usebibmacro{doi+eprint+url}%
1354 \newunit\newblock
1355 \usebibmacro{addendum+pubstate}%
1356 \setunit{\bibpagerefpunct}\newblock
1357 \usebibmacro{pageref}%
1358 \newunit\newblock
1359 \iftoggle{bbx:related}
1360 {\usebibmacro{related:init}%
1361 \usebibmacro{related}}
1362 {}%
1363 \usebibmacro{annotation}\usebibmacro{finentry}}
1364 }
1365 }
1366 }
1367 % \end{macrocode}
1368 %
1369 % \begin{macro}{\@@_xihei:n}
1370 % 定义华文细黑字体,采用 |cover/xiheiFont| 指定的字体文件。
1371 % 为兼容旧版,XeLaTeX 上未指定字体文件时,会回退到中易字库的黑体。
1372 % \begin{macrocode}
1373 \cs_new:Npn \@@_xihei:n #1 {
1374 \sys_if_engine_xetex:TF {
1375 \xeCJK_family_if_exist:nTF {xihei} {
1376 \CJKfamily{xihei} #1
1377 }{
1378 \heiti #1
1379 }
1380 } {
1381 \CJKfamily{xihei} #1
1382 }
1383 }
1384 % \end{macrocode}
1385 % \end{macro}
1386 %
1387 % \begin{macro}{\@@_title_font:}
1388 % 定义标题字体。
1389 % \begin{macrocode}
1390 \cs_new:Npn \@@_title_font: {
1391 \bool_if:NTF \l_@@_arial_as_title_font_bool {
1392 % 即使是英文模板,仍可能出现中文,也需设置中文字体。
1393 \heiti\arialfamily
1394 } {
1395 % 西文保持原本的 Times New Roman。黑体一般不搭配衬线体,但学校要求如此。
1396 \heiti
1397 }
1398 }
1399 % \end{macrocode}
1400 % \end{macro}
1401 %
1402 % \begin{macro}{\@@_unnumchapter_style:}
1403 % 定义无序章节的样式。
1404 % \begin{macrocode}
1405 \cs_new:Npn \@@_unnumchapter_style: {
1406 % 本科全英文、研究生学位论文需要加粗
1407 \int_compare:nNnTF {\g_@@_thesis_type_int} > {2} {
1408 \bfseries
1409 } {
1410 \mdseries
1411 }
1412 }
1413 % \end{macrocode}
1414 % \end{macro}
1415 %
1416 % \begin{macro}{\arabicHeiti}
1417 % 遗留下来的黑体字体定义。
1418 % \begin{macrocode}
1419 \cs_set:Npn \arabicHeiti #1 {#1}
1420 % \end{macrocode}
1421 % \end{macro}
1422 %
1423 % 定义 \pkg{fancyhdr} 的页眉页脚。
1424 % \begin{macrocode}
1425 \fancypagestyle{BIThesis}{
1426 \fancyhf{}
1427 % 此处按 N 判断是因为 style/head 可能填写 \LaTeX 这样的宏,不能随便按 e/x 展开;模板默认值虽需展开才能判断,但部分非空,所以不展开亦可。
1428 \tl_if_empty:NTF \l_@@_style_head_tl {
1429 % 若 style/head 为空,则不仅页眉文字为空,页眉线也应删除
1430 \renewcommand{\headrulewidth}{0pt}
1431 } {
1432 % 定义页眉(模板默认)
1433 \fancyhead[C]{
1434 \zihao{\int_use:N \g_@@_head_zihao_int}
1435 \ziju{0.08}\songti
1436 \tl_use:N \l_@@_style_head_tl
1437 }
1438 % 页眉分割线稍微粗一些
1439 \renewcommand{\headrulewidth}{0.6pt}
1440 }
1441 % 定义页码
1442 \fancyfoot[C]{\songti\zihao{5} \thepage}
1443 }
1444 % \end{macrocode}
1445 %
1446 % 定义 \pkg{ctex} 的章节标题形式。
1447 % \begin{macrocode}
1448 \ctexset{chapter={
1449 number = {\arabicHeiti{ \arabic{chapter} }},
1450 % 对于硕博模板,此处样式会被 \mainmatter 继续修改
1451 format = { \@@_title_font: \bfseries \centering \zihao{3}},
1452 nameformat = {},
1453 titleformat = {},
1454 aftername = \hspace{9bp},
1455 pagestyle = BIThesis,
1456 beforeskip = \@@_if_graduate:TF {13bp} {8bp},
1457 afterskip = \@@_if_graduate:TF {24.5bp} {32bp},
1458 fixskip = true,
1459 lofskip = 0cm,
1460 lotskip = 0cm,
1461 }
1462 }
1463 % 硕博模板于2026年3月将“第1章”改为“1”
1464 \@@_if_graduate:T {
1465 \ctexset{ chapter / name = {} }
1466 }
1467
1468 \ctexset{section={
1469 number = {\arabicHeiti{\thechapter.\hspace{1bp}\arabic{section}}},
1470 format = {\@@_title_font: \raggedright \bfseries \zihao{4}},
1471 nameformat = {},
1472 titleformat = {},
1473 aftername = \hspace{8bp},
1474 beforeskip = \@@_if_graduate:TF {26bp} {20bp},
1475 afterskip = \@@_if_graduate:TF {18bp} {17bp},
1476 fixskip = true,
1477 }
1478 }
1479
1480 \ctexset{subsection={
1481 number = {
1482 \arabicHeiti{
1483 \thechapter.\hspace{1bp}
1484 \arabic{section}.\hspace{1bp}
1485 \arabic{subsection}
1486 }
1487 },
1488 format = {\@@_title_font: \bfseries \raggedright \zihao{-4}},
1489 nameformat = {},
1490 titleformat = {},
1491 aftername = \hspace{7bp},
1492 beforeskip = 17bp,
1493 afterskip = 17bp,
1494 fixskip = true,
1495 }
1496 }
1497
1498 \ctexset{
1499 secnumdepth = 3,
1500 subsubsection={
1501 numbering = true,
1502 number = {
1503 \arabicHeiti{
1504 \arabic{chapter}.\hspace{1bp}
1505 \arabic{section}.\hspace{1bp}
1506 \arabic{subsection}.\hspace{1bp}
1507 \arabic{subsubsection}
1508 }
1509 },
1510 format={\@@_title_font: \raggedright \zihao{-4}},
1511 nameformat = {},
1512 titleformat = {},
1513 beforeskip=14bp,
1514 afterskip=14bp,
1515 fixskip=true,
1516 }
1517 }
1518 % \end{macrocode}
1519 %
1520 % 定义 TOC 样式。
1521 % \begin{macrocode}
1522 \addtocontents{toc}{\protect\hypersetup{hidelinks}}
1523
1524 \@@_if_graduate:TF {
1525 % 对于研究生模板,《撰写规范》要求各级标题字号不同,且缩进 2n 字符。
1526 % 为尽可能视觉对齐,缩进的字宽统一按四号 14pt,页码统一按小四。
1527 % chapter 不缩进,标题四号,页码小四。行距为保持与其它项相同,设定为:原本 baselinestretch 1.56 × 小四 12pt / 四号 14pt = 1.33714 倍。
1528 \titlecontents{chapter}[0pt]{\songti \zihao{4} \linespread{1.33714}\selectfont}
1529 {\thecontentslabel\unskip\hspace{\ccwd}}{}
1530 {\hspace{.5em}\zihao{-4}\titlerule*{.}\contentspage}
1531 % section 缩进两字,全部小四。
1532 \titlecontents{section}[14pt * 2]{\songti \zihao{-4}}
1533 {\thecontentslabel\hspace{\ccwd}}{}
1534 {\hspace{.5em}\titlerule*{.}\contentspage}
1535 % subsection 缩进四字,全部小四。
1536 \titlecontents{subsection}[14pt * 4]{\songti \zihao{-4}}
1537 {\thecontentslabel\hspace{\ccwd}}{}
1538 {\hspace{.5em}\titlerule*{.}\contentspage}
1539 } {
1540 % 对于其他,定义各章标题为宋体小四号。
1541 \titlecontents{chapter}[0pt]{\songti \zihao{-4}}
1542 {\thecontentslabel\unskip\hspace{\ccwd}}{}
1543 {\hspace{.5em}\titlerule*{.}\contentspage}
1544 % section 标题为宋体小四号。
1545 \titlecontents{section}[1\ccwd]{\songti \zihao{-4}}
1546 {\thecontentslabel\hspace{\ccwd}}{}
1547 {\hspace{.5em}\titlerule*{.}\contentspage}
1548 % subsection 标题为宋体小四号。
1549 \titlecontents{subsection}[2\ccwd]{\songti \zihao{-4}}
1550 {\thecontentslabel\hspace{\ccwd}}{}
1551 {\hspace{.5em}\titlerule*{.}\contentspage}
1552 }
1553 % listoffigure 样式优化
1554 \titlecontents{figure}[0pt]{\songti\zihao{-4}}
1555 {\figurename~\thecontentslabel\quad}{\hspace*{-1.5cm}}
1556 {\hspace{.5em}\titlerule*{.}\contentspage}
1557 % listoftable 样式优化
1558 \titlecontents{table}[0pt]{\songti\zihao{-4}}
1559 {\tablename~\thecontentslabel\quad}{\hspace*{-1.5cm}}
1560 {\hspace{.5em}\titlerule*{.}\contentspage}
1561 % \end{macrocode}
1562 %
1563 % \subsubsection{定义样式相关函数}
1564 %
1565 % \begin{macro}{\frontmatter}
1566 % 定义前置内容的页面样式。
1567 % \begin{macrocode}
1568 \RenewDocumentCommand \frontmatter {} {
1569 \pagenumbering{Roman}
1570 % 这部分的章节标题不进行编号。
1571 \ctexset{
1572 chapter = {
1573 numbering = false,
1574 }
1575 }
1576 \linespread{1.53}\selectfont
1577 \pagestyle{BIThesis}
1578
1579 % 调整表格内容字号(默认五号)和各行之间的距离。
1580 %
1581 % 由于这种方式会影响所有的表格,
1582 % 所以我们尽可能延迟这种影响。
1583 %
1584 % 不过,在目前的代码实现中没有在封面
1585 % 之类的地方使用表格,所以目前即使放在
1586 % preamble 中也不会有影响。
1587 %
1588 % 支持标准tabular、tabular*环境和宏包tabularx、longtable。
1589 \clist_map_inline:nn
1590 {tabular, tabular*, tabularx, longtable}
1591 {
1592 \AtBeginEnvironment {##1} {
1593 % 字号只想设置表格内容,不想影响caption。
1594 % 一般caption在环境之外,自然不受影响;
1595 % 而longtable的caption虽在环境内,但caption宏包能正常处理。
1596 \zihao{\l_@@_misc_tabular_font_size_tl}
1597 % 各行间距只想影响表格,不想影响矩阵,因此也必须在钩子中设置。
1598 \cs_set:Npn \arraystretch {\l_@@_misc_tabular_row_separation_tl}
1599 }
1600 }
1601 }
1602 % \end{macrocode}
1603 % \end{macro}
1604 %
1605 % \begin{macro}{\mainmatter}
1606 % 主体内容的页面样式。
1607 % \begin{macrocode}
1608 \RenewDocumentCommand \mainmatter {} {
1609 % 另起一个空页,以便于后续的章节标题编号。
1610 % \clearpage
1611 \cleardoublepage
1612 % 这部分的章节标题进行编号。
1613 \ctexset{
1614 chapter = {
1615 numbering = true,
1616 }
1617 }
1618 % 硕博模板于2026年3月将正文部分的章标题改为顶左,但其它仍居中;本科模板全文样式统一,此处不必继续设置
1619 \@@_if_graduate:T {
1620 \ctexset{
1621 chapter / format+ = { \raggedright}
1622 }
1623 }
1624 % 页码使用阿拉伯数字。
1625 \pagenumbering{arabic}
1626 \pagestyle{BIThesis}
1627 % 正文行距 22 磅,同时略保有弹性以支持 style/pageVerticalAlign = scattered
1628 \setlength{\parskip}{0em plus 0.2em}
1629 \linespread{1.53}\selectfont
1630 % 修复脚注出现跨页的问题
1631 \interfootnotelinepenalty=10000
1632 }
1633 % \end{macrocode}
1634 % \end{macro}
1635 %
1636 % \begin{macro}{\backmatter}
1637 % 后置内容的页面样式。
1638 % \begin{macrocode}
1639 \RenewDocumentCommand \backmatter {} {
1640 % 同样,所有的章节标题不进行编号。
1641 \setcounter{section}{0}
1642 \setcounter{subsection}{0}
1643 \setcounter{subsubsection}{0}
1644 \ctexset{
1645 chapter = {
1646 numbering = false,
1647 beforeskip = 18bp,
1648 format = {
1649 \@@_title_font: \@@_unnumchapter_style: \centering \zihao{3}
1650 },
1651 afterskip = \@@_if_graduate:TF {31bp} {26bp},
1652 }
1653 }
1654 }
1655 % \end{macrocode}
1656 % \end{macro}
1657 %
1658 % 设置图表浮动体与前后正文的间距,以及浮动体内部的图表本体与 caption 的间距。
1659 %
1660 % 此处只满足学校要求;后续`misc/floatSeparation`等设置会在此基础上叠加。
1661 %
1662 % 学校要求:
1663 %
1664 % - 本科生
1665 % - 图表与上下文之间各空一行。
1666 % - 空行一边是 caption,一边是正文,字号不同。空行的字号具体采用哪个没有说明。
1667 % - 研究生
1668 % - 图序、图题、表序、表题单倍行距,段前6磅,段后6磅。
1669 % - 图表本体与正文的间距没有明确规定,不过Word模板实作明显窄于LaTeX默认间距(甚至小于行距),特别是表格。
1670 %
1671 % 这些间距在LaTeX中比较复杂:
1672 %
1673 % - 图表 caption 的布局位置相反,却共用术语
1674 %
1675 % 图自上而下的布局顺序是“正文 → 图本体 → caption → 正文”,而表是“正文 → caption → 表本体 → 正文”。
1676 % 按照图的布局,caption 的 below 指“caption 🡘 正文”距离,above 指“图表本体 🡘 caption”距离。
1677 % 这种 below、above 说法外推到了表的布局,导致表的所谓 below、above 与实际空间关系相反。
1678 % 详见`caption`宏包手册。
1679 %
1680 % - 间距是多个设置之和
1681 %
1682 % 可能涉及以下四类设置。
1683 % 1. 浮动体设置 intextsep、textfloatsep、floatsep ——默认是一段非零的弹性长度(由 LaTeX 和 CTeX 共同提供),可`setlength`。
1684 % 2. caption 设置 belowcaptionskip、abovecaptionskip ——默认为零,可直接`setlength`,或间接用`captionsetup`设置。
1685 % 3. `caption`宏包加的 strut——这部分为零,因为引入宏包时已设置`strut=off`。
1686 % 4. 行距——捉摸不定(因为间距两边字号不同),并且难以修改。
1687 % 详见 https://github.com/CTeX-org/forum/issues/86 和 https://tex.stackexchange.com/q/26521/266758。
1688 %
1689 % - 图表具体形式多样
1690 %
1691 % 图可能包含子图,子图还可能有多行,要避免各行间遮挡。
1692 % 表除了普通 table,还可能有 longtable,后者有另外的`LTpre`、`LTpost`机制。
1693 %
1694 % \begin{macrocode}
1695 %
1696 % 1. 设置相对简单的浮动体内部“图表本体 🡘 caption”距离。
1697 %
1698 \@@_if_graduate:TF {
1699 \captionsetup[table]{skip=8bp}
1700 } {
1701 \setlength{\abovecaptionskip}{11pt}
1702
1703 % 调整表格 caption 和表格本体间的距离。
1704 % 英文模板缺乏规定,只调整中文模板
1705 \@@_if_thesis_english:F {
1706 % 本来默认有一定空隙,现改为紧贴,这样更接近Word模板实作。
1707 \captionsetup[table]{skip=5pt}
1708 }
1709 }
1710 %
1711 % 2. 设置比较复杂的图表浮动体与前后正文的间距。
1712 % a. 首先设置浮动体,保证“图表本体 🡘 caption”距离;
1713 % b. 然后设置 caption,在浮动体设置的基础上,补正“caption 🡘 正文”距离。
1714 % c. 同时适配 subcaption、longtable 等宏包。
1715 %
1716 \@@_if_graduate:TF {
1717 % 保留“正文 🡘 图片本体”距离不动,缩小“表格本体 🡘 正文”实际距离,使二者相近
1718 \AtBeginEnvironment{table}{
1719 \setlength{\intextsep}{3bp plus 1pt minus 1pt}
1720 }
1721
1722 % 调整“正文 🡘 表格 caption”距离
1723 \captionsetup[table]{belowskip = 6bp + 0.25\baselineskip}
1724
1725 % 调整“图片 caption 🡘 正文”距离
1726 % 这一距离是 intextsep 与 belowcaptionskip 之和。
1727 % 前者在小四 ctexbook 中默认为`14.0pt plus 4.0pt minus 4.0pt`,我们未改。
1728 % 计算下来,后者应设置为 14.0pt - 6bp 左右。
1729 \captionsetup[figure]{belowskip = -12pt}
1730 % 浮动体连续排列时,补偿以上负间距
1731 \addtolength{\floatsep}{12pt}
1732
1733 % 适配子图
1734 \captionsetup[subfigure]{aboveskip = 3bp, belowskip = 3bp}
1735
1736 \AtBeginDocument {
1737 % longtable 宏包有另外的机制,需专门调整
1738 \@ifpackageloaded{longtable}{
1739 \setlength{\LTpre}{0.2\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
1740 \setlength{\LTpost}{0.1\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
1741 }{}
1742 }
1743 } {
1744 % 浮动体位于正文中间时,调整浮动体与上下正文之间的距离,即"前后加上一行空白"
1745 \setlength{\intextsep}{1.80\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
1746 % 浮动体位于页面顶部或底部时,调整浮动体与正文之间的距离,后或前加上一行空白
1747 \setlength{\textfloatsep}{1.80\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
1748
1749 \@@_if_thesis_english:TF {
1750 \setlength{\belowcaptionskip}{9pt}
1751 } {
1752 % 为了满足“前后一行空白的问题”,需要删除 caption 下方的间距。
1753 %
1754 % 这里实际的 skip 在 15pt 左右,但是全部移除会导致当图片置于页面顶部时,
1755 % 图片与上方的间距过小,因此这里只移除 5pt。
1756 % 当然,这样会导致文本间的图片的 caption 下方的间距微微大于一行。
1757 %
1758 % 至于表格,`caption`宏包已考虑布局区别,统一设置 belowskip 即可。
1759 \captionsetup{belowskip=-5pt}
1760 % 不过 longtable 宏包有另外的机制,不设置 belowskip 时间距已可较小,
1761 % 设置成负数还导致 caption 和表格本体的距离变大。因此我们撤销更改。
1762 \captionsetup[longtable]{belowskip=0pt}
1763
1764 }
1765 \AtBeginDocument {
1766 % longtable 宏包有另外的机制,需专门调整
1767 \@ifpackageloaded{longtable}{
1768 \setlength{\LTpre}{1.60\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
1769 \setlength{\LTpost}{1.60\baselineskip plus 0.2\baselineskip minus 0.2\baselineskip}
1770 }{}
1771 }
1772 }
1773 % \end{macrocode}
1774 %
1775 % 定义图表标题中的分隔字符,同时调整字号。
1776 % \begin{macrocode}
1777 \@@_if_graduate:TF {
1778 \tl_gset:Nn \g_@@_label_divide_char_tl {.}
1779 % 研究生模板要求 "图序和图题间空1个中文字距"
1780 \captionsetup[figure]{font=small,labelsep=quad}
1781 % 研究生模板要求 "表序和题目间空1个中文字距"
1782 \captionsetup[table]{font=small,labelsep=quad}
1783 % 其它 caption 也参照上述格式
1784 \captionsetup[lstlisting]{font=small,labelsep=quad}
1785 \captionsetup[algorithm]{font=small,labelsep=quad}
1786 } {
1787 \tl_gset:Nn \g_@@_label_divide_char_tl {-}
1788 % 本科生模板无 caption 字距要求
1789 \captionsetup[figure]{font=small,labelsep=space}
1790 \captionsetup[table]{font=small,labelsep=space}
1791 \captionsetup[lstlisting]{font=small,labelsep=space}
1792 \captionsetup[algorithm]{font=small,labelsep=space}
1793 }
1794 % 为了不强制导入宏包,且允许最终作者在导言区覆写,不使用`\@ifpackageloaded`或`\AtBeginDocument`
1795 \ctex_at_end_package:nn {algorithm2e} {
1796 \SetAlCapFnt{\small}
1797 \SetAlCapNameFnt{\small}
1798 }
1799 % \end{macrocode}
1800 %
1801 % 为保证各种表格、算法效果一致,要手动重置 setspace 宏包漏掉的情况,具体包括 longtable 和任意 H 型浮动体。
1802 % 由于浮动体的 H 很难检测,干脆统一设置。(H 未必由 float 宏包提供,例如 algorithm2e 的 H 就不是。)
1803 % 未使用 |\singlespacing|,因为它会在 |\setstretch{1}| 基础上空一行,添加多余空白。
1804 % \begin{macrocode}
1805 \clist_map_inline:nn {longtable, table, algorithm} {
1806 \AtBeginEnvironment {#1} { \setstretch{1} }
1807 }
1808 % \end{macrocode}
1809 %
1810 % 调整算法环境内部的字号。
1811 %
1812 % 学校无规定,但默认与正文相同,很怪。需要调小至与 caption 相同。
1813 % \begin{macrocode}
1814 \AtBeginEnvironment {algorithmic} {\small}
1815 \ctex_at_end_package:nn {algorithm2e} { \SetAlFnt{\small} }
1816 % \end{macrocode}
1817 %
1818 % 汉化宏包。
1819 % \begin{macrocode}
1820 \@@_if_thesis_english:F {
1821 \ctex_at_end_package:nn {algorithm2e} {
1822 \SetKwInput{KwData}{数据}
1823 \SetKwInput{KwResult}{结果}
1824 \SetKwInput{KwIn}{输入}
1825 \SetKwInput{KwOut}{输出}
1826 }
1827 \ctex_at_end_package:nn {algorithmic} {
1828 \renewcommand*{\algorithmicrequire}{\textbf{输入:}}
1829 \renewcommand*{\algorithmicensure}{\textbf{输出:}}
1830 }
1831 }
1832 % \end{macrocode}
1833 %
1834 % \begin{macro}{\thefigure,\thetable,\theequation,\thelstlisting,\lstlistingname}
1835 % 定义各种计数器的格式。
1836 % \begin{macrocode}
1837 % 图片:五号字。
1838 \cs_set:Npn \thefigure {\thechapter\g_@@_label_divide_char_tl\arabic{figure}}
1839
1840 % 表格:五号字。
1841 \cs_set:Npn \thetable {\thechapter\g_@@_label_divide_char_tl\arabic{table}}
1842
1843 % equation
1844 \cs_set:Npn \theequation {\thechapter\g_@@_label_divide_char_tl\arabic{equation}}
1845
1846 % 适配 cleveref 宏包
1847 % 在 AtBeginDocument 之外,保证最终作者可以覆写
1848 \ctex_at_end_package:nn {cleveref} {
1849 % cleveref 支持同一处引用多个标签,英文涉及单复数两个值;
1850 % 而 BITSetup 主要为中文设计,接口只允许一个值,无法简单套用到英文。
1851 % 再考虑到我校缺乏英文规范,我们干脆只给中文适配,英文沿用 cleveref 默认,最终作者有需要可以覆写。
1852 \@@_if_thesis_english:F {
1853 % “第……”格式在编号后有字,autoref 无法可靠设置,BITSetup 也难以预留接口
1854 \crefformat{chapter}{第~#2#1#3~章}
1855 \crefformat{section}{第~#2#1#3~节}
1856 \crefformat{subsection}{第~#2#1#3~小节}
1857 \crefformat{subsubsection}{第~#2#1#3~小节}
1858 % 普通格式沿用 autoref 设置
1859 \crefname{figure}{\figureautorefname}{\figureautorefname}
1860 \crefname{table}{\tableautorefname}{\tableautorefname}
1861 \crefname{listing}{\c_@@_label_code_tl}{\c_@@_label_code_tl}
1862 \crefname{algorithm}{\l_@@_misc_autoref_algo_tl}{\l_@@_misc_autoref_algo_tl}
1863 \crefname{algo}{\l_@@_misc_autoref_algo_tl}{\l_@@_misc_autoref_algo_tl}
1864 \crefname{them}{\themautorefname}{\themautorefname}
1865 \crefname{lem}{\lemautorefname}{\lemautorefname}
1866 \crefname{prop}{\propautorefname}{\propautorefname}
1867 \crefname{cor}{\corautorefname}{\corautorefname}
1868 \crefname{axi}{\axiautorefname}{\axiautorefname}
1869 \crefname{defn}{\defnautorefname}{\defnautorefname}
1870 \crefname{conj}{\conjautorefname}{\conjautorefname}
1871 \crefname{exmp}{\exmpautorefname}{\exmpautorefname}
1872 \crefname{case}{\caseautorefname}{\caseautorefname}
1873 \crefname{rem}{\remautorefname}{\remautorefname}
1874 % 同一处引用多个公式较为常见,专门适配
1875 % #2、#3 标识的链接范围不可包含括号,否则影响标点挤压。
1876 \crefformat{equation}{\equationautorefname(#2#1#3)}
1877 \crefrangeformat{equation}{\equationautorefname(#3#1#4)至(#5#2#6)}
1878 \crefmultiformat{equation}{\equationautorefname(#2#1#3)}{和(#2#1#3)}{、(#2#1#3)}{和(#2#1#3)}
1879 }
1880 }
1881
1882 % code snippet
1883 \AtBeginDocument{
1884 \cs_gset:Npn \thelstlisting {\thechapter\g_@@_label_divide_char_tl\arabic{lstlisting}}
1885 \cs_gset:Npn \lstlistingname {\c_@@_label_code_tl}
1886
1887 % 定义算法标题
1888 % 针对模板的 algo 环境
1889 \tl_set:Nn \algoautorefname {\l_@@_misc_autoref_algo_tl}
1890 % 针对 algorithm 宏包
1891 \tl_set:Nn \ALG@name {\l_@@_misc_autoref_algo_tl}
1892 % 针对 algorithm2e 宏包
1893 \tl_set:Nn \algorithmcfname {\l_@@_misc_autoref_algo_tl}
1894
1895 % 定义算法的 autoref
1896 % algorithm2e 宏包会覆写它,所以我们必须AtBeginDocument时再修改
1897 \tl_set:Nn \algorithmautorefname {\l_@@_misc_autoref_algo_tl}
1898
1899 % 算法变成「章节号-序号」
1900 % 为了减少修改,我们只适配按章编号的情况。
1901 % 针对 algorithm 宏包
1902 \@ifpackagewith{algorithm}{chapter}{
1903 \cs_gset:Npn \thealgorithm
1904 {\thechapter\g_@@_label_divide_char_tl\arabic{algorithm}}
1905 }{}
1906 % 针对 algorithm2e 宏包
1907 \@ifpackagewith{algorithm2e}{algochapter}{
1908 % 名字中的“cf”是指其作者 Christophe Fiorio。
1909 \cs_gset:Npn \thealgocf
1910 {\thechapter\g_@@_label_divide_char_tl\arabic{algocf}}
1911 }{}
1912
1913 % 默认的情况下,保留公式和上下文的一定间距。(会比 Word 稍宽一些)
1914 \setlength{\abovedisplayskip}{\l_@@_style_math_above_display_skip_dim}
1915 \setlength{\abovedisplayshortskip}{\l_@@_style_math_above_display_skip_dim}
1916 \setlength{\belowdisplayskip}{\l_@@_style_math_below_display_skip_dim}
1917 \setlength{\belowdisplayshortskip}{\l_@@_style_math_below_display_skip_dim}
1918 % 调整浮动体与文字之间的距离
1919 \addtolength{\intextsep}{\l_@@_misc_float_separation_tl\baselineskip}
1920 \addtolength{\textfloatsep}{\l_@@_misc_float_separation_tl\baselineskip}
1921 % longtable 宏包有另外的机制,需专门调整
1922 \@ifpackageloaded{longtable}{
1923 \addtolength{\LTpre}{\l_@@_misc_float_separation_tl\baselineskip}
1924 \addtolength{\LTpost}{\l_@@_misc_float_separation_tl\baselineskip}
1925 }{}
1926 % 调整算法与文字之间的距离
1927 % 针对 algorithm2e 宏包
1928 \@ifpackageloaded{algorithm2e}{
1929 % 宏包手册介绍可自定义宏,再`\SetAlgoSkip`;我们为简洁,直接覆写。
1930 \renewcommand{\@algoskip}{\vspace{\l_@@_misc_algorithm_separation_tl}}
1931 }{}
1932 }
1933 % \end{macrocode}
1934 % \end{macro}
1935 %
1936 % 调整底层 TeX 排版引擎参数以保证所有段落能够很好地以两端对齐的方式呈现。
1937 % 是的,这是祖传代码。
1938 % 在英文模式下禁用,因为这段代码会禁用 hyphenation.
1939 % \begin{macrocode}
1940 \bool_if:NF \l_@@_style_hyphen_bool {
1941 \hbadness=10000
1942 \tolerance=1
1943 \emergencystretch=\maxdimen
1944 \hyphenpenalty=10000
1945 }
1946 % \end{macrocode}
1947 %
1948 % 自定义一个默认的 lstlisting 样式。
1949 % \begin{macrocode}
1950 \definecolor{codegreen}{rgb}{0,0.6,0}
1951 \definecolor{codegray}{rgb}{0.5,0.5,0.5}
1952 \definecolor{codepurple}{rgb}{0.58,0,0.82}
1953 \definecolor{backcolour}{rgb}{0.95,0.95,0.92}
1954 \lstdefinestyle{examplestyle}{
1955 backgroundcolor=\color{backcolour},
1956 commentstyle=\color{codegreen},
1957 keywordstyle=\color{magenta},
1958 numberstyle=\tiny\color{codegray},
1959 stringstyle=\color{codepurple},
1960 basicstyle=\ttfamily\footnotesize,
1961 breakatwhitespace=false,
1962 breaklines=true,
1963 captionpos=b,
1964 keepspaces=true,
1965 numbers=left,
1966 numbersep=5pt,
1967 showspaces=false,
1968 showstringspaces=false,
1969 showtabs=false,
1970 tabsize=2
1971 }
1972 \lstset{style=examplestyle}
1973 % \end{macrocode}
1974 %
1975 % 调整插图目录与表格目录的标题。
1976 % \begin{macrocode}
1977 \cs_set:Npn \listfigurename {\currentpdfbookmark{\c_@@_label_figure_tl}{ch:figures}\@@_get_const:n {figure}}
1978 \cs_set:Npn \listtablename {\currentpdfbookmark{\c_@@_label_table_tl}{ch:tables}\@@_get_const:n {table}}
1979 % \end{macrocode}
1980 %
1981 % 预定义用户常用的证明环境。
1982 % \begin{macrocode}
1983 \theoremstyle{plain}
1984 \newtheorem{algo}{\@@_get_const:n {algo}}[chapter]
1985 \newtheorem{them}{\@@_get_const:n {them}}[chapter]
1986 \newtheorem{lem}{\@@_get_const:n {lem}}[chapter]
1987 \newtheorem{prop}{\@@_get_const:n {prop}}[chapter]
1988 \newtheorem{cor}{\@@_get_const:n {cor}}[chapter]
1989 \newtheorem{axi}{\@@_get_const:n {axi}}[chapter]
1990 \theoremstyle{definition}
1991 \newtheorem{defn}{\@@_get_const:n {defn}}[chapter]
1992 \newtheorem{conj}{\@@_get_const:n {conj}}[chapter]
1993 \newtheorem{exmp}{\@@_get_const:n {exmp}}[chapter]
1994 \newtheorem{case}{\@@_get_const:n {case}}
1995 \theoremstyle{remark}
1996 \newtheorem{rem}{\@@_get_const:n {rem}}
1997 \renewcommand{\qedsymbol}{\ensuremath{\blacksquare}}
1998 % \end{macrocode}
1999 %
2000 % \begin{macro}{\@@_dunderline:nnn,\@@_dunderline:n}
2001 % 用于渲染下划线。
2002 %
2003 % 参数如下:
2004 % \begin{itemize}
2005 % \item \#1 |dim| 线的竖直偏移量,例如 |-10pt|。
2006 % \item \#2 |dim| 线宽(粗细),例如 |1pt|。
2007 % \item \#3 |tl| 文字内容。
2008 % \end{itemize}
2009 %
2010 % 前两个可以统一不提供,此时分别默认为 |-1pt|、|1pt|。
2011 % \begin{macrocode}
2012 \cs_new:Npn \@@_dunderline:nnn #1#2#3 {
2013 {\setbox0=\hbox{#3}\ooalign{\copy0\cr\rule[\dimexpr#1-#2\relax]{\wd0}{#2}}}
2014 }
2015 \cs_new:Npn \@@_dunderline:n #1 {
2016 \@@_dunderline:nnn {-1pt} {1pt} {#1}
2017 }
2018 % \end{macrocode}
2019 % \end{macro}
2020 %
2021 % \begin{macro}{|@@_render_cover_entry:nn}
2022 % 用于渲染封面的辅助函数。
2023 %
2024 % 参数如下:
2025 % \begin{itemize}
2026 % \item \#1 |{token_list}| 为封面信息条目的名称,含分隔符。
2027 % \item \#2 |{token_list}| 为封面信息条目的内容。
2028 % \end{itemize}
2029 %
2030 % 需要在 |\l_@@_cover_label_max_width_dim| 和 |\l_@@_cover_value_max_width_dim|
2031 % 存储已经计算出来的最大宽度。
2032 % \begin{macrocode}
2033 \cs_new:Npn \@@_render_cover_entry:nn #1#2 {
2034 \makebox[\l_@@_cover_label_max_width_dim][\l_@@_cover_label_align_tl]{
2035 \tl_if_blank:VTF #1 {} {#1}
2036 }
2037 \hspace{1ex}
2038 \@@_dunderline:nnn{\l_@@_cover_underline_offset_dim}
2039 {\l_@@_cover_underline_thickness_dim}{
2040 \makebox[\l_@@_cover_value_max_width_dim][\l_@@_cover_value_align_tl]{#2}
2041 }\par
2042 }
2043 % \end{macrocode}
2044 % \end{macro}
2045
2046 % \begin{macro}{|@@_cover_entry_rendered_width:}
2047 % 预估 |\@@_render_cover_entry:nn| 会占用的宽度,可用于判断行是否会溢出
2048 % \begin{macrocode}
2049 \cs_new:Nn \@@_cover_entry_rendered_width: {
2050 \l_@@_cover_label_max_width_dim + 1ex + \l_@@_cover_value_max_width_dim
2051 }
2052 % \end{macrocode}
2053 % \end{macro}
2054 %
2055 % \begin{macro}{|@@_get_text_width:Nn,\@@_get_text_width:NV}
2056 % 计算 \#2 所占用的宽度,将结果存储在 \#1 中。
2057 %
2058 % 参数如下:
2059 % \begin{itemize}
2060 % \item \#1 |dim| 存储宽度的变量。
2061 % \item \#2 |tl| 要计算宽度的文本。
2062 % \end{itemize}
2063 % \begin{macrocode}
2064 \cs_new:Npn \@@_get_text_width:Nn #1#2
2065 {
2066 \hbox_set:Nn \l_tmpa_box {#2}
2067 \dim_set:Nn #1 { \box_wd:N \l_tmpa_box }
2068 }
2069 \cs_generate_variant:Nn \@@_get_text_width:Nn { NV }
2070 % \end{macrocode}
2071 % \end{macro}
2072 %
2073 % \begin{macro}{\@@_get_max_text_width:NN}
2074 % 从 \#2 中获取最大的文本宽度,然后设置到 \#1 中。
2075 %
2076 % 参数如下:
2077 % \begin{itemize}
2078 % \item \#1: |dim| 用于输出最大宽度。
2079 % \item \#2: |seq| 用于输入文本。
2080 % \end{itemize}
2081 % \begin{macrocode}
2082 \cs_new:Npn \@@_get_max_text_width:NN #1#2
2083 {
2084 % 这里用 |group| 确保局部变量不会被污染。
2085 \group_begin:
2086 \seq_set_eq:NN \l_@@_tmpa_seq #2
2087 \dim_zero:N #1
2088 \dim_zero_new:N \l_@@_tmpa_dim
2089 \bool_until_do:nn { \seq_if_empty_p:N \l_@@_tmpa_seq }
2090 {
2091 \seq_pop_left:NN \l_@@_tmpa_seq \l_@@_tmpa_tl
2092 \@@_get_text_width:NV \l_@@_tmpa_dim \l_@@_tmpa_tl
2093 \dim_gset:Nn #1 { \dim_max:nn {#1} { \l_@@_tmpa_dim } }
2094 }
2095 \group_end:
2096 }
2097 % \end{macrocode}
2098 % \end{macro}
2099 %
2100 % \begin{macro}{\@@_parse_entry:nn}
2101 % 解析封面信息条目,丢弃空项,并添加分隔符。
2102 %
2103 % 参数如下:
2104 % \begin{itemize}
2105 % \item \#1: |tl| 为封面信息条目的名称。
2106 % \item \#2: |tl| 为封面信息条目的内容。
2107 % \end{itemize}
2108 % |\\| 会被视为换行符,从而实现信息条目换行的效果。
2109 %
2110 % 结果会存储到 |\l_@@_tmp_left_seq| 和 |\l_@@_tmp_right_seq|。
2111 %
2112 % \begin{macrocode}
2113 \cs_new:Npn \@@_parse_entry:nn #1 #2 {
2114 \seq_clear:N \l_@@_tmp_left_seq
2115 \seq_clear:N \l_@@_tmp_right_seq
2116
2117 % 只处理 value 非空的项
2118 \tl_set:Nn \l_tmpa_tl {#2}
2119 \tl_if_empty:xTF {\l_tmpa_tl} {} {
2120 \seq_set_split:Nnx \l_@@_tmp_right_seq {\\} {#2}
2121 \seq_map_inline:Nn \l_@@_tmp_right_seq {
2122 \seq_put_right:Nn \l_@@_tmp_left_seq {}
2123 }
2124 \seq_put_left:Nn \l_@@_tmp_left_seq {#1\l_@@_cover_delimiter_tl}
2125 \seq_pop_right:NN \l_@@_tmp_left_seq \g_@@_trashcan_tl
2126 }
2127 }
2128 % \end{macrocode}
2129 % \end{macro}
2130 %
2131 % \begin{macro}{\@@_render_cover_entry}
2132 % 渲染封面信息项。此函数为主函数。
2133 % \begin{macrocode}
2134 \msg_new:nnn { bithesis } { render-cover-entry/overfull-hbox }
2135 {
2136 One~or~more~cover~entries~are~too~wide,~which~may~result~in~poor~layout.\\
2137 To~fix~it,~please~split~long~entries~into~multiple~lines~by~inserting~“\c_backslash_str\c_backslash_str”.\\
2138 \@@_warning_footer:n { render-cover-entry/overfull-hbox }
2139 }
2140 \cs_new:Npn \@@_render_cover_entry:N #1 {
2141 % 左边是标签,右边是值。
2142 % 形如:
2143 % { {label_1} {value_1}, {label_2} {value 2} }
2144 % 首先转换成 seq 类型。
2145 \seq_set_from_clist:NN \l_@@_input_seq #1
2146 \seq_map_inline:Nn \l_@@_input_seq {
2147 % 然后对于每一对 label 和 value,首先查找
2148 % value 中是否含有 \\ 字符,如果有,则将其分割成多个
2149 % label - value 对。
2150 % 比如 {label_1} {value \\ 1} 会被转换成
2151 % { {label_1} {value}, {} {1} }
2152 \@@_parse_entry:nn ##1
2153 % 然后将这些 label - value 对添加到 \l_@@_right_seq
2154 % 或者 \l_@@_left_sql 中。
2155 % left 就是 label,right 就是 value。
2156 \seq_concat:NNN \l_@@_right_seq \l_@@_right_seq \l_@@_tmp_right_seq
2157 \seq_concat:NNN \l_@@_left_seq \l_@@_left_seq \l_@@_tmp_left_seq
2158 }
2159
2160 % 如果用户选择自动计算最大宽度,则计算最大宽度。
2161 \bool_if:NT \l_@@_cover_auto_width_bool {
2162 \@@_get_max_text_width:NN \l_@@_cover_label_max_width_dim \l_@@_left_seq
2163 \@@_get_max_text_width:NN \l_@@_cover_value_max_width_dim \l_@@_right_seq
2164 % 在 value 两边加上空白,避免文本太靠边。
2165 \dim_add:Nn \l_@@_cover_value_max_width_dim { \l_@@_cover_auto_width_padding_dim * 2 }
2166 }
2167 \dim_compare:nNnT { \linewidth } < { \@@_cover_entry_rendered_width: } {
2168 \msg_warning:nn {bithesis} {render-cover-entry/overfull-hbox}
2169 }
2170
2171
2172 % 最后,根据宽度渲染 label 和 value 对。
2173 \group_begin:
2174 \bool_until_do:nn { \seq_if_empty_p:N \l_@@_left_seq }
2175 {
2176 \seq_pop_left:NN \l_@@_left_seq \l_@@_tmpa_tl
2177 \seq_pop_left:NN \l_@@_right_seq \l_@@_tmpb_tl
2178 \@@_render_cover_entry:nn {\l_@@_tmpa_tl} {\l_@@_tmpb_tl}
2179 }
2180 \group_end:
2181 }
2182 % \end{macrocode}
2183 % \end{macro}
2184 %
2185 % \begin{macro}{\@@_make_graduate_cover:}
2186 % 制作研究生论文模板封面。
2187 %
2188 % 学校会发一个彩色封皮,上半部分带有“北京理工大学”“博士学位论文”“(专业型)”等通用标题。
2189 % 这里制造的封面包含文章信息,打印店会把它打印到通用封皮上。
2190 % 因此,这里生成的内容要避让封皮的通用内容,不能随意扩张。
2191 % \begin{macrocode}
2192 \cs_new:Npn \@@_make_graduate_cover: {
2193 \cleardoublepage
2194 \bool_if:NT \l_@@_internal__pre_frontmatter__bookmarked_bool {
2195 \currentpdfbookmark{封面}{pre-frontmatter:cover}
2196 }
2197 \begin{titlepage}
2198 {
2199 \heiti\zihao{5}
2200 \tl_if_blank:VTF \l_@@_value_classified_level_tl {} {
2201 \flushright
2202 \c_@@_label_classified_level_tl:~
2203 \l_@@_value_classified_level_tl \par
2204 }
2205 }
2206 \centering
2207 \vspace*{90mm}
2208 {\heiti\zihao{-2} \l_@@_value_title_tl \par}
2209 \vskip 50mm
2210 {
2211 % 渲染信息。
2212 \clist_set:Nn \l_@@_input_clist {
2213 {姓名:} {\@@_secret_info_fixed:Nn \l_@@_value_author_tl {3}},
2214 {学号:} {\@@_secret_info:N \l_@@_value_student_id_tl},
2215 {学院:} {\l_@@_value_school_tl},
2216 }
2217 \linespread{2.0}\selectfont
2218 \dim_set:Nn \l_@@_cover_auto_width_padding_dim {2em}
2219 % 黑体 小三
2220 \heiti \zihao{-3} \@@_render_cover_entry:N \l_@@_input_clist
2221 }
2222 \vskip 10mm
2223 % 黑体 小三
2224 {\heiti \zihao{-3} \l_@@_cover_date_tl}
2225 \end{titlepage}
2226 }
2227 % \end{macrocode}
2228 % \end{macro}
2229 %
2230 % \begin{macro}{\@@_make_paper_back:}
2231 % 制作书脊。
2232 % \begin{macrocode}
2233 \msg_new:nnn { bithesis } { paper-back/missing-degree-type-icon-file }
2234 {
2235 Failed~to~find~the~file~for~degree~type~in~the~paper~back:~#1.\\
2236 Please~download~from~https://github.com/BITNP/BIThesis/blob/main/templates/graduate-thesis/ #1.\\
2237 \@@_warning_footer:n { paper-back/missing-degree-type-icon-file }
2238 }
2239 \cs_new:Npn \@@_make_paper_back: {
2240 \cleardoublepage
2241 \bool_if:NT \l_@@_internal__pre_frontmatter__bookmarked_bool {
2242 \currentpdfbookmark{书脊}{pre-frontmatter:paperback}
2243 }
2244 \begin{titlepage}
2245 \centering
2246 % 实现竖排——将水平宽度设得很窄,让文字自动换行,并改小行距
2247 \linespread{1.1}\selectfont
2248 \begin{minipage}[c][19.7cm]{2em}
2249 \centering
2250 {
2251 \tl_new:N \l_@@_icon_path_tl
2252 \tl_set:Nx \l_@@_icon_path_tl { misc/icon_ \l_@@_value_degree_type_tl .jpg }
2253 \file_if_exist:nTF {\l_@@_icon_path_tl} {
2254 \includegraphics[width=1.5em]{\l_@@_icon_path_tl}
2255 } {
2256 \msg_warning:nnV {bithesis} {paper-back/missing-degree-type-icon-file} \l_@@_icon_path_tl
2257 }
2258 }
2259 \vspace{1em plus 1fill}
2260 \par
2261 {
2262 \heiti\zihao{3}
2263 \tl_if_blank:VTF \l_@@_value_vertical_title_tl
2264 {\l_@@_value_title_tl}{\l_@@_value_vertical_title_tl}
2265 }
2266 \par
2267 \vspace{1em plus 1fill}
2268 {\heiti\zihao{3}\@@_secret_info:nn{\l_@@_value_author_tl}{\g_@@_const_substitute_symbol_tl\quad\g_@@_const_substitute_symbol_tl\quad\g_@@_const_substitute_symbol_tl}}
2269 \par
2270 \vspace{1em plus 1fill}
2271 {\heiti\zihao{3}\c_@@_label_university_tl}
2272 \end{minipage}
2273 \end{titlepage}
2274 }
2275 % \end{macrocode}
2276 % \end{macro}
2277 %
2278 % \begin{macro}{\@@_make_chinese_title_page:}
2279 % 制作中文封面页。
2280 % \begin{macrocode}
2281 \cs_new:Npn \@@_make_chinese_title_page: {
2282 \cleardoublepage
2283 \bool_if:NT \l_@@_internal__pre_frontmatter__bookmarked_bool {
2284 \currentpdfbookmark{中文题名页}{pre-frontmatter:titlepage-zh}
2285 }
2286 \begin{titlepage}
2287 \noindent\begin{minipage}[t]{0.48\textwidth}
2288 % 分类号、学校代码
2289 {\heiti \zihao{5} \c_@@_label_classification_tl}
2290 \l_@@_value_classification_tl\\
2291 {\heiti \zihao{5} \c_@@_label_udc_tl} \l_@@_value_udc_tl\\
2292 {\heiti \zihao{5} \c_@@_label_university_code_tl} \l_@@_value_university_code_tl
2293 \end{minipage}
2294
2295 \hfill
2296
2297 % 以下内容是「学生类型」的内容,
2298 % 若 cover/showSpecialTypeBox 为 false 且没有任何勾选,则隐藏。
2299 \bool_if:nT {\l_@@_cover_show_special_type_box_bool || \l_@@_value_international_student_ugp_bool || \l_@@_value_cross_research_bool || \l_@@_value_engineering_special_plan_bool} {
2300 \begin{minipage}[t]{0.48\textwidth}
2301 \vspace{-12pt}
2302 \begin{flushright}
2303 \setlength\fboxrule{1pt}\setlength\fboxsep{3mm}
2304 \fbox{
2305 \noindent\begin{minipage}{0.48\linewidth}
2306 \heiti \zihao{5}
2307 \scalebox{1.1}\BigStar{}\hspace{4pt} \c_@@_label_special_type_tl\\
2308
2309 {
2310 \zihao{-4}
2311 \bool_if:NTF \l_@@_value_engineering_special_plan_bool {\@@_boxcheck:} {\@@_boxempty:}
2312 }
2313 \hspace{1pt}\c_@@_label_engineering_special_plan_tl\\
2314
2315 {
2316 \zihao{-4}
2317 \bool_if:NTF \l_@@_value_cross_research_bool {\@@_boxcheck:} {\@@_boxempty:}
2318 }
2319 \hspace{1pt}\c_@@_label_cross_research_tl\\
2320
2321 {
2322 \zihao{-4}
2323 \bool_if:NTF \l_@@_value_international_student_ugp_bool {\@@_boxcheck:} {\@@_boxempty:}
2324 }
2325 \hspace{1pt}\c_@@_label_international_student_ugp_tl
2326 \end{minipage}
2327 }
2328 \end{flushright}
2329 \end{minipage}
2330 % 保证下面的内容空间不会受到挤占。
2331 \vspace{-35pt}
2332 }
2333
2334 \begin{center}
2335
2336 \vskip \stretch{1}
2337
2338 {\heiti\zihao{-2} \l_@@_value_title_tl \par}
2339
2340 \vskip \stretch{1}
2341
2342 \def\tabcolsep{1pt}
2343 \def\arraystretch{1.5}
2344
2345 {
2346 \renewcommand{\baselinestretch}{2}
2347
2348 \tl_if_empty:NT \l_@@_cover_delimiter_tl {
2349 \tl_set:Nn \l_@@_cover_delimiter_tl {\qquad}
2350 }
2351 \dim_set:Nn \l_@@_cover_underline_offset_dim {-5pt}
2352
2353 % 如果不是自动计算宽度,且用户没有自定义宽度,
2354 % 则尝试提供一个默认宽度。
2355 \bool_if:NF \l_@@_cover_auto_width_bool {
2356 \dim_compare:nNnT {\l_@@_cover_label_max_width_dim} = {0pt} {
2357 \dim_set:Nn \l_@@_cover_label_max_width_dim {45mm}
2358 }
2359 \dim_compare:nNnT {\l_@@_cover_value_max_width_dim} = {0pt} {
2360 \dim_set:Nn \l_@@_cover_value_max_width_dim {60mm}
2361 }
2362 }
2363
2364 % 渲染信息。
2365 % 此处必须限制盲审模式替换符号数量,不然会泄露信息,还可能导致行溢出
2366 \clist_set:Nn \l_@@_input_clist {
2367 {\c_@@_graduate_label_author_tl} {\@@_secret_info_fixed:Nn \l_@@_value_author_tl {3}},
2368 {\c_@@_graduate_label_school_tl} {\l_@@_value_school_tl},
2369 {\c_@@_graduate_label_supervisor_tl} {\@@_secret_info_fixed:Nn \l_@@_value_supervisor_tl {5}},
2370 {\c_@@_graduate_label_industrial_mentor_tl} {\@@_secret_info_fixed:Nn \l_@@_value_industrial_mentor_tl {5}},
2371 {\c_@@_graduate_label_chairman_tl} {\@@_secret_info_fixed:Nn \l_@@_value_chairman_tl {5}},
2372 {\g_@@_const_info_degree_tl} {\l_@@_value_degree_tl},
2373 {\g_@@_const_info_major_tl} {\l_@@_value_major_tl},
2374 {\c_@@_graduate_label_institute_tl} {\l_@@_value_institute_tl},
2375 {\c_@@_graduate_label_submission_date_tl} {\l_@@_value_submission_date_tl},
2376 }
2377
2378 \heiti\zihao{-3}
2379 \@@_render_cover_entry:N \l_@@_input_clist
2380 }
2381 \end{center}
2382 \vskip \stretch{0.5}
2383 \end{titlepage}
2384 }
2385 % \end{macrocode}
2386 % \end{macro}
2387 %
2388 % \begin{macro}{\@@_make_english_title_page:}
2389 % 制作英文封面页。
2390 % \begin{macrocode}
2391 \cs_new:Npn \@@_make_english_title_page: {
2392 \bool_if:NT \l_@@_internal__pre_frontmatter__bookmarked_bool {
2393 \currentpdfbookmark{英文题名页}{pre-frontmatter:titlepage-en}
2394 }
2395 \begin{titlepage}
2396 \begin{center}
2397
2398 \vspace*{10em}
2399
2400 {
2401 \zihao{-2}
2402 \textbf{\l_@@_value_title_en_tl}
2403 \par
2404 }
2405
2406 \vskip \stretch{1}
2407
2408 {
2409 \tl_if_empty:NT \l_@@_cover_delimiter_tl {
2410 \tl_set:Nn \l_@@_cover_delimiter_tl {:~}
2411 }
2412
2413 \tl_set:Nn \l_@@_cover_label_align_tl {l}
2414 \dim_set:Nn \l_@@_cover_underline_offset_dim {-5pt}
2415
2416 % 如果不是自动计算宽度,且用户没有自定义宽度,
2417 % 则尝试提供一个默认宽度。
2418 \bool_if:NF \l_@@_cover_auto_width_bool {
2419 \dim_compare:nNnT {\l_@@_cover_label_max_width_dim} = {0pt} {
2420 \dim_set:Nn \l_@@_cover_label_max_width_dim {55mm}
2421 }
2422 \dim_compare:nNnT {\l_@@_cover_value_max_width_dim} = {0pt} {
2423 \dim_set:Nn \l_@@_cover_value_max_width_dim {85mm}
2424 }
2425 }
2426
2427 % 渲染信息。
2428 % 此处必须限制盲审模式替换符号数量,不然会泄露信息,还可能导致行溢出
2429 \clist_set:Nn \l_@@_input_clist {
2430 {\c_@@_graduate_label_author_en_tl} {\@@_secret_info_fixed:Nn \l_@@_value_author_en_tl {9}},
2431 {\c_@@_graduate_label_school_en_tl} {\l_@@_value_school_en_tl},
2432 {\c_@@_graduate_label_supervisor_en_tl} {\@@_secret_info_fixed:Nn \l_@@_value_supervisor_en_tl {12}},
2433 {\c_@@_graduate_label_industrial_mentor_en_tl} {\@@_secret_info_fixed:Nn \l_@@_value_industrial_mentor_en_tl {12}},
2434 {\c_@@_graduate_label_chairman_en_tl} {\@@_secret_info_fixed:Nn \l_@@_value_chairman_en_tl {12}},
2435 {\c_@@_graduate_label_degree_en_tl} {\l_@@_value_degree_en_tl},
2436 {\c_@@_graduate_label_major_en_tl} {\l_@@_value_major_en_tl},
2437 {\c_@@_graduate_label_institute_en_tl} {\l_@@_value_institute_en_tl},
2438 {\c_@@_graduate_label_submission_date_en_tl} {\l_@@_value_submission_date_en_tl},
2439 }
2440
2441 \zihao{-3}
2442 \@@_render_cover_entry:N \l_@@_input_clist
2443 }
2444
2445 \end{center}
2446
2447 \vskip \stretch{0.5}
2448 \end{titlepage}
2449 }
2450 % \end{macrocode}
2451 % \end{macro}
2452 %
2453 % \begin{macro}{\circled}
2454 % 圆形数字编号定义。
2455 % \begin{macrocode}
2456 \newcommand{\circled}[2][]{\tikz[baseline=(char.base)]
2457 {\node[shape = circle, draw, inner~sep = 1pt]
2458 (char) {\phantom{\ifblank{#1}{#2}{#1}}};
2459 \node at (char.center) {\makebox[0pt][c]{#2}};}}
2460 \robustify{\circled}
2461 % \end{macrocode}
2462 % \end{macro}
2463 %
2464 % \begin{macro}{\@@_graduate_originality:}
2465 % 研究生原创性声明。
2466 % \begin{macrocode}
2467 \cs_new:Npn \@@_graduate_originality:
2468 {
2469 % 取消页眉页脚。
2470 \ctexset {
2471 chapter / pagestyle = plain,
2472 }
2473
2474 \begin{titlepage}
2475 % 不计算页码。
2476 \pagenumbering{gobble}
2477
2478 % 原创性声明部分
2479 \begin{center}
2480 \@@_same_page:
2481 \ctexset{
2482 chapter = {
2483 titleformat = {\heiti\zihao{-2}},
2484 afterskip = 30pt,
2485 }
2486 }
2487 \bool_if:NT \l_@@_internal__pre_frontmatter__bookmarked_bool {
2488 \currentpdfbookmark{\c_@@_graduate_label_originality_tl}{pre-frontmatter:originality}
2489 }
2490 \chapter*{
2491 \c_@@_graduate_label_originality_tl
2492 }
2493 \end{center}
2494
2495 % 本部分字号为三号,且 Word 行距为 28 pt(≈ 1.46 × 1.2 基础行距 × 16 pt 三号字)。
2496 \zihao{3}
2497 \linespread{1.46}\selectfont
2498
2499 \qquad\c_@@_graduate_label_originality_clause_tl
2500 \vspace{3\baselineskip}
2501
2502 \begin{flushright}
2503 \c_@@_graduate_label_originality_author_signature_tl\par
2504 \end{flushright}
2505
2506 \cleardoublepage
2507
2508 % 使用授权声明部分。
2509 \begin{center}
2510 \@@_same_page:
2511 \ctexset{
2512 chapter = {
2513 titleformat = {\heiti\zihao{-2}},
2514 afterskip = 30pt,
2515 }
2516 }
2517 \bool_if:NT \l_@@_internal__pre_frontmatter__bookmarked_bool {
2518 \currentpdfbookmark{\c_@@_graduate_label_authorization_tl}{pre-frontmatter:originality-authorization}
2519 }
2520 \chapter*{
2521 \c_@@_graduate_label_authorization_tl
2522 }
2523 \end{center}
2524
2525 \qquad\c_@@_graduate_label_authorization_clause_tl
2526
2527 \vspace{3\baselineskip}
2528
2529 \begin{flushright}
2530 \begin{spacing}{1.65}
2531 \zihao{3}
2532 % \hspace{5mm}\raisebox{-2ex}{\includegraphics[width=30mm]{example-image}}\hspace{5mm}
2533 \c_@@_graduate_label_originality_author_signature_tl\par
2534 \vspace{1\baselineskip}
2535 \c_@@_graduate_label_originality_supervisor_signature_tl\par
2536 \end{spacing}
2537 \end{flushright}
2538 \end{titlepage}
2539 \cleardoublepage
2540 }
2541 % \end{macrocode}
2542 % \end{macro}