From da715730531f001dace300e3c81578d20d93e5b9 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 3 May 2021 21:12:19 +0000 Subject: easybook (3may21) git-svn-id: svn://tug.org/texlive/trunk@59068 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/easybook/chapter1.tex | 2 +- .../doc/latex/easybook/easybook-demo.pdf | Bin 266713 -> 266824 bytes .../doc/latex/easybook/easybook-demo.tex | 92 +- Master/texmf-dist/doc/latex/easybook/easybook.pdf | Bin 467289 -> 467542 bytes .../texmf-dist/source/latex/easybook/easybook.dtx | 1557 ++++++++++---------- Master/texmf-dist/tex/latex/easybook/easybook.cls | 1519 +++++++++---------- 6 files changed, 1622 insertions(+), 1548 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/easybook/chapter1.tex b/Master/texmf-dist/doc/latex/easybook/chapter1.tex index eee32163074..11d793de889 100644 --- a/Master/texmf-dist/doc/latex/easybook/chapter1.tex +++ b/Master/texmf-dist/doc/latex/easybook/chapter1.tex @@ -2,7 +2,7 @@ \chapter{多彩盒子} -\begin{outline} +\begin{outline}[leftmargin = *] \index{zhaiyao@摘要盒子} \item \zhlipsum*[68][name = zhufu] \item \zhlipsum*[68][name = zhufu] diff --git a/Master/texmf-dist/doc/latex/easybook/easybook-demo.pdf b/Master/texmf-dist/doc/latex/easybook/easybook-demo.pdf index 67b4ed55645..0aa9c117dad 100644 Binary files a/Master/texmf-dist/doc/latex/easybook/easybook-demo.pdf and b/Master/texmf-dist/doc/latex/easybook/easybook-demo.pdf differ diff --git a/Master/texmf-dist/doc/latex/easybook/easybook-demo.tex b/Master/texmf-dist/doc/latex/easybook/easybook-demo.tex index c1fed9f9f51..d37e662e63a 100644 --- a/Master/texmf-dist/doc/latex/easybook/easybook-demo.tex +++ b/Master/texmf-dist/doc/latex/easybook/easybook-demo.tex @@ -1,9 +1,9 @@ \documentclass[ - class = book, - scheme = chinese, - zihao = -4, - font = noto, - paper = a4paper, + class = book, + scheme = chinese, + zihao = -4, + font = noto, + paper = a4paper, openany ]{easybook} @@ -11,56 +11,56 @@ { style = { - color = seaside, - % color-all = 009393, - % multoc = true, - % withpart = true, - footwith = page, - notomath = true, - rulewidth = 0.75pt, - % uppercase = false, - number-sep = {.} + color = seaside, + % color-all = 009393, + % multoc = true, + % withpart = true, + footwith = page, + notomath = true, + rulewidth = 0.75pt, + % uppercase = false, + number-sep = {.} }, link = { hyperlink = various, linkcolor = navyblue, - linktoc = all + linktoc = all }, spread = { - line = 1.355, - table = 1.05, - math = 1.05, - caption = 1, - footnote = 1 + line = 1.355, + table = 1.05, + math = 1.05, + caption = 1, + footnote = 1 }, elsefont = { - table-cap = \sffamily\zihao{5}, - figure-cap = \sffamily\zihao{5}, + table-cap = \sffamily\zihao{5}, + figure-cap = \sffamily\zihao{5}, listing-cap = \sffamily\zihao{5}, - footnote = \rmfamily, - marginpar = \sffamily\zihao{-5} + footnote = \rmfamily, + marginpar = \sffamily\zihao{-5} }, thmset = { - thmbox = true, - within = chapter, - bodyfont = \normalfont, + thmbox = true, + within = chapter, + bodyfont = \normalfont, headpunct = {.} }, geoset = { - vmargin = {2.54cm,2.54cm}, - hmargin = 3.17cm, - headheight = 2.04cm, - headsep = 0.5cm, + vmargin = {2.54cm,2.54cm}, + hmargin = 3.17cm, + headheight = 2.04cm, + headsep = 0.5cm, ignorefoot }, hdrset = { - % headrule = {}, + % headrule = {}, head-foot = { \easyhead[EC]{\color{DarkOrchid}\kaishu\leftmark} @@ -70,30 +70,30 @@ }, tocset = { - hang = false, - line-align = true, - numsep-all = \ccwd, - part = + hang = false, + line-align = true, + numsep-all = \ccwd, + part = { - format += \large, - indent = 0\ccwd, - rule = \tocrule{}[\bfseries] + format += \large, + indent = 0\ccwd, + rule = \tocrule{}[\bfseries] }, chapter = { - format = \addvspace{1pc}\sffamily\large, - indent = 0\ccwd, - rule = \tocrule[0.7pc](1.2){$\cdot$}[\bfseries] + format = \addvspace{1pc}\sffamily\large, + indent = 0\ccwd, + rule = \tocrule[0.7pc](1.2){$\cdot$}[\bfseries] } }, bibset = { bib-loadpkg = true, - backend = bibtex, - bib-style = numerical + backend = bibtex, + bib-style = numerical }, % secnumdepth = 2, - % tocdepth = 2 + % tocdepth = 2 } \usepackage{lipsum,zhlipsum,bicaption,tasks,tcolorbox,imakeidx} @@ -106,7 +106,7 @@ \url{https://latexstudio.net} \\ \url{https://gitee.com/texl3/easybook}\thanks{Gitee为项目的主要发布地址。} } -\date{2021/05/01\hskip\ccwd\relax v1.24y} +\date{2021/05/02\hskip\ccwd\relax v1.24z} \frontmatter[roman] \maketitle diff --git a/Master/texmf-dist/doc/latex/easybook/easybook.pdf b/Master/texmf-dist/doc/latex/easybook/easybook.pdf index 5bd31156672..04f3b5c5838 100644 Binary files a/Master/texmf-dist/doc/latex/easybook/easybook.pdf and b/Master/texmf-dist/doc/latex/easybook/easybook.pdf differ diff --git a/Master/texmf-dist/source/latex/easybook/easybook.dtx b/Master/texmf-dist/source/latex/easybook/easybook.dtx index 7a4ecaeec70..73f3c1ead7b 100644 --- a/Master/texmf-dist/source/latex/easybook/easybook.dtx +++ b/Master/texmf-dist/source/latex/easybook/easybook.dtx @@ -56,7 +56,7 @@ The latest version of this license is in % % \title{\sffamily easybook 文档类手册} % \author{瞿毅} -% \date{2021/05/01\hskip\ccwd\relax v1.24y\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/05/02\hskip\ccwd\relax v1.24z\thanks{\url{https://gitee.com/texl3/easybook}}} % % \maketitle % \begin{abstract} @@ -180,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.24y}{2021/04/04}{目录命令的可选参数增加标题键值。} +% \changes{v1.24z}{2021/04/04}{目录命令的可选参数增加标题键值。} % \end{function} % % \section{接口选项} @@ -263,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.24y}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} +% \changes{v1.24z}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} % \end{function} % % \begin{optdesc} @@ -342,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.24y}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} +% \changes{v1.24z}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} % \end{function} % % \begin{optdesc} @@ -414,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.24y}{2021/04/25}{增加定义定理环境命令 \tn{EbNewtheorem}。} +% \changes{v1.24z}{2021/04/25}{增加定义定理环境命令 \tn{EbNewtheorem}。} % \end{function} % % \begin{optdesc} @@ -498,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.24y}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} +% \changes{v1.24z}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-03-14]{\easyhead,\easyfoot} @@ -538,7 +538,7 @@ The latest version of this license is in % % \opt{format} 是目录中标题的格式,可以设置字体和加入垂直间距等,垂直间距最好使用无间距重合的 \tn{addvspace} 命令,带有加号的 \opt{format+} 选项用于在已有的格式命令后附加内容。\opt{indent} 是目录中标题在页面左侧的缩进距离,应该有长度单位。\opt{rule} 选项中一般应当使用 \tn{tocrule} 命令,将会在接下来介绍。\opt{numsep} 是有编号的标题在目录中编号与标题的间距。 % \changes{v1.21}{2021/01/13}{增加配置目录样式的选项。} -% \changes{v1.24y}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} +% \changes{v1.24z}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-04-20]{\tocrule,\EbNumberline} @@ -578,10 +578,10 @@ The latest version of this license is in % rule-all = <目录引导线样式> % \end{syntax} % \ding{229} 以上选项路径为 \opt{tocset/list/...} 或 \opt{tocset/...} -% \changes{v1.24y}{2021/04/05}{可以设置图、表和代码目录的标签。} -% \changes{v1.24y}{2021/04/06}{增加目录引导线右边对齐方式。} -% \changes{v1.24y}{2021/04/19}{给目录增加 \opt{hang} 样式选项。} -% \changes{v1.24y}{2021/05/01}{给目录增加 \opt{format+} 和 \opt{rule-all} 选项。} +% \changes{v1.24z}{2021/04/05}{可以设置图、表和代码目录的标签。} +% \changes{v1.24z}{2021/04/06}{增加目录引导线右边对齐方式。} +% \changes{v1.24z}{2021/04/19}{给目录增加 \opt{hang} 样式选项。} +% \changes{v1.24z}{2021/05/01}{给目录增加 \opt{format+} 和 \opt{rule-all} 选项。} % \end{function} % % \begin{optdesc} @@ -623,7 +623,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.24y}{2021/04/08}{重新优化列表环境的配置。} +% \changes{v1.24z}{2021/04/08}{重新优化列表环境的配置。} % \end{function} % % \begin{ctexexam} @@ -701,17 +701,17 @@ The latest version of this license is in % 使用盒子以及小节 \ref{subsec:exercise} 中的 \env{exercise} 环境需要在导言区\textbf{手动载入} \pkg{tcolorbox} 宏包,它们的配置键值列表选项同样由 \pkg{tcolorbox} 提供支持,具体选项可见宏包文档的 Option Keys 一节,可以进行边距、字体及背景颜色等各种个性化设置,一些配置会覆盖之前预置的设置。 % % \subsubsection{摘要盒子} -% \begin{function}[added = 2021-01-05,updated = 2021-03-19]{outline} +% \begin{function}[added = 2021-01-05,updated = 2021-05-02]{outline} % \begin{syntax} -% \tn{begin}\marg{outline}\parg{标题名称}\oarg{配置选项} +% \tn{begin}\marg{outline}\oarg{列表配置选项}\parg{标题名称}\oarg{盒子配置选项} % \ \tn{item} <摘要内容> % \tn{end}\marg{outline} % \end{syntax} -% 摘要盒子可用于章前摘要,它的标题是可选参数,默认标题是摘要。 +% 摘要盒子可用于章前摘要,它的标题是可选参数,默认标题是摘要。列表配置选项与 \pkg{enumitem} 宏包中列表的选项相同,可以设置摘要条目的各种距离。 % \end{function} % % \begin{ctexexam} -% \begin{outline}(标题名称) +% \begin{outline}[leftmargin = *](标题名称) % \item 摘要内容 % \item 摘要内容 % \end{outline} @@ -742,7 +742,7 @@ The latest version of this license is in % \tn{end}\marg{ebparbox} % \end{syntax} % 环境 \env{ebparbox} 与 \env{easybox} 类似,同样带有三个可选参数。当使用星号参数时盒子左边带有一条竖线,\meta{颜色名} 选项可以自定义竖线颜色,使用不带有星号的环境则盒子带有竖线颜色的浅色背景。\meta{段落标题} 选项可以设置标题,默认无标题。 -% \changes{v1.24y}{2021/04/19}{优化盒子环境的选项,增加可带有标题的扁平盒子 \env{ebparbox}。} +% \changes{v1.24z}{2021/04/19}{优化盒子环境的选项,增加可带有标题的扁平盒子 \env{ebparbox}。} % \end{function} % % \subsubsection{行内盒子} @@ -801,7 +801,7 @@ The latest version of this license is in % \tn{labelformat}\marg{计数器}\marg{标签引用格式} % \end{syntax} % 使用 \tn{ref} 命令进行引用将会自动检测环境并添加相应的前缀,\tn{labelformat} 可以设置标签引用格式,第二个参数中\#1代表 \tn{the}\meta{计数器},可以设置引用序号的前缀和后缀。 -% \changes{v1.24y}{2021/04/11}{取消载入 \pkg{cleveref} 宏包来交叉引用。} +% \changes{v1.24z}{2021/04/11}{取消载入 \pkg{cleveref} 宏包来交叉引用。} % \end{function} % % \subsubsection{索引} @@ -811,7 +811,7 @@ The latest version of this license is in % \tn{printindex*+}\parg{索引名}\oarg{键值列表} % \end{syntax} % \pkg{imakeidx} 宏包可使用索引的功能,重新定义了它的 \tn{printindex} 命令用于生成索引目录,键值列表及用法与小节 \ref{subsec:document command} 相同,但 \opt{multoc} 选项和 \pkg{imakeidx} 原本的接口命令 \tn{indexsetup} 部分选项失效。仅做了简单的设置如将索引设为双栏并加入目录,其他选项可另外配置。 -% \changes{v1.24y}{2021/05/01}{重新定义 \tn{printindex} 命令与文档适配。} +% \changes{v1.24z}{2021/05/01}{重新定义 \tn{printindex} 命令与文档适配。} % \end{function} % % \subsubsection{自定义脚注} @@ -915,23 +915,29 @@ The latest version of this license is in %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplClass{easybook}{2021/05/01}{1.24x}{beta} +\ProvidesExplClass{easybook}{2021/05/02}{1.24z}{beta} -\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_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 \eb_ctex_define:nn #1 - {\keys_define:nn {ctex/#1}} + { \keys_define:nn { ctex/#1 } } \cs_new_protected:Npn \eb_put_ctexbook:n #1 - {\PassOptionsToClass{#1}{ctexbook}} + { \PassOptionsToClass{#1}{ctexbook} } \cs_new_protected:Npn \eb_patch_cmd:Nnn #1#2#3 - {\ctex_patch_cmd_once:NnnnTF #1{}{#2}{#3}{}{\ctex_patch_failure:N #1}} + { + \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}} + { + \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}} -\cs_gset_eq:NN \PackageWarning\use_none:nn + { \ctex_gadd_ltxhook:nn { env/document/before } } +\cs_gset_eq:NN \PackageWarning \use_none:nn \bool_set_false:N \l__eb_compile_draft_bool \bool_set_false:N \l__eb_title_newline_bool @@ -941,76 +947,77 @@ The latest version of this license is in \tl_new:N \g__eb_config_tl \clist_new:N \g__eb_options_clist -\keys_define:nn {easybook} +\keys_define:nn { easybook } { - 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}, + 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}}, - font/noto .code:n = + font .choices:nn = + { adobe,founder,mac,windows,none } + { \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 .value_required:n = true, - font .initial:n = overleaf, + font/overleaf .code:n = { }, + font/linux .code:n = \eb_put_ctexbook:n { fontset = ubuntu }, + font .value_required:n = true, + font .initial:n = overleaf, - paper .choice:, - paper .value_required:n = true, - paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, - paper .initial:n = a4paper, + paper .choice:, + paper .value_required:n = true, + paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, + paper .initial:n = a4paper, - oneside .value_forbidden:n = true, - twoside .value_forbidden:n = true, - oneside .code:n = + oneside .value_forbidden:n = true, + twoside .value_forbidden:n = true, + 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 = + twoside .code:n = { \bool_set_true:N \l__eb_page_twoside_bool - \eb_put_ctexbook:n {twoside} + \eb_put_ctexbook:n { twoside } }, - class .choice:, - class .value_required:n = true, - class/book .code:n = {}, - class/article .code:n = + class .choice:, + class .value_required:n = true, + class/book .code:n = { }, + class/article .code:n = { \bool_set_false:N \l__eb_class_book_bool - \keys_set:nn {easybook}{oneside} + \keys_set:nn { easybook } { oneside } }, - class .initial:n = book, + class .initial:n = book, - config .tl_set:N = \g__eb_config_tl, - unknown .code:n = - {\clist_gput_right:No \g__eb_options_clist{\CurrentOption}} + config .tl_set:N = \g__eb_config_tl, + unknown .code:n = + { \clist_gput_right:No \g__eb_options_clist { \CurrentOption } } } \ProcessKeysOptions{easybook} \clist_map_inline:nn { - {svgnames}{xcolor}, - {hang,stable}{footmisc}, - {normalem}{ulem}, - {protrusion = false}{microtype}, - {list = off}{bicaption}, - {shortlabels,inline}{enumitem}, - {many}{tcolorbox}, - {xindy}{imakeidx}, - {CJKmath = true}{xeCJK}, - {no-math}{fontspec}, - {noto,upint}{newtxmath} - }{\PassOptionsToPackage#1} -\eb_put_ctexbook:n {\g__eb_options_clist} + { svgnames } { xcolor }, + { hang,stable } { footmisc }, + { normalem } { ulem }, + { protrusion = false } { microtype }, + { list = off } { bicaption }, + { shortlabels,inline } { enumitem }, + { many } { tcolorbox }, + { xindy } { imakeidx }, + { CJKmath = true } { xeCJK }, + { no-math } { fontspec }, + { noto,upint } { newtxmath } + } + { \PassOptionsToPackage #1 } +\eb_put_ctexbook:n { \g__eb_options_clist } \LoadClass[UTF8]{ctexbook} \bool_new:N \l__eb_multoc_bool @@ -1027,46 +1034,46 @@ The latest version of this license is in } \seq_map_inline:Nn \c__eb_options_path_seq { - \ctex_define:n {#1 .meta:nn = {ctex/#1}{##1}} - \cs_new:cpn {#1}##1{\keys_set:nn {ctex/#1}{##1}} + \ctex_define:n { #1 .meta:nn = { ctex/#1 } {##1} } + \cs_new:cpn {#1} ##1 { \keys_set:nn {ctex/#1} {##1} } } \ctex_define:n { - lstlistlistingname .tl_set:N = \lstlistlistingname, - lstlistingname .tl_set:N = \lstlistingname - } -\eb_ctex_define:nn {style} - { - multoc .bool_set:N = \l__eb_multoc_bool, - multoc .default:n = true, - withpart .bool_set:N = \l__eb_chap_withpart_bool, - withpart .default:n = true, - withpart .initial:n = false, - notomath .bool_set:N = \l__eb_notomath_bool, - notomath .default:n = true, - 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, - uppercase .default:n = true, - uppercase .initial:n = true, - - footwith .choices:nn = - {part,page,chapter} - {\tl_set_eq:NN \l__eb_foot_numberwith_tl\l_keys_choice_tl}, - footwith .value_required:n = true, - footwith .initial:n = chapter, - - figure-sep .tl_set:N = \l__eb_figure_separator_tl, - table-sep .tl_set:N = \l__eb_table_separator_tl, - listing-sep .tl_set:N = \l__eb_lstlisting_separator_tl, - equation-sep .tl_set:N = \l__eb_equation_separator_tl, - number-sep .meta:n = - { - figure-sep = {#1},table-sep = {#1}, - listing-sep = {#1},equation-sep = {#1} + lstlistlistingname .tl_set:N = \lstlistlistingname, + lstlistingname .tl_set:N = \lstlistingname + } +\eb_ctex_define:nn { style } + { + multoc .bool_set:N = \l__eb_multoc_bool, + multoc .default:n = true, + withpart .bool_set:N = \l__eb_chap_withpart_bool, + withpart .default:n = true, + withpart .initial:n = false, + notomath .bool_set:N = \l__eb_notomath_bool, + notomath .default:n = true, + 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, + uppercase .default:n = true, + uppercase .initial:n = true, + + footwith .choices:nn = + { part,page,chapter } + { \tl_set_eq:NN \l__eb_foot_numberwith_tl \l_keys_choice_tl }, + footwith .value_required:n = true, + footwith .initial:n = chapter, + + figure-sep .tl_set:N = \l__eb_figure_separator_tl, + table-sep .tl_set:N = \l__eb_table_separator_tl, + listing-sep .tl_set:N = \l__eb_lstlisting_separator_tl, + equation-sep .tl_set:N = \l__eb_equation_separator_tl, + number-sep .meta:n = + { + figure-sep = #1,table-sep = #1, + listing-sep = #1,equation-sep = #1 }, - number-sep .initial:n = {.} + number-sep .initial:n = { . } } \RequirePackage @@ -1086,20 +1093,20 @@ The latest version of this license is in \ctex_at_end_preamble:n { \bool_if:NT \l__eb_notomath_bool - {\RequirePackage{newtxmath,bm}} + { \RequirePackage{newtxmath,bm} } } \ctex_at_end:n { \tl_if_empty:NF \g__eb_config_tl - {\file_input:n {\g__eb_config_tl}} + { \file_input:n { \g__eb_config_tl } } } \cs_new_protected:Npn \eb_package_later_bool:nn #1#2 { \@ifpackagelater{#1}{#2} - {}{\msg_warning:nnn {easybook}{package-old}{#1}} + {}{\msg_warning:nnn { easybook } { package-old } {#1}} } -\msg_new:nnn {easybook}{package-old} +\msg_new:nnn { easybook } { package-old } { Package~#1~has~been~out~of~date. \\ Some~problems~or~errors~may~occur \\ @@ -1108,131 +1115,133 @@ The latest version of this license is in } \clist_map_inline:nn { - {expl3}{2020/10/27}, - {xparse}{2020/10/27}, - {l3keys2e}{2020/10/27}, - {ctex}{2020/10/19}, - {thmtools}{2020/08/01}, - {caption-light}{2020/08/24} - }{\eb_package_later_bool:nn #1} + { expl3 } { 2020/10/27 }, + { xparse } { 2020/10/27 }, + { l3keys2e } { 2020/10/27 }, + { ctex } { 2020/10/19 }, + { thmtools } { 2020/08/01 }, + { caption-light } { 2020/08/24 } + } + { \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_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_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 - {\__fontspec_main_setmainfont:nn {#2}{#1}} + { \__fontspec_main_setmainfont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setsansfont:nn #1#2 - {\__fontspec_main_setsansfont:nn {#2}{#1}} + { \__fontspec_main_setsansfont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setmonofont:nn #1#2 - {\__fontspec_main_setmonofont:nn {#2}{#1}} + { \__fontspec_main_setmonofont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setCJKmainfont:nn #1#2 - {\eb_set_family:nnn {\CJKrmdefault}{#2}{#1}} + { \eb_set_family:nnn { \CJKrmdefault } {#2} {#1} } \cs_new_protected:Npn \eb_setCJKsansfont:nn #1#2 - {\eb_set_family:nnn {\CJKsfdefault}{#2}{#1}} + { \eb_set_family:nnn { \CJKsfdefault } {#2} {#1} } \cs_new_protected:Npn \eb_setCJKmonofont:nn #1#2 - {\eb_set_family:nnn {\CJKttdefault}{#2}{#1}} + { \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}} + { \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}} + { \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}} + { \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}} + { \eb_set_family:nnn { fangsong } {#2} {#1} } \tl_const:Nn \eb_option_zhfont_tl - {UprightFont = *,AutoFakeBold = 1.5,ItalicFont = *} + { UprightFont = *,AutoFakeBold = 1.5,ItalicFont = * } \cs_new_protected:Npx \eb_setCJKmainfont:n #1 - {\eb_setCJKmainfont:nn {#1}{\eb_option_zhfont_tl}} + { \eb_setCJKmainfont:nn {#1} { \eb_option_zhfont_tl } } \cs_new_protected:Npx \eb_setCJKsansfont:n #1 - {\eb_setCJKsansfont:nn {#1}{\eb_option_zhfont_tl}} + { \eb_setCJKsansfont:nn {#1} { \eb_option_zhfont_tl } } \cs_new_protected:Npx \eb_setCJKmonofont:n #1 - {\eb_setCJKmonofont:nn {#1}{\eb_option_zhfont_tl}} + { \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}} + { \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}} + { \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}} + { \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}} + { \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, + Extension = .ttf, UprightFont = *-Regular, - BoldFont = *-Bold, - ItalicFont = *-Italic + BoldFont = *-Bold, + ItalicFont = *-Italic } - \eb_setsansfont:nn {NotoSans} + \eb_setsansfont:nn { NotoSans } { - Extension = .ttf, + Extension = .ttf, UprightFont = *-Regular, - BoldFont = *-Bold, - ItalicFont = *-Italic + BoldFont = *-Bold, + ItalicFont = *-Italic } - \eb_setmonofont:nn {NotoSansMono} + \eb_setmonofont:nn { NotoSansMono } { - Extension = .ttf, + Extension = .ttf, UprightFont = *-Regular, - BoldFont = *-Bold + BoldFont = *-Bold } - \eb_setCJKmainfont:nn {FZShuSong-Z01S} + \eb_setCJKmainfont:nn { FZShuSong-Z01S } { UprightFont = *, - BoldFont = FZHei-B01S, - ItalicFont = FZKai-Z03S + 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_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}} + { \cs_if_exist:NF \kaishu { \cs_gset_eq:NN \kaishu \itshape } } \includepdfset{fitpaper = true} \geometry { - vmargin = 2.54cm, - hmargin = 3.17cm, - columnsep = 2\ccwd, - headheight = 2.04cm, - headsep = 0.5cm, - footskip = 0.79cm, - footnotesep = 0.5cm, - marginparsep = 8pt, - marginparwidth = 2.54cm + vmargin = 2.54cm, + hmargin = 3.17cm, + columnsep = 2\ccwd, + headheight = 2.04cm, + headsep = 0.5cm, + footskip = 0.79cm, + footnotesep = 0.5cm, + marginparsep = 8pt, + marginparwidth = 2.54cm } \clist_new:N \g__eb_geometry_clist -\eb_ctex_define:nn {geoset} +\eb_ctex_define:nn { geoset } { - footnotemargin .dim_set:N = \footnotemargin, - footnotemargin .initial:n = 0.5\ccwd, - footparskip .tl_set:N = \hangfootparskip, - footparskip .initial:n = 0ex, - footparindent .tl_set:N = \hangfootparindent, - footparindent .initial:n = 2\ccwd, - unknown .code:n = + footnotemargin .dim_set:N = \footnotemargin, + footnotemargin .initial:n = 0.5\ccwd, + footparskip .tl_set:N = \hangfootparskip, + footparskip .initial:n = 0ex, + footparindent .tl_set:N = \hangfootparindent, + footparindent .initial:n = 2\ccwd, + unknown .code:n = { \clist_gput_right:Nx \g__eb_geometry_clist { \l_keys_key_str - \tl_if_empty:NF \l_keys_value_tl{ = {#1}} + \tl_if_empty:NF \l_keys_value_tl { = {#1} } } } } @@ -1242,8 +1251,8 @@ The latest version of this license is in \clearpage \bool_if:NT \l__eb_page_twoside_bool { - \int_if_odd:nF {\c@page} - {\hbox:n {}\thispagestyle{#1}\clearpage} + \int_if_odd:nF { \c@page } + { \hbox:n { }\thispagestyle{#1}\clearpage } } } \RenewDocumentCommand{\frontmatter}{sO{Roman}} @@ -1258,67 +1267,68 @@ The latest version of this license is in \booltrue{@mainmatter} \pagenumbering{arabic} } -\cs_gset_eq:NN \easyhead\fancyhead -\cs_gset_eq:NN \easyfoot\fancyfoot -\eb_ctex_define:nn {hdrset} +\cs_gset_eq:NN \easyhead \fancyhead +\cs_gset_eq:NN \easyfoot \fancyfoot +\eb_ctex_define:nn { hdrset } { - head-foot .tl_set:N = \l__eb_fancyhf_content_tl, - head-foot .initial:n = + head-foot .tl_set:N = \l__eb_fancyhf_content_tl, + head-foot .initial:n = { \bool_if:NTF \l__eb_page_twoside_bool { \easyhead[EC]{\color{ctex@frame}\kaishu\leftmark} \easyhead[OC]{\color{ctex@frame}\kaishu\rightmark} \easyhead[EL,OR]{\color{ctex@frame}\thepage} - }{ + } + { \easyhead[L]{\color{ctex@frame}\kaishu\leftmark} \easyhead[R]{\color{ctex@frame}\thepage} } }, - chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, - chap-mark .initial:n = + chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, + chap-mark .initial:n = { - \int_compare:nT {\c@secnumdepth > -1} + \int_compare:nT { \c@secnumdepth > -1 } { \ifbool{@mainmatter} { - \int_if_odd:nT {\CTEX@chapter@numbering} - {\CTEXthechapter\hspace{\ccwd}} + \int_if_odd:nT { \CTEX@chapter@numbering } + { \CTEXthechapter\hspace{\ccwd} } }{} }#1 }, - sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, - sec-mark .initial:n = + sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, + sec-mark .initial:n = { - \int_compare:nT {\c@secnumdepth > 0} + \int_compare:nT { \c@secnumdepth > 0 } { - \int_if_odd:nT {\CTEX@section@numbering} - {\CTEXthesection\hspace{0.5\ccwd}} + \int_if_odd:nT { \CTEX@section@numbering } + { \CTEXthesection\hspace{0.5\ccwd} } }#1 }, - subsec-mark .cs_set:Np = \eb_fancyhf_subsection_mark:n #1, - subsec-mark .initial:n = + subsec-mark .cs_set:Np = \eb_fancyhf_subsection_mark:n #1, + subsec-mark .initial:n = { - \int_compare:nT {\c@secnumdepth > 1} + \int_compare:nT { \c@secnumdepth > 1 } { - \int_if_odd:nT {\CTEX@subsection@numbering} - {\CTEXthesubsection\hspace{0.5\ccwd}} + \int_if_odd:nT { \CTEX@subsection@numbering } + { \CTEXthesubsection\hspace{0.5\ccwd} } }#1 }, - headrule .tl_gset:N = \headrule, - headrule .initial:n = + headrule .tl_gset:N = \headrule, + headrule .initial:n = { \group_begin: \color{ctex@frame}\vspace*{1.5pt} \hrule width \textwidth height \l__eb_rule_width_dim \group_end: }, - footrule .tl_gset:N = \footrule, - footrule .initial:n = {}, - footnoterule .tl_gset:N = \footnoterule, - footnoterule .initial:n = + footrule .tl_gset:N = \footrule, + footrule .initial:n = { }, + footnoterule .tl_gset:N = \footnoterule, + footnoterule .initial:n = { \group_begin: \color{ctex@frame} @@ -1330,185 +1340,183 @@ The latest version of this license is in \cs_new:Npn \eb_upper_number_mark_bool:nn #1#2 { \bool_if:NT \l__eb_uppercase_bool - {\text_uppercase:n}{\use:c {eb_fancyhf_#1_mark:n}{#2}} + { \text_uppercase:n } { \use:c { eb_fancyhf_#1_mark:n } {#2} } } -\cs_new:Npn \eb@number@markdouble#1#2 +\cs_new:Npn \eb@number@markdouble #1#2 { \markboth - {\eb_upper_number_mark_bool:nn {#1}{#2}} + {\eb_upper_number_mark_bool:nn {#1} {#2}} { \bool_if:NT \l__eb_page_twoside_bool - {\eb_upper_number_mark_bool:nn {#1}{#2}} + { \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}}} +\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 + \exp_args:NV \geometry \g__eb_geometry_clist \fancyhf{} \tl_use:N \l__eb_fancyhf_content_tl - \cs_gset_eq:NN \ps@plain\ps@empty + \cs_gset_eq:NN \ps@plain \ps@empty \pagestyle{fancy} \bool_if:NTF \l__eb_class_book_bool { - \cs_gset:Npn \chaptermark#1 - {\eb@number@markdouble{chapter}{#1}} - \cs_gset:Npn \sectionmark#1 - {\eb@number@markright{section}{#1}} - }{ - \cs_gset:Npn \sectionmark#1 - {\eb@number@markdouble{section}{#1}} - \cs_gset:Npn \subsectionmark#1 - {\eb@number@markright{subsection}{#1}} + \cs_gset:Npn \chaptermark #1 + { \eb@number@markdouble{chapter}{#1} } + \cs_gset:Npn \sectionmark #1 + { \eb@number@markright{section}{#1} } + } + { + \cs_gset:Npn \sectionmark #1 + { \eb@number@markdouble{section}{#1} } + \cs_gset:Npn \subsectionmark #1 + { \eb@number@markright{subsection}{#1} } } \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} } + { \easyhead[C]{\color{SlateGray}\sffamily\today} } \geometry{showframe} } } \seq_const_from_clist:Nn \c__eb_toc_headings_level_seq - {part,chapter,section,subsection,list} + { part,chapter,section,subsection,list } \seq_map_inline:Nn \c__eb_toc_headings_level_seq { - \ctex_define:n {tocset/#1 .meta:nn = {ctex/tocset/#1}{##1}} - \eb_ctex_define:nn {tocset} + \ctex_define:n { tocset/#1 .meta:nn = { ctex/tocset/#1 } {##1} } + \eb_ctex_define:nn { tocset } { - #1/format .tl_set:c = l__eb_toc_#1_format_tl, - #1/format+ .code:n = - {\tl_put_right:cn {l__eb_toc_#1_format_tl}{##1}}, + #1/format .tl_set:c = l__eb_toc_#1_format_tl, + #1/format+ .code:n = + { \tl_put_right:cn {l__eb_toc_#1_format_tl} {##1} }, #1/format~+ .code:n = - {\tl_put_right:cn {l__eb_toc_#1_format_tl}{##1}}, - #1/indent .tl_set:c = l__eb_toc_#1_indent_tl, - #1/rule .tl_set:c = l__eb_toc_#1_rule_tl, - #1/numsep .tl_set:c = eb@toc@#1@numsep + { \tl_put_right:cn {l__eb_toc_#1_format_tl} {##1} }, + #1/indent .tl_set:c = l__eb_toc_#1_indent_tl, + #1/rule .tl_set:c = l__eb_toc_#1_rule_tl, + #1/numsep .tl_set:c = eb@toc@#1@numsep } } -\cs_new:Npn \EbNumberline#1 +\cs_new:Npn \EbNumberline #1 { \CTEXifname { - \use:c {CTEXthe#1} - \hspace{\use:c {eb@toc@#1@numsep}} + \use:c { CTEXthe#1 } + \hspace{\use:c { eb@toc@#1@numsep }} }{} } \newbool{eb@titletoc@hang@fix} -\eb_ctex_define:nn {tocset} - { - list/lolskip .skip_set:N = \l__eb_toc_lolskip_skip, - list/lolskip .initial:n = 0.8pc, - list/belowoffset .dim_set:N = \l__eb_toc_listoffset_dim, - list/belowoffset .initial:n = - {\bool_if:NTF \l__eb_class_book_bool{0pc}{0.15pc}}, - belowoffset .dim_set:N = \l__eb_toc_offset_dim, - belowoffset .initial:n = - {\bool_if:NTF \l__eb_class_book_bool{-1pc}{-0.35pc}}, - tocline-fig .cs_set:Np = \eb@labelname@lof#1, - tocline-fig .initial:n = - { - \figurename\space#1 +\eb_ctex_define:nn { tocset } + { + list/lolskip .skip_set:N = \l__eb_toc_lolskip_skip, + list/lolskip .initial:n = 0.8pc, + list/belowoffset .dim_set:N = \l__eb_toc_listoffset_dim, + list/belowoffset .initial:n = + {\bool_if:NTF \l__eb_class_book_bool { 0pc } { 0.15pc } }, + + belowoffset .dim_set:N = \l__eb_toc_offset_dim, + belowoffset .initial:n = + { \bool_if:NTF \l__eb_class_book_bool { -1pc } { -0.35pc } }, + tocline-fig .cs_set:Np = \eb@labelname@lof #1, + tocline-fig .initial:n = + { + \figurename\space #1 \notbool{eb@titletoc@hang@fix} {\hspace{\eb@toc@list@numsep}}{} }, - tocline-tab .cs_set:Np = \eb@labelname@lot#1, - tocline-tab .initial:n = + tocline-tab .cs_set:Np = \eb@labelname@lot #1, + tocline-tab .initial:n = { - \tablename\space#1 + \tablename\space #1 \notbool{eb@titletoc@hang@fix} {\hspace{\eb@toc@list@numsep}}{} }, - tocline-lst .tl_set:N = \eb@labelname@lol, - tocline-lst .initial:n = + tocline-lst .tl_set:N = \eb@labelname@lol, + tocline-lst .initial:n = { \lstlistingname\space\thelstlisting \notbool{eb@titletoc@hang@fix} {\hspace{\eb@toc@list@numsep}}{} }, - line-align .bool_set:N = \l__eb_toc_line_align_bool, - line-align .default:n = true, - line-align .initial:n = true, + line-align .bool_set:N = \l__eb_toc_line_align_bool, + line-align .default:n = true, + line-align .initial:n = true, - hang .choice:, - hang/true .code:n = + hang .choice:, + hang/true .code:n = { \booltrue{eb@titletoc@hang@fix} \ctex_set:n { - chapter/tocline = \CTEXnumberline{##1}##2, - section/tocline = \CTEXnumberline{##1}##2, - subsection/tocline = \CTEXnumberline{##1}##2 + chapter/tocline = \CTEXnumberline{##1}##2, + section/tocline = \CTEXnumberline{##1}##2, + subsection/tocline = \CTEXnumberline{##1}##2 } }, - hang/false .code:n = + hang/false .code:n = { \ctex_set:n { - chapter/tocline = \EbNumberline{##1}##2, - section/tocline = \EbNumberline{##1}##2, - subsection/tocline = \EbNumberline{##1}##2 + chapter/tocline = \EbNumberline{##1}##2, + section/tocline = \EbNumberline{##1}##2, + subsection/tocline = \EbNumberline{##1}##2 } }, - hang .default:n = true, - hang .initial:n = false, + hang .default:n = true, + hang .initial:n = false, - numsep-all .meta:n = + numsep-all .meta:n = { - part/numsep = {#1}, - chapter/numsep = {#1}, - section/numsep = {#1}, - subsection/numsep = {#1}, - list/numsep = {#1} + part/numsep = #1, + chapter/numsep = #1, + section/numsep = #1, + subsection/numsep = #1, + list/numsep = #1 }, - indent-all .meta:n = - { - part/indent = {#1}, - chapter/indent = {#1}, - section/indent = {#1}, - subsection/indent = {#1}, - list/indent = {#1} + numsep-all .initial:n = \ccwd, + indent-all .meta:n = + { + part/indent = #1, + chapter/indent = #1, + section/indent = #1, + subsection/indent = #1, + list/indent = #1 }, - rule-all .meta:n = + rule-all .meta:n = { - part/rule = {#1}, - chapter/rule = {#1}, - section/rule = {#1}, - subsection/rule = {#1}, - list/rule = {#1} + part/rule = #1, + chapter/rule = #1, + section/rule = #1, + subsection/rule = #1, + list/rule = #1 } } -\ctex_set:nn {tocset} +\ctex_set:nn { tocset } { part/format = \addvspace{1pc}\sffamily\large, part/indent = 0\ccwd, - part/rule = \tocrule{}[\bfseries], - part/numsep = \ccwd, + part/rule = \tocrule{}[\bfseries], - chapter/format = \addvspace{1pc}\sffamily\large, - chapter/indent = 0\ccwd, - chapter/rule = \tocrule{$\cdot$}[\bfseries], - chapter/numsep = \ccwd, + chapter/format = \addvspace{1pc}\sffamily\large, + chapter/indent = 0\ccwd, + chapter/rule = \tocrule{$\cdot$}[\bfseries], - section/format = \addvspace{0.35pc}, - section/indent = - {\bool_if:NTF \l__eb_class_book_bool{1.5\ccwd}{0\ccwd}}, - section/rule = \tocrule{$\cdot$}, - section/numsep = \ccwd, + section/format = \addvspace{0.35pc}, + section/indent = + { \bool_if:NTF \l__eb_class_book_bool {1.5\ccwd } { 0\ccwd } }, + section/rule = \tocrule{$\cdot$}, subsection/format = \addvspace{0.35pc}, subsection/indent = - {\bool_if:NTF \l__eb_class_book_bool{3.8\ccwd}{1.4\ccwd}}, - subsection/rule = \tocrule{$\cdot$}, - subsection/numsep = \ccwd, + { \bool_if:NTF \l__eb_class_book_bool {3.8\ccwd } { 1.4\ccwd } }, + subsection/rule = \tocrule{$\cdot$}, list/format = \addvspace{0.2pc}, list/indent = 0\ccwd, - list/rule = \tocrule{$\cdot$}, - list/numsep = \ccwd + list/rule = \tocrule{$\cdot$} } \NewDocumentCommand{\tocrule}{sO{0.7pc}D(){1.2}mO{}} @@ -1519,52 +1527,53 @@ The latest version of this license is in {\thecontentspage} { \bool_if:NTF \l__eb_toc_line_align_bool - {\contentspage}{\thecontentspage} + { \contentspage } { \thecontentspage } } } \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}} + [\use:c { l__eb_toc_#2_indent_tl }] + {\use:c { l__eb_toc_#2_format_tl }} { \ifbool{eb@titletoc@hang@fix} { \contentspush { \bool_if:NT \l__eb_toc_number_color_bool - {\color{ctex@toc@number}} + { \color{ctex@toc@number} } \thecontentslabel - \hspace{\use:c {eb@toc@#2@numsep}} + \hspace{\use:c { eb@toc@#2@numsep }} } }{} }{} - {\use:c {l__eb_toc_#2_rule_tl}} + {\use:c { l__eb_toc_#2_rule_tl }} } \contentsuse{lstlisting}{lol} \clist_map_inline:nn { - {part}{part}, - {chapter}{chapter}, - {section}{section}, - {subsection}{subsection}, - {figure}{list}, - {table}{list}, - {lstlisting}{list} - }{\eb_titlecontents_set:nn #1} + { part } { part }, + { chapter } { chapter }, + { section } { section }, + { subsection } { subsection }, + { figure } { list }, + { table } { list }, + { lstlisting } { list } + } + { \eb_titlecontents_set:nn #1 } \prop_new:N \l__eb_label_name_prop \prop_set_from_keyval:Nn \l__eb_label_name_prop { - figure = \eb@labelname@lof, - table = \eb@labelname@lot + figure = \eb@labelname@lof, + table = \eb@labelname@lot } -\cs_gset:Npn \caption@@@addcontentsline#1#2#3#4 +\cs_gset:Npn \caption@@@addcontentsline #1#2#3#4 { \addcontentsline{#1}{#2} { \ifbool{eb@titletoc@hang@fix}{\protect\numberline}{} - {\prop_item:Nn \l__eb_label_name_prop{#2}{#3}}{#4} + {\prop_item:Nn \l__eb_label_name_prop {#2}{#3}}#4 } } \ctex_patch_cmd:Nnn \lst@MakeCaption @@ -1581,103 +1590,107 @@ The latest version of this license is in \eb_appto_cmd:Nn \@chapter { - \skip_if_eq:nnF {\l__eb_toc_lolskip_skip}{\c_zero_skip} + \skip_if_eq:nnF { \l__eb_toc_lolskip_skip } { \c_zero_skip } { \addtocontents{lol} {\protect\addvspace{\skip_use:N \l__eb_toc_lolskip_skip}} } \bool_if:NF \l__eb_class_book_bool - {\msg_error:nn {easybook}{no-chapter}} + { \msg_error:nn { easybook } { no-chapter } } } \eb_appto_cmd:Nn \@schapter { \bool_if:NF \l__eb_class_book_bool - {\msg_error:nn {easybook}{no-chapter}} + { \msg_error:nn { easybook } { no-chapter } } } -\msg_new:nnn {easybook}{no-chapter} +\msg_new:nnn { easybook } { no-chapter } { Your~document~class~is~in~article~mode. \\ The~\string\chapter\space~command~will~not~be~used. } -\tl_set:Nn \l__eb_toc_type_tl{book} -\keys_define:nn {eb/listoc} +\tl_set:Nn \l__eb_toc_type_tl { book } +\keys_define:nn { eb/listoc } { - article .code:n = \tl_set:Nn \l__eb_toc_type_tl{article}, - book .code:n = {}, - multoc .bool_set:N = \l__eb_multoc_bool, - multoc .default:n = true, - multoc .initial:n = false, - title .tl_set:N = \eb@toc@title + article .code:n = \tl_set:Nn \l__eb_toc_type_tl { article }, + book .code:n = { }, + multoc .bool_set:N = \l__eb_multoc_bool, + multoc .default:n = true, + multoc .initial:n = false, + title .tl_set:N = \eb@toc@title } \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}} + { \text_uppercase:n {#1} } + { \text_titlecase_first:n {#1} } } -\cs_new:Npn \eb@nonumber@markdouble#1 +\cs_new:Npn \eb@nonumber@markdouble #1 { \markboth {\eb_upper_nonumber_mark_bool:n {#1}} { \bool_if:NT \l__eb_page_twoside_bool - {\eb_upper_nonumber_mark_bool:n {#1}} + { \eb_upper_nonumber_mark_bool:n {#1} } } } -\cs_new:Npn \eb@nonumber@markright#1 - {\markright{\eb_upper_nonumber_mark_bool:n {#1}}} +\cs_new:Npn \eb@nonumber@markright #1 + { \markright{\eb_upper_nonumber_mark_bool:n {#1}} } \cs_new_protected:Npn \eb_title_mark_intoc:n #1 { - \tl_if_eq:NnTF \l__eb_toc_type_tl{book} + \tl_if_eq:NnTF \l__eb_toc_type_tl { book } { - \chapter*{\phantomsection#1} + \chapter*{\phantomsection #1} \CTEX@addtocline{chapter}{#1} \eb@nonumber@markdouble{#1} - }{ - \section*{\phantomsection#1} + } + { + \section*{\phantomsection #1} \CTEX@addtocline{section}{#1} \bool_if:NTF \l__eb_class_book_bool - {\eb@nonumber@markright{#1}} - {\eb@nonumber@markdouble{#1}} + { \eb@nonumber@markright{#1} } + { \eb@nonumber@markdouble{#1} } } } \cs_new_protected:Npn \eb_title_mark_notoc:n #1 { - \tl_if_eq:NnTF \l__eb_toc_type_tl{book} + \tl_if_eq:NnTF \l__eb_toc_type_tl { book } { - \chapter*{\phantomsection#1} + \chapter*{\phantomsection #1} \eb@nonumber@markdouble{#1} - }{ - \section*{\phantomsection#1} + } + { + \section*{\phantomsection #1} \bool_if:NTF \l__eb_class_book_bool - {\eb@nonumber@markright{#1}} - {\eb@nonumber@markdouble{#1}} + { \eb@nonumber@markright{#1} } + { \eb@nonumber@markdouble{#1} } } } \cs_new_protected:Npn \eb_title_number_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}} - }{ + \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}} + { \eb_title_mark_notoc:n {\eb@toc@title} } + { \eb_title_mark_intoc:n {\eb@toc@title} } } } \cs_new_protected:Npn \eb_class_title_level_bool:n #1 { \bool_if:NTF \l__eb_class_book_bool { - \chapter*{\phantomsection#1} + \chapter*{\phantomsection #1} \CTEX@addtocline{chapter}{#1} - }{ - \section*{\phantomsection#1} + } + { + \section*{\phantomsection #1} \CTEX@addtocline{section}{#1} } \eb@nonumber@markdouble{#1} @@ -1689,25 +1702,26 @@ The latest version of this license is in \ifbool{@twocolumn} { \booltrue{@restonecol} - \bool_if:NTF \l__eb_multoc_bool{\twocolumn}{\onecolumn} + \bool_if:NTF \l__eb_multoc_bool {\twocolumn } { \onecolumn } }{ \boolfalse{@restonecol} - \bool_if:NT \l__eb_multoc_bool{\twocolumn} + \bool_if:NT \l__eb_multoc_bool { \twocolumn } } - }{\tl_set:Nn \l__eb_toc_type_tl{article}} + } + { \tl_set:Nn \l__eb_toc_type_tl { article } } } \cs_new_protected:Npn \eb_multoc_post_bool: { \bool_if:NT \l__eb_class_book_bool - {\ifbool{@restonecol}{\twocolumn}{\onecolumn}} + { \ifbool{@restonecol}{\twocolumn}{\onecolumn} } } \RenewDocumentCommand{\tableofcontents}{o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\contentsname - \IfValueT{#1}{\keys_set:nn {eb/listoc}{#1}} + \tl_set_eq:NN \eb@toc@title \contentsname + \IfValueT{#1}{\keys_set:nn { eb/listoc } {#1}} \eb_multoc_pre_bool: - \eb_title_mark_notoc:n {\eb@toc@title} + \eb_title_mark_notoc:n { \eb@toc@title } \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{toc} \eb_multoc_post_bool: @@ -1716,11 +1730,11 @@ The latest version of this license is in \RenewDocumentCommand{\listoffigures}{st+o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\listfigurename - \IfValueT{#3}{\keys_set:nn {eb/listoc}{#3}} + \tl_set_eq:NN \eb@toc@title \listfigurename + \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \eb_multoc_pre_bool: - \eb_title_number_intoc_bool:nn {#2}{#1} - \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listoffset_dim + \eb_title_number_intoc_bool:nn {#2} {#1} + \dim_add:NV \l__eb_toc_offset_dim \l__eb_toc_listoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lof} \eb_multoc_post_bool: @@ -1729,11 +1743,11 @@ The latest version of this license is in \RenewDocumentCommand{\listoftables}{st+o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\listtablename - \IfValueT{#3}{\keys_set:nn {eb/listoc}{#3}} + \tl_set_eq:NN \eb@toc@title \listtablename + \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \eb_multoc_pre_bool: - \eb_title_number_intoc_bool:nn {#2}{#1} - \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listoffset_dim + \eb_title_number_intoc_bool:nn {#2} {#1} + \dim_add:NV \l__eb_toc_offset_dim \l__eb_toc_listoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lot} \eb_multoc_post_bool: @@ -1742,38 +1756,38 @@ The latest version of this license is in \NewDocumentCommand{\listoflistings}{st+o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\lstlistlistingname - \IfValueT{#3}{\keys_set:nn {eb/listoc}{#3}} + \tl_set_eq:NN \eb@toc@title \lstlistlistingname + \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \eb_multoc_pre_bool: - \eb_title_number_intoc_bool:nn {#2}{#1} - \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listoffset_dim + \eb_title_number_intoc_bool:nn {#2} {#1} + \dim_add:NV \l__eb_toc_offset_dim \l__eb_toc_listoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lol} \eb_multoc_post_bool: \group_end: } -\ctex_at_end_package:nn {imakeidx} +\ctex_at_end_package:nn { imakeidx } { \makeindex[ - options = -M~texindy~-C~utf8, - program = truexindy, - columns = 2, + options = -M~texindy~-C~utf8, + program = truexindy, + columns = 2, columnsep = 2\ccwd ] \RenewDocumentCommand{\printindex}{st+D(){\imki@jobname}o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\indexname - \cs_set_eq:NN \imki@indexlevel\use_none:n + \tl_set_eq:NN \eb@toc@title \indexname + \cs_set_eq:NN \imki@indexlevel \use_none:n \setkeys{imki}{intoc = false} - \IfValueT{#4}{\keys_set:nn {eb/listoc}{#4}} + \IfValueT{#4}{\keys_set:nn { eb/listoc } {#4}} \bool_if:NF \l__eb_class_book_bool - {\tl_set:Nn \l__eb_toc_type_tl{article}} + { \tl_set:Nn \l__eb_toc_type_tl { article } } \tl_set:Nn \imki@indexheaders { - \eb_title_number_intoc_bool:nn {#2}{#1} - \cs_set_eq:NN \thispagestyle\use_none:n + \eb_title_number_intoc_bool:nn {#2} {#1} + \cs_set_eq:NN \thispagestyle \use_none:n \cs_undefine:N \imki@firstpagestyle } \imki@putindex{#3} @@ -1786,18 +1800,18 @@ The latest version of this license is in \tl_new:N \l__eb_font_listing_tl \tl_new:N \l__eb_font_footnote_tl -\eb_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, - figure-cap .tl_set:N = \l__eb_font_figure_tl, - figure-cap .initial:n = \sffamily\small, - listing-cap .tl_set:N = \l__eb_font_listing_tl, - listing-cap .initial:n = \sffamily\small, - footnote .tl_set:N = \l__eb_font_footnote_tl, - footnote .initial:n = \rmfamily, - marginpar .tl_set:N = \marginfont, - marginpar .initial:n = \rmfamily\footnotesize + table-cap .tl_set:N = \l__eb_font_table_tl, + table-cap .initial:n = \sffamily\small, + figure-cap .tl_set:N = \l__eb_font_figure_tl, + figure-cap .initial:n = \sffamily\small, + listing-cap .tl_set:N = \l__eb_font_listing_tl, + listing-cap .initial:n = \sffamily\small, + footnote .tl_set:N = \l__eb_font_footnote_tl, + footnote .initial:n = \rmfamily, + marginpar .tl_set:N = \marginfont, + marginpar .initial:n = \rmfamily\footnotesize } \DeclareCaptionLabelSeparator{ccwd}{\hspace{\ccwd}} @@ -1807,14 +1821,13 @@ The latest version of this license is in \DeclareCaptionFont{eb@listing@font}{\l__eb_font_listing_tl} \captionsetup { - format = hang, - % figurewithin = section, - % tablewithin = section, + format = hang, font = {stretch = {\fp_use:N \l__eb_spread_caption_fp}}, - labelfont = {color = ctex@frame}, - labelsep = ccwd, + labelfont = {color = ctex@frame}, + labelsep = ccwd, singlelinecheck = true, - belowskip = 0pt,aboveskip = 10pt + belowskip = 0pt, + aboveskip = 10pt } \captionsetup[table]{font += eb@table@font} \captionsetup[figure]{font += eb@figure@font} @@ -1822,38 +1835,39 @@ The latest version of this license is in \captionsetup[subfigure] { labelformat = parens, - font += eb@figure@font, - belowskip = 2pt,aboveskip = 6pt + font+ = eb@figure@font, + belowskip = 2pt, + aboveskip = 6pt } -\ctex_at_end_package:nn {bicaption} +\ctex_at_end_package:nn { bicaption } { \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_gset:cpn { thesection } + { + \int_compare:nT { \c@chapter > 0 } { \thechapter. } + \eb_arabic:n { section } + } +\seq_const_from_clist:Nn \c__eb_serial_number_counter_seq + { 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:nT {\c@chapter > 0} + \int_compare:nT { \c@chapter > 0 } { \thechapter - \use:c {l__eb_#1_separator_tl} + \use:c { l__eb_#1_separator_tl } } \eb_arabic:n {#1} } } -\cs_gset:cpn {thesection} - { - \int_compare:nT {\c@chapter > 0}{\thechapter.} - \eb_arabic:n {section} - } -\clist_map_inline:nn - {figure,table,lstlisting,equation} - {\eb_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} @@ -1862,7 +1876,8 @@ The latest version of this license is in \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} @@ -1870,22 +1885,22 @@ The latest version of this license is in \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 = {}} + \ctex_set:nn { appendix }{ number = \@Alph\c@section,name = { } } } } \AtBeginEnvironment{tabularx} { - \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_table_fp} + \exp_args:Nx \linespread { \fp_use:N \l__eb_spread_table_fp } \selectfont\ignorespaces } \AtBeginEnvironment{tabular} { - \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_table_fp} + \exp_args:Nx \linespread { \fp_use:N \l__eb_spread_table_fp } \selectfont\ignorespaces } \ctex_after_end_preamble:n { - \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_line_fp} + \exp_args:Nx \linespread { \fp_use:N \l__eb_spread_line_fp } \selectfont\ignorespaces } @@ -1895,38 +1910,38 @@ The latest version of this license is in \fp_new:N \l__eb_spread_caption_fp \fp_new:N \l__eb_spread_footnote_fp -\eb_ctex_define:nn {spread} - { - line .fp_set:N = \l__eb_spread_line_fp, - line .initial:n = 1.3, - table .fp_set:N = \l__eb_spread_table_fp, - table .initial:n = 1.05, - math .fp_set:N = \l__eb_spread_math_fp, - math .initial:n = 1.05, - caption .fp_set:N = \l__eb_spread_caption_fp, - caption .initial:n = 1, - footnote .fp_set:N = \l__eb_spread_footnote_fp, - footnote .initial:n = 1, - spread-all .meta:n = - { - line = {#1},table = {#1},math = {#1}, - caption = {#1},footnote = {#1} +\eb_ctex_define:nn { spread } + { + line .fp_set:N = \l__eb_spread_line_fp, + line .initial:n = 1.3, + table .fp_set:N = \l__eb_spread_table_fp, + table .initial:n = 1.05, + math .fp_set:N = \l__eb_spread_math_fp, + math .initial:n = 1.05, + caption .fp_set:N = \l__eb_spread_caption_fp, + caption .initial:n = 1, + footnote .fp_set:N = \l__eb_spread_footnote_fp, + footnote .initial:n = 1, + spread-all .meta:n = + { + line = #1,table = #1,math = #1, + caption = #1,footnote = #1 } } -\skip_set:Nn \parskip{0pt plus 2pt minus 1pt} -\skip_set:Nn \floatsep{12pt plus 2pt minus 2pt} -\skip_set:Nn \intextsep{14pt plus 2pt minus 2pt} -\skip_set:Nn \textfloatsep{16pt plus 2pt minus 4pt} -\skip_set:Nn \dbltextfloatsep{16pt plus 2pt minus 4pt} -\skip_set:Nn \@fpsep{8pt plus 2.0fil} +\skip_set:Nn \parskip { 0pt plus 2pt minus 1pt } +\skip_set:Nn \floatsep { 12pt plus 2pt minus 2pt } +\skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt } +\skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt } +\skip_set:Nn \dbltextfloatsep { 16pt plus 2pt minus 4pt } +\skip_set:Nn \@fpsep { 8pt plus 2.0fil } \setcounter{topnumber}{4} \setcounter{bottomnumber}{4} \setcounter{totalnumber}{8} -\tl_gset:Nn \textfraction{0.18} -\tl_gset:Nn \topfraction{0.85} -\tl_gset:Nn \bottomfraction{0.65} -\tl_gset:Nn \floatpagefraction{0.60} +\tl_gset:Nn \textfraction { 0.18 } +\tl_gset:Nn \topfraction { 0.85 } +\tl_gset:Nn \bottomfraction { 0.65 } +\tl_gset:Nn \floatpagefraction { 0.60 } \newcolumntype{L}{X} \newcolumntype{C}{>{\centering\arraybackslash}X} @@ -1935,18 +1950,21 @@ The latest version of this license is in \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} \cs_new_protected:Npn \eb_enumitem_labelval_set:nn #1#2 - {\SetEnumitemValue{label}{#1}{\color{ctex@emph}#2}} + { \SetEnumitemValue{label}{#1}{\color{ctex@emph}#2} } \clist_map_inline:nn { - {bullet}{\textbullet}, - {endash}{\normalfont\bfseries\textendash}, - {asterisk}{\textasteriskcentered}, - {arabic}{\arabic*.}, - {alph}{(\alph*)}, - {roman}{\roman*.}, - {outline}{\upshape\ding{111}} - }{\eb_enumitem_labelval_set:nn #1} + { bullet } { \textbullet }, + { endash } { \normalfont\bfseries\textendash }, + { asterisk } { \textasteriskcentered }, + { arabic } { \arabic*. }, + { alph } { (\alph*) }, + { roman } { \roman*. }, + { outline } { \upshape\ding{111} } + } + { \eb_enumitem_labelval_set:nn #1 } \SetEnumitemValue{font}{sf}{\color{ctex@emph}\normalfont\sffamily} +\SetEnumitemValue{ref}{enumii}{\arabic{enumi}.\alph*} +\SetEnumitemValue{ref}{enumiii}{\arabic{enumi}.\alph{enumii}.\roman*} \setlist { labelsep = .75\ccwd,listparindent = 2\ccwd,leftmargin = *, @@ -1959,26 +1977,25 @@ The latest version of this license is in \setlist[itemize,2]{label = endash} \setlist[itemize,3]{label = asterisk} \setlist[enumerate,1]{label = arabic,ref = \arabic*} -\setlist[enumerate,2]{label = alph,ref = \arabic{enumi}.\alph*} -\setlist[enumerate,3]{label = roman,ref = \arabic{enumi}.\alph{enumii}.\roman*} -\setlist*[enumerate,3]{labelwidth = *} +\setlist[enumerate,2]{label = alph,ref = enumii} +\setlist[enumerate,3]{label = roman,ref = enumiii,labelwidth = *} \setlist[description]{font = sf,labelwidth = *,leftmargin = 2\ccwd} \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}} - {\tl_const:cn {c__eb_name_#1_tl}{#2}} + \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } + { \tl_const:cn { c__eb_name_#1_tl } {#3} } + { \tl_const:cn { c__eb_name_#1_tl } {#2} } } \NewDocumentCommand{\EbNewtheorem} {mO{\text_titlecase_first:n {#1}}mD(){tc-theorem}O{}} { \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}, + name = \use:c { c__eb_name_#1_tl }, style = easy-theorem,#5 }{#1}[] \bool_if:NT \l__eb_thmbox_bool @@ -1986,7 +2003,7 @@ The latest version of this license is in \@ifpackageloaded{tcolorbox} {\tcolorboxenvironment{#1}{#4}}{} } - \labelformat{#1}{\use:c {c__eb_name_#1_tl}~##1} + \labelformat{#1}{\use:c { c__eb_name_#1_tl }~##1} } } @@ -2001,99 +2018,107 @@ The latest version of this license is in \RenewDocumentCommand{\newtheorem}{O{}m} {\AfterPreamble{\declaretheorem[#1]{#2}}} -\eb_ctex_define:nn {thmset} - { - thmbox .bool_set:N = \l__eb_thmbox_bool, - thmbox .default:n = true, - thmbox .initial:n = false, - within .tl_set:N = \l__eb_thm_numberwith_tl, - within .initial:n = \bool_if:NT \l__eb_class_book_bool{chapter}, - bodyfont .tl_set:N = \l__eb_thm_bodyfont_tl, - bodyfont .initial:n = {}, - notefont .tl_set:N = \l__eb_thm_notefont_tl, - notefont .initial:n = {}, - headfont .tl_set:N = \l__eb_thm_headfont_tl, - headfont .initial:n = \color{ctex@emph}\sffamily, - headpunct .tl_set:N = \l__eb_thm_headpunct_tl, - headpunct .initial:n = {}, - spacepost .tl_set:N = \l__eb_thm_spacepost_tl, - spacepost .initial:n = \ccwd, - headindent .tl_set:N = \l__eb_thm_headindent_tl, - headindent .initial:n = 0\ccwd, - spaceabove .tl_set:N = \l__eb_thm_spaceabove_tl, - spaceabove .initial:n = .75ex plus .1ex, - spacebelow .tl_set:N = \l__eb_thm_spacebelow_tl, - spacebelow .initial:n = .75ex plus .1ex +\eb_ctex_define:nn { thmset } + { + thmbox .bool_set:N = \l__eb_thmbox_bool, + thmbox .default:n = true, + thmbox .initial:n = false, + within .tl_set:N = \l__eb_thm_numberwith_tl, + within .initial:n = \bool_if:NT \l__eb_class_book_bool { chapter }, + bodyfont .tl_set:N = \l__eb_thm_bodyfont_tl, + bodyfont .initial:n = { }, + notefont .tl_set:N = \l__eb_thm_notefont_tl, + notefont .initial:n = { }, + headfont .tl_set:N = \l__eb_thm_headfont_tl, + headfont .initial:n = \color{ctex@emph}\sffamily, + headpunct .tl_set:N = \l__eb_thm_headpunct_tl, + headpunct .initial:n = { }, + spacepost .tl_set:N = \l__eb_thm_spacepost_tl, + spacepost .initial:n = \ccwd, + headindent .tl_set:N = \l__eb_thm_headindent_tl, + headindent .initial:n = 0\ccwd, + spaceabove .tl_set:N = \l__eb_thm_spaceabove_tl, + spaceabove .initial:n = .75ex plus .1ex, + spacebelow .tl_set:N = \l__eb_thm_spacebelow_tl, + spacebelow .initial:n = .75ex plus .1ex } \tl_const:Nn \c__eb_thmtools_keyval_tl { [ - spaceabove = \l__eb_thm_spaceabove_tl, - spacebelow = \l__eb_thm_spacebelow_tl, - headindent = \l__eb_thm_headindent_tl, - headfont = \l__eb_thm_headfont_tl, - notefont = \l__eb_thm_notefont_tl, - notebraces = {}{}, - bodyfont = \l__eb_thm_bodyfont_tl, - headpunct = \l__eb_thm_headpunct_tl, + spaceabove = \l__eb_thm_spaceabove_tl, + spacebelow = \l__eb_thm_spacebelow_tl, + headindent = \l__eb_thm_headindent_tl, + headfont = \l__eb_thm_headfont_tl, + notefont = \l__eb_thm_notefont_tl, + notebraces = {}{}, + bodyfont = \l__eb_thm_bodyfont_tl, + headpunct = \l__eb_thm_headpunct_tl, postheadspace = \l__eb_thm_spacepost_tl, - within = \l__eb_thm_numberwith_tl, - headformat = \NAME\space\NUMBER\NOTE + within = \l__eb_thm_numberwith_tl, + headformat = \NAME\space\NUMBER\NOTE ] } \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 { - {lemma}{引理}, - {example}{例}, - {theorem}{定理}, - {corollary}{推论}, - {definition}{定义}, - {proposition}{性质}, - {remark}{注}[numbered = no], - {{proof}{证明}[numbered = no,qed = \qedsymbol]} - }{\EbNewtheorem#1} + { lemma } { 引理 }, + { example } { 例 }, + { theorem } { 定理 }, + { corollary } { 推论 }, + { definition } { 定义 }, + { proposition } { 性质 }, + { remark } { 注 } [ numbered = no ], + { { proof } { 证明 } [ numbered = no,qed = \qedsymbol ] } + } + { \EbNewtheorem #1 } } -\ctex_at_end_package:nn {tasks} +\ctex_at_end_package:nn { tasks } { \settasks { - label = (\Alph*), - after-item-skip = 0ex plus .1ex, - column-sep = \ccwd, - item-indent = 2\ccwd, - label-width = 1.5\ccwd + label = (\Alph*), + column-sep = \ccwd, + item-indent = 2\ccwd, + label-width = 1.5\ccwd, + after-item-skip = 0ex plus .1ex } } \setchemformula { - math-scripts = false, - charge-hshift = 0.25\ccwd, - subscript-vshift = -0.2ex + math-scripts = false, + charge-hshift = 0.25\ccwd, + subscript-vshift = -0.2ex } \sisetup { detect-family, detect-weight, detect-shape, - detect-inline-family = math, - detect-inline-weight = math, + detect-inline-family = math, + detect-inline-weight = math, detect-display-math, - range-phrase = \ensuremath{\sim}, - range-units = single, table-parse-only, - group-digits = false + range-phrase = \ensuremath{\sim}, + range-units = single, + group-digits = false } \allowdisplaybreaks[4] -\tl_gset:Nn \ULthickness{.75pt} -\skip_set:Nn \jot{4pt plus 1pt minus 1pt} -\cs_new_protected:Npn \l__eb_math_restore:n #1 +\tl_gset:Nn \ULthickness { 0.75pt } +\skip_set:Nn \jot { 4pt plus 1pt minus 1pt } +\seq_const_from_clist:Nn \c__eb_math_spread_env_seq + { + array,matrix,pmatrix,bmatrix,Bmatrix,vmatrix,Vmatrix, + matrix*,pmatrix*,bmatrix*,Bmatrix*,vmatrix*,Vmatrix*, + cases,cases*,dcases,dcases*,rcases,rcases*,drcases,drcases*, + aligned,alignedat,gathered,multlined,lgathered,rgathered + } +\seq_map_inline:Nn \c__eb_math_spread_env_seq { \AtBeginEnvironment{#1} { @@ -2101,40 +2126,45 @@ The latest version of this license is in \selectfont\ignorespaces } } -\clist_map_inline:nn - { - array,matrix,pmatrix,bmatrix,Bmatrix,vmatrix,Vmatrix, - matrix*,pmatrix*,bmatrix*,Bmatrix*,vmatrix*,Vmatrix*, - 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 - {\collect@body} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} + { \collect@body } + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\collect@body + } \eb_patch_cmd:Nnn \start@align - {\collect@body} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} + { \collect@body } + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\collect@body + } \eb_patch_cmd:Nnn \start@multline - {\collect@body} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} + { \collect@body } + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\collect@body + } \eb_patch_cmd:Nnn \gather@split - {\spread@equation} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\spread@equation} + { \spread@equation } + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\spread@equation + } \ctex_after_end_preamble:n { - \skip_set:Nn \abovedisplayskip{5pt plus 1pt minus 1pt} - \skip_set:Nn \belowdisplayskip{5pt plus 1pt minus 1pt} - \skip_set:Nn \abovedisplayshortskip{0pt} - \skip_set:Nn \belowdisplayshortskip{5pt plus 1pt minus 1pt} + \skip_set:Nn \abovedisplayskip { 5pt plus 1pt minus 1pt } + \skip_set:Nn \belowdisplayskip { 5pt plus 1pt minus 1pt } + \skip_set:Nn \abovedisplayshortskip { 0pt } + \skip_set:Nn \belowdisplayshortskip { 5pt plus 1pt minus 1pt } } -\cs_gset:Npn \tagform@#1 - {\maketag@@@{\color{ctex@emph}(\ignorespaces#1\unskip\@@italiccorr)}} -\ctex_at_end_package:nn {unicode-math} - {\msg_redirect_module:nnn {unicode-math}{warning}{none}} +\cs_gset:Npn \tagform@ #1 + { \maketag@@@{\color{ctex@emph}(\ignorespaces #1\unskip\@@italiccorr)} } +\ctex_at_end_package:nn { unicode-math } + {\msg_redirect_module:nnn { unicode-math } { warning } { none } } -\ctex_at_end_package:nn {tcolorbox} +\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 = @@ -2164,16 +2194,16 @@ The latest version of this license is in before~skip = 3.75ex,after~skip = 2.5ex }, breakable, - boxsep = 0pt, - arc = 0pt, + boxsep = 0pt, + arc = 0pt, fonttitle = \sffamily, - boxrule = \l__eb_rule_width_dim + boxrule = \l__eb_rule_width_dim } - \NewDocumentEnvironment{outline}{D(){\abstractname}o+b} + \NewDocumentEnvironment{outline}{O{}D(){\abstractname}o+b} { - \begin{tcolorbox}[tc-outline,title = #1,IfValueT = {#2}{#2}] - \begin{outlinelist} - #3 + \begin{tcolorbox}[tc-outline,title = #2,IfValueT = {#3}{#3}] + \begin{outlinelist}[#1] + #4 \end{outlinelist} \end{tcolorbox} }{} @@ -2184,9 +2214,9 @@ The latest version of this license is in { \tcbox[ tc-exercise, - fuzzy~halo = 5pt~with~#3, - IfValueT = {#6}{#6}, - phantom = + fuzzy~halo = 5pt~with~#3, + IfValueT = {#6}{#6}, + phantom = \IfBooleanF{#1} { \CTEX@ifnametrue @@ -2197,8 +2227,8 @@ The latest version of this license is in ]{\IfBooleanF{#1}{\CTEXthesection\hspace{0.5\ccwd}}#5} }{ \group_begin: - \keys_set:nn {ctex/section}{format += \centering} - \IfValueT{#6}{\keys_set:nn {ctex/section}{#6}} + \keys_set:nn { ctex/section } { format += \centering } + \IfValueT{#6}{\keys_set:nn { ctex/section } {#6}} \IfBooleanTF{#1}{\section*{#5}}{\section{#5}} \group_end: }#7 @@ -2230,8 +2260,8 @@ The latest version of this license is in borderline~west = {3pt}{0pt}{#2}, IfBooleanTF = {#1} { - colback = white, - IfValueT = {#3}{title = #3}, + colback = white, + IfValueT = {#3}{title = #3}, top = 0pt,bottom = 0pt,toptitle = 0pt }{ colback = #2,colbacktitle = #2, @@ -2265,90 +2295,92 @@ The latest version of this license is in \tl_new:N \l__eb_bib_citestyle_tl \tl_new:N \l__eb_bib_file_tl -\eb_ctex_define:nn {bibset} +\eb_ctex_define:nn { bibset } { - backend .choice:, - backend/bibtex .code:n = {}, - backend/biblatex .code:n = - {\bool_set_false:N \l__eb_backend_bibtex_bool}, + backend .choice:, + backend/bibtex .code:n = { }, + backend/biblatex .code:n = + { \bool_set_false:N \l__eb_backend_bibtex_bool }, - bib-style .choice:, - bib-style .value_required:n = true, - bib-style/numerical .code:n = + bib-style .choice:, + bib-style .value_required:n = true, + bib-style/numerical .code:n = { - \tl_set:Nn \l__eb_bib_style_tl{#1} + \tl_set:Nn \l__eb_bib_style_tl {#1} \tl_clear:N \l__eb_bib_otherstyle_tl }, - bib-style/authoryear .code:n = + bib-style/authoryear .code:n = { - \tl_set:Nn \l__eb_bib_style_tl{#1} + \tl_set:Nn \l__eb_bib_style_tl {#1} \tl_clear:N \l__eb_bib_otherstyle_tl }, - bib-style/unknown .code:n = - {\tl_set_eq:NN \l__eb_bib_otherstyle_tl\l_keys_value_tl}, - bib-style .initial:n = numerical, + bib-style/unknown .code:n = + { \tl_set_eq:NN \l__eb_bib_otherstyle_tl \l_keys_value_tl }, + bib-style .initial:n = numerical, - 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, + 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, - bib-loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool, - bib-loadpkg .default:n = true, - bib-loadpkg .initial:n = true + bib-loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool, + bib-loadpkg .default:n = true, + bib-loadpkg .initial:n = true } \cs_new_protected:Npn \EbBibtexSet { \tl_if_empty:NTF \l__eb_bib_otherstyle_tl { - \tl_if_eq:NnT \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: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} + \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 } \tl_if_empty:NF \l__eb_bib_citestyle_tl - {\exp_args:NV \setcitestyle\l__eb_bib_citestyle_tl} - \skip_set:Nn \bibsep{0ex} + { \exp_args:NV \setcitestyle \l__eb_bib_citestyle_tl } + \skip_zero:N \bibsep \NewDocumentCommand{\printbibliography}{st+o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\bibname - \IfValueT{##3}{\keys_set:nn {eb/listoc}{##3}} + \tl_set_eq:NN \eb@toc@title \bibname + \IfValueT{##3}{ \keys_set:nn { eb/listoc } {##3} } \eb_multoc_pre_bool: \tl_set:Nn \bibsection - {\eb_title_number_intoc_bool:nn {##2}{##1}} - \exp_args:NV \bibliography\l__eb_bib_file_tl + { \eb_title_number_intoc_bool:nn {##2} {##1} } + \exp_args:NV \bibliography \l__eb_bib_file_tl \eb_multoc_post_bool: \group_end: } } \cs_new_protected:Npn \eb_put_biblatex:n #1 - {\PassOptionsToPackage{#1}{biblatex}} + { \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}} - \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_eq:NnT \l__eb_bib_style_tl { numerical } + { \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 } } \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 - \tl_gset:Nn \blx@default@theheading{bibintoc} + \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}} - \skip_set:Nn \bibitemsep{0ex} + \skip_zero:N \bibitemsep } \eb_at_end_preamble:n { @@ -2358,7 +2390,8 @@ The latest version of this license is in { \RequirePackage[sort&compress]{natbib} \EbBibtexSet - }{ + } + { \EbBiblatexPreset \RequirePackage{biblatex} \EbBiblatexPostset @@ -2373,42 +2406,42 @@ The latest version of this license is in \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont \exp_args:NNNo \group_end: - \dim_set:Nn \footnotesep{\dim_use:N \box_ht:N \strutbox} + \dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } \bool_if:NT \l__eb_chap_withpart_bool - {\counterwithin*{chapter}{part}} - \tl_if_eq:NnT \l__eb_foot_numberwith_tl{part} + { \counterwithin*{chapter}{part} } + \tl_if_eq:NnT \l__eb_foot_numberwith_tl { part } { \counterwithout*{footnote}{chapter} \counterwithin*{footnote}{part} } - \tl_if_eq:NnT \l__eb_foot_numberwith_tl{page} + \tl_if_eq:NnT \l__eb_foot_numberwith_tl { page } { \counterwithout*{footnote}{chapter} \counterwithin*{footnote}{page} } } \eb_patch_cmd:Nnn \@footnotetext - {\reset@font} + { \reset@font } { \linespread{\fp_use:N \l__eb_spread_footnote_fp} \selectfont\ignorespaces \l__eb_font_footnote_tl } \eb_patch_cmd:Nnn \@mpfootnotetext - {\reset@font} + { \reset@font } { \linespread{\fp_use:N \l__eb_spread_footnote_fp} \selectfont\ignorespaces \l__eb_font_footnote_tl } \eb_patch_cmd:Nnn \@makefnmark - {\normalfont}{\l__eb_font_footnote_tl} -\cs_gset:Npn \thempfootnote{\int_to_alph:n {\c@mpfootnote}} + { \normalfont } { \l__eb_font_footnote_tl } +\cs_gset:Npn \thempfootnote { \int_to_alph:n { \c@mpfootnote } } \lstdefinestyle{easy-listings} { - language = [LaTeX]TeX, - texcsstyle = + language = [LaTeX]TeX, + texcsstyle = { *\lst@ifdisplaystyle \bfseries\color{ctex@verb} @@ -2416,7 +2449,7 @@ The latest version of this license is in \color{ctex@verb} \fi }, - basicstyle = + basicstyle = { \ttfamily\lst@ifdisplaystyle \small @@ -2424,7 +2457,7 @@ The latest version of this license is in \color{ctex@verb} \fi }, - keywordstyle = + keywordstyle = { \lst@ifdisplaystyle \bfseries\color{ctex@verb} @@ -2432,58 +2465,58 @@ The latest version of this license is in \color{ctex@verb} \fi }, - framexleftmargin = 0pt, + framexleftmargin = 0pt, framexrightmargin = 0pt, - xleftmargin = 3pt, - xrightmargin = 3pt, - numbersep = 10pt, - framesep = 3pt, - frame = single, - rulecolor = \color{ctex@frame}, - commentstyle = \color{SlateGray}, - emphstyle = \color{ctex@emph}, - emph = {caption,multirow,subcaption,tabularx}, - morekeywords = + xleftmargin = 3pt, + xrightmargin = 3pt, + numbersep = 10pt, + framesep = 3pt, + frame = single, + rulecolor = \color{ctex@frame}, + commentstyle = \color{SlateGray}, + emphstyle = \color{ctex@emph}, + emph = {caption,multirow,subcaption,tabularx}, + morekeywords = { includegraphics,setmainfont,setsansfont,setmonofont,setCJKmainfont,setCJKsansfont,setCJKmonofont,setCJKfamilyfont,RequirePackage } } \lstset { - style = easy-listings, - breaklines = true, - resetmargins = true, - % numbers = left, - numberstyle = \footnotesize, - abovecaptionskip = -1ex, - belowcaptionskip = 1.5ex, - aboveskip = 1.5ex plus .2ex minus .1ex, - belowskip = 0.55ex plus .2ex minus .1ex, - keepspaces = true, - framerule = \l__eb_rule_width_dim, - columns = flexible + style = easy-listings, + breaklines = true, + resetmargins = true, + % numbers = left, + numberstyle = \footnotesize, + aboveskip = 1.5ex plus .2ex minus .1ex, + belowskip = 0.55ex plus .2ex minus .1ex, + keepspaces = true, + framerule = \l__eb_rule_width_dim, + columns = flexible, + abovecaptionskip = -1ex, + belowcaptionskip = 1.5ex } \lstloadlanguages{C,C++,Java,Python,Matlab} \clist_new:N \l__eb_hyperref_clist \cs_new_protected:Npn \eb_put_hyperref:n #1 - {\clist_put_right:Nn \l__eb_hyperref_clist{#1}} + { \clist_put_right:Nn \l__eb_hyperref_clist {#1} } \cs_new_protected:Npn \eb_define_linkcolor:nnn #1#2#3 - {\definecolorset{HTML}{ctex@}{}{link,#1;url,#2;cite,#3}} + { \definecolorset{HTML}{ctex@}{}{link,#1;url,#2;cite,#3} } \cs_new_protected:Npn \eb_define_themecolor:nnn #1#2#3 - {\definecolorset{HTML}{ctex@}{}{frame,#1;emph,#2;verb,#3}} + { \definecolorset{HTML}{ctex@}{}{frame,#1;emph,#2;verb,#3} } \cs_new_protected:Npn \eb_define_linkcolor:n #1 - {\definecolorset{HTML}{ctex@}{}{link,#1;url,#1;cite,#1}} + { \definecolorset{HTML}{ctex@}{}{link,#1;url,#1;cite,#1} } \cs_new_protected:Npn \eb_define_themecolor:n #1 - {\definecolorset{HTML}{ctex@}{}{frame,#1;emph,#1;verb,#1}} + { \definecolorset{HTML}{ctex@}{}{frame,#1;emph,#1;verb,#1} } \cs_new:Npn \eb_linkcolor_set:n #1 { - linkcolor/\clist_item:nn {#1}{1} .code:n = + linkcolor/\clist_item:nn {#1} {1} .code:n = { \eb_define_linkcolor:nnn - {\clist_item:nn {#1}{2}} - {\clist_item:nn {#1}{3}} - {\clist_item:nn {#1}{4}} + { \clist_item:nn {#1} {2} } + { \clist_item:nn {#1} {3} } + { \clist_item:nn {#1} {4} } \eb_put_hyperref:n { linkcolor = ctex@link,linkbordercolor = ctex@link, @@ -2494,88 +2527,91 @@ The latest version of this license is in } \cs_new:Npn \eb_themecolor_set:n #1 { - color/\clist_item:nn {#1}{1} .code:n = + color/\clist_item:nn {#1} {1} .code:n = { \eb_define_themecolor:nnn - {\clist_item:nn {#1}{2}} - {\clist_item:nn {#1}{3}} - {\clist_item:nn {#1}{4}} + { \clist_item:nn {#1} {2} } + { \clist_item:nn {#1} {3} } + { \clist_item:nn {#1} {4} } }, } \bool_set_false:N \l__eb_toc_number_color_bool -\eb_ctex_define:nn {link} +\eb_ctex_define:nn { link } { - hyperlink .choice:, - hyperlink/edge .code:n = {}, - hyperlink/none .code:n = \eb_put_hyperref:n {hidelinks}, + hyperlink .choice:, + hyperlink/edge .code:n = { }, + hyperlink/none .code:n = \eb_put_hyperref:n { hidelinks }, hyperlink/various .code:n = { \bool_set_true:N \l__eb_toc_number_color_bool - \eb_put_hyperref:n {colorlinks} + \eb_put_hyperref:n { colorlinks } }, - hyperlink .default:n = edge, - hyperlink .initial:n = edge, + hyperlink .default:n = edge, + hyperlink .initial:n = edge, - linktoc .choice:, - linktoc/unknown .code:n = + linktoc .choice:, + linktoc/unknown .code:n = { - \eb_put_hyperref:n {linktoc = #1} - \clist_map_inline:nn {page,none} + \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@number}{black}}} + \tl_if_eq:NnT \l_keys_value_tl {##1} + { + \clist_map_break:n + { \colorlet{ctex@toc@number}{black} } + } } }, - linktoc .default:n = all, - linktoc .initial:n = all, - unknown .code:n = + linktoc .default:n = all, + linktoc .initial:n = all, + unknown .code:n = { \eb_put_hyperref:x { \l_keys_key_str - \tl_if_empty:NF \l_keys_value_tl{ = {#1}} + \tl_if_empty:NF \l_keys_value_tl { = {#1} } } } } -\eb_ctex_define:nx {link} +\eb_ctex_define:nx { link } { - linkcolor .choice:, + linkcolor .choice:, \clist_map_function:nN { - {fresh, 62d71f,0000B2,005752}, - {cutepink, ff69b4,9d5196,57b5e5}, - {navyblue, 000080,004986,eb6877}, - {crimson, dc143c,00c1c9,afcd20} + { fresh, 62d71f,0000B2,005752 }, + { cutepink, ff69b4,9d5196,57b5e5 }, + { navyblue, 000080,004986,eb6877 }, + { crimson, dc143c,00c1c9,afcd20 } } \eb_linkcolor_set:n - linkcolor .default:n = navyblue, - linkcolor .initial:n = navyblue, - linkcol-all .code:n = - {\eb_define_linkcolor:n {\exp_not:n {#1}}} + linkcolor .default:n = navyblue, + linkcolor .initial:n = navyblue, + linkcol-all .code:n = + { \eb_define_linkcolor:n { \exp_not:n {#1} } } } \colorlet{ctex@toc@number}{ctex@link} -\eb_ctex_define:nx {style} +\eb_ctex_define:nx { style } { - color .choice:, - color .value_required:n = true, + color .choice:, + color .value_required:n = true, \clist_map_function:nN { - {none, 000000,000000,000000}, - {seaside, 4169e1,708090,9932cc}, - {energy, f39800,00a0e9,893895}, - {cyberpunk, 601986,eb6877,a4005b} + { none, 000000,000000,000000 }, + { seaside, 4169e1,708090,9932cc }, + { energy, f39800,00a0e9,893895 }, + { cyberpunk, 601986,eb6877,a4005b } } \eb_themecolor_set:n - color .initial:n = none, + 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_add_urlbreak_points: - {\tl_map_function:NN \c__eb_urlbreak_points_tl\do} + { \tl_map_function:NN \c__eb_urlbreak_points_tl\do } \eb_appto_cmd:Nn \UrlBreaks{\UrlOrds\eb_add_urlbreak_points:} } @@ -2590,23 +2626,23 @@ The latest version of this license is in \RequirePackage{hyperref} \urlstyle{same} \eb_allow_urlbreak: - \ctex_hypersetup:n {pdfstartview = FitH} - \exp_args:NV \hypersetup\l__eb_hyperref_clist + \ctex_hypersetup:n { pdfstartview = FitH } + \exp_args:NV \hypersetup \l__eb_hyperref_clist \labelformat{part}{\CTEXthepart} \labelformat{chapter}{\CTEXthechapter} \labelformat{figure}{\figurename~#1} \labelformat{table}{\tablename~#1} - \tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} + \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } { - \keys_set_known:nn {ctex} + \keys_set_known:nn { ctex } { - contentsname = 目\hspace{\ccwd}录, - indexname = 索\hspace{\ccwd}引, - listfigurename = 图片索引, - listtablename = 表格索引, - abstractname = 摘\hspace{\ccwd}要, - lstlistlistingname = 代码索引, - lstlistingname = 代码 + contentsname = 目\hspace{\ccwd}录, + indexname = 索\hspace{\ccwd}引, + listfigurename = 图片索引, + listtablename = 表格索引, + abstractname = 摘\hspace{\ccwd}要, + lstlistlistingname = 代码索引, + lstlistingname = 代码 } \labelformat{equation}{式(#1)} \labelformat{align}{式(#1)} @@ -2614,12 +2650,13 @@ The latest version of this license is in \labelformat{gather}{式(#1)} \labelformat{section}{节#1} \labelformat{subsection}{小节#1} - }{ - \keys_set_known:nn {ctex} + } + { + \keys_set_known:nn { ctex } { - abstractname = Abstract, - lstlistlistingname = List~of~Codes, - lstlistingname = Code + abstractname = Abstract, + lstlistlistingname = List~of~Codes, + lstlistingname = Code } \labelformat{equation}{Equation~(#1)} \labelformat{align}{Equation~(#1)} @@ -2633,59 +2670,59 @@ The latest version of this license is in \ctex_set:n { secnumdepth = 3, - tocdepth = \bool_if:NTF \l__eb_class_book_bool{1}{2}, + tocdepth = \bool_if:NTF \l__eb_class_book_bool { 1 } { 2 }, part = { pagestyle = empty, - tocline = \EbNumberline{#1}#2, - format = \color{ctex@frame}\sffamily\Huge, + tocline = \EbNumberline{#1}#2, + format = \color{ctex@frame}\sffamily\Huge, aftername = { \bool_if:NTF \l__eb_title_newline_bool - {\par\nobreak}{\hspace{\ccwd}} + { \par\nobreak } { \hspace{\ccwd} } } }, chapter = { - % pagestyle = fancy, - format = + % pagestyle = fancy, + format = { \color{ctex@frame}\sffamily\LARGE - \bool_if:NF \l__eb_title_newline_bool{\centering} + \bool_if:NF \l__eb_title_newline_bool { \centering } }, - aftername = + aftername = { \bool_if:NTF \l__eb_title_newline_bool - {\par\nobreak\vskip 1.5pc}{\hspace{\ccwd}} + { \par\nobreak\vskip 1.5pc } { \hspace{\ccwd} } }, - beforeskip = -1.5ex, - afterskip = 3ex, - lotskip = 0.8pc, - lofskip = 0.8pc + beforeskip = -1.5ex, + afterskip = 3ex, + lotskip = 0.8pc, + lofskip = 0.8pc }, section = { - hang = true, - format = \color{ctex@frame}\sffamily\Large, - aftername = \hspace{0.5\ccwd}, - beforeskip = 1.5ex plus .2ex minus .1ex, - afterskip = 1.5ex plus .2ex minus .1ex + hang = true, + format = \color{ctex@frame}\sffamily\Large, + aftername = \hspace{0.5\ccwd}, + beforeskip = 1.5ex plus .2ex minus .1ex, + afterskip = 1.5ex plus .2ex minus .1ex }, subsection = { - hang = true, - format = \color{ctex@frame}\sffamily\large, - aftername = \hspace{0.5\ccwd}, - beforeskip = 1.3ex plus .2ex minus .1ex, - afterskip = 1.3ex plus .2ex minus .1ex + hang = true, + format = \color{ctex@frame}\sffamily\large, + aftername = \hspace{0.5\ccwd}, + beforeskip = 1.3ex plus .2ex minus .1ex, + afterskip = 1.3ex plus .2ex minus .1ex }, subsubsection = { - hang = true, - format = \color{ctex@frame}\sffamily, - aftername = \hspace{0.5\ccwd}, - beforeskip = \parskip, - afterskip = \parskip + hang = true, + format = \color{ctex@frame}\sffamily, + aftername = \hspace{0.5\ccwd}, + beforeskip = \parskip, + afterskip = \parskip } } @@ -2693,8 +2730,8 @@ The latest version of this license is in { \ctex_set:n { - part/hang = true, - chapter/hang = true + part/hang = true, + chapter/hang = true } } % diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls index fa2594325ab..045531c7321 100644 --- a/Master/texmf-dist/tex/latex/easybook/easybook.cls +++ b/Master/texmf-dist/tex/latex/easybook/easybook.cls @@ -13,23 +13,29 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplClass{easybook}{2021/05/01}{1.24x}{beta} +\ProvidesExplClass{easybook}{2021/05/02}{1.24z}{beta} -\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_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 \eb_ctex_define:nn #1 - {\keys_define:nn {ctex/#1}} + { \keys_define:nn { ctex/#1 } } \cs_new_protected:Npn \eb_put_ctexbook:n #1 - {\PassOptionsToClass{#1}{ctexbook}} + { \PassOptionsToClass{#1}{ctexbook} } \cs_new_protected:Npn \eb_patch_cmd:Nnn #1#2#3 - {\ctex_patch_cmd_once:NnnnTF #1{}{#2}{#3}{}{\ctex_patch_failure:N #1}} + { + \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}} + { + \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}} -\cs_gset_eq:NN \PackageWarning\use_none:nn + { \ctex_gadd_ltxhook:nn { env/document/before } } +\cs_gset_eq:NN \PackageWarning \use_none:nn \bool_set_false:N \l__eb_compile_draft_bool \bool_set_false:N \l__eb_title_newline_bool @@ -39,76 +45,77 @@ \tl_new:N \g__eb_config_tl \clist_new:N \g__eb_options_clist -\keys_define:nn {easybook} +\keys_define:nn { easybook } { - 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}, + 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}}, - font/noto .code:n = + font .choices:nn = + { adobe,founder,mac,windows,none } + { \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 .value_required:n = true, - font .initial:n = overleaf, + font/overleaf .code:n = { }, + font/linux .code:n = \eb_put_ctexbook:n { fontset = ubuntu }, + font .value_required:n = true, + font .initial:n = overleaf, - paper .choice:, - paper .value_required:n = true, - paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, - paper .initial:n = a4paper, + paper .choice:, + paper .value_required:n = true, + paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, + paper .initial:n = a4paper, - oneside .value_forbidden:n = true, - twoside .value_forbidden:n = true, - oneside .code:n = + oneside .value_forbidden:n = true, + twoside .value_forbidden:n = true, + 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 = + twoside .code:n = { \bool_set_true:N \l__eb_page_twoside_bool - \eb_put_ctexbook:n {twoside} + \eb_put_ctexbook:n { twoside } }, - class .choice:, - class .value_required:n = true, - class/book .code:n = {}, - class/article .code:n = + class .choice:, + class .value_required:n = true, + class/book .code:n = { }, + class/article .code:n = { \bool_set_false:N \l__eb_class_book_bool - \keys_set:nn {easybook}{oneside} + \keys_set:nn { easybook } { oneside } }, - class .initial:n = book, + class .initial:n = book, - config .tl_set:N = \g__eb_config_tl, - unknown .code:n = - {\clist_gput_right:No \g__eb_options_clist{\CurrentOption}} + config .tl_set:N = \g__eb_config_tl, + unknown .code:n = + { \clist_gput_right:No \g__eb_options_clist { \CurrentOption } } } \ProcessKeysOptions{easybook} \clist_map_inline:nn { - {svgnames}{xcolor}, - {hang,stable}{footmisc}, - {normalem}{ulem}, - {protrusion = false}{microtype}, - {list = off}{bicaption}, - {shortlabels,inline}{enumitem}, - {many}{tcolorbox}, - {xindy}{imakeidx}, - {CJKmath = true}{xeCJK}, - {no-math}{fontspec}, - {noto,upint}{newtxmath} - }{\PassOptionsToPackage#1} -\eb_put_ctexbook:n {\g__eb_options_clist} + { svgnames } { xcolor }, + { hang,stable } { footmisc }, + { normalem } { ulem }, + { protrusion = false } { microtype }, + { list = off } { bicaption }, + { shortlabels,inline } { enumitem }, + { many } { tcolorbox }, + { xindy } { imakeidx }, + { CJKmath = true } { xeCJK }, + { no-math } { fontspec }, + { noto,upint } { newtxmath } + } + { \PassOptionsToPackage #1 } +\eb_put_ctexbook:n { \g__eb_options_clist } \LoadClass[UTF8]{ctexbook} \bool_new:N \l__eb_multoc_bool @@ -125,46 +132,46 @@ } \seq_map_inline:Nn \c__eb_options_path_seq { - \ctex_define:n {#1 .meta:nn = {ctex/#1}{##1}} - \cs_new:cpn {#1}##1{\keys_set:nn {ctex/#1}{##1}} + \ctex_define:n { #1 .meta:nn = { ctex/#1 } {##1} } + \cs_new:cpn {#1} ##1 { \keys_set:nn {ctex/#1} {##1} } } \ctex_define:n { - lstlistlistingname .tl_set:N = \lstlistlistingname, - lstlistingname .tl_set:N = \lstlistingname - } -\eb_ctex_define:nn {style} - { - multoc .bool_set:N = \l__eb_multoc_bool, - multoc .default:n = true, - withpart .bool_set:N = \l__eb_chap_withpart_bool, - withpart .default:n = true, - withpart .initial:n = false, - notomath .bool_set:N = \l__eb_notomath_bool, - notomath .default:n = true, - 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, - uppercase .default:n = true, - uppercase .initial:n = true, - - footwith .choices:nn = - {part,page,chapter} - {\tl_set_eq:NN \l__eb_foot_numberwith_tl\l_keys_choice_tl}, - footwith .value_required:n = true, - footwith .initial:n = chapter, - - figure-sep .tl_set:N = \l__eb_figure_separator_tl, - table-sep .tl_set:N = \l__eb_table_separator_tl, - listing-sep .tl_set:N = \l__eb_lstlisting_separator_tl, - equation-sep .tl_set:N = \l__eb_equation_separator_tl, - number-sep .meta:n = - { - figure-sep = {#1},table-sep = {#1}, - listing-sep = {#1},equation-sep = {#1} + lstlistlistingname .tl_set:N = \lstlistlistingname, + lstlistingname .tl_set:N = \lstlistingname + } +\eb_ctex_define:nn { style } + { + multoc .bool_set:N = \l__eb_multoc_bool, + multoc .default:n = true, + withpart .bool_set:N = \l__eb_chap_withpart_bool, + withpart .default:n = true, + withpart .initial:n = false, + notomath .bool_set:N = \l__eb_notomath_bool, + notomath .default:n = true, + 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, + uppercase .default:n = true, + uppercase .initial:n = true, + + footwith .choices:nn = + { part,page,chapter } + { \tl_set_eq:NN \l__eb_foot_numberwith_tl \l_keys_choice_tl }, + footwith .value_required:n = true, + footwith .initial:n = chapter, + + figure-sep .tl_set:N = \l__eb_figure_separator_tl, + table-sep .tl_set:N = \l__eb_table_separator_tl, + listing-sep .tl_set:N = \l__eb_lstlisting_separator_tl, + equation-sep .tl_set:N = \l__eb_equation_separator_tl, + number-sep .meta:n = + { + figure-sep = #1,table-sep = #1, + listing-sep = #1,equation-sep = #1 }, - number-sep .initial:n = {.} + number-sep .initial:n = { . } } \RequirePackage @@ -184,20 +191,20 @@ \ctex_at_end_preamble:n { \bool_if:NT \l__eb_notomath_bool - {\RequirePackage{newtxmath,bm}} + { \RequirePackage{newtxmath,bm} } } \ctex_at_end:n { \tl_if_empty:NF \g__eb_config_tl - {\file_input:n {\g__eb_config_tl}} + { \file_input:n { \g__eb_config_tl } } } \cs_new_protected:Npn \eb_package_later_bool:nn #1#2 { \@ifpackagelater{#1}{#2} - {}{\msg_warning:nnn {easybook}{package-old}{#1}} + {}{\msg_warning:nnn { easybook } { package-old } {#1}} } -\msg_new:nnn {easybook}{package-old} +\msg_new:nnn { easybook } { package-old } { Package~#1~has~been~out~of~date. \\ Some~problems~or~errors~may~occur \\ @@ -206,131 +213,133 @@ } \clist_map_inline:nn { - {expl3}{2020/10/27}, - {xparse}{2020/10/27}, - {l3keys2e}{2020/10/27}, - {ctex}{2020/10/19}, - {thmtools}{2020/08/01}, - {caption-light}{2020/08/24} - }{\eb_package_later_bool:nn #1} + { expl3 } { 2020/10/27 }, + { xparse } { 2020/10/27 }, + { l3keys2e } { 2020/10/27 }, + { ctex } { 2020/10/19 }, + { thmtools } { 2020/08/01 }, + { caption-light } { 2020/08/24 } + } + { \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_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_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 - {\__fontspec_main_setmainfont:nn {#2}{#1}} + { \__fontspec_main_setmainfont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setsansfont:nn #1#2 - {\__fontspec_main_setsansfont:nn {#2}{#1}} + { \__fontspec_main_setsansfont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setmonofont:nn #1#2 - {\__fontspec_main_setmonofont:nn {#2}{#1}} + { \__fontspec_main_setmonofont:nn {#2} {#1} } \cs_new_protected:Npn \eb_setCJKmainfont:nn #1#2 - {\eb_set_family:nnn {\CJKrmdefault}{#2}{#1}} + { \eb_set_family:nnn { \CJKrmdefault } {#2} {#1} } \cs_new_protected:Npn \eb_setCJKsansfont:nn #1#2 - {\eb_set_family:nnn {\CJKsfdefault}{#2}{#1}} + { \eb_set_family:nnn { \CJKsfdefault } {#2} {#1} } \cs_new_protected:Npn \eb_setCJKmonofont:nn #1#2 - {\eb_set_family:nnn {\CJKttdefault}{#2}{#1}} + { \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}} + { \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}} + { \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}} + { \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}} + { \eb_set_family:nnn { fangsong } {#2} {#1} } \tl_const:Nn \eb_option_zhfont_tl - {UprightFont = *,AutoFakeBold = 1.5,ItalicFont = *} + { UprightFont = *,AutoFakeBold = 1.5,ItalicFont = * } \cs_new_protected:Npx \eb_setCJKmainfont:n #1 - {\eb_setCJKmainfont:nn {#1}{\eb_option_zhfont_tl}} + { \eb_setCJKmainfont:nn {#1} { \eb_option_zhfont_tl } } \cs_new_protected:Npx \eb_setCJKsansfont:n #1 - {\eb_setCJKsansfont:nn {#1}{\eb_option_zhfont_tl}} + { \eb_setCJKsansfont:nn {#1} { \eb_option_zhfont_tl } } \cs_new_protected:Npx \eb_setCJKmonofont:n #1 - {\eb_setCJKmonofont:nn {#1}{\eb_option_zhfont_tl}} + { \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}} + { \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}} + { \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}} + { \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}} + { \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, + Extension = .ttf, UprightFont = *-Regular, - BoldFont = *-Bold, - ItalicFont = *-Italic + BoldFont = *-Bold, + ItalicFont = *-Italic } - \eb_setsansfont:nn {NotoSans} + \eb_setsansfont:nn { NotoSans } { - Extension = .ttf, + Extension = .ttf, UprightFont = *-Regular, - BoldFont = *-Bold, - ItalicFont = *-Italic + BoldFont = *-Bold, + ItalicFont = *-Italic } - \eb_setmonofont:nn {NotoSansMono} + \eb_setmonofont:nn { NotoSansMono } { - Extension = .ttf, + Extension = .ttf, UprightFont = *-Regular, - BoldFont = *-Bold + BoldFont = *-Bold } - \eb_setCJKmainfont:nn {FZShuSong-Z01S} + \eb_setCJKmainfont:nn { FZShuSong-Z01S } { UprightFont = *, - BoldFont = FZHei-B01S, - ItalicFont = FZKai-Z03S + 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_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}} + { \cs_if_exist:NF \kaishu { \cs_gset_eq:NN \kaishu \itshape } } \includepdfset{fitpaper = true} \geometry { - vmargin = 2.54cm, - hmargin = 3.17cm, - columnsep = 2\ccwd, - headheight = 2.04cm, - headsep = 0.5cm, - footskip = 0.79cm, - footnotesep = 0.5cm, - marginparsep = 8pt, - marginparwidth = 2.54cm + vmargin = 2.54cm, + hmargin = 3.17cm, + columnsep = 2\ccwd, + headheight = 2.04cm, + headsep = 0.5cm, + footskip = 0.79cm, + footnotesep = 0.5cm, + marginparsep = 8pt, + marginparwidth = 2.54cm } \clist_new:N \g__eb_geometry_clist -\eb_ctex_define:nn {geoset} +\eb_ctex_define:nn { geoset } { - footnotemargin .dim_set:N = \footnotemargin, - footnotemargin .initial:n = 0.5\ccwd, - footparskip .tl_set:N = \hangfootparskip, - footparskip .initial:n = 0ex, - footparindent .tl_set:N = \hangfootparindent, - footparindent .initial:n = 2\ccwd, - unknown .code:n = + footnotemargin .dim_set:N = \footnotemargin, + footnotemargin .initial:n = 0.5\ccwd, + footparskip .tl_set:N = \hangfootparskip, + footparskip .initial:n = 0ex, + footparindent .tl_set:N = \hangfootparindent, + footparindent .initial:n = 2\ccwd, + unknown .code:n = { \clist_gput_right:Nx \g__eb_geometry_clist { \l_keys_key_str - \tl_if_empty:NF \l_keys_value_tl{ = {#1}} + \tl_if_empty:NF \l_keys_value_tl { = {#1} } } } } @@ -340,8 +349,8 @@ \clearpage \bool_if:NT \l__eb_page_twoside_bool { - \int_if_odd:nF {\c@page} - {\hbox:n {}\thispagestyle{#1}\clearpage} + \int_if_odd:nF { \c@page } + { \hbox:n { }\thispagestyle{#1}\clearpage } } } \RenewDocumentCommand{\frontmatter}{sO{Roman}} @@ -356,67 +365,68 @@ \booltrue{@mainmatter} \pagenumbering{arabic} } -\cs_gset_eq:NN \easyhead\fancyhead -\cs_gset_eq:NN \easyfoot\fancyfoot -\eb_ctex_define:nn {hdrset} +\cs_gset_eq:NN \easyhead \fancyhead +\cs_gset_eq:NN \easyfoot \fancyfoot +\eb_ctex_define:nn { hdrset } { - head-foot .tl_set:N = \l__eb_fancyhf_content_tl, - head-foot .initial:n = + head-foot .tl_set:N = \l__eb_fancyhf_content_tl, + head-foot .initial:n = { \bool_if:NTF \l__eb_page_twoside_bool { \easyhead[EC]{\color{ctex@frame}\kaishu\leftmark} \easyhead[OC]{\color{ctex@frame}\kaishu\rightmark} \easyhead[EL,OR]{\color{ctex@frame}\thepage} - }{ + } + { \easyhead[L]{\color{ctex@frame}\kaishu\leftmark} \easyhead[R]{\color{ctex@frame}\thepage} } }, - chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, - chap-mark .initial:n = + chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, + chap-mark .initial:n = { - \int_compare:nT {\c@secnumdepth > -1} + \int_compare:nT { \c@secnumdepth > -1 } { \ifbool{@mainmatter} { - \int_if_odd:nT {\CTEX@chapter@numbering} - {\CTEXthechapter\hspace{\ccwd}} + \int_if_odd:nT { \CTEX@chapter@numbering } + { \CTEXthechapter\hspace{\ccwd} } }{} }#1 }, - sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, - sec-mark .initial:n = + sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, + sec-mark .initial:n = { - \int_compare:nT {\c@secnumdepth > 0} + \int_compare:nT { \c@secnumdepth > 0 } { - \int_if_odd:nT {\CTEX@section@numbering} - {\CTEXthesection\hspace{0.5\ccwd}} + \int_if_odd:nT { \CTEX@section@numbering } + { \CTEXthesection\hspace{0.5\ccwd} } }#1 }, - subsec-mark .cs_set:Np = \eb_fancyhf_subsection_mark:n #1, - subsec-mark .initial:n = + subsec-mark .cs_set:Np = \eb_fancyhf_subsection_mark:n #1, + subsec-mark .initial:n = { - \int_compare:nT {\c@secnumdepth > 1} + \int_compare:nT { \c@secnumdepth > 1 } { - \int_if_odd:nT {\CTEX@subsection@numbering} - {\CTEXthesubsection\hspace{0.5\ccwd}} + \int_if_odd:nT { \CTEX@subsection@numbering } + { \CTEXthesubsection\hspace{0.5\ccwd} } }#1 }, - headrule .tl_gset:N = \headrule, - headrule .initial:n = + headrule .tl_gset:N = \headrule, + headrule .initial:n = { \group_begin: \color{ctex@frame}\vspace*{1.5pt} \hrule width \textwidth height \l__eb_rule_width_dim \group_end: }, - footrule .tl_gset:N = \footrule, - footrule .initial:n = {}, - footnoterule .tl_gset:N = \footnoterule, - footnoterule .initial:n = + footrule .tl_gset:N = \footrule, + footrule .initial:n = { }, + footnoterule .tl_gset:N = \footnoterule, + footnoterule .initial:n = { \group_begin: \color{ctex@frame} @@ -428,185 +438,183 @@ \cs_new:Npn \eb_upper_number_mark_bool:nn #1#2 { \bool_if:NT \l__eb_uppercase_bool - {\text_uppercase:n}{\use:c {eb_fancyhf_#1_mark:n}{#2}} + { \text_uppercase:n } { \use:c { eb_fancyhf_#1_mark:n } {#2} } } -\cs_new:Npn \eb@number@markdouble#1#2 +\cs_new:Npn \eb@number@markdouble #1#2 { \markboth - {\eb_upper_number_mark_bool:nn {#1}{#2}} + {\eb_upper_number_mark_bool:nn {#1} {#2}} { \bool_if:NT \l__eb_page_twoside_bool - {\eb_upper_number_mark_bool:nn {#1}{#2}} + { \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}}} +\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 + \exp_args:NV \geometry \g__eb_geometry_clist \fancyhf{} \tl_use:N \l__eb_fancyhf_content_tl - \cs_gset_eq:NN \ps@plain\ps@empty + \cs_gset_eq:NN \ps@plain \ps@empty \pagestyle{fancy} \bool_if:NTF \l__eb_class_book_bool { - \cs_gset:Npn \chaptermark#1 - {\eb@number@markdouble{chapter}{#1}} - \cs_gset:Npn \sectionmark#1 - {\eb@number@markright{section}{#1}} - }{ - \cs_gset:Npn \sectionmark#1 - {\eb@number@markdouble{section}{#1}} - \cs_gset:Npn \subsectionmark#1 - {\eb@number@markright{subsection}{#1}} + \cs_gset:Npn \chaptermark #1 + { \eb@number@markdouble{chapter}{#1} } + \cs_gset:Npn \sectionmark #1 + { \eb@number@markright{section}{#1} } + } + { + \cs_gset:Npn \sectionmark #1 + { \eb@number@markdouble{section}{#1} } + \cs_gset:Npn \subsectionmark #1 + { \eb@number@markright{subsection}{#1} } } \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} } + { \easyhead[C]{\color{SlateGray}\sffamily\today} } \geometry{showframe} } } \seq_const_from_clist:Nn \c__eb_toc_headings_level_seq - {part,chapter,section,subsection,list} + { part,chapter,section,subsection,list } \seq_map_inline:Nn \c__eb_toc_headings_level_seq { - \ctex_define:n {tocset/#1 .meta:nn = {ctex/tocset/#1}{##1}} - \eb_ctex_define:nn {tocset} + \ctex_define:n { tocset/#1 .meta:nn = { ctex/tocset/#1 } {##1} } + \eb_ctex_define:nn { tocset } { - #1/format .tl_set:c = l__eb_toc_#1_format_tl, - #1/format+ .code:n = - {\tl_put_right:cn {l__eb_toc_#1_format_tl}{##1}}, + #1/format .tl_set:c = l__eb_toc_#1_format_tl, + #1/format+ .code:n = + { \tl_put_right:cn {l__eb_toc_#1_format_tl} {##1} }, #1/format~+ .code:n = - {\tl_put_right:cn {l__eb_toc_#1_format_tl}{##1}}, - #1/indent .tl_set:c = l__eb_toc_#1_indent_tl, - #1/rule .tl_set:c = l__eb_toc_#1_rule_tl, - #1/numsep .tl_set:c = eb@toc@#1@numsep + { \tl_put_right:cn {l__eb_toc_#1_format_tl} {##1} }, + #1/indent .tl_set:c = l__eb_toc_#1_indent_tl, + #1/rule .tl_set:c = l__eb_toc_#1_rule_tl, + #1/numsep .tl_set:c = eb@toc@#1@numsep } } -\cs_new:Npn \EbNumberline#1 +\cs_new:Npn \EbNumberline #1 { \CTEXifname { - \use:c {CTEXthe#1} - \hspace{\use:c {eb@toc@#1@numsep}} + \use:c { CTEXthe#1 } + \hspace{\use:c { eb@toc@#1@numsep }} }{} } \newbool{eb@titletoc@hang@fix} -\eb_ctex_define:nn {tocset} - { - list/lolskip .skip_set:N = \l__eb_toc_lolskip_skip, - list/lolskip .initial:n = 0.8pc, - list/belowoffset .dim_set:N = \l__eb_toc_listoffset_dim, - list/belowoffset .initial:n = - {\bool_if:NTF \l__eb_class_book_bool{0pc}{0.15pc}}, - belowoffset .dim_set:N = \l__eb_toc_offset_dim, - belowoffset .initial:n = - {\bool_if:NTF \l__eb_class_book_bool{-1pc}{-0.35pc}}, - tocline-fig .cs_set:Np = \eb@labelname@lof#1, - tocline-fig .initial:n = - { - \figurename\space#1 +\eb_ctex_define:nn { tocset } + { + list/lolskip .skip_set:N = \l__eb_toc_lolskip_skip, + list/lolskip .initial:n = 0.8pc, + list/belowoffset .dim_set:N = \l__eb_toc_listoffset_dim, + list/belowoffset .initial:n = + {\bool_if:NTF \l__eb_class_book_bool { 0pc } { 0.15pc } }, + + belowoffset .dim_set:N = \l__eb_toc_offset_dim, + belowoffset .initial:n = + { \bool_if:NTF \l__eb_class_book_bool { -1pc } { -0.35pc } }, + tocline-fig .cs_set:Np = \eb@labelname@lof #1, + tocline-fig .initial:n = + { + \figurename\space #1 \notbool{eb@titletoc@hang@fix} {\hspace{\eb@toc@list@numsep}}{} }, - tocline-tab .cs_set:Np = \eb@labelname@lot#1, - tocline-tab .initial:n = + tocline-tab .cs_set:Np = \eb@labelname@lot #1, + tocline-tab .initial:n = { - \tablename\space#1 + \tablename\space #1 \notbool{eb@titletoc@hang@fix} {\hspace{\eb@toc@list@numsep}}{} }, - tocline-lst .tl_set:N = \eb@labelname@lol, - tocline-lst .initial:n = + tocline-lst .tl_set:N = \eb@labelname@lol, + tocline-lst .initial:n = { \lstlistingname\space\thelstlisting \notbool{eb@titletoc@hang@fix} {\hspace{\eb@toc@list@numsep}}{} }, - line-align .bool_set:N = \l__eb_toc_line_align_bool, - line-align .default:n = true, - line-align .initial:n = true, + line-align .bool_set:N = \l__eb_toc_line_align_bool, + line-align .default:n = true, + line-align .initial:n = true, - hang .choice:, - hang/true .code:n = + hang .choice:, + hang/true .code:n = { \booltrue{eb@titletoc@hang@fix} \ctex_set:n { - chapter/tocline = \CTEXnumberline{##1}##2, - section/tocline = \CTEXnumberline{##1}##2, - subsection/tocline = \CTEXnumberline{##1}##2 + chapter/tocline = \CTEXnumberline{##1}##2, + section/tocline = \CTEXnumberline{##1}##2, + subsection/tocline = \CTEXnumberline{##1}##2 } }, - hang/false .code:n = + hang/false .code:n = { \ctex_set:n { - chapter/tocline = \EbNumberline{##1}##2, - section/tocline = \EbNumberline{##1}##2, - subsection/tocline = \EbNumberline{##1}##2 + chapter/tocline = \EbNumberline{##1}##2, + section/tocline = \EbNumberline{##1}##2, + subsection/tocline = \EbNumberline{##1}##2 } }, - hang .default:n = true, - hang .initial:n = false, + hang .default:n = true, + hang .initial:n = false, - numsep-all .meta:n = + numsep-all .meta:n = { - part/numsep = {#1}, - chapter/numsep = {#1}, - section/numsep = {#1}, - subsection/numsep = {#1}, - list/numsep = {#1} + part/numsep = #1, + chapter/numsep = #1, + section/numsep = #1, + subsection/numsep = #1, + list/numsep = #1 }, - indent-all .meta:n = - { - part/indent = {#1}, - chapter/indent = {#1}, - section/indent = {#1}, - subsection/indent = {#1}, - list/indent = {#1} + numsep-all .initial:n = \ccwd, + indent-all .meta:n = + { + part/indent = #1, + chapter/indent = #1, + section/indent = #1, + subsection/indent = #1, + list/indent = #1 }, - rule-all .meta:n = + rule-all .meta:n = { - part/rule = {#1}, - chapter/rule = {#1}, - section/rule = {#1}, - subsection/rule = {#1}, - list/rule = {#1} + part/rule = #1, + chapter/rule = #1, + section/rule = #1, + subsection/rule = #1, + list/rule = #1 } } -\ctex_set:nn {tocset} +\ctex_set:nn { tocset } { part/format = \addvspace{1pc}\sffamily\large, part/indent = 0\ccwd, - part/rule = \tocrule{}[\bfseries], - part/numsep = \ccwd, + part/rule = \tocrule{}[\bfseries], - chapter/format = \addvspace{1pc}\sffamily\large, - chapter/indent = 0\ccwd, - chapter/rule = \tocrule{$\cdot$}[\bfseries], - chapter/numsep = \ccwd, + chapter/format = \addvspace{1pc}\sffamily\large, + chapter/indent = 0\ccwd, + chapter/rule = \tocrule{$\cdot$}[\bfseries], - section/format = \addvspace{0.35pc}, - section/indent = - {\bool_if:NTF \l__eb_class_book_bool{1.5\ccwd}{0\ccwd}}, - section/rule = \tocrule{$\cdot$}, - section/numsep = \ccwd, + section/format = \addvspace{0.35pc}, + section/indent = + { \bool_if:NTF \l__eb_class_book_bool {1.5\ccwd } { 0\ccwd } }, + section/rule = \tocrule{$\cdot$}, subsection/format = \addvspace{0.35pc}, subsection/indent = - {\bool_if:NTF \l__eb_class_book_bool{3.8\ccwd}{1.4\ccwd}}, - subsection/rule = \tocrule{$\cdot$}, - subsection/numsep = \ccwd, + { \bool_if:NTF \l__eb_class_book_bool {3.8\ccwd } { 1.4\ccwd } }, + subsection/rule = \tocrule{$\cdot$}, list/format = \addvspace{0.2pc}, list/indent = 0\ccwd, - list/rule = \tocrule{$\cdot$}, - list/numsep = \ccwd + list/rule = \tocrule{$\cdot$} } \NewDocumentCommand{\tocrule}{sO{0.7pc}D(){1.2}mO{}} @@ -617,52 +625,53 @@ {\thecontentspage} { \bool_if:NTF \l__eb_toc_line_align_bool - {\contentspage}{\thecontentspage} + { \contentspage } { \thecontentspage } } } \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}} + [\use:c { l__eb_toc_#2_indent_tl }] + {\use:c { l__eb_toc_#2_format_tl }} { \ifbool{eb@titletoc@hang@fix} { \contentspush { \bool_if:NT \l__eb_toc_number_color_bool - {\color{ctex@toc@number}} + { \color{ctex@toc@number} } \thecontentslabel - \hspace{\use:c {eb@toc@#2@numsep}} + \hspace{\use:c { eb@toc@#2@numsep }} } }{} }{} - {\use:c {l__eb_toc_#2_rule_tl}} + {\use:c { l__eb_toc_#2_rule_tl }} } \contentsuse{lstlisting}{lol} \clist_map_inline:nn { - {part}{part}, - {chapter}{chapter}, - {section}{section}, - {subsection}{subsection}, - {figure}{list}, - {table}{list}, - {lstlisting}{list} - }{\eb_titlecontents_set:nn #1} + { part } { part }, + { chapter } { chapter }, + { section } { section }, + { subsection } { subsection }, + { figure } { list }, + { table } { list }, + { lstlisting } { list } + } + { \eb_titlecontents_set:nn #1 } \prop_new:N \l__eb_label_name_prop \prop_set_from_keyval:Nn \l__eb_label_name_prop { - figure = \eb@labelname@lof, - table = \eb@labelname@lot + figure = \eb@labelname@lof, + table = \eb@labelname@lot } -\cs_gset:Npn \caption@@@addcontentsline#1#2#3#4 +\cs_gset:Npn \caption@@@addcontentsline #1#2#3#4 { \addcontentsline{#1}{#2} { \ifbool{eb@titletoc@hang@fix}{\protect\numberline}{} - {\prop_item:Nn \l__eb_label_name_prop{#2}{#3}}{#4} + {\prop_item:Nn \l__eb_label_name_prop {#2}{#3}}#4 } } \ctex_patch_cmd:Nnn \lst@MakeCaption @@ -679,103 +688,107 @@ \eb_appto_cmd:Nn \@chapter { - \skip_if_eq:nnF {\l__eb_toc_lolskip_skip}{\c_zero_skip} + \skip_if_eq:nnF { \l__eb_toc_lolskip_skip } { \c_zero_skip } { \addtocontents{lol} {\protect\addvspace{\skip_use:N \l__eb_toc_lolskip_skip}} } \bool_if:NF \l__eb_class_book_bool - {\msg_error:nn {easybook}{no-chapter}} + { \msg_error:nn { easybook } { no-chapter } } } \eb_appto_cmd:Nn \@schapter { \bool_if:NF \l__eb_class_book_bool - {\msg_error:nn {easybook}{no-chapter}} + { \msg_error:nn { easybook } { no-chapter } } } -\msg_new:nnn {easybook}{no-chapter} +\msg_new:nnn { easybook } { no-chapter } { Your~document~class~is~in~article~mode. \\ The~\string\chapter\space~command~will~not~be~used. } -\tl_set:Nn \l__eb_toc_type_tl{book} -\keys_define:nn {eb/listoc} +\tl_set:Nn \l__eb_toc_type_tl { book } +\keys_define:nn { eb/listoc } { - article .code:n = \tl_set:Nn \l__eb_toc_type_tl{article}, - book .code:n = {}, - multoc .bool_set:N = \l__eb_multoc_bool, - multoc .default:n = true, - multoc .initial:n = false, - title .tl_set:N = \eb@toc@title + article .code:n = \tl_set:Nn \l__eb_toc_type_tl { article }, + book .code:n = { }, + multoc .bool_set:N = \l__eb_multoc_bool, + multoc .default:n = true, + multoc .initial:n = false, + title .tl_set:N = \eb@toc@title } \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}} + { \text_uppercase:n {#1} } + { \text_titlecase_first:n {#1} } } -\cs_new:Npn \eb@nonumber@markdouble#1 +\cs_new:Npn \eb@nonumber@markdouble #1 { \markboth {\eb_upper_nonumber_mark_bool:n {#1}} { \bool_if:NT \l__eb_page_twoside_bool - {\eb_upper_nonumber_mark_bool:n {#1}} + { \eb_upper_nonumber_mark_bool:n {#1} } } } -\cs_new:Npn \eb@nonumber@markright#1 - {\markright{\eb_upper_nonumber_mark_bool:n {#1}}} +\cs_new:Npn \eb@nonumber@markright #1 + { \markright{\eb_upper_nonumber_mark_bool:n {#1}} } \cs_new_protected:Npn \eb_title_mark_intoc:n #1 { - \tl_if_eq:NnTF \l__eb_toc_type_tl{book} + \tl_if_eq:NnTF \l__eb_toc_type_tl { book } { - \chapter*{\phantomsection#1} + \chapter*{\phantomsection #1} \CTEX@addtocline{chapter}{#1} \eb@nonumber@markdouble{#1} - }{ - \section*{\phantomsection#1} + } + { + \section*{\phantomsection #1} \CTEX@addtocline{section}{#1} \bool_if:NTF \l__eb_class_book_bool - {\eb@nonumber@markright{#1}} - {\eb@nonumber@markdouble{#1}} + { \eb@nonumber@markright{#1} } + { \eb@nonumber@markdouble{#1} } } } \cs_new_protected:Npn \eb_title_mark_notoc:n #1 { - \tl_if_eq:NnTF \l__eb_toc_type_tl{book} + \tl_if_eq:NnTF \l__eb_toc_type_tl { book } { - \chapter*{\phantomsection#1} + \chapter*{\phantomsection #1} \eb@nonumber@markdouble{#1} - }{ - \section*{\phantomsection#1} + } + { + \section*{\phantomsection #1} \bool_if:NTF \l__eb_class_book_bool - {\eb@nonumber@markright{#1}} - {\eb@nonumber@markdouble{#1}} + { \eb@nonumber@markright{#1} } + { \eb@nonumber@markdouble{#1} } } } \cs_new_protected:Npn \eb_title_number_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}} - }{ + \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}} + { \eb_title_mark_notoc:n {\eb@toc@title} } + { \eb_title_mark_intoc:n {\eb@toc@title} } } } \cs_new_protected:Npn \eb_class_title_level_bool:n #1 { \bool_if:NTF \l__eb_class_book_bool { - \chapter*{\phantomsection#1} + \chapter*{\phantomsection #1} \CTEX@addtocline{chapter}{#1} - }{ - \section*{\phantomsection#1} + } + { + \section*{\phantomsection #1} \CTEX@addtocline{section}{#1} } \eb@nonumber@markdouble{#1} @@ -787,25 +800,26 @@ \ifbool{@twocolumn} { \booltrue{@restonecol} - \bool_if:NTF \l__eb_multoc_bool{\twocolumn}{\onecolumn} + \bool_if:NTF \l__eb_multoc_bool {\twocolumn } { \onecolumn } }{ \boolfalse{@restonecol} - \bool_if:NT \l__eb_multoc_bool{\twocolumn} + \bool_if:NT \l__eb_multoc_bool { \twocolumn } } - }{\tl_set:Nn \l__eb_toc_type_tl{article}} + } + { \tl_set:Nn \l__eb_toc_type_tl { article } } } \cs_new_protected:Npn \eb_multoc_post_bool: { \bool_if:NT \l__eb_class_book_bool - {\ifbool{@restonecol}{\twocolumn}{\onecolumn}} + { \ifbool{@restonecol}{\twocolumn}{\onecolumn} } } \RenewDocumentCommand{\tableofcontents}{o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\contentsname - \IfValueT{#1}{\keys_set:nn {eb/listoc}{#1}} + \tl_set_eq:NN \eb@toc@title \contentsname + \IfValueT{#1}{\keys_set:nn { eb/listoc } {#1}} \eb_multoc_pre_bool: - \eb_title_mark_notoc:n {\eb@toc@title} + \eb_title_mark_notoc:n { \eb@toc@title } \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{toc} \eb_multoc_post_bool: @@ -814,11 +828,11 @@ \RenewDocumentCommand{\listoffigures}{st+o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\listfigurename - \IfValueT{#3}{\keys_set:nn {eb/listoc}{#3}} + \tl_set_eq:NN \eb@toc@title \listfigurename + \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \eb_multoc_pre_bool: - \eb_title_number_intoc_bool:nn {#2}{#1} - \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listoffset_dim + \eb_title_number_intoc_bool:nn {#2} {#1} + \dim_add:NV \l__eb_toc_offset_dim \l__eb_toc_listoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lof} \eb_multoc_post_bool: @@ -827,11 +841,11 @@ \RenewDocumentCommand{\listoftables}{st+o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\listtablename - \IfValueT{#3}{\keys_set:nn {eb/listoc}{#3}} + \tl_set_eq:NN \eb@toc@title \listtablename + \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \eb_multoc_pre_bool: - \eb_title_number_intoc_bool:nn {#2}{#1} - \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listoffset_dim + \eb_title_number_intoc_bool:nn {#2} {#1} + \dim_add:NV \l__eb_toc_offset_dim \l__eb_toc_listoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lot} \eb_multoc_post_bool: @@ -840,38 +854,38 @@ \NewDocumentCommand{\listoflistings}{st+o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\lstlistlistingname - \IfValueT{#3}{\keys_set:nn {eb/listoc}{#3}} + \tl_set_eq:NN \eb@toc@title \lstlistlistingname + \IfValueT{#3}{\keys_set:nn { eb/listoc } {#3}} \eb_multoc_pre_bool: - \eb_title_number_intoc_bool:nn {#2}{#1} - \dim_add:NV \l__eb_toc_offset_dim\l__eb_toc_listoffset_dim + \eb_title_number_intoc_bool:nn {#2} {#1} + \dim_add:NV \l__eb_toc_offset_dim \l__eb_toc_listoffset_dim \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{lol} \eb_multoc_post_bool: \group_end: } -\ctex_at_end_package:nn {imakeidx} +\ctex_at_end_package:nn { imakeidx } { \makeindex[ - options = -M~texindy~-C~utf8, - program = truexindy, - columns = 2, + options = -M~texindy~-C~utf8, + program = truexindy, + columns = 2, columnsep = 2\ccwd ] \RenewDocumentCommand{\printindex}{st+D(){\imki@jobname}o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\indexname - \cs_set_eq:NN \imki@indexlevel\use_none:n + \tl_set_eq:NN \eb@toc@title \indexname + \cs_set_eq:NN \imki@indexlevel \use_none:n \setkeys{imki}{intoc = false} - \IfValueT{#4}{\keys_set:nn {eb/listoc}{#4}} + \IfValueT{#4}{\keys_set:nn { eb/listoc } {#4}} \bool_if:NF \l__eb_class_book_bool - {\tl_set:Nn \l__eb_toc_type_tl{article}} + { \tl_set:Nn \l__eb_toc_type_tl { article } } \tl_set:Nn \imki@indexheaders { - \eb_title_number_intoc_bool:nn {#2}{#1} - \cs_set_eq:NN \thispagestyle\use_none:n + \eb_title_number_intoc_bool:nn {#2} {#1} + \cs_set_eq:NN \thispagestyle \use_none:n \cs_undefine:N \imki@firstpagestyle } \imki@putindex{#3} @@ -884,18 +898,18 @@ \tl_new:N \l__eb_font_listing_tl \tl_new:N \l__eb_font_footnote_tl -\eb_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, - figure-cap .tl_set:N = \l__eb_font_figure_tl, - figure-cap .initial:n = \sffamily\small, - listing-cap .tl_set:N = \l__eb_font_listing_tl, - listing-cap .initial:n = \sffamily\small, - footnote .tl_set:N = \l__eb_font_footnote_tl, - footnote .initial:n = \rmfamily, - marginpar .tl_set:N = \marginfont, - marginpar .initial:n = \rmfamily\footnotesize + table-cap .tl_set:N = \l__eb_font_table_tl, + table-cap .initial:n = \sffamily\small, + figure-cap .tl_set:N = \l__eb_font_figure_tl, + figure-cap .initial:n = \sffamily\small, + listing-cap .tl_set:N = \l__eb_font_listing_tl, + listing-cap .initial:n = \sffamily\small, + footnote .tl_set:N = \l__eb_font_footnote_tl, + footnote .initial:n = \rmfamily, + marginpar .tl_set:N = \marginfont, + marginpar .initial:n = \rmfamily\footnotesize } \DeclareCaptionLabelSeparator{ccwd}{\hspace{\ccwd}} @@ -905,14 +919,13 @@ \DeclareCaptionFont{eb@listing@font}{\l__eb_font_listing_tl} \captionsetup { - format = hang, - % figurewithin = section, - % tablewithin = section, + format = hang, font = {stretch = {\fp_use:N \l__eb_spread_caption_fp}}, - labelfont = {color = ctex@frame}, - labelsep = ccwd, + labelfont = {color = ctex@frame}, + labelsep = ccwd, singlelinecheck = true, - belowskip = 0pt,aboveskip = 10pt + belowskip = 0pt, + aboveskip = 10pt } \captionsetup[table]{font += eb@table@font} \captionsetup[figure]{font += eb@figure@font} @@ -920,38 +933,39 @@ \captionsetup[subfigure] { labelformat = parens, - font += eb@figure@font, - belowskip = 2pt,aboveskip = 6pt + font+ = eb@figure@font, + belowskip = 2pt, + aboveskip = 6pt } -\ctex_at_end_package:nn {bicaption} +\ctex_at_end_package:nn { bicaption } { \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_gset:cpn { thesection } + { + \int_compare:nT { \c@chapter > 0 } { \thechapter. } + \eb_arabic:n { section } + } +\seq_const_from_clist:Nn \c__eb_serial_number_counter_seq + { 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:nT {\c@chapter > 0} + \int_compare:nT { \c@chapter > 0 } { \thechapter - \use:c {l__eb_#1_separator_tl} + \use:c { l__eb_#1_separator_tl } } \eb_arabic:n {#1} } } -\cs_gset:cpn {thesection} - { - \int_compare:nT {\c@chapter > 0}{\thechapter.} - \eb_arabic:n {section} - } -\clist_map_inline:nn - {figure,table,lstlisting,equation} - {\eb_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} @@ -960,7 +974,8 @@ \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} @@ -968,22 +983,22 @@ \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 = {}} + \ctex_set:nn { appendix }{ number = \@Alph\c@section,name = { } } } } \AtBeginEnvironment{tabularx} { - \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_table_fp} + \exp_args:Nx \linespread { \fp_use:N \l__eb_spread_table_fp } \selectfont\ignorespaces } \AtBeginEnvironment{tabular} { - \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_table_fp} + \exp_args:Nx \linespread { \fp_use:N \l__eb_spread_table_fp } \selectfont\ignorespaces } \ctex_after_end_preamble:n { - \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_line_fp} + \exp_args:Nx \linespread { \fp_use:N \l__eb_spread_line_fp } \selectfont\ignorespaces } @@ -993,38 +1008,38 @@ \fp_new:N \l__eb_spread_caption_fp \fp_new:N \l__eb_spread_footnote_fp -\eb_ctex_define:nn {spread} - { - line .fp_set:N = \l__eb_spread_line_fp, - line .initial:n = 1.3, - table .fp_set:N = \l__eb_spread_table_fp, - table .initial:n = 1.05, - math .fp_set:N = \l__eb_spread_math_fp, - math .initial:n = 1.05, - caption .fp_set:N = \l__eb_spread_caption_fp, - caption .initial:n = 1, - footnote .fp_set:N = \l__eb_spread_footnote_fp, - footnote .initial:n = 1, - spread-all .meta:n = - { - line = {#1},table = {#1},math = {#1}, - caption = {#1},footnote = {#1} +\eb_ctex_define:nn { spread } + { + line .fp_set:N = \l__eb_spread_line_fp, + line .initial:n = 1.3, + table .fp_set:N = \l__eb_spread_table_fp, + table .initial:n = 1.05, + math .fp_set:N = \l__eb_spread_math_fp, + math .initial:n = 1.05, + caption .fp_set:N = \l__eb_spread_caption_fp, + caption .initial:n = 1, + footnote .fp_set:N = \l__eb_spread_footnote_fp, + footnote .initial:n = 1, + spread-all .meta:n = + { + line = #1,table = #1,math = #1, + caption = #1,footnote = #1 } } -\skip_set:Nn \parskip{0pt plus 2pt minus 1pt} -\skip_set:Nn \floatsep{12pt plus 2pt minus 2pt} -\skip_set:Nn \intextsep{14pt plus 2pt minus 2pt} -\skip_set:Nn \textfloatsep{16pt plus 2pt minus 4pt} -\skip_set:Nn \dbltextfloatsep{16pt plus 2pt minus 4pt} -\skip_set:Nn \@fpsep{8pt plus 2.0fil} +\skip_set:Nn \parskip { 0pt plus 2pt minus 1pt } +\skip_set:Nn \floatsep { 12pt plus 2pt minus 2pt } +\skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt } +\skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt } +\skip_set:Nn \dbltextfloatsep { 16pt plus 2pt minus 4pt } +\skip_set:Nn \@fpsep { 8pt plus 2.0fil } \setcounter{topnumber}{4} \setcounter{bottomnumber}{4} \setcounter{totalnumber}{8} -\tl_gset:Nn \textfraction{0.18} -\tl_gset:Nn \topfraction{0.85} -\tl_gset:Nn \bottomfraction{0.65} -\tl_gset:Nn \floatpagefraction{0.60} +\tl_gset:Nn \textfraction { 0.18 } +\tl_gset:Nn \topfraction { 0.85 } +\tl_gset:Nn \bottomfraction { 0.65 } +\tl_gset:Nn \floatpagefraction { 0.60 } \newcolumntype{L}{X} \newcolumntype{C}{>{\centering\arraybackslash}X} @@ -1033,18 +1048,21 @@ \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} \cs_new_protected:Npn \eb_enumitem_labelval_set:nn #1#2 - {\SetEnumitemValue{label}{#1}{\color{ctex@emph}#2}} + { \SetEnumitemValue{label}{#1}{\color{ctex@emph}#2} } \clist_map_inline:nn { - {bullet}{\textbullet}, - {endash}{\normalfont\bfseries\textendash}, - {asterisk}{\textasteriskcentered}, - {arabic}{\arabic*.}, - {alph}{(\alph*)}, - {roman}{\roman*.}, - {outline}{\upshape\ding{111}} - }{\eb_enumitem_labelval_set:nn #1} + { bullet } { \textbullet }, + { endash } { \normalfont\bfseries\textendash }, + { asterisk } { \textasteriskcentered }, + { arabic } { \arabic*. }, + { alph } { (\alph*) }, + { roman } { \roman*. }, + { outline } { \upshape\ding{111} } + } + { \eb_enumitem_labelval_set:nn #1 } \SetEnumitemValue{font}{sf}{\color{ctex@emph}\normalfont\sffamily} +\SetEnumitemValue{ref}{enumii}{\arabic{enumi}.\alph*} +\SetEnumitemValue{ref}{enumiii}{\arabic{enumi}.\alph{enumii}.\roman*} \setlist { labelsep = .75\ccwd,listparindent = 2\ccwd,leftmargin = *, @@ -1057,26 +1075,25 @@ \setlist[itemize,2]{label = endash} \setlist[itemize,3]{label = asterisk} \setlist[enumerate,1]{label = arabic,ref = \arabic*} -\setlist[enumerate,2]{label = alph,ref = \arabic{enumi}.\alph*} -\setlist[enumerate,3]{label = roman,ref = \arabic{enumi}.\alph{enumii}.\roman*} -\setlist*[enumerate,3]{labelwidth = *} +\setlist[enumerate,2]{label = alph,ref = enumii} +\setlist[enumerate,3]{label = roman,ref = enumiii,labelwidth = *} \setlist[description]{font = sf,labelwidth = *,leftmargin = 2\ccwd} \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}} - {\tl_const:cn {c__eb_name_#1_tl}{#2}} + \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } + { \tl_const:cn { c__eb_name_#1_tl } {#3} } + { \tl_const:cn { c__eb_name_#1_tl } {#2} } } \NewDocumentCommand{\EbNewtheorem} {mO{\text_titlecase_first:n {#1}}mD(){tc-theorem}O{}} { \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}, + name = \use:c { c__eb_name_#1_tl }, style = easy-theorem,#5 }{#1}[] \bool_if:NT \l__eb_thmbox_bool @@ -1084,7 +1101,7 @@ \@ifpackageloaded{tcolorbox} {\tcolorboxenvironment{#1}{#4}}{} } - \labelformat{#1}{\use:c {c__eb_name_#1_tl}~##1} + \labelformat{#1}{\use:c { c__eb_name_#1_tl }~##1} } } @@ -1099,99 +1116,107 @@ \RenewDocumentCommand{\newtheorem}{O{}m} {\AfterPreamble{\declaretheorem[#1]{#2}}} -\eb_ctex_define:nn {thmset} - { - thmbox .bool_set:N = \l__eb_thmbox_bool, - thmbox .default:n = true, - thmbox .initial:n = false, - within .tl_set:N = \l__eb_thm_numberwith_tl, - within .initial:n = \bool_if:NT \l__eb_class_book_bool{chapter}, - bodyfont .tl_set:N = \l__eb_thm_bodyfont_tl, - bodyfont .initial:n = {}, - notefont .tl_set:N = \l__eb_thm_notefont_tl, - notefont .initial:n = {}, - headfont .tl_set:N = \l__eb_thm_headfont_tl, - headfont .initial:n = \color{ctex@emph}\sffamily, - headpunct .tl_set:N = \l__eb_thm_headpunct_tl, - headpunct .initial:n = {}, - spacepost .tl_set:N = \l__eb_thm_spacepost_tl, - spacepost .initial:n = \ccwd, - headindent .tl_set:N = \l__eb_thm_headindent_tl, - headindent .initial:n = 0\ccwd, - spaceabove .tl_set:N = \l__eb_thm_spaceabove_tl, - spaceabove .initial:n = .75ex plus .1ex, - spacebelow .tl_set:N = \l__eb_thm_spacebelow_tl, - spacebelow .initial:n = .75ex plus .1ex +\eb_ctex_define:nn { thmset } + { + thmbox .bool_set:N = \l__eb_thmbox_bool, + thmbox .default:n = true, + thmbox .initial:n = false, + within .tl_set:N = \l__eb_thm_numberwith_tl, + within .initial:n = \bool_if:NT \l__eb_class_book_bool { chapter }, + bodyfont .tl_set:N = \l__eb_thm_bodyfont_tl, + bodyfont .initial:n = { }, + notefont .tl_set:N = \l__eb_thm_notefont_tl, + notefont .initial:n = { }, + headfont .tl_set:N = \l__eb_thm_headfont_tl, + headfont .initial:n = \color{ctex@emph}\sffamily, + headpunct .tl_set:N = \l__eb_thm_headpunct_tl, + headpunct .initial:n = { }, + spacepost .tl_set:N = \l__eb_thm_spacepost_tl, + spacepost .initial:n = \ccwd, + headindent .tl_set:N = \l__eb_thm_headindent_tl, + headindent .initial:n = 0\ccwd, + spaceabove .tl_set:N = \l__eb_thm_spaceabove_tl, + spaceabove .initial:n = .75ex plus .1ex, + spacebelow .tl_set:N = \l__eb_thm_spacebelow_tl, + spacebelow .initial:n = .75ex plus .1ex } \tl_const:Nn \c__eb_thmtools_keyval_tl { [ - spaceabove = \l__eb_thm_spaceabove_tl, - spacebelow = \l__eb_thm_spacebelow_tl, - headindent = \l__eb_thm_headindent_tl, - headfont = \l__eb_thm_headfont_tl, - notefont = \l__eb_thm_notefont_tl, - notebraces = {}{}, - bodyfont = \l__eb_thm_bodyfont_tl, - headpunct = \l__eb_thm_headpunct_tl, + spaceabove = \l__eb_thm_spaceabove_tl, + spacebelow = \l__eb_thm_spacebelow_tl, + headindent = \l__eb_thm_headindent_tl, + headfont = \l__eb_thm_headfont_tl, + notefont = \l__eb_thm_notefont_tl, + notebraces = {}{}, + bodyfont = \l__eb_thm_bodyfont_tl, + headpunct = \l__eb_thm_headpunct_tl, postheadspace = \l__eb_thm_spacepost_tl, - within = \l__eb_thm_numberwith_tl, - headformat = \NAME\space\NUMBER\NOTE + within = \l__eb_thm_numberwith_tl, + headformat = \NAME\space\NUMBER\NOTE ] } \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 { - {lemma}{引理}, - {example}{例}, - {theorem}{定理}, - {corollary}{推论}, - {definition}{定义}, - {proposition}{性质}, - {remark}{注}[numbered = no], - {{proof}{证明}[numbered = no,qed = \qedsymbol]} - }{\EbNewtheorem#1} + { lemma } { 引理 }, + { example } { 例 }, + { theorem } { 定理 }, + { corollary } { 推论 }, + { definition } { 定义 }, + { proposition } { 性质 }, + { remark } { 注 } [ numbered = no ], + { { proof } { 证明 } [ numbered = no,qed = \qedsymbol ] } + } + { \EbNewtheorem #1 } } -\ctex_at_end_package:nn {tasks} +\ctex_at_end_package:nn { tasks } { \settasks { - label = (\Alph*), - after-item-skip = 0ex plus .1ex, - column-sep = \ccwd, - item-indent = 2\ccwd, - label-width = 1.5\ccwd + label = (\Alph*), + column-sep = \ccwd, + item-indent = 2\ccwd, + label-width = 1.5\ccwd, + after-item-skip = 0ex plus .1ex } } \setchemformula { - math-scripts = false, - charge-hshift = 0.25\ccwd, - subscript-vshift = -0.2ex + math-scripts = false, + charge-hshift = 0.25\ccwd, + subscript-vshift = -0.2ex } \sisetup { detect-family, detect-weight, detect-shape, - detect-inline-family = math, - detect-inline-weight = math, + detect-inline-family = math, + detect-inline-weight = math, detect-display-math, - range-phrase = \ensuremath{\sim}, - range-units = single, table-parse-only, - group-digits = false + range-phrase = \ensuremath{\sim}, + range-units = single, + group-digits = false } \allowdisplaybreaks[4] -\tl_gset:Nn \ULthickness{.75pt} -\skip_set:Nn \jot{4pt plus 1pt minus 1pt} -\cs_new_protected:Npn \l__eb_math_restore:n #1 +\tl_gset:Nn \ULthickness { 0.75pt } +\skip_set:Nn \jot { 4pt plus 1pt minus 1pt } +\seq_const_from_clist:Nn \c__eb_math_spread_env_seq + { + array,matrix,pmatrix,bmatrix,Bmatrix,vmatrix,Vmatrix, + matrix*,pmatrix*,bmatrix*,Bmatrix*,vmatrix*,Vmatrix*, + cases,cases*,dcases,dcases*,rcases,rcases*,drcases,drcases*, + aligned,alignedat,gathered,multlined,lgathered,rgathered + } +\seq_map_inline:Nn \c__eb_math_spread_env_seq { \AtBeginEnvironment{#1} { @@ -1199,40 +1224,45 @@ \selectfont\ignorespaces } } -\clist_map_inline:nn - { - array,matrix,pmatrix,bmatrix,Bmatrix,vmatrix,Vmatrix, - matrix*,pmatrix*,bmatrix*,Bmatrix*,vmatrix*,Vmatrix*, - 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 - {\collect@body} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} + { \collect@body } + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\collect@body + } \eb_patch_cmd:Nnn \start@align - {\collect@body} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} + { \collect@body } + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\collect@body + } \eb_patch_cmd:Nnn \start@multline - {\collect@body} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\collect@body} + { \collect@body } + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\collect@body + } \eb_patch_cmd:Nnn \gather@split - {\spread@equation} - {\linespread{\fp_use:N \l__eb_spread_math_fp}\selectfont\spread@equation} + { \spread@equation } + { + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\spread@equation + } \ctex_after_end_preamble:n { - \skip_set:Nn \abovedisplayskip{5pt plus 1pt minus 1pt} - \skip_set:Nn \belowdisplayskip{5pt plus 1pt minus 1pt} - \skip_set:Nn \abovedisplayshortskip{0pt} - \skip_set:Nn \belowdisplayshortskip{5pt plus 1pt minus 1pt} + \skip_set:Nn \abovedisplayskip { 5pt plus 1pt minus 1pt } + \skip_set:Nn \belowdisplayskip { 5pt plus 1pt minus 1pt } + \skip_set:Nn \abovedisplayshortskip { 0pt } + \skip_set:Nn \belowdisplayshortskip { 5pt plus 1pt minus 1pt } } -\cs_gset:Npn \tagform@#1 - {\maketag@@@{\color{ctex@emph}(\ignorespaces#1\unskip\@@italiccorr)}} -\ctex_at_end_package:nn {unicode-math} - {\msg_redirect_module:nnn {unicode-math}{warning}{none}} +\cs_gset:Npn \tagform@ #1 + { \maketag@@@{\color{ctex@emph}(\ignorespaces #1\unskip\@@italiccorr)} } +\ctex_at_end_package:nn { unicode-math } + {\msg_redirect_module:nnn { unicode-math } { warning } { none } } -\ctex_at_end_package:nn {tcolorbox} +\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 = @@ -1262,16 +1292,16 @@ before~skip = 3.75ex,after~skip = 2.5ex }, breakable, - boxsep = 0pt, - arc = 0pt, + boxsep = 0pt, + arc = 0pt, fonttitle = \sffamily, - boxrule = \l__eb_rule_width_dim + boxrule = \l__eb_rule_width_dim } - \NewDocumentEnvironment{outline}{D(){\abstractname}o+b} + \NewDocumentEnvironment{outline}{O{}D(){\abstractname}o+b} { - \begin{tcolorbox}[tc-outline,title = #1,IfValueT = {#2}{#2}] - \begin{outlinelist} - #3 + \begin{tcolorbox}[tc-outline,title = #2,IfValueT = {#3}{#3}] + \begin{outlinelist}[#1] + #4 \end{outlinelist} \end{tcolorbox} }{} @@ -1282,9 +1312,9 @@ { \tcbox[ tc-exercise, - fuzzy~halo = 5pt~with~#3, - IfValueT = {#6}{#6}, - phantom = + fuzzy~halo = 5pt~with~#3, + IfValueT = {#6}{#6}, + phantom = \IfBooleanF{#1} { \CTEX@ifnametrue @@ -1295,8 +1325,8 @@ ]{\IfBooleanF{#1}{\CTEXthesection\hspace{0.5\ccwd}}#5} }{ \group_begin: - \keys_set:nn {ctex/section}{format += \centering} - \IfValueT{#6}{\keys_set:nn {ctex/section}{#6}} + \keys_set:nn { ctex/section } { format += \centering } + \IfValueT{#6}{\keys_set:nn { ctex/section } {#6}} \IfBooleanTF{#1}{\section*{#5}}{\section{#5}} \group_end: }#7 @@ -1328,8 +1358,8 @@ borderline~west = {3pt}{0pt}{#2}, IfBooleanTF = {#1} { - colback = white, - IfValueT = {#3}{title = #3}, + colback = white, + IfValueT = {#3}{title = #3}, top = 0pt,bottom = 0pt,toptitle = 0pt }{ colback = #2,colbacktitle = #2, @@ -1363,90 +1393,92 @@ \tl_new:N \l__eb_bib_citestyle_tl \tl_new:N \l__eb_bib_file_tl -\eb_ctex_define:nn {bibset} +\eb_ctex_define:nn { bibset } { - backend .choice:, - backend/bibtex .code:n = {}, - backend/biblatex .code:n = - {\bool_set_false:N \l__eb_backend_bibtex_bool}, + backend .choice:, + backend/bibtex .code:n = { }, + backend/biblatex .code:n = + { \bool_set_false:N \l__eb_backend_bibtex_bool }, - bib-style .choice:, - bib-style .value_required:n = true, - bib-style/numerical .code:n = + bib-style .choice:, + bib-style .value_required:n = true, + bib-style/numerical .code:n = { - \tl_set:Nn \l__eb_bib_style_tl{#1} + \tl_set:Nn \l__eb_bib_style_tl {#1} \tl_clear:N \l__eb_bib_otherstyle_tl }, - bib-style/authoryear .code:n = + bib-style/authoryear .code:n = { - \tl_set:Nn \l__eb_bib_style_tl{#1} + \tl_set:Nn \l__eb_bib_style_tl {#1} \tl_clear:N \l__eb_bib_otherstyle_tl }, - bib-style/unknown .code:n = - {\tl_set_eq:NN \l__eb_bib_otherstyle_tl\l_keys_value_tl}, - bib-style .initial:n = numerical, + bib-style/unknown .code:n = + { \tl_set_eq:NN \l__eb_bib_otherstyle_tl \l_keys_value_tl }, + bib-style .initial:n = numerical, - 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, + 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, - bib-loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool, - bib-loadpkg .default:n = true, - bib-loadpkg .initial:n = true + bib-loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool, + bib-loadpkg .default:n = true, + bib-loadpkg .initial:n = true } \cs_new_protected:Npn \EbBibtexSet { \tl_if_empty:NTF \l__eb_bib_otherstyle_tl { - \tl_if_eq:NnT \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: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} + \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 } \tl_if_empty:NF \l__eb_bib_citestyle_tl - {\exp_args:NV \setcitestyle\l__eb_bib_citestyle_tl} - \skip_set:Nn \bibsep{0ex} + { \exp_args:NV \setcitestyle \l__eb_bib_citestyle_tl } + \skip_zero:N \bibsep \NewDocumentCommand{\printbibliography}{st+o} { \group_begin: - \tl_set_eq:NN \eb@toc@title\bibname - \IfValueT{##3}{\keys_set:nn {eb/listoc}{##3}} + \tl_set_eq:NN \eb@toc@title \bibname + \IfValueT{##3}{ \keys_set:nn { eb/listoc } {##3} } \eb_multoc_pre_bool: \tl_set:Nn \bibsection - {\eb_title_number_intoc_bool:nn {##2}{##1}} - \exp_args:NV \bibliography\l__eb_bib_file_tl + { \eb_title_number_intoc_bool:nn {##2} {##1} } + \exp_args:NV \bibliography \l__eb_bib_file_tl \eb_multoc_post_bool: \group_end: } } \cs_new_protected:Npn \eb_put_biblatex:n #1 - {\PassOptionsToPackage{#1}{biblatex}} + { \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}} - \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_eq:NnT \l__eb_bib_style_tl { numerical } + { \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 } } \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 - \tl_gset:Nn \blx@default@theheading{bibintoc} + \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}} - \skip_set:Nn \bibitemsep{0ex} + \skip_zero:N \bibitemsep } \eb_at_end_preamble:n { @@ -1456,7 +1488,8 @@ { \RequirePackage[sort&compress]{natbib} \EbBibtexSet - }{ + } + { \EbBiblatexPreset \RequirePackage{biblatex} \EbBiblatexPostset @@ -1471,42 +1504,42 @@ \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont \exp_args:NNNo \group_end: - \dim_set:Nn \footnotesep{\dim_use:N \box_ht:N \strutbox} + \dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } \bool_if:NT \l__eb_chap_withpart_bool - {\counterwithin*{chapter}{part}} - \tl_if_eq:NnT \l__eb_foot_numberwith_tl{part} + { \counterwithin*{chapter}{part} } + \tl_if_eq:NnT \l__eb_foot_numberwith_tl { part } { \counterwithout*{footnote}{chapter} \counterwithin*{footnote}{part} } - \tl_if_eq:NnT \l__eb_foot_numberwith_tl{page} + \tl_if_eq:NnT \l__eb_foot_numberwith_tl { page } { \counterwithout*{footnote}{chapter} \counterwithin*{footnote}{page} } } \eb_patch_cmd:Nnn \@footnotetext - {\reset@font} + { \reset@font } { \linespread{\fp_use:N \l__eb_spread_footnote_fp} \selectfont\ignorespaces \l__eb_font_footnote_tl } \eb_patch_cmd:Nnn \@mpfootnotetext - {\reset@font} + { \reset@font } { \linespread{\fp_use:N \l__eb_spread_footnote_fp} \selectfont\ignorespaces \l__eb_font_footnote_tl } \eb_patch_cmd:Nnn \@makefnmark - {\normalfont}{\l__eb_font_footnote_tl} -\cs_gset:Npn \thempfootnote{\int_to_alph:n {\c@mpfootnote}} + { \normalfont } { \l__eb_font_footnote_tl } +\cs_gset:Npn \thempfootnote { \int_to_alph:n { \c@mpfootnote } } \lstdefinestyle{easy-listings} { - language = [LaTeX]TeX, - texcsstyle = + language = [LaTeX]TeX, + texcsstyle = { *\lst@ifdisplaystyle \bfseries\color{ctex@verb} @@ -1514,7 +1547,7 @@ \color{ctex@verb} \fi }, - basicstyle = + basicstyle = { \ttfamily\lst@ifdisplaystyle \small @@ -1522,7 +1555,7 @@ \color{ctex@verb} \fi }, - keywordstyle = + keywordstyle = { \lst@ifdisplaystyle \bfseries\color{ctex@verb} @@ -1530,58 +1563,58 @@ \color{ctex@verb} \fi }, - framexleftmargin = 0pt, + framexleftmargin = 0pt, framexrightmargin = 0pt, - xleftmargin = 3pt, - xrightmargin = 3pt, - numbersep = 10pt, - framesep = 3pt, - frame = single, - rulecolor = \color{ctex@frame}, - commentstyle = \color{SlateGray}, - emphstyle = \color{ctex@emph}, - emph = {caption,multirow,subcaption,tabularx}, - morekeywords = + xleftmargin = 3pt, + xrightmargin = 3pt, + numbersep = 10pt, + framesep = 3pt, + frame = single, + rulecolor = \color{ctex@frame}, + commentstyle = \color{SlateGray}, + emphstyle = \color{ctex@emph}, + emph = {caption,multirow,subcaption,tabularx}, + morekeywords = { includegraphics,setmainfont,setsansfont,setmonofont,setCJKmainfont,setCJKsansfont,setCJKmonofont,setCJKfamilyfont,RequirePackage } } \lstset { - style = easy-listings, - breaklines = true, - resetmargins = true, - % numbers = left, - numberstyle = \footnotesize, - abovecaptionskip = -1ex, - belowcaptionskip = 1.5ex, - aboveskip = 1.5ex plus .2ex minus .1ex, - belowskip = 0.55ex plus .2ex minus .1ex, - keepspaces = true, - framerule = \l__eb_rule_width_dim, - columns = flexible + style = easy-listings, + breaklines = true, + resetmargins = true, + % numbers = left, + numberstyle = \footnotesize, + aboveskip = 1.5ex plus .2ex minus .1ex, + belowskip = 0.55ex plus .2ex minus .1ex, + keepspaces = true, + framerule = \l__eb_rule_width_dim, + columns = flexible, + abovecaptionskip = -1ex, + belowcaptionskip = 1.5ex } \lstloadlanguages{C,C++,Java,Python,Matlab} \clist_new:N \l__eb_hyperref_clist \cs_new_protected:Npn \eb_put_hyperref:n #1 - {\clist_put_right:Nn \l__eb_hyperref_clist{#1}} + { \clist_put_right:Nn \l__eb_hyperref_clist {#1} } \cs_new_protected:Npn \eb_define_linkcolor:nnn #1#2#3 - {\definecolorset{HTML}{ctex@}{}{link,#1;url,#2;cite,#3}} + { \definecolorset{HTML}{ctex@}{}{link,#1;url,#2;cite,#3} } \cs_new_protected:Npn \eb_define_themecolor:nnn #1#2#3 - {\definecolorset{HTML}{ctex@}{}{frame,#1;emph,#2;verb,#3}} + { \definecolorset{HTML}{ctex@}{}{frame,#1;emph,#2;verb,#3} } \cs_new_protected:Npn \eb_define_linkcolor:n #1 - {\definecolorset{HTML}{ctex@}{}{link,#1;url,#1;cite,#1}} + { \definecolorset{HTML}{ctex@}{}{link,#1;url,#1;cite,#1} } \cs_new_protected:Npn \eb_define_themecolor:n #1 - {\definecolorset{HTML}{ctex@}{}{frame,#1;emph,#1;verb,#1}} + { \definecolorset{HTML}{ctex@}{}{frame,#1;emph,#1;verb,#1} } \cs_new:Npn \eb_linkcolor_set:n #1 { - linkcolor/\clist_item:nn {#1}{1} .code:n = + linkcolor/\clist_item:nn {#1} {1} .code:n = { \eb_define_linkcolor:nnn - {\clist_item:nn {#1}{2}} - {\clist_item:nn {#1}{3}} - {\clist_item:nn {#1}{4}} + { \clist_item:nn {#1} {2} } + { \clist_item:nn {#1} {3} } + { \clist_item:nn {#1} {4} } \eb_put_hyperref:n { linkcolor = ctex@link,linkbordercolor = ctex@link, @@ -1592,88 +1625,91 @@ } \cs_new:Npn \eb_themecolor_set:n #1 { - color/\clist_item:nn {#1}{1} .code:n = + color/\clist_item:nn {#1} {1} .code:n = { \eb_define_themecolor:nnn - {\clist_item:nn {#1}{2}} - {\clist_item:nn {#1}{3}} - {\clist_item:nn {#1}{4}} + { \clist_item:nn {#1} {2} } + { \clist_item:nn {#1} {3} } + { \clist_item:nn {#1} {4} } }, } \bool_set_false:N \l__eb_toc_number_color_bool -\eb_ctex_define:nn {link} +\eb_ctex_define:nn { link } { - hyperlink .choice:, - hyperlink/edge .code:n = {}, - hyperlink/none .code:n = \eb_put_hyperref:n {hidelinks}, + hyperlink .choice:, + hyperlink/edge .code:n = { }, + hyperlink/none .code:n = \eb_put_hyperref:n { hidelinks }, hyperlink/various .code:n = { \bool_set_true:N \l__eb_toc_number_color_bool - \eb_put_hyperref:n {colorlinks} + \eb_put_hyperref:n { colorlinks } }, - hyperlink .default:n = edge, - hyperlink .initial:n = edge, + hyperlink .default:n = edge, + hyperlink .initial:n = edge, - linktoc .choice:, - linktoc/unknown .code:n = + linktoc .choice:, + linktoc/unknown .code:n = { - \eb_put_hyperref:n {linktoc = #1} - \clist_map_inline:nn {page,none} + \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@number}{black}}} + \tl_if_eq:NnT \l_keys_value_tl {##1} + { + \clist_map_break:n + { \colorlet{ctex@toc@number}{black} } + } } }, - linktoc .default:n = all, - linktoc .initial:n = all, - unknown .code:n = + linktoc .default:n = all, + linktoc .initial:n = all, + unknown .code:n = { \eb_put_hyperref:x { \l_keys_key_str - \tl_if_empty:NF \l_keys_value_tl{ = {#1}} + \tl_if_empty:NF \l_keys_value_tl { = {#1} } } } } -\eb_ctex_define:nx {link} +\eb_ctex_define:nx { link } { - linkcolor .choice:, + linkcolor .choice:, \clist_map_function:nN { - {fresh, 62d71f,0000B2,005752}, - {cutepink, ff69b4,9d5196,57b5e5}, - {navyblue, 000080,004986,eb6877}, - {crimson, dc143c,00c1c9,afcd20} + { fresh, 62d71f,0000B2,005752 }, + { cutepink, ff69b4,9d5196,57b5e5 }, + { navyblue, 000080,004986,eb6877 }, + { crimson, dc143c,00c1c9,afcd20 } } \eb_linkcolor_set:n - linkcolor .default:n = navyblue, - linkcolor .initial:n = navyblue, - linkcol-all .code:n = - {\eb_define_linkcolor:n {\exp_not:n {#1}}} + linkcolor .default:n = navyblue, + linkcolor .initial:n = navyblue, + linkcol-all .code:n = + { \eb_define_linkcolor:n { \exp_not:n {#1} } } } \colorlet{ctex@toc@number}{ctex@link} -\eb_ctex_define:nx {style} +\eb_ctex_define:nx { style } { - color .choice:, - color .value_required:n = true, + color .choice:, + color .value_required:n = true, \clist_map_function:nN { - {none, 000000,000000,000000}, - {seaside, 4169e1,708090,9932cc}, - {energy, f39800,00a0e9,893895}, - {cyberpunk, 601986,eb6877,a4005b} + { none, 000000,000000,000000 }, + { seaside, 4169e1,708090,9932cc }, + { energy, f39800,00a0e9,893895 }, + { cyberpunk, 601986,eb6877,a4005b } } \eb_themecolor_set:n - color .initial:n = none, + 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_add_urlbreak_points: - {\tl_map_function:NN \c__eb_urlbreak_points_tl\do} + { \tl_map_function:NN \c__eb_urlbreak_points_tl\do } \eb_appto_cmd:Nn \UrlBreaks{\UrlOrds\eb_add_urlbreak_points:} } @@ -1688,23 +1724,23 @@ \RequirePackage{hyperref} \urlstyle{same} \eb_allow_urlbreak: - \ctex_hypersetup:n {pdfstartview = FitH} - \exp_args:NV \hypersetup\l__eb_hyperref_clist + \ctex_hypersetup:n { pdfstartview = FitH } + \exp_args:NV \hypersetup \l__eb_hyperref_clist \labelformat{part}{\CTEXthepart} \labelformat{chapter}{\CTEXthechapter} \labelformat{figure}{\figurename~#1} \labelformat{table}{\tablename~#1} - \tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} + \tl_if_eq:NnTF \l__ctex_scheme_tl { chinese } { - \keys_set_known:nn {ctex} + \keys_set_known:nn { ctex } { - contentsname = 目\hspace{\ccwd}录, - indexname = 索\hspace{\ccwd}引, - listfigurename = 图片索引, - listtablename = 表格索引, - abstractname = 摘\hspace{\ccwd}要, - lstlistlistingname = 代码索引, - lstlistingname = 代码 + contentsname = 目\hspace{\ccwd}录, + indexname = 索\hspace{\ccwd}引, + listfigurename = 图片索引, + listtablename = 表格索引, + abstractname = 摘\hspace{\ccwd}要, + lstlistlistingname = 代码索引, + lstlistingname = 代码 } \labelformat{equation}{式(#1)} \labelformat{align}{式(#1)} @@ -1712,12 +1748,13 @@ \labelformat{gather}{式(#1)} \labelformat{section}{节#1} \labelformat{subsection}{小节#1} - }{ - \keys_set_known:nn {ctex} + } + { + \keys_set_known:nn { ctex } { - abstractname = Abstract, - lstlistlistingname = List~of~Codes, - lstlistingname = Code + abstractname = Abstract, + lstlistlistingname = List~of~Codes, + lstlistingname = Code } \labelformat{equation}{Equation~(#1)} \labelformat{align}{Equation~(#1)} @@ -1731,59 +1768,59 @@ \ctex_set:n { secnumdepth = 3, - tocdepth = \bool_if:NTF \l__eb_class_book_bool{1}{2}, + tocdepth = \bool_if:NTF \l__eb_class_book_bool { 1 } { 2 }, part = { pagestyle = empty, - tocline = \EbNumberline{#1}#2, - format = \color{ctex@frame}\sffamily\Huge, + tocline = \EbNumberline{#1}#2, + format = \color{ctex@frame}\sffamily\Huge, aftername = { \bool_if:NTF \l__eb_title_newline_bool - {\par\nobreak}{\hspace{\ccwd}} + { \par\nobreak } { \hspace{\ccwd} } } }, chapter = { - % pagestyle = fancy, - format = + % pagestyle = fancy, + format = { \color{ctex@frame}\sffamily\LARGE - \bool_if:NF \l__eb_title_newline_bool{\centering} + \bool_if:NF \l__eb_title_newline_bool { \centering } }, - aftername = + aftername = { \bool_if:NTF \l__eb_title_newline_bool - {\par\nobreak\vskip 1.5pc}{\hspace{\ccwd}} + { \par\nobreak\vskip 1.5pc } { \hspace{\ccwd} } }, - beforeskip = -1.5ex, - afterskip = 3ex, - lotskip = 0.8pc, - lofskip = 0.8pc + beforeskip = -1.5ex, + afterskip = 3ex, + lotskip = 0.8pc, + lofskip = 0.8pc }, section = { - hang = true, - format = \color{ctex@frame}\sffamily\Large, - aftername = \hspace{0.5\ccwd}, - beforeskip = 1.5ex plus .2ex minus .1ex, - afterskip = 1.5ex plus .2ex minus .1ex + hang = true, + format = \color{ctex@frame}\sffamily\Large, + aftername = \hspace{0.5\ccwd}, + beforeskip = 1.5ex plus .2ex minus .1ex, + afterskip = 1.5ex plus .2ex minus .1ex }, subsection = { - hang = true, - format = \color{ctex@frame}\sffamily\large, - aftername = \hspace{0.5\ccwd}, - beforeskip = 1.3ex plus .2ex minus .1ex, - afterskip = 1.3ex plus .2ex minus .1ex + hang = true, + format = \color{ctex@frame}\sffamily\large, + aftername = \hspace{0.5\ccwd}, + beforeskip = 1.3ex plus .2ex minus .1ex, + afterskip = 1.3ex plus .2ex minus .1ex }, subsubsection = { - hang = true, - format = \color{ctex@frame}\sffamily, - aftername = \hspace{0.5\ccwd}, - beforeskip = \parskip, - afterskip = \parskip + hang = true, + format = \color{ctex@frame}\sffamily, + aftername = \hspace{0.5\ccwd}, + beforeskip = \parskip, + afterskip = \parskip } } @@ -1791,8 +1828,8 @@ { \ctex_set:n { - part/hang = true, - chapter/hang = true + part/hang = true, + chapter/hang = true } } \endinput -- cgit v1.2.3