From bb51b61cfc3fcb367f52d31948039a1468fbcf80 Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Wed, 17 Mar 2021 03:01:06 +0000
Subject: CTAN sync 202103170301

---
 macros/latex/contrib/easybook/easybook.cls | 185 +++++++++++++----------------
 1 file changed, 82 insertions(+), 103 deletions(-)

(limited to 'macros/latex/contrib/easybook/easybook.cls')

diff --git a/macros/latex/contrib/easybook/easybook.cls b/macros/latex/contrib/easybook/easybook.cls
index 4d3c1759ca..97f532796f 100644
--- a/macros/latex/contrib/easybook/easybook.cls
+++ b/macros/latex/contrib/easybook/easybook.cls
@@ -7,9 +7,9 @@
 %% conditions of the CC-BY 4.0 License.
 %% The latest version of this license is in
 %%   https://creativecommons.org/licenses/by/4.0/legalcode
-\NeedsTeXFormat{LaTeX2e}
+\NeedsTeXFormat{LaTeX2e}[2020/10/01]
 \RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/03/15}{1.23r}{}
+\ProvidesExplClass{easybook}{2021/03/16}{1.23s}{}
 
 \cs_generate_variant:Nn \keys_define:nn {nx}
 \cs_generate_variant:Nn \int_to_arabic:n {v}
@@ -29,6 +29,7 @@
 \bool_set_true:N  \l__zhtitle_bool
 \bool_set_true:N  \l__lang_chinese_bool
 \bool_set_true:N  \l__page_twoside_bool
+\bool_set_true:N  \l__class_book_bool
 \clist_new:N      \g__options_clist
 
 \keys_define:nn {easybook}
@@ -68,7 +69,13 @@
         \__put_ctexbook:n {oneside}
       },
 
-    unknown   .code:n =
+    class         .choice:,
+    class         .value_required:n = true,
+    class/book    .code:n = {},
+    class/article .code:n = {\bool_set_false:N \l__class_book_bool},
+    class         .initial:n = book,
+
+    unknown       .code:n =
       {\clist_gput_right:No \g__options_clist{\CurrentOption}}
   }
 
@@ -566,97 +573,82 @@
       {\section*{\phantomsection#1}}
     \__markboth:n {#1}
   }
+\cs_new_protected:Npn \__ifmultoc_pre_set:
+  {
+    \bool_if:NTF \l__class_book_bool
+      {
+        \if@twocolumn
+          \@restonecoltrue
+          \onecolumn
+          \bool_if:NT \l__multoc_bool{\twocolumn}
+        \else
+          \@restonecolfalse
+          \bool_if:NT \l__multoc_bool{\twocolumn}
+        \fi
+      }{\tl_set:Nn \l__toc_type_tl{article}}
+  }
+\cs_new_protected:Npn \__ifmultoc_after_set:
+  {
+    \bool_if:NTF \l__class_book_bool
+      {
+        \if@restonecol
+          \twocolumn
+        \else
+          \onecolumn
+        \fi
+      }{\tl_set:Nn \l__toc_type_tl{article}}
+  }
 \RenewDocumentCommand{\tableofcontents}{o}
   {
     \group_begin:
     \IfValueT {#1}{\keys_set:nn {listoc}{#1}}
-    \if@twocolumn
-      \@restonecoltrue\onecolumn
-      \bool_if:NT \l__multoc_bool{\twocolumn}
-    \else
-      \@restonecolfalse
-      \bool_if:NT \l__multoc_bool{\twocolumn}
-    \fi
+    \__ifmultoc_pre_set:
     \__title_mark:n {\contentsname}
     \vspace*{\dim_use:N \l__toc_offset_dim}
     \@starttoc{toc}
-    \if@restonecol
-      \twocolumn
-    \else
-      \onecolumn
-    \fi
+    \__ifmultoc_after_set:
     \group_end:
   }
 \RenewDocumentCommand{\listoffigures}{so}
   {
     \group_begin:
     \IfValueT {#2}{\keys_set:nn {listoc}{#2}}
-    \if@twocolumn
-      \@restonecoltrue\onecolumn
-      \bool_if:NT \l__multoc_bool{\twocolumn}
-    \else
-      \@restonecolfalse
-      \bool_if:NT \l__multoc_bool{\twocolumn}
-    \fi
+    \__ifmultoc_pre_set:
     \IfBooleanTF {#1}
       {\__title_mark:n {\listfigurename}}
       {\__title_mark_intoc:n {\listfigurename}}
     \dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim
     \vspace*{\dim_use:N \l__toc_offset_dim}
     \@starttoc{lof}
-    \if@restonecol
-      \twocolumn
-    \else
-      \onecolumn
-    \fi
+    \__ifmultoc_after_set:
     \group_end:
   }
 \RenewDocumentCommand{\listoftables}{so}
   {
     \group_begin:
     \IfValueT {#2}{\keys_set:nn {listoc}{#2}}
-    \if@twocolumn
-      \@restonecoltrue\onecolumn
-      \bool_if:NT \l__multoc_bool{\twocolumn}
-    \else
-      \@restonecolfalse
-      \bool_if:NT \l__multoc_bool{\twocolumn}
-    \fi
+    \__ifmultoc_pre_set:
     \IfBooleanTF {#1}
       {\__title_mark:n {\listtablename}}
       {\__title_mark_intoc:n {\listtablename}}
     \dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim
     \vspace*{\dim_use:N \l__toc_offset_dim}
     \@starttoc{lot}
-    \if@restonecol
-      \twocolumn
-    \else
-      \onecolumn
-    \fi
+    \__ifmultoc_after_set:
     \group_end:
   }
 \NewDocumentCommand{\listoflistings}{so}
   {
     \group_begin:
     \IfValueT {#2}{\keys_set:nn {listoc}{#2}}
-    \if@twocolumn
-      \@restonecoltrue\onecolumn
-      \bool_if:NT \l__multoc_bool{\twocolumn}
-    \else
-      \@restonecolfalse
-      \bool_if:NT \l__multoc_bool{\twocolumn}
-    \fi
+    \__ifmultoc_pre_set:
     \IfBooleanTF {#1}
       {\__title_mark:n {\lstlistlistingname}}
       {\__title_mark_intoc:n {\lstlistlistingname}}
     \dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim
     \vspace*{\dim_use:N \l__toc_offset_dim}
     \@starttoc{lol}
-    \if@restonecol
-      \twocolumn
-    \else
-      \onecolumn
-    \fi
+    \__ifmultoc_after_set:
     \group_end:
   }
 
@@ -669,9 +661,9 @@
   ]
 \indexsetup
   {
-    level = \int_compare:nTF {\c@chapter > 0}{\chapter*}{\section*},
-    toclevel = \int_compare:nTF {\c@chapter > 0}{chapter}{section},
-    firstpagestyle = \int_compare:nTF {\c@chapter > 0}{plain}{fancy}
+    level = \bool_if:NTF \l__class_book_bool{\chapter*}{\section*},
+    toclevel = \bool_if:NTF \l__class_book_bool{chapter}{section},
+    firstpagestyle = \bool_if:NTF \l__class_book_bool{plain}{fancy}
   }
 \__patch_cmd:Nnn \imki@indexheaders
   {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}}
@@ -724,49 +716,46 @@
 \captionsetup[figure][bi-second]{name = Figure}
 \captionsetup[table][bi-second]{name = Table}
 \cs_new:Npn \__arabic:n #1{\int_to_arabic:v {c@#1}}
-\AtBeginDocument
+\cs_new_protected:Npn \__separator_set:n #1
   {
-    \cs_new_protected:Npn \__separator_set:n #1
+    \cs_set:cpn {the#1}
       {
-        \cs_set:cpn {the#1}
+        \int_compare:nT {\c@chapter > 0}
           {
-            \int_compare:nT {\c@chapter > 0}
-              {
-                \thechapter
-                \use:c {l__#1_separator_tl}
-              }
-            \__arabic:n {#1}
+            \thechapter
+            \use:c {l__#1_separator_tl}
           }
+        \__arabic:n {#1}
       }
-    \cs_gset:cpn {thesection}
-      {
-        \int_compare:nT {\c@chapter > 0}{\thechapter.}
-        \__arabic:n {section}
-      }
-    \clist_map_inline:nn
-      {{figure},{table},{lstlisting},{equation}}
-      {\__separator_set:n {#1}}
-    \cs_gset_protected:Npn \appendix
+  }
+\cs_gset:cpn {thesection}
+  {
+    \int_compare:nT {\c@chapter > 0}{\thechapter.}
+    \__arabic:n {section}
+  }
+\clist_map_inline:nn
+  {{figure},{table},{lstlisting},{equation}}
+  {\__separator_set:n {#1}}
+\cs_gset_protected:Npn \appendix
+  {
+    \int_compare:nNnTF {\c@chapter} > {0}
       {
-        \int_compare:nNnTF {\c@chapter} > {0}
-          {
-            \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 = {}}
-          }
+        \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}
@@ -1177,13 +1166,7 @@
       {
         \group_begin:
         \IfValueT {##2}{\keys_set:nn {listoc}{##2}}
-        \if@twocolumn
-          \@restonecoltrue\onecolumn
-          \bool_if:NT \l__multoc_bool{\twocolumn}
-        \else
-          \@restonecolfalse
-          \bool_if:NT \l__multoc_bool{\twocolumn}
-        \fi
+        \__ifmultoc_pre_set:
         \cs_set:Npn \bibsection
           {
             \IfBooleanTF {##1}
@@ -1191,11 +1174,7 @@
               {\__title_mark_intoc:n {\bibname}}
           }
         \exp_args:NV \bibliography\l__bib_file_tl
-        \if@restonecol
-          \twocolumn
-        \else
-          \onecolumn
-        \fi
+        \__ifmultoc_after_set:
         \group_end:
       }
   }
-- 
cgit v1.2.3

