summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/easybook/easybook.cls
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/easybook/easybook.cls')
-rw-r--r--Master/texmf-dist/tex/latex/easybook/easybook.cls220
1 files changed, 140 insertions, 80 deletions
diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls
index c4eba751794..1388e2c4070 100644
--- a/Master/texmf-dist/tex/latex/easybook/easybook.cls
+++ b/Master/texmf-dist/tex/latex/easybook/easybook.cls
@@ -13,9 +13,9 @@
%% https://creativecommons.org/licenses/by/4.0/legalcode
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/04/07}{1.24g}{beta}
+\ProvidesExplClass{easybook}{2021/04/09}{1.24i}{beta}
-\cs_generate_variant:Nn \keys_define:nn {nx}
+\cs_generate_variant:Nn \__ctex_define:nn {nx}
\cs_generate_variant:Nn \int_to_arabic:n {v}
\cs_generate_variant:Nn \dim_add:Nn {NV}
\cs_generate_variant:Nn \__eb_put_hyperref:n {x}
@@ -27,6 +27,8 @@
{\ctex_patch_cmd_once:NnnnTF #1{}{#2}{#3}{}{\ctex_patch_failure:N #1}}
\cs_new_protected:Npn \__eb_appto_cmd:Nn #1#2
{\ctex_appto_cmd:NnnTF #1{}{#2}{}{\ctex_patch_failure:N #1}}
+\cs_new_protected:Npn \__eb_at_end_preamble:n
+ {\ctex_gadd_ltxhook:nn {env/document/before}}
\bool_set_false:N \l__eb_draft_bool
\bool_set_false:N \l__eb_newline_bool
@@ -132,7 +134,7 @@
withpart .initial:n = false,
notomath .bool_set:N = \l__eb_notomath_bool,
notomath .default:n = true,
- notomath .initial:n = false,
+ notomath .initial:n = true,
rulewidth .dim_set:N = \l__eb_rule_width_dim,
rulewidth .initial:n = 0.75pt,
uppercase .bool_set:N = \l__eb_uppercase_bool,
@@ -168,8 +170,8 @@
fancyhdr,titletoc,
caption-light,subcaption,
tabularx,multirow,booktabs,
- tasks,enumitem,
- listings,imakeidx
+ enumitem,
+ listings
}
\ctex_at_end_preamble:n
{
@@ -285,7 +287,8 @@
\cs_new_protected:Npn \kaishu{\__eb_switch_family:n {kaishu}}
\cs_new_protected:Npn \fangsong{\__eb_switch_family:n {fangsong}}
}
-\cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\normalfont}
+\__eb_at_end_preamble:n
+ {\cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\normalfont}}
\includepdfset{fitpaper = true}
\geometry
@@ -353,6 +356,7 @@
\easyhead[OC]{\color{ctex@frame}\kaishu\rightmark}
\easyhead[EL,OR]{\color{ctex@frame}\thepage}
},
+
chap-mark .cs_set:Np = \__eb_fancyhf_chap_mark:n #1,
chap-mark .initial:n =
{
@@ -375,6 +379,17 @@
\fi
}#1
},
+ subsec-mark .cs_set:Np = \__eb_fancyhf_subsec_mark:n #1,
+ subsec-mark .initial:n =
+ {
+ \int_compare:nT {\c@secnumdepth > 1}
+ {
+ \ifodd\CTEX@subsection@numbering
+ \CTEXthesubsection\hspace{0.5\ccwd}
+ \fi
+ }#1
+ },
+
headrule .tl_gset:N = \headrule,
headrule .initial:n =
{
@@ -401,35 +416,56 @@
{\text_uppercase:n {\__eb_fancyhf_chap_mark:n {#1}}}
{\text_titlecase_first:n {\__eb_fancyhf_chap_mark:n {#1}}}
}
+\cs_new_protected:Npn \__eb_ifupper_sectionmark_set:n #1
+ {
+ \bool_if:NTF \l__eb_uppercase_bool
+ {\text_uppercase:n {\__eb_fancyhf_sec_mark:n {#1}}}
+ {\text_titlecase_first:n {\__eb_fancyhf_sec_mark:n {#1}}}
+ }
+\cs_new_protected:Npn \__eb_ifupper_subsectionmark_set:n #1
+ {
+ \bool_if:NTF \l__eb_uppercase_bool
+ {\text_uppercase:n {\__eb_fancyhf_subsec_mark:n {#1}}}
+ {\text_titlecase_first:n {\__eb_fancyhf_subsec_mark:n {#1}}}
+ }
\ctex_at_end_preamble:n
{
\exp_args:NV \geometry\g__eb_geometry_clist
- \pagestyle{fancy}
\fancyhf{}
- \bool_if:NTF \l__eb_page_twoside_bool
+ \tl_use:N \l__eb_fancyhf_content_tl
+ \cs_gset_eq:NN \ps@plain\ps@empty
+ \pagestyle{fancy}
+ \bool_if:NTF \l__eb_class_book_bool
{
- \cs_gset:Npn \chaptermark#1
+ \bool_if:NTF \l__eb_page_twoside_bool
{
- \markboth
- {\__eb_ifupper_chaptermark_set:n {#1}}
- {\__eb_ifupper_chaptermark_set:n {#1}}
+ \cs_gset:Npn \chaptermark#1
+ {
+ \markboth
+ {\__eb_ifupper_chaptermark_set:n {#1}}
+ {\__eb_ifupper_chaptermark_set:n {#1}}
+ }
+ }{
+ \cs_gset:Npn \chaptermark#1
+ {\markboth{\__eb_ifupper_chaptermark_set:n {#1}}{}}
}
- \l__eb_fancyhf_content_tl
- \cs_gset_eq:NN \ps@plain\ps@empty
+ \cs_gset:Npn \sectionmark#1
+ {\markright{\__eb_ifupper_sectionmark_set:n {#1}}}
}{
- \cs_gset:Npn \chaptermark#1
- {\markboth{\__eb_ifupper_chaptermark_set:n {#1}}{}}
- \l__eb_fancyhf_content_tl
- \cs_gset_eq:NN \ps@plain\ps@empty
- }
- \cs_gset:Npn \sectionmark#1
- {
- \markright
+ \bool_if:NTF \l__eb_page_twoside_bool
{
- \bool_if:NTF \l__eb_uppercase_bool
- {\text_uppercase:n {\__eb_fancyhf_sec_mark:n {#1}}}
- {\text_titlecase_first:n {\__eb_fancyhf_sec_mark:n {#1}}}
+ \cs_gset:Npn \sectionmark#1
+ {
+ \markboth
+ {\__eb_ifupper_sectionmark_set:n {#1}}
+ {\__eb_ifupper_sectionmark_set:n {#1}}
+ }
+ }{
+ \cs_gset:Npn \sectionmark#1
+ {\markboth{\__eb_ifupper_sectionmark_set:n {#1}}{}}
}
+ \cs_gset:Npn \subsectionmark#1
+ {\markright{\__eb_ifupper_subsectionmark_set:n {#1}}}
}
\bool_if:NT \l__eb_draft_bool
{
@@ -576,7 +612,7 @@
{\text_uppercase:n {#1}}
{\text_titlecase_first:n {#1}}
}
-\cs_new_protected:Npn \__eb_markboth:n #1
+\cs_new_protected:Npn \eb@markdouble#1
{
\bool_if:NTF \l__eb_page_twoside_bool
{
@@ -607,14 +643,14 @@
\section*{\phantomsection#1}
\CTEX@addtocline{section}{#1}
}
- \__eb_markboth:n {#1}
+ \eb@markdouble{#1}
}
-\cs_new_protected:Npn \__eb_title_mark:n #1
+\cs_new_protected:Npn \__eb_title_mark_notoc:n #1
{
\tl_if_eq:NnTF \l__eb_toc_type_tl{book}
{\chapter*{\phantomsection#1}}
{\section*{\phantomsection#1}}
- \__eb_markboth:n {#1}
+ \eb@markdouble{#1}
}
\cs_new_protected:Npn \__eb_ifmultoc_pre_set:
{
@@ -643,7 +679,7 @@
\cs_new_protected:Npn \__eb_title_ifintoc_set:n #1
{
\IfBooleanTF{#1}
- {\__eb_title_mark:n {\eb@toc@title}}
+ {\__eb_title_mark_notoc:n {\eb@toc@title}}
{\__eb_title_mark_intoc:n {\eb@toc@title}}
}
\RenewDocumentCommand{\tableofcontents}{o}
@@ -652,7 +688,7 @@
\tl_set_eq:NN \eb@toc@title\contentsname
\IfValueT{#1}{\keys_set:nn {listoc}{#1}}
\__eb_ifmultoc_pre_set:
- \__eb_title_mark:n {\eb@toc@title}
+ \__eb_title_mark_notoc:n {\eb@toc@title}
\vspace*{\dim_use:N \l__eb_toc_offset_dim}
\@starttoc{toc}
\__eb_ifmultoc_post_set:
@@ -698,22 +734,25 @@
\group_end:
}
-\makeindex[
- intoc,
- options = -M~texindy~-C~utf8,
- program = truexindy,
- columns = 2,
- columnsep = 2\ccwd
- ]
-\indexsetup
- {
- level = \bool_if:NTF \l__eb_class_book_bool{\chapter*}{\section*},
- toclevel = \bool_if:NTF \l__eb_class_book_bool{chapter}{section},
- firstpagestyle = \bool_if:NTF \l__eb_class_book_bool{plain}{fancy}
+\ctex_at_end_package:nn {imakeidx}
+ {
+ \makeindex[
+ intoc,
+ options = -M~texindy~-C~utf8,
+ program = truexindy,
+ columns = 2,
+ columnsep = 2\ccwd
+ ]
+ \indexsetup
+ {
+ level = \bool_if:NTF \l__eb_class_book_bool{\chapter*}{\section*},
+ toclevel = \bool_if:NTF \l__eb_class_book_bool{chapter}{section},
+ firstpagestyle = \bool_if:NTF \l__eb_class_book_bool{plain}{fancy}
+ }
+ \ctex_patch_cmd:Nnn \imki@indexheaders
+ {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}}
+ {\eb@markdouble{\indexname}}
}
-\__eb_patch_cmd:Nnn \imki@indexheaders
- {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}}
- {\__eb_markboth:n {\indexname}}
\tl_new:N \l__eb_font_table_tl
\tl_new:N \l__eb_font_figure_tl
@@ -895,7 +934,7 @@
\cs_new_protected:Npn \__eb_thmname_set:nn #1#2
{\tl_const:cn {c__eb_name_#1_tl}{#2}}
-\tl_if_eq:VnTF \l__ctex_scheme_tl{chinese}
+\tl_if_eq:NnTF \l__ctex_scheme_tl{chinese}
{
\clist_map_inline:nn
{
@@ -987,7 +1026,7 @@
name = \use:c {c__eb_name_#1_tl}
]{#1}
}
- \cs_gset_eq:NN \proof\relax
+ \cs_undefine:N \proof
\declaretheorem[
style = easy-thm-sty,
name = \c__eb_name_remark_tl,
@@ -1001,13 +1040,16 @@
]{proof}
}
-\settasks
+\ctex_at_end_package:nn {tasks}
{
- label = (\Alph*),
- after-item-skip = 0ex plus .1ex,
- column-sep = .5\ccwd,
- item-indent = 2\ccwd,
- label-width = 1.5\ccwd
+ \settasks
+ {
+ label = (\Alph*),
+ after-item-skip = 0ex plus .1ex,
+ column-sep = .5\ccwd,
+ item-indent = 2\ccwd,
+ label-width = 1.5\ccwd
+ }
}
\setchemformula
{
@@ -1225,19 +1267,23 @@
cite-style .code:n =
{\tl_set:Nn \l__eb_bib_citestyle_tl{#1}},
bibfile .tl_set:N = \l__eb_bib_file_tl,
- bibfile .initial:n = refs.bib
+ bibfile .initial:n = refs.bib,
+
+ bib-loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool,
+ bib-loadpkg .default:n = true,
+ bib-loadpkg .initial:n = true
}
-\cs_new_protected:Npn \__eb_bibtex_set:
+\cs_new_protected:Npn \EbBibtexSet
{
\tl_if_empty:NTF \l__eb_bib_otherstyle_tl
{
- \tl_if_eq:VnT \l__eb_bib_style_tl{numerical}
+ \tl_if_eq:NnT \l__eb_bib_style_tl{numerical}
{
\bibliographystyle{gbt7714-numerical}
\setcitestyle{comma,square,super}
}
- \tl_if_eq:VnT \l__eb_bib_style_tl{authoryear}
+ \tl_if_eq:NnT \l__eb_bib_style_tl{authoryear}
{\bibliographystyle{gbt7714-author-year}}
\cs_set_eq:NN \cite\citep
}{\exp_args:NV \bibliographystyle\l__eb_bib_otherstyle_tl}
@@ -1258,36 +1304,39 @@
}
\cs_new_protected:Npn \__eb_put_biblatex:n #1
{\PassOptionsToPackage{#1}{biblatex}}
-\cs_new_protected:Npn \__eb_biblatex_pre_set:
+\cs_new_protected:Npn \EbBiblatexPreset
{
\tl_if_empty:NTF \l__eb_bib_otherstyle_tl
{
- \tl_if_eq:VnT \l__eb_bib_style_tl{numerical}
+ \tl_if_eq:NnT \l__eb_bib_style_tl{numerical}
{\__eb_put_biblatex:n {style = gb7714-2015}}
- \tl_if_eq:VnT \l__eb_bib_style_tl{authoryear}
+ \tl_if_eq:NnT \l__eb_bib_style_tl{authoryear}
{\__eb_put_biblatex:n {style = gb7714-2015ay}}
}{\__eb_put_biblatex:n {style = \l__eb_bib_otherstyle_tl}}
\tl_if_empty:NF \l__eb_bib_citestyle_tl
{\__eb_put_biblatex:n {citestyle = \l__eb_bib_citestyle_tl}}
\__eb_put_biblatex:n {backend = biber}
}
-\cs_new_protected:Npn \__eb_biblatex_post_set:
+\cs_new_protected:Npn \EbBiblatexPostset
{
\exp_args:NV \addbibresource\l__eb_bib_file_tl
\cs_gset:Npn \blx@default@theheading{bibintoc}
\defbibheading{bibintoc}[\bibname]{\__eb_title_mark_intoc:n {##1}}
\skip_set:Nn \bibitemsep{0ex}
}
-\ctex_at_end_preamble:n
+\__eb_at_end_preamble:n
{
- \bool_if:NTF \l__eb_backend_bibtex_bool
+ \bool_if:NT \l__eb_bib_loadpkg_bool
{
- \RequirePackage[sort&compress]{natbib}
- \__eb_bibtex_set:
- }{
- \__eb_biblatex_pre_set:
- \RequirePackage{biblatex}
- \__eb_biblatex_post_set:
+ \bool_if:NTF \l__eb_backend_bibtex_bool
+ {
+ \RequirePackage[sort&compress]{natbib}
+ \EbBibtexSet
+ }{
+ \EbBiblatexPreset
+ \RequirePackage{biblatex}
+ \EbBiblatexPostset
+ }
}
}
@@ -1295,7 +1344,8 @@
{
\group_begin:
\footnotesize
- \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont
+ \exp_args:Nx
+ \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont
\skip_gset:Nn \footnotesep{\ht\strutbox}
\group_end:
\bool_if:NT \l__eb_chap_withpart_bool
@@ -1313,14 +1363,20 @@
}
\__eb_patch_cmd:Nnn \@footnotetext
{\reset@font}
- {\def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp}\l__eb_font_footnote_tl}
+ {
+ \def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp}
+ \l__eb_font_footnote_tl
+ }
\__eb_patch_cmd:Nnn \@mpfootnotetext
{\reset@font}
- {\def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp}\l__eb_font_footnote_tl}
+ {
+ \def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp}
+ \l__eb_font_footnote_tl
+ }
\__eb_patch_cmd:Nnn \@makefnmark
{\normalfont}{\l__eb_font_footnote_tl}
-\lstdefinestyle{mystyle}
+\lstdefinestyle{easy-lst-sty}
{
language = [LaTeX]TeX,
texcsstyle =
@@ -1365,7 +1421,7 @@
}
\lstset
{
- style = mystyle,
+ style = easy-lst-sty,
breaklines = true,
resetmargins = true,
% numbers = left,
@@ -1422,9 +1478,13 @@
\UrlBreaks{\UrlOrds\__eb_add_urlbreak_points:}
}
\tl_const:Nn \c__eb_urlbreak_points_tl
- {ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789}
+ {
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ
+ abcdefghijklmnopqrstuvwxyz
+ 0123456789
+ }
-\keys_define:nx {ctex/link}
+\__ctex_define:nx {link}
{
hyperlink .choice:,
hyperlink/edge .code:n = {},
@@ -1459,7 +1519,7 @@
}
}
}
-\keys_define:nx {ctex/style}
+\__ctex_define:nx {style}
{
color .choice:,
color .value_required:n = true,
@@ -1481,7 +1541,7 @@
\__eb_allow_urlbreak:
\ctex_hypersetup:n {pdfstartview = FitH}
\exp_args:NV \hypersetup\l__eb_hyperref_clist
- \tl_if_eq:VnTF \l__ctex_scheme_tl{chinese}
+ \tl_if_eq:NnTF \l__ctex_scheme_tl{chinese}
{
\keys_set_known:nn {ctex}
{
@@ -1512,7 +1572,7 @@
\keys_set_known:nn {ctex}
{
abstractname = Abstract,
- lstlistlistingname = List~of~Listings,
+ lstlistlistingname = List~of~Codes,
lstlistingname = Code
}
\crefformat{equation}{#2Equation~(#1)#3}