summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/easybook/easybook.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2024-04-23 03:00:52 +0000
committerNorbert Preining <norbert@preining.info>2024-04-23 03:00:52 +0000
commitb5598758830c291828e8dcf4693b17f97d2bf3b9 (patch)
tree3385f558e291f7ab07eca23b94cbc857014b6e3c /macros/latex/contrib/easybook/easybook.dtx
parenta31bd8158f86091f06dabe074c14dd277da57c68 (diff)
CTAN sync 202404230300
Diffstat (limited to 'macros/latex/contrib/easybook/easybook.dtx')
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx110
1 files changed, 65 insertions, 45 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index b1e774981d..ed8abf47f5 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -15,7 +15,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2021/11/15]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2024/04/19}{2024as}
+\ProvidesExplClass{easybook}{2024/04/22}{2024aw}
{Easily typesetting Chinese theses or books}
\bool_new:N \l__eb_compile_draft_bool
@@ -297,7 +297,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2021/11/15]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2024/04/19}{2024as}
+\ProvidesExplPackage{easybase}{2024/04/22}{2024aw}
{Easily typesetting Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -308,7 +308,7 @@
\cs_generate_variant:Nn \skip_set:Nn { NV }
\cs_generate_variant:Nn \seq_set_from_clist:Nn { No }
\cs_generate_variant:Nn \ctex_define:nn { nx }
-\cs_generate_variant:Nn \eb_put_hyperref:n { x }
+\cs_generate_variant:Nn \eb_set_hyperref:n { x }
\cs_generate_variant:Nn \eb_at_begin_environment:nn { on }
\cs_set_protected:Npn \ctex_define:nn #1
@@ -564,8 +564,8 @@
{
\exp_args:Nx \geometry
{
- \l_keys_key_str
- \tl_if_empty:NF \l_keys_value_tl { = {#1} }
+ \str_use:N \l_keys_key_str
+ \tl_if_empty:NF \l_keys_value_tl { = \exp_not:n { {#1} } }
}
}
}
@@ -1176,7 +1176,7 @@
\tl_use:N \l__eb_fntext_after_tl
}
-\tl_clear:N \@thefnmark
+\tl_clear_new:N \@thefnmark
\tl_new:N \@the@up@fnmark
\cs_new:Npn \eb@@makefnmark #1#2
{
@@ -1275,8 +1275,7 @@
{ \use:c { CTEX@#1@tocline }{#1}{#2} }
\group_end:
}
-\eb_seq_map_inline:nn
- { chapter,section,subsection }
+\cs_new_protected:Npn \RegisterBititle #1
{
\exp_args:Nc \NewDocumentCommand { bi#1 }{sO{##3}mm}
{
@@ -1294,11 +1293,44 @@
}
}
}
+\clist_map_function:nN
+ { chapter,section,subsection }
+ \RegisterBititle
\eb_preto_cmd:nn { @chapter }
{
\skip_if_eq:nnF { \eb@toc@lol@skip } { \c_zero_skip }
{ \addtocontents{lol}{\protect\addvspace{\skip_use:N \eb@toc@lol@skip}} }
}
+\cs_new_protected:Npn \NewTitleCommand #1#2
+ {
+ \newcounter{#1}
+ \cs_set_eq:cN { #1mark } \use_none:n
+ \tl_clear:N \l__ctex_tmp_tl
+ \__ctex_initial_heading:n {#1}
+ \__ctex_def_heading_keys:n {#1}
+ \exp_args:No \ctex_define:n { \l__ctex_tmp_tl }
+ \cs_gset_protected:cpx {#1}
+ {
+ \exp_not:N \@startsection{#1}{#2}
+ {\exp_not:c { CTEX@#1@indent }}
+ {\exp_not:c { CTEX@#1@beforeskip }}
+ {\exp_not:c { CTEX@#1@afterskip }}
+ {\exp_not:N \normalfont\exp_not:c { CTEX@#1@format }}
+ }
+ \cs_new:cpn { CTEX@#1@tocline } ##1##2
+ { \CTEXnumberline{##1}##2 }
+ \exp_args:Nc \providecommand { toclevel@#1 }{#2}
+ }
+\NewDocumentCommand{\NewTitleEntryCommand}{O{toc}m}
+ {
+ \cs_new_protected:cpn { #2entry } ##1
+ {
+ \bool_if:cTF { CTEX@#2@numbering }
+ { \CTEX@ifnametrue }
+ { \CTEX@ifnamefalse }
+ \addcontentsline{#1}{#2}{\use:c { CTEX@#2@tocline }{#2}{##1}}
+ }
+ }
\ctex_define:nn { style }
{
@@ -1537,8 +1569,8 @@
#1/tocend .tl_set:c = l__eb_toc_#1_end_tl
}
}
-\tl_new:N \l_eb_tmpa_tl
-\tl_new:N \l_eb_tmpb_tl
+\tl_new:N \l__eb_toc_tmpa_tl
+\tl_new:N \l__eb_toc_tmpb_tl
\cs_new_protected:Npn \eb_toc_format_initial:nn #1#2
{
\exp_last_unbraced:Nx
@@ -1546,7 +1578,7 @@
{
\exp_not:N
\titlecontents
- \tl_use:N \l_eb_tmpa_tl
+ \tl_use:N \l__eb_toc_tmpa_tl
\exp_not:n
{
{#2}
@@ -1556,10 +1588,11 @@
{\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 }
+ \exp_not:o { \l__eb_toc_tmpb_tl }
}
\ctex_set:nn {#2}
{
+ tocformat = \IfBooleanT{#1}{\contentsmargin{0pt}},
tocindent = 0em,
tocrule = \IfBooleanTF{#1}{,~\thecontentspage}{\tocrule{$\cdot$}},
toclabel =
@@ -1567,13 +1600,7 @@
\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 }
- }
+ { ##1\tl_use:c { l__eb_toc_##2_after_tl } }
},
tocafter = \hspace{1em},
tocsep = .—,
@@ -1584,8 +1611,9 @@
{
\IfBooleanT{#1}
{
- \tl_set:Nn \l_eb_tmpa_tl {*}
- \tl_set:Nn \l_eb_tmpb_tl
+ \ctex_set:nn { tocset } { between = { },bibetween = { } }
+ \tl_set:Nn \l__eb_toc_tmpa_tl {*}
+ \tl_set:Nn \l__eb_toc_tmpb_tl
{
[\tl_use:c { l__eb_toc_#2_sep_tl }]
[\tl_use:c { l__eb_toc_#2_end_tl }]
@@ -1593,6 +1621,8 @@
}
\eb_toc_format_define:n {#2}
\eb_toc_format_initial:nn {#1} {#2}
+ \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
@@ -2226,6 +2256,12 @@
\lstloadlanguages{C,C++,Java,Python,Matlab}
\clist_new:N \l__eb_hyperref_clist
+\cs_new_protected:Npn \eb_set_hyperref:n #1
+ {
+ \IfPackageLoadedTF{hyperref}
+ {\hypersetup}
+ {\eb_put_hyperref:n}{#1}
+ }
\cs_new_protected:Npn \eb_put_hyperref:n #1
{ \clist_put_right:Nn \l__eb_hyperref_clist {#1} }
\cs_new_protected:Npn \eb_define_link_color:nnn #1#2#3
@@ -2290,36 +2326,20 @@
color-every .code:n = \eb_define_theme_color:n { \exp_not:n {#1} }
}
-\bool_new:N \l__eb_toc_number_color_bool
\cs_new_protected:Npn \eb_link_border_set:n #1
{
- \bool_set_false:N \l__eb_toc_number_color_bool
\ctex_at_end_package:nn { hyperref }
{
\def\@pdfborder{#1}
\def\Hy@colorlink ##1 {\begingroup}
\def\Hy@endcolorlink{\endgroup}
}
- \eb_put_hyperref:n { colorlinks = false }
+ \eb_set_hyperref:n { colorlinks = false }
}
\cs_new_protected:Npn \eb_link_colors_set:
- {
- \bool_set_true:N \l__eb_toc_number_color_bool
- \colorlet{ctex@toc@number}{ctex@link}
- \eb_put_hyperref:n { colorlinks }
- }
+ { \eb_set_hyperref:n { colorlinks } }
\cs_new_protected:Npn \eb_link_toc_put:n #1
- {
- \eb_put_hyperref:n { linktoc = #1 }
- \eb_seq_map_inline:nn { page,none }
- {
- \tl_if_eq:NnT \l_keys_value_tl {##1}
- {
- \colorlet{ctex@toc@number}{black}
- \seq_map_break:
- }
- }
- }
+ { \eb_set_hyperref:n { linktoc = #1 } }
\ctex_define:nn { refset }
{
linktype .choice:,
@@ -2330,15 +2350,15 @@
linktype/various .meta:n = linktype/colors,
linktype .initial:n = edge,
linktoc .choice:,
+ linktoc .value_required:n = true,
linktoc/unknown .code:n = \eb_link_toc_put:n {#1},
- linktoc .default:n = all,
linktoc .initial:n = all,
unknown .code:n =
{
- \eb_put_hyperref:x
+ \eb_set_hyperref:x
{
- \l_keys_key_str
- \tl_if_empty:NF \l_keys_value_tl { = {#1} }
+ \str_use:N \l_keys_key_str
+ \tl_if_empty:NF \l_keys_value_tl { = \exp_not:n { {#1} } }
}
}
}
@@ -2420,7 +2440,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2024/04/19}{2024as}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2024/04/22}{2024aw}
{Customization of tcolorbox for easybook}
\cs_set_protected:Npn \addtotcbstyle #1#2