Newer
Older
% 指定宽度的双层下划线。
% \begin{arguments}
% \item 宽度,|dim| 型变量
% \end{arguments}
\cs_new_protected:Npn \@@_uuline:n #1
{
\mode_leave_vertical:
\rule [ -0.5 ex ] { #1 } { 0.4 pt }
\skip_horizontal:n { -#1 }
\rule [ -0.6 ex ] { #1 } { 0.4 pt }
\skip_horizontal:n { -#1 }
}
% \begin{macro}{\@@_get_text_width:Nn,\@@_get_text_width:NV}
% 获取文本宽度。
% \begin{arguments}
% \item 存储宽度的 |dim| 型变量
% \item 文本
% \end{arguments}
% 将内容放入 \tn{hbox} 后读取其宽度,存入 |dim| 型变量。
\hbox_set:Nn \l_@@_tmp_box {#2}
\dim_set:Nn #1 { \box_wd:N \l_@@_tmp_box }
}
\cs_generate_variant:Nn \@@_get_text_width:Nn { NV }
% \end{macro}
%
% \begin{macro}{\@@_full_uline:Nn,\@@_full_uline:NV}
% 横跨整页的下划线。
% \begin{arguments}
% \item 宽度,|dim| 型变量
% \item 文本
% \end{arguments}
% 先使用 \cs{@@_get_text_width:Nn} 获取文本内容宽度,该宽度存储在调用的 |dim| 型变量中。随后输出文本内容。
% \begin{macrocode}
\cs_new_protected:Npn \@@_full_uline:Nn #1#2
{
\@@_get_text_width:Nn #1 { #2 }
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
}
\cs_generate_variant:Nn \@@_full_uline:Nn { NV }
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@@_uline_entry:nnnn}
% 生成占整页宽度的下划线条目。
% \begin{arguments}
% \item 宽度,|dim| 型变量
% \item 文本
% \item 文本
% \item 分隔符
% \end{arguments}
% \begin{macrocode}
\cs_new_protected:Npn \@@_uline_entry:nnnn #1#2#3#4
{
\@@_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
\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 } }
},
nlcover .bool_set:N = \g_@@_nlcover_bool,
nlcover .initial:n = false,
% \footnote{原创性声明的英文翻译为 Declaration of Originality,为了使选项表义更清晰同时缩减名称长度,将其修改为“声明页”这一名称。}
decl-page .bool_set:N = \g_@@_orig_decl_bool,
decl-page .initial:n = false,
% \begin{macro}{draft}
% \changes{v0.13}{2021/12/15}{新增草稿模式选项。}
% 是否开启草稿模式(默认关闭)。
% \begin{macrocode}
draft .bool_set:N = \g_@@_draft_bool,
draft .initial:n = false,
% \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}
bib .meta:nn = { nju / bib } { #1 },
info .meta:nn = { nju / info } { #1 },
style .meta:nn = { nju / style } { #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}
% 英文封面字样。
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
{
本人郑重声明,所提交的学位论文是本人在导师指导下独立进行科学研究工作
所取得的成果。除本论文中已经注明引用的内容外,本论文不包含其他个人或
集体已经发表或撰写过的研究成果,也不包含为获得南京大学或其他教育机构
的学位证书而使用过的材料。对本文的研究做出重要贡献的个人和集体,均已
在论文的致谢部分明确标明。本人郑重申明愿承担本声明的法律责任。
}
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
% \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,
% \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 }
\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 } }
{ \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 }
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Courier~New}[Scale=MatchLowercase]
}
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Menlo}[Scale=MatchLowercase]
}
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
{
\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 }
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
\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 作为思源字体。}
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
% 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: