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.dtx159
1 files changed, 83 insertions, 76 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index c4e52d8a91..18a9524c2c 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -15,12 +15,12 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/11/28}{1.41B}
+\ProvidesExplClass{easybook}{2021/11/29}{1.41C}
{Typeset Chinese theses or books}
\bool_set_false:N \l__eb_compile_draft_bool
\bool_set_false:N \l__eb_title_newline_bool
-\bool_set_true:N \l__eb_class_book_bool
+\bool_set_true:N \l__eb_class_mode_book_bool
\tl_new:N \g__eb_config_tl
\tl_new:N \l__eb_font_choice_tl
\clist_new:N \g__eb_options_clist
@@ -58,7 +58,7 @@
class/book .code:n = { },
class/article .code:n =
{
- \bool_set_false:N \l__eb_class_book_bool
+ \bool_set_false:N \l__eb_class_mode_book_bool
\eb_put_ctexbook:n { oneside }
},
book .meta:n = { class = book },
@@ -253,7 +253,7 @@
\ctex_set:n
{
secnumdepth = 3,
- tocdepth = \bool_if:NTF \l__eb_class_book_bool { 1 } { 2 },
+ tocdepth = \bool_if:NTF \l__eb_class_mode_book_bool { 1 } { 2 },
part =
{
pagestyle = empty,
@@ -325,7 +325,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplPackage{easybase}{2021/11/28}{1.41B}
+\ProvidesExplPackage{easybase}{2021/11/29}{1.41C}
{Typeset Chinese theses or books}
\cs_generate_variant:Nn \dim_set:Nn { NV }
@@ -423,8 +423,8 @@
{ \BeforeBeginEnvironment{document} }
\cs_gset_eq:NN \PackageWarning \PackageInfo
-\bool_if_exist:NF \l__eb_class_book_bool
- { \bool_set_true:N \l__eb_class_book_bool }
+\bool_if_exist:NF \l__eb_class_mode_book_bool
+ { \bool_set_true:N \l__eb_class_mode_book_bool }
\bool_if_exist:NF \l__eb_compile_draft_bool
{ \bool_set_false:N \l__eb_compile_draft_bool }
\clist_new:N \g__eb_ctex_options_clist
@@ -446,7 +446,7 @@
class/book .code:n = { },
class/article .code:n =
{
- \bool_set_false:N \l__eb_class_book_bool
+ \bool_set_false:N \l__eb_class_mode_book_bool
\boolfalse{@twoside}
\boolfalse{@mparswitch}
},
@@ -491,21 +491,21 @@
\eb_clist_map_inline:nn
{ style,subfont,spread,bibset,thmset,hdrset,tocset }
{
- \msg_new:nnn { easybase } { ignore-#1 }
+ \msg_new:nnn { easybase } { abandon-#1 }
{
- ##1~is~an~unknown~option~of~#1. \\
- Please~check~the~user~manual~for~the~supported~options.
+ ##1~is~an~abandoned~option~of~#1~module. \\
+ Please~browse~the~user~manual~for~the~new~options.
}
}
-\cs_new:Npn \eb_msg_unknown_option:n #1
- { \msg_warning:nnx { easybase } { ignore-#1 } { \l_keys_key_str } }
+\cs_new:Npn \eb_msg_abandon_option:n #1
+ { \msg_warning:nnx { easybase } { abandon-#1 } { \l_keys_key_str } }
\cs_if_exist:NF \chapter
{
\newcounter{chapter}
- \bool_set_false:N \l__eb_class_book_bool
+ \bool_set_false:N \l__eb_class_mode_book_bool
\ctex_define:n { chapter/tocline .code:n = { } }
}
-\bool_if:NF \l__eb_class_book_bool
+\bool_if:NF \l__eb_class_mode_book_bool
{
\cs_undefine:N \chapter
\ctex_after_end_preamble:n
@@ -710,24 +710,21 @@
{ \eb_mark_nouppercase:n }
{ \use:c { eb_fancyhf_#1_mark:n } {#2} }
}
+\cs_set:Npn \markdouble #1 { \markboth{#1}{\ifbool{@twoside}{#1}{}} }
\cs_new:Npn \eb@level@markdouble #1#2
- {
- \markboth
- {\eb_mark_if_uppercase:nn {#1} {#2}}
- {\ifbool{@twoside}{\eb_mark_if_uppercase:nn {#1} {#2}}{}}
- }
+ { \markdouble{\eb_mark_if_uppercase:nn {#1} {#2}} }
\cs_new:Npn \eb@level@markright #1#2
{ \markright{\eb_mark_if_uppercase:nn {#1} {#2}} }
\cs_gset:Npn \chaptermark #1 { \eb@level@markdouble{chapter}{#1} }
\cs_gset:Npn \sectionmark #1
{
- \bool_if:NTF \l__eb_class_book_bool
+ \bool_if:NTF \l__eb_class_mode_book_bool
{ \eb@level@markright{section}{#1} }
{ \eb@level@markdouble{section}{#1} }
}
\cs_gset:Npn \subsectionmark #1
{
- \bool_if:NF \l__eb_class_book_bool
+ \bool_if:NF \l__eb_class_mode_book_bool
{ \eb@level@markright{subsection}{#1} }
}
\cs_gset_eq:NN \ps@plain \ps@empty
@@ -915,7 +912,7 @@
fntext-num/unknown .code:n = \eb_fnmate_short_label_set:nn {#1} { thefootnote },
fnmate-num .meta:n = { fntext-num = #1,fnmark-num = #1 },
fnmate-num .initial:n = plain,
- unknown .code:n = \eb_msg_unknown_option:n { hdrset }
+ unknown .code:n = \eb_msg_abandon_option:n { hdrset }
}
\eb_at_end_preamble:n
@@ -1287,26 +1284,29 @@
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.2pc },
+ main-voffset .initial:n = \bool_if:NTF \l__eb_class_mode_book_bool { 1pc } { 0.2pc },
dotalign .bool_set:N = \l__eb_toc_dot_align_bool,
dotalign .default:n = true,
dotalign .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 }
+ unknown .code:n = \eb_msg_abandon_option:n { tocset }
}
-\NewDocumentCommand{\tocrule}{sO{0.7pc}D(){1.2}mO{}}
+\NewDocumentCommand{\tocrule}{st-O{0.7pc}D(){1.2}mO{}}
{
\normalsize\normalfont
- \titlerule*[#2]{\scalebox{#3}{#4}}#5
+ \titlerule*[#3]{\scalebox{#4}{#5}}#6
\bgroup
- \IfBooleanTF{#1}
- {\thecontentspage}
+ \IfBooleanF{#2}
{
- \bool_if:NTF \l__eb_toc_dot_align_bool
- { \contentspage }
- { \thecontentspage }
+ \IfBooleanTF{#1}
+ {\thecontentspage}
+ {
+ \bool_if:NTF \l__eb_toc_dot_align_bool
+ { \contentspage }
+ { \thecontentspage }
+ }
}
\egroup
}
@@ -1340,23 +1340,27 @@
chapter/tocindent = 0em,
chapter/tocrule = \tocrule{$\cdot$}[\bfseries],
chapter/tocline = \CTEXnumberline{#1}#2,
- section/tocformat = \addvspace{0.2pc}\bool_if:NF \l__eb_class_book_bool { \sffamily },
- section/tocindent = \bool_if:NTF \l__eb_class_book_bool { 1.5em } { 0em },
+ section/tocformat =
+ {
+ \addvspace{0.2pc}
+ \bool_if:NF \l__eb_class_mode_book_bool { \sffamily }
+ },
+ section/tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 1.5em } { 0em },
section/tocrule =
{
- \bool_if:NTF \l__eb_class_book_bool
+ \bool_if:NTF \l__eb_class_mode_book_bool
{ \tocrule{$\cdot$} }
{ \tocrule{$\cdot$}[\bfseries] }
},
section/tocline = \CTEXnumberline{#1}#2,
subsection/tocformat = \addvspace{0.2pc},
- subsection/tocindent = \bool_if:NTF \l__eb_class_book_bool { 3.8em } { 1.4em },
+ subsection/tocindent = \bool_if:NTF \l__eb_class_mode_book_bool { 3.8em } { 1.4em },
subsection/tocrule = \tocrule{$\cdot$},
subsection/tocline = \CTEXnumberline{#1}#2,
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 },
+ list/voffset = 0.2pc\bool_if:NT \l__eb_class_mode_book_bool { + 10pt },
table/tocline = \listnumberline{table},
figure/tocline = \listnumberline{figure},
lstlisting/tocline = \listnumberline{lstlisting}
@@ -1491,7 +1495,7 @@
listing-connect = #1,equation-connect = #1
},
connect-all .initial:n = { . },
- unknown .code:n = \eb_msg_unknown_option:n { style }
+ unknown .code:n = \eb_msg_abandon_option:n { style }
}
\eb_clist_map_inline:nn
{ figure,table,lstlisting,equation }
@@ -1507,14 +1511,14 @@
}
}
-\tl_set:Nx \l__eb_toc_type_tl
- { \bool_if:NTF \l__eb_class_book_bool { chapter } { section } }
+\tl_set:Nx \l__eb_toc_title_level_tl
+ { \bool_if:NTF \l__eb_class_mode_book_bool { chapter } { section } }
\tl_new:N \eb@bitoc@title
\keys_define:nn { eb/listoc }
{
- section .code:n = \tl_set:Nn \l__eb_toc_type_tl { section },
- chapter .code:n = \tl_set:Nn \l__eb_toc_type_tl { chapter },
- none .code:n = \tl_set:Nn \l__eb_toc_type_tl { none },
+ section .code:n = \tl_set:Nn \l__eb_toc_title_level_tl { section },
+ chapter .code:n = \tl_set:Nn \l__eb_toc_title_level_tl { chapter },
+ none .code:n = \tl_set:Nn \l__eb_toc_title_level_tl { none },
article .meta:n = section,
book .meta:n = chapter,
multoc .int_set:N = \l__eb_toc_columns_int,
@@ -1523,7 +1527,7 @@
columns .meta:n = { multoc = #1 },
title .code:n = \eb_assign_toc_title:n {#1}
}
-\bool_if:NTF \l__eb_class_book_bool
+\bool_if:NTF \l__eb_class_mode_book_bool
{ \keys_define:nn { } { eb/listoc .inherit:n = ctex/chapter } }
{ \keys_define:nn { } { eb/listoc .inherit:n = ctex/section } }
\NewDocumentCommand{\eb_assign_toc_title:n}
@@ -1537,17 +1541,17 @@
{ \tl_set:Nn \eb@bitoc@title {#2} }
}
-\cs_new_protected:Npn \eb_toc_type_section_initial:
+\cs_new_protected:Npn \eb_toc_title_level_initial:
{
- \bool_if:NF \l__eb_class_book_bool
+ \bool_if:NF \l__eb_class_mode_book_bool
{
- \tl_if_eq:NnT \l__eb_toc_type_tl { chapter }
- { \tl_set:Nn \l__eb_toc_type_tl { section } }
+ \tl_if_eq:NnT \l__eb_toc_title_level_tl { chapter }
+ { \tl_set:Nn \l__eb_toc_title_level_tl { section } }
}
}
\cs_new_protected:Npn \eb_title_mark_intoc:n #1
{
- \str_case:Vn \l__eb_toc_type_tl
+ \str_case:Vn \l__eb_toc_title_level_tl
{
{ chapter } { \bichapter*{#1}{\eb@bitoc@title} }
{ section } { \bisection*{#1}{\eb@bitoc@title} }
@@ -1555,7 +1559,7 @@
}
\cs_new_protected:Npn \eb_title_mark_notoc:n #1
{
- \str_case:Vn \l__eb_toc_type_tl
+ \str_case:Vn \l__eb_toc_title_level_tl
{
{ chapter } { \chapter*{\phantomsection #1}\chaptermark{#1} }
{ section } { \section*{\phantomsection #1}\sectionmark{#1} }
@@ -1563,10 +1567,10 @@
}
\cs_new_protected:Npn \eb_title_number_intoc_spec:nn #1#2
{
- \eb_toc_type_section_initial:
+ \eb_toc_title_level_initial:
\IfBooleanTF{#1}
{
- \str_case:Vn \l__eb_toc_type_tl
+ \str_case:Vn \l__eb_toc_title_level_tl
{
{ chapter } { \bichapter{\eb@toc@title}{\eb@bitoc@title} }
{ section } { \bisection{\eb@toc@title}{\eb@bitoc@title} }
@@ -1579,7 +1583,7 @@
}
\cs_new_protected:Npn \eb_biber_title_level_spec:n #1
{
- \bool_if:NTF \l__eb_class_book_bool
+ \bool_if:NTF \l__eb_class_mode_book_bool
{ \bichapter*{#1}{\l__eb_bib_en_bitoc_title_tl} }
{ \bisection*{#1}{\l__eb_bib_en_bitoc_title_tl} }
\sectionmark{#1}
@@ -1596,7 +1600,7 @@
}
\cs_new_protected:Npn \eb_toc_if_title_voffset:n #1
{
- \tl_if_eq:NnF \l__eb_toc_type_tl { none }
+ \tl_if_eq:NnF \l__eb_toc_title_level_tl { none }
{ \vspace*{-\dim_use:c { l__eb_toc_#1_voffset_skip }} }
}
\cs_new_protected:Npn \eb_toc_list_parse:nnnnn #1#2#3#4#5
@@ -1628,7 +1632,7 @@
\tl_set_eq:NN \eb@toc@title \contentsname
\tl_set:Nn \eb@bitoc@title { Contents }
\IfValueT{#2}{\keys_set:nn { eb/listoc } {#2}}
- \eb_toc_type_section_initial:
+ \eb_toc_title_level_initial:
\eb_title_mark_notoc:n { \eb@toc@title }
\eb_toc_if_title_voffset:n { main }
\eb_toc_start_multi_column_ext:n { toc }#3
@@ -1727,7 +1731,7 @@
footnote .initial:n = \rmfamily,
marginpar .tl_set:N = \marginfont,
marginpar .initial:n = \rmfamily\footnotesize,
- unknown .code:n = \eb_msg_unknown_option:n { subfont }
+ unknown .code:n = \eb_msg_abandon_option:n { subfont }
}
\fp_new:N \l__eb_spread_table_fp
@@ -1748,7 +1752,7 @@
footnote .fp_set:N = \l__eb_spread_footnote_fp,
footnote .initial:n = 1.2,
spread-all .meta:n = { line = #1,table = #1,math = #1,caption = #1,footnote = #1 },
- unknown .code:n = \eb_msg_unknown_option:n { spread }
+ unknown .code:n = \eb_msg_abandon_option:n { spread }
}
\DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{~}(#2)}
@@ -1987,7 +1991,7 @@
thmbox .meta:n = { thmframe = #1 },
thmbox .default:n = true,
notebraces .tl_set:N = \l__eb_thm_notebraces_tl,
- unknown .code:n = \eb_msg_unknown_option:n { thmset }
+ unknown .code:n = \eb_msg_abandon_option:n { thmset }
}
\eb_patch_cmd:wnn \thmt@setheadstyle
{ \def\NAME{\the\thm@headfont ##1} }
@@ -2006,7 +2010,7 @@
headfont = \color{ctex@emph}\sffamily,
postheadspace = 1em,
notebraces = {(}{)},
- within = \bool_if:NT \l__eb_class_book_bool { chapter },
+ within = \bool_if:NT \l__eb_class_mode_book_bool { chapter },
headformat = \NAME\NUMBER\NOTE
}
\msg_new:nnn { easybase } { need-tcolorbox }
@@ -2108,7 +2112,7 @@
datafile .clist_set:N = \l__eb_bib_datafile_clist,
bitoc-title .tl_set:N = \l__eb_bib_en_bitoc_title_tl,
bitoc-title .initial:n = Reference,
- unknown .code:n = \eb_msg_unknown_option:n { bibset }
+ unknown .code:n = \eb_msg_abandon_option:n { bibset }
}
\cs_new_protected:Npn \eb_natbib_bibtex_set:
@@ -2366,7 +2370,8 @@
\ctex_define:n
{
lstlistlistingname .tl_set:N = \listlstlistingname,
- lstlistingname .tl_set:N = \lstlistingname
+ lstlistingname .tl_set:N = \lstlistingname,
+ exercisename .tl_set:N = \exercisename
}
\tl_if_eq:NnTF \l__ctex_scheme_tl { chinese }
{
@@ -2378,7 +2383,8 @@
listfigurename = 图片索引,
listtablename = 表格索引,
lstlistlistingname = 代码索引,
- lstlistingname = 代码
+ lstlistingname = 代码,
+ exercisename = 练习
}
\labelformat{equation}{式(#1)}
\labelformat{section}{节 #1}
@@ -2389,7 +2395,8 @@
{
abstractname = Abstract,
lstlistlistingname = List~of~Codes,
- lstlistingname = Code
+ lstlistingname = Code,
+ exercisename = Exercise
}
\labelformat{equation}{Equation~(#1)}
\labelformat{section}{Section~#1}
@@ -2397,17 +2404,18 @@
}
%</package>
%<*tcolorbox>
-\ProvidesExplFile{eb-tcolorbox.cfg}{2021/11/28}{1.41B}
+\ProvidesExplFile{eb-tcolorbox.cfg}{2021/11/29}{1.41C}
{Customization of tcolorbox for easybook}
\cs_set_protected:Npn \setexercise #1
{ \keys_set:nn { eb/exercise } {#1} }
\cs_set_protected:Npn \addtcbstyle #1#2
{ \tcbset{#1/.append~style = {#2}} }
-\cs_set_protected:Npn \newtcbstyle #1#2
+\cs_set_protected:Npn \deftcbstyle #1#2
{ \tcbset{#1/.style = {#2}} }
\cs_new_protected:Npn \tcbappstyle
- { \@ifstar{\newtcbstyle}{\addtcbstyle} }
+ { \@ifstar{\deftcbstyle}{\addtcbstyle} }
+\cs_set_eq:NN \newtcbstyle \deftcbstyle
\keys_define:nn { eb/exercise }
{
color .tl_set:N = \eb@tc@background@color,
@@ -2415,7 +2423,7 @@
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,
+ title .initial:n = \exercisename,
numsep .dim_set:N = \eb@toc@exercise@numsep,
numsep .initial:n = 0.5em,
tocnumsep .dim_set:N = \eb@toc@exertoc@numsep,
@@ -2426,7 +2434,7 @@
}
\tl_gset:Nn \eb@tc@line@skip { 0.5\baselineskip }
-\newtcbstyle{tc-theorem}
+\deftcbstyle{tc-theorem}
{
enhanced~jigsaw,pad~at~break* = 3pt,
opacityback = 0,
@@ -2437,7 +2445,7 @@
top = \eb@tc@line@skip,bottom = \eb@tc@line@skip,
middle = \eb@tc@line@skip
}
-\newtcbstyle{tc-outline}
+\deftcbstyle{tc-outline}
{
enhanced,nofloat,
tikznode~boxed~title,
@@ -2450,14 +2458,14 @@
arc = 3pt,
left = 2pc,right = 2pc,top = 1.5pc,bottom = 1pc
}
-\newtcbstyle{tc-exercise}
+\deftcbstyle{tc-exercise}
{
blank,on~line,center,
sharpish~corners,
fontupper = \Large\sffamily,
beforeafter~skip = 3.75ex plus .2ex minus .1ex
}
-\newtcbstyle{tc-easybox}
+\deftcbstyle{tc-easybox}
{
enhanced~jigsaw,pad~at~break* = 3pt,
center~title,
@@ -2471,7 +2479,7 @@
titlerule = 0pt,
beforeafter~skip = 1.75ex plus .2ex minus .1ex
}
-\newtcbstyle{tc-ebparbox}
+\deftcbstyle{tc-ebparbox}
{
frame~hidden,
enhanced~jigsaw,pad~at~break* = 3pt,
@@ -2481,15 +2489,15 @@
middle = \eb@tc@line@skip,bottomtitle = \eb@tc@line@skip,
beforeafter~skip = 1.75ex plus .2ex minus .1ex
}
-\newtcbstyle{tc-ebemph}{on~line,blank}
-\newtcbstyle{tc-eblink}
+\deftcbstyle{tc-ebemph}{on~line,blank}
+\deftcbstyle{tc-eblink}
{
standard~jigsaw,on~line,
top = 1.5pt,bottom = 1.5pt,left = 1.5pt,right = 1.5pt,
boxrule = 0.5pt,arc = 1pt,
opacityback = 0.2
}
-\newtcbstyle{tc-ebfbox}
+\deftcbstyle{tc-ebfbox}
{
on~line,sharpish~corners,
top = 1.5pt,bottom = 1.5pt,left = 1pt,right = 1pt,
@@ -2511,7 +2519,6 @@
\tl_gset:Nn \eb@tc@exercise@ifnametrue {#1}
\tl_gset:Nn \eb@tc@exercise@ifnamefalse {#2}
}
-\eb_thm_name_set:nnn { exercise } { Exercise } { 练习 }
\tcphantomifname
{
\markright