summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/easybook/easybook.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-08-02 03:02:40 +0000
committerNorbert Preining <norbert@preining.info>2021-08-02 03:02:40 +0000
commit7c20aed48e20b439ef64f417a7e32ce7fda44d18 (patch)
tree13cc29cf9941f8b282c5a95dcb8910f1aef9dbd5 /macros/latex/contrib/easybook/easybook.dtx
parent956b25a304207d06fe012f8c8efcb13cc66e3eec (diff)
CTAN sync 202108020302
Diffstat (limited to 'macros/latex/contrib/easybook/easybook.dtx')
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx178
1 files changed, 137 insertions, 41 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index 3e61fa0833..7f671cf194 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -8,7 +8,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/07/30}{1.28}
+\ProvidesExplClass{easybook}{2021/08/01}{1.28b}
{Typeset Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
@@ -292,11 +292,10 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2021/07/30}{1.28}
+\ProvidesExplPackage{easybase}{2021/08/01}{1.28b}
{Typeset Chinese theses or books}
\cs_generate_variant:Nn \int_to_arabic:n { v }
-\cs_generate_variant:Nn \int_to_alph:n { v }
\cs_generate_variant:Nn \dim_add:Nn { NV,Nv }
\cs_generate_variant:Nn \dim_set:Nn { NV }
\cs_generate_variant:Nn \prop_set_from_keyval:Nn { NV }
@@ -728,8 +727,6 @@
\cs_if_exist:NF \kaishu { \cs_gset_eq:NN \kaishu \itshape }
}
-\tl_new:N \l__eb_fnmark_number_choice_tl
-\bool_new:N \l__eb_fntext_bottom_bool
\ctex_define:nn { style }
{
footwith .choices:nn =
@@ -738,6 +735,73 @@
footwith .value_required:n = true,
footwith .initial:n = chapter
}
+\NewDocumentCommand{\eb_assign_fnmark_code:n}
+ {>{\SplitArgument{1}{,}}m}
+ {\eb_assign_fnmark_code_pos:nn #1}
+\cs_new_protected:Npn \eb_assign_fnmark_code_pos:nn #1#2
+ {
+ \tl_set:Nn \l__eb_fnmark_before_tl {#1}
+ \tl_if_novalue:nTF {#2}
+ { \tl_clear:N \l__eb_fnmark_after_tl }
+ { \tl_set:Nn \l__eb_fnmark_after_tl {#2} }
+ }
+\cs_new:Npn \eb_fnmark_counter_pifont:N #1
+ { \ding{\int_eval:n { 171 + #1 }} }
+\cs_new:Npn \eb_fnmark_counter_pifont_neg:N #1
+ { \ding{\int_eval:n { 181 + #1 }} }
+\cs_new:Npn \eb_fnmark_counter_pifont_sans:N #1
+ { \ding{\int_eval:n { 191 + #1 }} }
+\cs_new:Npn \eb_fnmark_counter_pifont_sans_neg:N #1
+ { \ding{\int_eval:n { 201 + #1 }} }
+\cs_new:Npn \eb_int_format_trans:NN #1
+ {
+ \str_case:nn {#1}
+ {
+ { A } { \int_to_Alph:n }
+ { a } { \int_to_alph:n }
+ { 1 } { \int_to_arabic:n }
+ { I } { \int_to_Roman:n }
+ { i } { \int_to_roman:n }
+ { c } { \exp_args:NV \zhnumber }
+ }
+ }
+\cs_new_protected:Npn \eb_fnmark_normal_label_set:nn #1#2
+ {
+ \tl_set:Nn \l__eb_fnmark_number_type_tl {#1}
+ \cs_set:cpx {#2}
+ {
+ \str_case:VnT \l__eb_fnmark_number_type_tl
+ {
+ { plain }
+ { \exp_not:N \int_use:N }
+ { pifont }
+ { \exp_not:N \eb_fnmark_counter_pifont:N }
+ { pifont* }
+ { \exp_not:N \eb_fnmark_counter_pifont_neg:N }
+ { pifont-sans }
+ { \exp_not:N \eb_fnmark_counter_pifont_sans:N }
+ { pifont-sans* }
+ { \exp_not:N \eb_fnmark_counter_pifont_sans_neg:N }
+ }
+ { \exp_not:N \c@footnote }
+ }
+ }
+\cs_new_protected:Npn \eb_fnmark_shorter_label_set:nn #1#2
+ {
+ \tl_set:Nn \l__eb_fnmark_shorter_label_tl {#1}
+ \eb_clist_map_inline:nn
+ { A,a,1,I,i,c }
+ {
+ \tl_if_in:nnT {#1} {##1}
+ {
+ \tl_replace_once:Nnn \l__eb_fnmark_shorter_label_tl {##1}
+ { \eb_int_format_trans:NN ##1 \c@footnote }
+ \seq_map_break:
+ }
+ }
+ \cs_set_eq:cN {#2} \l__eb_fnmark_shorter_label_tl
+ }
+\bool_new:N \l__eb_fntext_bottom_bool
\ctex_define:nn { hdrset }
{
fnmargin .dim_set:N = \footnoteindent,
@@ -750,9 +814,9 @@
fnmark-pos .tl_set:N = \l__eb_fnmark_position_tl,
fnmark-pos .initial:n = super,
- afterfnmark .tl_set:N = \l__eb_fnmark_after_tl,
- afterfnmark .initial:n =
- { \tl_if_eq:NnF \l__eb_fnmark_position_tl { super } { \space } },
+ fnmark-code .code:n = \eb_assign_fnmark_code:n {#1},
+ fnmark-code .initial:n =
+ { ,\tl_if_eq:NnF \l__eb_fnmark_position_tl { super } { \space } },
fnmark-form .tl_set:N = \l__eb_fnmark_format_tl,
footnotetype .multichoices:nn =
@@ -767,8 +831,18 @@
fnmark-num .choices:nn =
{ plain,pifont,pifont*,pifont-sans,pifont-sans* }
- { \tl_set:Nn \l__eb_fnmark_number_choice_tl {#1} },
+ { \eb_fnmark_normal_label_set:nn {#1} { the@footnote } },
fnmark-num .value_required:n = true,
+ fnmark-num/unknown .code:n =
+ { \eb_fnmark_shorter_label_set:nn {#1} { the@footnote } },
+ fntext-num .choices:nn =
+ { plain,pifont,pifont*,pifont-sans,pifont-sans* }
+ { \eb_fnmark_normal_label_set:nn {#1} { thefootnote } },
+ fntext-num .value_required:n = true,
+ fntext-num/unknown .code:n =
+ { \eb_fnmark_shorter_label_set:nn {#1} { thefootnote } },
+ fnboth-num .meta:n = { fntext-num = #1,fnmark-num = #1 },
+ fnboth-num .initial:n = plain,
unknown .code:n = \eb_msg_unknown_option:n { hdrset }
}
@@ -882,20 +956,58 @@
}
\ProvideDocumentCommand{\super}{mo}{\textsuperscript{#1}}
\providecommand{\spb@textsuperscript@save}{\textsuperscript}
-\providecommand{\footref}[1]
+\cs_set_protected:Npn \footref #1
{
\group_begin:
- \unrestored@protected@xdef\@thefnmark{\ref{#1}}
+ \unrestored@protected@xdef\eb@thefnmark{\ref{#1}}
\group_end:
\@footnotemark
}
+\cs_set_protected:Npn \footnote
+ {
+ \@ifnextchar [
+ {\@xfootnote}
+ {
+ \exp_args:NV \stepcounter \@mpfn
+ \eb_current_label:n { @footnote }
+ \protected@xdef\@thefnmark{\thempfn}
+ \protected@xdef\eb@thefnmark{\the@footnote}
+ \@footnotemark
+ \@footnotetext
+ }
+ }
+\cs_set:Npn \footnotemark
+ {
+ \@ifnextchar [
+ {\@xfootnotemark}
+ {
+ \stepcounter{footnote}
+ \protected@xdef\eb@thefnmark{\the@footnote}
+ \@footnotemark
+ }
+ }
+\ctex_at_end_package:nn { hyperref }
+ {
+ \cs_set:Npn \@xfootnotemark [#1]
+ {
+ \group_begin:
+ \setcounter{footnote}{#1}
+ \unrestored@protected@xdef\eb@thefnmark{\the@footnote}
+ \group_end:
+ \@footnotemark
+ }
+ }
\cs_set:Npn \@makefnmark
{
\hbox:n
{
\tl_use:N \l__eb_subfont_footnote_tl
\tl_use:N \l__eb_fnmark_format_tl
- {\super{\@thefnmark}[0pt]}
+ {
+ \tl_if_eq:NnTF \@mpfn { footnote }
+ { \super{\eb@thefnmark}[0pt] }
+ { \super{\@thefnmark}[0pt] }
+ }
}
}
\cs_new:Npn \eb@makefnmark
@@ -906,8 +1018,12 @@
\tl_use:N \l__eb_fnmark_format_tl
{
\tl_if_eq:NnT \l__eb_fnmark_position_tl { super }
- { \spb@textsuperscript@save }{\@thefnmark}
- \tl_use:N \l__eb_fnmark_after_tl
+ { \spb@textsuperscript@save }
+ {
+ \tl_use:N \l__eb_fnmark_before_tl
+ \@thefnmark
+ \tl_use:N \l__eb_fnmark_after_tl
+ }
}
}
}
@@ -924,30 +1040,8 @@
\cs_new:Npn \Footnote #1 { \Footnotemark{#1}\@footnotetext }
\cs_new:Npn \Footnotemark #1 { \eb@@makefnmark{#1}\@footnotemark }
\cs_new:Npn \Footnotetext #1 { \eb@@makefnmark{#1}\@footnotetext }
-\cs_new:Npn \eb_fnmark_counter_pifont:N #1
- { \ding{\int_eval:n { 171 + #1 }} }
-\cs_new:Npn \eb_fnmark_counter_pifont_neg:N #1
- { \ding{\int_eval:n { 181 + #1 }} }
-\cs_new:Npn \eb_fnmark_counter_pifont_sans:N #1
- { \ding{\int_eval:n { 191 + #1 }} }
-\cs_new:Npn \eb_fnmark_counter_pifont_sans_neg:N #1
- { \ding{\int_eval:n { 201 + #1 }} }
-\cs_new:Npn \eb_footnote_counter:N #1
- {
- \str_case:VnF \l__eb_fnmark_number_choice_tl
- {
- { plain } { \int_use:N #1 }
- { pifont } { \eb_fnmark_counter_pifont:N #1 }
- { pifont* } { \eb_fnmark_counter_pifont_neg:N #1 }
- { pifont-sans } { \eb_fnmark_counter_pifont_sans:N #1 }
- { pifont-sans* } { \eb_fnmark_counter_pifont_sans_neg:N #1 }
- }
- { \int_use:N #1 }
- }
-\cs_new:Npn \eb_alph:n #1 { \int_to_alph:v { c@#1 } }
-\cs_set:Npn \thefootnote { \eb_footnote_counter:N \c@footnote }
-\cs_set:Npn \thempfootnote { \eb_alph:n { mpfootnote } }
\cs_new:Npn \eb@footmisc@ifvoid #1#2#3 { \ifvoid #1#2\else #3\fi }
+\cs_set:Npn \thempfootnote { \int_to_alph:n { \c@mpfootnote } }
\contentsuse{lstlisting}{lol}
\seq_put_left:Nn \c__ctex_headings_seq { chapter }
@@ -1191,11 +1285,10 @@
\tl_remove_once:cn { theeb@#4 } {#5}
\eb_current_label:n { eb@#4 }
}
-\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@#1 } }
\cs_new:Npn \eb_section_counter_prefix:n #1
{
\int_compare:nNnT { \c@chapter } > { 0 } { \use:c { the#1chapter }. }
- \eb_arabic:n { #1section }
+ \int_to_arabic:v { c@#1section }
}
\cs_set:Npn \thebichapter { \eb_arabic:n { bichapter } }
\cs_set:Npn \thebisection { \eb_section_counter_prefix:n { bi } }
@@ -2147,7 +2240,10 @@
\clist_map_inline:nn { page,none }
{
\tl_if_eq:NnT \l_keys_value_tl {##1}
- { \clist_map_break:n { \colorlet{ctex@toc@number}{black} } }
+ {
+ \colorlet{ctex@toc@number}{black}
+ \clist_map_break:
+ }
}
},
linktoc .default:n = all,
@@ -2256,7 +2352,7 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2021/07/30}{1.28}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2021/08/01}{1.28b}
{Customization of tcolorbox for easybook}
\tl_gset:Nn \eb@tc@line@skip { 0.5\baselineskip }