%% %% This is file `xdupgthesis.cls', %% generated with the docstrip utility. %% %% The original source files were: %% %% xduts.dtx (with options: `class,thesis,xdupgthesis') %% %% Copyright 2022--2022 by @note286 in GitHub and CTAN %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 %% of this license or (at your option) any later version. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% %% This work has the LPPL maintenance status `author-maintained'. %% %% The Current Maintainer of this work is @note286 in GitHub and CTAN. %% %% This work consists of the files README.md, xduts.dtx, and xduts.ins %% and the derived files xduts.pdf, xdufont.sty, xdupgthesis.cls, and xduugthesis.cls. %% %% The copyright of xdulogo.pdf is Xidian University. %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} \ProvidesExplClass{xdupgthesis} {2022/05/08}{1.13.2.0} {Xidian University Postgraduate Thesis document class} \RequirePackage { xparse, l3keys2e } \PassOptionsToPackage { quiet } { xeCJK } \PassOptionsToClass { a4paper, zihao=-4, sub4section, fontset = none } { ctexbook } \LoadClass { ctexbook } \RequirePackage { geometry } \geometry { paper = a4paper } \RequirePackage { fancyhdr } \RequirePackage { xeCJKfntef } \RequirePackage { graphicx } \tl_new:N \l__xdu_cjk_font_tl \tl_new:N \l__xdu_fake_bold_tl \tl_new:N \l__xdu_fake_slant_tl \tl_new:N \l__xdu_latin_font_tl \tl_new:N \l__xdu_math_font_tl \tl_new:N \l__xdu_unicode_math_tl \tl_new:N \l__xdu_font_type_tl \tl_new:N \l__xdu_font_path_tl \keys_define:nn { xdu / style } { cjk-font .choices:nn = { win, adobe, founder, sinotype, fandol, none } { \tl_set_eq:NN \l__xdu_cjk_font_tl \l_keys_choice_tl }, cjk-fake-bold .tl_set:N = \l__xdu_fake_bold_tl, cjk-fake-slant .tl_set:N = \l__xdu_fake_slant_tl, latin-font .choices:nn = { tac, tacn, thcs, gyre, none } { \tl_set_eq:NN \l__xdu_latin_font_tl \l_keys_choice_tl }, math-font .choices:nn = { asana, cambria, cm, fira, garamond, lm, libertinus, stix, bonum, dejavu, pagella, schola, termes, xits, none } { \tl_set_eq:NN \l__xdu_math_font_tl \l_keys_choice_tl }, unicode-math .tl_set:N = \l__xdu_unicode_math_tl, font-type .choices:nn = { font, file } { \tl_set_eq:NN \l__xdu_font_type_tl \l_keys_choice_tl }, font-path .tl_set:N = \l__xdu_font_path_tl } \keys_set:nn { xdu } { style / cjk-font = fandol, style / cjk-fake-bold = 3, style / cjk-fake-slant = 0.2, style / latin-font = gyre, style / math-font = cm, style / unicode-math = { }, style / font-type = font, style / font-path = fonts } \cs_new:Npn \__xdu_if_platform_macos:FT #1#2 { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } { #2 } { #1 } } \cs_new:Npn \__xdu_texmf_font:nn #1#2 { \__xdu_if_platform_macos:FT { #1 } { #2 } } \cs_new:Npn \__xdu_select_font:nn #1#2 { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } { #1 } { #2 } } \cs_new:Npn \__xdu_font_path: { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } { } { Path = \l__xdu_font_path_tl / , } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_b:n #1 { BoldFont = { #1 } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_fb:n #1 { BoldFont = { #1 }, BoldFeatures = { FakeBold = \l__xdu_fake_bold_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_fs:n #1 { SlantedFont = { #1 }, SlantedFeatures = { FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_fbfs:n #1 { BoldSlantedFont = { #1 }, BoldSlantedFeatures = { FakeBold = \l__xdu_fake_bold_tl, FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_bfs:n #1 { BoldSlantedFont = { #1 }, BoldSlantedFeatures = { FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_i:n #1 { ItalicFont = { #1 } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_fi:n #1 { ItalicFont = { #1 }, ItalicFeatures = { FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_ifb:n #1 { BoldItalicFont = { #1 }, BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_sub_fifb:n #1 { BoldItalicFont = { #1 }, BoldItalicFeatures = { FakeBold = \l__xdu_fake_bold_tl, FakeSlant = \l__xdu_fake_slant_tl } } \cs_new:Npn \__xdu_cfg_cjk_font_r:n #1 { \__xdu_cfg_cjk_font_sub_fb:n { #1 }, \__xdu_cfg_cjk_font_sub_fs:n { #1 }, \__xdu_cfg_cjk_font_sub_fbfs:n { #1 }, \__xdu_cfg_cjk_font_sub_fi:n { #1 }, \__xdu_cfg_cjk_font_sub_fifb:n { #1 } } \cs_new:Npn \__xdu_cfg_cjk_font_rb:nn #1#2 { \__xdu_cfg_cjk_font_sub_b:n { #2 }, \__xdu_cfg_cjk_font_sub_fs:n { #1 }, \__xdu_cfg_cjk_font_sub_bfs:n { #2 }, \__xdu_cfg_cjk_font_sub_fi:n { #1 }, \__xdu_cfg_cjk_font_sub_fifb:n { #1 } } \cs_new:Npn \__xdu_cfg_cjk_font_ri:nn #1#2 { \__xdu_cfg_cjk_font_sub_fb:n { #1 }, \__xdu_cfg_cjk_font_sub_fs:n { #1 }, \__xdu_cfg_cjk_font_sub_fbfs:n { #1 }, \__xdu_cfg_cjk_font_sub_i:n { #2 }, \__xdu_cfg_cjk_font_sub_ifb:n { #2 } } \cs_new:Npn \__xdu_cfg_cjk_font_rbi:nnn #1#2#3 { \__xdu_cfg_cjk_font_sub_b:n { #2 }, \__xdu_cfg_cjk_font_sub_fs:n { #1 }, \__xdu_cfg_cjk_font_sub_bfs:n { #2 }, \__xdu_cfg_cjk_font_sub_i:n { #3 }, \__xdu_cfg_cjk_font_sub_ifb:n { #3 } } \cs_new:Npn \__xdu_set_cjk_main_font:nn #1#2 { \setCJKmainfont { #1 } [ \__xdu_font_path: \__xdu_cfg_cjk_font_ri:nn { #1 } { #2 } ] } \cs_new:Npn \__xdu_set_cjk_main_font:nnn #1#2#3 { \setCJKmainfont { #1 } [ \__xdu_font_path: \__xdu_cfg_cjk_font_rbi:nnn { #1 } { #2 } { #3 } ] } \cs_new:Npn \__xdu_set_cjk_sans_font:n #1 { \setCJKsansfont { #1 } [ \__xdu_font_path: \__xdu_cfg_cjk_font_r:n { #1 } ] } \cs_new:Npn \__xdu_set_cjk_sans_font:nn #1#2 { \setCJKsansfont { #1 } [ \__xdu_font_path: \__xdu_cfg_cjk_font_rb:nn { #1 } { #2 } ] } \cs_new:Npn \__xdu_set_cjk_mono_font:n #1 { \setCJKmonofont { #1 } [ \__xdu_font_path: \__xdu_cfg_cjk_font_r:n { #1 } ] } \cs_new:Npn \__xdu_load_cjk_font_win: { \__xdu_set_cjk_main_font:nn { \__xdu_select_font:nn { SimSun } { simsun.ttc } } { \__xdu_select_font:nn { KaiTi } { simkai.ttf } } \__xdu_set_cjk_sans_font:n { \__xdu_select_font:nn { SimHei } { simhei.ttf } } \__xdu_set_cjk_mono_font:n { \__xdu_select_font:nn { FangSong } { simfang.ttf } } } \cs_new:Npn \__xdu_load_cjk_font_adobe: { \__xdu_set_cjk_main_font:nn { \__xdu_select_font:nn { Adobe~Song~Std } { adobesongstd-light.otf } } { \__xdu_select_font:nn { Adobe~Kaiti~Std } { adobekaitistd-regular.otf } } \__xdu_set_cjk_sans_font:n { \__xdu_select_font:nn { Adobe~Heiti~Std } { adobeheitistd-regular.otf } } \__xdu_set_cjk_mono_font:n { \__xdu_select_font:nn { Adobe~Fangsong~Std } { Adobe-Fangsong-Std-R-Font.otf } } } \cs_new:Npn \__xdu_load_cjk_font_founder: { \__xdu_set_cjk_main_font:nn { \__xdu_select_font:nn { FZShuSong-Z01 } { FZShuSong-Z01.ttf } } { \__xdu_select_font:nn { FZKai-Z03 } { FZKai-Z03.ttf } } \__xdu_set_cjk_sans_font:n { \__xdu_select_font:nn { FZHei-B01 } { FZHei-B01.ttf } } \__xdu_set_cjk_mono_font:n { \__xdu_select_font:nn { FZFangSong-Z02 } { FZFSK.TTF } } } \cs_new:Npn \__xdu_load_cjk_font_sinotype: { \__xdu_set_cjk_main_font:nn { \__xdu_select_font:nn { STSong } { STSONG.TTF } } { \__xdu_select_font:nn { STKaiti } { STKAITI.TTF } } \__xdu_set_cjk_sans_font:nn { \__xdu_select_font:nn { STXihei } { STXIHEI.TTF } } { \__xdu_select_font:nn { STHeiti } { STHeiti.ttf } } \__xdu_set_cjk_mono_font:n { \__xdu_select_font:nn { STFangsong } { STFANGSO.TTF } } } \cs_new:Npn \__xdu_load_cjk_font_fandol: { \__xdu_set_cjk_main_font:nnn { FandolSong-Regular.otf } { FandolSong-Bold.otf } { FandolKai-Regular.otf } \__xdu_set_cjk_sans_font:nn { FandolHei-Regular.otf } { FandolHei-Bold.otf } \__xdu_set_cjk_mono_font:n { FandolFang-Regular.otf } } \cs_new:Npn \__xdu_load_cjk_font_none: { } \cs_new:Npn \__xdu_set_latin_font:nnn #1#2#3 { BoldFont = { #1 }, SlantedFont = { #2 }, BoldSlantedFont = { #3 }, ItalicFont = { #2 }, BoldItalicFont = { #3 } } \cs_new:Npn \__xdu_set_latin_scale: { Scale = MatchLowercase , } \cs_new:Npn \__xdu_off_latin_ligatures: { Ligatures = CommonOff , } \cs_new:Npn \__xdu_set_latin_main_font:nnnnn #1#2#3#4#5 { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } { \setmainfont { #1 } } { \setmainfont { #2 } [ \__xdu_font_path: \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } } \cs_new:Npn \__xdu_set_latin_sans_font:nnnnn #1#2#3#4#5 { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } { \setsansfont { #1 } [ \__xdu_set_latin_scale: ] } { \setsansfont { #2 } [ \__xdu_font_path: \__xdu_set_latin_scale: \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } } \cs_new:Npn \__xdu_set_latin_mono_font:nnnnn #1#2#3#4#5 { \str_if_eq:NNTF { \l__xdu_font_type_tl } { font } { \setmonofont{ #1 } [ \__xdu_set_latin_scale: \__xdu_off_latin_ligatures: ]} { \setmonofont{ #2 } [ \__xdu_font_path: \__xdu_set_latin_scale: \__xdu_off_latin_ligatures: \__xdu_set_latin_font:nnn { #3 } { #4 } { #5 } ] } } \cs_new:Npn \__xdu_set_latin_main_font:nnnn #1#2#3#4 { \setmainfont { #1 } [ \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 } ] } \cs_new:Npn \__xdu_set_latin_sans_font:nnnn #1#2#3#4 { \setsansfont { #1 } [ \__xdu_set_latin_scale: \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 } ] } \cs_new:Npn \__xdu_set_latin_mono_font:nnnn #1#2#3#4 { \setmonofont{ #1 } [ \__xdu_set_latin_scale: \__xdu_off_latin_ligatures: \__xdu_set_latin_font:nnn { #2 } { #3 } { #4 } ] } \cs_new:Npn \__xdu_load_latin_font_tac: { \__xdu_set_latin_main_font:nnnnn { Times~New~Roman } { times.ttf } { timesbd.ttf } { timesi.ttf } { timesbi.ttf } \__xdu_set_latin_sans_font:nnnnn { Arial } { arial.ttf } { arialbd.ttf } { ariali.ttf } { arialbi.ttf } \__xdu_set_latin_mono_font:nnnnn { Consolas } { consola.ttf } { consolab.ttf } { consolai.ttf } { consolaz.ttf } } \cs_new:Npn \__xdu_load_latin_font_tacn: { \__xdu_set_latin_main_font:nnnnn { Times~New~Roman } { times.ttf } { timesbd.ttf } { timesi.ttf } { timesbi.ttf } \__xdu_set_latin_sans_font:nnnnn { Arial } { arial.ttf } { arialbd.ttf } { ariali.ttf } { arialbi.ttf } \__xdu_set_latin_mono_font:nnnnn { Courier~New } { cour.ttf } { courbd.ttf } { couri.ttf } { courbi.ttf } } \cs_new:Npn \__xdu_load_latin_font_thcs: { \__xdu_set_latin_main_font:nnnnn { Times~New~Roman } { times.ttf } { timesbd.ttf } { timesi.ttf } { timesbi.ttf } \__xdu_set_latin_sans_font:nnnnn { Helvetica } { Helvetica.ttf } { Helvetica~Bold.ttf } { Helvetica~Oblique.ttf } { Helvetica~Bold~Oblique.ttf } \__xdu_set_latin_mono_font:nnnnn { Courier~Std } { CourierStd.otf } { CourierStd-Bold.otf } { CourierStd-Oblique.otf } { CourierStd-BoldOblique.otf } } \cs_new:Npn \__xdu_load_latin_font_gyre: { \__xdu_set_latin_main_font:nnnn { texgyretermes-regular.otf } { texgyretermes-bold.otf } { texgyretermes-italic.otf } { texgyretermes-bolditalic.otf } \__xdu_set_latin_sans_font:nnnn { texgyreheros-regular.otf } { texgyreheros-bold.otf } { texgyreheros-italic.otf } { texgyreheros-bolditalic.otf } \__xdu_set_latin_mono_font:nnnn { texgyrecursor-regular.otf } { texgyrecursor-bold.otf } { texgyrecursor-italic.otf } { texgyrecursor-bolditalic.otf } } \cs_new:Npn \__xdu_load_latin_font_none: { } \cs_new:Npn \__xdu_load_unicode_math_pkg: { \RequirePackage [ \l__xdu_unicode_math_tl ] { unicode-math } } \cs_new:Npn \__xdu_load_math_font_cambria: { \__xdu_load_unicode_math_pkg: \str_if_eq:NNTF { \l__xdu_font_type_tl} { font} { \setmathfont { Cambria~Math} } { \setmathfont { cambria.ttc} [ Path = \l__xdu_font_path_tl/, FontIndex = 1 ] } } \cs_new:Npn \__xdu_define_math_font:nn #1#2 { \cs_new:cpn { __xdu_load_math_font_ #1 : } { \__xdu_load_unicode_math_pkg: \setmathfont { #2 } } } \clist_map_inline:nn { { asana } { Asana-Math.otf }, { fira } { FiraMath-Regular.otf }, { garamond } { Garamond-Math.otf }, { lm } { latinmodern-math.otf }, { libertinus } { LibertinusMath-Regular.otf }, { stix } { STIXMath-Regular.otf }, { bonum } { texgyrebonum-math.otf }, { dejavu } { texgyredejavu-math.otf }, { pagella } { texgyrepagella-math.otf }, { schola } { texgyreschola-math.otf }, { termes } { texgyretermes-math.otf } } { \__xdu_define_math_font:nn #1 } \cs_new:Npn \__xdu_load_math_font_xits: { \__xdu_load_unicode_math_pkg: \__xdu_if_platform_macos:FT { \setmathfont { XITS~Math } } { \__xdu_load_unicode_math_pkg: \setmathfont { XITSMath-Regular.otf } \setmathfont { XITSMath-Bold.otf } [range= { bfup -> up, bfit -> it } ] } } \cs_new:Npn \__xdu_load_math_font_cm: { } \cs_new:Npn \__xdu_load_math_font_none: { } \cs_new:Npn \__xdu_load_font: { \use:c { __xdu_load_cjk_font_ \l__xdu_cjk_font_tl : } \use:c { __xdu_load_latin_font_ \l__xdu_latin_font_tl : } \use:c { __xdu_load_math_font_ \l__xdu_math_font_tl : } } \ctex_at_end_preamble:n { \__xdu_load_font: } \str_new:N \l__xdu_title_str \str_new:N \l__xdu_title_i_str \str_new:N \l__xdu_title_ii_str \str_new:N \l__xdu_dept_str \str_new:N \l__xdu_major_str \str_new:N \l__xdu_author_str \str_new:N \l__xdu_supv_str \str_new:N \l__xdu_supv_ent_str \str_new:N \l__xdu_student_id_str \tl_new:N \l__xdu_abstract_zh_tl \tl_new:N \l__xdu_abstract_en_tl \clist_new:N \l__xdu_keywords_zh_clist \clist_new:N \l__xdu_keywords_en_clist \tl_new:N \l__xdu_ack_tl \keys_define:nn { xdu / info } { title .tl_set:N = \l__xdu_title_str, department .tl_set:N = \l__xdu_dept_str, major .tl_set:N = \l__xdu_major_str, author .tl_set:N = \l__xdu_author_str, supervisor .tl_set:N = \l__xdu_supv_str, supervisor-enterprise .tl_set:N = \l__xdu_supv_ent_str, student-id .tl_set:N = \l__xdu_student_id_str, abstract .tl_set:N = \l__xdu_abstract_zh_tl, abstract* .tl_set:N = \l__xdu_abstract_en_tl, keywords .clist_set:N = \l__xdu_keywords_zh_clist, keywords* .clist_set:N = \l__xdu_keywords_en_clist, acknowledgements .tl_set:N = \l__xdu_ack_tl } \keys_set:nn { xdu } { info / title = { }, info / department = { }, info / major = { }, info / author = { }, info / supervisor = { }, info / supervisor-enterprise = { }, info / student-id = { }, info / abstract = { }, info / abstract* = { }, info / keywords = { }, info / keywords* = { }, info / acknowledgements = { } } \tl_new:N \l__xdu_gr_type_tl \tl_new:N \l__xdu_degree_type_tl \str_new:N \l__xdu_degree_str \str_new:N \l__xdu_degree_en_str \str_new:N \l__xdu_author_en_str \str_new:N \l__xdu_supv_en_str \str_new:N \l__xdu_supv_ent_en_str \str_new:N \l__xdu_supv_t_str \str_new:N \l__xdu_supv_t_en_str \str_new:N \l__xdu_supv_ent_t_str \str_new:N \l__xdu_supv_ent_t_en_str \str_new:N \l__xdu_title_en_str \str_new:N \l__xdu_major_en_str \str_new:N \l__xdu_sub_major_str \str_new:N \l__xdu_domain_str \str_new:N \l__xdu_clc_str \str_new:N \l__xdu_secret_lv_str \str_new:N \l__xdu_submit_date_str \keys_define:nn { xdu / info } { graduate-type .choices:nn = { 硕士, 博士 } { \tl_set_eq:NN \l__xdu_gr_type_tl \l_keys_choice_tl }, degree-type .choices:nn = { 学术, 专业 } { \tl_set_eq:NN \l__xdu_degree_type_tl \l_keys_choice_tl }, degree .tl_set:N = \l__xdu_degree_str, degree* .tl_set:N = \l__xdu_degree_en_str, author* .tl_set:N = \l__xdu_author_en_str, supervisor* .tl_set:N = \l__xdu_supv_en_str, supervisor-enterprise* .tl_set:N = \l__xdu_supv_ent_en_str, supervisor-title .tl_set:N = \l__xdu_supv_t_str, supervisor-title* .tl_set:N = \l__xdu_supv_t_en_str, supervisor-enterprise-title .tl_set:N = \l__xdu_supv_ent_t_str, supervisor-enterprise-title* .tl_set:N = \l__xdu_supv_ent_t_en_str, title* .tl_set:N = \l__xdu_title_en_str, major* .tl_set:N = \l__xdu_major_en_str, sub-major .tl_set:N = \l__xdu_sub_major_str, domain .tl_set:N = \l__xdu_domain_str, clc .tl_set:N = \l__xdu_clc_str, secret-level .choices:nn = { 秘密, 公开 } { \tl_set_eq:NN \l__xdu_secret_lv_str \l_keys_choice_tl }, submit-date .tl_set:N = \l__xdu_submit_date_str } \keys_set:nn { xdu } { info / graduate-type = { 硕士 }, info / degree-type = { 学术 }, info / degree = { }, info / degree* = { }, info / author* = { }, info / supervisor* = { }, info / supervisor-enterprise* = { }, info / supervisor-title = { }, info / supervisor-title* = { }, info / supervisor-enterprise-title = { }, info / supervisor-enterprise-title* = { }, info / title* = { }, info / major* = { }, info / sub-major = { }, info / domain = { }, info / clc = { }, info / secret-level = { 公开 }, info / submit-date = { } } \bool_new:N \l__xdu_en_cjk_font_bool \tl_new:N \l__xdu_lang_tl \tl_new:N \l__xdu_bib_tool_tl \clist_new:N \l__xdu_bib_file_clist \tl_new:N \l__xdu_ref_add_space \tl_new:N \l__xdu_cap_label_sep_tl \bool_new:N \l__xdu_tab_small_bool \bool_new:N \l__xdu_alg_small_bool \clist_new:N \l__xdu_before_skip_clist \clist_new:N \l__xdu_after_skip_clist \tl_new:N \l__xdu_chap_tl \tl_new:N \l__xdu_sec_tl \tl_new:N \l__xdu_subsec_tl \tl_new:N \l__xdu_subsubsec_tl \tl_new:N \l__xdu_para_tl \tl_new:N \l__xdu_subpara_tl \bool_new:N \l__xdu_sym_mgn_bool \tl_new:N \l__xdu_page_v_align_tl \keys_define:nn { xdu / style } { en-cjk-font .bool_set:N = \l__xdu_en_cjk_font_bool, language .choices:nn = { zh, en } { \tl_set_eq:NN \l__xdu_lang_tl \l_keys_choice_tl }, bib-backend .choices:nn = { bibtex, biblatex } { \tl_set_eq:NN \l__xdu_bib_tool_tl \l_keys_choice_tl }, bib-resource .clist_set:N = \l__xdu_bib_file_clist, ref-add-space .bool_set:N = \l__xdu_ref_add_space, caption-label-sep .tl_set:N = \l__xdu_cap_label_sep_tl, table-small-font .bool_set:N = \l__xdu_tab_small_bool, algorithm-small-font .bool_set:N = \l__xdu_alg_small_bool, before-skip .clist_set:N = \l__xdu_before_skip_clist, after-skip .clist_set:N = \l__xdu_after_skip_clist, chap-zihao .tl_set:N = \l__xdu_chap_tl, sec-zihao .tl_set:N = \l__xdu_sec_tl, subsec-zihao .tl_set:N = \l__xdu_subsec_tl, subsubsec-zihao .tl_set:N = \l__xdu_subsubsec_tl, para-zihao .tl_set:N = \l__xdu_para_tl, subpara-zihao .tl_set:N = \l__xdu_subpara_tl, symmetric-margin .bool_set:N = \l__xdu_sym_mgn_bool, page-vertical-align .tl_set:N = \l__xdu_page_v_align_tl } \keys_set:nn { xdu } { style / en-cjk-font = false, style / language = zh, style / bib-backend = biblatex, style / bib-resource = { }, style / ref-add-space = false, style / caption-label-sep = { 0.75em }, style / table-small-font = true, style / algorithm-small-font = true, style / before-skip = { 24pt, 18pt, 12pt, 12pt, 12pt, 12pt }, style / after-skip = { 18pt, 12pt, 6pt, 6pt, 6pt, 6pt }, style / symmetric-margin = false, style / page-vertical-align = {顶部对齐} } \NewDocumentCommand \xdusetup { m } { \keys_set:nn { xdu } { #1 } } \keys_define:nn { xdu } { style .meta:nn = { xdu / style } { #1 }, info .meta:nn = { xdu / info } { #1 } } \ProcessKeysOptions { xdu / style } \str_new:N \l__xdu_header_str \ctex_at_end_preamble:n { \__xdu_lang_switch:nn { \tl_if_eq:NnTF \l__xdu_gr_type_tl { 硕士 } { \str_set:Nn \l__xdu_header_str { 西安电子科技大学硕士学位论文 } } { \str_set:Nn \l__xdu_header_str { 西安电子科技大学博士学位论文 } } } { \tl_if_eq:NnTF \l__xdu_gr_type_tl { 硕士 } { \str_set:Nn \l__xdu_header_str { Master~Thesis~of~XIDIAN~UNIVERSITY } } { \str_set:Nn \l__xdu_header_str { Doctoral~Dissertation~of~XIDIAN~UNIVERSITY } } } } \cs_new:Npn \__xdu_lang_switch:nn #1#2 { \str_if_eq:NNTF { \l__xdu_lang_tl } { zh } { #1 } { #2 } } \cs_new:Npn \__xdu_rm_family: { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { rm } } { \rmfamily } } \cs_new:Npn \__xdu_sf_family: { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { sf } } { \sffamily } } \cs_new:Npn \__xdu_tt_family: { \bool_if:NTF \l__xdu_en_cjk_font_bool { \CJKfamily+ { tt } } { \ttfamily } } \ctex_at_end_preamble:n { \str_new:N \l__xdu_pure_title_str \str_set_eq:NN \l__xdu_pure_title_str \l__xdu_title_str \str_remove_all:Nn \l__xdu_pure_title_str { \\ } } \cs_new:Npn \__xdu_uline:n #1 { \CJKunderline [ thickness = 0.5pt ] { #1 } } \cs_new:Npn \__xdu_tl_set_if_empty:Nn #1#2 { \tl_if_empty:NT #1 { \tl_set:Nn #1 { #2 } } } \cs_new:Npn \__xdu_get_text_width:Nn #1#2 { \box_clear_new:N \l__xdu_tmp_box \hbox_set:Nn \l__xdu_tmp_box { #2 } \dim_set:Nn #1 { \box_wd:N \l__xdu_tmp_box } } \cs_generate_variant:Nn \__xdu_get_text_width:Nn { NV } \cs_new:Npn \__xdu_add_bookmark:n #1 { \currentpdfbookmark { #1 } { #1 } } \cs_new:Npn \__xdu_add_toc:n #1 { \cleardoublepage \phantomsection \addcontentsline { toc } { chapter } { #1 } } \cs_new:Npn \__xdu_n_chapter_head:n #1 { \__xdu_add_bookmark:n { #1 } \chapter* { #1 } \markboth { #1 } { } } \cs_new:Npn \__xdu_n_chapter_head_ii:nn #1#2 { { \ctexset { chapter / format = { #2 } } \__xdu_n_chapter_head:n { #1 } } } \cs_new:Npn \__xdu_n_chapter_head:nn #1#2 { \__xdu_add_bookmark:n { #1 } \chapter* { #2 } \markboth { #1 } { } } \cs_new:Npn \__xdu_n_chapter_head_ii:nnn #1#2#3 { { \ctexset { chapter / format = { #3 } } \__xdu_n_chapter_head:nn { #1 } { #2 } } } \cs_new:Npn \__xdu_n_chapter_head_toc:n #1 { \__xdu_add_toc:n { #1 } \chapter* { #1 } \markboth { #1 } { } } \cs_new:Npn \__xdu_n_chapter_head_toc:nn #1#2 { \__xdu_add_toc:n { #1 } \chapter* { #2 } \markboth { #1 } { } } \cs_new:Npn \__xdu_typeout_keywords:nNn #1#2#3 { \str_clear_new:N \l__xdu_keywords_label_str \str_set:Nn \l__xdu_keywords_label_str { #1 } \dim_zero_new:N \l__xdu_keywords_label_dim \__xdu_get_text_width:NV \l__xdu_keywords_label_dim \l__xdu_keywords_label_str \begin { list } { \l__xdu_keywords_label_str } { \labelwidth \l__xdu_keywords_label_dim \labelsep \c_zero_dim \rightmargin \c_zero_dim \leftmargin \l__xdu_keywords_label_dim } \item \clist_use:Nnnn #2 { #3 } { #3 } { #3 } \end { list } } \newgeometry { top = 3cm, bottom = 2.5cm, inner = 2.5cm, outer = 2.5cm, bindingoffset = 0.5cm, head = 2cm, foot = 0.75cm } \savegeometry { main } \newgeometry { top = 3cm, bottom = 2.5cm, inner = 2.75cm, outer = 2.75cm, head = 2cm, foot = 0.75cm } \savegeometry { main-sym } \newgeometry { top = 3cm, bottom = 2cm, inner = 3cm, outer = 2.5cm } \savegeometry { cover } \cs_new:Npn \__xdu_load_main_geometry: { \bool_if:NTF \l__xdu_sym_mgn_bool { \loadgeometry { main-sym } } { \loadgeometry { main } } } \clist_map_inline:nn { { chinese }, { arabic }, { roman }, { Roman }, { alph }, { Alph }, { fnsymbol } } { \cs_new_eq:cc { __xdu _ #1 : } { #1 } } \tl_set:Nn \chaptername { Chapter } \tl_new:N \l__xdu_chaptername \tl_set_eq:NN \l__xdu_chaptername \chaptername \renewcommand { \chaptermark } [ 1 ] { \markboth { \__xdu_lang_switch:nn { \CTEXthechapter } { \l__xdu_chaptername \space \__xdu_Roman: { chapter } } \quad #1 } { } } \fancypagestyle { plain } { \pagestyle { fancy } \fancyhf { } \fancyhead [ CE ] { \__xdu_rm_family: \zihao { 5 } \l__xdu_header_str } \fancyhead [ CO ] { \__xdu_rm_family: \zihao { 5 } \leftmark } \fancyfoot [ CE ] { \__xdu_rm_family: \zihao { -5 } \thepage } \fancyfoot [ CO ] { \__xdu_rm_family: \zihao { -5 } \thepage } \cs_set:Npn \headrulewidth { 0.5pt } \cs_set:Npn \headrule { \hrule \@height \headrulewidth \skip_vertical:N \headrulewidth \hrule \@height \headrulewidth \skip_vertical:N -\headrulewidth } } \fancypagestyle { front } { \pagestyle { plain } \fancyfoot [ CE ] { \rmfamily \zihao { -5 } \thepage } \fancyfoot [ CO ] { \rmfamily \zihao { -5 } \thepage } } \ctex_at_end_preamble:n { \tl_if_eq:NnTF \l__xdu_page_v_align_tl { 顶部对齐 } { \raggedbottom } { \flushbottom } } \renewcommand { \theequation } { \thechapter - \arabic { equation } } \ctex_at_end_preamble:n { \clist_map_inline:nn { { \algorithmname }, { \ALG@name }, { \algorithmcfname } } { \cs_set:Npn #1 { \__xdu_lang_switch:nn { 算法 } { Algorithm } } } } \PassOptionsToPackage { chapter } { algorithm } \ctex_at_end_preamble:n { \@ifpackageloaded { algorithm } { \cs_if_exist:NT \thealgorithm { \floatplacement { algorithm } { tbp } \cs_set:Npn \thealgorithm { \thechapter . \arabic { algorithm } } \bool_if:NT \l__xdu_alg_small_bool { \renewenvironment { algorithm } { \@nameuse { fst@algorithm } \@float@setevery { algorithm } \ctex_gadd_ltxhook:nn { cmd/@floatboxreset/after } { \zihao { 5 } } \@float { algorithm } } { \float@end } } } } { } } \PassOptionsToPackage { algochapter } { algorithm2e } \ctex_at_end_preamble:n { \@ifpackageloaded { algorithm2e } { \cs_if_exist:NT \thealgocf { \cs_set:Npn \thealgocf { \thechapter . \arabic { algocf } } \renewenvironment { \algocf@envname } [ 1 ] [ tbp ] { \setboolean { algocf@algostar } { false } \setboolean { algocf@procenvironment } { false } \gdef \algocfautorefname { \algorithmautorefname } \begin { algocf@algorithm } [ #1 ] \ignorespaces } { \end { algocf@algorithm } \ignorespacesafterend } \bool_if:NT \l__xdu_alg_small_bool { \SetAlFnt { \zihao { 5 } } } } } { } } \RequirePackage { caption } \DeclareCaptionLabelSeparator { customskip } { \hskip \l__xdu_cap_label_sep_tl } \DeclareCaptionFont { customfont } { \__xdu_rm_family: \zihao { 5 } } \captionsetup { labelsep = customskip, font = customfont } \captionsetup [ algorithm ] { labelsep = customskip, labelfont = customfont, font = customfont } \ctex_at_end_preamble:n { \cs_if_exist:NT \thealgocf { \SetAlgoCaptionSeparator { \hbox_to_wd:nn { \l__xdu_cap_label_sep_tl } { } } \SetAlCapNameFnt { \__xdu_rm_family: \zihao { 5 } } \SetAlCapFnt { \__xdu_rm_family: \zihao { 5 } } \SetAlCapSty { } } } \ctex_at_end_preamble:n { \@ifpackageloaded { tabularray } { \SetTblrStyle { head } { font = \__xdu_rm_family: \zihao { 5 } } \DefTblrTemplate { caption-sep } { default } { \hskip \l__xdu_cap_label_sep_tl } } { } } \PassOptionsToPackage { font = small } { subfig } \captionsetup [ sub ] { font = customfont } \ctex_at_end_preamble:n { \bool_if:NT \l__xdu_tab_small_bool { \renewenvironment { table } { \def\@floatboxreset { \reset@font\small\@setminipage } \@float { table } } { \end@float } } } \ctex_at_end_preamble:n { \@ifpackageloaded { longtable } { \bool_if:NT \l__xdu_tab_small_bool { \ctex_gadd_ltxhook:nn { env/longtable/begin } { \small } } } { } } \ctex_at_end_preamble:n { \@ifpackageloaded { tabularray } { \bool_if:NT \l__xdu_tab_small_bool { \ctex_gadd_ltxhook:nn { env/tblr/begin } { \small } \ctex_gadd_ltxhook:nn { env/longtblr/begin } { \small } } } { } } \RequirePackage{ hyperref } \hypersetup { bookmarksnumbered, hidelinks } \ctex_at_end_preamble:n { \hypersetup { pdftitle = \l__xdu_pure_title_str, pdfsubject = \l__xdu_header_str, pdfcreator = { XeLaTeX~with~xdupgthesis~class~in~XDUTS }, pdfauthor = \l__xdu_author_str } } \ctex_at_end_preamble:n { \bool_if:NT \l__xdu_ref_add_space { \str_if_eq:NNT { \l__xdu_lang_tl } { zh } { \RequirePackage { xspace } \xspaceaddexceptions { 。?!,、;:“”‘’—….--~·《》<>_ } \cs_generate_variant:Nn \str_if_in:nnTF { xnTF } \ctex_after_end_preamble:n { \cs_set_eq:NN \__xdu_trad_ref:n \ref \cs_set:Npn \ref #1 { \str_if_in:xnTF { \__hyp_get_anchor:n { #1 } } { chapter } { \__xdu_trad_ref:n { #1 } } { \xspace \__xdu_trad_ref:n { #1 } \xspace } } } } } } \cs_new_protected:Npn \__xdu_begin_document:n #1 { \ctex_gadd_ltxhook:nn { env/document/begin } { #1 } } \__xdu_begin_document:n { \tl_if_eq:NnTF \l__xdu_bib_tool_tl { bibtex } { \RequirePackage [ sort&compress,square,super,comma,numbers ] { natbib } \RequirePackage { gbt7714 } \bibliographystyle { gbt7714-numerical } } { \RequirePackage [ style = gb7714-2015 ] { biblatex } \clist_map_inline:Nn \l__xdu_bib_file_clist { \addbibresource { #1 } } } } \renewcommand { \frontmatter } { \loadgeometry { cover } \pagestyle { empty } \__xdu_load_main_geometry: \pagestyle { front } \pagenumbering { Roman } } \renewcommand { \mainmatter } { \__xdu_load_main_geometry: \pagestyle { plain } \pagenumbering { arabic } } %% %% %% End of file `xdupgthesis.cls'.