Newer
Older
% 行间代码可以使用抄录环境 \tn{verb} (或者 \pkg{listings} 提供的 \tn{lstinline}),
% 格式如 |\verb!<code>!|。其中包裹代码的两个感叹号并不是绝对的,可以替换成任何两个相同的没有在这段代码中出现过的符号。
% 符号表可以参考\url{https://www.caam.rice.edu/~heinken/latex/symbols.pdf}。单位请参考\pkg{siunitx}。\pkg{siunitx}是一个更新频繁的包,可能会引发兼容性问题。
% 行内公式形如|$\mathrm{e}^{(a+2b)x}$|
%
% 带有编号的行间公式\env{equation}
% \begin{equation}\label{eq:myeqlabel}
% \pi
% \end{equation}
% \begin{definition}[他人]
% 定义他人即地狱
% \end{definition}
% \begin{function}{\cref}
% \begin{syntax}
% \tn{cref}\Arg{标签}
% \end{syntax}
%
% 使用\pkg{cleveref}宏包实现了带图、表等项目名称的智能引用。
%
% \end{function}
%
% \vspace{1cm}
% \begin{flushright}
% 我的名字\\
% 时间地点
% \end{flushright}
% \begin{function}{\tableofcontents,\listoffigures,\listoftables}
% 分别生成目录、图片清单和表格清单。
% \end{function}
% \begin{acknowledgement}
% 感谢NJU LUG
% \end{acknowledgement}
% \begin{function}{\appendix}
% 附录放在本命令后,以英文字母进行编号,编写方式同正文
% \end{function}
%
% \subsubsection{成果列表}
%
% \begin{function}{\njupaperlist,\njupaperlist*}
% \begin{syntax}
% \tn{njupaperlist}\Arg{文献}
% \end{syntax}
% 成果列表,分别为发表文章目录与合作文章目录。\Arg{文献}的填写方式同\tn{cite},多个文献需要使用英文半角逗号隔开。
% 符合GB7714-2015规范。使用\hologo{biber}作为后端。需要使用 |biber| 命令手动编译才会显示
% \begin{function}{\addbibresource}
% \begin{syntax}
% \tn{addbibresource}\Arg{文件}
% \end{syntax}
% 示例参考文献存储于 \file{njuthesis-sample.bib},直接向其中粘贴新的参考文献即可。如果希望额外添加参考文献列表,可以在导言区中多次调用 \tn{addbibresource} 命令。注意本命令与 |\bibliography{bibfile1,bibfile2}| 不同,不可以用逗号分隔多个输入文件,且必须使用带扩展名的完整文件名。
% \begin{function}{\printbibliography}
% 生成参考文献列表页面。
% \end{function}
% \begin{function}{\cite,\citeauthor,\citeyear}
% \begin{syntax}
% \tn{cite}\Arg{文献}
% \tn{citeauthor}\Arg{文献}
% \tn{citeyear}\Arg{文献}
% \end{syntax}
% 引用文献
% \end{function}
%
%
% \subsubsection{文献管理}
%
% \subparagraph{使用EndNote}
%
% 南京大学信息化建设管理服务中心已购买\href{https://itsc.nju.edu.cn/EndNote/list.htm}{EndNote}供全校师生免费试用,最新版为EndNote 20。
%
%
% \subparagraph{使用Zotero}
%
% \href{https://www.zotero.org/}{Zotero}是一款免费的文献管理软件,支持所有桌面平台。
%
% 在保持Zotero程序运行的情况下,点击浏览器工具栏的Zotero Connector插件即可自动从网页抓取参考文件信息。Zotero可以通过\href{https://github.com/l0o0/jasminum}{jasminum插件}支持中文参考文献的识别。在选中希望使用的文献后右键导出文献条目即可生成\file{.bib}文件。
%
% \begin{latexexample}[moretexcs={\njuemblem,\njuname}]
% \njuemblem{!}{3cm} % 生成指定大小的紫色南大校徽
% \njuname{4cm}{!} % 生成指定大小的紫色南大中文校名
% \njuname*{4cm}{!} % 生成指定大小的紫色南大英文校名
% \njuemblem[black]{!}{3cm} % 黑色的南大校徽
% \njuemblem[department=dii]{!}{4cm} % 紫色匡院徽标
% \njuemblem[department=cs,color=blue]{!}{3cm} % 纯蓝色计科徽标
% 本宏包的详细使用方法请参考其\href{http://mirrors.ctan.org/macros/latex/contrib/njuvisual/njuvisual.pdf}{说明文档}。
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
%
% \begin{thebibliography}{99}
%
% \newcommand\urlprefix{\newline\hspace*{\fill}}
% \let\OldUrl=\url
% \renewcommand\url[2][]{{\small\textit{#1}~\OldUrl{#2}}}
% \newcommand\CTANurl[2][]{{^^A
% \small\textit{#1}~\href{http://mirror.ctan.org/#2}{\texttt{CTAN://#2}}}}
%
% \bibitem{latexmk}
% \textsc{Collins J}.
% \newblock \textit{Fully automated \hologo{LaTeX} document generation} [EB/OL].
% \newblock version 4.76,
% \newblock (2021-11-20)
% \urlprefix\url{https://www.ctan.org/pkg/latexmk}
% \urlprefix\CTANurl[文档:]{support/latexmk/latexmk.pdf}
%
% \bibitem{lshort}
% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al.
% \newblock \textit{The Not So Short Introduction to \hologo{LaTeXe}: Or \hologo{LaTeXe} in 139 minutes} [EB/OL].
% \newblock version 6.4,
% \newblock (2021-03-09)
% \urlprefix\url{https://ctan.org/pkg/lshort-english}
% \urlprefix\CTANurl[文档:]{info/lshort/english/lshort.pdf}
%
% \bibitem{lshort-zh-cn}
% \textsc{Oetiker T}, \textsc{Partl H}, \textsc{Hyna I}, et al.
% \newblock \textit{一份(不太)简短的 \hologo{LaTeXe} 介绍: 或 111 分钟了解 \hologo{LaTeXe}} [EB/OL].
% \newblock \CTeX{} 开发小组, 译.
% \newblock 原版版本 version 6.4, 中文版本 version 6.03,
% \newblock (2021-11-21)
% \urlprefix\url{https://ctan.org/pkg/lshort-zh-cn}
% \urlprefix\CTANurl[文档:]{info/lshort/chinese/lshort-zh-cn.pdf}
%
% \end{thebibliography}
%
%
% 本模板使用 \hologo{LaTeX3} 语法编写,依赖 \pkg{expl3} 环境,
% 并需调用 \pkg{l3packages} 中的相关宏包。
%
% 以下代码中有一些形如 |<*class>|
% 的标记,这是 \pkg{DocStrip} 中的“guard”,用来选择性地提取文件。
% “|*|”和“|/|”分别表示该部分的开始和结束。不含
% “|*|”和“|/|”的 guard 出现在行号右侧,它们用来确定
% 单独一行代码的归属。这些 guard 的颜色深浅不一,用以明确嵌套关系。
%
% 另有若干包含 |@@| 的guard,用以表示名空间(模块)。
% 在删除注释生成格式文件时,变量名称中的 |@@| 会被等号后的字段替换,
% 譬如在本模板 \cls{njuthesis} 中 |@@=nju|。
% \changes{v0.12}{2021/12/03}{放宽对于 \pkg{l3packages} 的版本要求。}
Package~ "#1"~ is~ too~ old. \\
Please~ update~ an~ up-to-date~ version~ of~
the~ bundles "l3kernel"~ and~ "l3packages"~
{ } { \msg_error:nnn { njuthesis } { l3-too-old } {#1} }
}
% \end{macrocode}
%
% \begin{macrocode}
\msg_new:nnn { njuthesis } { unsupported-engine }
{
The~ njuthesis~ class~ requires~ either~
XeTeX~ or~ LuaTeX. \\
"#1"~ is~ not~ supported~ at~ present.~
You~ must~ change your~ typesetting~ engine~
}
\sys_if_engine_xetex:F
{
\sys_if_engine_luatex:F
{
\msg_fatal:nnx { njuthesis } { unsupported-engine }
{ \c_sys_engine_str }
}
}
% \end{macrocode}
%
% \begin{variable}{\l_@@_tmpa_clist,\l_@@_tmpb_clist,\l_@@_tmpa_seq,\l_@@_tmpa_tl,\l_@@_tmpb_tl}
% 临时变量。
% \begin{macrocode}
\clist_new:N \l_@@_tmpa_clist
\clist_new:N \l_@@_tmpb_clist
\seq_new:N \l_@@_tmpa_seq
\tl_new:N \l_@@_tmpa_tl
% \c_@@_name_degree_clist,\c_@@_name_degree_en_clist}
% 论文类型与学位类型。
% \begin{macrocode}
\clist_const:Nn \c_@@_name_type_clist
{ 毕业论文, 毕业设计 }
\clist_const:Nn \c_@@_name_type_en_clist
{ THESIS, DESIGN }
{ 学士, 硕士, 硕士专业, 博士 }
\clist_const:Nn \c_@@_name_degree_en_clist
{ Bachelor, Master, Master, Doctor~of~Philosophy }
% \begin{variable}{\g_@@_info_degree_int,\l_@@_info_type_tl,
% \g_@@_info_diploma_tl}
% 用于存储学位名称的变量。l代表局部变量,g代表全局变量。
\int_new:N \l_@@_info_diploma_int
\tl_new:N \g_@@_info_diploma_tl
% \begin{variable}{\l_@@_second_supv_bool}
% 定义用于判断是否有第二导师的变量。
% \begin{macrocode}
\bool_new:N \l_@@_second_supv_bool
% \end{macrocode}
% \end{variable}
%
% \begin{variable}{\l_@@_info_supv_full_tl,\l_@@_info_supv_full_en_tl}
% 用于存储导师姓名加职称的变量。
\tl_new:N \l_@@_info_supv_full_tl
\tl_new:N \l_@@_info_supv_full_en_tl
% \begin{variable}{\g_@@_load_system_fontset_bool}
% 定义用于判断是否需要载入系统预装字体的变量。
% \begin{macrocode}
\bool_new:N \g_@@_load_system_fontset_bool
% \end{macrocode}
% \end{variable}
%
% \begin{variable}{\g_@@_latin_fontset_tl,\g_@@_cjk_fontset_tl}
% 用于存储所使用字体名称的全局变量
\tl_new:N \g_@@_latin_fontset_tl
\tl_new:N \g_@@_cjk_fontset_tl
% \begin{macro}{\@@_quad:,\@@_qquad:}
% 等价于 \LaTeXe{} 中的 \tn{quad} 和 \tn{qquad}。
\cs_new:Nn \@@_quad: { \skip_horizontal:n { 1 em } }
\cs_new:Nn \@@_qquad: { \skip_horizontal:n { 2 em } }
% \begin{macro}{\@@_vskip:,\@@_hskip:}
% 生成一个较小的 skip。
\cs_new:Nn \@@_vskip: { \skip_vertical:n { 1 ex } }
\cs_new:Nn \@@_hskip: { \skip_horizontal:n { 0.3 em } }
%
% \begin{macro}{\@@_define_name:nn,\@@_define_name:nnn}
% 用来定义默认名称的辅助函数。
% \begin{macrocode}
\cs_new_protected:Npn \@@_define_name:nn #1#2
{ \tl_const:cn { c_@@_name_ #1 _tl } {#2} }
\cs_new_protected:Npn \@@_define_name:nnn #1#2#3
{
\tl_const:cn { c_@@_name_ #1 _tl } {#2}
\tl_const:cn { c_@@_name_ #1 _en_tl } {#3}
}
% \end{macrocode}
% \end{macro}
%
%
% \subsection{模板选项}
% \changes{v0.11}{2021/11/15}{进行了效率优化。}
\tl_set:Nn \l_@@_info_degree_tl
{ \clist_item:Nn \c_@@_name_degree_clist { \g_@@_info_degree_int } }
\int_compare:nTF { \g_@@_info_degree_int == 1 }
{ \tl_set:Nn \g_@@_info_diploma_tl { ug } }
{ \tl_set:Nn \g_@@_info_diploma_tl { g } } },
% \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_put_left:Nn \l_@@_info_type_tl
{ \tl_use:c { c_@@_name_ \g_@@_info_diploma_tl _tl } } },
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{nlcover}
% 是否需要国家图书馆封面的设置。
% \begin{macrocode}
nlcover .bool_set:N = \g_@@_nlcover_bool,
nlcover .initial:n = false,
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{customlatinfont,customchinesefont}
% 定义字体选项
% \begin{macrocode}
customlatinfont .choices:nn =
{ gyre, macos, windows, none }
{ \tl_set_eq:NN \g_@@_latin_fontset_tl \l_keys_choice_tl },
customchinesefont .choices:nn =
{ fandol, founder, macos, noto, windows, none }
{ \tl_set_eq:NN \g_@@_cjk_fontset_tl \l_keys_choice_tl },
}
% \begin{macrocode}
\ProcessKeysOptions { nju }
% \end{macrocode}
%
%
% \subsection{配置常量}
% TODO: 分离为单独文件
% 通用默认名称。注意空格是忽略掉的。
% \begin{macrocode}
\clist_map_inline:nn
{
{ id } { 学号 },
{ supv_ii } { 第二导师 },
{ supv_title } { 职称 },
{ submit_date } { 提交日期 },
{ pdf_creator } { LaTeX~ with~ njuthesis~ class }
}
{ \@@_define_name:nn #1 }
% \end{macrocode}
%
% 针对学位的特定名称。需要放在 \cs{ProcessKeysOptions} 导入设置选项后,以使用学位信息。
% \begin{macrocode}
\int_compare:nTF { \g_@@_info_degree_int == 1 }
{
% \end{macrocode}
% 本科默认名称。
% \begin{macrocode}
\clist_map_inline:nn
{
{ title } { 题目 },
{ ug } { 本科 },
{ supv } { 导师 },
{ author_full } { 本科生姓名 },
{ type } { 本科生毕业论文(设计、作品)}
\clist_map_inline:nn
{
{ author } { 学生姓名 } { UNDERGRADUATE },
{ major } { 专业 } { SPECIALIZATION },
{ supv_full } { 指导教师(姓名、职称) } { MENTOR }
}
{ \@@_define_name:nnn #1 }
}
% \end{macrocode}
% 研究生默认名称。
% \begin{macrocode}
{
\clist_map_inline:nn
{
{ g } { 研究生 },
{ supv } { 导师 },
{ title } { 论文题目 },
{ defend_date } { 论文答辩日期 },
{ degree_l } {(申请 },
{ degree_r } { 学位) },
{ sign } {(签字) },
{ abstract_r } { 摘要首页用纸 },
{ note }
{ A~ dissertation~ submitted~ to \\
the~ graduate~ school~ of~ Nanjing~ University \\
in~ partial~ fulfilment~ of~ the~ requirements~
for~ the~ degree~ of }
\clist_map_inline:nn
{
{ major } { 专业方向 } { SPECIALIZATION },
{ author } { 作者姓名 } { POSTGRADUATE },
{ supv_full } { 指导教师 } { MENTOR }
}
{ \@@_define_name:nnn #1 }
{ lang } { 中文 } { 英文 },
{ nju } { 南京大学 } { Nanjing University },
{ dept } { 院系 } { DEPARTMENT },
{ abstract } { 摘要 } { ABSTRACT },
{ keywords } { 关键词: } { Keywords:~ }
}
{ \@@_define_name:nnn #1 }
% \end{macrocode}
%
% \begin{variable}{\c_@@_orig_decl_text_tl}
% 学位论文原创性声明。
% \begin{macrocode}
\tl_const:Nn \c_@@_orig_decl_text_tl
{
本人郑重声明,所提交的学位论文是本人在导师指导下独立进行科学研究工作
所取得的成果。除本论文中已经注明引用的内容外,本论文不包含其他个人或
集体已经发表或撰写过的研究成果,也不包含为获得南京大学或其他教育机构
的学位证书而使用过的材料。对本文的研究做出重要贡献的个人和集体,均已
在论文的致谢部分明确标明。本人郑重申明愿承担本声明的法律责任。
}
% \end{macrocode}
% \end{variable}
\keys_define:nn { nju } { info.meta:nn = { nju / info } { #1 } }
title* .tl_set:N = \l_@@_info_title_en_tl,
titlea .code:n = { },
titleb .code:n = { },
titlec .code:n = { },
% \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_title_tl,
supervisor-title* .tl_set:N = \l_@@_info_supv_title_en_tl,
supervisora .code:n = { },
supervisora* .code:n = { },
supervisora-title .code:n = { },
supervisora-title* .code:n = { },
% \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_title_tl,
supervisor-ii-title*.tl_set:N = \l_@@_info_supv_ii_title_en_tl,
supervisorb .code:n = { },
supervisorb* .code:n = { },
supervisorb-title .code:n = { },
supervisorb-title* .code:n = { },
% \begin{macro}{info/submit-date,info/submit-date*}
submit-date .tl_set:N = \l_@@_info_submit_date_tl,
submit-date* .tl_set:N = \l_@@_info_submit_date_en_tl,
% \begin{macro}{info/defend-date,info/chairman,info/reviewer}
defend-date .tl_set:N = \l_@@_info_defend_date_tl,
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,
% \begin{macro}{\njusetup}
% \changes{v0.6}{2021/09/10}{改用键值对输入信息。}
% \changes{v0.11}{2021/10/01}{将个人信息变量名改为小写字母加连字符的形式。}
\NewDocumentCommand \njusetup { m } { \keys_set:nn { nju } { #1 } }
\bool_set:Nn \l_@@_second_supv_bool
{ ! \tl_if_empty_p:N \l_@@_info_supv_ii_tl }
\l_@@_info_supv_tl \@@_hskip:
\l_@@_info_supv_title_tl
\bool_if:NT \l_@@_second_supv_bool
{
\@@_quad: \l_@@_info_supv_ii_tl
\@@_hskip: \l_@@_info_supv_ii_title_tl
}
\l_@@_info_supv_title_en_tl \@@_hskip:
\l_@@_info_supv_en_tl
\bool_if:NT \l_@@_second_supv_bool
{
\@@_quad: \l_@@_info_supv_ii_title_en_tl
\@@_hskip: \l_@@_info_supv_ii_en_tl
}
%
% \changes{v0.12}{2021/12/07}{重新组织宏包载入顺序。}
% 将选项传入 \cls{ctexbook} 文档类。
\PassOptionsToClass
{
a4paper,
twoside,
UTF8,
scheme=chinese,
% 关于行距,\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 }
{ cleveref }
}
{ \PassOptionsToPackage #1 }
% \end{macrocode}
%
% 使用\pkg{ctexbook}作为基础文档类。
{
geometry,
caption,
setspace,
fancyhdr,
% \pkg{url} 用于生成链接文本。
% \begin{macrocode}
url,
% \end{macrocode}
% \pkg{emptypage} 用于清除空白页的页码。
% \begin{macrocode}
emptypage,
% \end{macrocode}
% 南京大学视觉形象化标准宏包 \pkg{njuvisual} 用于绘制学校 logo。
% \begin{macrocode}
njuvisual,
% 数学,\pkg{amsmath} 必须在 \pkg{unicode-math} 前加载。
% \pkg{unicode-math} 指定了 \hologo{XeTeX} 和 \hologo{LuaTeX} 下所使用的数学字体。
% 用于配置数学环境的 \pkg{mathtools} 会与 \pkg{unicode-math} 发生冲突,此处手动消除其警告。
amsmath,
amsthm,
mathtools,
thmtools,
unicode-math,
listings,
enumitem,
% \end{macrocode}
% 按以下顺序加载两个关于引用的包。
% \pkg{hyperref} 覆写了大量命令,因此需要在其他包最后载入。
% 仅有 \pkg{cleveref} 需要在 \pkg{hyperref} 后载入,否则会报错。
% \begin{macrocode}
hyperref,
cleveref
}
% \begin{macro}{\njuline}
% 针对编译引擎,使用不同的宏包构建可以对中文正常换行的下划线命令。
\sys_if_engine_xetex:T
{
\RequirePackage{xeCJKfntef,microtype}
\NewDocumentCommand \njuline { m } { \CJKunderline{#1} }
}
\sys_if_engine_luatex:T
{
\RequirePackage{lua-ul,dashundergaps}
\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 } }
% \begin{macrocode}
\tl_if_empty:NTF \g_@@_latin_fontset_tl
{
\tl_if_empty:NT \g_@@_cjk_fontset_tl
{ \bool_gset_true:N \g_@@_load_system_fontset_bool }
}
% \end{macrocode}
%
% 进行系统检测。
% 检测 Windows 的命令由\pkg{l3kernal}提供,
% 检测 macOS 的命令由\pkg{ctex}提供,
% 这两种情况外的系统被判断为 Linux,一律使用自由字体。
% \begin{macrocode}
{
\sys_if_platform_windows:TF
{ \tl_set:Nn \g_@@_latin_fontset_tl { windows }
\tl_set:Nn \g_@@_cjk_fontset_tl { windows } }
{ \ctex_if_platform_macos:TF
{ \tl_set:Nn \g_@@_latin_fontset_tl { macos }
\tl_set:Nn \g_@@_cjk_fontset_tl { macos } }
{ \tl_set:Nn \g_@@_latin_fontset_tl { gyre }
\tl_set:Nn \g_@@_cjk_fontset_tl { fandol } } }
%
% \begin{macro}{\@@_load_latin_font_windows:}
% Windows 西文字体
% \begin{macrocode}
\cs_new_protected:Npn \@@_load_latin_font_windows:
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Courier~New}[Scale=MatchLowercase]
}
{
\setmainfont{Times~New~Roman}
\setsansfont{Arial}
\setmonofont{Menlo}[Scale=MatchLowercase]
}
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
{
\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}
\setCJKmonofont{FangSong}
\setCJKfamilyfont{zhsong}{SimSun}[AutoFakeBold=2.17]
\setCJKfamilyfont{zhhei}{SimHei}
\setCJKfamilyfont{zhfs}{FangSong}
\setCJKfamilyfont{zhkai}{KaiTi}[AutoFakeBold=2.17]
}