diff options
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/easybook/easybook.dtx | 603 |
1 files changed, 299 insertions, 304 deletions
diff --git a/Master/texmf-dist/source/latex/easybook/easybook.dtx b/Master/texmf-dist/source/latex/easybook/easybook.dtx index c4966338421..bd50a651710 100644 --- a/Master/texmf-dist/source/latex/easybook/easybook.dtx +++ b/Master/texmf-dist/source/latex/easybook/easybook.dtx @@ -54,9 +54,10 @@ The latest version of this license is in % \changes{v1.20}{2021/01/09}{模板更改为使用 CC-BY 许可协议。} % \changes{v1.23}{2021/03/19}{修复在 \pkg{ctex} v2.5.6 更新后 \cls{easybook} 与 \pkg{hyperref} 冲突问题。} % -% \title{\sffamily easybook 书籍文档类} +% \title{\sffamily easybook 文档类手册} % \author{瞿毅} -% \date{2021/04/27\hskip\ccwd\relax v1.24u\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/04/29\hskip\ccwd\relax v1.24w\thanks{\url{https://gitee.com/texl3/easybook}}} +% % \maketitle % \begin{abstract} % \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装。虽然\CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并载入一些常用宏包实现一般的排版需求,它适用于排版中英文书籍或笔记,甚至可稍加调整成为学位论文模板。 @@ -105,17 +106,13 @@ The latest version of this license is in % \end{function} % % \begin{function}[rEXP,added = 2021-01-05]{newline} -% 章标题风格为另起一行,英文模式使用较为常见。类似下面的效果 +% 部分和章标题的样式为另起一行,符合一般英文书籍的习惯。类似下面的效果 % \begin{flushleft}\sffamily\LARGE % Chapter 1\vskip 1.3pc % This is a title % \end{flushleft} % \end{function} % -% \begin{function}[rEXP,added = 2021-01-05]{entitle} -% 部分标题编号由中文数字变为大写罗马数字,章标题编号由中文数字变为阿拉伯数字。比如\textbf{第一部分}变为\textbf{第I部分},\textbf{第一章}变为\textbf{第1章}。 -% \end{function} -% % \begin{function}[rEXP,added = 2021-01-05,updated = 2021-04-08]{scheme} % \begin{syntax} % scheme = <(chinese)|plain> @@ -123,8 +120,8 @@ The latest version of this license is in % \opt{scheme} 代表文档的主题,扩展了此选项在\CTeX 文档类中原有的作用范围,\opt{plain} 选项可使各类标题变为英文形式。包括章节标题、图表标题和定理标题等。如\textbf{第一章}变为\textbf{Chapter 1},\textbf{图1.1} 变为 \textbf{Table 1.1}。 % \end{function} % -% \begin{function}[rEXP,added = 2021-01-05]{enstyle} -% 同时开启 \opt{newline}、\opt{entitle} 和 \opt{scheme = plain} 三个选项以符合英文原生风格。 +% \begin{function}[rEXP,added = 2021-01-05,updated = 2021-04-29]{enmode} +% 同时开启 \opt{newline} 和 \opt{scheme = plain} 选项以符合英文原生风格。 % \end{function} % % \begin{function}[rEXP,added = 2021-01-05,updated = 2021-02-02]{font} @@ -161,18 +158,18 @@ The latest version of this license is in % % \subsection{文档命令} % \label{subsec:document command} -% \begin{function}[added = 2021-02-20,updated = 2021-04-11]{\frontmatter,\mainmatter,\backmatter,\cleardoublepage,\tableofcontents,\listoffigures,\listoftables,\listoflistings} +% \begin{function}[added = 2021-02-20,updated = 2021-04-29]{\frontmatter,\mainmatter,\backmatter,\cleardoublepage,\tableofcontents,\listoffigures,\listoftables,\listoflistings} % \begin{syntax} % \tn{frontmatter*}\oarg{编号格式|(Roman)} % \tn{mainmatter*} % \tn{backmatter} % \tn{cleardoublepage}\oarg{页面风格|(empty)} % \tn{tableofcontents}\oarg{键值列表} -% \tn{listoffigures*}\oarg{键值列表} -% \tn{listoftables*}\oarg{键值列表} -% \tn{listoflistings*}\oarg{键值列表} +% \tn{listoffigures*+}\oarg{键值列表} +% \tn{listoftables*+}\oarg{键值列表} +% \tn{listoflistings*+}\oarg{键值列表} % \end{syntax} -% \tn{frontmatter} 为前言区命令,章标题不编号,页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,带有星号的命令 \tn{frontmatter*} 不使用清双页命令 \tn{cleardoublepage}。\tn{mainmatter} 为主文区命令,章标题正常编号且页码为从1开始计数的阿拉伯数字,\tn{mainmatter*} 命令不使用 \tn{cleardoublepage}。\tn{backmatter} 为后记区命令,页码格式与编号保持不变,章标题不编号。在奇数页使用命令 \tn{cleardoublepage} 时可选参数为下一页多出的空白偶数页的页面风格,默认为 \opt{empty} 即空的页眉页脚。\tn{listoffigures} 命令输出图片目录,\tn{listoftables} 输出表格目录,\tn{listoflistings} 输出代码目录。带有星号的目录命令不会添加进主文档目录中,目录的键值列表选项如下 +% \tn{frontmatter} 为前言区命令,章标题不编号,页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,带有星号的命令 \tn{frontmatter*} 不使用清双页命令 \tn{cleardoublepage}。\tn{mainmatter} 为主文区命令,章标题正常编号且页码为从1开始计数的阿拉伯数字,\tn{mainmatter*} 命令不使用 \tn{cleardoublepage}。\tn{backmatter} 为后记区命令,页码格式与编号保持不变,章标题不编号。在奇数页使用命令 \tn{cleardoublepage} 时可选参数为下一页多出的空白偶数页的页面风格,默认为 \opt{empty} 即空的页眉页脚。\tn{listoffigures} 命令输出图片目录,\tn{listoftables} 输出表格目录,\tn{listoflistings} 输出代码目录。带有星号的目录命令不将标题添加进主文档目录,带有+号的目录命令可以使当前标题编号。目录的键值列表选项如下 % \changes{v1.23}{2021/02/20}{重新定义文档结构划分命令。} % \end{function} % @@ -183,7 +180,7 @@ The latest version of this license is in % \end{syntax} % \opt{multoc} 与 \opt{style/multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同目录是否双栏排版。已经预置了中英文的目录标题,可以使用 \opt{title} 选项更改目录标题的名称。\opt{book} 选项使目录标题按照 \opt{chapter} 级别输出,\opt{article} 选项使目录标题按照 \opt{article} 级别输出,默认为 \opt{chapter} 级别。 % \changes{v1.23}{2021/03/15}{为几个目录增加键值列表的选项,可设置标题输出级别以及是否加入主目录。} -% \changes{v1.24u}{2021/04/04}{目录命令的可选参数增加标题键值。} +% \changes{v1.24w}{2021/04/04}{目录命令的可选参数增加标题键值。} % \end{function} % % \section{接口选项} @@ -266,7 +263,7 @@ The latest version of this license is in % \ding{229} 以上选项路径为 \opt{link/...} \\ % \opt{link} 将超链接选项(包括以上选项)交给 \pkg{hyperref} 处理,除了一些关于 pdf 书签的选项可能会失效,其它由键值选项命令 \tn{hypersetup} 支持的多数选项可用。 % \changes{v1.10}{2021/01/08}{修复了 \opt{linktopage} 选项关闭时目录中标题编号无超链接的问题。} -% \changes{v1.24u}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} +% \changes{v1.24w}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} % \end{function} % % \begin{optdesc} @@ -345,7 +342,7 @@ The latest version of this license is in % \ding{229} 以上选项路径为 \opt{bibset/...} % \changes{v1.21}{2021/01/11}{增加 \opt{bibset} 选项,可以使用 \hologo{BibTeX} 或 \hologo{biber} 编译参考文献。} % \changes{v1.23}{2021/02/23}{使用 \opt{bibset} 选项时可设置标注风格。} -% \changes{v1.24u}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} +% \changes{v1.24w}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} % \end{function} % % \begin{optdesc} @@ -417,7 +414,7 @@ The latest version of this license is in % \end{syntax} % 文档类已预置8个定理环境,环境名及对应的定理标题名见小节 \ref{subsec:theorem},如果需要新的定理标题名或定理样式可使用这两个命令。 % \changes{v1.23}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。} -% \changes{v1.24u}{2021/04/25}{增加定义定理环境命令 \tn{EbNewtheorem}。} +% \changes{v1.24w}{2021/04/25}{增加定义定理环境命令 \tn{EbNewtheorem}。} % \end{function} % % \begin{optdesc} @@ -501,7 +498,7 @@ The latest version of this license is in % \changes{v1.21}{2021/01/13}{增加配置页眉页脚的选项。} % \changes{v1.23}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 标志选项。} % \changes{v1.23}{2021/03/14}{可以手动绘制页眉、页脚和脚注的横线。} -% \changes{v1.24u}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} +% \changes{v1.24w}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-03-14]{\easyhead,\easyfoot} @@ -540,7 +537,7 @@ The latest version of this license is in % % \opt{format} 是目录中标题的格式,可以设置字体和加入垂直间距等,垂直间距最好使用无间距重合的 \tn{addvspace} 命令。\opt{indent} 是目录中标题在页面左侧的缩进距离,应该有长度单位。\opt{rule} 选项中一般应当使用 \tn{tocrule} 命令,将会在接下来介绍。\opt{numsep} 是有编号的标题在目录中编号与标题的间距。 % \changes{v1.21}{2021/01/13}{增加配置目录样式的选项。} -% \changes{v1.24u}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} +% \changes{v1.24w}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-04-20]{\tocrule,\EbNumberline} @@ -579,9 +576,9 @@ The latest version of this license is in % indent-all = <目录标题左边缩进> % \end{syntax} % \ding{229} 以上选项路径为 \opt{tocset/lists/...} 或 \opt{tocset/...} -% \changes{v1.24u}{2021/04/05}{可以设置图、表和代码目录的标签。} -% \changes{v1.24u}{2021/04/06}{增加目录引导线右边对齐方式。} -% \changes{v1.24u}{2021/04/19}{给目录增加 \opt{hang} 样式选项。} +% \changes{v1.24w}{2021/04/05}{可以设置图、表和代码目录的标签。} +% \changes{v1.24w}{2021/04/06}{增加目录引导线右边对齐方式。} +% \changes{v1.24w}{2021/04/19}{给目录增加 \opt{hang} 样式选项。} % \end{function} % % \begin{optdesc} @@ -621,7 +618,7 @@ The latest version of this license is in % \tn{end}\marg{环境名} % \end{syntax} % \pkg{enumitem} 宏包为系统预置的列表环境 \env{enumerate}、\env{itemize}和 \env{description} 提供了更灵活的标签以及间距的控制,可使用 \tn{setlist} 命令设置原有的三种列表格式,也可以直接使用可选参数的键值列表,具体选项见 \pkg{enumitem} 宏包文档。已为三种列表预置了三个级别的格式可相互嵌套,默认标签与 \cls{book} 文档类相同,若自定义标签可例如 -% \changes{v1.24u}{2021/04/08}{重新优化列表环境的配置。} +% \changes{v1.24w}{2021/04/08}{重新优化列表环境的配置。} % \end{function} % % \begin{ctexexam} @@ -677,7 +674,7 @@ The latest version of this license is in % \label{subsec:exercise} % \begin{function}[added = 2021-01-05,updated = 2021-04-19]{exercise} % \begin{syntax} -% \tn{begin}\marg{exercise}*+\oarg{颜色名|(LightBlue)}\oarg{编号|(1.)}\parg{标题|(习题)}\oarg{配置选项}\oarg{序言} +% \tn{begin}\marg{exercise}*+\oarg{颜色名|(LightSkyBlue)}\oarg{编号|(1.)}\parg{标题|(习题)}\oarg{配置选项}\oarg{序言} % \ \tn{item} <习题内容> % \tn{end}\marg{exercise} % \end{syntax} @@ -688,7 +685,7 @@ The latest version of this license is in % \end{function} % % \begin{ctexexam} -% \begin{exercise}+[LightBlue][1.](习题) +% \begin{exercise}+[LightSkyBlue][1.](习题) % \item 习题内容 % \item 习题内容 % \end{exercise} @@ -740,7 +737,7 @@ The latest version of this license is in % \tn{end}\marg{ebparbox} % \end{syntax} % 环境 \env{ebparbox} 与 \env{easybox} 类似,同样带有三个可选参数。当使用星号参数时盒子左边带有一条竖线,\meta{颜色名} 选项可以自定义竖线颜色,使用不带有星号的环境则盒子带有竖线颜色的浅色背景。\meta{段落标题} 选项可以设置标题,默认无标题。 -% \changes{v1.24u}{2021/04/19}{优化盒子环境的选项,增加可带有标题的扁平盒子 \env{ebparbox}。} +% \changes{v1.24w}{2021/04/19}{优化盒子环境的选项,增加可带有标题的扁平盒子 \env{ebparbox}。} % \end{function} % % \subsubsection{行内盒子} @@ -799,14 +796,14 @@ The latest version of this license is in % \tn{labelformat}\marg{计数器}\marg{标签引用格式} % \end{syntax} % 使用 \tn{ref} 命令进行引用将会自动检测环境并添加相应的前缀,\tn{labelformat} 可以设置标签引用格式,第二个参数中\#1代表 \tn{the}\meta{计数器},可以设置引用序号的前缀和后缀。 -% \changes{v1.24u}{2021/04/11}{取消载入 \pkg{cleveref} 宏包来交叉引用。} +% \changes{v1.24w}{2021/04/11}{取消载入 \pkg{cleveref} 宏包来交叉引用。} % \end{function} % % \subsubsection{索引} -% \begin{function}[added = 2021-01-05]{\index,\printindex} +% \begin{function}[added = 2021-04-29]{\index,\printindex} % \begin{syntax} % \tn{index}\marg{标签} -% \tn{printindex}\oarg{索引名} +% \tn{printindex}\parg{索引名}\oarg{标题名} % \end{syntax} % \pkg{imakeidx} 宏包可使用索引的功能,\tn{printindex} 命令用于生成索引目录。仅做了简单的设置如将索引设为双栏并加入目录,其他选项可另外配置。 % \end{function} @@ -871,6 +868,9 @@ The latest version of this license is in % \pkg{ulem} 宏包提供了多种下划线命令,下划线的粗细由命令 \tn{ULthickness} 控制,重新定义它需要使用 \tn{renewcommand} 命令。下划线的深度由 \tn{ULdepth} 控制,默认值 \tn{maxdimen} 是一个允许深度根据当前字体变化的特殊标志,当然也可以使用 \tn{setlength} 设定特定深度。 % \end{function} % +% \subsection{封面} +% 目前仍然使用由 \tn{maketitle} 命令生成的标准 \cls{book} 文档类的封面,并未做任何改动。可以自行设计或用其它软件制作封面,也可以使用热心网友 nangeng 已经为 \cls{easybook} 制作的\href{https://gitee.com/texl3/easybook/issues/I3NXVQ}{一个封面}。 +% % \section{载入的宏包} % 以下为 \cls{easybook} 直接调用的关键宏包,带有 \ding{75} 符号的宏包并未载入它们,仅做了预配置和兼容性处理,可根据需要在导言区手动载入以实现相关的功能。 % \begin{description} @@ -909,27 +909,27 @@ The latest version of this license is in %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplClass{easybook}{2021/04/27}{1.24u}{beta} +\ProvidesExplClass{easybook}{2021/04/29}{1.24w}{beta} -\cs_generate_variant:Nn \__ctex_define:nn {nx} +\cs_generate_variant:Nn \eb_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} -\cs_new_protected:Npn \__ctex_define:nn #1 +\cs_generate_variant:Nn \eb_put_hyperref:n {x} +\cs_new_protected:Npn \eb_ctex_define:nn #1 {\keys_define:nn {ctex/#1}} -\cs_new_protected:Npn \__eb_put_ctexbook:n #1 +\cs_new_protected:Npn \eb_put_ctexbook:n #1 {\PassOptionsToClass{#1}{ctexbook}} -\cs_new_protected:Npn \__eb_patch_cmd:Nnn #1#2#3 +\cs_new_protected:Npn \eb_patch_cmd:Nnn #1#2#3 {\ctex_patch_cmd_once:NnnnTF #1{}{#2}{#3}{}{\ctex_patch_failure:N #1}} -\cs_new_protected:Npn \__eb_appto_cmd:Nn #1#2 +\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 +\cs_new_protected:Npn \eb_at_end_preamble:n {\ctex_gadd_ltxhook:nn {env/document/before}} +\cs_gset_eq:NN \PackageWarning\use_none:nn -\bool_set_false:N \l__eb_draft_bool -\bool_set_false:N \l__eb_newline_bool +\bool_set_false:N \l__eb_compile_draft_bool +\bool_set_false:N \l__eb_title_newline_bool \bool_set_false:N \l__eb_font_noto_bool -\bool_set_true:N \l__eb_zhtitle_bool \bool_set_true:N \l__eb_page_twoside_bool \bool_set_true:N \l__eb_class_book_bool \tl_new:N \g__eb_config_tl @@ -937,22 +937,21 @@ The latest version of this license is in \keys_define:nn {easybook} { - draft .code:n = \bool_set_true:N \l__eb_draft_bool, - newline .code:n = \bool_set_true:N \l__eb_newline_bool, - entitle .code:n = \bool_set_false:N \l__eb_zhtitle_bool, - scheme .code:n = \__eb_put_ctexbook:n {scheme = #1}, - enstyle .meta:n = {newline,entitle,scheme = plain}, + draft .code:n = \bool_set_true:N \l__eb_compile_draft_bool, + newline .code:n = \bool_set_true:N \l__eb_title_newline_bool, + scheme .code:n = \eb_put_ctexbook:n {scheme = #1}, + enmode .meta:n = {newline,scheme = plain}, font .choices:nn = {adobe,founder,mac,windows,none} - {\__eb_put_ctexbook:n {fontset = \l_keys_choice_tl}}, + {\eb_put_ctexbook:n {fontset = \l_keys_choice_tl}}, font/noto .code:n = { \bool_set_true:N \l__eb_font_noto_bool - \__eb_put_ctexbook:n {fontset = none} + \eb_put_ctexbook:n {fontset = none} }, font/overleaf .code:n = {}, - font/linux .code:n = \__eb_put_ctexbook:n {fontset = ubuntu}, + font/linux .code:n = \eb_put_ctexbook:n {fontset = ubuntu}, font .value_required:n = true, font .initial:n = overleaf, @@ -966,12 +965,12 @@ The latest version of this license is in oneside .code:n = { \bool_set_false:N \l__eb_page_twoside_bool - \__eb_put_ctexbook:n {oneside} + \eb_put_ctexbook:n {oneside} }, twoside .code:n = { \bool_set_true:N \l__eb_page_twoside_bool - \__eb_put_ctexbook:n {twoside} + \eb_put_ctexbook:n {twoside} }, class .choice:, @@ -1005,7 +1004,7 @@ The latest version of this license is in {no-math}{fontspec}, {noto,upint}{newtxmath} }{\PassOptionsToPackage#1} -\__eb_put_ctexbook:n {\g__eb_options_clist} +\eb_put_ctexbook:n {\g__eb_options_clist} \LoadClass[UTF8]{ctexbook} \bool_new:N \l__eb_multoc_bool @@ -1030,7 +1029,7 @@ The latest version of this license is in lstlistlistingname .tl_set:N = \lstlistlistingname, lstlistingname .tl_set:N = \lstlistingname } -\__ctex_define:nn {style} +\eb_ctex_define:nn {style} { multoc .bool_set:N = \l__eb_multoc_bool, multoc .default:n = true, @@ -1089,7 +1088,7 @@ The latest version of this license is in {\file_input:n {\g__eb_config_tl}} } -\cs_new_protected:Npn \__eb_package_later_bool:nn #1#2 +\cs_new_protected:Npn \eb_package_later_bool:nn #1#2 { \@ifpackagelater{#1}{#2} {}{\msg_warning:nnn {easybook}{package-old}{#1}} @@ -1109,96 +1108,96 @@ The latest version of this license is in {ctex}{2020/10/19}, {thmtools}{2020/08/01}, {caption-light}{2020/08/24} - }{\__eb_package_later_bool:nn #1} + }{\eb_package_later_bool:nn #1} \sys_if_engine_xetex:TF { - \cs_new_eq:NN \__eb_set_family:nnn \xeCJK_set_family:nnn - \cs_new_eq:NN \__eb_switch_family:n \xeCJK_switch_family:n + \cs_new_eq:NN \eb_set_family:nnn \xeCJK_set_family:nnn + \cs_new_eq:NN \eb_switch_family:n \xeCJK_switch_family:n }{ - \cs_new_eq:NN \__eb_set_family:nnn \ctex_ltj_set_family:nnn - \cs_new_eq:NN \__eb_switch_family:n \ctex_ltj_switch_family:n + \cs_new_eq:NN \eb_set_family:nnn \ctex_ltj_set_family:nnn + \cs_new_eq:NN \eb_switch_family:n \ctex_ltj_switch_family:n } -\cs_new_protected:Npn \__eb_setmainfont:nn #1#2 +\cs_new_protected:Npn \eb_setmainfont:nn #1#2 {\__fontspec_main_setmainfont:nn {#2}{#1}} -\cs_new_protected:Npn \__eb_setsansfont:nn #1#2 +\cs_new_protected:Npn \eb_setsansfont:nn #1#2 {\__fontspec_main_setsansfont:nn {#2}{#1}} -\cs_new_protected:Npn \__eb_setmonofont:nn #1#2 +\cs_new_protected:Npn \eb_setmonofont:nn #1#2 {\__fontspec_main_setmonofont:nn {#2}{#1}} -\cs_new_protected:Npn \__eb_setCJKmainfont:nn #1#2 - {\__eb_set_family:nnn {\CJKrmdefault}{#2}{#1}} -\cs_new_protected:Npn \__eb_setCJKsansfont:nn #1#2 - {\__eb_set_family:nnn {\CJKsfdefault}{#2}{#1}} -\cs_new_protected:Npn \__eb_setCJKmonofont:nn #1#2 - {\__eb_set_family:nnn {\CJKttdefault}{#2}{#1}} -\cs_new_protected:Npn \__eb_set_zhfont_songti:nn #1#2 - {\__eb_set_family:nnn {songti}{#2}{#1}} -\cs_new_protected:Npn \__eb_set_zhfont_heiti:nn #1#2 - {\__eb_set_family:nnn {heiti}{#2}{#1}} -\cs_new_protected:Npn \__eb_set_zhfont_kaishu:nn #1#2 - {\__eb_set_family:nnn {kaishu}{#2}{#1}} -\cs_new_protected:Npn \__eb_set_zhfont_fangsong:nn #1#2 - {\__eb_set_family:nnn {fangsong}{#2}{#1}} - -\tl_const:Nn \__eb_option_zhfont_tl +\cs_new_protected:Npn \eb_setCJKmainfont:nn #1#2 + {\eb_set_family:nnn {\CJKrmdefault}{#2}{#1}} +\cs_new_protected:Npn \eb_setCJKsansfont:nn #1#2 + {\eb_set_family:nnn {\CJKsfdefault}{#2}{#1}} +\cs_new_protected:Npn \eb_setCJKmonofont:nn #1#2 + {\eb_set_family:nnn {\CJKttdefault}{#2}{#1}} +\cs_new_protected:Npn \eb_set_zhfont_songti:nn #1#2 + {\eb_set_family:nnn {songti}{#2}{#1}} +\cs_new_protected:Npn \eb_set_zhfont_heiti:nn #1#2 + {\eb_set_family:nnn {heiti}{#2}{#1}} +\cs_new_protected:Npn \eb_set_zhfont_kaishu:nn #1#2 + {\eb_set_family:nnn {kaishu}{#2}{#1}} +\cs_new_protected:Npn \eb_set_zhfont_fangsong:nn #1#2 + {\eb_set_family:nnn {fangsong}{#2}{#1}} + +\tl_const:Nn \eb_option_zhfont_tl {UprightFont = *,AutoFakeBold = 1.5,ItalicFont = *} -\cs_new_protected:Npx \__eb_setCJKmainfont:n #1 - {\__eb_setCJKmainfont:nn {#1}{\__eb_option_zhfont_tl}} -\cs_new_protected:Npx \__eb_setCJKsansfont:n #1 - {\__eb_setCJKsansfont:nn {#1}{\__eb_option_zhfont_tl}} -\cs_new_protected:Npx \__eb_setCJKmonofont:n #1 - {\__eb_setCJKmonofont:nn {#1}{\__eb_option_zhfont_tl}} -\cs_new_protected:Npx \__eb_set_zhfont_songti:n #1 - {\__eb_set_zhfont_songti:nn {#1}{\__eb_option_zhfont_tl}} -\cs_new_protected:Npx \__eb_set_zhfont_heiti:n #1 - {\__eb_set_zhfont_heiti:nn {#1}{\__eb_option_zhfont_tl}} -\cs_new_protected:Npx \__eb_set_zhfont_kaishu:n #1 - {\__eb_set_zhfont_kaishu:nn {#1}{\__eb_option_zhfont_tl}} -\cs_new_protected:Npx \__eb_set_zhfont_fangsong:n #1 - {\__eb_set_zhfont_fangsong:nn {#1}{\__eb_option_zhfont_tl}} +\cs_new_protected:Npx \eb_setCJKmainfont:n #1 + {\eb_setCJKmainfont:nn {#1}{\eb_option_zhfont_tl}} +\cs_new_protected:Npx \eb_setCJKsansfont:n #1 + {\eb_setCJKsansfont:nn {#1}{\eb_option_zhfont_tl}} +\cs_new_protected:Npx \eb_setCJKmonofont:n #1 + {\eb_setCJKmonofont:nn {#1}{\eb_option_zhfont_tl}} +\cs_new_protected:Npx \eb_set_zhfont_songti:n #1 + {\eb_set_zhfont_songti:nn {#1}{\eb_option_zhfont_tl}} +\cs_new_protected:Npx \eb_set_zhfont_heiti:n #1 + {\eb_set_zhfont_heiti:nn {#1}{\eb_option_zhfont_tl}} +\cs_new_protected:Npx \eb_set_zhfont_kaishu:n #1 + {\eb_set_zhfont_kaishu:nn {#1}{\eb_option_zhfont_tl}} +\cs_new_protected:Npx \eb_set_zhfont_fangsong:n #1 + {\eb_set_zhfont_fangsong:nn {#1}{\eb_option_zhfont_tl}} \bool_if:NT \l__eb_font_noto_bool { - \__eb_setmainfont:nn {NotoSerif} + \eb_setmainfont:nn {NotoSerif} { Extension = .ttf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic } - \__eb_setsansfont:nn {NotoSans} + \eb_setsansfont:nn {NotoSans} { Extension = .ttf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic } - \__eb_setmonofont:nn {NotoSansMono} + \eb_setmonofont:nn {NotoSansMono} { Extension = .ttf, UprightFont = *-Regular, BoldFont = *-Bold } - \__eb_setCJKmainfont:nn {FZShuSong-Z01S} + \eb_setCJKmainfont:nn {FZShuSong-Z01S} { UprightFont = *, BoldFont = FZHei-B01S, ItalicFont = FZKai-Z03S } - \__eb_setCJKsansfont:n {FZHei-B01S} - \__eb_setCJKmonofont:n {FZFangSong-Z02S} - \__eb_set_zhfont_songti:n {FZShuSong-Z01S} - \__eb_set_zhfont_heiti:n {FZHei-B01S} - \__eb_set_zhfont_kaishu:n {FZKai-Z03S} - \__eb_set_zhfont_fangsong:n {FZFangSong-Z02S} - \cs_new_protected:Npn \songti{\__eb_switch_family:n {songti}} - \cs_new_protected:Npn \heiti{\__eb_switch_family:n {heiti}} - \cs_new_protected:Npn \kaishu{\__eb_switch_family:n {kaishu}} - \cs_new_protected:Npn \fangsong{\__eb_switch_family:n {fangsong}} - } -\__eb_at_end_preamble:n - {\cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\normalfont}} + \eb_setCJKsansfont:n {FZHei-B01S} + \eb_setCJKmonofont:n {FZFangSong-Z02S} + \eb_set_zhfont_songti:n {FZShuSong-Z01S} + \eb_set_zhfont_heiti:n {FZHei-B01S} + \eb_set_zhfont_kaishu:n {FZKai-Z03S} + \eb_set_zhfont_fangsong:n {FZFangSong-Z02S} + \cs_new_protected:Npn \songti{\eb_switch_family:n {songti}} + \cs_new_protected:Npn \heiti{\eb_switch_family:n {heiti}} + \cs_new_protected:Npn \kaishu{\eb_switch_family:n {kaishu}} + \cs_new_protected:Npn \fangsong{\eb_switch_family:n {fangsong}} + } +\eb_at_end_preamble:n + {\cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\itshape}} \includepdfset{fitpaper = true} \geometry @@ -1214,7 +1213,7 @@ The latest version of this license is in marginparwidth = 2.54cm } \clist_new:N \g__eb_geometry_clist -\__ctex_define:nn {geoset} +\eb_ctex_define:nn {geoset} { footnotemargin .dim_set:N = \footnotemargin, footnotemargin .initial:n = 0.5\ccwd, @@ -1244,18 +1243,18 @@ The latest version of this license is in \RenewDocumentCommand{\frontmatter}{sO{Roman}} { \IfBooleanTF{#1}{\clearpage}{\cleardoublepage} - \@mainmatterfalse + \boolfalse{@mainmatter} \pagenumbering{#2} } \RenewDocumentCommand{\mainmatter}{s} { \IfBooleanTF{#1}{\clearpage}{\cleardoublepage} - \@mainmattertrue + \booltrue{@mainmatter} \pagenumbering{arabic} } \cs_gset_eq:NN \easyhead\fancyhead \cs_gset_eq:NN \easyfoot\fancyfoot -\__ctex_define:nn {hdrset} +\eb_ctex_define:nn {hdrset} { head-foot .tl_set:N = \l__eb_fancyhf_content_tl, head-foot .initial:n = @@ -1271,36 +1270,34 @@ The latest version of this license is in } }, - chap-mark .cs_set:Np = \__eb_fancyhf_chap_mark:n #1, + chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, chap-mark .initial:n = { \int_compare:nT {\c@secnumdepth > -1} { - \if@mainmatter - \ifodd\CTEX@chapter@numbering - \CTEXthechapter\hspace{\ccwd} - \fi - \fi + \ifbool{@mainmatter} + { + \int_if_odd:nT {\CTEX@chapter@numbering} + {\CTEXthechapter\hspace{\ccwd}} + }{} }#1 }, - sec-mark .cs_set:Np = \__eb_fancyhf_sec_mark:n #1, + sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, sec-mark .initial:n = { \int_compare:nT {\c@secnumdepth > 0} { - \ifodd\CTEX@section@numbering - \CTEXthesection\hspace{0.5\ccwd} - \fi + \int_if_odd:nT {\CTEX@section@numbering} + {\CTEXthesection\hspace{0.5\ccwd}} }#1 }, - subsec-mark .cs_set:Np = \__eb_fancyhf_subsec_mark:n #1, + subsec-mark .cs_set:Np = \eb_fancyhf_subsection_mark:n #1, subsec-mark .initial:n = { \int_compare:nT {\c@secnumdepth > 1} { - \ifodd\CTEX@subsection@numbering - \CTEXthesubsection\hspace{0.5\ccwd} - \fi + \int_if_odd:nT {\CTEX@subsection@numbering} + {\CTEXthesubsection\hspace{0.5\ccwd}} }#1 }, @@ -1324,21 +1321,22 @@ The latest version of this license is in \group_end: } } -\cs_new:Npn \__eb_upper_chaptermark_bool:n #1 - { - \bool_if:NT \l__eb_uppercase_bool - {\text_uppercase:n}{\__eb_fancyhf_chap_mark:n {#1}} - } -\cs_new:Npn \__eb_upper_sectionmark_bool:n #1 +\cs_new:Npn \eb_upper_number_mark_bool:nn #1#2 { \bool_if:NT \l__eb_uppercase_bool - {\text_uppercase:n}{\__eb_fancyhf_sec_mark:n {#1}} + {\text_uppercase:n}{\use:c {eb_fancyhf_#1_mark:n}{#2}} } -\cs_new:Npn \__eb_upper_subsectionmark_bool:n #1 +\cs_new:Npn \eb@number@markdouble#1#2 { - \bool_if:NT \l__eb_uppercase_bool - {\text_uppercase:n}{\__eb_fancyhf_subsec_mark:n {#1}} + \markboth + {\eb_upper_number_mark_bool:nn {#1}{#2}} + { + \bool_if:NT \l__eb_page_twoside_bool + {\eb_upper_number_mark_bool:nn {#1}{#2}} + } } +\cs_new:Npn \eb@number@markright#1#2 + {\markright{\eb_upper_number_mark_bool:nn {#1}{#2}}} \ctex_at_end_preamble:n { \exp_args:NV \geometry\g__eb_geometry_clist @@ -1349,30 +1347,16 @@ The latest version of this license is in \bool_if:NTF \l__eb_class_book_bool { \cs_gset:Npn \chaptermark#1 - { - \markboth - {\__eb_upper_chaptermark_bool:n {#1}} - { - \bool_if:NT \l__eb_page_twoside_bool - {\__eb_upper_chaptermark_bool:n {#1}} - } - } + {\eb@number@markdouble{chapter}{#1}} \cs_gset:Npn \sectionmark#1 - {\markright{\__eb_upper_sectionmark_bool:n {#1}}} + {\eb@number@markright{section}{#1}} }{ \cs_gset:Npn \sectionmark#1 - { - \markboth - {\__eb_upper_sectionmark_bool:n {#1}} - { - \bool_if:NT \l__eb_page_twoside_bool - {\__eb_upper_sectionmark_bool:n {#1}} - } - } + {\eb@number@markdouble{section}{#1}} \cs_gset:Npn \subsectionmark#1 - {\markright{\__eb_upper_subsectionmark_bool:n {#1}}} + {\eb@number@markright{subsection}{#1}} } - \bool_if:NT \l__eb_draft_bool + \bool_if:NT \l__eb_compile_draft_bool { \bool_if:NTF \l__eb_page_twoside_bool {\easyfoot[C]{\color{SlateGray}\sffamily\today}} @@ -1386,7 +1370,7 @@ The latest version of this license is in \seq_map_inline:Nn \c__eb_toc_headings_level_seq { \ctex_define:n {tocset/#1 .meta:nn = {ctex/tocset/#1}{##1}} - \__ctex_define:nn {tocset} + \eb_ctex_define:nn {tocset} { #1/format .tl_set:c = l__eb_toc_#1_format_tl, #1/indent .tl_set:c = l__eb_toc_#1_indent_tl, @@ -1403,8 +1387,8 @@ The latest version of this license is in \hspace{\use:c {eb@toc@#1@numsep}} }{} } -\newtoggle{eb@titletoc@hang@fix} -\__ctex_define:nn {tocset} +\newbool{eb@titletoc@hang@fix} +\eb_ctex_define:nn {tocset} { lists/lolskip .skip_set:N = \l__eb_toc_lolskip_skip, lists/lolskip .initial:n = 0.8pc, @@ -1418,22 +1402,22 @@ The latest version of this license is in tocline-fig .initial:n = { \figurename\space#1 - \iftoggle{eb@titletoc@hang@fix}{} - {\hspace{\eb@toc@lists@numsep}} + \notbool{eb@titletoc@hang@fix} + {\hspace{\eb@toc@lists@numsep}}{} }, tocline-tab .cs_set:Np = \eb@labelname@lot#1, tocline-tab .initial:n = { \tablename\space#1 - \iftoggle{eb@titletoc@hang@fix}{} - {\hspace{\eb@toc@lists@numsep}} + \notbool{eb@titletoc@hang@fix} + {\hspace{\eb@toc@lists@numsep}}{} }, tocline-lst .tl_set:N = \eb@labelname@lol, tocline-lst .initial:n = { \lstlistingname\space\thelstlisting - \iftoggle{eb@titletoc@hang@fix}{} - {\hspace{\eb@toc@lists@numsep}} + \notbool{eb@titletoc@hang@fix} + {\hspace{\eb@toc@lists@numsep}}{} }, line-align .bool_set:N = \l__eb_toc_line_align_bool, line-align .default:n = true, @@ -1442,7 +1426,7 @@ The latest version of this license is in hang .choice:, hang/true .code:n = { - \toggletrue{eb@titletoc@hang@fix} + \booltrue{eb@titletoc@hang@fix} \ctex_set:n { chapter/tocline = \CTEXnumberline{##1}##2, @@ -1498,7 +1482,8 @@ The latest version of this license is in section/numsep = \ccwd, subsection/format = \addvspace{0.35pc}, - subsection/indent = 3.8\ccwd, + subsection/indent = + {\bool_if:NTF \l__eb_class_book_bool{3.8\ccwd}{1.4\ccwd}}, subsection/rule = \tocrule{$\cdot$}, subsection/numsep = \ccwd, @@ -1519,17 +1504,18 @@ The latest version of this license is in {\contentspage}{\thecontentspage} } } -\cs_new_protected:Npn \__eb_titlecontents_set:nn #1#2 +\cs_new_protected:Npn \eb_titlecontents_set:nn #1#2 { \titlecontents{#1} [\use:c {l__eb_toc_#2_indent_tl}] {\use:c {l__eb_toc_#2_format_tl}} { - \iftoggle{eb@titletoc@hang@fix} + \ifbool{eb@titletoc@hang@fix} { \contentspush { - \bool_if:NT \l__eb_toc_color_bool{\color{ctex@toc}} + \bool_if:NT \l__eb_toc_number_color_bool + {\color{ctex@toc@number}} \thecontentslabel \hspace{\use:c {eb@toc@#2@numsep}} } @@ -1547,7 +1533,7 @@ The latest version of this license is in {figure}{lists}, {table}{lists}, {lstlisting}{lists} - }{\__eb_titlecontents_set:nn #1} + }{\eb_titlecontents_set:nn #1} \prop_new:N \l__eb_label_name_prop \prop_set_from_keyval:Nn \l__eb_label_name_prop @@ -1559,8 +1545,8 @@ The latest version of this license is in { \addcontentsline{#1}{#2} { - \iftoggle{eb@titletoc@hang@fix}{\protect\numberline}{} - {\prop_item:Nn \l__eb_label_name_prop{#2}{#3}}{#4} + \ifbool{eb@titletoc@hang@fix}{\protect\numberline}{} + {\prop_item:Nn \l__eb_label_name_prop{#2}{#3}}{#4} } } \ctex_patch_cmd:Nnn \lst@MakeCaption @@ -1570,12 +1556,12 @@ The latest version of this license is in }{ \addcontentsline{lol}{lstlisting} { - \iftoggle{eb@titletoc@hang@fix}{\protect\numberline}{} - {\eb@labelname@lol}\lst@@caption + \ifbool{eb@titletoc@hang@fix}{\protect\numberline}{} + {\eb@labelname@lol}\lst@@caption } } -\__eb_appto_cmd:Nn \@chapter +\eb_appto_cmd:Nn \@chapter { \skip_if_eq:nnF {\l__eb_toc_lolskip_skip}{\c_zero_skip} { @@ -1585,7 +1571,7 @@ The latest version of this license is in \bool_if:NF \l__eb_class_book_bool {\msg_error:nn {easybook}{no-chapter}} } -\__eb_appto_cmd:Nn \@schapter +\eb_appto_cmd:Nn \@schapter { \bool_if:NF \l__eb_class_book_bool {\msg_error:nn {easybook}{no-chapter}} @@ -1596,23 +1582,23 @@ The latest version of this license is in The~\string\chapter\space~command~will~not~be~used. } -\cs_new_protected:Npn \__eb_uppercase_bool:n #1 +\cs_new:Npn \eb_upper_nonumber_mark_bool:n #1 { \bool_if:NTF \l__eb_uppercase_bool {\text_uppercase:n {#1}} {\text_titlecase_first:n {#1}} } -\cs_new_protected:Npn \eb@nonumber@markdouble#1 +\cs_new:Npn \eb@nonumber@markdouble#1 { \markboth - {\__eb_uppercase_bool:n {#1}} + {\eb_upper_nonumber_mark_bool:n {#1}} { \bool_if:NT \l__eb_page_twoside_bool - {\__eb_uppercase_bool:n {#1}} + {\eb_upper_nonumber_mark_bool:n {#1}} } } -\cs_new_protected:Npn \eb@nonumber@markright#1 - {\markright{\__eb_uppercase_bool:n {#1}}} +\cs_new:Npn \eb@nonumber@markright#1 + {\markright{\eb_upper_nonumber_mark_bool:n {#1}}} \tl_set:Nn \l__eb_toc_type_tl{book} \keys_define:nn {listoc} @@ -1625,7 +1611,7 @@ The latest version of this license is in title .tl_set:N = \eb@toc@title } -\cs_new_protected:Npn \__eb_title_mark_intoc:n #1 +\cs_new_protected:Npn \eb_title_mark_intoc:n #1 { \tl_if_eq:NnTF \l__eb_toc_type_tl{book} { @@ -1640,7 +1626,7 @@ The latest version of this license is in {\eb@nonumber@markdouble{#1}} } } -\cs_new_protected:Npn \__eb_title_mark_notoc:n #1 +\cs_new_protected:Npn \eb_title_mark_notoc:n #1 { \tl_if_eq:NnTF \l__eb_toc_type_tl{book} { @@ -1653,7 +1639,20 @@ The latest version of this license is in {\eb@nonumber@markdouble{#1}} } } -\cs_new_protected:Npn \__eb_class_title_bool:n #1 +\cs_new_protected:Npn \eb_title_intoc_bool:nn #1#2 + { + \IfBooleanTF{#1} + { + \tl_if_eq:NnTF \l__eb_toc_type_tl{book} + {\chapter{\eb@toc@title}} + {\section{\eb@toc@title}} + }{ + \IfBooleanTF{#2} + {\eb_title_mark_notoc:n {\eb@toc@title}} + {\eb_title_mark_intoc:n {\eb@toc@title}} + } + } +\cs_new_protected:Npn \eb_class_title_bool:n #1 { \bool_if:NTF \l__eb_class_book_bool { @@ -1665,85 +1664,74 @@ The latest version of this license is in } \eb@nonumber@markdouble{#1} } -\cs_new_protected:Npn \__eb_multoc_pre_bool: - { - \bool_if:NTF \l__eb_class_book_bool - { - \if@twocolumn - \@restonecoltrue - \bool_if:NTF \l__eb_multoc_bool{\twocolumn}{\onecolumn} - \else - \@restonecolfalse - \bool_if:NT \l__eb_multoc_bool{\twocolumn} - \fi - }{\tl_set:Nn \l__eb_toc_type_tl{article}} - } -\cs_new_protected:Npn \__eb_multoc_post_bool: +\cs_new_protected:Npn \eb_multoc_pre_bool: { \bool_if:NTF \l__eb_class_book_bool { - \if@restonecol - \twocolumn - \else - \onecolumn - \fi + \ifbool{@twocolumn} + { + \booltrue{@restonecol} + \bool_if:NTF \l__eb_multoc_bool{\twocolumn}{\onecolumn} + }{ + \boolfalse{@restonecol} + \bool_if:NT \l__eb_multoc_bool{\twocolumn} + } }{\tl_set:Nn \l__eb_toc_type_tl{article}} } -\cs_new_protected:Npn \__eb_title_intoc_bool:n #1 +\cs_new_protected:Npn \eb_multoc_post_bool: { - \IfBooleanTF{#1} - {\__eb_title_mark_notoc:n {\eb@toc@title}} - {\__eb_title_mark_intoc:n {\eb@toc@title}} + \bool_if:NT \l__eb_class_book_bool + {\ifbool{@restonecol}{\twocolumn}{\onecolumn}} } \RenewDocumentCommand{\tableofcontents}{o} { \group_begin: \tl_set_eq:NN \eb@toc@title\contentsname \IfValueT{#1}{\keys_set:nn {listoc}{#1}} - \__eb_multoc_pre_bool: - \__eb_title_mark_notoc:n {\eb@toc@title} + \eb_multoc_pre_bool: + \eb_title_mark_notoc:n {\eb@toc@title} \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{toc} - \__eb_multoc_post_bool: + \eb_multoc_post_bool: \group_end: } -\RenewDocumentCommand{\listoffigures}{so} +\RenewDocumentCommand{\listoffigures}{st+o} { \group_begin: \tl_set_eq:NN \eb@toc@title\listfigurename - \IfValueT{#2}{\keys_set:nn {listoc}{#2}} - \__eb_multoc_pre_bool: - \__eb_title_intoc_bool:n {#1} + \IfValueT{#3}{\keys_set:nn {listoc}{#3}} + \eb_multoc_pre_bool: + \eb_title_intoc_bool:nn {#2}{#1} \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listsoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lof} - \__eb_multoc_post_bool: + \eb_multoc_post_bool: \group_end: } -\RenewDocumentCommand{\listoftables}{so} +\RenewDocumentCommand{\listoftables}{st+o} { \group_begin: \tl_set_eq:NN \eb@toc@title\listtablename - \IfValueT{#2}{\keys_set:nn {listoc}{#2}} - \__eb_multoc_pre_bool: - \__eb_title_intoc_bool:n {#1} + \IfValueT{#3}{\keys_set:nn {listoc}{#3}} + \eb_multoc_pre_bool: + \eb_title_intoc_bool:nn {#2}{#1} \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listsoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lot} - \__eb_multoc_post_bool: + \eb_multoc_post_bool: \group_end: } -\NewDocumentCommand{\listoflistings}{so} +\NewDocumentCommand{\listoflistings}{st+o} { \group_begin: \tl_set_eq:NN \eb@toc@title\lstlistlistingname - \IfValueT{#2}{\keys_set:nn {listoc}{#2}} - \__eb_multoc_pre_bool: - \__eb_title_intoc_bool:n {#1} + \IfValueT{#3}{\keys_set:nn {listoc}{#3}} + \eb_multoc_pre_bool: + \eb_title_intoc_bool:nn {#2}{#1} \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listsoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lol} - \__eb_multoc_post_bool: + \eb_multoc_post_bool: \group_end: } @@ -1751,6 +1739,7 @@ The latest version of this license is in { \makeindex[ intoc, + title = \eb@toc@title, options = -M~texindy~-C~utf8, program = truexindy, columns = 2, @@ -1765,6 +1754,14 @@ The latest version of this license is in \ctex_patch_cmd:Nnn \imki@indexheaders {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} {\eb@nonumber@markdouble{\indexname}} + \RenewDocumentCommand{\printindex} + {D(){\imki@jobname}O{\imki@indexname}} + { + \group_begin: + \tl_set:Nn \eb@toc@title{#2} + \imki@putindex{#1} + \group_end: + } } \tl_new:N \l__eb_font_table_tl @@ -1772,7 +1769,7 @@ The latest version of this license is in \tl_new:N \l__eb_font_listing_tl \tl_new:N \l__eb_font_footnote_tl -\__ctex_define:nn {elsefont} +\eb_ctex_define:nn {elsefont} { table-cap .tl_set:N = \l__eb_font_table_tl, table-cap .initial:n = \sffamily\small, @@ -1816,8 +1813,8 @@ The latest version of this license is in \captionsetup[figure][bi-second]{name = Figure} \captionsetup[table][bi-second]{name = Table} } -\cs_new:Npn \__eb_arabic:n #1{\int_to_arabic:v {c@#1}} -\cs_new_protected:Npn \__eb_separator_set:n #1 +\cs_new:Npn \eb_arabic:n #1{\int_to_arabic:v {c@#1}} +\cs_new_protected:Npn \eb_separator_set:n #1 { \cs_set:cpn {the#1} { @@ -1826,17 +1823,17 @@ The latest version of this license is in \thechapter \use:c {l__eb_#1_separator_tl} } - \__eb_arabic:n {#1} + \eb_arabic:n {#1} } } \cs_gset:cpn {thesection} { \int_compare:nT {\c@chapter > 0}{\thechapter.} - \__eb_arabic:n {section} + \eb_arabic:n {section} } \clist_map_inline:nn {figure,table,lstlisting,equation} - {\__eb_separator_set:n {#1}} + {\eb_separator_set:n {#1}} \cs_gset_protected:Npn \appendix { \int_compare:nNnTF {\c@chapter} > {0} @@ -1881,7 +1878,7 @@ The latest version of this license is in \fp_new:N \l__eb_spread_caption_fp \fp_new:N \l__eb_spread_footnote_fp -\__ctex_define:nn {spread} +\eb_ctex_define:nn {spread} { line .fp_set:N = \l__eb_spread_line_fp, line .initial:n = 1.3, @@ -1920,7 +1917,7 @@ The latest version of this license is in \graphicspath{{figures/}} \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} -\cs_new_protected:Npn \__eb_enumitem_labelval_set:nn #1#2 +\cs_new_protected:Npn \eb_enumitem_labelval_set:nn #1#2 {\SetEnumitemValue{label}{#1}{\color{ctex@emph}#2}} \clist_map_inline:nn { @@ -1931,7 +1928,7 @@ The latest version of this license is in {alph}{(\alph*)}, {roman}{\roman*.}, {outline}{\upshape\ding{111}} - }{\__eb_enumitem_labelval_set:nn #1} + }{\eb_enumitem_labelval_set:nn #1} \SetEnumitemValue{font}{sf}{\color{ctex@emph}\normalfont\sffamily} \setlist { @@ -1950,7 +1947,7 @@ The latest version of this license is in \setlist*[enumerate,3]{labelwidth = *} \setlist[description]{font = sf,labelwidth = *,leftmargin = 2\ccwd} -\cs_new_protected:Npn \__eb_thmname_set:nnn #1#2#3 +\cs_new_protected:Npn \eb_thmname_set:nnn #1#2#3 { \tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} {\tl_const:cn {c__eb_name_#1_tl}{#3}} @@ -1961,7 +1958,7 @@ The latest version of this license is in { \ctex_at_end_preamble:n { - \__eb_thmname_set:nnn {#1}{#2}{#3} + \eb_thmname_set:nnn {#1}{#2}{#3} \exp_args:No \declaretheorem@i { name = \use:c {c__eb_name_#1_tl}, @@ -1987,7 +1984,7 @@ The latest version of this license is in \RenewDocumentCommand{\newtheorem}{O{}m} {\AfterPreamble{\declaretheorem[#1]{#2}}} -\__ctex_define:nn {thmset} +\eb_ctex_define:nn {thmset} { thmbox .bool_set:N = \l__eb_thmbox_bool, thmbox .default:n = true, @@ -2027,11 +2024,11 @@ The latest version of this license is in headformat = \NAME\space\NUMBER\NOTE ] } -\__eb_at_end_preamble:n +\eb_at_end_preamble:n { \exp_last_unbraced:No \declaretheoremstyle\c__eb_thmtools_keyval_tl{easy-theorem} - \__eb_thmname_set:nnn {exercise}{Exercise}{练习} + \eb_thmname_set:nnn {exercise}{Exercise}{练习} \cs_undefine:N \proof \clist_map_inline:nn { @@ -2094,16 +2091,16 @@ The latest version of this license is in cases,cases*,dcases,dcases*,rcases,rcases*,drcases,drcases*, aligned,alignedat,gathered,multlined,lgathered,rgathered }{\l__eb_math_restore:n {#1}} -\__eb_patch_cmd:Nnn \start@gather +\eb_patch_cmd:Nnn \start@gather {\collect@body} {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} -\__eb_patch_cmd:Nnn \start@align +\eb_patch_cmd:Nnn \start@align {\collect@body} {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} -\__eb_patch_cmd:Nnn \start@multline +\eb_patch_cmd:Nnn \start@multline {\collect@body} {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} -\__eb_patch_cmd:Nnn \gather@split +\eb_patch_cmd:Nnn \gather@split {\spread@equation} {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\spread@equation} \ctex_after_end_preamble:n @@ -2120,7 +2117,7 @@ The latest version of this license is in \ctex_at_end_package:nn {tcolorbox} { - \__eb_package_later_bool:nn {tcolorbox}{2020/10/09} + \eb_package_later_bool:nn {tcolorbox}{2020/10/09} \tcbset { tc-theorem/.style = @@ -2251,7 +2248,7 @@ The latest version of this license is in \tl_new:N \l__eb_bib_citestyle_tl \tl_new:N \l__eb_bib_file_tl -\__ctex_define:nn {bibset} +\eb_ctex_define:nn {bibset} { backend .choice:, backend/bibtex .code:n = {}, @@ -2300,42 +2297,41 @@ The latest version of this license is in \tl_if_empty:NF \l__eb_bib_citestyle_tl {\exp_args:NV \setcitestyle\l__eb_bib_citestyle_tl} \skip_set:Nn \bibsep{0ex} - \NewDocumentCommand{\printbibliography}{so} + \NewDocumentCommand{\printbibliography}{st+o} { \group_begin: \tl_set_eq:NN \eb@toc@title\bibname - \IfValueT{##2}{\keys_set:nn {listoc}{##2}} - \__eb_multoc_pre_bool: - \cs_set:Npn \bibsection{\__eb_title_intoc_bool:n {##1}} + \IfValueT{##3}{\keys_set:nn {listoc}{##3}} + \eb_multoc_pre_bool: + \cs_set:Npn \bibsection{\eb_title_intoc_bool:nn {##2}{##1}} \exp_args:NV \bibliography\l__eb_bib_file_tl - \__eb_multoc_post_bool: + \eb_multoc_post_bool: \group_end: } } -\cs_new_protected:Npn \__eb_put_biblatex:n #1 +\cs_new_protected:Npn \eb_put_biblatex:n #1 {\PassOptionsToPackage{#1}{biblatex}} \cs_new_protected:Npn \EbBiblatexPreset { \tl_if_empty:NTF \l__eb_bib_otherstyle_tl { \tl_if_eq:NnT \l__eb_bib_style_tl{numerical} - {\__eb_put_biblatex:n {style = gb7714-2015}} + {\eb_put_biblatex:n {style = gb7714-2015}} \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}} + {\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} + {\eb_put_biblatex:n {citestyle = \l__eb_bib_citestyle_tl}} + \eb_put_biblatex:n {backend = biber} } \cs_new_protected:Npn \EbBiblatexPostset { \exp_args:NV \addbibresource\l__eb_bib_file_tl \cs_gset:Npn \blx@default@theheading{bibintoc} - \cs_gset:Npn \blx@warning@noline##1{} - \defbibheading{bibintoc}[\bibname]{\__eb_class_title_bool:n {##1}} + \defbibheading{bibintoc}[\bibname]{\eb_class_title_bool:n {##1}} \skip_set:Nn \bibitemsep{0ex} } -\__eb_at_end_preamble:n +\eb_at_end_preamble:n { \bool_if:NT \l__eb_bib_loadpkg_bool { @@ -2351,7 +2347,7 @@ The latest version of this license is in } } -\__eb_at_end_preamble:n +\eb_at_end_preamble:n { \group_begin: \footnotesize @@ -2372,21 +2368,21 @@ The latest version of this license is in \counterwithin*{footnote}{page} } } -\__eb_patch_cmd:Nnn \@footnotetext +\eb_patch_cmd:Nnn \@footnotetext {\reset@font} { \linespread{\fp_use:N \l__eb_spread_footnote_fp} \selectfont\ignorespaces \l__eb_font_footnote_tl } -\__eb_patch_cmd:Nnn \@mpfootnotetext +\eb_patch_cmd:Nnn \@mpfootnotetext {\reset@font} { \linespread{\fp_use:N \l__eb_spread_footnote_fp} \selectfont\ignorespaces \l__eb_font_footnote_tl } -\__eb_patch_cmd:Nnn \@makefnmark +\eb_patch_cmd:Nnn \@makefnmark {\normalfont}{\l__eb_font_footnote_tl} \cs_gset:Npn \thempfootnote{\int_to_alph:n {\c@mpfootnote}} @@ -2451,25 +2447,25 @@ The latest version of this license is in \lstloadlanguages{C,C++,Java,Python,Matlab} \clist_new:N \l__eb_hyperref_clist -\cs_new_protected:Npn \__eb_put_hyperref:n #1 +\cs_new_protected:Npn \eb_put_hyperref:n #1 {\clist_put_right:Nn \l__eb_hyperref_clist{#1}} -\cs_new_protected:Npn \__eb_define_linkcolor:nnn #1#2#3 +\cs_new_protected:Npn \eb_define_linkcolor:nnn #1#2#3 {\definecolorset{HTML}{ctex@}{}{link,#1;url,#2;cite,#3}} -\cs_new_protected:Npn \__eb_define_themecolor:nnn #1#2#3 +\cs_new_protected:Npn \eb_define_themecolor:nnn #1#2#3 {\definecolorset{HTML}{ctex@}{}{frame,#1;emph,#2;verb,#3}} -\cs_new_protected:Npn \__eb_define_linkcolor:n #1 +\cs_new_protected:Npn \eb_define_linkcolor:n #1 {\definecolorset{HTML}{ctex@}{}{link,#1;url,#1;cite,#1}} -\cs_new_protected:Npn \__eb_define_themecolor:n #1 +\cs_new_protected:Npn \eb_define_themecolor:n #1 {\definecolorset{HTML}{ctex@}{}{frame,#1;emph,#1;verb,#1}} -\cs_new:Npn \__eb_linkcolor_set:n #1 +\cs_new:Npn \eb_linkcolor_set:n #1 { linkcolor/\clist_item:nn {#1}{1} .code:n = { - \__eb_define_linkcolor:nnn + \eb_define_linkcolor:nnn {\clist_item:nn {#1}{2}} {\clist_item:nn {#1}{3}} {\clist_item:nn {#1}{4}} - \__eb_put_hyperref:n + \eb_put_hyperref:n { linkcolor = ctex@link,linkbordercolor = ctex@link, urlcolor = ctex@url,urlbordercolor = ctex@url, @@ -2477,27 +2473,27 @@ The latest version of this license is in } }, } -\cs_new:Npn \__eb_themecolor_set:n #1 +\cs_new:Npn \eb_themecolor_set:n #1 { color/\clist_item:nn {#1}{1} .code:n = { - \__eb_define_themecolor:nnn + \eb_define_themecolor:nnn {\clist_item:nn {#1}{2}} {\clist_item:nn {#1}{3}} {\clist_item:nn {#1}{4}} }, } -\bool_set_false:N \l__eb_toc_color_bool -\__ctex_define:nn {link} +\bool_set_false:N \l__eb_toc_number_color_bool +\eb_ctex_define:nn {link} { hyperlink .choice:, hyperlink/edge .code:n = {}, - hyperlink/none .code:n = \__eb_put_hyperref:n {hidelinks}, + hyperlink/none .code:n = \eb_put_hyperref:n {hidelinks}, hyperlink/various .code:n = { - \bool_set_true:N \l__eb_toc_color_bool - \__eb_put_hyperref:n {colorlinks} + \bool_set_true:N \l__eb_toc_number_color_bool + \eb_put_hyperref:n {colorlinks} }, hyperlink .default:n = edge, hyperlink .initial:n = edge, @@ -2505,25 +2501,25 @@ The latest version of this license is in linktoc .choice:, linktoc/unknown .code:n = { - \__eb_put_hyperref:n {linktoc = #1} + \eb_put_hyperref:n {linktoc = #1} \clist_map_inline:nn {page,none} { \tl_if_eq:NnT \l_keys_value_tl{##1} - {\clist_map_break:n {\colorlet{ctex@toc}{black}}} + {\clist_map_break:n {\colorlet{ctex@toc@number}{black}}} } }, linktoc .default:n = all, linktoc .initial:n = all, unknown .code:n = { - \__eb_put_hyperref:x + \eb_put_hyperref:x { \l_keys_key_str \tl_if_empty:NF \l_keys_value_tl{ = {#1}} } } } -\__ctex_define:nx {link} +\eb_ctex_define:nx {link} { linkcolor .choice:, \clist_map_function:nN @@ -2533,14 +2529,14 @@ The latest version of this license is in {navyblue, 000080,004986,eb6877}, {crimson, dc143c,00c1c9,afcd20} } - \__eb_linkcolor_set:n + \eb_linkcolor_set:n linkcolor .default:n = navyblue, linkcolor .initial:n = navyblue, linkcol-all .code:n = - {\__eb_define_linkcolor:n {\exp_not:n {#1}}} + {\eb_define_linkcolor:n {\exp_not:n {#1}}} } -\colorlet{ctex@toc}{ctex@link} -\__ctex_define:nx {style} +\colorlet{ctex@toc@number}{ctex@link} +\eb_ctex_define:nx {style} { color .choice:, color .value_required:n = true, @@ -2551,18 +2547,18 @@ The latest version of this license is in {energy, f39800,00a0e9,893895}, {cyberpunk, 601986,eb6877,a4005b} } - \__eb_themecolor_set:n + \eb_themecolor_set:n color .initial:n = none, color-all .code:n = - {\__eb_define_themecolor:n {\exp_not:n {#1}}} + {\eb_define_themecolor:n {\exp_not:n {#1}}} } -\cs_new:Npn \__eb_allow_urlbreak: +\cs_new:Npn \eb_allow_urlbreak: { - \cs_new:Npn \__eb_add_urlbreak_points: + \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:} + \eb_appto_cmd:Nn + \UrlBreaks{\UrlOrds\eb_add_urlbreak_points:} } \tl_const:Nn \c__eb_urlbreak_points_tl { @@ -2574,7 +2570,7 @@ The latest version of this license is in { \RequirePackage{hyperref} \urlstyle{same} - \__eb_allow_urlbreak: + \eb_allow_urlbreak: \ctex_hypersetup:n {pdfstartview = FitH} \exp_args:NV \hypersetup\l__eb_hyperref_clist \labelformat{part}{\CTEXthepart} @@ -2618,30 +2614,29 @@ The latest version of this license is in \ctex_set:n { secnumdepth = 3, - tocdepth = 1, + tocdepth = \bool_if:NTF \l__eb_class_book_bool{1}{2}, part = { pagestyle = empty, - number = - {\bool_if:NTF \l__eb_zhtitle_bool{\chinese{part}}{\thepart}}, format = \color{ctex@frame}\sffamily\Huge, aftername = - {\bool_if:NTF \l__eb_newline_bool{\par\nobreak}{\hspace{\ccwd}}}, + { + \bool_if:NTF \l__eb_title_newline_bool + {\par\nobreak}{\hspace{\ccwd}} + }, tocline = \CTEXifname{\CTEXthepart\hspace{\eb@toc@part@numsep}}{}#2 }, chapter = { % pagestyle = fancy, - number = - {\bool_if:NTF \l__eb_zhtitle_bool{\chinese{chapter}}{\thechapter}}, format = { \color{ctex@frame}\sffamily\LARGE - \bool_if:NF \l__eb_newline_bool{\centering} + \bool_if:NF \l__eb_title_newline_bool{\centering} }, aftername = { - \bool_if:NTF \l__eb_newline_bool + \bool_if:NTF \l__eb_title_newline_bool {\par\nobreak\vskip 1.5pc}{\hspace{\ccwd}} }, beforeskip = -1.5ex, @@ -2675,7 +2670,7 @@ The latest version of this license is in } } -\bool_if:NF \l__eb_newline_bool +\bool_if:NF \l__eb_title_newline_bool { \ctex_set:n { |