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.dtx145
1 files changed, 102 insertions, 43 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index a7d77a29ae..eed7155bee 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/18}{1.3O}
+\ProvidesExplClass{easybook}{2021/10/18}{1.3P}
{Typeset Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -319,7 +319,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2021/10/18}{1.3O}
+\ProvidesExplPackage{easybase}{2021/10/18}{1.3P}
{Typeset Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -868,7 +868,28 @@
{ \tl_set:Nn \l__eb_footnote_choice_tl {#1} }
}
}
+\cs_new_protected:Npn \eb_fn_shift_set:nnn #1#2#3
+ {
+ \str_if_eq:nnTF {#1} { match }
+ {
+ \tl_set:cv { l__eb_fn#2_#3shift_tl }
+ { l__spb_super_script_#3shift_dim }
+ }
+ { \tl_set:cn { l__eb_fn#2_#3shift_tl } {#1} }
+ }
+\cs_new_protected:Npn \eb_fn_format_set:nn #1#2
+ {
+ \str_if_eq:nnTF {#1} { match }
+ { \bool_set_true:c { l__eb_fn#2_format_match_bool } }
+ {
+ \bool_set_false:c { l__eb_fn#2_format_match_bool }
+ \tl_set:cn { l__eb_fn#2_format_tl } {#1}
+ }
+ }
+
\bool_new:N \l__eb_fnpara_bottom_bool
+\tl_new:N \l__eb_fnmate_format_tl
+\tl_new:N \l__eb_fncust_format_tl
\clist_new:N \l__eb_footnote_mulchoice_clist
\ctex_define:nn { hdrset }
{
@@ -880,14 +901,14 @@
fnparindent .initial:n = 2em,
fnpara-form .tl_set:N = \l__eb_fnpara_format_tl,
- fnmark-pos .tl_set:N = \l__eb_fnmark_position_tl,
- fnmark-pos .initial:n = super,
+ fntext-pos .tl_set:N = \l__eb_fntext_position_tl,
+ fntext-pos .initial:n = super,
fntext-code .code:n = \eb_assign_fnmark_code:n {#1},
fntext-code .initial:n =
- { ,\tl_if_eq:NnF \l__eb_fnmark_position_tl { super } { \space } },
- fnmark-form .tl_set:N = \l__eb_fnmark_format_tl,
- fncust-form .tl_set:N = \l__eb_fncust_format_tl,
- fnboth-form .meta:n = { fnmark-form = #1,fncust-form = #1 },
+ { ,\tl_if_eq:NnF \l__eb_fntext_position_tl { super } { \space } },
+ fnmate-form .code:n = \eb_fn_format_set:nn {#1} { mate },
+ fncust-form .code:n = \eb_fn_format_set:nn {#1} { cust },
+ fnboth-form .meta:n = { fnmate-form = #1,fncust-form = #1 },
footnotetype .multichoices:nn =
{ default,hang,bottom,para,flush }
@@ -895,6 +916,13 @@
footnotetype .value_required:n = true,
footnotetype .initial:n = hang,
+ fnmark-vshift .code:n = \eb_fn_shift_set:nnn {#1} { mark } { v },
+ fnmark-hshift .code:n = \eb_fn_shift_set:nnn {#1} { mark } { h },
+ fntext-vshift .code:n = \eb_fn_shift_set:nnn {#1} { text } { v },
+ fnmark-vshift .initial:n = 0pt,
+ fnmark-hshift .initial:n = 0pt,
+ fntext-vshift .initial:n = 0pt,
+
fnmark-num .choices:nn =
{ plain,pifont,pifont*,pifont-sans,pifont-sans* }
{ \eb_fnmark_normal_label_set:nn {#1} { the@footnote } },
@@ -968,6 +996,7 @@
}
}
}
+
\cs_new_protected:Npn \eb_footnote_direct_hang:
{
\hbox_set:Nn \l_tmpa_box
@@ -1028,15 +1057,7 @@
\@ifpackagewith{footmisc}{hang}
{\cs_set_eq:NN \@makefntext \eb@makefntext}{}
}
-\eb_at_end_patch_cmd:nnn { \@footnotetext,\@mpfootnotetext }
- { \reset@font }
- {
- \linespread{\fp_use:N \l__eb_spread_footnote_fp}
- \selectfont\ignorespaces
- \l__eb_subfont_footnote_tl
- }
-\ProvideDocumentCommand{\super}{d()mo}{\textsuperscript{#2}}
-\providecommand{\spbset}{\use_none:n}
+
\cs_set_protected:Npn \footref #1
{
\group_begin:
@@ -1067,6 +1088,13 @@
\@footnotemark
}
}
+\eb_at_end_patch_cmd:nnn { \@footnotetext,\@mpfootnotetext }
+ { \reset@font }
+ {
+ \linespread{\fp_use:N \l__eb_spread_footnote_fp}
+ \selectfont\ignorespaces
+ \l__eb_subfont_footnote_tl
+ }
\ctex_at_end_package:nn { hyperref }
{
\cs_set:Npn \@xfootnotemark [#1]
@@ -1078,22 +1106,45 @@
\H@@footnotemark
}
}
+
+\ProvideDocumentCommand{\super}{od()mo}{\textsuperscript{#3}}
+\providecommand{\spbset}{\use_none:n}
\NewDocumentCommand{\eb@fnmark@super}{sm}
{
\IfBooleanTF{#1}
- {\super{#2}[0pt]}
- {\super(\l__eb_fnmark_format_tl){#2}[0pt]}
+ {\super[\l__eb_fntext_vshift_tl]{#2}[0pt]}
+ {
+ \super[\l__eb_fnmark_vshift_tl]
+ (\l__eb_fnmate_format_tl){#2}
+ [\l__eb_fnmark_hshift_tl]
+ }
}
\cs_new_protected:Npn \eb_fnmark_format_initial:
{
- \spbset{super-format = { },nohshift}
+ \bool_if:NF \l__eb_fnmate_format_match_bool
+ { \spbset{super-format = { }} }
\tl_use:N \l__eb_subfont_footnote_tl
}
+\bool_set_true:N \l__eb_normal_footnote_bool
+\bool_new:N \l__eb_fnmate_format_match_bool
+\bool_new:N \l__eb_fncust_format_match_bool
+\cs_new_protected:Npn \eb_fn_format_if_match:T #1
+ {
+ \bool_if:NTF \l__eb_normal_footnote_bool
+ { \bool_if:NT \l__eb_fnmate_format_match_bool {#1} }
+ { \bool_if:NT \l__eb_fncust_format_match_bool {#1} }
+ }
+\cs_new_protected:Npn \eb_fn_set_eq_format:
+ {
+ \tl_set_eq:NN
+ \l__eb_fnmate_format_tl \l__spb_super_script_formati_tl
+ }
\cs_set:Npn \@makefnmark
{
\hbox:n
{
\eb_fnmark_format_initial:
+ \eb_fn_format_if_match:T { \eb_fn_set_eq_format: }
\tl_if_eq:NnTF \@mpfn { footnote }
{ \eb@fnmark@super{\eb@thefnmark} }
{ \eb@fnmark@super{\@thefnmark} }
@@ -1104,15 +1155,18 @@
\hbox:n
{
\eb_fnmark_format_initial:
- \tl_if_eq:NnT \l__eb_fnmark_position_tl { super }
- { \eb@fnmark@super* }
+ \tl_use:N \l__eb_fnmark_before_tl
+ \tl_if_eq:NnTF \l__eb_fntext_position_tl { super }
{
- \tl_use:N \l__eb_fnmark_before_tl
- {\l__eb_fnmark_format_tl{\@thefnmark}}
- \tl_use:N \l__eb_fnmark_after_tl
+ \eb_fn_format_if_match:T { \tl_clear:N \l__eb_fnmate_format_tl }
+ \eb@fnmark@super*
}
+ { \eb_fn_format_if_match:T { \eb_fn_set_eq_format: } }
+ {\l__eb_fnmate_format_tl{\@thefnmark}}
+ \tl_use:N \l__eb_fnmark_after_tl
}
}
+
\tl_clear:N \@thefnmark
\tl_new:N \eb@thefnmark
\cs_new:Npn \eb@@makefnmark #1#2
@@ -1128,8 +1182,12 @@
\cs_new_protected:Npn \eb_fncust_format_initial:
{
% \hdrset{fntext-code = { }}
- \tl_set_eq:NN
- \l__eb_fnmark_format_tl \l__eb_fncust_format_tl
+ \bool_set_false:N \l__eb_normal_footnote_bool
+ \bool_if:NF \l__eb_fncust_format_match_bool
+ {
+ \tl_set_eq:NN
+ \l__eb_fnmate_format_tl \l__eb_fncust_format_tl
+ }
}
\NewDocumentCommand{\Footnote}{O{#2}mm}
{
@@ -1163,6 +1221,19 @@
\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
+\cs_new_protected:Npn \eb_titletoc_hang_fix:n #1
+ {
+ \bool_if:NT \eb@titletoc@hang@fix@bool
+ {
+ \contentspush
+ {
+ \bool_if:NT \l__eb_toc_number_color_bool
+ { \color{ctex@toc@number} }
+ \thecontentslabel
+ \hspace{\use:c { eb@toc@#1@numsep }}
+ }
+ }
+ }
\cs_new_protected:Npn \eb_toc_assign_keys:n #1
{
\ctex_define:n { tocset/#1 .meta:nn = { ctex/tocset/#1 } {##1} }
@@ -1181,18 +1252,7 @@
\titlecontents{#1}
[\dim_use:c { l__eb_toc_#1_indent_dim }]
{\tl_use:c { l__eb_toc_#1_format_tl }}
- {
- \bool_if:NT \eb@titletoc@hang@fix@bool
- {
- \contentspush
- {
- \bool_if:NT \l__eb_toc_number_color_bool
- { \color{ctex@toc@number} }
- \thecontentslabel
- \hspace{\use:c { eb@toc@#1@numsep }}
- }
- }
- }{}
+ {\eb_titletoc_hang_fix:n {#1}}{}
{\tl_use:c { l__eb_toc_#1_rule_tl }}
}
\seq_map_function:NN
@@ -2187,8 +2247,7 @@
\LoadPackage[backend = biber]{biblatex}
\clist_map_function:NN \l__eb_bib_datafile_clist \addbibresource
\tl_gset:Nn \blx@default@theheading { bibintoc }
- \defbibheading{bibintoc}[\bibname]
- {\eb_biber_title_level_spec:n {##1}}
+ \defbibheading{bibintoc}[\bibname]{\eb_biber_title_level_spec:n {##1}}
\skip_zero:N \bibitemsep
}
\eb_at_end_preamble:n
@@ -2292,6 +2351,7 @@
linktype/colors .code:n =
{
\bool_set_true:N \l__eb_toc_number_color_bool
+ \colorlet{ctex@toc@number}{ctex@link}
\eb_put_hyperref:n { colorlinks }
},
linktype/various .meta:n = linktype/colors,
@@ -2337,7 +2397,6 @@
linkcol-all .code:n =
{ \eb_define_link_color:n { \exp_not:n {#1} } }
}
-\colorlet{ctex@toc@number}{ctex@link}
\ctex_define:nx { style }
{
color .choice:,
@@ -2422,7 +2481,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2021/10/18}{1.3O}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2021/10/18}{1.3P}
{Customization of tcolorbox for easybook}
\tl_gset:Nn \eb@tc@line@skip { 0.5\baselineskip }