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.dtx212
1 files changed, 103 insertions, 109 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index de8fd66f10..73196e000b 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -15,7 +15,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/10/25}{1.40C}
+\ProvidesExplClass{easybook}{2021/10/25}{1.40E}
{Typeset Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -325,7 +325,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2021/10/25}{1.40C}
+\ProvidesExplPackage{easybase}{2021/10/25}{1.40E}
{Typeset Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -1207,6 +1207,10 @@
\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
@@ -1216,24 +1220,22 @@
\bool_if:NT \l__eb_toc_number_color_bool
{ \color{ctex@toc@number} }
\thecontentslabel
- \hspace{\use:c { eb@toc@#1@numsep }}
+ \tl_use:c { l__eb_toc_#1_after_tl }
}
}
}
\cs_new_protected:Npn \eb_toc_assign_keys:n #1
{
- \ctex_define:n { tocset/#1 .meta:nn = { ctex/tocset/#1 } {##1} }
- \ctex_define:nn { tocset }
+ \ctex_define:n
{
- #1/format .tl_set:c = l__eb_toc_#1_format_tl,
- #1/format+ .code: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/format~+ .code:n =
+ #1/tocformat~+ .code:n =
{ \tl_put_right:cn { l__eb_toc_#1_format_tl } {##1} },
- #1/indent .dim_set:c = l__eb_toc_#1_indent_dim,
- #1/rule .tl_set:c = l__eb_toc_#1_rule_tl,
- #1/numsep .dim_set:c = eb@toc@#1@numsep,
- #1/unknown .code:n = \eb_msg_unknown_option:n { tocset }
+ #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 }]
@@ -1243,20 +1245,23 @@
}
\seq_map_function:NN
\c__ctex_headings_seq \eb_toc_assign_keys:n
-\ctex_define:n { tocset/list .meta:nn = { ctex/tocset/list } {#1} }
\eb_clist_map_inline:nn
{ figure,table,lstlisting }
{
- \ctex_define:nn { tocset }
+ \ctex_define:n
{
#1/voffset .skip_set:c = l__eb_toc_#1_voffset_skip,
#1/tocline .cs_set:cp = { eb@toc@label@#1 } ##1,
}
}
\eb_clist_map_inline:nn
- { format,format+,format~+,indent,rule,numsep,voffset,tocline }
{
- \ctex_define:nn { tocset }
+ tocformat,tocformat+,tocformat~+,
+ tocindent,tocrule,tocline,
+ voffset,tocafter
+ }
+ {
+ \ctex_define:n
{
list/#1 .meta:n =
{
@@ -1267,59 +1272,39 @@
}
}
\eb_clist_map_inline:nn
- { numsep,indent,rule }
+ { tocafter,tocindent,tocrule }
{
\ctex_define:nn { tocset }
{
- #1-all .meta:n =
+ #1-all .code:n =
{
- part/#1 = ##1,
- chapter/#1 = ##1,
- section/#1 = ##1,
- subsection/#1 = ##1,
- list/#1 = ##1
+ \ctex_set:n
+ {
+ part/#1 = ##1,
+ chapter/#1 = ##1,
+ section/#1 = ##1,
+ subsection/#1 = ##1,
+ list/#1 = ##1
+ }
}
}
}
-\cs_set_eq:NN \ctexnumberline \CTEXnumberline
-\cs_set:Npn \CTEXnumberline #1
- {
- \CTEXifname
- {
- \bool_if:NTF \eb@titletoc@hang@fix@bool
- { \eb@numberline{\use:c { CTEXthe#1 }} }
- {
- \use:c { CTEXthe#1 }
- \hspace{\use:c { eb@toc@#1@numsep }}
- }
- }{}
- }
-\cs_new:Npn \eb@numberline { \protect\numberline }
-\cs_set_eq:NN \EBNumberLine \CTEXnumberline
\ctex_define:nn { tocset }
{
- lolskip .skip_set:N = \eb@toc@lolskip,
- lolskip .initial:n = 10pt,
- tocvoffset .skip_set:N = \l__eb_toc_voffset_skip,
- tocvoffset .initial:n =
+ lolskip .skip_set:N = \eb@toc@lolskip,
+ lolskip .initial:n = 10pt,
+ main-voffset .skip_set:N = \l__eb_toc_main_voffset_skip,
+ main-voffset .initial:n =
{ \bool_if:NTF \l__eb_class_book_bool { 1pc } { 0.35pc } },
- line-align .bool_set:N = \l__eb_toc_line_align_bool,
- line-align .default:n = true,
- line-align .initial:n = true,
- hang .bool_set:N = \eb@titletoc@hang@fix@bool,
- hang .default:n = true,
- hang .initial:n = false,
+ line-align .bool_set:N = \l__eb_toc_line_align_bool,
+ line-align .default:n = true,
+ line-align .initial:n = true,
+ hang .bool_set:N = \eb@titletoc@hang@fix@bool,
+ hang .default:n = true,
+ hang .initial:n = false,
unknown .code:n = \eb_msg_unknown_option:n { tocset }
}
-\ctex_set:n
- {
- part/tocline = \CTEXnumberline{#1}#2,
- chapter/tocline = \CTEXnumberline{#1}#2,
- section/tocline = \CTEXnumberline{#1}#2,
- subsection/tocline = \CTEXnumberline{#1}#2
- }
-
\NewDocumentCommand{\tocrule}{sO{0.7pc}D(){1.2}mO{}}
{
\normalsize\normalfont
@@ -1334,62 +1319,69 @@
}
}
}
-\ctex_set:nn { tocset }
+\cs_set_eq:NN \ctexnumberline \CTEXnumberline
+\cs_new:Npn \eb@numberline { \protect\numberline }
+\cs_set:Npn \CTEXnumberline #1
+ {
+ \CTEXifname
+ {
+ \bool_if:NTF \eb@titletoc@hang@fix@bool
+ { \eb@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/format = \addvspace{1pc}\sffamily\large,
- part/indent = 0em,
- part/rule = \tocrule{}[\bfseries],
+ part/tocformat = \addvspace{1pc}\sffamily\large,
+ part/tocindent = 0em,
+ part/tocrule = \tocrule{}[\bfseries],
+ part/tocline = \CTEXnumberline{#1}#2,
- chapter/format = \addvspace{1pc}\sffamily\large,
- chapter/indent = 0em,
- chapter/rule = \tocrule{$\cdot$}[\bfseries],
+ chapter/tocformat = \addvspace{1pc}\sffamily\large,
+ chapter/tocindent = 0em,
+ chapter/tocrule = \tocrule{$\cdot$}[\bfseries],
+ chapter/tocline = \CTEXnumberline{#1}#2,
- section/format =
+ section/tocformat =
{
\addvspace{0.35pc}
\bool_if:NF \l__eb_class_book_bool { \sffamily }
},
- section/indent =
+ section/tocindent =
{ \bool_if:NTF \l__eb_class_book_bool { 1.5em } { 0em } },
- section/rule =
+ section/tocrule =
{
\bool_if:NTF \l__eb_class_book_bool
{ \tocrule{$\cdot$} }
{ \tocrule{$\cdot$}[\bfseries] }
},
+ section/tocline = \CTEXnumberline{#1}#2,
- subsection/format = \addvspace{0.35pc},
- subsection/indent =
+ subsection/tocformat = \addvspace{0.35pc},
+ subsection/tocindent =
{ \bool_if:NTF \l__eb_class_book_bool { 3.8em } { 1.4em } },
- subsection/rule = \tocrule{$\cdot$},
+ subsection/tocrule = \tocrule{$\cdot$},
+ subsection/tocline = \CTEXnumberline{#1}#2,
- list/format = \addvspace{0.2pc},
- list/indent = 0em,
- list/rule = \tocrule{$\cdot$},
- list/voffset =
+ list/tocformat = \addvspace{0.2pc},
+ list/tocindent = 0em,
+ list/tocrule = \tocrule{$\cdot$},
+ list/voffset =
{ 0.2pc\bool_if:NT \l__eb_class_book_bool { + 10pt } },
-
- figure/tocline =
- {
- \figurename~#1
- \bool_if:NF \eb@titletoc@hang@fix@bool
- { \hspace{\eb@toc@figure@numsep} }
- },
- table/tocline =
- {
- \tablename~#1
- \bool_if:NF \eb@titletoc@hang@fix@bool
- { \hspace{\eb@toc@table@numsep} }
- },
- lstlisting/tocline =
- {
- \lstlistingname~\thelstlisting
- \bool_if:NF \eb@titletoc@hang@fix@bool
- { \hspace{\eb@toc@lstlisting@numsep} }
- },
- numsep-all = 1em
+ 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_name_prop
\prop_set_from_keyval:Nn \l__eb_list_label_name_prop
{
@@ -1649,12 +1641,12 @@
\tl_set:Nn \eb@bitoc@title { Contents }
\IfValueT{#2}{\keys_set:nn { eb/listoc } {#2}}
\eb_title_mark_notoc:n { \eb@toc@title }
- \vspace*{-\dim_use:N \l__eb_toc_voffset_skip}
+ \vspace*{-\dim_use:N \l__eb_toc_main_voffset_skip}
\eb_toc_start_multi_column_ext:n { toc }#3
\IfBooleanT{#1}
{
\eb_title_mark_notoc:n { \eb@bitoc@title }
- \vspace*{-\dim_use:N \l__eb_toc_voffset_skip}
+ \vspace*{-\dim_use:N \l__eb_toc_main_voffset_skip}
\eb_toc_start_multi_column_ext:n { tec }
}
\group_end:
@@ -2120,17 +2112,19 @@
\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 = \c__eb_name_exercise_tl,
- numsep .dim_set:N = \eb@toc@exercise@numsep,
- numsep .initial:n = 0.5em,
- label .tl_set:N = \eb@tc@exercise@label,
- enumitem .code:n = \setexerlist{#1},
- tcolorbox .code:n = \addtcbstyle{exercise}{#1}
+ 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 = \c__eb_name_exercise_tl,
+ 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}
}
\cs_set_protected:Npn \setexercise #1
{ \keys_set:nn { eb/exercise } {#1} }
@@ -2457,7 +2451,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2021/10/25}{1.40C}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2021/10/25}{1.40E}
{Customization of tcolorbox for easybook}
\tl_gset:Nn \eb@tc@line@skip { 0.5\baselineskip }
@@ -2555,7 +2549,7 @@
}
\addcontentsline{toc}{section}
{
- \eb_tcb_toc_counter_numsep:n { section }
+ \eb_tcb_toc_counter_numsep:n { exertoc }
\eb@tc@exercise@title
}
}{}