% % Copyright (C) 2021 by Qu Yi % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3c 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 `maintained'. %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} \ProvidesExplClass{easybook}{2021/12/06}{1.41I} {Typeset Chinese theses or books} \bool_set_false:N \l__eb_compile_draft_bool \bool_set_false:N \l__eb_title_newline_bool \bool_set_true:N \l__eb_class_mode_book_bool \tl_new:N \g__eb_config_tl \tl_new:N \l__eb_font_choice_tl \clist_new:N \g__eb_options_clist \cs_new_protected:Npn \eb_put_ctexbook:n #1 { \PassOptionsToClass{#1}{ctexbook} } \cs_generate_variant:Nn \eb_put_ctexbook:n { V } \keys_define:nn { easybook } { newline .code:n = \bool_set_true:N \l__eb_title_newline_bool, scheme .code:n = \eb_put_ctexbook:n { scheme = #1 }, enmode .meta:n = { newline,scheme = plain }, font .choices:nn = { noto,garamond,times,times*,libertine,palatino,auto } { \tl_set:Nn \l__eb_font_choice_tl {#1} }, font .value_required:n = true, font .initial:n = auto, cjkfont .code:n = \eb_put_ctexbook:n { fontset = #1 }, mathfont .choices:nn = { noto,notosans,times,libertine, charter,garamond,none,nc,stix } { \tl_set:Nn \l__eb_mathfont_choice_tl {#1} }, mathfont .value_required:n = true, mathfont .initial:n = times, paper .choice:, paper .value_required:n = true, paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, class .choice:, class .value_required:n = true, class/book .code:n = { }, class/article .code:n = { \bool_set_false:N \l__eb_class_mode_book_bool \eb_put_ctexbook:n { oneside } }, book .meta:n = { class = book }, article .meta:n = { class = article }, config .tl_set:N = \g__eb_config_tl, floatpage .bool_set:N = \l__eb_float_page_bool, floatpage .default:n = true, unknown .code:n = \clist_gput_right:NV \g__eb_options_clist \CurrentOption } \ProcessKeysOptions{easybook} \PassOptionsToPackage{no-math,quiet,CJKmath}{xeCJK} \eb_put_ctexbook:V \g__eb_options_clist \LoadClass[UTF8]{ctexbook} \RequirePackage{easybase} \ctex_at_end:n { \use:c { eb@font@load@\l__eb_font_choice_tl } \tl_if_empty:NF \g__eb_config_tl { \file_input:n { \g__eb_config_tl } } } \sys_if_engine_xetex:TF { \cs_new_eq:NN \eb_set_family:nnn \xeCJK_set_family:nnn \cs_new_eq:NN \eb_switch_family:n \xeCJK_switch_family:n }{ \cs_new_eq:NN \eb_set_family:nnn \ctex_ltj_set_family:nnn \cs_new_eq:NN \eb_switch_family:n \ctex_ltj_switch_family:n } \cs_new_protected:Npn \eb_setmainfont:nn #1#2 { \__fontspec_main_setmainfont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setsansfont:nn #1#2 { \__fontspec_main_setsansfont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setmonofont:nn #1#2 { \__fontspec_main_setmonofont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setCJKmainfont:nn #1#2 { \eb_set_family:nnn { \CJKrmdefault } {#2} {#1} } \cs_new_protected:Npn \eb_setCJKsansfont:nn #1#2 { \eb_set_family:nnn { \CJKsfdefault } {#2} {#1} } \cs_new_protected:Npn \eb_setCJKmonofont:nn #1#2 { \eb_set_family:nnn { \CJKttdefault } {#2} {#1} } \eb_seq_map_inline:nn { main,sans,mono,CJKmain,CJKsans,CJKmono } { \exp_args:Nc \RenewDocumentCommand { set#1font }{O{}mO{}} {\use:c { eb_set#1font:nn } {##2} {##1,##3}} } \RenewDocumentCommand{\newCJKfontfamily}{omO{}mO{}} { \tl_set:Nx \l_tmpa_tl { \tl_if_novalue:nTF {#1} { \cs_to_str:N #2 } {#1} } \cs_new_protected:Npx #2 { \eb_switch_family:n { \l_tmpa_tl } } \eb_set_family:nnn { \l_tmpa_tl } {#3,#5} {#4} } \cs_new_protected:Npn \eb@font@load@noto { \eb_setmainfont:nn { NotoSerif } { Extension = .ttf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic } \eb_setsansfont:nn { NotoSans } { Extension = .ttf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic } \eb_setmonofont:nn { NotoSansMono } { Extension = .ttf, UprightFont = *-Regular, BoldFont = *-Bold } } \cs_new_protected:Npn \eb@font@load@times { \eb_setmainfont:nn { XITS } { Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, ItalicFont = *-italic, BoldItalicFont = *-bolditalic } \eb_setsansfont:nn { texgyreheros } { Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, ItalicFont = *-italic, BoldItalicFont = *-bolditalic } \eb_setmonofont:nn { texgyrecursor } { Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, ItalicFont = *-italic, BoldItalicFont = *-bolditalic, Ligatures = CommonOff } } \cs_new_protected:cpn { eb@font@load@times* } { \eb_setmainfont:nn { Times~New~Roman } { } \eb_setsansfont:nn { Arial } { } \eb_setmonofont:nn { Courier~New } { } } \cs_new_protected:Npn \eb_font_load_libertinus_sans: { \eb_setsansfont:nn { LibertinusSans } { Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic } } \cs_new_protected:Npn \eb_font_load_lmmonolt_mono: { \eb_setmonofont:nn { lmmonolt10 } { Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, ItalicFont = *-oblique, BoldItalicFont = *-boldoblique } } \cs_new_protected:Npn \eb@font@load@garamond { \eb_setmainfont:nn { EBGaramond } { Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic } \eb_font_load_libertinus_sans: \eb_font_load_lmmonolt_mono: } \cs_new_protected:Npn \eb@font@load@libertine { \eb_setmainfont:nn { LibertinusSerif } { Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic } \eb_font_load_libertinus_sans: \eb_font_load_lmmonolt_mono: } \cs_new_protected:Npn \eb@font@load@palatino { \eb_setmainfont:nn { texgyrepagella } { Extension = .otf, UprightFont = *-regular, BoldFont = *-bold, ItalicFont = *-italic, BoldItalicFont = *-bolditalic } \eb_font_load_libertinus_sans: \eb_font_load_lmmonolt_mono: } \cs_new_protected:Npn \eb_put_newtxmath:n #1 { \PassOptionsToPackage{#1}{newtxmath} } \str_case:VnT \l__eb_mathfont_choice_tl { { times } { } { nc } { \eb_put_newtxmath:n { nc } } { noto } { \eb_put_newtxmath:n { noto } } { stix } { \eb_put_newtxmath:n { stix2 } } { charter } { \eb_put_newtxmath:n { charter } } { notosans } { \eb_put_newtxmath:n { notosans } } { garamond } { \eb_put_newtxmath:n { ebgaramond } } { libertine } { \eb_put_newtxmath:n { libertine } } } { \LoadPackage{newtxmath+bm} } \ctex_set:n { secnumdepth = 3, tocdepth = \bool_if:NTF \l__eb_class_mode_book_bool { 1 } { 2 }, part = { pagestyle = empty, format = \color{ctex@frame}\sffamily\Huge, nameformat = { }, titleformat = { }, aftername = { \bool_if:NTF \l__eb_title_newline_bool { \par\nobreak } { \hspace{1em} } } }, chapter = { % pagestyle = fancy, format = { \color{ctex@frame}\sffamily\LARGE \bool_if:NF \l__eb_title_newline_bool { \centering } }, nameformat = { }, titleformat = { }, aftername = { \bool_if:NTF \l__eb_title_newline_bool { \par\nobreak\vskip 1.5pc } { \hspace{1em} } }, beforeskip = -1.5ex, afterskip = 3ex, lotskip = 0.8pc, lofskip = 0.8pc }, section = { hang = true, format = \color{ctex@frame}\sffamily\Large, aftername = \hspace{0.5em}, beforeskip = 1.5ex plus .2ex minus .1ex, afterskip = 1.5ex plus .2ex minus .1ex }, subsection = { hang = true, format = \color{ctex@frame}\sffamily\large, aftername = \hspace{0.5em}, beforeskip = 1.3ex plus .2ex minus .1ex, afterskip = 1.3ex plus .2ex minus .1ex }, subsubsection = { hang = true, format = \color{ctex@frame}\sffamily, aftername = \hspace{0.5em}, beforeskip = \parskip, afterskip = \parskip } } \bool_if:NF \l__eb_title_newline_bool { \ctex_set:n { part/hang = true, chapter/hang = true } } % %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} \ProvidesExplPackage{easybase}{2021/12/06}{1.41I} {Typeset Chinese theses or books} \cs_generate_variant:Nn \dim_set:Nn { NV } \cs_generate_variant:Nn \dim_sign:n { V } \cs_generate_variant:Nn \int_to_arabic:n { v } \cs_generate_variant:Nn \prop_set_from_keyval:Nn { NV } \cs_generate_variant:Nn \skip_set:Nn { NV } \cs_generate_variant:Nn \seq_set_from_clist:Nn { No } \cs_generate_variant:Nn \ctex_define:nn { nx } \cs_generate_variant:Nn \eb_put_hyperref:n { x } \cs_generate_variant:Nn \eb_at_begin_environment:nn { on } \cs_set_protected:Npn \ctex_define:nn #1 { \keys_define:nn { ctex/#1 } } \cs_new_protected:Npn \eb_seq_map_inline:nn #1#2 { \seq_set_from_clist:Nn \l_tmpa_seq {#1} \seq_map_inline:Nn \l_tmpa_seq {#2} } \cs_new_protected:Npn \eb_char_patch_cmd:wnn #1#2#3 { \ExplSyntaxOn\makeatletter \eb_patch_cmd:wnn {#1} {#2} {#3} \ExplSyntaxOff\makeatother } \cs_new_protected:Npn \eb_patch_cmd:wnn #1#2#3 { \eb_seq_map_inline:nn {#1} { \ctex_patch_cmd_once:NnnnTF ##1 { } {#2} {#3} { } { \ctex_patch_failure:N ##1 } } } \cs_new_protected:Npn \eb_preto_cmd:Nn #1#2 { \ctex_preto_cmd:NnnTF #1 { } {#2} { } { \ctex_patch_failure:N #1 } } \cs_new_protected:Npn \eb_appto_cmd:Nn #1#2 { \ctex_appto_cmd:NnnTF #1 { } {#2} { } { \ctex_patch_failure:N #1 } } \cs_new_protected:Npn \eb_at_begin_environment:nn #1#2 { \eb_seq_map_inline:nn {#1} { \AtBeginEnvironment{##1}{#2} } } \cs_new_protected:Npn \eb_match_load_package:n #1 { \tl_if_in:nnTF {#1} { [ } { \seq_set_split:Nnn \l_tmpa_seq { [ } {#1} \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl \seq_pop_right:NN \l_tmpa_seq \l_tmpb_tl \IfFileExists{\l_tmpa_tl.sty} { \exp_last_unbraced:Nx \RequirePackage { [\l_tmpb_tl }{\l_tmpa_tl} }{} } { \IfFileExists{#1.sty}{\RequirePackage{#1}}{} } } \cs_new_protected:Npn \eb_if_package_loaded:nF #1#2 { \@ifpackageloaded{#1} {\msg_warning:nnn { easybase } { package-reloaded } {#1}} {#2\disable@package@load{#1}{}} } \msg_new:nnn { easybase } { package-reloaded } { The~macro~package~#1~has~been~reloaded. \\ Please~pass~the~arguments~by \\ the~\string\PassOptionsToPackage{\#1}{#1}\ command. } \cs_set_eq:NN \eb@usepackage@save \usepackage \RenewDocumentCommand{\usepackage}{O{}m} { \PassOptionsToPackage{#1}{#2} \eb_seq_map_inline:nn {#2} { \eb_if_package_loaded:nF {##1} { \eb@usepackage@save{##1} } } } \NewDocumentCommand{\LoadPackage}{O{}m} { \seq_set_split:Nnn \l_tmpb_seq { + } {#2} \int_compare:nNnT { \seq_count:N \l_tmpb_seq } = { 1 } { \PassOptionsToPackage{#1}{#2} } \seq_map_function:NN \l_tmpb_seq \eb_match_load_package:n } \cs_new_protected:Npn \eb_at_end_preamble:n { \BeforeBeginEnvironment{document} } \cs_gset_eq:NN \PackageWarning \PackageInfo \bool_if_exist:NF \l__eb_class_mode_book_bool { \bool_set_true:N \l__eb_class_mode_book_bool } \bool_if_exist:NF \l__eb_compile_draft_bool { \bool_set_false:N \l__eb_compile_draft_bool } \clist_new:N \g__eb_ctex_options_clist \keys_define:nn { easybase } { draft .code:n = \bool_set_true:N \l__eb_compile_draft_bool, floatpage .bool_set:N = \l__eb_float_page_bool, floatpage .default:n = true, floatpage .initial:n = false, paper .choice:, paper .value_required:n = true, paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, paper .initial:n = a4paper, class .choice:, class .value_required:n = true, class/book .code:n = { }, class/article .code:n = { \bool_set_false:N \l__eb_class_mode_book_bool \boolfalse{@twoside} \boolfalse{@mparswitch} }, class .initial:n = book, book .meta:n = { class = book }, article .meta:n = { class = article }, unknown .code:n = \clist_gput_right:NV \g__eb_ctex_options_clist \CurrentOption } \PassOptionsToPackage{list = off}{bicaption} \PassOptionsToPackage{many}{tcolorbox} \PassOptionsToPackage{upint}{newtxmath} \PassOptionsToPackage{svgnames}{xcolor} \ProcessKeysOptions{easybase} \PassOptionsToPackage{\g__eb_ctex_options_clist}{ctex} \@ifclassloaded{ctexbook}{} { \@ifclassloaded{ctexart}{} { \@ifclassloaded{ctexrep}{} {\RequirePackage[heading]{ctex}} } } \bool_new:N \l__eb_mark_uppercase_bool \bool_new:N \l__eb_chap_counter_withpart_bool \tl_new:N \l__eb_foot_counter_parent_choice_tl \eb_seq_map_inline:nn { style,subfont,spread, refset,bibset,thmset, geoset,hdrset,tocset } { \ctex_define:n { #1 .meta:nn = { ctex/#1 } {##1} } \cs_new_protected:cpn {#1} ##1 { \ctex_set:nn {#1} {##1} } } \keys_define:nn { } { ctex/link .inherit:n = ctex/refset } \ctex_define:n { link .meta:nn = { ctex/link } {#1} } \cs_set_eq:NN \link \refset \eb_seq_map_inline:nn { style,subfont,spread,bibset,thmset,hdrset,tocset } { \msg_new:nnn { easybase } { abandon-#1 } { ##1~is~an~abandoned~option~of~#1~module. \\ Please~browse~the~user~manual~for~the~new~options. } } \cs_new:Npn \eb_msg_abandon_option:n #1 { \msg_warning:nnx { easybase } { abandon-#1 } { \l_keys_key_str } } \cs_if_exist:NF \chapter { \newcounter{chapter} \bool_set_false:N \l__eb_class_mode_book_bool \ctex_define:n { chapter/tocline .code:n = { } } } \bool_if:NF \l__eb_class_mode_book_bool { \cs_undefine:N \chapter \ctex_after_end_preamble:n { \NewDocumentCommand{\chapter}{som} { \msg_error:nn { easybase } { no-chapter } \msg_redirect_name:nnn { easybase } { no-chapter } { none } } } } \msg_new:nnn { easybase } { no-chapter } { Your~document~class~is~in~article~mode. \\ The~\string\chapter\ command~will~not~be~used. } \LoadPackage { spbmark[both]+ ulem[normalem]+ enumitem[shortlabels,inline]+ chemformula+siunitx+pifont+ amsthm+thmtools+ geometry+marginnote+ pdfpages+multicol+ fancyhdr+titletoc+caption+ tabularray+ setspace+ listings } \cs_new_protected:Npn \eb_package_date_check:nn #1#2 { \IfPackageAtLeastTF{#1}{#2}{} {\msg_warning:nnn { easybase } { package-old } {#1}} } \msg_new:nnn { easybase } { package-old } { Package~#1~has~been~out~of~date. \\ Some~problems~or~errors~may~occur \\ if~you~continue~compiling. \\\\ Please~update~your~macro~package~from~CTAN. } \eb_seq_map_inline:nn { { expl3 } { 2020/10/27 }, { xparse } { 2020/10/27 }, { l3keys2e } { 2020/10/27 }, { thmtools } { 2020/08/01 }, { caption } { 2020/08/24 }, { fancyhdr } { 2021/01/28 }, { siunitx } { 2021/06/22 }, { tabularray } { 2021/07/01 }, { spbmark } { 2021/06/30 } } { \eb_package_date_check:nn #1 } \NewDocumentCommand{\eb_assign_tag_brackets:n} {>{\SplitArgument{1}{,}}m} {\eb_assign_tag_brackets_pos:nn #1} \cs_new_protected:Npn \eb_assign_tag_brackets_pos:nn #1#2 { \tl_set:Nn \eb@tag@brackets@left {#1} \tl_set:Nn \eb@tag@brackets@right {#2} } \cs_gset:Npn \tagform@ #1 { \maketag@@@ { \color{ctex@emph} \eb@tag@brackets@left \bgroup \ignorespaces{#1}\unskip\@@italiccorr \eb@tag@brackets@right \egroup } } \ctex_define:nn { style } { multoc .int_set:N = \l__eb_toc_columns_int, multoc .default:n = 2, withpart .bool_set:N = \l__eb_chap_counter_withpart_bool, withpart .default:n = true, withpart .initial:n = false, rulewidth .dim_set:N = \l__eb_rule_width_dim, rulewidth .initial:n = 0.6pt, uppercase .bool_set:N = \l__eb_mark_uppercase_bool, uppercase .default:n = true, uppercase .initial:n = true, brackets .code:n = \eb_assign_tag_brackets:n {#1}, brackets .initial:n = { (,) }, figurepath .tl_set:N = \l_eb_graphics_path_tl } \includepdfset{fitpaper = true} \geometry { vmargin = 2.54cm, hmargin = 3.17cm, columnsep = 2em, headheight = 2.04cm, headsep = 0.5cm, footskip = 0.79cm, footnotesep = 0.5cm, marginparsep = 8pt, marginparwidth = 2.54cm } \ctex_define:nn { geoset } { headruleskip .tl_set:N = \headruleskip, headruleskip .initial:n = 1.5pt, footruleskip .tl_set:N = \footruleskip, unknown .code:n = { \exp_args:Nx \geometry { \l_keys_key_str \tl_if_empty:NF \l_keys_value_tl { = {#1} } } } } \cs_new_protected:Npn \blankpagestyle #1 { \tl_set:Nn \l__eb_blank_pagestyle_tl {#1} } \blankpagestyle{empty} \RenewDocumentCommand{\cleardoublepage} {O{\l__eb_blank_pagestyle_tl}} { \clearpage \ifbool{@twoside} { \int_if_odd:nF { \c@page } { \hbox:n { }\thispagestyle{#1}\clearpage } }{} } \DeclareDocumentCommand{\frontmatter}{sO{Roman}} { \IfBooleanTF{#1}{\clearpage}{\cleardoublepage} \boolfalse{@mainmatter} \pagenumbering{#2} } \DeclareDocumentCommand{\mainmatter}{s} { \IfBooleanTF{#1}{\clearpage}{\cleardoublepage} \booltrue{@mainmatter} \pagenumbering{arabic} } \eb_seq_map_inline:nn { chapter,section,subsection } { \exp_args:Nc \NewDocumentCommand { eb@mark@#1@label@layout } {O{\use:c { CTEXthe#1 }}m} {\tl_set:cn { eb@mark@#1@label } {##1##2}} \cs_new:cpn { eb_mark_#1_name_parse:n } ##1 { \tl_if_in:nnTF {##1} { [ } { \use:c { eb@mark@#1@label@layout }##1 } { \use:c { eb@mark@#1@label@layout }{##1} } } } \cs_gset_eq:NN \easyhead \fancyhead \cs_gset_eq:NN \easyfoot \fancyfoot \NewDocumentCommand{\markrule} {O{\textwidth}D(){ctex@frame}m>{\SplitArgument{1}{|}}O{}} {\eb_draw_markrule:nnnnn {#1} {#2} {#3} #4} \cs_new_protected:Npn \eb_draw_markrule:nnnnn #1#2#3#4#5 { \group_begin: \tl_if_empty:nF {#4} { \vspace*{#4} } \color{#2}\hrule\@width #1\@height #3 \tl_if_novalue:nF {#5} { \vspace*{#5} } \group_end: } \ctex_define:nn { hdrset } { chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, chap-mark .initial:n = \CTEXifname{\eb@mark@chapter@label}{}#1, sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, sec-mark .initial:n = \CTEXifname{\eb@mark@section@label}{}#1, subsec-mark .cs_set:Np = \eb_fancyhf_subsection_mark:n #1, subsec-mark .initial:n = \CTEXifname{\eb@mark@subsection@label}{}#1, chap-label .code:n = \eb_mark_chapter_name_parse:n {#1}, chap-label .initial:n = \hspace{1em}, sec-label .code:n = \eb_mark_section_name_parse:n {#1}, sec-label .initial:n = \hspace{0.5em}, subsec-label .code:n = \eb_mark_subsection_name_parse:n {#1}, subsec-label .initial:n = \hspace{0.5em}, headrule .tl_gset:N = \headrule, headrule .initial:n = \markrule{\l__eb_rule_width_dim}, footrule .tl_gset:N = \footrule, footrule .initial:n = { }, footnoterule .tl_gset:N = \footnoterule, footnoterule .initial:n = \markrule[0.35\textwidth]{\l__eb_rule_width_dim}[|2.6pt] } \cs_set_eq:NN \eb_mark_uppercase:n \text_uppercase:n \cs_set_eq:NN \eb_mark_nouppercase:n \text_titlecase_first:n \cs_new:Npn \eb_mark_if_uppercase:nn #1#2 { \bool_if:NTF \l__eb_mark_uppercase_bool { \eb_mark_uppercase:n } { \eb_mark_nouppercase:n } { \use:c { eb_fancyhf_#1_mark:n } {#2} } } \cs_set:Npn \markdouble #1 { \markboth{#1}{\ifbool{@twoside}{#1}{}} } \cs_new:Npn \eb@level@markdouble #1#2 { \markdouble{\eb_mark_if_uppercase:nn {#1} {#2}} } \cs_new:Npn \eb@level@markright #1#2 { \markright{\eb_mark_if_uppercase:nn {#1} {#2}} } \cs_gset:Npn \chaptermark #1 { \eb@level@markdouble{chapter}{#1} } \cs_gset:Npn \sectionmark #1 { \bool_if:NTF \l__eb_class_mode_book_bool { \eb@level@markright{section}{#1} } { \eb@level@markdouble{section}{#1} } } \cs_gset:Npn \subsectionmark #1 { \bool_if:NF \l__eb_class_mode_book_bool { \eb@level@markright{subsection}{#1} } } \cs_gset_eq:NN \ps@plain \ps@empty \fancyhf{} \ifbool{@twoside} { \fancyhead[EC]{\color{ctex@frame}\kaishu\leftmark} \fancyhead[OC]{\color{ctex@frame}\kaishu\rightmark} \fancyhead[EL,OR]{\color{ctex@frame}\thepage} }{ \fancyhead[L]{\color{ctex@frame}\kaishu\leftmark} \fancyhead[R]{\color{ctex@frame}\thepage} } \bool_if:NT \l__eb_compile_draft_bool { \fancyfoot[C]{\color{SlateGray}\sffamily\today} \geometry{showframe} } \bool_new:N \l__eb_ps_used_bool \eb_appto_cmd:Nn \pagestyle { \bool_set_true:N \l__eb_ps_used_bool } \ctex_at_end_preamble:n { \bool_if:NF \l__eb_ps_used_bool { \pagestyle{fancy} } \tl_if_empty:NF \l_eb_graphics_path_tl { \exp_args:NV \graphicspath \l_eb_graphics_path_tl } \cs_if_exist:NF \kaishu { \cs_gset_eq:NN \kaishu \itshape } } \ctex_define:nn { style } { footwith .choices:nn = { part,page,chapter } { \tl_set:Nn \l__eb_foot_counter_parent_choice_tl {#1} }, footwith .value_required:n = true, footwith .initial:n = chapter } \NewDocumentCommand{\eb_assign_fntext_code:n} {>{\SplitArgument{1}{,}}m} {\eb_assign_fnmark_code_pos:nn #1} \cs_new_protected:Npn \eb_assign_fnmark_code_pos:nn #1#2 { \tl_set:Nn \l__eb_fntext_before_tl {#1} \tl_if_novalue:nTF {#2} { \tl_clear:N \l__eb_fntext_after_tl } { \tl_set:Nn \l__eb_fntext_after_tl {#2} } } \cs_new:Npn \eb_fnmate_counter_pifont:N #1 { \ding{\int_eval:n { 171 + #1 }} } \cs_new:Npn \eb_fnmate_counter_pifont_neg:N #1 { \ding{\int_eval:n { 181 + #1 }} } \cs_new:Npn \eb_fnmate_counter_pisans:N #1 { \ding{\int_eval:n { 191 + #1 }} } \cs_new:Npn \eb_fnmate_counter_pisans_neg:N #1 { \ding{\int_eval:n { 201 + #1 }} } \cs_new_protected:Npn \DefineFntSymbols #1#2#3 { \cs_set_protected:cpn { eb@use@fnt@symbol@#1 } { \cs_set:Npn \eb_int_to_symbols:n ####1 { \int_to_symbols:nnn {####1} {#2} {#3} } } } \cs_new_protected:Npn \setfntsymbol #1 { \use:c { eb@use@fnt@symbol@#1 } } \DefineFntSymbols{empty}{1}{} \setfntsymbol{empty} \cs_new:Npn \eb_int_format_trans:NN #1 { \str_case:nn {#1} { { A } { \int_to_Alph:n } { a } { \int_to_alph:n } { 1 } { \int_to_arabic:n } { I } { \int_to_Roman:n } { i } { \int_to_roman:n } { c } { \exp_args:NV \zhnumber } { s } { \eb_int_to_symbols:n } } } \cs_new_protected:Npn \eb_fnmate_normal_label_set:nn #1#2 { \tl_set:Nn \l__eb_fnmate_number_type_tl {#1} \cs_set:cpx {#2} { \str_case:VnT \l__eb_fnmate_number_type_tl { { plain } { \exp_not:N \int_use:N } { pifont } { \exp_not:N \eb_fnmate_counter_pifont:N } { pifont* } { \exp_not:N \eb_fnmate_counter_pifont_neg:N } { pisans } { \exp_not:N \eb_fnmate_counter_pisans:N } { pisans* } { \exp_not:N \eb_fnmate_counter_pisans_neg:N } } { \exp_not:N \c@footnote } } } \cs_new_protected:Npn \eb_fnmate_short_label_set:nn #1#2 { \tl_set:Nn \l__eb_fnmate_short_tokens_tl {#1} \eb_seq_map_inline:nn { A,a,1,I,i,c,s } { \tl_if_in:nnT {#1} {##1} { \tl_replace_once:Nnn \l__eb_fnmate_short_tokens_tl {##1} { \eb_int_format_trans:NN ##1 \c@footnote } \seq_map_break: } } \cs_set_eq:cN {#2} \l__eb_fnmate_short_tokens_tl } \cs_new_protected:Npn \eb_footnote_choice_handle:n #1 { \str_case:nnF {#1} { { bottom } { \bool_set_true:N \l__eb_fnpara_bottom_bool } { flush } { \tl_set:Nn \l__eb_footnote_choice_tl { default } \clist_push:Nn \l__eb_footnote_mulchoice_clist {#1} } } { \bool_lazy_or:nnT { \str_if_eq_p:nn {#1} { hang } } { \str_if_eq_p:nn {#1} { default } } { \tl_set:Nn \l__eb_footnote_choice_tl {#1} } } } \cs_new_protected:Npn \eb_fnmate_shift_set:nnn #1#2#3 { \str_if_eq:nnTF {#1} { match } { \tl_set:cv { l__eb_fn#2_#3shift_tl } { l__spb_super_script_#3shift_dim } } { \tl_set:cn { l__eb_fn#2_#3shift_tl } {#1} } } \cs_new_protected:Npn \eb_fnboth_format_set:nn #1#2 { \str_if_eq:nnTF {#1} { match } { \bool_set_true:c { l__eb_fn#2_format_match_bool } } { \bool_set_false:c { l__eb_fn#2_format_match_bool } \tl_set:cn { l__eb_fn#2_format_tl } {#1} } } \bool_new:N \l__eb_fnpara_bottom_bool \tl_new:N \l__eb_fnmate_format_tl \tl_new:N \l__eb_fncust_format_tl \clist_new:N \l__eb_footnote_mulchoice_clist \ctex_define:nn { hdrset } { fnindent .dim_set:N = \footindent, fnindent .initial:n = 0.75em, fnparskip .skip_set:N = \footparskip, fnparskip .initial:n = 0ex, fnparindent .tl_set:N = \footparindent, fnparindent .initial:n = 2em, fnpara-form .tl_set:N = \l__eb_fnpara_format_tl, fntext-pos .tl_set:N = \l__eb_fntext_position_tl, fntext-pos .initial:n = super, fntext-code .code:n = \eb_assign_fntext_code:n {#1}, fntext-code .initial:n = { ,\tl_if_eq:NnF \l__eb_fntext_position_tl { super } { ~ } }, fnmate-form .code:n = \eb_fnboth_format_set:nn {#1} { mate }, fncust-form .code:n = \eb_fnboth_format_set:nn {#1} { cust }, fnboth-form .meta:n = { fnmate-form = #1,fncust-form = #1 }, footnotetype .multichoices:nn = { default,hang,bottom,para,flush } { \eb_footnote_choice_handle:n {#1} }, footnotetype .value_required:n = true, footnotetype .initial:n = hang, fnmark-vshift .code:n = \eb_fnmate_shift_set:nnn {#1} { mark } { v }, fnmark-hshift .code:n = \eb_fnmate_shift_set:nnn {#1} { mark } { h }, fntext-vshift .code:n = \eb_fnmate_shift_set:nnn {#1} { text } { v }, fnmark-vshift .initial:n = 0pt, fnmark-hshift .initial:n = 0pt, fntext-vshift .initial:n = 0pt, fnmark-num .choices:nn = { plain,pifont,pifont*,pifont-sans,pifont-sans* } { \eb_fnmate_normal_label_set:nn {#1} { the@footnote } }, fnmark-num .value_required:n = true, fnmark-num/unknown .code:n = \eb_fnmate_short_label_set:nn {#1} { the@footnote }, fntext-num .choices:nn = { plain,pifont,pifont*,pifont-sans,pifont-sans* } { \eb_fnmate_normal_label_set:nn {#1} { thefootnote } }, fntext-num .value_required:n = true, fntext-num/unknown .code:n = \eb_fnmate_short_label_set:nn {#1} { thefootnote }, fnmate-num .meta:n = { fntext-num = #1,fnmark-num = #1 }, fnmate-num .initial:n = plain, unknown .code:n = \eb_msg_abandon_option:n { hdrset } } \eb_at_end_preamble:n { \group_begin: \footnotesize \setspread{\fp_use:N \l__eb_spread_footnote_fp} \exp_args:NNNo \group_end: \dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } \bool_if:NT \l__eb_chap_counter_withpart_bool { \counterwithin*{chapter}{part} } \str_case:VnT \l__eb_foot_counter_parent_choice_tl { { part } { \counterwithin*{footnote}{part} } { page } { \counterwithin*{footnote}{page} } } { \counterwithout*{footnote}{chapter} } \eb_fnpara_if_pos_bottom: } \cs_new_protected:Npn \setspread #1 { \linespread{#1}\selectfont } \cs_new_protected:Npn \eb_fnpara_if_pos_bottom: { \bool_if:NT \l__eb_fnpara_bottom_bool { \cs_set:Npn \@makecol { \setbox\@outputbox\box\@cclv \xdef\@freelist{\@freelist\@midlist} \global\let\@midlist\@empty \@combinefloats \eb@footmisc@ifvoid\footins{} { \setbox\@outputbox\vbox \bgroup \boxmaxdepth\@maxdepth \unvbox\@outputbox \vfill\relax \vskip\skip\footins \color@begingroup \normalcolor\footnoterule \unvbox\footins \color@endgroup \egroup } \eb@footmisc@ifvoid\@kludgeins {\@makespecialcolbox} { \setbox\@outputbox\vbox to\@colht { \@texttop\dimen@\dp\@outputbox \unvbox\@outputbox \vskip -\dimen@\@textbottom } } \global\maxdepth\@maxdepth } } } \cs_new_protected:Npn \eb_footnote_direct_hang: { \hbox_set:Nn \l_tmpa_box { \dim_compare:nNnTF { \footindent } > { 0pt } { \hbox_to_wd:nn { \footindent } { \eb@makefnmark\hss } } { \eb@makefnmark } } \dim_set:Nn \leftmargin { \box_wd:N \l_tmpa_box } \dim_zero:N \rightmargin \dim_set_eq:NN \linewidth \columnwidth \dim_sub:Nn \linewidth { \leftmargin } \parshape\@ne\leftmargin\linewidth \@setpar{{\@@par}} \mode_leave_vertical: \hbox_overlap_left:n { \box_use:N \l_tmpa_box } } \cs_new_protected:Npn \eb_footnote_direct_default: { \noindent \clist_if_in:NnT \l__eb_footnote_mulchoice_clist { flush } { \dim_zero:N \footindent } \int_case:nn { \dim_sign:V \footindent } { { 1 } { \use_i:nnn } { 0 } { \use_ii:nnn } { -1 } { \use_iii:nnn } } { \hbox_to_wd:nn { \footindent } { \hss\eb@makefnmark } } { \hbox_overlap_left:n { \eb@makefnmark } } { \hbox_overlap_left:n { \hbox_to_wd:nn { -\footindent } { \eb@makefnmark\hss } } } } \cs_set:Npn \@makefntext #1 { \group_begin: \str_case:Vn \l__eb_footnote_choice_tl { { hang } { \use_i:nn } { default } { \use_ii:nn } } { \eb_footnote_direct_hang: } { \eb_footnote_direct_default: } \skip_set:NV \parskip \footparskip \dim_set:NV \parindent \footparindent \l__eb_fnpara_format_tl{#1} \tl_if_eq:NnT \l__eb_footnote_choice_tl { hang } { \par } \group_end: } \cs_set_eq:NN \eb@makefntext \@makefntext \ctex_at_end_package:nn { footmisc } { \notbool{FN@para} { \cs_set_eq:NN \@makefntext \eb@makefntext \msg_warning:nn { easybase } { footmisc } }{} } \msg_new:nnn { easybase } { footmisc } { It~is~not~recommended~that~you~use~the \\ hang,~symbol,~marginal,~flushmargin~or~bottom \\ options~of~the~footmisc~package. } \cs_set_protected:Npn \footref #1 { \group_begin: \unrestored@protected@xdef\eb@thefnmark{\ref{#1}} \group_end: \H@@footnotemark } \cs_set_protected:Npn \footnote { \peek_meaning:NTF [ { \@xfootnote } { \exp_args:NV \stepcounter \@mpfn \eb_current_label:n { @footnote } \protected@xdef\@thefnmark{\thempfn} \protected@xdef\eb@thefnmark{\the@footnote} \@footnotemark \@footnotetext } } \cs_set:Npn \footnotemark { \peek_meaning:NTF [ { \@xfootnotemark } { \stepcounter{footnote} \protected@xdef\eb@thefnmark{\the@footnote} \@footnotemark } } \eb_patch_cmd:wnn { \@footnotetext,\@mpfootnotetext } { \reset@font } { \setspread{\fp_use:N \l__eb_spread_footnote_fp} \l__eb_subfont_footnote_tl } \ctex_at_end_package:nn { hyperref } { \cs_set:Npn \@xfootnotemark [#1] { \group_begin: \setcounter{footnote}{#1} \unrestored@protected@xdef\eb@thefnmark{\the@footnote} \group_end: \H@@footnotemark } } \ProvideDocumentCommand{\super}{omo}{\textsuperscript{#2}} \providecommand{\spbset}{\use_none:n} \NewDocumentCommand{\eb@fnmate@super}{sm} { \IfBooleanTF{#1} {\super[\l__eb_fntext_vshift_tl]{#2}[0pt]} { \super[\l__eb_fnmark_vshift_tl] {\l__eb_fnmate_format_tl{#2}} [\l__eb_fnmark_hshift_tl] } } \cs_new_protected:Npn \eb_fnmate_format_initial: { \bool_if:NTF \l__eb_normal_footnote_bool { \bool_if:NT \l__eb_fnmate_format_match_bool { \tl_clear:N \l__eb_fnmate_format_tl } } { \bool_if:NT \l__eb_fncust_format_match_bool { \tl_clear:N \l__eb_fnmate_format_tl } } \bool_if:NF \l__eb_fnmate_format_match_bool { \spbset{super-format = { }} } \tl_use:N \l__eb_subfont_footnote_tl } \bool_set_true:N \l__eb_normal_footnote_bool \bool_new:N \l__eb_fnmate_format_match_bool \bool_new:N \l__eb_fncust_format_match_bool \cs_set:Npn \@makefnmark { \hbox:n { \eb_fnmate_format_initial: \tl_if_eq:NnTF \@mpfn { footnote } { \eb@fnmate@super{\eb@thefnmark} } { \eb@fnmate@super{\@thefnmark} } } } \cs_new:Npn \eb@makefnmark { \hbox:n { \eb_fnmate_format_initial: \tl_if_eq:NnT \l__eb_fntext_position_tl { super } { \eb@fnmate@super* } { \tl_use:N \l__eb_fntext_before_tl \bgroup \l__eb_fnmate_format_tl{\@thefnmark} \egroup } \tl_use:N \l__eb_fntext_after_tl } } \tl_clear:N \@thefnmark \tl_new:N \eb@thefnmark \cs_new:Npn \eb@@makefnmark #1#2 { \tl_if_empty:oF {#2} { \group_begin: \unrestored@protected@xdef\eb@thefnmark{#1} \unrestored@protected@xdef\@thefnmark{#2} \group_end: } } \cs_new_protected:Npn \eb_fncust_format_initial: { % \hdrset{fntext-code = { }} \bool_set_false:N \l__eb_normal_footnote_bool \bool_if:NF \l__eb_fncust_format_match_bool { \tl_set_eq:NN \l__eb_fnmate_format_tl \l__eb_fncust_format_tl } } \NewDocumentCommand{\Footnote}{O{#2}mm} { \group_begin: \eb_fncust_format_initial: \eb@@makefnmark{#2}{#1} \@footnotemark \@footnotetext{#3} \group_end: } \cs_new_protected:Npn \Footnotemark #1 { \group_begin: \eb_fncust_format_initial: \eb@@makefnmark{#1}{#1}\@footnotemark \group_end: } \cs_new_protected:Npn \Footnotetext #1#2 { \group_begin: \eb_fncust_format_initial: \eb@@makefnmark{#1}{#1}\@footnotetext{#2} \group_end: } \cs_new:Npn \eb@footmisc@ifvoid #1#2#3 { \ifvoid #1#2\else #3\fi } \cs_set:Npn \thempfootnote { \int_to_alph:n { \c@mpfootnote } } \contentsuse{lstlisting}{lol} \seq_put_left:Nn \c__ctex_headings_seq { chapter } \seq_put_right:Nn \c__ctex_headings_seq { figure } \seq_put_right:Nn \c__ctex_headings_seq { table } \seq_put_right:Nn \c__ctex_headings_seq { lstlisting } \seq_remove_duplicates:N \c__ctex_headings_seq \ctex_define:n { lstlisting/#1 .meta:nn = { ctex/#1 } {##1} } \ctex_define:n { figure/#1 .meta:nn = { ctex/#1 } {##1} } \ctex_define:n { table/#1 .meta:nn = { ctex/#1 } {##1} } \ctex_define:n { list/#1 .meta:nn = { ctex/#1 } {##1} } \cs_new_protected:Npn \eb_titletoc_hang_fix:n #1 { \bool_if:NT \eb@titletoc@hang@fix@bool { \contentspush { \bool_if:NT \l__eb_toc_number_color_bool { \color{ctex@toc@number} } \thecontentslabel \tl_use:c { l__eb_toc_#1_after_tl } } } } \cs_new_protected:Npn \eb_toc_assign_keys:n #1 { \ctex_define:n { #1/tocformat .tl_set:c = l__eb_toc_#1_format_tl, #1/tocformat+ .code:n = \tl_put_right:cn { l__eb_toc_#1_format_tl } {##1}, #1/tocformat~+ .code:n = \tl_put_right:cn { l__eb_toc_#1_format_tl } {##1}, #1/tocindent .dim_set:c = l__eb_toc_#1_indent_dim, #1/tocrule .tl_set:c = l__eb_toc_#1_rule_tl, #1/tocafter .tl_set:c = l__eb_toc_#1_after_tl } \titlecontents{#1} [\dim_use:c { l__eb_toc_#1_indent_dim }] {\tl_use:c { l__eb_toc_#1_format_tl }} {\eb_titletoc_hang_fix:n {#1}}{} {\tl_use:c { l__eb_toc_#1_rule_tl }} } \seq_map_function:NN \c__ctex_headings_seq \eb_toc_assign_keys:n \eb_seq_map_inline:nn { figure,table,lstlisting } { \ctex_define:n { #1/between .tl_set:c = l__eb_toc_#1_between_hook_tl, #1/tocline .cs_set:cp = { eb@toc@label@#1 } ##1, } } \eb_seq_map_inline:nn { tocformat,tocformat+,tocformat~+, tocindent,tocrule,tocline,tocafter,between } { \ctex_define:n { list/#1 .meta:n = { figure/#1 = ##1,table/#1 = ##1, lstlisting/#1 = ##1 } } } \eb_seq_map_inline:nn { tocafter,tocindent,tocrule } { \ctex_define:nn { tocset } { #1-all .code:n = { \ctex_set:n { part/#1 = ##1,chapter/#1 = ##1, section/#1 = ##1,subsection/#1 = ##1, list/#1 = ##1 } } } } \ctex_define:nn { tocset } { lolskip .skip_set:N = \eb@toc@lolskip, lolskip .initial:n = 10pt, between .tl_set:N = \l__eb_toc_main_between_hook_tl, between .initial:n = { \bool_if:NTF \l__eb_class_mode_book_bool { \vspace*{-1pc} } { \vspace*{-0.2pc} } }, dotalign .bool_set:N = \l__eb_toc_dot_align_bool, dotalign .default:n = true, dotalign .initial:n = true, hang .bool_set:N = \eb@titletoc@hang@fix@bool, hang .default:n = true, hang .initial:n = false, pnumwd .code:n = \contentsmargin{#1}, pnumwd .initial:n = 1.55em, unknown .code:n = \eb_msg_abandon_option:n { tocset } } \NewDocumentCommand{\tocrule}{st-O{0.7pc}D(){1.2}mO{}} { \normalsize\normalfont \titlerule*[#3]{\scalebox{#4}{#5}}#6 \bgroup \IfBooleanF{#2} { \IfBooleanTF{#1} {\thecontentspage} { \bool_if:NTF \l__eb_toc_dot_align_bool { \contentspage } { \thecontentspage } } } \egroup } \cs_set_eq:NN \ctexnumberline \CTEXnumberline \cs_new:Npn \p@numberline { \protect\numberline } \cs_set:Npn \CTEXnumberline #1 { \CTEXifname { \bool_if:NTF \eb@titletoc@hang@fix@bool { \p@numberline{\use:c { CTEXthe#1 }} } { \use:c { CTEXthe#1 } \tl_use:c { l__eb_toc_#1_after_tl } } }{} } \cs_new:Npn \listnumberline #1 { \use:c { #1name }~\use:c { the#1 } \bool_if:NF \eb@titletoc@hang@fix@bool { \tl_use:c { l__eb_toc_#1_after_tl } } } \ctex_set:n { part/tocformat = \addvspace{1pc}\sffamily\large, part/tocindent = 0em, part/tocrule = \tocrule{}[\bfseries], part/tocline = \CTEXnumberline{#1}#2, chapter/tocformat = \addvspace{1pc}\sffamily\large, chapter/tocindent = 0em, chapter/tocrule = \tocrule{$\cdot$}[\bfseries], chapter/tocline = \CTEXnumberline{#1}#2, section/tocformat = { \addvspace{0.2pc} \bool_if:NF \l__eb_class_mode_book_bool { \sffamily } }, section/tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 1.5em } { 0em }, section/tocrule = { \bool_if:NTF \l__eb_class_mode_book_bool { \tocrule{$\cdot$} } { \tocrule{$\cdot$}[\bfseries] } }, section/tocline = \CTEXnumberline{#1}#2, subsection/tocformat = \addvspace{0.2pc}, subsection/tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 3.8em } { 1.4em }, subsection/tocrule = \tocrule{$\cdot$}, subsection/tocline = \CTEXnumberline{#1}#2, list/tocformat = \addvspace{0.2pc}, list/tocindent = 0em, list/tocrule = \tocrule{$\cdot$}, list/between = \vspace*{-0.2pc\bool_if:NT \l__eb_class_mode_book_bool { - 10pt }}, table/tocline = \listnumberline{table}, figure/tocline = \listnumberline{figure}, lstlisting/tocline = \listnumberline{lstlisting} } \ctex_set:nn { tocset } { tocafter-all = \hspace{1em} } \prop_new:N \l__eb_list_label_entry_prop \prop_set_from_keyval:Nn \l__eb_list_label_entry_prop { figure = \eb@toc@label@figure, table = \eb@toc@label@table } \cs_gset:Npn \caption@@@addcontentsline #1#2#3#4 { \addcontentsline{#1}{#2} { \bool_if:NT \eb@titletoc@hang@fix@bool { \p@numberline } \bgroup \prop_item:Nn \l__eb_list_label_entry_prop {#2}{#3} \egroup #4 } } \cs_set_eq:NN \eb@if@boolT \bool_if:NT \ctex_patch_cmd:Nnn \lst@MakeCaption { \addcontentsline{lol}{lstlisting} {\protect\numberline{\thelstlisting}\lst@@caption} } { \addcontentsline{lol}{lstlisting} { \eb@if@boolT\eb@titletoc@hang@fix@bool{\p@numberline} \bgroup \eb@toc@label@lstlisting{\thelstlisting} \egroup \lst@@caption } } \newcounter{bichapter} \newcounter{bisection}[bichapter] \newcounter{bisubsection}[bisection] \cs_new_protected:Npn \eb_current_label:n #1 { \tl_set:Nx \@currentlabel { \use:c { p@#1 } \tl_use:c { the#1 } } } \NewDocumentCommand{\counteruse}{soD(){arabic}mO{.}d()} { \IfBooleanF{#1}{\stepcounter{#4}} \IfValueT{#6}{\setcounter{#4}{#6}} \tl_set:cn { theeb@#4 } { \IfValueT{#2}{\use:c { the#2 }#5} \use:c {#3}{#4} } \tl_use:c { theeb@#4 } \eb_current_label:n { eb@#4 } } \cs_new:Npn \eb_section_counter_prefix:n #1 { \int_compare:nNnT { \c@chapter } > { 0 } { \use:c { the#1chapter }. } \int_to_arabic:v { c@#1section } } \cs_set:Npn \thebichapter { \@arabic\c@bichapter } \cs_set:Npn \thebisection { \eb_section_counter_prefix:n { bi } } \cs_set:Npn \thebisubsection { \thebisection.\@arabic\c@bisubsection } \cs_set:Npn \thesection { \eb_section_counter_prefix:n { } } \contentsuse{}{tec} \tl_new:N \eb@before@addbitoc@hook \NewDocumentCommand{\BeforeAddBitoc}{sm} { \IfBooleanTF{#1} {\tl_gset:Nn \eb@before@addbitoc@hook {#2}} {\tl_gput_right:Nn \eb@before@addbitoc@hook {#2}} } \cs_new_protected:Npn \CTEX@addbitocline #1#2 { \group_begin: \def\CTEX@prechapter{\CTEX@prebichapter} \def\CTEX@thechapter{\CTEX@bichapter@number} \def\CTEX@postchapter{\CTEX@postbichapter} \eb@before@addbitoc@hook \addcontentsline{tec}{#1}{\use:c { CTEX@#1@tocline }{#1}{#2}} \group_end: } \eb_seq_map_inline:nn { chapter,section,subsection } { \exp_args:Nc \NewDocumentCommand { bi#1 }{sO{##3}mm} { \IfBooleanTF{##1} { \use:c {#1}*{\phantomsection ##3} \CTEX@addtocline{#1}{##2} \tl_if_empty:oF {##4} { \CTEX@addbitocline{#1}{##4} } \tl_set:Nn \l__eb__bitoc_mark_title_level_tl {#1} \str_case:nn {#1} { { chapter } { \chaptermark{##2} } { section } { \sectionmark{##2} } { subsection } { \subsectionmark{##2} } } }{ \stepcounter{bi#1} \use:c {#1}[##2]{##3} \tl_if_empty:oF {##4} { \CTEX@addbitocline{#1}{##4} } } } } \cs_if_exist:NT \chapter { \eb_appto_cmd:Nn \@chapter { \skip_if_eq:nnF { \eb@toc@lolskip } { \c_zero_skip } { \addtocontents{lol}{\protect\addvspace{\skip_use:N \eb@toc@lolskip}} } } } \ctex_define:nn { style } { figure-connect .tl_set:N = \l__eb_figure_connector_tl, table-connect .tl_set:N = \l__eb_table_connector_tl, listing-connect .tl_set:N = \l__eb_lstlisting_connector_tl, equation-connect .tl_set:N = \l__eb_equation_connector_tl, connect-all .meta:n = { figure-connect = #1,table-connect = #1, listing-connect = #1,equation-connect = #1 }, connect-all .initial:n = { . }, unknown .code:n = \eb_msg_abandon_option:n { style } } \eb_seq_map_inline:nn { figure,table,lstlisting,equation } { \cs_set:cpn { the#1 } { \int_compare:nNnT { \c@chapter } > { 0 } { \thechapter \tl_use:c { l__eb_#1_connector_tl } } \int_to_arabic:v { c@#1 } } } \tl_set:Nx \l__eb_toc_title_level_tl { \bool_if:NTF \l__eb_class_mode_book_bool { chapter } { section } } \tl_new:N \eb@bitoc@title \keys_define:nn { eb/listoc } { section .code:n = \tl_set:Nn \l__eb_toc_title_level_tl { section }, chapter .code:n = \tl_set:Nn \l__eb_toc_title_level_tl { chapter }, none .code:n = \tl_set:Nn \l__eb_toc_title_level_tl { none }, article .meta:n = section, book .meta:n = chapter, multoc .int_set:N = \l__eb_toc_columns_int, multoc .default:n = 2, multoc .initial:n = 1, columns .meta:n = { multoc = #1 }, title .code:n = \eb_assign_toc_title:n {#1} } \bool_if:NTF \l__eb_class_mode_book_bool { \keys_define:nn { } { eb/listoc .inherit:n = ctex/chapter } } { \keys_define:nn { } { eb/listoc .inherit:n = ctex/section } } \NewDocumentCommand{\eb_assign_toc_title:n} {>{\SplitArgument{1}{,}}m} {\eb_assign_toc_title_judge:nn #1} \cs_new_protected:Npn \eb_assign_toc_title_judge:nn #1#2 { \tl_set:Nn \eb@toc@title {#1} \tl_if_novalue:nTF {#2} { \tl_clear:N \eb@bitoc@title } { \tl_set:Nn \eb@bitoc@title {#2} } } \cs_new_protected:Npn \eb_toc_title_level_initial: { \bool_if:NF \l__eb_class_mode_book_bool { \tl_if_eq:NnT \l__eb_toc_title_level_tl { chapter } { \tl_set:Nn \l__eb_toc_title_level_tl { section } } } } \cs_new_protected:Npn \eb_title_mark_intoc:n #1 { \str_case:Vn \l__eb_toc_title_level_tl { { chapter } { \bichapter*{#1}{\eb@bitoc@title} } { section } { \bisection*{#1}{\eb@bitoc@title} } } } \cs_new_protected:Npn \eb_title_mark_notoc:n #1 { \str_case:Vn \l__eb_toc_title_level_tl { { chapter } { \chapter*{\phantomsection #1}\chaptermark{#1} } { section } { \section*{\phantomsection #1}\sectionmark{#1} } } } \cs_new_protected:Npn \eb_title_number_intoc_spec:nn #1#2 { \eb_toc_title_level_initial: \IfBooleanTF{#1} { \str_case:Vn \l__eb_toc_title_level_tl { { chapter } { \bichapter{\eb@toc@title}{\eb@bitoc@title} } { section } { \bisection{\eb@toc@title}{\eb@bitoc@title} } } }{ \IfBooleanTF{#2} {\eb_title_mark_notoc:n { \eb@toc@title }} {\eb_title_mark_intoc:n { \eb@toc@title }} } } \cs_new_protected:Npn \eb_biber_title_level_spec:n #1 { \bool_if:NTF \l__eb_class_mode_book_bool { \bichapter*{#1}{\l__eb_bib_en_bitoc_title_tl} } { \bisection*{#1}{\l__eb_bib_en_bitoc_title_tl} } \sectionmark{#1} } \cs_new_protected:Npn \eb_toc_start_multi_column_ext:n #1 { \int_compare:nNnTF { \l__eb_toc_columns_int } > { 1 } { \begin{multicols}{\int_use:N \l__eb_toc_columns_int} \@starttoc{#1} \end{multicols} } { \@starttoc{#1} } } \cs_new_protected:Npn \eb_toc_if_title_between_hook:n #1 { \tl_if_eq:NnF \l__eb_toc_title_level_tl { none } { \tl_use:c { l__eb_toc_#1_between_hook_tl } } } \cs_new_protected:Npn \eb_toc_list_parse:nnnnn #1#2#3#4#5 { \group_begin: \tl_set_eq:Nc \eb@toc@title { list#4name } \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \eb_title_number_intoc_spec:nn {#2} {#1} \eb_toc_if_title_between_hook:n {#4} \eb_toc_start_multi_column_ext:n {#5} \group_end: } \cs_new_protected:Npn \eb_list_content_cmd_set:nn #1#2 { \exp_args:Nc \DeclareDocumentCommand { listof#1s }{st+o} {\eb_toc_list_parse:nnnnn {##1} {##2} {##3} {#1} {#2}} } \eb_seq_map_inline:nn { { figure } { lof }, { table } { lot }, { lstlisting } { lol } } { \eb_list_content_cmd_set:nn #1 } \cs_set_eq:NN \listoflistings \listoflstlistings \RenewDocumentCommand{\tableofcontents}{t+oD(){}} { \group_begin: \tl_set_eq:NN \eb@toc@title \contentsname \tl_set:Nn \eb@bitoc@title { Contents } \IfValueT{#2}{\keys_set:nn { eb/listoc } {#2}} \eb_toc_title_level_initial: \eb_title_mark_notoc:n { \eb@toc@title } \eb_toc_if_title_between_hook:n { main } \eb_toc_start_multi_column_ext:n { toc }#3 \IfBooleanT{#1} { \eb_title_mark_notoc:n { \eb@bitoc@title } \eb_toc_if_title_between_hook:n { main } \eb_toc_start_multi_column_ext:n { tec } } \group_end: } \ctex_at_end_package:nn { imakeidx } { \makeindex \RenewDocumentCommand{\printindex}{st+oD(){\imki@jobname}} { \group_begin: \tl_set_eq:NN \eb@toc@title \indexname \cs_set_eq:NN \imki@indexlevel \use_none:n \setkeys{imkiindex}{noclearpage} \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \cs_set_protected:Npn \imki@indexheaders { \eb_title_number_intoc_spec:nn {#2} {#1} \cs_set_eq:NN \thispagestyle \use_none:n \cs_undefine:N \imki@firstpagestyle } \imki@putindex{#4} \group_end: } } \ctex_define:nn { chapter } { biname .code:n = \ctex_assign_heading_name:nn { bichapter } {#1}, biname .initial:n = Chapter\space, binmuber .tl_set:N = \CTEX@bichapter@number, binmuber .initial:n = \arabic{chapter} } \cs_new_protected:Npn \eb_counter_zero:n #1 { \eb_seq_map_inline:nn {#1} { \setcounter{##1}{0} } } \RenewDocumentCommand{\appendix} {O{Appendix\space}D(){\Alph{chapter}}} { \ctex_assign_heading_name:nn { biappendix } {#1} \int_compare:nNnTF { \c@chapter } > { 0 } { \eb_char_patch_cmd:wnn \CTEX@addbitocline { \def\CTEX@prechapter{\CTEX@prebichapter} \def\CTEX@thechapter{\CTEX@bichapter@number} \def\CTEX@postchapter{\CTEX@postbichapter} } { \def\CTEX@prechapter{\CTEX@prebiappendix} \def\CTEX@thechapter{#2} \def\CTEX@postchapter{\CTEX@postbiappendix} } \gdef\thechapter{\@Alph\c@chapter} \gdef\thebichapter{\@Alph\c@bichapter} \gdef\CTEX@prechapter{\CTEX@preappendix} \gdef\CTEX@thechapter{\CTEX@appendix@number} \gdef\CTEX@postchapter{\CTEX@postappendix} \gdef\CTEX@chapter@numbering{\CTEX@appendix@numbering} \eb_counter_zero:n { chapter,section,bichapter,bisection } } { \gdef\thesection{\@Alph\c@section} \gdef\thebisection{\@Alph\c@bisection} \gdef\CTEX@presection{\CTEX@preappendix} \gdef\CTEX@thesection{\CTEX@appendix@number} \gdef\CTEX@postsection{\CTEX@postappendix} \gdef\CTEX@section@numbering{\CTEX@appendix@numbering} \ctex_set:nn { appendix } { number = \@Alph\c@section,name = { } } \eb_counter_zero:n { section,subsection,bisection,bisubsection } } } \tl_new:N \l__eb_subfont_table_tl \tl_new:N \l__eb_subfont_figure_tl \tl_new:N \l__eb_subfont_listing_tl \tl_new:N \l__eb_subfont_footnote_tl \ctex_define:nn { subfont } { caption-table .tl_set:N = \l__eb_subfont_table_tl, caption-figure .tl_set:N = \l__eb_subfont_figure_tl, caption-listing .tl_set:N = \l__eb_subfont_listing_tl, caption .meta:n = { caption-table = #1,caption-figure = #1, caption-listing = #1 }, caption .initial:n = \sffamily\small, footnote .tl_set:N = \l__eb_subfont_footnote_tl, footnote .initial:n = \rmfamily, marginpar .tl_set:N = \marginfont, marginpar .initial:n = \rmfamily\footnotesize, unknown .code:n = \eb_msg_abandon_option:n { subfont } } \fp_new:N \l__eb_spread_table_fp \fp_new:N \l__eb_spread_math_fp \fp_new:N \l__eb_spread_caption_fp \fp_new:N \l__eb_spread_footnote_fp \ctex_define:nn { spread } { line .code:n = \AfterPreamble{\setspread{#1}}, line .initial:n = 1.354, table .fp_set:N = \l__eb_spread_table_fp, table .initial:n = 1.354, math .fp_set:N = \l__eb_spread_math_fp, math .initial:n = 1.2, caption .fp_set:N = \l__eb_spread_caption_fp, caption .initial:n = 1.2, footnote .fp_set:N = \l__eb_spread_footnote_fp, footnote .initial:n = 1.2, spread-all .meta:n = { line = #1,table = #1,math = #1,caption = #1,footnote = #1 }, unknown .code:n = \eb_msg_abandon_option:n { spread } } \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{~}(#2)} \DeclareCaptionFont{eb@table@font}{\l__eb_subfont_table_tl} \DeclareCaptionFont{eb@figure@font}{\l__eb_subfont_figure_tl} \DeclareCaptionFont{eb@listing@font}{\l__eb_subfont_listing_tl} \captionsetup { format = hang, font = {stretch = \fp_use:N \l__eb_spread_caption_fp}, labelfont = {color = ctex@frame}, labelsep = quad, singlelinecheck = true, belowskip = 0pt, aboveskip = 10pt } \captionsetup[table]{font += eb@table@font} \captionsetup[figure]{font += eb@figure@font} \captionsetup[lstlisting]{font += eb@listing@font} \captionsetup[subfigure] { labelformat = parens, font+ = eb@figure@font, belowskip = 2pt, aboveskip = 6pt } \ctex_at_end_package:nn { bicaption } { \captionsetup[figure][bi-second]{name = Figure} \captionsetup[table][bi-second]{name = Table} } \eb_at_begin_environment:nn { tabular,tabularx,tblr,longtblr,longtable } { \setspread{\fp_use:N \l__eb_spread_table_fp} } \IfPackageAtLeastTF{tabularray}{2021/07/01}{\UseTblrLibrary{booktabs}}{} \bool_if:NF \l__eb_float_page_bool { \tl_gset:Nn \textfraction { 0.1 } \tl_gset:Nn \topfraction { 0.9 } \tl_gset:Nn \bottomfraction { 0.9 } \tl_gset:Nn \floatpagefraction { 0.9 } \tl_gset:Nn \dbltopfraction { 0.9 } \tl_gset:Nn \dblfloatpagefraction { 0.9 } } \dim_zero_new:N \mathindent \skip_set:Nn \parskip { 0pt plus 2pt minus 1pt } \skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt } \skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt } \skip_set:Nn \multicolsep { 12pt plus 4pt minus 3pt } \skip_set:Nn \dbltextfloatsep { 16pt plus 2pt minus 4pt } \int_gset:Nn \vbadness { 10000 } \int_gset:Nn \hbadness { 10000 } \setcounter{topnumber}{4} \setcounter{bottomnumber}{4} \setcounter{totalnumber}{8} \allowdisplaybreaks[4] \everymath{\displaystyle} \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} \cs_set_protected:Npn \hangpara #1#2 { \hangindent #1\hangafter #2\noindent\ignorespaces } \DeclareDocumentEnvironment{hangparas}{mm+b} { \dim_zero:N \parindent \everypar{\hangpara{#1}{#2}}#3\par }{} \cs_new_protected:Npn \eb_enumitem_label_set:nn #1#2 { \SetEnumitemValue{label}{#1}{\color{ctex@emph}#2} } \eb_seq_map_inline:nn { { bullet } { \textbullet }, { endash } { \normalfont\bfseries\textendash }, { asterisk } { \textasteriskcentered }, { arabic } { \arabic*. }, { alph } { (\alph*) }, { roman } { \roman*. }, { outline } { \upshape\ding{111} } } { \eb_enumitem_label_set:nn #1 } \SetEnumitemValue{font}{sf}{\color{ctex@emph}\normalfont\sffamily} \SetEnumitemValue{ref}{enumii}{\arabic{enumi}.\alph*} \SetEnumitemValue{ref}{enumiii}{\arabic{enumi}.\alph{enumii}.\roman*} \setlist{nosep,align = left} \setlist*{labelsep = 0.5em,listparindent = 2em,leftmargin = *} \setlist[itemize,1]{label = bullet} \setlist[itemize,2]{label = endash} \setlist[itemize,3]{label = asterisk} \setlist[enumerate,1]{label = arabic,ref = \arabic*} \setlist[enumerate,2]{label = alph,ref = enumii,labelwidth = *} \setlist[enumerate,3]{label = roman,ref = enumiii,labelwidth = *} \setlist[description]{font = sf,labelwidth = *,leftmargin = 2em} \newlist{eb@outline@list}{itemize}{1} \newlist{eb@exercise@list}{enumerate}{2} \newlist{eb@eqcomp@list}{description}{1} \setlist[eb@outline@list]{label = outline,itemsep = 0.5ex plus .1ex} \setlist[eb@eqcomp@list]{labelsep = 0em} \cs_new:Npn \setexerlist #1 { \setlist*[eb@exercise@list]{#1} } \cs_new:Npn \seteqcomplist #1 { \setlist*[eb@eqcomp@list]{#1} } \cs_new:Npn \setoutlinelist #1 { \setlist*[eb@outline@list]{#1} } \keys_define:nn { eb/eqcomp } { width .dim_set:N = \l__eb_eqsymb_width_dim, width .initial:n = 10pt, delim .tl_set:N = \l__eb_eqsymb_delim_tl, delim .initial:n = { —— }, space .dim_set:N = \l__eb_eqsymb_space_dim, space .initial:n = 0.25em, item-align .tl_set:N = \l__eb_eqsymb_item_align_tl, item-align .initial:n = r, delim-align .tl_set:N = \l__eb_eqsymb_delim_align_tl, delim-align .initial:n = c, enumitem .code:n = \seteqcomplist{#1}, intro .tl_set:N = \l__eb_eqsymb_intro_tl, font .tl_set:N = \l__eb_eqsymb_font_tl, mode .tl_set:N = \l__eb_eqsymb_mode_tl, mode .initial:n = math } \cs_new_protected:Npn \seteqcomp #1 { \keys_set:nn { eb/eqcomp} {#1} } \cs_new:Npn \eb_eqsymb_left_margin_calc: { \hbox_set:Nn \l_tmpa_box { \l__eb_eqsymb_delim_tl } \hbox_set:Nn \l_tmpb_box { \l__eb_eqsymb_intro_tl } \dim_set:Nn \l_tmpa_dim { \box_wd:N \l_tmpb_box + \l__eb_eqsymb_width_dim + \l__eb_eqsymb_space_dim + \box_wd:N \l_tmpa_box + \l__eb_eqsymb_space_dim } } \NewDocumentEnvironment{eqcomp}{oD(){}+b} { \IfValueT{#1}{\keys_set:nn { eb/eqcomp } {#1}} \eb_eqsymb_left_margin_calc: \begin{eb@eqcomp@list}[#2] #3 \end{eb@eqcomp@list} }{} \cs_new_protected:Npn \eb_eqsymb_format_mark:n #1 { \tl_use:N \l__eb_eqsymb_font_tl { \tl_if_eq:NnT \l__eb_eqsymb_mode_tl { math } { \ensuremath }{#1} } } \cs_new_protected:Npn \eb_eqsymb_space_delim:nn #1#2 { \hspace{\l__eb_eqsymb_space_dim} \IfBooleanTF{#1} {\makebox{#2}} {\makebox[\box_wd:N \l_tmpa_box][\l__eb_eqsymb_delim_align_tl]{#2}} \hspace{\l__eb_eqsymb_space_dim} } \cs_new_protected:Npn \eb@itembox { \item\makebox } \NewDocumentCommand{\symb}{smO{\l__eb_eqsymb_delim_tl}} { \IfBooleanTF{#1} { \eb_eqsymb_format_mark:n {#2} \eb_eqsymb_space_delim:nn {#1} {#3} } { \eb@itembox[\l_tmpa_dim] { \makebox[\box_wd:N \l_tmpb_box]{\l__eb_eqsymb_intro_tl} \makebox[\l__eb_eqsymb_width_dim][\l__eb_eqsymb_item_align_tl] {\eb_eqsymb_format_mark:n {#2}} \eb_eqsymb_space_delim:nn {#1} {#3} } } \tl_clear:N \l__eb_eqsymb_intro_tl \ignorespaces } \cs_new_protected:Npn \eb_thm_name_set:nnn #1#2#3 { \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } { \tl_const:cn { c__eb_name_#1_tl } {#3} } { \tl_const:cn { c__eb_name_#1_tl } {#2} } } \cs_undefine:N \proof \cs_set_eq:NN \eb@declaretheorem@save \declaretheorem \cs_set_eq:NN \eb@declaretheoremsyle@save \declaretheoremstyle \RenewDocumentCommand{\declaretheorem}{O{}mO{}} {\AtBeginDocument{\eb@declaretheorem@save[#1,#3]{#2}}} \RenewDocumentCommand{\declaretheoremstyle}{O{}mO{}} {\eb@declaretheoremsyle@save[#1,#3]{#2}} \cs_set_eq:NN \newtheorem \declaretheorem \cs_new_protected:Npn \eb_if_thmframe_with_tcolorbox:TF #1#2 { \bool_if:NT \l__eb_thm_frame_bool { \@ifpackageloaded{tcolorbox}{#1}{#2} } } \NewDocumentCommand{\deftheorem} {mO{\text_titlecase_first:n {#1}}mD(){tc-theorem}O{}} { \eb_thm_name_set:nnn {#1} {#2} {#3} \declaretheorem{#1}[ name = \tl_use:c { c__eb_name_#1_tl }, style = easy-theorem,#5 ] \eb_if_thmframe_with_tcolorbox:TF { \tcolorboxenvironment{#1}{#4} } { } \labelformat{#1}{\tl_use:c { c__eb_name_#1_tl }~##1} } \prop_new:N \l__eb_thmtools_entry_prop \clist_const:Nn \c__eb_thmtools_entry_clist { within = \l__eb_thm_within_tl, headfont = \l__eb_thm_headfont_tl, notefont = \l__eb_thm_notefont_tl, bodyfont = \l__eb_thm_bodyfont_tl, headpunct = \l__eb_thm_headpunct_tl, spaceabove = \l__eb_thm_spaceabove_tl, spacebelow = \l__eb_thm_spacebelow_tl, headindent = \l__eb_thm_headindent_tl, headformat = \l__eb_thm_headformat_tl, postheadspace = \l__eb_thm_postheadspace_tl } \prop_set_from_keyval:NV \l__eb_thmtools_entry_prop \c__eb_thmtools_entry_clist \prop_map_inline:Nn \l__eb_thmtools_entry_prop { \ctex_define:nn { thmset } { #1 .tl_set:N = #2 } } \ctex_define:nn { thmset } { thmframe .bool_set:N = \l__eb_thm_frame_bool, thmframe .default:n = true, thmframe .initial:n = false, thmbox .meta:n = { thmframe = #1 }, thmbox .default:n = true, notebraces .tl_set:N = \l__eb_thm_notebraces_tl, unknown .code:n = \eb_msg_abandon_option:n { thmset } } \eb_patch_cmd:wnn \thmt@setheadstyle { \def\NAME{\the\thm@headfont ##1} } { \def\NAME { \the\thm@headfont ##1 \peek_meaning:NT \NUMBER { \tl_if_blank:nF {##2} { \ } } } } \ctex_set:nn { thmset } { spaceabove = 0ex plus .1ex, spacebelow = 0ex plus .1ex, headindent = 0em, headfont = \color{ctex@emph}\sffamily, postheadspace = 1em, notebraces = {(}{)}, within = \bool_if:NT \l__eb_class_mode_book_bool { chapter }, headformat = \NAME\NUMBER\NOTE } \msg_new:nnn { easybase } { need-tcolorbox } { Now~that~the~thmframe~option~is~true. \\ Please~load~the~tcolorbox~macro~package. } \eb_at_end_preamble:n { \eb_if_thmframe_with_tcolorbox:TF { } { \msg_warning:nn { easybase } { need-tcolorbox } } \clist_put_right:Nx \c__eb_thmtools_entry_clist { notebraces = \l__eb_thm_notebraces_tl } \exp_last_unbraced:NNV \declaretheoremstyle[\c__eb_thmtools_entry_clist]{easy-theorem} \deftheorem{lemma}{引理} \deftheorem{example}{例} \deftheorem{theorem}{定理} \deftheorem{corollary}{推论} \deftheorem{definition}{定义} \deftheorem{proposition}{性质} \deftheorem{remark}{注}[numbered = no] \deftheorem{proof}{证明}[numbered = no,qed = \qedsymbol] } \setchemformula { math-scripts = false, charge-hshift = 0.25em, subscript-vshift = -0.2ex } \IfPackageAtLeastTF{siunitx}{2021/06/22} { \sisetup { mode = match, table-parse-only, text-family-to-math, text-series-to-math, reset-text-family = false, reset-text-series = false, reset-text-shape = false, range-phrase = \ensuremath{\sim}, range-units = single, group-digits = none } }{} \eb_at_begin_environment:nn { array,matrix,pmatrix,bmatrix,Bmatrix,vmatrix,Vmatrix, matrix*,pmatrix*,bmatrix*,Bmatrix*,vmatrix*,Vmatrix*, cases,cases*,dcases,dcases*,rcases,rcases*,drcases,drcases*, aligned,alignedat,gathered,multlined,lgathered,rgathered } { \setspread{\fp_use:N \l__eb_spread_math_fp} } \eb_patch_cmd:wnn { \start@gather,\start@align,\start@multline } { \collect@body } { \setspread{\fp_use:N \l__eb_spread_math_fp} \collect@body } \eb_patch_cmd:wnn \gather@split { \spread@equation } { \setspread{\fp_use:N \l__eb_spread_math_fp} \spread@equation } \ctex_after_end_preamble:n { \skip_set:Nn \abovedisplayskip { 6pt plus 1pt minus 1pt } \skip_set:Nn \belowdisplayskip { 6pt plus 1pt minus 1pt } \skip_set:Nn \abovedisplayshortskip { 0pt plus 1pt minus 1pt } \skip_set:Nn \belowdisplayshortskip { 6pt plus 1pt minus 1pt } } \ctex_at_end_package:nn { unicode-math } { \msg_redirect_module:nnn { unicode-math } { warning } { info } } \ctex_at_end_package:nn { tcolorbox } { \eb_package_date_check:nn { tcolorbox } { 2020/10/09 } \file_if_exist_input:n { eb-tcolorbox.cfg } } \bool_set_true:N \l__eb_backend_bibtex_bool \tl_new:N \l__eb_bib_both_style_tl \tl_new:N \l__eb_bib_cite_style_tl \clist_new:N \l__eb_bib_datafile_clist \ctex_define:nn { bibset } { backend .choice:, backend .value_required:n = true, backend/bibtex .code:n = { }, backend/biblatex .code:n = \bool_set_false:N \l__eb_backend_bibtex_bool, bibstyle .code:n = \tl_set:Nn \l__eb_bib_both_style_tl {#1}, bibstyle .value_required:n = true, bibstyle .initial:n = numerical, citestyle .code:n = \tl_set:Nn \l__eb_bib_cite_style_tl {#1}, datafile .clist_set:N = \l__eb_bib_datafile_clist, bitoc-title .tl_set:N = \l__eb_bib_en_bitoc_title_tl, bitoc-title .initial:n = Reference, unknown .code:n = \eb_msg_abandon_option:n { bibset } } \cs_new_protected:Npn \eb_natbib_bibtex_set: { \LoadPackage[sort&compress]{natbib} \str_case:VnTF \l__eb_bib_both_style_tl { { numerical } { \bibliographystyle{gbt7714-numerical} \setcitestyle{comma,square,super} } { authoryear } { \bibliographystyle{gbt7714-author-year} } } { \cs_set_eq:NN \cite \citep } { \exp_args:NV \bibliographystyle \l__eb_bib_otherstyle_tl } \tl_if_empty:NF \l__eb_bib_cite_style_tl { \exp_args:NV \setcitestyle \l__eb_bib_cite_style_tl } \NewDocumentCommand{\printbibliography}{st+o} { \group_begin: \tl_set_eq:NN \eb@toc@title \bibname \IfValueT{##3}{ \keys_set:nn { eb/listoc } {##3} } \cs_set_protected:Npn \bibsection { \eb_title_number_intoc_spec:nn {##2} {##1} \int_compare:nNnT { \l__eb_toc_columns_int } > { 1 } { \begin{multicols}{\int_use:N \l__eb_toc_columns_int} } } \exp_args:NV \bibliography \l__eb_bib_datafile_clist \group_end: } \AtEndEnvironment{thebibliography} {\int_compare:nNnT { \l__eb_toc_columns_int } > { 1 } { \end{multicols} }} \skip_zero:N \bibsep } \cs_new_protected:Npn \eb_put_biblatex:n #1 { \PassOptionsToPackage{#1}{biblatex} } \cs_new_protected:Npn \eb_biblatex_biber_set: { \str_case:VnF \l__eb_bib_both_style_tl { { numerical } { \use_i:nnn } { authoryear } { \use_ii:nnn } } { \use_iii:nnn } { \eb_put_biblatex:n { style = gb7714-2015 } } { \eb_put_biblatex:n { style = gb7714-2015ay } } { \eb_put_biblatex:n { style = \l__eb_bib_both_style_tl } } \tl_if_empty:NF \l__eb_bib_cite_style_tl { \eb_put_biblatex:n { citestyle = \l__eb_bib_cite_style_tl } } \LoadPackage[backend = biber]{biblatex} \clist_map_function:NN \l__eb_bib_datafile_clist \addbibresource \tl_gset:Nn \blx@default@theheading { bibintoc } \defbibheading{bibintoc}[\bibname]{\eb_biber_title_level_spec:n {##1}} \skip_zero:N \bibitemsep } \eb_at_end_preamble:n { \clist_if_empty:NF \l__eb_bib_datafile_clist { \bool_if:NTF \l__eb_backend_bibtex_bool { \eb_natbib_bibtex_set: } { \eb_biblatex_biber_set: } } } \cs_new:Npn \eb@lst@if@display #1#2 { \lst@ifdisplaystyle #1\else #2\fi } \lstdefinestyle{lst-base} { breaklines = true, resetmargins = true, % numbers = left, numberstyle = \footnotesize, basewidth = 0.5em, columns = flexible, aboveskip = 1.5ex plus .2ex minus .1ex, belowskip = 1.5ex plus .2ex minus .1ex, abovecaptionskip = -1ex, belowcaptionskip = 1.5ex, keepspaces = true, escapeinside = {(*}{*)}, framerule = \l__eb_rule_width_dim, xleftmargin = 5pt, xrightmargin = 5pt, framesep = \dimexpr(5pt - \l__eb_rule_width_dim), frame = single, rulecolor = \color{ctex@frame}, commentstyle = \color{SlateGray}, emphstyle = \color{ctex@emph} } \lstdefinestyle{lst-latex} { style = lst-base, language = [LaTeX]TeX, texcsstyle = *\color{ctex@verb}\bfseries, basicstyle = \ttfamily\eb@lst@if@display{\small}{\color{ctex@verb}}, keywordstyle = \color{ctex@verb}\eb@lst@if@display{\bfseries}{} } \lstset{style = lst-latex} \lstloadlanguages{C,C++,Java,Python,Matlab} \clist_new:N \l__eb_hyperref_clist \cs_new_protected:Npn \eb_put_hyperref:n #1 { \clist_put_right:Nn \l__eb_hyperref_clist {#1} } \cs_new_protected:Npn \eb_define_link_color:nnn #1#2#3 { \definecolorset{HTML}{ctex@}{}{link,#1;url,#2;cite,#3} } \cs_new_protected:Npn \eb_define_theme_color:nnn #1#2#3 { \definecolorset{HTML}{ctex@}{}{frame,#1;emph,#2;verb,#3} } \cs_new_protected:Npn \eb_define_link_color:n #1 { \definecolorset{HTML}{ctex@}{}{link,#1;url,#1;cite,#1} } \cs_new_protected:Npn \eb_define_theme_color:n #1 { \definecolorset{HTML}{ctex@}{}{frame,#1;emph,#1;verb,#1} } \cs_new_protected:Npn \DeclareLinkColor #1 { \ctex_define:nx { refset } { \eb_link_color_set:n {#1} } } \cs_new_protected:Npn \DeclareThemeColor #1 { \ctex_define:nx { style } { \eb_theme_color_set:n {#1} } } \cs_new_protected:Npn \eb_color_assign_cmd_set:nn #1#2 { \cs_new:cpn { eb_#2_color_set:n } ##1 { #1/\clist_item:nn {##1} { 1 } .code:n = { \use:c { eb_define_#2_color:nnn } { \clist_item:nn {##1} { 2 } } { \clist_item:nn {##1} { 3 } } { \clist_item:nn {##1} { 4 } } }, } } \eb_seq_map_inline:nn { { linkcolor } { link }, { color } { theme } } { \eb_color_assign_cmd_set:nn #1 } \ctex_define:nx { refset } { linkcolor .choice:, \clist_map_function:nN { { fresh, 62d71f,0000B2,005752 }, { cutepink, ff69b4,9d5196,57b5e5 }, { navyblue, 000080,004986,eb6877 }, { crimson, dc143c,00c1c9,afcd20 } } \eb_link_color_set:n linkcolor .default:n = navyblue, linkcolor .initial:n = navyblue, linkcolor-all .code:n = \eb_define_link_color:n { \exp_not:n {#1} } } \ctex_define:nx { style } { color .choice:, color .value_required:n = true, \clist_map_function:nN { { none, 000000,000000,000000 }, { seaside, 4169e1,9932cc,eb6100 }, { energy, f39800,00a0e9,893895 }, { cyberpunk, 601986,eb6877,a4005b } } \eb_theme_color_set:n color .initial:n = none, color-all .code:n = \eb_define_theme_color:n { \exp_not:n {#1} } } \bool_set_false:N \l__eb_toc_number_color_bool \cs_new_protected:Npn \eb_link_border_set:n #1 { \AtBeginDocument { \def\@pdfborder{#1} \def\Hy@colorlink ##1 {\begingroup} \def\Hy@endcolorlink{\endgroup} } } \cs_new_protected:Npn \eb_link_colors_set: { \bool_set_true:N \l__eb_toc_number_color_bool \colorlet{ctex@toc@number}{ctex@link} \eb_put_hyperref:n { colorlinks } } \cs_new_protected:Npn \eb_link_toc_put:n #1 { \eb_put_hyperref:n { linktoc = #1 } \eb_seq_map_inline:nn { page,none } { \tl_if_eq:NnT \l_keys_value_tl {##1} { \colorlet{ctex@toc@number}{black} \seq_map_break: } } } \ctex_define:nn { refset } { linktype .choice:, linktype .value_required:n = true, linktype/edge .code:n = \eb_link_border_set:n { 0~0~1 }, linktype/none .code:n = \eb_link_border_set:n { 0~0~0 }, linktype/colors .code:n = \eb_link_colors_set:, linktype/various .meta:n = linktype/colors, linktype .initial:n = edge, linktoc .choice:, linktoc/unknown .code:n = \eb_link_toc_put:n {#1}, linktoc .default:n = all, linktoc .initial:n = all, unknown .code:n = { \eb_put_hyperref:x { \l_keys_key_str \tl_if_empty:NF \l_keys_value_tl { = {#1} } } } } \cs_new_protected:Npn \eb_allow_url_break: { \eb_appto_cmd:Nn \UrlBreaks { \UrlOrds \tl_map_function:NN \c__eb_url_break_points_tl \do } } \tl_const:Nn \c__eb_url_break_points_tl { ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 0123456789 } \ctex_at_end_preamble:n { \LoadPackage{hyperref} \urlstyle{same} \eb_allow_url_break: \eb_put_hyperref:n { linkcolor = ctex@link,linkbordercolor = ctex@link, urlcolor = ctex@url,urlbordercolor = ctex@url, citecolor = ctex@cite,citebordercolor = ctex@cite } \exp_args:NV \hypersetup \l__eb_hyperref_clist } \labelformat{part}{\CTEXthepart} \labelformat{chapter}{\CTEXthechapter} \labelformat{figure}{\figurename~#1} \labelformat{table}{\tablename~#1} \cs_if_free:NT \bibname { \cs_set_eq:NN \bibname \refname } \ctex_define:n { lstlistlistingname .tl_set:N = \listlstlistingname, lstlistingname .tl_set:N = \lstlistingname, exercisename .tl_set:N = \exercisename } \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } { \keys_set_known:nn { ctex } { contentsname = 目\hspace{1em}录, indexname = 索\hspace{1em}引, abstractname = 摘\hspace{1em}要, listfigurename = 图片索引, listtablename = 表格索引, lstlistlistingname = 代码索引, lstlistingname = 代码, exercisename = 练习 } \labelformat{equation}{式(#1)} \labelformat{section}{节 #1} \labelformat{subsection}{小节 #1} } { \keys_set_known:nn { ctex } { abstractname = Abstract, lstlistlistingname = List~of~Codes, lstlistingname = Code, exercisename = Exercise } \labelformat{equation}{Equation~(#1)} \labelformat{section}{Section~#1} \labelformat{subsection}{Subsection~#1} } % %<*tcolorbox> \ProvidesExplFile{eb-tcolorbox.cfg}{2021/12/06}{1.41I} {Customization of tcolorbox for easybook} \cs_set_protected:Npn \setexercise #1 { \keys_set:nn { eb/exercise } {#1} } \cs_set_protected:Npn \addtcbstyle #1#2 { \tcbset{#1/.append~style = {#2}} } \cs_set_protected:Npn \deftcbstyle #1#2 { \tcbset{#1/.style = {#2}} } \cs_new_protected:Npn \tcbappstyle { \@ifstar{\deftcbstyle}{\addtcbstyle} } \cs_set_eq:NN \newtcbstyle \deftcbstyle \keys_define:nn { eb/exercise } { color .tl_set:N = \eb@tc@background@color, color .initial:n = DeepSkyBlue, number .tl_set:N = \eb@tc@list@number, number .initial:n = 1., title .tl_set:N = \eb@tc@exercise@title, title .initial:n = \exercisename, numsep .dim_set:N = \eb@toc@exercise@numsep, numsep .initial:n = 0.5em, tocnumsep .dim_set:N = \eb@toc@exertoc@numsep, tocnumsep .initial:n = 1em, label .tl_set:N = \eb@tc@exercise@label, enumitem .code:n = \setexerlist{#1}, tcolorbox .code:n = \addtcbstyle{exercise}{#1} } \tl_gset:Nn \eb@tc@line@skip { 0.5\baselineskip } \deftcbstyle{tc-theorem} { enhanced~jigsaw,pad~at~break* = 3pt, opacityback = 0, colframe = ctex@emph, sharpish~corners, beforeafter~skip = 1.75ex plus .2ex minus .1ex, left = 8pt,right = 8pt, top = \eb@tc@line@skip,bottom = \eb@tc@line@skip, middle = \eb@tc@line@skip } \deftcbstyle{tc-outline} { enhanced,nofloat, tikznode~boxed~title, interior~style = white,colframe = ctex@emph, colbacktitle = white,coltitle = ctex@emph, fonttitle = \large\sffamily,fontupper = \itshape, boxed~title~style = {size = normal,opacityframe = 0,boxrule = 0pt}, attach~boxed~title~to~top~center = {yshift = -\tcboxedtitleheight/2}, after~skip = 3ex plus .2ex minus .1ex, arc = 3pt, left = 2pc,right = 2pc,top = 1.5pc,bottom = 1pc } \deftcbstyle{tc-exercise} { blank,on~line,center, sharpish~corners, fontupper = \Large\sffamily, beforeafter~skip = 3.75ex plus .2ex minus .1ex } \deftcbstyle{tc-easybox} { enhanced~jigsaw,pad~at~break* = 3pt, center~title, sharpish~corners, left = 8pt,right = 8pt, opacityback = 0.2,opacitybacktitle = 0.2, coltitle = black,colframe = black, top = \eb@tc@line@skip,bottom = \eb@tc@line@skip, middle = \eb@tc@line@skip, toptitle = \eb@tc@line@skip, titlerule = 0pt, beforeafter~skip = 1.75ex plus .2ex minus .1ex } \deftcbstyle{tc-ebparbox} { frame~hidden, enhanced~jigsaw,pad~at~break* = 3pt, boxrule = 0pt, sharpish~corners, left = 8pt, middle = \eb@tc@line@skip,bottomtitle = \eb@tc@line@skip, beforeafter~skip = 1.75ex plus .2ex minus .1ex } \deftcbstyle{tc-ebemph}{on~line,blank} \deftcbstyle{tc-eblink} { standard~jigsaw,on~line, top = 1.5pt,bottom = 1.5pt,left = 1.5pt,right = 1.5pt, boxrule = 0.5pt,arc = 1pt, opacityback = 0.2 } \deftcbstyle{tc-ebfbox} { on~line,sharpish~corners, top = 1.5pt,bottom = 1.5pt,left = 1pt,right = 1pt, boxrule = 0.5pt,leftrule = 0pt,rightrule = 0pt } \tcbset { breakable, boxsep = 0pt, fonttitle = \sffamily, boxrule = \l__eb_rule_width_dim } \tl_new:N \p@eb@exercise \tl_new:N \eb@tc@list@prologue \cs_new:Npn \exerprologue #1 { \tl_gset:Nn \eb@tc@list@prologue {#1} } \cs_new:Npn \tcphantomifname #1#2 { \tl_gset:Nn \eb@tc@exercise@ifnametrue {#1} \tl_gset:Nn \eb@tc@exercise@ifnamefalse {#2} } \tcphantomifname { \markright { \eb_tcb_toc_counter_numsep:n { exercise } \eb@tc@exercise@title } \addcontentsline{toc}{section} { \eb_tcb_toc_counter_numsep:n { exertoc } \eb@tc@exercise@title } }{} \cs_set:Npn \eb_exercise_label_noempty_use: { \eb_current_label:n { eb@exercise } \tl_if_empty:NF \eb@tc@exercise@label { \exp_args:NV \label \eb@tc@exercise@label } } \cs_new:Npn \eb_tcb_toc_counter_numsep:n #1 { \thetcbcounter \hspace{\use:c { eb@toc@#1@numsep }} } \newtcbox[auto~counter]{\eb@tc@exercise@box}[1]{tc-exercise,#1} \newtcolorbox{eb@tc@outline@box}[2]{title = #1,tc-outline,#2} \NewDocumentEnvironment{outline}{O{}D(){\abstractname}o+b} { \begin{eb@tc@outline@box}{#2}{IfValueT = {#3}{#3}} \begin{eb@outline@list}[#1] #4 \end{eb@outline@list} \end{eb@tc@outline@box} }{} \NewDocumentEnvironment{exercise}{st+od()O{}+b} { \IfValueT{#3}{ \keys_set:nn { eb/exercise } {#3} } \IfBooleanF{#2} { \eb@tc@exercise@box { fuzzy~halo = 5pt~with~\eb@tc@background@color, IfValueT = {#4}{#4}, phantom = { \IfBooleanTF{#1} {\eb@tc@exercise@ifnamefalse} {\eb@tc@exercise@ifnametrue} } }{ \IfBooleanF{#1} { \eb_tcb_toc_counter_numsep:n { exercise } \tl_set_eq:NN \theeb@exercise \thetcbcounter \eb_exercise_label_noempty_use: } \eb@tc@exercise@title } } \tl_if_empty:NF \eb@tc@list@prologue { \eb@tc@list@prologue } \exp_last_unbraced:NnNo \begin{eb@exercise@list}[\eb@tc@list@number,#5] #6 \end{eb@exercise@list} \tl_gclear:N \eb@tc@list@prologue }{} \DeclareTColorBox{easybox}{sO{Khaki}d()O{}} { IfBooleanF = {#1}{frame~hidden,boxrule = 0pt}, IfValueT = {#3}{title = #3}, colback = #2,colbacktitle = #2, tc-easybox,#4 } \DeclareTColorBox{ebparbox}{sO{DarkSlateBlue}d()O{}} { borderline~west = {3pt}{0pt}{#2}, IfBooleanTF = {#1} { colback = #2,colbacktitle = #2, opacityback = 0.2,opacitybacktitle = 0.2, IfValueTF = {#3}{title = #3,top = 0pt}{top = \eb@tc@line@skip}, bottom = \eb@tc@line@skip,toptitle = \eb@tc@line@skip, right = 8pt }{ colback = white, IfValueT = {#3}{title = #3}, top = 0pt,bottom = 0pt,right = 0pt,toptitle = 0pt }, coltitle = #2,tc-ebparbox,#4 } \DeclareTotalTCBox{\ebfbox}{O{Lime}vO{}} {colback = #1!10!white,colframe = #1!50!black,tc-ebfbox,#3}{#2} \DeclareTotalTCBox{\ebemph}{O{DarkSeaGreen}vO{}} {fuzzy~halo = 2pt~with~#1,tc-ebemph,#3}{#2} \DeclareTotalTCBox{\eblink}{O{Aqua}vO{}} {colback = #1,colframe = #1,tc-eblink,#3}{#2} %