From b0bd9715b1c3d53f6da98005d98f487af1b9f1f2 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 4 May 2021 22:26:44 +0000 Subject: easybook (5may21) git-svn-id: svn://tug.org/texlive/trunk@59076 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/easybook/easybook.cls | 102 ++++++++++++++++++---- 1 file changed, 83 insertions(+), 19 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls index 045531c7321..15509a3cb28 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,etoolbox} -\ProvidesExplClass{easybook}{2021/05/02}{1.24z}{beta} +\ProvidesExplClass{easybook}{2021/05/04}{1.25a}{beta} \cs_generate_variant:Nn \eb_ctex_define:nn { nx } \cs_generate_variant:Nn \int_to_arabic:n { v } @@ -168,8 +168,10 @@ equation-sep .tl_set:N = \l__eb_equation_separator_tl, number-sep .meta:n = { - figure-sep = #1,table-sep = #1, - listing-sep = #1,equation-sep = #1 + figure-sep = #1, + table-sep = #1, + listing-sep = #1, + equation-sep = #1 }, number-sep .initial:n = { . } } @@ -231,6 +233,18 @@ \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_font_double_engine_set:n #1 + { + \exp_args:Nc \RenewDocumentCommand {set #1 font}{O{}mO{}} + { + \ctex_at_end_preamble:n + { \use:c { eb_set #1 font:nn }{##2}{##1,##3} } + } + } +\seq_const_from_clist:Nn \c__eb_font_reset_family_seq + { main,sans,mono,CJKmain,CJKsans,CJKmono } +\seq_map_inline:Nn \c__eb_font_reset_family_seq + { \eb_font_double_engine_set:n {#1} } \cs_new_protected:Npn \eb_setmainfont:nn #1#2 { \__fontspec_main_setmainfont:nn {#2} {#1} } @@ -387,7 +401,7 @@ chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, chap-mark .initial:n = { - \int_compare:nT { \c@secnumdepth > -1 } + \int_compare:nNnT { \c@secnumdepth } > { -1 } { \ifbool{@mainmatter} { @@ -399,7 +413,7 @@ sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, sec-mark .initial:n = { - \int_compare:nT { \c@secnumdepth > 0 } + \int_compare:nNnT { \c@secnumdepth } > { 0 } { \int_if_odd:nT { \CTEX@section@numbering } { \CTEXthesection\hspace{0.5\ccwd} } @@ -408,7 +422,7 @@ subsec-mark .cs_set:Np = \eb_fancyhf_subsection_mark:n #1, subsec-mark .initial:n = { - \int_compare:nT { \c@secnumdepth > 1 } + \int_compare:nNnT { \c@secnumdepth } > { 1 } { \int_if_odd:nT { \CTEX@subsection@numbering } { \CTEXthesubsection\hspace{0.5\ccwd} } @@ -502,7 +516,7 @@ { \CTEXifname { - \use:c { CTEXthe#1 } + \use:c { CTEXthe #1 } \hspace{\use:c { eb@toc@#1@numsep }} }{} } @@ -678,7 +692,8 @@ { \addcontentsline{lol}{lstlisting} {\protect\numberline{\thelstlisting}\lst@@caption} - }{ + } + { \addcontentsline{lol}{lstlisting} { \ifbool{eb@titletoc@hang@fix}{\protect\numberline}{} @@ -686,6 +701,27 @@ } } +\contentsuse{}{bitoc} +\cs_set_protected:Npn \CTEX@addbitocline #1#2 + { + \group_begin: + \ctex_set:n + { + chapter/name = Chapter\space, + chapter/number = \arabic{chapter} + } + \addcontentsline{bitoc}{#1} + {\use:c { CTEX@#1@tocline }{#1}{#2}} + \group_end: + } +\seq_const_from_clist:Nn \c__eb_bitoc_title_level_seq + { chapter,section,subsection } +\seq_map_inline:Nn \c__eb_bitoc_title_level_seq + { + \cs_new_protected:cpn {bi #1} ##1##2 + { \use:c {#1}{##1}\CTEX@addbitocline{#1}{##2} } + } + \eb_appto_cmd:Nn \@chapter { \skip_if_eq:nnF { \l__eb_toc_lolskip_skip } { \c_zero_skip } @@ -715,7 +751,17 @@ multoc .bool_set:N = \l__eb_multoc_bool, multoc .default:n = true, multoc .initial:n = false, - title .tl_set:N = \eb@toc@title + title .code:n = \eb_assign_toc_title:n {#1} + } +\NewDocumentCommand \eb_assign_toc_title:n + {>{\SplitArgument{1}{,}}m} + {\eb_assign_toc_title:nn #1} +\cs_new_protected:Npn \eb_assign_toc_title: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:Npn \eb_upper_nonumber_mark_bool:n #1 @@ -813,15 +859,22 @@ \bool_if:NT \l__eb_class_book_bool { \ifbool{@restonecol}{\twocolumn}{\onecolumn} } } -\RenewDocumentCommand{\tableofcontents}{o} +\RenewDocumentCommand{\tableofcontents}{t+o} { \group_begin: \tl_set_eq:NN \eb@toc@title \contentsname - \IfValueT{#1}{\keys_set:nn { eb/listoc } {#1}} + \tl_set:Nn \eb@bitoc@title { Contents } + \IfValueT{#2}{\keys_set:nn { eb/listoc } {#2}} \eb_multoc_pre_bool: \eb_title_mark_notoc:n { \eb@toc@title } \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{toc} + \IfBooleanT{#1} + { + \eb_title_mark_notoc:n { \eb@bitoc@title } + \vspace*{\dim_use:N \l__eb_toc_offset_dim} + \@starttoc{bitoc} + } \eb_multoc_post_bool: \group_end: } @@ -943,19 +996,19 @@ \captionsetup[table][bi-second]{name = Table} } -\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@#1 } } +\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@ #1 } } \cs_gset:cpn { thesection } { - \int_compare:nT { \c@chapter > 0 } { \thechapter. } + \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 } + \cs_set:cpn { the #1 } { - \int_compare:nT { \c@chapter > 0 } + \int_compare:nNnT { \c@chapter } > { 0 } { \thechapter \use:c { l__eb_#1_separator_tl } @@ -967,6 +1020,17 @@ { \int_compare:nNnTF { \c@chapter } > { 0 } { + \ExplSyntaxOn\char_set_catcode_letter:N \@ + \eb_patch_cmd:Nnn \CTEX@addbitocline + { + chapter/name = Chapter\space, + chapter/number = \arabic{chapter} + } + { + chapter/name = Appendix\space, + chapter/number = \alph{chapter} + } + \ExplSyntaxOff\char_set_catcode_other:N \@ \setcounter{chapter}{0} \setcounter{section}{0} \gdef\thechapter{\@Alph\c@chapter} @@ -983,7 +1047,7 @@ \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 = { } } + \ctex_set:nn { appendix } { number = \@Alph\c@section,name = { } } } } \AtBeginEnvironment{tabularx} @@ -1148,7 +1212,7 @@ headindent = \l__eb_thm_headindent_tl, headfont = \l__eb_thm_headfont_tl, notefont = \l__eb_thm_notefont_tl, - notebraces = {}{}, + notebraces = { }{ }, bodyfont = \l__eb_thm_bodyfont_tl, headpunct = \l__eb_thm_headpunct_tl, postheadspace = \l__eb_thm_spacepost_tl, @@ -1258,7 +1322,7 @@ \cs_gset:Npn \tagform@ #1 { \maketag@@@{\color{ctex@emph}(\ignorespaces #1\unskip\@@italiccorr)} } \ctex_at_end_package:nn { unicode-math } - {\msg_redirect_module:nnn { unicode-math } { warning } { none } } + { \msg_redirect_module:nnn { unicode-math } { warning } { none } } \ctex_at_end_package:nn { tcolorbox } { @@ -1573,7 +1637,7 @@ rulecolor = \color{ctex@frame}, commentstyle = \color{SlateGray}, emphstyle = \color{ctex@emph}, - emph = {caption,multirow,subcaption,tabularx}, + % emph = {}, morekeywords = { includegraphics,setmainfont,setsansfont,setmonofont,setCJKmainfont,setCJKsansfont,setCJKmonofont,setCJKfamilyfont,RequirePackage -- cgit v1.2.3