Skip to content

Commit ff3cd61

Browse files
committed
Fix option
1 parent 3ac7ec8 commit ff3cd61

1 file changed

Lines changed: 28 additions & 20 deletions

File tree

ustcthesis.cls

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@
106106
{ \bool_set_true:N \l__ustc_degree_graduate_bool }
107107
\l__ustc_degree_hook_tl
108108
} ,
109+
fontset .choices:nn =
110+
{ auto , windows , mac , ubuntu , fandol , none }
111+
{ \str_set:NV \l__ustc_fontset_str \l_keys_choice_tl } ,
112+
output .choice: ,
113+
output / print .code:n =
114+
{ \bool_set_false:N \l__ustc_output_electronic_bool } ,
115+
output / electronic .code:n =
116+
{ \bool_set_true:N \l__ustc_output_electronic_bool } ,
109117
degree-type .choices:nn =
110118
{ academic , professional , engineering }
111119
{ \str_set:NV \l__ustc_degree_type_str \l_keys_choice_tl } ,
@@ -120,9 +128,6 @@
120128
} ,
121129
review .bool_set:N = \l__ustc_review_bool ,
122130
reviewer .bool_set:N = \l__ustc_reviewer_bool ,
123-
fontset .choices:nn =
124-
{ auto , windows , mac , ubuntu , fandol , none }
125-
{ \str_set:NV \l__ustc_fontset_str \l_keys_choice_tl } ,
126131
font .choices:nn =
127132
{ auto , times , termes , stix , xits , libertinus , newcm , lm , newtx , cm , none }
128133
{
@@ -182,11 +187,6 @@
182187
\str_set:NV \l__ustc_cite_style_str \l_keys_choice_tl
183188
\l__ustc_cite_style_hook_tl
184189
} ,
185-
output .choice: ,
186-
output / print .code:n =
187-
{ \bool_set_false:N \l__ustc_output_electronic_bool } ,
188-
output / electronic .code:n =
189-
{ \bool_set_true:N \l__ustc_output_electronic_bool } ,
190190
section-style .choice: ,
191191
section-style / chinese .code:n =
192192
{ \bool_set_true:N \l__ustc_section_style_chinese_bool } ,
@@ -202,18 +202,18 @@
202202
{ \bool_set_true:N \l__ustc_eqn_paren_style_full_bool } ,
203203
eqn-paren-style / half .code:n =
204204
{ \bool_set_false:N \l__ustc_eqn_paren_style_full_bool } ,
205-
unknown .code:n =
206-
{ \PassOptionsToClass { \CurrentOption } { ctexbook } } ,
205+
unknown .code:n = { \PassOptionsToClass { \CurrentOption } { ctexbook } } ,
207206
}
208207

209208
\keys_set:nn { ustc }
210209
{
211210
degree = doctor ,
211+
fontset = auto ,
212+
output = print ,
212213
degree-type = academic ,
213214
language = chinese ,
214215
review = false ,
215216
reviewer = false ,
216-
fontset = auto ,
217217
font = auto ,
218218
cjk-font = auto ,
219219
math-font = auto ,
@@ -264,11 +264,19 @@
264264
\ProcessKeysOptions { ustc }
265265
}
266266

267-
\keys_set:nn { ustc }
268-
{ unknown .undefine: }
267+
\clist_map_inline:nn { degree , fontset , output }
268+
{
269+
\keys_define:nn { ustc }
270+
{
271+
#1 .code:n = { \msg_error:nnnn { ustcthesis } { load-only } {##1} } ,
272+
}
273+
}
269274

270-
\bool_if:NT \l__ustc_output_electronic_bool
271-
{ \PassOptionsToClass { oneside } { ctexbook } }
275+
\msg_new:nnn { ustcthesis } { load-only }
276+
{ The~ '#1'~ option~ can~ only~ be~ used~ when~ loading~ the~ class. }
277+
278+
\keys_define:nn { ustc }
279+
{ unknown .undefine: }
272280

273281
\PassOptionsToPackage { no-math } { fontspec }
274282

@@ -283,7 +291,7 @@
283291
% 建议在模板开始处载入全部宏包,不要轻易改变加载顺序。
284292
% \pkg{hyperref} 一般在最后加载。
285293
\RequirePackage { amsmath }
286-
\RequirePackage { fontspec } [ 2017/03/31 ]
294+
\RequirePackage { fontspec }
287295
\RequirePackage { geometry }
288296
\RequirePackage { graphicx }
289297
\RequirePackage { fancyhdr }
@@ -604,14 +612,14 @@
604612
\str_if_eq:VnT \l__ustc_fontset_str { auto }
605613
{
606614
\sys_if_platform_windows:TF
607-
{ \ustcsetup { fontset = windows } }
615+
{ \str_set:Nn \l__ustc_fontset_str { windows } }
608616
{
609617
\fontspec_font_if_exist:nTF { SimSun }
610-
{ \ustcsetup { fontset = windows} }
618+
{ \str_set:Nn \l__ustc_fontset_str { windows } }
611619
{
612620
\__ustc_if_platform_mac:TF
613-
{ \ustcsetup { fontset = mac } }
614-
{ \ustcsetup { fontset = fandol } }
621+
{ \str_set:Nn \l__ustc_fontset_str { mac } }
622+
{ \str_set:Nn \l__ustc_fontset_str { fandol } }
615623
}
616624
}
617625
}

0 commit comments

Comments
 (0)