diff --git a/njuthesis.cls b/njuthesis.cls index 1b0c306..8a847e4 100644 --- a/njuthesis.cls +++ b/njuthesis.cls @@ -1,12 +1,12 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{njuthesis} +\ProvidesClass{njuthesis}[2021/09/10 NJU Thesis Undergraduate LaTeX Template] \RequirePackage{kvoptions} \SetupKeyvalOptions{ family=njuthesis, - prefix=,% 故意留空防止出现大量@,但估计要发布CTAN还得加回去 + prefix=nju@,% 故意留空防止出现大量@,但估计要发布CTAN还得加回nju@。 setkeys=\kvsetkeys } @@ -20,12 +20,12 @@ zihao=-4 ]{ctexbook}[2018/04/01] -\DeclareStringOption[1]{TitleLength} -\DeclareStringOption[UG]{Degree} -\DeclareStringOption[thesis]{Type} -\DeclareBoolOption[true]{UseSysFont} -\DeclareStringOption[windows]{CustomEnFont} -\DeclareStringOption[windows]{CustomZhFont} +\DeclareStringOption[1]{titlelength} +\DeclareStringOption[UG]{degree} +\DeclareStringOption[thesis]{type} +\DeclareBoolOption[true]{systemfont} +\DeclareStringOption[windows]{customlatinfont} +\DeclareStringOption[windows]{customchinesefont} \ProcessKeyvalOptions*\relax diff --git a/njuthesis.tex b/njuthesis.tex index 64dc5b8..83718ee 100644 --- a/njuthesis.tex +++ b/njuthesis.tex @@ -1,7 +1,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % NJU Thesis Undergraduate % 南京大学本科生毕业论文LaTeX模板 -% Version 0.4.0 (2021-09-10) +% Version 0.4.1 (2021-09-10) % % 请关注项目地址以获取最新变化 % https://github.com/nju-lug/NJUThesisUndergraduate @@ -16,12 +16,12 @@ % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[ - TitleLength=2,% 选择标题行数,范围是1~3 - Degree=UG,% UG: 本科 - Type=thesis,% thesis: 毕业论文,design: 毕业设计 - % UseSysFont=false,% 自定义字体请反注释此项 - % CustomEnFont=windows,% 设置英文字符集 - % CustomZhFont=windows,% 设置中文字符集 + titlelength=2,% 选择标题行数,范围是1~3 + % degree=UG,% UG: 本科 + type=thesis,% thesis: 毕业论文,design: 毕业设计 + systemfont=false,% 自定义字体请反注释此项 + customlatinfont=windows,% 设置英文字符集 + customchinesefont=windows,% 设置中文字符集 ]{njuthesis} % 输入个人信息 diff --git a/profile/cover.sty b/profile/cover.sty index 7e1d402..424c178 100644 --- a/profile/cover.sty +++ b/profile/cover.sty @@ -41,7 +41,7 @@ \coverbox:n {专\hfill 业} & \cover_underline:nn {250pt}{\songti\Major}\\ - \int_case:nn {\TitleLength} + \int_case:nn {\nju@titlelength} { { 1 } { \coverbox:n {题\hfill 目} @@ -91,10 +91,10 @@ } % 判断类型 -\str_if_eq:eeTF {\Degree} {UG} +\str_if_eq:eeTF {\nju@degree} {UG} {\tl_const:Nn \Degreename {本\hfill 科\hfill }}{} -\str_if_eq:eeTF {\Type} {thesis} +\str_if_eq:eeTF {\nju@type} {thesis} {\tl_const:Nn \typename {\Degreename 毕\hfill 业\hfill 论\hfill 文}} {\tl_const:Nn \typename {\Degreename 毕\hfill 业\hfill 设\hfill 计}} diff --git a/profile/font.sty b/profile/font.sty index 8836a08..6e1751e 100644 --- a/profile/font.sty +++ b/profile/font.sty @@ -152,7 +152,7 @@ } % 根据操作系统选择相应字体 -\ifUseSysFont +\ifnju@systemfont % 检测是否是 Windows \sys_if_platform_windows:TF { @@ -173,29 +173,22 @@ } } \else% 如果用户需要自定义 -% tl_case:Nn 只能实现宏和宏之间的比较,不能直接实现字符串和宏的比较,无奈出此下策,希望之后能找到更优雅的写法 -\tl_const:Nn \usingwindows {windows} -\tl_const:Nn \usingmacos {macos} -\tl_const:Nn \usingfandol {fandol} -\tl_const:Nn \usinggyre {gyre} -\tl_const:Nn \usingfounder {founder} -\tl_const:Nn \usingnoto {noto} -\tl_const:Nn \usingnull {null} -\tl_case:Nn {\CustomEnFont} +% 此处需要使用\str_case_e而不是\str_case使宏展开为字符串 +\str_case_e:nn { \nju@customlatinfont } { - \usingwindows{\set_latin_fontset_windows} - \usingmacos{\set_latin_fontset_macos} - \usinggyre{\set_latin_fontset_gyre} - \usingnull{} + { windows } { \set_latin_fontset_windows } + { macos} { \set_latin_fontset_macos } + { gyre } { \set_latin_fontset_gyre } + { null } {} } -\tl_case:Nn {\CustomZhFont} +\str_case_e:nn { \nju@customchinesefont } { - \usingwindows{\set_chinese_fontset_windows} - \usingmacos{\set_chinese_fontset_macos} - \usingfandol{\set_chinese_fontset_fandol} - \usingfounder{\set_chinese_fontset_founder}% 使用方正字体 - \usingnoto{\set_chinese_fontset_noto}% 使用思源宋体+思源黑体 - \usingnull{} + { windows } { \set_chinese_fontset_windows } + { macos} { \set_chinese_fontset_macos } + { gyre } { \set_chinese_fontset_gyre } + { founder } { \set_chinese_fontset_founder } + { noto } { \set_chinese_fontset_noto } + { null } {} } \fi % 我是 Linux 用户,但我用 Windows 字体(请您赶快坐到主席台上来)