diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/easybook/easybase.sty | 284 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/easybook/easybook.cls | 2 |
2 files changed, 128 insertions, 158 deletions
diff --git a/Master/texmf-dist/tex/latex/easybook/easybase.sty b/Master/texmf-dist/tex/latex/easybook/easybase.sty index b3de2700eb8..6eed832fb2e 100644 --- a/Master/texmf-dist/tex/latex/easybook/easybase.sty +++ b/Master/texmf-dist/tex/latex/easybook/easybase.sty @@ -13,7 +13,7 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{etoolbox} -\ProvidesExplPackage{easybase}{2021/06/11}{1.26}{beta} +\ProvidesExplPackage{easybase}{2021/06/14}{1.26b}{beta} \cs_generate_variant:Nn \eb_ctex_define:nn { nx } \cs_generate_variant:Nn \int_to_arabic:n { v } @@ -71,7 +71,7 @@ } } \cs_new_protected:Npn \eb_at_end_preamble:n - { \ctex_gadd_ltxhook:nn { env/document/before } } + { \BeforeBeginEnvironment { document } } \cs_gset_eq:NN \PackageWarning \use_none:nn \bool_if_exist:NF \l__eb_class_book_bool @@ -110,9 +110,9 @@ \ProcessKeysOptions{easybase} \bool_new:N \l__eb_multoc_bool -\bool_new:N \l__eb_uppercase_bool -\bool_new:N \l__eb_chap_withpart_bool -\tl_new:N \l__eb_foot_numparent_choice_tl +\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 \seq_const_from_clist:Nn \c__eb_options_path_seq { @@ -137,12 +137,12 @@ { multoc .bool_set:N = \l__eb_multoc_bool, multoc .default:n = true, - withpart .bool_set:N = \l__eb_chap_withpart_bool, + withpart .bool_set:N = \l__eb_chap_counter_withpart_bool, withpart .default:n = true, withpart .initial:n = false, rulewidth .dim_set:N = \eb@rule@width@dim, rulewidth .initial:n = 0.75pt, - uppercase .bool_set:N = \l__eb_uppercase_bool, + uppercase .bool_set:N = \l__eb_mark_uppercase_bool, uppercase .default:n = true, uppercase .initial:n = true, figurepath .tl_set:N = \l_eb_graphics_path_tl, @@ -151,7 +151,7 @@ { part,page,chapter } { \tl_set_eq:NN - \l__eb_foot_numparent_choice_tl \l_keys_choice_tl + \l__eb_foot_counter_parent_choice_tl \l_keys_choice_tl }, footwith .value_required:n = true, footwith .initial:n = chapter, @@ -276,6 +276,17 @@ \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: + } \eb_ctex_define:nn { hdrset } { head-foot .tl_set:N = \l__eb_fancyhf_content_tl, @@ -293,36 +304,15 @@ } }, - chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, - chap-mark .initial:n = - { - \int_compare:nNnT { \c@secnumdepth } > { -1 } - { - \ifbool{@mainmatter} - { - \int_if_odd:nT { \CTEX@chapter@numbering } - { \eb@mark@chapter@label } - }{} - }#1 - }, - sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, - sec-mark .initial:n = - { - \int_compare:nNnT { \c@secnumdepth } > { 0 } - { - \int_if_odd:nT { \CTEX@section@numbering } - { \eb@mark@section@label } - }#1 - }, + 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 = - { - \int_compare:nNnT { \c@secnumdepth } > { 1 } - { - \int_if_odd:nT { \CTEX@subsection@numbering } - { \eb@mark@subsection@label } - }#1 - }, + { \CTEXifname{\eb@mark@subsection@label}{}#1 }, chap-label .code:n = \eb_mark_chapter_number_bool:n {#1}, chap-label .initial:n = \hspace{\ccwd}, sec-label .code:n = \eb_mark_section_number_bool:n {#1}, @@ -330,25 +320,13 @@ subsec-label .code:n = \eb_mark_subsection_number_bool:n {#1}, subsec-label .initial:n = \hspace{0.5\ccwd}, - headrule .tl_gset:N = \headrule, - headrule .initial:n = - { - \group_begin: - \color{ctex@frame} - \hrule\@width\textwidth\@height\eb@rule@width@dim - \group_end: - }, - footrule .tl_gset:N = \footrule, - footrule .initial:n = { }, + headrule .tl_gset:N = \headrule, + headrule .initial:n = \markrule{\eb@rule@width@dim}, + footrule .tl_gset:N = \footrule, + footrule .initial:n = { }, footnoterule .tl_gset:N = \footnoterule, footnoterule .initial:n = - { - \group_begin: - \color{ctex@frame} - \hrule\@width 0.35\columnwidth\@height\eb@rule@width@dim - \vspace*{2.6pt} - \group_end: - }, + { \markrule[0.35\textwidth]{\eb@rule@width@dim}[+2.6pt] }, fnmargin .dim_set:N = \footnotemargin, fnmargin .initial:n = 0.75\ccwd, @@ -376,32 +354,34 @@ fnmark-num .value_required:n = true } -\cs_new:Npn \eb_upper_number_mark_bool:nn #1#2 +\cs_new:Npn \eb_mark_uppercase_bool:nn #1#2 { - \bool_if:NT \l__eb_uppercase_bool - { \text_uppercase:n } {\use:c { eb_fancyhf_#1_mark:n } {#2}} + \bool_if:NTF \l__eb_mark_uppercase_bool + { \text_uppercase:n } + { \text_titlecase_first:n } + { \use:c { eb_fancyhf_#1_mark:n } {#2} } } -\cs_new:Npn \eb@number@markdouble #1#2 +\cs_new:Npn \eb@level@markdouble #1#2 { \markboth - {\eb_upper_number_mark_bool:nn {#1} {#2}} + {\eb_mark_uppercase_bool:nn {#1} {#2}} { \bool_if:NT \l__eb_page_twoside_bool - { \eb_upper_number_mark_bool:nn {#1} {#2} } + { \eb_mark_uppercase_bool:nn {#1} {#2} } } } -\cs_new:Npn \eb@number@markright #1#2 - { \markright{\eb_upper_number_mark_bool:nn {#1} {#2}} } -\cs_new:Npn \eb@number@section@mark #1 +\cs_new:Npn \eb@level@markright #1#2 + { \markright{\eb_mark_uppercase_bool:nn {#1} {#2}} } +\cs_new:Npn \eb@level@section@mark #1 { \bool_if:NTF \l__eb_class_book_bool - { \eb@number@markright{section}{#1} } - { \eb@number@markdouble{section}{#1} } + { \eb@level@markright{section}{#1} } + { \eb@level@markdouble{section}{#1} } } -\cs_new:Npn \eb@number@subsection@mark #1 +\cs_new:Npn \eb@level@subsection@mark #1 { \bool_if:NF \l__eb_class_book_bool - { \eb@number@markright{subsection}{#1} } + { \eb@level@markright{subsection}{#1} } } \ctex_at_end_preamble:n { @@ -410,9 +390,9 @@ \tl_use:N \l__eb_fancyhf_content_tl \cs_gset_eq:NN \ps@plain \ps@empty \pagestyle{fancy} - \cs_gset:Npn \chaptermark #1 { \eb@number@markdouble{chapter}{#1} } - \cs_gset_eq:NN \sectionmark \eb@number@section@mark - \cs_gset_eq:NN \subsectionmark \eb@number@subsection@mark + \cs_gset:Npn \chaptermark #1 { \eb@level@markdouble{chapter}{#1} } + \cs_gset_eq:NN \sectionmark \eb@level@section@mark + \cs_gset_eq:NN \subsectionmark \eb@level@subsection@mark \bool_if:NT \l__eb_compile_draft_bool { \easyfoot[C]{\color{SlateGray}\sffamily\today} @@ -431,14 +411,14 @@ \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont \exp_args:NNNo \group_end: \dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } - \bool_if:NT \l__eb_chap_withpart_bool + \bool_if:NT \l__eb_chap_counter_withpart_bool { \counterwithin*{chapter}{part} } - \tl_if_eq:NnT \l__eb_foot_numparent_choice_tl { part } + \tl_if_eq:NnT \l__eb_foot_counter_parent_choice_tl { part } { \counterwithout*{footnote}{chapter} \counterwithin*{footnote}{part} } - \tl_if_eq:NnT \l__eb_foot_numparent_choice_tl { page } + \tl_if_eq:NnT \l__eb_foot_counter_parent_choice_tl { page } { \counterwithout*{footnote}{chapter} \counterwithin*{footnote}{page} @@ -745,13 +725,48 @@ } } +\newcounter{bichapter} +\newcounter{bisection}[bichapter] +\newcounter{bisubsection}[bisection] +\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@#1 } } +\cs_new:Npn \eb_section_counter_prefix:n #1 + { + \int_compare:nNnT { \c@chapter } > { 0 } { \use:c { the#1chapter }. } + \eb_arabic:n { #1section } + } +\cs_set:Npn \thebichapter { \eb_arabic:n { bichapter } } +\cs_set:Npn \thebisection { \eb_section_counter_prefix:n { bi } } +\cs_set:Npn \thebisubsection { \thebisection.\eb_arabic:n { bisubsection } } +\cs_set:Npn \thesection { \eb_section_counter_prefix:n { } } +\seq_const_from_clist:Nn \c__eb_serial_number_counter_seq + { figure,table,lstlisting,equation } +\seq_map_inline:Nn \c__eb_serial_number_counter_seq + { + \cs_set:cpn { the#1 } + { + \int_compare:nNnT { \c@chapter } > { 0 } + { + \thechapter + \tl_use:c { l__eb_#1_separator_tl } + } + \eb_arabic:n {#1} + } + } \contentsuse{}{tec} +\tl_new:N \eb@before@addbitoc@hook +\NewDocumentCommand{\EBeforeAddBitoc}{sm} + { + \IfBooleanTF{#1} + {\tl_gset:Nn \eb@before@addbitoc@hook {#2}} + {\tl_gput_right:Nn \eb@before@addbitoc@hook {#2}} + } \cs_set_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: @@ -772,13 +787,14 @@ \tl_case:Nn \l__eb__bitoc_mark_title_level_tl { \c__eb_bitoc_mark_title_chapter_tl - { \eb@nonumber@markdouble{##2} } + { \eb@level@markdouble{chapter}{##2} } \c__eb_bitoc_mark_title_section_tl - { \eb@nonumber@section@mark{##2} } + { \eb@level@section@mark{##2} } \c__eb_bitoc_mark_title_subsection_tl - { \eb@nonumber@subsection@mark{##2} } + { \eb@level@subsection@mark{##2} } } }{ + \stepcounter{bi#1} \use:c {#1}[##2]{##3} \tl_if_empty:oF {##4} { \CTEX@addbitocline{#1}{##4} } } @@ -838,45 +854,16 @@ { \tl_set:Nn \eb@bitoc@title {#2} } } -\cs_new:Npn \eb_upper_nonumber_mark_bool:n #1 - { - \bool_if:NTF \l__eb_uppercase_bool - { \text_uppercase:n {#1} } - { \text_titlecase_first:n {#1} } - } -\cs_new:Npn \eb@nonumber@markdouble #1 - { - \markboth - {\eb_upper_nonumber_mark_bool:n {#1}} - { - \bool_if:NT \l__eb_page_twoside_bool - { \eb_upper_nonumber_mark_bool:n {#1} } - } - } -\cs_new:Npn \eb@nonumber@markright #1 - { \markright{\eb_upper_nonumber_mark_bool:n {#1}} } -\cs_new:Npn \eb@nonumber@section@mark #1 - { - \bool_if:NTF \l__eb_class_book_bool - { \eb@nonumber@markright{#1} } - { \eb@nonumber@markdouble{#1} } - } -\cs_new:Npn \eb@nonumber@subsection@mark #1 - { - \bool_if:NF \l__eb_class_book_bool - { \eb@nonumber@markright{#1} } - } - \cs_new_protected:Npn \eb_title_mark_intoc:n #1 { \tl_if_eq:NnTF \l__eb_toc_type_tl { chapter } { \bichapter*{#1}{\eb@bitoc@title} - \eb@nonumber@markdouble{#1} + \eb@level@markdouble{chapter}{#1} } { \bisection*{#1}{\eb@bitoc@title} - \eb@nonumber@section@mark{#1} + \eb@level@section@mark{#1} } } \cs_new_protected:Npn \eb_title_mark_notoc:n #1 @@ -884,11 +871,11 @@ \tl_if_eq:NnTF \l__eb_toc_type_tl { chapter } { \chapter*{\phantomsection #1} - \eb@nonumber@markdouble{#1} + \eb@level@markdouble{chapter}{#1} } { \section*{\phantomsection #1} - \eb@nonumber@section@mark{#1} + \eb@level@section@mark{#1} } } \cs_new_protected:Npn \eb_title_number_intoc_bool:nn #1#2 @@ -909,7 +896,7 @@ \bool_if:NTF \l__eb_class_book_bool { \bichapter*{#1}{\l__eb_bib_bitoc_title} } { \bisection*{#1}{\l__eb_bib_bitoc_title} } - \eb@nonumber@section@mark{#1} + \eb@level@section@mark{#1} } \cs_new_protected:Npn \eb_toc_start_multicol_bool:n #1 { @@ -981,7 +968,7 @@ \group_begin: \tl_set_eq:NN \eb@toc@title \indexname \cs_set_eq:NN \imki@indexlevel \use_none:n - \setkeys{imki}{intoc = false} + \setkeys{imkiindex}{noclearpage} \IfValueT{#4}{\keys_set:nn { eb/listoc } {#4}} \tl_set:Nn \imki@indexheaders { @@ -1002,6 +989,12 @@ binmuber .tl_set:N = \CTEX@bichapter@number, binmuber .initial:n = \arabic{chapter} } +\cs_new_protected:Npn \eb_counter_set:nn #1#2 + { + \seq_set_from_clist:No \l__eb_counter_name_seq {#2} + \seq_map_inline:Nn \l__eb_counter_name_seq + { \setcounter{##1}{#1} } + } \RenewDocumentCommand{\appendix} {O{Appendix\space}D(){\Alph{chapter}}} { @@ -1021,23 +1014,23 @@ \def\CTEX@postchapter{\CTEX@postbiappendix} } \ExplSyntaxOff\char_set_catcode_other:N \@ - \setcounter{chapter}{0} - \setcounter{section}{0} \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_set:nn { 0 } { chapter,section,bichapter,bisection } } { - \setcounter{section}{0} - \setcounter{subsection}{0} \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_set:nn { 0 } { section,subsection,bisection,bisubsection } } } @@ -1180,27 +1173,6 @@ \selectfont\ignorespaces } -\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@#1 } } -\cs_gset:Npn \thesection - { - \int_compare:nNnT { \c@chapter } > { 0 } { \thechapter. } - \eb_arabic:n { section } - } -\seq_const_from_clist:Nn \c__eb_serial_number_counter_seq - { figure,table,lstlisting,equation } -\seq_map_inline:Nn \c__eb_serial_number_counter_seq - { - \cs_set:cpn { the#1 } - { - \int_compare:nNnT { \c@chapter } > { 0 } - { - \thechapter - \tl_use:c { l__eb_#1_separator_tl } - } - \eb_arabic:n {#1} - } - } - \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 } @@ -1313,24 +1285,22 @@ } \tl_const:Nn \c__eb_thmtools_keyval_tl { - [ - spaceabove = \l__eb_thm_spaceabove_tl, - spacebelow = \l__eb_thm_spacebelow_tl, - headindent = \l__eb_thm_headindent_tl, - headfont = \l__eb_thm_headfont_tl, - notefont = \l__eb_thm_notefont_tl, - notebraces = { }{ }, - bodyfont = \l__eb_thm_bodyfont_tl, - headpunct = \l__eb_thm_headpunct_tl, - postheadspace = \l__eb_thm_spacepost_tl, - within = \l__eb_thm_numberwith_tl, - headformat = \NAME\space\NUMBER\NOTE - ] + spaceabove = \l__eb_thm_spaceabove_tl, + spacebelow = \l__eb_thm_spacebelow_tl, + headindent = \l__eb_thm_headindent_tl, + headfont = \l__eb_thm_headfont_tl, + notefont = \l__eb_thm_notefont_tl, + notebraces = { }{ }, + bodyfont = \l__eb_thm_bodyfont_tl, + headpunct = \l__eb_thm_headpunct_tl, + postheadspace = \l__eb_thm_spacepost_tl, + within = \l__eb_thm_numberwith_tl, + headformat = \NAME\space\NUMBER\NOTE } \eb_at_end_preamble:n { - \exp_last_unbraced:NV - \declaretheoremstyle \c__eb_thmtools_keyval_tl{easy-theorem} + \exp_last_unbraced:NNV + \declaretheoremstyle[\c__eb_thmtools_keyval_tl]{easy-theorem} \eb_thmname_set:nnn { exercise } { Exercise } { 练习 } \cs_undefine:N \proof \clist_map_inline:nn @@ -1451,7 +1421,7 @@ } \newtcbox[auto~counter]{\eb@tc@exercise@box}[1]{tc-exercise,#1} \tl_new:N \eb@tc@list@prologue - \cs_new:Npn \exerprologue #1 { \tl_set:Nn \eb@tc@list@prologue {#1} } + \cs_new:Npn \exerprologue #1 { \tl_gset:Nn \eb@tc@list@prologue {#1} } \NewDocumentEnvironment{outline}{O{}D(){\abstractname}o+b} { \begin{tcolorbox}[tc-outline,title = #2,IfValueT = {#3}{#3}] @@ -1561,7 +1531,7 @@ \tl_new:N \l__eb_bib_style_tl \tl_new:N \l__eb_bib_otherstyle_tl \tl_new:N \l__eb_bib_citestyle_tl -\tl_new:N \l__eb_bib_datafile_tl +\clist_new:N \l__eb_bib_datafile_clist \eb_ctex_define:nn { bibset } { @@ -1586,9 +1556,9 @@ { \tl_set_eq:NN \l__eb_bib_otherstyle_tl \l_keys_value_tl }, bib-style .initial:n = numerical, - cite-style .code:n = + cite-style .code:n = { \tl_set:Nn \l__eb_bib_citestyle_tl {#1} }, - datafile .tl_set:N = \l__eb_bib_datafile_tl, + datafile .clist_set:N = \l__eb_bib_datafile_clist, bitoc-title .tl_set:N = \l__eb_bib_bitoc_title, bitoc-title .initial:n = Reference @@ -1624,7 +1594,7 @@ \bool_if:NT \l__eb_multoc_bool { \begin{multicols}{\int_use:N \l__eb_toc_columns_int} } } - \exp_args:NV \bibliography \l__eb_bib_datafile_tl + \exp_args:NV \bibliography \l__eb_bib_datafile_clist \group_end: } } @@ -1646,7 +1616,7 @@ } \cs_new_protected:Npn \EBiblatexPostset { - \exp_args:NV \addbibresource \l__eb_bib_datafile_tl + \clist_map_function:NN \l__eb_bib_datafile_clist \addbibresource \tl_gset:Nn \blx@default@theheading { bibintoc } \defbibheading{bibintoc}[\bibname] {\eb_biber_title_level_bool:n {##1}} @@ -1654,7 +1624,7 @@ } \eb_at_end_preamble:n { - \tl_if_empty:NF \l__eb_bib_datafile_tl + \clist_if_empty:NF \l__eb_bib_datafile_clist { \bool_if:NTF \l__eb_backend_bibtex_bool { diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls index 0c6b3ddd2fa..a0f73b2f5ca 100644 --- a/Master/texmf-dist/tex/latex/easybook/easybook.cls +++ b/Master/texmf-dist/tex/latex/easybook/easybook.cls @@ -13,7 +13,7 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/06/11}{1.26}{beta} +\ProvidesExplClass{easybook}{2021/06/14}{1.26b}{beta} \bool_set_false:N \l__eb_compile_draft_bool \bool_set_false:N \l__eb_title_newline_bool |