Skip to content
Snippets Groups Projects
Commit 9dc733ea authored by Yu Xiong's avatar Yu Xiong :confounded:
Browse files

feat: 使用class选项控制字体

parent a20d5a55
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,8 @@
\SetupKeyvalOptions{
family=njuthesis,
prefix=
prefix=,% 故意留空防止出现大量@,但估计要发布CTAN还得加回去
setkeys=\kvsetkeys
}
\LoadClass[
......@@ -22,6 +23,8 @@
\DeclareStringOption[1]{TitleLength}
\DeclareStringOption[UG]{Degree}
\DeclareStringOption[thesis]{Type}
\DeclareBoolOption[true]{UseSysFont}
\DeclareStringOption[linux]{CustomChFont}\DeclareStringOption[linux]{CustomEnFont}
\ProcessKeyvalOptions*\relax
......
......@@ -18,8 +18,11 @@
\documentclass[
TitleLength=2,% 选择标题行数,范围是1~3
Degree=UG,% UG: 本科
Type=thesis% thesis: 毕业论文,design: 毕业设计
]{njuthesis}
Type=thesis,% thesis: 毕业论文,design: 毕业设计
% UseSysFont=false,% 自定义字体请反注释此项
% CustomChFont=linux,% 设置中文字符集
% CustomEnFont=linux,% 设置英文字符集
]{njuthesis}
% 输入个人信息
\input{coverinfo.tex}
......
......@@ -152,6 +152,7 @@
}
% 根据操作系统选择相应字体
\ifUseSysFont
% 检测是否是 Windows
\sys_if_platform_windows:TF
{
......@@ -171,17 +172,24 @@
\set_chinese_fontset_fandol
}
}
% 选择其他字体,请确保相应字体已安装并自行取消注释
% 使用方正字体
% \set_chinese_fontset_founder
% 使用思源宋体+思源黑体
% \set_chinese_fontset_noto
\else% 如果用户需要自定义
\str_case:nnTF {\CustomChFont}
{
{windows}{\set_chinese_fontset_windows}
{macos}{\set_chinese_fontset_macos}
{linux}{\set_chinese_fontset_fandol}
{founder}{\set_chinese_fontset_founder}% 使用方正字体
{noto}{\set_chinese_fontset_noto}% 使用思源宋体+思源黑体
}
\str_case:nnTF {\CustomEnFont}
{
{windows}{\set_latin_fontset_windows}
{macos}{\set_latin_fontset_macos}
{linux}{\set_latin_fontset_gyre}
}
\fi
% 我是 Linux 用户,但我用 Windows 字体(请您赶快坐到主席台上来)
% \set_latin_fontset_windows
% \set_chinese_fontset_windows
% 选择其他字体,请确保相应字体已安装
% 设置数学字体 (XITS, 或者 STIX, 与 Times New Roman 最为相近)
% \setmathfont{STIXTwoMath-Regular}[Extension = .otf]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment