Newer
Older
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
\@@_full_uline:NV #1 { \@@_name:n { #2 } #4 }
\@@_ulined_center_box:nn { #1 } { \@@_info:n { #3 } }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_uline_bientry:nnnn}
% 生成占半页宽度的下划线条目。
% \begin{arguments}
% \item 宽度,|dim| 型变量
% \item 文本
% \item 文本
% \item 分隔符
% \end{arguments}
% \begin{macrocode}
\cs_new_protected:Npn \@@_uline_bientry:nnnn #1#2#3#4
{
\@@_full_uline:NV #1 { \@@_name:n { #2 } #4 }
\dim_sub:Nn #1 { \textwidth / 2 }
\@@_ulined_center_box:nn { #1 } { \@@_info:n { #3 } }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\njuchapter}
% 含有目录和 PDF 标签的无编号章。
% \begin{macrocode}
\NewDocumentCommand \njuchapter { m }
{
\chapter*{#1}
\addcontentsline { toc } { chapter } { \c_@@_sec_format_tl #1 }
\@mkboth{#1}{#1}
}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{模板选项}
% \changes{v0.11}{2021/11/15}{进行了效率优化。}
{
\int_set_eq:NN \l_@@_info_degree_int \l_keys_choice_int
{
\clist_item:Nn \c_@@_name_degree_clist
{ \l_@@_info_degree_int }
}
\int_compare:nTF { \l_@@_info_degree_int == 1 }
{ \tl_set:Nn \l_@@_info_diploma_tl { ug } }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{type}
{
\int_set_eq:NN \l_@@_info_type_int \l_keys_choice_int
\tl_set:Nn \l_@@_info_type_tl
{ \clist_item:Nn \c_@@_name_type_clist { \l_@@_info_type_int } }
{ \tl_use:c { c_@@_name_ \l_@@_info_diploma_tl _tl } }
},
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{nlcover}
nlcover .bool_set:N = \g_@@_nlcover_bool,
nlcover .initial:n = false,
%
% \begin{macro}{orig-decl}
% \changes{v0.13}{2021/12/15}{新增诚信承诺书选项。}
% 是否需要诚信承诺书或原创性声明(默认关闭)。
% \begin{macrocode}
orig-decl .bool_set:N = \g_@@_orig_decl_bool,
orig-decl .initial:n = false,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{draft}
% \changes{v0.13}{2021/12/15}{新增草稿模式选项。}
% 是否开启草稿模式(默认关闭)。
% \begin{macrocode}
draft .bool_set:N = \g_@@_draft_bool,
draft .initial:n = false,
% \end{macrocode}
% \changes{v0.14}{2021/12/12}{简化字体选项名称。}
% 定义字体选项。
{ gyre, mac, win, none }
{ \tl_set_eq:NN \g_@@_latin_font_tl \l_keys_choice_tl },
{ fandol, founder, mac, noto, source, win, none }
{ \tl_set_eq:NN \g_@@_cjk_font_tl \l_keys_choice_tl },
% \begin{macrocode}
\ProcessKeysOptions { nju }
% \end{macrocode}
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
% \subsection{用户接口}
%
% \begin{macro}{info,bib}
% 定义元(meta)键值对。
% \begin{macrocode}
\keys_define:nn { nju }
{
info .meta:nn = { nju / info } { #1 },
bib .meta:nn = { nju / bib } { #1 }
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\njusetup}
% \changes{v0.6}{2021/09/10}{改用键值对输入信息。}
% 定义用于设置信息的命令。
% \begin{macrocode}
\NewDocumentCommand \njusetup { m } { \keys_set:nn { nju } { #1 } }
% \end{macrocode}
% \end{macro}
%
%
% \subsection{配置常量}
% TODO: 分离为单独文件
% 通用默认名称。注意空格是忽略掉的。
% \begin{macrocode}
\clist_map_inline:nn
{
{ acknowledgement } { 致\hspace{2em}谢 },
{ id } { 学号 },
{ orig_date } { 日期 },
{ paperlist } { 发表文章目录 },
{ pdf_creator } { LaTeX~ with~ njuthesis~ class },
{ preface } { 前\hspace{2em}言 },
{ supv_ii } { 第二导师 },
{ supv_ttl } { 职称 }
}
{ \@@_define_name:nn #1 }
% \end{macrocode}
%
% 定义同时使用到中英文名称的常量。
% \begin{macrocode}
\clist_map_inline:nn
{
{ abstract } { 摘要 } { ABSTRACT },
{ keywords } { 关键词: } { Keywords:~ },
{ lang } { 中文 } { 英文 },
{ nju } { 南京大学 } { Nanjing~ University },
{ table } { 表 } { table }
}
{ \@@_define_name:nnn #1 }
% \end{macrocode}
%
% 针对学位的特定名称。需要放在 \cs{ProcessKeysOptions} 导入设置选项后,以使用学位信息。
% \begin{macrocode}
{
% \end{macrocode}
% 本科默认名称。
% \begin{macrocode}
\clist_map_inline:nn
{
{ author_full } { 本科生姓名 },
{ grade } { 年级 },
{ orig_decl } { 本科毕业论文(设计)诚信承诺书 },
{ orig_sign } { 作者签名 },
{ sm_date } { 提交日期 },
{ supv } { 导师 },
{ title } { 题目 },
{ type } { 本科生毕业论文(设计、作品) },
{ ug } { 本科 }
{ author } { 学生姓名 } { UNDERGRADUATE },
{ major } { 专业 } { SPECIALIZATION },
{ supv_full } { 指导教师(姓名、职称) } { MENTOR }
% \end{macrocode}
%
% \begin{variable}{\c_@@_orig_decl_text_tl}
% 学位论文诚信承诺书。
% \begin{macrocode}
\tl_const:Nn \c_@@_orig_decl_text_tl
{
本人郑重承诺:所呈交的毕业论文(设计)(题目:)是在指导教师的指导下
严格按照学校和院系有关规定由本人独立完成的。本毕业论文(设计)中引用
他人观点及参考资源的内容均已标注引用,如出现侵犯他人知识产权的行为,
由本人承担相应法律责任。本人承诺不存在抄袭、伪造、篡改、代写、买卖毕
业论文(设计)等违纪行为。
}
% 研究生默认名称。
% \begin{macrocode}
{
\clist_map_inline:nn
{
{ chairman } { 答辩委员会主席: },
{ clc } { 分类号 },
{ confer } { 学位授予单位和日期 },
{ df_date } { 论文答辩日期 },
{ degree } { 申请学位级别 },
{ degree_l } { (申请 },
{ degree_r } { 学位) },
{ field } { 研究方向 },
{ g } { 研究生 },
{ grade } { 级 },
{ major_s } { 专业 },
{ major_nl } { 专业名称 },
{ reviewer } { 评阅人: },
{ seclv } { 密级 },
{ sign } { (签字) },
{ sm_date } { 论文提交日期 },
{ supv } { 导师 },
{ supv_r } { (姓名、职称) },
{ supv_info } { 指导教师姓名、职务、
职称、学位、单位名称及地址 },
{ title } { 论文题目 },
{ title_nl } { (题名和副题名) },
{ title_s } { 题目 },
{ udc } { U D C }
% \begin{variable}{\c_@@_cover_en_text_tl}
% 英文封面字样。
\tl_const:Nn \c_@@_cover_en_text_tl
{
A~ dissertation~ submitted~ to \\
the~ graduate~ school~ of~ Nanjing~ University \\
in~ partial~ fulfilment~ of~ the~ requirements~ for~ the~ degree~ of
}
%
% \begin{variable}{\c_@@_orig_decl_text_tl}
% 学位论文原创性声明。
% \begin{macrocode}
\tl_const:Nn \c_@@_orig_decl_text_tl
{
本人郑重声明,所提交的学位论文是本人在导师指导下独立进行科学研究工作
所取得的成果。除本论文中已经注明引用的内容外,本论文不包含其他个人或
集体已经发表或撰写过的研究成果,也不包含为获得南京大学或其他教育机构
的学位证书而使用过的材料。对本文的研究做出重要贡献的个人和集体,均已
在论文的致谢部分明确标明。本人郑重申明愿承担本声明的法律责任。
}
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
% \begin{variable}{\c_@@_theorem_type_clist}
% 默认定理类型。
% \begin{macrocode}
\clist_const:Nn \c_@@_theorem_type_clist
{ axiom, corollary, definition, example, lemma, theorem }
% \end{macrocode}
% \end{variable}
%
% 默认定理头名称。
% \begin{macrocode}
\clist_map_inline:nn
{
{ axiom } { 公理 } { Axiom },
{ corollary } { 推论 } { Corollary },
{ definition } { 定义 } { Definition },
{ example } { 例 } { Example },
{ lemma } { 引理 } { Lemma },
{ proof } { 证明 } { Proof },
{ theorem } { 定理 } { Theorem }
}
{ \@@_define_name:nnn #1 }
% \end{macrocode}
% \begin{macro}{info/keywords,info/keywords*}
keywords .clist_set:N = \l_@@_info_keywords_clist,
keywords* .clist_set:N = \l_@@_info_keywords_en_clist,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{info/grade,info/student-id,info/author,info/author*}
grade .tl_set:N = \l_@@_info_grade_tl,
student-id .tl_set:N = \l_@@_info_id_tl,
author .tl_set:N = \l_@@_info_author_tl,
author* .tl_set:N = \l_@@_info_author_en_tl,
% \begin{macro}{info/department,info/department*,info/major,info/major*,info/field,info/field*}
department .tl_set:N = \l_@@_info_dept_tl,
department* .tl_set:N = \l_@@_info_dept_en_tl,
major .tl_set:N = \l_@@_info_major_tl,
major* .tl_set:N = \l_@@_info_major_en_tl,
field .tl_set:N = \l_@@_info_field_tl,
field* .tl_set:N = \l_@@_info_field_en_tl,
% \begin{macro}{info/supervisor,info/supervisor*,info/supervisor-title,info/supervisor-title*}
supervisor .tl_set:N = \l_@@_info_supv_tl,
supervisor* .tl_set:N = \l_@@_info_supv_en_tl,
supervisor-title .tl_set:N = \l_@@_info_supv_ttl_tl,
supervisor-title* .tl_set:N = \l_@@_info_supv_ttl_en_tl,
% \begin{macro}{info/supervisor-ii,info/supervisor-ii*,info/supervisor-ii-title,info/supervisor-ii-title*}
supervisor-ii .tl_set:N = \l_@@_info_supv_ii_tl,
supervisor-ii* .tl_set:N = \l_@@_info_supv_ii_en_tl,
supervisor-ii-title .tl_set:N = \l_@@_info_supv_ii_ttl_tl,
supervisor-ii-title*.tl_set:N = \l_@@_info_supv_ii_ttl_en_tl,
% \begin{macro}{info/submit-date,info/submit-date*}
% \begin{macro}{info/defend-date,info/chairman,info/reviewer}
chairman .tl_set:N = \l_@@_info_chairman_tl,
reviewer .clist_set:N = \l_@@_info_reviewer_clist,
% \begin{macro}{info/clc,info/secret-level,info/udc,info/supervisor-contact}
clc .tl_set:N = \l_@@_info_clc_tl,
secret-level .tl_set:N = \l_@@_info_seclv_tl,
udc .tl_set:N = \l_@@_info_udc_tl,
supervisor-contact .tl_set:N = \l_@@_info_supv_cont_tl,
\bool_set:Nn \l_@@_second_supv_bool
{ ! \tl_if_empty_p:N \l_@@_info_supv_ii_tl }
\bool_if:NT \l_@@_second_supv_bool
{
\@@_quad: \l_@@_info_supv_ii_tl
\l_@@_info_supv_en_tl
\bool_if:NT \l_@@_second_supv_bool
{
%
% \changes{v0.12}{2021/12/07}{重新组织宏包载入顺序。}
% 将选项传入 \cls{ctexbook} 文档类。
\PassOptionsToClass
{
a4paper,
twoside,
UTF8,
scheme=chinese,
% 开启草稿模式后传入 |draft| 选项。
% \begin{macrocode}
\bool_if:NT \g_@@_draft_bool { draft, }
% \end{macrocode}
% 关于行距,\hologo{LaTeX} 默认1.2行距,word 默认行距是1.3,要求1.5倍 word 行距,故
linespread=1.625,
% \end{macrocode}
% 默认不载入任何字体,供本模板自行设置。
% \begin{macrocode}
fontset=none,
% \end{macrocode}
% 正文字体设置为小四号。
% \begin{macrocode}
zihao=-4
}
{ ctexbook }
%
% 传入各宏包选项。
% \begin{macrocode}
\clist_map_inline:nn
{
{ no-math } { fontspec },
{ perpage } { footmisc },
{ amsmath, thmmarks } { ntheorem },
{ hyphens } { url },
{ warnings-off={ mathtools-colon, mathtools-overbracket } }
{ unicode-math },
{ capitalise, nameinlink, noabbrev }
}
{ \PassOptionsToPackage #1 }
% \end{macrocode}
%
% 使用\pkg{ctexbook}作为基础文档类。
% \end{macrocode}
% \pkg{emptypage} 用于清除空白页的页码。
% \begin{macrocode}
emptypage,
% \end{macrocode}
% 南京大学视觉形象化标准宏包 \pkg{njuvisual} 用于绘制学校 logo。
% \begin{macrocode}
njuvisual,
% \changes{v0.13}{2021/12/13}{使用 \pkg{ntheorem} 创建定理环境,删除 \pkg{amsthm} 和 \pkg{thmtools}。}
% 数学,\pkg{amsmath} 必须在 \pkg{unicode-math} 前加载。
% \pkg{unicode-math} 指定了 \hologo{XeTeX} 和 \hologo{LuaTeX} 下所使用的数学字体。
% 用于配置数学环境的 \pkg{mathtools} 会与 \pkg{unicode-math} 发生冲突,此处手动消除其警告。
% \changes{v0.14}{2021/12/21}{移除内置的 \pkg{multirow}、\pkg{subcaption} 和 \pkg{wrapfig}。}
% \end{macrocode}
% \pkg{url} 用于生成链接文本。
% \begin{macrocode}
url,
% \end{macrocode}
% 按以下顺序加载两个关于引用的包。
% \pkg{hyperref} 覆写了大量命令,因此需要在其他包最后载入。
% 仅有 \pkg{cleveref} 需要在 \pkg{hyperref} 后载入,否则会报错。
% \begin{macrocode}
hyperref,
cleveref
}
% \changes{v0.13}{2021/12/13}{删除会与 \pkg{ntheorem} 冲突的 \pkg{microtype}。}
% \begin{macro}{\njuline}
% 针对编译引擎,使用不同的宏包构建可以对中文正常换行的下划线命令。
\NewDocumentCommand \njuline { m } { \CJKunderline{#1} }
}
\NewDocumentCommand \njuline { m } { \underLine{#1} \null }
}
% \begin{macro}{\@@_check_package:nnn}
% 检查过时宏包。
% \begin{macrocode}
\msg_new:nnn { njuthesis } { package-too-old }
{
Package~ "#1"~ is~ too~ old. \\
The~ njuthesis~ class~ only~ supports~ "#1"~ with~
a~ version higher~ than~ v#2.\\
Please~ update~ an~ up-to-date~ version~ of~ it~
}
\cs_new_protected:Npn \@@_check_package:nnn #1#2#3
{
\@ifpackagelater {#1} {#2}
{ } { \msg_error:nnnn { njuthesis } { package-too-old } {#1} {#3} }
}
% \end{macrocode}
% \end{macro}
%
% 检查绘制下划线所需的 \pkg{luatexja} 包版本。该宏包在2021-09-18的更新解决了下划线中断问题,然而在2021-10-24的更新才提供了正确的内嵌日期。
{ \@@_check_package:nnn { luatexja } { 2021/10/24 } { 20211024.0 } }
\tl_if_empty:NTF \g_@@_latin_font_tl
{ \bool_gset_true:N \g_@@_load_sys_font_bool }
\tl_if_empty:NT \g_@@_cjk_font_tl
{ \bool_gset_true:N \g_@@_load_sys_font_bool }
% \end{macrocode}
%
% 进行系统检测。
% 检测 Windows 的命令由\pkg{l3kernal}提供,
% 检测 macOS 的命令由\pkg{ctex}提供,
% 这两种情况外的系统被判断为 Linux,一律使用自由字体。
% \begin{macrocode}
{ \tl_set:Nn \g_@@_latin_font_tl { win }
\tl_set:Nn \g_@@_cjk_font_tl { win } }
{ \tl_set:Nn \g_@@_latin_font_tl { mac }
\tl_set:Nn \g_@@_cjk_font_tl { mac } }
{ \tl_set:Nn \g_@@_latin_font_tl { gyre }
\tl_set:Nn \g_@@_cjk_font_tl { fandol } } }
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Courier~New}[Scale=MatchLowercase]
}
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Menlo}[Scale=MatchLowercase]
}
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
{
\setmainfont{texgyretermes}[
Extension=.otf,
UprightFont=*-regular,
BoldFont=*-bold,
ItalicFont=*-italic,
BoldItalicFont=*-bolditalic]
\setsansfont{texgyreheros}[
Extension=.otf,
UprightFont=*-regular,
BoldFont=*-bold,
ItalicFont=*-italic,
BoldItalicFont=*-bolditalic]
\setmonofont{texgyrecursor}[
Extension=.otf,
UprightFont=*-regular,
BoldFont=*-bold,
ItalicFont=*-italic,
BoldItalicFont=*-bolditalic,
Scale=MatchLowercase,
Ligatures=CommonOff]
}
\setCJKmainfont { SimSun }
[ AutoFakeBold = 2.17, ItalicFont = KaiTi ]
\setCJKsansfont { SimHei } [ AutoFakeBold = 2.17 ]
\setCJKmonofont { FangSong } [ AutoFakeBold = 2.17 ]
\setCJKfamilyfont { zhsong } { SimSun } [ AutoFakeBold = 2.17 ]
\setCJKfamilyfont { zhhei } { SimHei } [ AutoFakeBold = 2.17 ]
\setCJKfamilyfont { zhfs } { FangSong } [ AutoFakeBold = 2.17 ]
\setCJKfamilyfont { zhkai } { KaiTi } [ AutoFakeBold = 2.17 ]
% \end{macrocode}
% 移除 does not contain script "CJK" 警告。
% \begin{macrocode}
\msg_redirect_name:nnn { fontspec } { no-script } { info }
\setCJKmainfont{Songti~SC~Light}[
BoldFont=Songti~SC~Bold,
ItalicFont=Kaiti~SC,
BoldItalicFont=Kaiti~SC~Bold]
\setCJKsansfont{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium]
\setCJKmonofont{STFangsong}
\setCJKfamilyfont{zhsong}{Songti~SC~Light}[BoldFont=Songti~SC~Bold]
\setCJKfamilyfont{zhhei}{Heiti~SC~Light}[BoldFont=Heiti~SC~Medium]
\setCJKfamilyfont{zhfs}{STFangsong}
\setCJKfamilyfont{zhkai}{Kaiti~SC}[BoldFont=Kaiti~SC~Bold]
\setCJKfamilyfont{zhnewhei}{PingFang~SC}
}
% \begin{macro}{\@@_load_cjk_font_fandol:}
% Fandol 字体
\msg_redirect_name:nnn {fontspec} {no-script} {info}
\setCJKmainfont{FandolSong-Regular}[
Extension=.otf,
BoldFont=FandolSong-Bold,
ItalicFont=FandolKai-Regular]
\setCJKsansfont{FandolHei-Regular}[
Extension=.otf,
BoldFont=FandolHei-Bold]
\setCJKmonofont{FandolFang-Regular}[Extension=.otf]
\setCJKfamilyfont{zhsong}{FandolSong-Regular}[
Extension=.otf,
BoldFont=FandolSong-Bold]
\setCJKfamilyfont{zhhei}{FandolHei-Regular}[
Extension=.otf,
BoldFont=FandolHei-Bold]
\setCJKfamilyfont{zhfs}{FandolFang-Regular}[Extension=.otf]
\setCJKfamilyfont{zhkai}{FandolKai-Regular}[
Extension=.otf,
AutoFakeBold=2.17]
}
%
% \begin{macro}{\@@_load_cjk_font_founder:}
\sys_if_engine_luatex:T
{
% \end{macrocode}
% 在 LuaTeX 中调整方正字体括号位置
% XeTeX 暂无好的解决方法
% \begin{macrocode}
\defaultCJKfontfeatures{JFM={zh_CN/{quanjiao,fzpr}}}
}
[ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ]
\setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ]
\setCJKmonofont { FZFangSong-Z02 }
\setCJKfamilyfont { zhsong } { FZShuSong-Z01 }
[ BoldFont = FZXiaoBiaoSong-B05 ]
\setCJKfamilyfont { zhhei } { FZHei-B01 }
[AutoFakeBold=2.17]
\setCJKfamilyfont { zhkai } { FZKai-Z03 }
[AutoFakeBold=2.17]
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 }
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
\setCJKmainfont
[
UprightFont = NotoSerifCJKsc-Regular,
BoldFont = NotoSerifCJKsc-Bold,
ItalicFont = NotoSerifCJKsc-Regular,
BoldItalicFont = NotoSerifCJKsc-Bold,
ItalicFeatures = FakeSlant,
BoldItalicFeatures = FakeSlant
] { Noto~Serif~CJK~SC }
\setCJKsansfont
[
UprightFont = NotoSansCJKsc-Regular,
BoldFont = NotoSansCJKsc-Bold,
ItalicFont = NotoSansCJKsc-Regular,
BoldItalicFont = NotoSansCJKsc-Bold,
ItalicFeatures = FakeSlant,
BoldItalicFeatures = FakeSlant
] { Noto~Sans~CJK~SC }
\setCJKmonofont { Noto~Sans~Mono~CJK~SC }
\setCJKfamilyfont { zhsong } { Noto~Serif~CJK~SC }
\setCJKfamilyfont { zhhei } { Noto~Sans~CJK~SC }
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 }
\setCJKfamilyfont { zhkai } { FZKai-Z03 }
[AutoFakeBold=2.17]
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_load_cjk_font_source:}
% \changes{v0.14}{2021/12/20}{增加 Adobe Source Han 作为思源字体。}
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
% Source Han 思源字体。
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_cjk_font_source:
{
\setCJKmainfont
[
UprightFont = SourceHanSerifSC-Regular,
BoldFont = SourceHanSerifSC-Bold,
ItalicFont = SourceHanSerifSC-Regular,
BoldItalicFont = SourceHanSerifSC-Bold,
ItalicFeatures = FakeSlant,
BoldItalicFeatures = FakeSlant
] { Source~Han~Serif~SC }
\setCJKsansfont
[
UprightFont = SourceHanSansSC-Regular,
BoldFont = SourceHanSansSC-Bold,
ItalicFont = SourceHanSansSC-Regular,
BoldItalicFont = SourceHanSansSC-Bold,
ItalicFeatures = FakeSlant,
BoldItalicFeatures = FakeSlant
] { Source~Han~Sans~SC }
\setCJKmonofont { FZFangSong-Z02 }
\setCJKfamilyfont { zhsong } { Source~Han~Serif~SC }
\setCJKfamilyfont { zhhei } { Source~Han~Sans~SC }
\setCJKfamilyfont { zhfs } { FZFangSong-Z02 }
\setCJKfamilyfont { zhkai } { FZKai-Z03 }
[AutoFakeBold=2.17]
% \subsubsection{定义数学字库}
%
% \begin{macro}{\@@_load_math_font:}
% 设置数学字体 (XITS, 或者 \href{https://www.stixfonts.org}{STIX}, 与 Times New Roman 最为相近)
% 通用数学字体。
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_math_font:
{
% \setmathfont{STIXTwoMath-Regular}[Extension = .otf]
\setmathfont{XITSMath-Regular}[
BoldFont = XITSMath-Bold,
Extension = .otf]
\setmathfont{NewCMMath-Regular.otf}[range={cal,bb,frak}]
\setmathfont{NewCMMath-Regular.otf}[version=bold,range={bfcal}]
}
% \end{macrocode}
% \end{macro}
%
%
\use:c { @@_load_latin_font_ \g_@@_latin_font_tl : }
\use:c { @@_load_cjk_font_ \g_@@_cjk_font_tl : }
% \changes{v0.10}{2021/09/28}{修正了数学字体。}
% \begin{macrocode}
\NewDocumentCommand \songti { } { \CJKfamily { zhsong } }
\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } }
\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } }
\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } }
% \end{macrocode}
% 重定义字号命令。
% \begin{macrocode}
\RenewDocumentCommand \large { } { \zihao { 4 } }
% 载入设置的字体。此处设置与文档类一同载入,否则在导言区后载入字体可能导致一部分覆盖字体的命令失效。
% \BeforeBeginEnvironment { document } { \@@_load_font: }
\@@_load_font:
\geometry
{
vmargin = 2.5 cm,
hmargin = 3.2 cm,
headheight = 15 pt
}
% 草稿模式下显示页面文字范围边界以及页眉、页脚线。
% \begin{macrocode}
\bool_if:NT \g_@@_draft_bool { \geometry { showframe } }
% \end{macrocode}
%
\fancypagestyle { plain }
{
\fancyhf { }
\fancyfoot [ C ] { \zihao{5} \thepage }
\RenewDocumentCommand \headrulewidth { } { 0 pt }
\RenewDocumentCommand \footrulewidth { } { 0 pt }
}
\fancypagestyle{headings}
{
\fancyhf { }
\fancyhead [ CO ] { \leftmark }
\fancyhead [ CE ] { \rightmark }
\fancyfoot [ C ] { \zihao{5} \thepage }
\RenewDocumentCommand \headrulewidth { } { 0.4 pt }
\RenewDocumentCommand \footrulewidth { } { 0 pt }
% \begin{macro}{\frontmatter}
% 重定义 \cs{frontmatter},清空页眉页脚以及页码设置。
% 此命令仅为解决原 \cls{book} 类中使用小写罗马字母序号的冲突,并不建议使用。
\RenewDocumentCommand \frontmatter { }
{
\cleardoublepage
\pagestyle{empty}
\pagenumbering{Roman}
}
% \changes{v0.12}{2021/12/03}{修复了摘要页字体格式泄漏到正文的问题。}
% \changes{v0.12}{2021/12/03}{修复了页眉上长标题重叠的问题。}
% 重定义 \cs{mainmatter},在论文主体部分载入页眉页脚设置,并重新进行数字编号。
% \begin{macrocode}
\RenewDocumentCommand \mainmatter { }
{
\cleardoublepage
\pagenumbering{arabic}
\normalfont\normalsize
}
% \end{macrocode}
% \end{macro}
\tl_const:Nn \c_@@_sec_format_tl { \large \normalfont \sffamily }