summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/easybook/easybase.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/easybook/easybase.sty')
-rw-r--r--Master/texmf-dist/tex/latex/easybook/easybase.sty84
1 files changed, 56 insertions, 28 deletions
diff --git a/Master/texmf-dist/tex/latex/easybook/easybase.sty b/Master/texmf-dist/tex/latex/easybook/easybase.sty
index 6241165ab95..b28fd502d9a 100644
--- a/Master/texmf-dist/tex/latex/easybook/easybase.sty
+++ b/Master/texmf-dist/tex/latex/easybook/easybase.sty
@@ -20,7 +20,7 @@
%% This work has the LPPL maintenance status `maintained'.
\NeedsTeXFormat{LaTeX2e}[2021/11/15]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2024/04/02}{2024ar}
+\ProvidesExplPackage{easybase}{2024/04/19}{2024as}
{Easily typesetting Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -1242,19 +1242,6 @@
\seq_put_right:Nn \c__ctex_headings_seq { figure }
\seq_put_right:Nn \c__ctex_headings_seq { lstlisting }
\seq_remove_duplicates:N \c__ctex_headings_seq
-\cs_new_protected:Npn \eb_toc_entry_if_hang:n #1
- {
- \bool_if:NTF \l__eb_toc_entry_hang_bool
- { \contentspush }
- { \use:n }
- {
- \bool_if:NTF \l__eb_toc_number_color_bool
- { \textcolor{ctex@toc@number} }
- { \use:n }
- { \thecontentslabel }
- \tl_use:c { l__eb_toc_#1_after_tl }
- }
- }
\cs_new_protected:Npn \eb_toc_format_define:n #1
{
\ctex_define:n
@@ -1264,30 +1251,71 @@
#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 .tl_set:c = l__eb_toc_#1_indent_tl,
+ #1/toclabel .cs_set:cp = { eb_toc_entry_#1:nnn } ##1##2##3,
#1/tocrule .tl_set:c = l__eb_toc_#1_rule_tl,
#1/tocafter .tl_set:c = l__eb_toc_#1_after_tl,
- #1/tocbelow .tl_set:c = l__eb_toc_#1_below_tl
+ #1/tocbelow .tl_set:c = l__eb_toc_#1_below_tl,
+ #1/tocbegin .meta:n = { #1/tocbelow = {##1} },
+ #1/tocsep .tl_set:c = l__eb_toc_#1_sep_tl,
+ #1/tocend .tl_set:c = l__eb_toc_#1_end_tl
}
}
-\cs_new_protected:Npn \eb_toc_format_initial:n #1
+\tl_new:N \l_eb_tmpa_tl
+\tl_new:N \l_eb_tmpb_tl
+\cs_new_protected:Npn \eb_toc_format_initial:nn #1#2
{
- \titlecontents{#1}
- [\tl_use:c { l__eb_toc_#1_indent_tl }]
- {\tl_use:c { l__eb_toc_#1_format_tl }}
- {\eb_toc_entry_if_hang:n {#1}}{}
- {\tl_use:c { l__eb_toc_#1_rule_tl }}
- [\tl_use:c { l__eb_toc_#1_below_tl }]
- \ctex_set:nn {#1}
+ \exp_last_unbraced:Nx
+ \use:n
+ {
+ \exp_not:N
+ \titlecontents
+ \tl_use:N \l_eb_tmpa_tl
+ \exp_not:n
+ {
+ {#2}
+ [\tl_use:c { l__eb_toc_#2_indent_tl }]
+ {\tl_use:c { l__eb_toc_#2_format_tl }}
+ {\use:c { eb_toc_entry_#2:nnn } { \thecontentslabel } {#2} {#1}}{}
+ {\tl_use:c { l__eb_toc_#2_rule_tl }}
+ [\tl_use:c { l__eb_toc_#2_below_tl }]
+ }
+ \exp_not:o { \l_eb_tmpb_tl }
+ }
+ \ctex_set:nn {#2}
{
tocindent = 0em,
- tocrule = \tocrule{$\cdot$},
- tocafter = \hspace{1em}
+ tocrule = \IfBooleanTF{#1}{,~\thecontentspage}{\tocrule{$\cdot$}},
+ toclabel =
+ {
+ \bool_if:NTF \l__eb_toc_entry_hang_bool
+ { \IfBooleanTF{##3}{\use:n}{\contentspush} }
+ { \use:n }
+ {
+ \bool_if:NTF \l__eb_toc_number_color_bool
+ { \textcolor{ctex@toc@number} }
+ { \use:n }
+ { ##1 }
+ \tl_use:c { l__eb_toc_##2_after_tl }
+ }
+ },
+ tocafter = \hspace{1em},
+ tocsep = .—,
+ tocend = .
}
}
-\cs_new_protected:Npn \RegisterTocName #1
+\NewDocumentCommand{\RegisterTocName}{sm}
{
- \eb_toc_format_define:n {#1}
- \eb_toc_format_initial:n {#1}
+ \IfBooleanT{#1}
+ {
+ \tl_set:Nn \l_eb_tmpa_tl {*}
+ \tl_set:Nn \l_eb_tmpb_tl
+ {
+ [\tl_use:c { l__eb_toc_#2_sep_tl }]
+ [\tl_use:c { l__eb_toc_#2_end_tl }]
+ }
+ }
+ \eb_toc_format_define:n {#2}
+ \eb_toc_format_initial:nn {#1} {#2}
}
\seq_map_function:NN
\c__ctex_headings_seq \RegisterTocName