summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/easybook/easybook.cls
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-05-06 20:23:02 +0000
committerKarl Berry <karl@freefriends.org>2021-05-06 20:23:02 +0000
commitd7beb28b367a3e13d6af289f0b302f06d8e3f68e (patch)
tree7b9e0c7ff9daa63d4b1ec3b722d51489c852a4be /Master/texmf-dist/tex/latex/easybook/easybook.cls
parentb564ac6302e296f459f60885a711abc04867a9ee (diff)
easybook (6may21)
git-svn-id: svn://tug.org/texlive/trunk@59102 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/easybook/easybook.cls')
-rw-r--r--Master/texmf-dist/tex/latex/easybook/easybook.cls213
1 files changed, 115 insertions, 98 deletions
diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls
index 15509a3cb28..16c271ff01b 100644
--- a/Master/texmf-dist/tex/latex/easybook/easybook.cls
+++ b/Master/texmf-dist/tex/latex/easybook/easybook.cls
@@ -13,7 +13,7 @@
%% https://creativecommons.org/licenses/by/4.0/legalcode
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e,etoolbox}
-\ProvidesExplClass{easybook}{2021/05/04}{1.25a}{beta}
+\ProvidesExplClass{easybook}{2021/05/06}{1.25c}{beta}
\cs_generate_variant:Nn \eb_ctex_define:nn { nx }
\cs_generate_variant:Nn \int_to_arabic:n { v }
@@ -126,8 +126,8 @@
\seq_const_from_clist:Nn \c__eb_options_path_seq
{
- style,link,elsefont,
- spread,bibset,thmset,
+ style,elsefont,spread,
+ refset,bibset,thmset,
geoset,hdrset,tocset
}
\seq_map_inline:Nn \c__eb_options_path_seq
@@ -135,8 +135,10 @@
\ctex_define:n { #1 .meta:nn = { ctex/#1 } {##1} }
\cs_new:cpn {#1} ##1 { \keys_set:nn {ctex/#1} {##1} }
}
+\keys_define:nn { } { ctex/link .inherit:n = ctex/refset }
\ctex_define:n
{
+ link .meta:nn = { ctex/link } {#1},
lstlistlistingname .tl_set:N = \lstlistlistingname,
lstlistingname .tl_set:N = \lstlistingname
}
@@ -235,11 +237,8 @@
}
\cs_new_protected:Npn \eb_font_double_engine_set:n #1
{
- \exp_args:Nc \RenewDocumentCommand {set #1 font}{O{}mO{}}
- {
- \ctex_at_end_preamble:n
- { \use:c { eb_set #1 font:nn }{##2}{##1,##3} }
- }
+ \exp_args:Nc \RenewDocumentCommand {set#1font}{O{}mO{}}
+ {\use:c { eb_set#1font:nn }{##2}{##1,##3}}
}
\seq_const_from_clist:Nn \c__eb_font_reset_family_seq
{ main,sans,mono,CJKmain,CJKsans,CJKmono }
@@ -487,9 +486,7 @@
}
\bool_if:NT \l__eb_compile_draft_bool
{
- \bool_if:NTF \l__eb_page_twoside_bool
- { \easyfoot[C]{\color{SlateGray}\sffamily\today} }
- { \easyhead[C]{\color{SlateGray}\sffamily\today} }
+ \easyfoot[C]{\color{SlateGray}\sffamily\today}
\geometry{showframe}
}
}
@@ -701,16 +698,14 @@
}
}
-\contentsuse{}{bitoc}
+\contentsuse{}{tec}
\cs_set_protected:Npn \CTEX@addbitocline #1#2
{
\group_begin:
- \ctex_set:n
- {
- chapter/name = Chapter\space,
- chapter/number = \arabic{chapter}
- }
- \addcontentsline{bitoc}{#1}
+ \def\CTEX@prechapter{\CTEX@prebichapter}
+ \def\CTEX@thechapter{\CTEX@bichapter@number}
+ \def\CTEX@postchapter{\CTEX@postbichapter}
+ \addcontentsline{tec}{#1}
{\use:c { CTEX@#1@tocline }{#1}{#2}}
\group_end:
}
@@ -718,8 +713,18 @@
{ chapter,section,subsection }
\seq_map_inline:Nn \c__eb_bitoc_title_level_seq
{
- \cs_new_protected:cpn {bi #1} ##1##2
- { \use:c {#1}{##1}\CTEX@addbitocline{#1}{##2} }
+ \exp_args:Nc \NewDocumentCommand {bi#1}{sO{##3}mm}
+ {
+ \IfBooleanTF{##1}
+ {
+ \use:c {#1}*{\phantomsection ##3}
+ \CTEX@addtocline{#1}{##2}
+ \tl_if_empty:oF {##4} { \CTEX@addbitocline{#1}{##4} }
+ }{
+ \use:c {#1}[##2]{##3}
+ \tl_if_empty:oF {##4} { \CTEX@addbitocline{#1}{##4} }
+ }
+ }
}
\eb_appto_cmd:Nn \@chapter
@@ -744,6 +749,7 @@
}
\tl_set:Nn \l__eb_toc_type_tl { book }
+\tl_new:N \eb@bitoc@title
\keys_define:nn { eb/listoc }
{
article .code:n = \tl_set:Nn \l__eb_toc_type_tl { article },
@@ -753,10 +759,10 @@
multoc .initial:n = false,
title .code:n = \eb_assign_toc_title:n {#1}
}
-\NewDocumentCommand \eb_assign_toc_title:n
+\NewDocumentCommand{\eb_assign_toc_title:n}
{>{\SplitArgument{1}{,}}m}
- {\eb_assign_toc_title:nn #1}
-\cs_new_protected:Npn \eb_assign_toc_title:nn #1#2
+ {\eb_assign_toc_title_judge:nn #1}
+\cs_new_protected:Npn \eb_assign_toc_title_judge:nn #1#2
{
\tl_set:Nn \eb@toc@title {#1}
\tl_if_novalue:nTF {#2}
@@ -786,13 +792,11 @@
{
\tl_if_eq:NnTF \l__eb_toc_type_tl { book }
{
- \chapter*{\phantomsection #1}
- \CTEX@addtocline{chapter}{#1}
+ \bichapter*{#1}{\eb@bitoc@title}
\eb@nonumber@markdouble{#1}
}
{
- \section*{\phantomsection #1}
- \CTEX@addtocline{section}{#1}
+ \bisection*{#1}{\eb@bitoc@title}
\bool_if:NTF \l__eb_class_book_bool
{ \eb@nonumber@markright{#1} }
{ \eb@nonumber@markdouble{#1} }
@@ -817,8 +821,8 @@
\IfBooleanTF{#1}
{
\tl_if_eq:NnTF \l__eb_toc_type_tl { book }
- { \chapter{\eb@toc@title} }
- { \section{\eb@toc@title} }
+ { \bichapter{\eb@toc@title}{\eb@bitoc@title} }
+ { \bisection{\eb@toc@title}{\eb@bitoc@title} }
}
{
\IfBooleanTF{#2}
@@ -826,17 +830,11 @@
{ \eb_title_mark_intoc:n {\eb@toc@title} }
}
}
-\cs_new_protected:Npn \eb_class_title_level_bool:n #1
+\cs_new_protected:Npn \eb_biber_title_level_bool:n #1
{
\bool_if:NTF \l__eb_class_book_bool
- {
- \chapter*{\phantomsection #1}
- \CTEX@addtocline{chapter}{#1}
- }
- {
- \section*{\phantomsection #1}
- \CTEX@addtocline{section}{#1}
- }
+ { \bichapter*{#1}{\l__eb_bib_bitoc_title} }
+ { \bisection*{#1}{\l__eb_bib_bitoc_title} }
\eb@nonumber@markdouble{#1}
}
\cs_new_protected:Npn \eb_multoc_pre_bool:
@@ -859,7 +857,7 @@
\bool_if:NT \l__eb_class_book_bool
{ \ifbool{@restonecol}{\twocolumn}{\onecolumn} }
}
-\RenewDocumentCommand{\tableofcontents}{t+o}
+\RenewDocumentCommand{\tableofcontents}{t+oD(){}}
{
\group_begin:
\tl_set_eq:NN \eb@toc@title \contentsname
@@ -868,12 +866,12 @@
\eb_multoc_pre_bool:
\eb_title_mark_notoc:n { \eb@toc@title }
\vspace*{\dim_use:N \l__eb_toc_offset_dim}
- \@starttoc{toc}
+ \@starttoc{toc}#3
\IfBooleanT{#1}
{
\eb_title_mark_notoc:n { \eb@bitoc@title }
\vspace*{\dim_use:N \l__eb_toc_offset_dim}
- \@starttoc{bitoc}
+ \@starttoc{tec}
}
\eb_multoc_post_bool:
\group_end:
@@ -946,6 +944,52 @@
}
}
+\eb_ctex_define:nn { chapter }
+ {
+ biname .code:n =
+ { \ctex_assign_heading_name:nn { bichapter } {#1} },
+ biname .initial:n = Chapter\space,
+ binmuber .tl_set:N = \CTEX@bichapter@number,
+ binmuber .initial:n = \arabic{chapter}
+ }
+\RenewDocumentCommand{\appendix}
+ {O{Appendix\space}D(){\Alph{chapter}}O{}}
+ {
+ \int_compare:nNnTF { \c@chapter } > { 0 }
+ {
+ \ExplSyntaxOn\char_set_catcode_letter:N \@
+ \eb_patch_cmd:Nnn \CTEX@addbitocline
+ {
+ \def\CTEX@prechapter{\CTEX@prebichapter}
+ \def\CTEX@thechapter{\CTEX@bichapter@number}
+ \def\CTEX@postchapter{\CTEX@postbichapter}
+ }
+ {
+ \def\CTEX@prechapter{#1}
+ \def\CTEX@thechapter{#2}
+ \def\CTEX@postchapter{#3}
+ }
+ \ExplSyntaxOff\char_set_catcode_other:N \@
+ \setcounter{chapter}{0}
+ \setcounter{section}{0}
+ \gdef\thechapter{\@Alph\c@chapter}
+ \gdef\CTEX@prechapter{\CTEX@preappendix}
+ \gdef\CTEX@thechapter{\CTEX@appendix@number}
+ \gdef\CTEX@postchapter{\CTEX@postappendix}
+ \gdef\CTEX@chapter@numbering{\CTEX@appendix@numbering}
+ }
+ {
+ \setcounter{section}{0}
+ \setcounter{subsection}{0}
+ \gdef\thesection{\@Alph\c@section}
+ \gdef\CTEX@presection{\CTEX@preappendix}
+ \gdef\CTEX@thesection{\CTEX@appendix@number}
+ \gdef\CTEX@postsection{\CTEX@postappendix}
+ \gdef\CTEX@section@numbering{\CTEX@appendix@numbering}
+ \ctex_set:nn { appendix } { number = \@Alph\c@section,name = { } }
+ }
+ }
+
\tl_new:N \l__eb_font_table_tl
\tl_new:N \l__eb_font_figure_tl
\tl_new:N \l__eb_font_listing_tl
@@ -996,7 +1040,7 @@
\captionsetup[table][bi-second]{name = Table}
}
-\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@ #1 } }
+\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@#1 } }
\cs_gset:cpn { thesection }
{
\int_compare:nNnT { \c@chapter } > { 0 } { \thechapter. }
@@ -1006,7 +1050,7 @@
{ figure,table,lstlisting,equation }
\seq_map_inline:Nn \c__eb_serial_number_counter_seq
{
- \cs_set:cpn { the #1 }
+ \cs_set:cpn { the#1 }
{
\int_compare:nNnT { \c@chapter } > { 0 }
{
@@ -1016,40 +1060,7 @@
\eb_arabic:n {#1}
}
}
-\cs_gset_protected:Npn \appendix
- {
- \int_compare:nNnTF { \c@chapter } > { 0 }
- {
- \ExplSyntaxOn\char_set_catcode_letter:N \@
- \eb_patch_cmd:Nnn \CTEX@addbitocline
- {
- chapter/name = Chapter\space,
- chapter/number = \arabic{chapter}
- }
- {
- chapter/name = Appendix\space,
- chapter/number = \alph{chapter}
- }
- \ExplSyntaxOff\char_set_catcode_other:N \@
- \setcounter{chapter}{0}
- \setcounter{section}{0}
- \gdef\thechapter{\@Alph\c@chapter}
- \gdef\CTEX@prechapter{\CTEX@preappendix}
- \gdef\CTEX@thechapter{\CTEX@appendix@number}
- \gdef\CTEX@postchapter{\CTEX@postappendix}
- \gdef\CTEX@chapter@numbering{\CTEX@appendix@numbering}
- }
- {
- \setcounter{section}{0}
- \setcounter{subsection}{0}
- \gdef\thesection{\@Alph\c@section}
- \gdef\CTEX@presection{\CTEX@preappendix}
- \gdef\CTEX@thesection{\CTEX@appendix@number}
- \gdef\CTEX@postsection{\CTEX@postappendix}
- \gdef\CTEX@section@numbering{\CTEX@appendix@numbering}
- \ctex_set:nn { appendix } { number = \@Alph\c@section,name = { } }
- }
- }
+
\AtBeginEnvironment{tabularx}
{
\exp_args:Nx \linespread { \fp_use:N \l__eb_spread_table_fp }
@@ -1086,8 +1097,11 @@
footnote .initial:n = 1,
spread-all .meta:n =
{
- line = #1,table = #1,math = #1,
- caption = #1,footnote = #1
+ line = #1,
+ table = #1,
+ math = #1,
+ caption = #1,
+ footnote = #1
}
}
@@ -1223,7 +1237,7 @@
\eb_at_end_preamble:n
{
\exp_last_unbraced:No
- \declaretheoremstyle\c__eb_thmtools_keyval_tl{easy-theorem}
+ \declaretheoremstyle{\c__eb_thmtools_keyval_tl}{easy-theorem}
\eb_thmname_set:nnn { exercise } { Exercise } { 练习 }
\cs_undefine:N \proof
\clist_map_inline:nn
@@ -1259,16 +1273,16 @@
}
\sisetup
{
+ detect-shape,
detect-family,
detect-weight,
- detect-shape,
+ table-parse-only,
+ detect-display-math,
detect-inline-family = math,
detect-inline-weight = math,
- detect-display-math,
- table-parse-only,
- range-phrase = \ensuremath{\sim},
- range-units = single,
- group-digits = false
+ range-phrase = \ensuremath{\sim},
+ range-units = single,
+ group-digits = false
}
\allowdisplaybreaks[4]
\tl_gset:Nn \ULthickness { 0.75pt }
@@ -1390,7 +1404,7 @@
}{
\group_begin:
\keys_set:nn { ctex/section } { format += \centering }
- \IfValueT{#6}{\keys_set:nn { ctex/section } {#6}}
+ \IfValueT{#6}{\ctex_set:nn { section } {#6}}
\IfBooleanTF{#1}{\section*{#5}}{\section{#5}}
\group_end:
}#7
@@ -1482,12 +1496,15 @@
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,
+ datafile .tl_set:N = \l__eb_bib_file_tl,
+ datafile .initial:n = refs.bib,
+
+ loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool,
+ loadpkg .default:n = true,
+ loadpkg .initial:n = true,
- bib-loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool,
- bib-loadpkg .default:n = true,
- bib-loadpkg .initial:n = true
+ bitoc-title .tl_set:N = \l__eb_bib_bitoc_title,
+ bitoc-title .initial:n = Reference
}
\cs_new_protected:Npn \EbBibtexSet
@@ -1541,7 +1558,7 @@
\exp_args:NV \addbibresource \l__eb_bib_file_tl
\tl_gset:Nn \blx@default@theheading { bibintoc }
\defbibheading{bibintoc}[\bibname]
- {\eb_class_title_level_bool:n {##1}}
+ {\eb_biber_title_level_bool:n {##1}}
\skip_zero:N \bibitemsep
}
\eb_at_end_preamble:n
@@ -1699,7 +1716,7 @@
}
\bool_set_false:N \l__eb_toc_number_color_bool
-\eb_ctex_define:nn { link }
+\eb_ctex_define:nn { refset }
{
hyperlink .choice:,
hyperlink/edge .code:n = { },
@@ -1736,7 +1753,7 @@
}
}
}
-\eb_ctex_define:nx { link }
+\eb_ctex_define:nx { refset }
{
linkcolor .choice:,
\clist_map_function:nN
@@ -1773,9 +1790,9 @@
\cs_new:Npn \eb_allow_urlbreak:
{
\cs_new:Npn \eb_add_urlbreak_points:
- { \tl_map_function:NN \c__eb_urlbreak_points_tl\do }
- \eb_appto_cmd:Nn
- \UrlBreaks{\UrlOrds\eb_add_urlbreak_points:}
+ { \tl_map_function:NN \c__eb_urlbreak_points_tl \do }
+ \eb_appto_cmd:Nn \UrlBreaks
+ { \UrlOrds\eb_add_urlbreak_points: }
}
\tl_const:Nn \c__eb_urlbreak_points_tl
{