summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/easybook/easybook.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/easybook/easybook.dtx')
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx127
1 files changed, 72 insertions, 55 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index 7beb93bdb9..3ebd079924 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -14,7 +14,7 @@
% This work has the LPPL maintenance status `maintained'.
%<*class>
\NeedsTeXFormat{LaTeX2e}[2021/11/15]
-\ProvidesExplClass{easybook}{2024/05/10}{2024bn}
+\ProvidesExplClass{easybook}{2024/05/12}{2024bo}
{Easily typesetting Chinese theses or books}
\bool_new:N \l__eb_compile_draft_bool
@@ -85,7 +85,7 @@
{ \eb_set_family:xnn { \CJKsfdefault } {#2} {#1} }
\cs_new_protected:Npn \eb_setCJKmonofont:nn #1#2
{ \eb_set_family:xnn { \CJKttdefault } {#2} {#1} }
-\eb_seq_map_inline:nn
+\clist_map_inline:nn
{ main,sans,mono,CJKmain,CJKsans,CJKmono }
{
\exp_args:Nc \RenewDocumentCommand { set#1font }{O{}mO{}}
@@ -301,7 +301,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2021/11/15]
\RequirePackage{etoolbox}
-\ProvidesExplPackage{easybase}{2024/05/10}{2024bn}
+\ProvidesExplPackage{easybase}{2024/05/12}{2024bo}
{Easily typesetting Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -318,11 +318,6 @@
\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_patch_cmd:Nnn #1#2#3
{
\ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3}
@@ -334,7 +329,7 @@
{ \AddToHook{cmd/#1/after}{#2} }
\cs_new_protected:Npn \eb_at_begin_environment:nn #1#2
{
- \eb_seq_map_inline:nn {#1}
+ \clist_map_inline:nn {#1}
{ \AtBeginEnvironment{##1}{#2} }
}
\cs_new_protected:Npn \eb_at_end_preamble:n
@@ -360,7 +355,7 @@
\RenewDocumentCommand{\usepackage}{O{}mO{}}
{
\PassOptionsToPackage{#1}{#2}
- \eb_seq_map_inline:nn {#2}
+ \clist_map_inline:nn {#2}
{
\eb_if_package_loaded:nnF {##1} {#1}
{ \eb@usepackage@save{##1}[#3] }
@@ -383,7 +378,7 @@
\int_compare:nTF { \clist_count:n {#1} <= 1 }
{ \RequirePackage }
{
- \eb_seq_map_inline:nn {#1}
+ \clist_map_inline:nn {#1}
{ \eb_match_load_package:n {##1} }
}
}
@@ -440,6 +435,10 @@
{\RequirePackage[heading]{ctex}}
}
}
+\ctex_disable_package:n { nccfoots }
+\ctex_disable_package:n { setspace }
+\ctex_disable_package:n { tocloft }
+\ctex_disable_package:n { titlesec }
\seq_set_from_clist:Nn \l__eb_module_paths_seq
{
@@ -611,7 +610,7 @@
\booltrue{@mainmatter}
\pagenumbering{arabic}
}
-\eb_seq_map_inline:nn
+\clist_map_inline:nn
{ chapter,section,subsection }
{
\exp_args:Nc \NewDocumentCommand { eb@mark@#1@label@layout }
@@ -826,7 +825,7 @@
\cs_new_protected:Npn \eb_fnmarktext_short_label_set:Nn #1#2
{
\tl_set:Nn \l__eb_fnmarktext_short_tokens_tl {#2}
- \eb_seq_map_inline:nn
+ \clist_map_inline:nn
{ A,a,1,I,i,c,s }
{
\regex_match:nnT {##1} {#2}
@@ -1043,7 +1042,7 @@
\l__eb_fnpara_format_tl{#1}
\tl_if_eq:NnT \l__eb_footnote_value_tl { hang } { \par }
}
-\eb_seq_map_inline:nn { \@footnotetext,\@mpfootnotetext }
+\clist_map_inline:nn { \@footnotetext,\@mpfootnotetext }
{
\eb_patch_cmd:Nnn #1
{ \reset@font }
@@ -1291,7 +1290,7 @@
{ \use:c { CTEX@#1@tocline }{#1}{#2} }
\group_end:
}
-\cs_new_protected:Npn \RegisterBititle #1
+\cs_new_protected:Npn \eb@register@bititle #1
{
\exp_args:Nc \NewDocumentCommand { bi#1 }{sO{##3}mm}
{
@@ -1308,9 +1307,12 @@
}
}
}
-\clist_map_function:nN
- { chapter,section,subsection }
- \RegisterBititle
+\cs_new_protected:Npn \RegisterBititle #1
+ {
+ \clist_map_function:nN {#1}
+ \eb@register@bititle
+ }
+\RegisterBititle{chapter,section,subsection}
\eb_preto_cmd:nn { @chapter }
{
\skip_if_eq:nnF { \eb@toc@lol@skip } { \c_zero_skip }
@@ -1379,7 +1381,7 @@
hyphen-every .initial:n = .,
unknown .code:n = \eb_msg_deprecated_option:n { tools }
}
-\eb_seq_map_inline:nn
+\clist_map_inline:nn
{ figure,table,listing,equation }
{
\cs_set:cpn { the#1 }
@@ -1625,7 +1627,7 @@
\ctex_set:nn {#2}
{
tocformat = \IfBooleanT{#1}{\contentsmargin{0pt}},
- tocindent = 0em,
+ tocindent = 0pt,
tocrule = \IfBooleanTF{#1}{,~\thecontentspage}{\tocrule{$\cdot$}},
toclabel =
{
@@ -1641,13 +1643,19 @@
}
\seq_new:N \l__eb_toc_every_include_name_seq
\cs_new_protected:Npn \ExcludeEveryTocName #1
- { \seq_remove_all:Nn \l__eb_toc_every_include_name_seq {#1} }
+ {
+ \clist_map_inline:nn {#1}
+ { \seq_remove_all:Nn \l__eb_toc_every_include_name_seq {##1} }
+ }
\cs_new_protected:Npn \IncludeEveryTocName #1
{
- \seq_put_right:Nn \l__eb_toc_every_include_name_seq {#1}
- \seq_remove_duplicates:N \l__eb_toc_every_include_name_seq
+ \clist_map_inline:nn {#1}
+ {
+ \seq_put_right:Nn \l__eb_toc_every_include_name_seq {##1}
+ \seq_remove_duplicates:N \l__eb_toc_every_include_name_seq
+ }
}
-\NewDocumentCommand{\RegisterTocName}{sm}
+\cs_new_protected:Npn \eb@register@toc@name #1#2
{
\IfBooleanT{#1}
{
@@ -1665,10 +1673,16 @@
\tl_clear:N \l__eb_toc_tmpa_tl
\tl_clear:N \l__eb_toc_tmpb_tl
}
-\seq_map_function:NN
-\c__ctex_headings_seq \RegisterTocName
+\NewDocumentCommand{\RegisterTocName}{sm}
+ {
+ \clist_map_inline:nn {#2}
+ { \eb@register@toc@name{#1}{##1} }
+ }
+\clist_set_from_seq:NN
+\c__ctex_headings_clist \c__ctex_headings_seq
+\exp_args:NV \RegisterTocName \c__ctex_headings_clist
\ctex_define:n { float/unknown .code:n = \eb_msg_deprecated_option:n { float } }
-\cs_new_protected:Npn \RegisterEveryTocOption #1
+\cs_new_protected:Npn \eb@register@every@toc@option #1
{
\ctex_define:nn { toc }
{
@@ -1679,9 +1693,12 @@
}
}
}
-\clist_map_function:nN
- { tocafter,tocindent,tocrule }
- \RegisterEveryTocOption
+\cs_new_protected:Npn \RegisterEveryTocOption #1
+ {
+ \clist_map_function:nN {#1}
+ \eb@register@every@toc@option
+ }
+\RegisterEveryTocOption{tocafter,tocindent,tocrule}
\NewDocumentCommand{\tocrule}{st-O{0.7pc}d()mO{}}
{
\normalsize\normalfont
@@ -1770,21 +1787,21 @@
part =
{
tocformat = \addvspace{1pc}\sffamily\large,
- tocindent = 0em,
+ tocindent = 0pt,
tocrule = \tocrule{}[\bfseries],
tocline = \CTEXnumberline{#1}#2
},
chapter =
{
tocformat = \addvspace{1pc}\sffamily,
- tocindent = 0em,
+ tocindent = 0pt,
tocrule = \tocrule{$\cdot$}[\bfseries],
tocline = \CTEXnumberline{#1}#2
},
section =
{
tocformat = \bool_if:NF \l__eb_class_mode_book_bool { \sffamily },
- tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 1.5em } { 0em },
+ tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 1.5em } { 0pt },
tocrule =
{
\bool_if:NTF \l__eb_class_mode_book_bool
@@ -1821,7 +1838,7 @@
binumber .initial:n = \arabic{chapter}
}
\cs_new_protected:Npn \eb_counter_zero:n #1
- { \eb_seq_map_inline:nn {#1} { \setcounter{##1}{0} } }
+ { \clist_map_inline:nn {#1} { \setcounter{##1}{0} } }
\RenewDocumentCommand{\appendix}
{O{Appendix\space}D(){\Alph{chapter}}}
{
@@ -1893,18 +1910,13 @@
}
}
\cs_set_eq:NN \addtosubfont \ebaddtofont
+
\ctex_define:nn { spread }
{
line .code:n = \setspread{#1},
- line .initial:n =
- {
- \fp_compare:nNnTF { \l__ctex_line_spread_fp } = { 1.3 }
- { 1.354 }
- { \fp_use:N \l__ctex_line_spread_fp }
- },
table .fp_set:N = \l__eb_spread_table_fp,
- table .initial:n = 1.354,
- math .fp_set:N = \l__eb_spread_math_fp,
+ table .initial:n = 1.2,
+ math .tl_set:N = \eb@spread@math,
math .initial:n = 1.2,
footnote .code:n =
{
@@ -1944,10 +1956,15 @@
belowdisplayskip .initial:n = 0.5ex plus .1ex minus .1ex,
unknown .code:n = \eb_msg_deprecated_option:n { spread }
}
-\AfterPreamble
- {\skip_set:Nn \abovedisplayshortskip { 0ex plus .1ex }}
+\tl_if_eq:NnT \l__ctex_scheme_tl { chinese }
+ {
+ \fp_compare:nNnTF { \l__ctex_line_spread_fp } = { 1.3 }
+ { \ctex_set:nn { spread } { line = 1.354,table = 1.354 } }
+ { \ctex_set:nn { spread } { line = \fp_use:N \l__ctex_line_spread_fp } }
+ }
+\AfterPreamble{\skip_set:Nn \abovedisplayshortskip { 0ex plus .1ex }}
-\eb_seq_map_inline:nn
+\clist_map_inline:nn
{ table,figure,listing }
{
\DeclareCaptionFont{eb@#1@font}
@@ -2022,7 +2039,7 @@
}{}
\cs_new_protected:Npn \eb_enumitem_label_set:nn #1#2
{ \SetEnumitemValue{label}{#1}{\color{ctex@emph}#2} }
-\eb_seq_map_inline:nn
+\clist_map_inline:nn
{
{ bullet } { \textbullet },
{ endash } { \normalfont\bfseries\textendash },
@@ -2045,7 +2062,7 @@
\setlist[enumerate,3]{label = roman,ref = enumiii}
\setlist[description]{font = sf,style = standard}
\newlist{eb@eqcomp@list}{description}{1}
-\setlist[eb@eqcomp@list]{nosep,labelsep = 0em}
+\setlist[eb@eqcomp@list]{nosep,labelsep = 0pt}
\cs_new:Npn \seteqcomplist #1 { \setlist*[eb@eqcomp@list]{#1} }
\keys_define:nn { eb/eqcomp }
@@ -2053,7 +2070,7 @@
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 = ——,
+ delim .initial:n = \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } { —— } { --- },
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,
@@ -2143,7 +2160,7 @@
\declaretheoremstyle{default}[
spaceabove = 0ex plus .1ex,
spacebelow = 0ex plus .1ex,
- headindent = 0em,
+ headindent = 0pt,
within = \bool_if:NT \l__eb_class_mode_book_bool { chapter },
headpunct = { },
headfont = \color{ctex@emph}\sffamily,
@@ -2209,21 +2226,21 @@
cases,cases*,dcases,dcases*,rcases,rcases*,drcases,drcases*,
aligned,alignedat,gathered,multlined,lgathered,rgathered
}
- { \setspread{\fp_use:N \l__eb_spread_math_fp} }
-\eb_seq_map_inline:nn
+ { \setspread{\eb@spread@math} }
+\clist_map_inline:nn
{ \start@gather,\start@align,\start@multline }
{
\eb_patch_cmd:Nnn #1
{ \collect@body }
{
- \setspread{\fp_use:N \l__eb_spread_math_fp}
+ \setspread{\eb@spread@math}
\collect@body
}
}
\eb_patch_cmd:Nnn \gather@split
{ \spread@equation }
{
- \setspread{\fp_use:N \l__eb_spread_math_fp}
+ \setspread{\eb@spread@math}
\spread@equation
}
\ctex_at_end_package:nn { unicode-math }
@@ -2389,7 +2406,7 @@
},
}
}
-\eb_seq_map_inline:nn
+\clist_map_inline:nn
{
{ linkcolor } { link },
{ color } { theme }
@@ -2536,7 +2553,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2024/05/10}{2024bn}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2024/05/12}{2024bo}
{Customization of tcolorbox for easybook}
\cs_set_protected:Npn \addtotcbstyle #1#2