From 94f0fd38b17b225048a0756ea6f03bbca0c30c7e Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 9 Apr 2021 20:05:28 +0000 Subject: easybook (9apr21) git-svn-id: svn://tug.org/texlive/trunk@58804 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/latex/easybook/easybook-demo.pdf | Bin 262451 -> 262450 bytes .../doc/latex/easybook/easybook-demo.tex | 5 +- Master/texmf-dist/doc/latex/easybook/easybook.pdf | Bin 425118 -> 442332 bytes .../texmf-dist/source/latex/easybook/easybook.dtx | 341 ++++++++++++++------- Master/texmf-dist/tex/latex/easybook/easybook.cls | 220 ++++++++----- 5 files changed, 366 insertions(+), 200 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/easybook/easybook-demo.pdf b/Master/texmf-dist/doc/latex/easybook/easybook-demo.pdf index 16ed695502a..08b9ac22cd8 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 e23317741fc..97f9fe4bb24 100644 --- a/Master/texmf-dist/doc/latex/easybook/easybook-demo.tex +++ b/Master/texmf-dist/doc/latex/easybook/easybook-demo.tex @@ -84,6 +84,7 @@ }, bibset = { + bib-loadpkg = true, backend = bibtex, bib-style = numerical }, @@ -91,7 +92,7 @@ % tocdepth = 2 } -\usepackage{zhlipsum,bicaption,tcolorbox} +\usepackage{zhlipsum,bicaption,tasks,tcolorbox,imakeidx} \begin{document} \title{\sffamily easybook书籍文档类} @@ -101,7 +102,7 @@ \url{https://latexstudio.net} \\ \url{https://gitee.com/texl3/easybook}\thanks{Gitee为项目的主要发布地址。} } -\date{2021/04/07\hskip\ccwd\relax v1.24g} +\date{2021/04/09\hskip\ccwd\relax v1.24i} \frontmatter[roman] \maketitle diff --git a/Master/texmf-dist/doc/latex/easybook/easybook.pdf b/Master/texmf-dist/doc/latex/easybook/easybook.pdf index ab902542d59..0cbbdadb85f 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 9fba9154423..ff3a9f73fb6 100644 --- a/Master/texmf-dist/source/latex/easybook/easybook.dtx +++ b/Master/texmf-dist/source/latex/easybook/easybook.dtx @@ -55,7 +55,7 @@ The latest version of this license is in % % \title{\sffamily easybook书籍文档类} % \author{瞿毅} -% \date{2021/04/07\hskip\ccwd\relax v1.24g\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/04/09\hskip\ccwd\relax v1.24i\thanks{\url{https://gitee.com/texl3/easybook}}} % \maketitle % \begin{abstract} % \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装。虽然\CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并载入一些常用宏包实现一般的排版需求,它适用于排版中英文书籍或笔记,甚至可稍加调整成为学位论文模板。 @@ -64,7 +64,7 @@ The latest version of this license is in % % \begin{documentation} % \section{编译方式} -% 文档类含有一个使用示例文件 \opt{easybook-demo.tex},编译前建议满足以下的条件 +% 编译文档类的一个使用示例文件 \opt{easybook-demo.tex} 前建议满足以下的条件 % \begin{itemize} % \item 使用 \hologo{XeLaTeX}(推荐)或 \hologo{LuaLaTeX} 两种编译方式。 % \item 由于用到了一些宏包较新的功能,建议安装最新的\TeX 发行版,例如 \TeX Live 2021或 \hologo{MiKTeX} 21.2之后的版本。 @@ -114,14 +114,14 @@ The latest version of this license is in % \begin{function}[rEXP,added = 2021-01-05]{entitle} % 部分标题编号由中文数字变为大写罗马数字,章标题编号由中文数字变为阿拉伯数字。比如\textbf{第一部分}变为\textbf{第I部分},\textbf{第一章}变为\textbf{第1章}。 % \end{function} -% \begin{function}[rEXP,added = 2021-01-05,updated = 2021-04-07]{scheme} +% \begin{function}[rEXP,added = 2021-01-05,updated = 2021-04-08]{scheme} % \begin{syntax} % scheme = <(chinese)|plain> % \end{syntax} % \opt{scheme} 代表文档的主题,扩展了此选项在\CTeX 文档类中原有的作用范围,\opt{plain} 选项可使各类标题变为英文形式。包括章节标题、图表标题和定理标题等。如\textbf{第一章}变为\textbf{Chapter 1},\textbf{图1.1} 变为 \textbf{Table 1.1}。 % \end{function} % \begin{function}[rEXP,added = 2021-01-05]{enstyle} -% 同时开启 \opt{newline}、\opt{entitle} 和 \opt{english} 三个选项以符合英文原生风格。 +% 同时开启 \opt{newline}、\opt{entitle} 和 \opt{scheme = plain} 三个选项以符合英文原生风格。 % \end{function} % % \begin{function}[rEXP,added = 2021-01-05,updated = 2021-02-02]{font} @@ -171,7 +171,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.24g}{2021/04/04}{目录命令的可选参数增加标题键值。} +% \changes{v1.24i}{2021/04/04}{目录命令的可选参数增加标题键值。} % \end{function} % % \section{接口选项} @@ -187,7 +187,7 @@ The latest version of this license is in % \hyperref[subsec:style]{风格} & \hyperref[subsec:hyperlinks]{超链接} & \hyperref[subsec:other font]{其它字体} & \hyperref[subsec:spacing]{行距} & \hyperref[subsec:reference]{参考文献} \\ % style & link & elsefont & spread & bibset \\ % \midrule -% \hyperref[subsec:theorem of style]{定理样式} & \hyperref[subsec:page margins]{页面边距} & \hyperref[subsec:header and footer]{页眉页脚} & \hyperref[subsec:catalog style]{目录样式} & \\ +% \hyperref[subsec:theorem of style]{定理样式} & \hyperref[subsec:page margins]{页面尺寸} & \hyperref[subsec:header and footer]{页眉页脚} & \hyperref[subsec:catalog style]{目录样式} & \\ % thmset & geoset & hdrset & tocset & \\ % \bottomrule % \end{tabular} @@ -210,7 +210,7 @@ The latest version of this license is in % multoc = % withpart = % footwith = -% notomath = +% notomath = <(true)|false> % rulewidth = <(0.75pt)> % uppercase = <(true)|false> % figure-sep = <(.)> @@ -238,7 +238,7 @@ The latest version of this license is in % \item[multoc] 开启双栏目录,可与 \opt{onecolumn} 和 \opt{twocolumn} 选项配合出单栏正文、单栏目录,双栏正文、单栏目录,单栏正文、双栏目录和双栏正文、双栏目录四种方式。 % \item[withpart] 使章跟随每一部分编号,默认不跟随。 % \item[footwith] 使脚注跟随编号的计数器,默认跟随章,当开启新的一章时脚注编号从1开始。 -% \item[notomath] 使用 \opt{noto} 风格的数学字体,将会加载 \pkg{newtxmath} 宏包。此选项默认关闭,此时可以使用 \pkg{unicode-math} 等宏包自定义数学字体。 +% \item[notomath] 使用 \opt{noto} 风格的数学字体,将会加载 \pkg{newtxmath} 宏包。关闭此选项时可以使用 \pkg{unicode-math} 等宏包自定义数学字体。 % \item[rulewidth] 调整页眉、定理盒子以及代码框线条的粗细。 % \item[uppercase] 使用 \tn{rightmark} 及 \tn{leftmark} 获取标题内容设置页眉页脚时英文是否大小写。 % \item[figure-sep] 图片标题编号的连接符。 @@ -259,7 +259,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.24g}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} +% \changes{v1.24i}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} % \end{function} % % \begin{optdesc} @@ -286,13 +286,13 @@ The latest version of this license is in % footnote = <(1)> % \end{syntax} % \ding{229} 以上选项路径为 \opt{spread/...} \\ -% 行距因子用于设置各种行距倍数,只能是浮点数,不能带有长度单位。\tn{ctexset} 原有的行距选项 \opt{linespread} 失效。各行距既可在导言区全局设置也可正文中设置对后面生效,行距的意义为 +% 行距因子用于设置各种行距倍数,只能是浮点数,不能带有长度单位。各行距既可在导言区全局设置也可正文中设置对后面生效,行距的意义为 % \changes{v1.21}{2021/01/12}{增加脚注线间的距离选项。} % \changes{v1.23}{2021/02/09}{取消使用 \pkg{zhlineskip} 宏包设置数学间距。} % \end{function} % % \begin{optdesc} -% \item[line] 正文行距。 +% \item[line] 正文行距,\tn{ctexset} 原有的行距选项 \opt{linespread} 失效。 % \item[table] 表格行距。 % \item[math] 数学环境行距,包括 \pkg{amsmath} 和 \pkg{mathtools} 宏包附带的环境,但并未加载 \pkg{mathtools} 宏包。 % \item[caption] 图表代码标题行距。 @@ -324,8 +324,9 @@ The latest version of this license is in % % \subsection{参考文献} % \label{subsec:reference} -% \begin{function}[EXP,added = 2021-01-11,updated = 2021-03-15]{backend,bib-style,cite-style,bibfile} +% \begin{function}[EXP,added = 2021-01-11,updated = 2021-04-09]{bib-loadpkg,backend,bib-style,cite-style,bibfile} % \begin{syntax} +% bib-loadpkg = <(true)|false> % backend = <(bibtex)|biblatex> % bib-style = <(numerical)|authoryear|其它格式> % cite-style = <标注风格> @@ -334,29 +335,37 @@ 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.24i}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} % \end{function} % % \begin{optdesc} +% \item[bib-loadpkg] 是否载入 \pkg{natbib} 或 \pkg{biblatex} 宏包,关闭此选项后需要在导言区手动载入参考文献宏包,之后可使用相关配置命令(见下文)或完全自行设置参考文献。 % \item[backend] 参考文献处理后端,默认用传统的 \hologo{BibTeX} 处理参考文献。 % \item[bib-style] 参考文献格式为中国的参考文献推荐标准GB/T 7714-2015,有顺序编码制和著者-出版年制两种风格,理工科类一般使用顺序编码制,文科类一般使用著者-出版年制。若使用其它格式,使用 \hologo{BibTeX} 处理时需确保正确的 \opt{bst} 文件,使用 \hologo{biber} 处理可使用 \pkg{biblatex} 宏包支持的参考文献风格名称。 % \item[cite-style] 标注参考文献的风格,\opt{backend = bibtex} 选项下可使用 \opt{super}(数字上标标注,默认)或 \opt{numbers}(数字标注)等 \pkg{natbib} 宏包带有的标注风格,\opt{backend = biblatex} 选项下可使用 \pkg{biblatex} 宏包支持的标注风格名称。 -% \item[bibfile] 参考文献的数据文件,使用 \hologo{biber} 处理时要带有 \opt{bib} 后缀,默认为一个以 \opt{refs.bib} 命名的文件。 +% \item[bibfile] 参考文献数据库的文件名,使用 \hologo{biber} 处理时要带有 \opt{bib} 后缀,若不在当前文件夹名称需要包含路径,默认是一个在当前文件夹以 \opt{refs.bib} 命名的文件。 % \end{optdesc} % -% \begin{function}[added = 2021-01-11,updated = 2021-03-15]{\printbibliography} +% \begin{function}[added = 2021-01-11,updated = 2021-04-09]{\printbibliography,\EbBibtexSet,\EbBiblatexPreset,\EbBiblatexPostset} % \begin{syntax} % \tn{printbibliography}\oarg{键值列表} % \end{syntax} -% 两种方式\textbf{均使用}此命令打印参考文献,不同处理后端此命令的键值列表不同。使用 \hologo{BibTeX} 处理时选项与小节 \ref{subsec:document command} 目录的选项相同,使用 \hologo{biber} 处理时常用的选项如下 +% 关闭 \opt{bib-loadpkg} 选项时 \opt{bibset} 中的选项会失效,但是后三个命令保存了 \opt{bibset} 模块预置的参考文献选项与配置,与对应宏包配合使用它们时 \opt{bibset} 中的选项仍然有效,也可以不使用它们完全自行设置参考文献方案。开启 \opt{bib-loadpkg} 选项对它们重新定义也可以达到重新设置参考文献的效果。 % \end{function} % -% \begin{function}{heading,title} -% \begin{syntax} -% heading = -% title = <参考文献标题名> -% \end{syntax} -% \opt{heading} 为参考文献标题的处理方式,\opt{bibliography} 选项以 \opt{chapter} 级别输出参考文献,不加进目录,\opt{subbibliography} 选项以 \opt{section} 级别输出参考文献,不加进目录,\opt{bibintoc} 选项以 \opt{chapter} 级别输出参考文献,加进目录,\opt{subbibintoc} 选项以 \opt{section} 级别输出参考文献,加进目录。\opt{title} 选项覆盖由 \opt{heading} 选项提供的缺省标题名。除此之外其他支持选项可见 \pkg{biblatex} 宏包说明文档。 -% \end{function} +% \begin{optdesc} +% \item[\tn{printbibliography}] 两种方式\textbf{均使用}此命令打印参考文献,不同处理后端此命令的键值列表不同。使用 \hologo{BibTeX} 处理时选项与小节 \ref{subsec:document command} 目录的选项相同,使用 \hologo{biber} 处理时常用的选项如下 +% \begin{function}{heading,title} +% \begin{syntax} +% heading = +% title = <参考文献标题名> +% \end{syntax} +% \opt{heading} 为参考文献标题的处理方式,\opt{bibliography} 选项以 \opt{chapter} 级别输出参考文献,不加进目录,\opt{subbibliography} 选项以 \opt{section} 级别输出参考文献,不加进目录,\opt{bibintoc} 选项以 \opt{chapter} 级别输出参考文献,加进目录,\opt{subbibintoc} 选项以 \opt{section} 级别输出参考文献,加进目录。\opt{title} 选项覆盖由 \opt{heading} 选项提供的缺省标题名。除此之外其他支持选项可见 \pkg{biblatex} 宏包说明文档。 +% \end{function} +% \item[\tn{EbBibtexSet}] 这是 \pkg{natbib} 宏包的配置命令,需要与 \pkg{natbib} 配合并放在载入其之后使用,默认保存了参考文献风格和标题的设置。 +% \item[\tn{EbBiblatexPreset}] 这是 \pkg{biblatex} 宏包的前配置命令,需要与 \pkg{biblatex} 配合并放在载入其之前使用,默认保存了参考文献风格的设置。若重新定义可使用 \tn{PassOptionsToPackage} 命令向 \pkg{biblatex} 传递它支持的各种参考文献选项。 +% \item[\tn{EbBiblatexPostset}] 这是 \pkg{biblatex} 宏包的后配置命令,需要与 \pkg{biblatex} 配合并放在载入其之后使用,默认保存了参考文献标题的设置。 +% \end{optdesc} % % \subsection{定理样式} % \label{subsec:theorem of style} @@ -424,7 +433,7 @@ The latest version of this license is in % \declaretheoremstyle[bodyfont = \rmfamily,spacepost = 0.5\ccwd]{定理样式名} % \end{ctexexam} % -% \subsection{页面边距} +% \subsection{页面尺寸} % \label{subsec:page margins} % \begin{function}[EXP,added = 2021-01-13,updated = 2021-03-21]{footnotemargin,footparskip,footparindent,list-labelsep,left,top,hmargin,textwidth,includehead} % \begin{syntax} @@ -439,7 +448,7 @@ The latest version of this license is in % includehead = % \end{syntax} % \ding{229} 以上选项路径为 \opt{geoset/...} \\ -% 预置的页面边距与 \cls{Word} 的默认值接近,\opt{geoset} 会将前4个选项以外的其它选项交给 \pkg{geometry} 宏包接口命令 \tn{geometry} 处理,并且选项的键值列表与之相同,上面的选项仅是一小部分,支持的参数可查阅宏包帮助文档。当在此设置页面大小时,会覆盖 \opt{paper} 选项的设置。 +% 预置的页面尺寸与 \cls{Word} 的默认值接近,\opt{geoset} 会将前4个选项以外的其它选项交给 \pkg{geometry} 宏包接口命令 \tn{geometry} 处理,并且选项的键值列表与之相同,上面的选项仅是一小部分,支持的参数可查阅宏包帮助文档。当在此设置页面大小时,会覆盖 \opt{paper} 选项的设置。 % \begin{ctexexam} % \geoset % { @@ -450,26 +459,30 @@ The latest version of this license is in % list-labelsep = \hspace{0.5\ccwd} % } % \end{ctexexam} -% \changes{v1.21}{2021/01/13}{增加配置页面边距的选项。} +% \changes{v1.21}{2021/01/13}{增加配置页面尺寸的选项。} % \end{function} % % \subsection{页眉页脚} % \label{subsec:header and footer} -% \begin{function}[EXP,added = 2021-01-13,updated = 2021-04-06]{head-foot,chap-mark,sec-mark,headrule,footrule,footnoterule} +% \begin{function}[EXP,added = 2021-01-13,updated = 2021-04-09]{head-foot,chap-mark,sec-mark,subsec-mark,headrule,footrule,footnoterule} % \begin{syntax} % head-foot = <页眉页脚中的内容> -% chap-mark = <\tn{chaptermark} 标志命令的定义> -% sec-mark = <\tn{sectionmark} 标志命令的定义> +% chap-mark = <\tn{chaptermark} 标志命令的内容> +% sec-mark = <\tn{sectionmark} 标志命令的内容> +% subsec-mark = <\tn{subsectionmark} 标志命令的内容> % headrule = <页眉横线格式> % footrule = <页脚横线格式> % footnoterule = <脚注横线格式> % \end{syntax} % \ding{229} 以上选项路径为 \opt{hdrset/...} \\ -% \opt{hdrset} 设置的命令由 \pkg{fancyhdr} 宏包提供支持。章节标志选项 \opt{chap-mark} 和 \opt{sec-mark} 中参数\#1代表当前章或节的标题。\opt{headrule}、\opt{footrule} 和 \opt{footnoterule} 三个横线选项一般可以使用 \tn{hrule} width \meta{长度} height \meta{高度} 命令来绘制,脚注横线默认为空。当然,手动绘制横线时线条粗细选项 \opt{style/rulewidth} 会失效。 +% \opt{hdrset} 设置的命令由 \pkg{fancyhdr} 宏包提供支持。设置章节标志选项 \opt{chap-mark}、\opt{sec-mark} 和 \opt{subsec-mark} 时已做了情形考虑,不需要使用 \tn{markboth} 或 \tn{markright} 命令,其中参数\#1代表当前章、节或小节的标题。\opt{chap-mark} 和 \opt{sec-mark} 选项在 \opt{book} 模式时有意义,\opt{sec-mark} 和 \opt{subsec-mark} 选项在 \opt{article} 模式时有意义,这与标准文档类的行为一致。也可以直接重新定义这些标志命令,但此时 \opt{style/uppercase} 选项失效,这时可以用例如 \tn{MakeUppercase} 命令来设置标志内容的大小写。 +% +% \opt{headrule}、\opt{footrule} 和 \opt{footnoterule} 三个横线选项一般可以使用 \tn{hrule} width \meta{长度} height \meta{高度} 命令来绘制,脚注横线默认为空。当然,手动绘制横线时线条粗细选项 \opt{style/rulewidth} 会失效。 % \changes{v1.21}{2021/01/11}{修复单面文档时页眉横线消失的问题。} % \changes{v1.21}{2021/01/13}{增加配置页眉页脚的选项。} -% \changes{v1.23}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 选项。} +% \changes{v1.23}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 标志选项。} % \changes{v1.23}{2021/03/14}{可以手动绘制页眉、页脚和脚注的横线。} +% \changes{v1.24i}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-03-14]{\easyhead,\easyfoot} @@ -529,8 +542,8 @@ The latest version of this license is in % \end{ctexexam} % % \opt{belowoffset} 选项为主目录标题 \tn{contentsname} 后的间距补偿,一般为负值,用于抵消 \opt{format} 中设置的垂直间距。\opt{lists} 中的 \opt{belowoffset} 与之意义类似,但是一般为正值,可以在 \opt{article} 模式中使用。建议 \opt{lists/lolskip(0.8pc) + lists/format/addvspace(0.2pc) + lists/belowoffset(0pc) = belowoffset(-1pc)}。\opt{line-align} 选项可以使目录引导线右边对齐并与页码保持一定间隙,否则会与页码连接。 -% \changes{v1.24g}{2021/04/05}{可以设置图、表和代码目录的标签。} -% \changes{v1.24g}{2021/04/06}{增加目录引导线右边对齐方式。} +% \changes{v1.24i}{2021/04/05}{可以设置图、表和代码目录的标签。} +% \changes{v1.24i}{2021/04/06}{增加目录引导线右边对齐方式。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-04-06]{\tocrule} @@ -564,19 +577,19 @@ The latest version of this license is in % \end{function} % % \subsection{列表} -% \begin{function}[added = 2021-01-05,updated = 2021-04-07]{enumerate,itemize,description} +% \begin{function}[added = 2021-01-05,updated = 2021-04-08]{enumerate,itemize,description} % \begin{syntax} % \tn{begin}\marg{环境名}\oarg{键值列表} % \ \tn{item} <列表内容> % \tn{end}\marg{环境名} % \end{syntax} -% \pkg{enumitem} 宏包为系统预置的列表环境 \env{enumerate}、\env{itemize}和 \env{description} 提供了更灵活的标签以及间距的控制,可使用 \tn{setlist} 命令设置原有的三种列表格式。已为三种列表预置了三个级别的格式,可相互嵌套,若自定义标签可例如 +% \pkg{enumitem} 宏包为系统预置的列表环境 \env{enumerate}、\env{itemize}和 \env{description} 提供了更灵活的标签以及间距的控制,可使用 \tn{setlist} 命令设置原有的三种列表格式。已为三种列表预置了三个级别的格式可相互嵌套,默认标签与 \cls{book} 文档类相同,若自定义标签可例如 % \begin{ctexexam} % \begin{enumerate}[label = \arabic*(a),leftmargin = 1cm,resume] % \begin{itemize}[label = \textbullet] % \begin{description}[font = \sffamily\bfseries,style = nextline] % \end{ctexexam} -% \changes{v1.24g}{2021/04/07}{重新优化列表环境的配置。} +% \changes{v1.24i}{2021/04/08}{重新优化列表环境的配置。} % \end{function} % % \subsubsection{排序列表} @@ -630,7 +643,7 @@ The latest version of this license is in % \ \tn{item} <习题内容> % \tn{end}\marg{exercise} % \end{syntax} -% 习题环境 \env{exercise} 的标题紧接上一节编号并加入目录与页眉,当使用星号环境时不进行编号。三个可选参数中颜色为自定义或 \pkg{xcolor} 包含的颜色名称,正文编号格式与小节 \ref{subsec:sort list} 排序列表相同,标题名默认为摘要。注意,环境具有相同定界符的可选参数只能\textbf{从右往左}省略,省略的参数使用默认值。 +% 习题环境 \env{exercise} 的标题紧接上一节编号并加入目录与页眉,当使用星号环境时不进行编号。三个可选参数中颜色为自定义或 \pkg{xcolor} 包含的颜色名称,已载入了 \opt{svgnames} 颜色库。正文编号格式与小节 \ref{subsec:sort list} 排序列表相同,标题名默认为摘要。注意,环境具有相同定界符的可选参数只能\textbf{从右往左}省略,省略的参数使用默认值。 % \begin{ctexexam} % \begin{exercise}[LightYellow][1.](习题) % \item 习题内容 @@ -768,9 +781,9 @@ The latest version of this license is in % \begin{syntax} % \tn{bicaption}\oarg{目录标题1}\marg{标题2}\oarg{目录标题1}\marg{标题2} % \tn{bicaptionbox}\oarg{目录标题1}\marg{标题2}\oarg{目录标题1}\marg{标题2} -% \oarg{宽度}\oarg{内部位置}\marg{内容} +% \ \oarg{宽度}\oarg{内部位置}\marg{内容} % \end{syntax} -% 可以实现中英文双语标题,使用此功能需要在导言区载入 \pkg{bicaption} 宏包,具体用法见说明文档。 +% 可以实现图表浮动环境的中英文双语标题,使用此功能需要在导言区载入 \pkg{bicaption} 宏包,具体用法见说明文档。 % \end{function} % % \subsection{插入文档} @@ -800,15 +813,47 @@ The latest version of this license is in % \end{syntax} % \pkg{ulem} 宏包提供了多种下划线命令,下划线的粗细由命令 \tn{ULthickness} 控制,重新定义它需要使用 \tn{renewcommand} 命令。下划线的深度由 \tn{ULdepth} 控制,默认值 \tn{maxdimen} 是一个允许深度根据当前字体变化的特殊标志,当然也可以使用 \tn{setlength} 设定特定深度。 % \end{function} +% +% \section{载入的宏包} +% 以下为 \cls{easybook} 直接调用的关键宏包,带有 \ding{75} 符号的宏包并未载入它们,仅做了预配置和兼容性处理,可根据需要在导言区手动载入以实现相关的功能。 +% \begin{description} +% \item[ctexbook] 提供中文排版的通用框架。 +% \item[xcolor] 提供多种颜色、阴影、色调和任意颜色的混合。 +% \item[footmisc] 更改脚注排版的方法的集合。 +% \item[amsmath] 提供\LaTeX 中的数学功能。 +% \item[thmtools] 用于通常需要的排版定理支持。 +% \item[marginnote] 增强了边注输出的功能。 +% \item[setspace] 提供对文档中行间距的支持。 +% \item[chemformula] 提供了对化学式进行排版的命令。 +% \item[siunitx] 全面的国际标准单位支持。 +% \item[ulem] 提供可断行多样式的下划线命令。 +% \item[geometry] 灵活完整的页面尺寸设置。 +% \item[pdfpages] 在\LaTeX 中插入 pdf 文档。 +% \item[graphicx] 增强了对图形插入的支持。 +% \item[fancyhdr] 广泛控制页面的页眉和页脚。 +% \item[titletoc] 设置目录中的标题格式。 +% \item[caption-light] 在浮动环境中自定义题注。 +% \item[tabularx] 带有可调整宽度的列的表格。 +% \item[multirow] 创建跨越多行的表格单元格。 +% \item[booktabs] 为表格提供三线表式的命令。 +% \item[enumitem] 提供列表环境的布局控制。 +% \item[listings] 可以在\LaTeX 中排版程序/编程代码。 +% \item[\ding{75} tcolorbox] 为带有标题线的彩色和带框文本框提供了一个环境。 +% \item[\ding{75} tasks] 将练习题组织成水平而不是垂直计数的列。 +% \item[\ding{75} imakeidx] 可以让文档同时生成和排版一个或多个索引。 +% \item[\ding{75} bicaption] 提供图表的双语题注。 +% \item[\ding{75} mathtools] 增强 \pkg{amsmath} 的数学功能。 +% \item[\ding{75} unicode-math] 处理使用 unicode 编码的数学字体。 +% \end{description} % \end{documentation} % % \StopEventually{} %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/04/07}{1.24g}{beta} +\ProvidesExplClass{easybook}{2021/04/09}{1.24i}{beta} -\cs_generate_variant:Nn \keys_define:nn {nx} +\cs_generate_variant:Nn \__ctex_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} \cs_generate_variant:Nn \dim_add:Nn {NV} \cs_generate_variant:Nn \__eb_put_hyperref:n {x} @@ -820,6 +865,8 @@ The latest version of this license is in {\ctex_patch_cmd_once:NnnnTF #1{}{#2}{#3}{}{\ctex_patch_failure:N #1}} \cs_new_protected:Npn \__eb_appto_cmd:Nn #1#2 {\ctex_appto_cmd:NnnTF #1{}{#2}{}{\ctex_patch_failure:N #1}} +\cs_new_protected:Npn \__eb_at_end_preamble:n + {\ctex_gadd_ltxhook:nn {env/document/before}} \bool_set_false:N \l__eb_draft_bool \bool_set_false:N \l__eb_newline_bool @@ -925,7 +972,7 @@ The latest version of this license is in withpart .initial:n = false, notomath .bool_set:N = \l__eb_notomath_bool, notomath .default:n = true, - notomath .initial:n = false, + notomath .initial:n = true, rulewidth .dim_set:N = \l__eb_rule_width_dim, rulewidth .initial:n = 0.75pt, uppercase .bool_set:N = \l__eb_uppercase_bool, @@ -961,8 +1008,8 @@ The latest version of this license is in fancyhdr,titletoc, caption-light,subcaption, tabularx,multirow,booktabs, - tasks,enumitem, - listings,imakeidx + enumitem, + listings } \ctex_at_end_preamble:n { @@ -1078,7 +1125,8 @@ The latest version of this license is in \cs_new_protected:Npn \kaishu{\__eb_switch_family:n {kaishu}} \cs_new_protected:Npn \fangsong{\__eb_switch_family:n {fangsong}} } -\cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\normalfont} +\__eb_at_end_preamble:n + {\cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\normalfont}} \includepdfset{fitpaper = true} \geometry @@ -1146,6 +1194,7 @@ The latest version of this license is in \easyhead[OC]{\color{ctex@frame}\kaishu\rightmark} \easyhead[EL,OR]{\color{ctex@frame}\thepage} }, + chap-mark .cs_set:Np = \__eb_fancyhf_chap_mark:n #1, chap-mark .initial:n = { @@ -1168,6 +1217,17 @@ The latest version of this license is in \fi }#1 }, + subsec-mark .cs_set:Np = \__eb_fancyhf_subsec_mark:n #1, + subsec-mark .initial:n = + { + \int_compare:nT {\c@secnumdepth > 1} + { + \ifodd\CTEX@subsection@numbering + \CTEXthesubsection\hspace{0.5\ccwd} + \fi + }#1 + }, + headrule .tl_gset:N = \headrule, headrule .initial:n = { @@ -1194,35 +1254,56 @@ The latest version of this license is in {\text_uppercase:n {\__eb_fancyhf_chap_mark:n {#1}}} {\text_titlecase_first:n {\__eb_fancyhf_chap_mark:n {#1}}} } +\cs_new_protected:Npn \__eb_ifupper_sectionmark_set:n #1 + { + \bool_if:NTF \l__eb_uppercase_bool + {\text_uppercase:n {\__eb_fancyhf_sec_mark:n {#1}}} + {\text_titlecase_first:n {\__eb_fancyhf_sec_mark:n {#1}}} + } +\cs_new_protected:Npn \__eb_ifupper_subsectionmark_set:n #1 + { + \bool_if:NTF \l__eb_uppercase_bool + {\text_uppercase:n {\__eb_fancyhf_subsec_mark:n {#1}}} + {\text_titlecase_first:n {\__eb_fancyhf_subsec_mark:n {#1}}} + } \ctex_at_end_preamble:n { \exp_args:NV \geometry\g__eb_geometry_clist - \pagestyle{fancy} \fancyhf{} - \bool_if:NTF \l__eb_page_twoside_bool + \tl_use:N \l__eb_fancyhf_content_tl + \cs_gset_eq:NN \ps@plain\ps@empty + \pagestyle{fancy} + \bool_if:NTF \l__eb_class_book_bool { - \cs_gset:Npn \chaptermark#1 + \bool_if:NTF \l__eb_page_twoside_bool { - \markboth - {\__eb_ifupper_chaptermark_set:n {#1}} - {\__eb_ifupper_chaptermark_set:n {#1}} + \cs_gset:Npn \chaptermark#1 + { + \markboth + {\__eb_ifupper_chaptermark_set:n {#1}} + {\__eb_ifupper_chaptermark_set:n {#1}} + } + }{ + \cs_gset:Npn \chaptermark#1 + {\markboth{\__eb_ifupper_chaptermark_set:n {#1}}{}} } - \l__eb_fancyhf_content_tl - \cs_gset_eq:NN \ps@plain\ps@empty + \cs_gset:Npn \sectionmark#1 + {\markright{\__eb_ifupper_sectionmark_set:n {#1}}} }{ - \cs_gset:Npn \chaptermark#1 - {\markboth{\__eb_ifupper_chaptermark_set:n {#1}}{}} - \l__eb_fancyhf_content_tl - \cs_gset_eq:NN \ps@plain\ps@empty - } - \cs_gset:Npn \sectionmark#1 - { - \markright + \bool_if:NTF \l__eb_page_twoside_bool { - \bool_if:NTF \l__eb_uppercase_bool - {\text_uppercase:n {\__eb_fancyhf_sec_mark:n {#1}}} - {\text_titlecase_first:n {\__eb_fancyhf_sec_mark:n {#1}}} + \cs_gset:Npn \sectionmark#1 + { + \markboth + {\__eb_ifupper_sectionmark_set:n {#1}} + {\__eb_ifupper_sectionmark_set:n {#1}} + } + }{ + \cs_gset:Npn \sectionmark#1 + {\markboth{\__eb_ifupper_sectionmark_set:n {#1}}{}} } + \cs_gset:Npn \subsectionmark#1 + {\markright{\__eb_ifupper_subsectionmark_set:n {#1}}} } \bool_if:NT \l__eb_draft_bool { @@ -1369,7 +1450,7 @@ The latest version of this license is in {\text_uppercase:n {#1}} {\text_titlecase_first:n {#1}} } -\cs_new_protected:Npn \__eb_markboth:n #1 +\cs_new_protected:Npn \eb@markdouble#1 { \bool_if:NTF \l__eb_page_twoside_bool { @@ -1400,14 +1481,14 @@ The latest version of this license is in \section*{\phantomsection#1} \CTEX@addtocline{section}{#1} } - \__eb_markboth:n {#1} + \eb@markdouble{#1} } -\cs_new_protected:Npn \__eb_title_mark:n #1 +\cs_new_protected:Npn \__eb_title_mark_notoc:n #1 { \tl_if_eq:NnTF \l__eb_toc_type_tl{book} {\chapter*{\phantomsection#1}} {\section*{\phantomsection#1}} - \__eb_markboth:n {#1} + \eb@markdouble{#1} } \cs_new_protected:Npn \__eb_ifmultoc_pre_set: { @@ -1436,7 +1517,7 @@ The latest version of this license is in \cs_new_protected:Npn \__eb_title_ifintoc_set:n #1 { \IfBooleanTF{#1} - {\__eb_title_mark:n {\eb@toc@title}} + {\__eb_title_mark_notoc:n {\eb@toc@title}} {\__eb_title_mark_intoc:n {\eb@toc@title}} } \RenewDocumentCommand{\tableofcontents}{o} @@ -1445,7 +1526,7 @@ The latest version of this license is in \tl_set_eq:NN \eb@toc@title\contentsname \IfValueT{#1}{\keys_set:nn {listoc}{#1}} \__eb_ifmultoc_pre_set: - \__eb_title_mark:n {\eb@toc@title} + \__eb_title_mark_notoc:n {\eb@toc@title} \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{toc} \__eb_ifmultoc_post_set: @@ -1491,22 +1572,25 @@ The latest version of this license is in \group_end: } -\makeindex[ - intoc, - options = -M~texindy~-C~utf8, - program = truexindy, - columns = 2, - columnsep = 2\ccwd - ] -\indexsetup - { - level = \bool_if:NTF \l__eb_class_book_bool{\chapter*}{\section*}, - toclevel = \bool_if:NTF \l__eb_class_book_bool{chapter}{section}, - firstpagestyle = \bool_if:NTF \l__eb_class_book_bool{plain}{fancy} +\ctex_at_end_package:nn {imakeidx} + { + \makeindex[ + intoc, + options = -M~texindy~-C~utf8, + program = truexindy, + columns = 2, + columnsep = 2\ccwd + ] + \indexsetup + { + level = \bool_if:NTF \l__eb_class_book_bool{\chapter*}{\section*}, + toclevel = \bool_if:NTF \l__eb_class_book_bool{chapter}{section}, + firstpagestyle = \bool_if:NTF \l__eb_class_book_bool{plain}{fancy} + } + \ctex_patch_cmd:Nnn \imki@indexheaders + {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} + {\eb@markdouble{\indexname}} } -\__eb_patch_cmd:Nnn \imki@indexheaders - {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} - {\__eb_markboth:n {\indexname}} \tl_new:N \l__eb_font_table_tl \tl_new:N \l__eb_font_figure_tl @@ -1688,7 +1772,7 @@ The latest version of this license is in \cs_new_protected:Npn \__eb_thmname_set:nn #1#2 {\tl_const:cn {c__eb_name_#1_tl}{#2}} -\tl_if_eq:VnTF \l__ctex_scheme_tl{chinese} +\tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} { \clist_map_inline:nn { @@ -1780,7 +1864,7 @@ The latest version of this license is in name = \use:c {c__eb_name_#1_tl} ]{#1} } - \cs_gset_eq:NN \proof\relax + \cs_undefine:N \proof \declaretheorem[ style = easy-thm-sty, name = \c__eb_name_remark_tl, @@ -1794,13 +1878,16 @@ The latest version of this license is in ]{proof} } -\settasks +\ctex_at_end_package:nn {tasks} { - label = (\Alph*), - after-item-skip = 0ex plus .1ex, - column-sep = .5\ccwd, - item-indent = 2\ccwd, - label-width = 1.5\ccwd + \settasks + { + label = (\Alph*), + after-item-skip = 0ex plus .1ex, + column-sep = .5\ccwd, + item-indent = 2\ccwd, + label-width = 1.5\ccwd + } } \setchemformula { @@ -2018,19 +2105,23 @@ The latest version of this license is in cite-style .code:n = {\tl_set:Nn \l__eb_bib_citestyle_tl{#1}}, bibfile .tl_set:N = \l__eb_bib_file_tl, - bibfile .initial:n = refs.bib + bibfile .initial:n = refs.bib, + + bib-loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool, + bib-loadpkg .default:n = true, + bib-loadpkg .initial:n = true } -\cs_new_protected:Npn \__eb_bibtex_set: +\cs_new_protected:Npn \EbBibtexSet { \tl_if_empty:NTF \l__eb_bib_otherstyle_tl { - \tl_if_eq:VnT \l__eb_bib_style_tl{numerical} + \tl_if_eq:NnT \l__eb_bib_style_tl{numerical} { \bibliographystyle{gbt7714-numerical} \setcitestyle{comma,square,super} } - \tl_if_eq:VnT \l__eb_bib_style_tl{authoryear} + \tl_if_eq:NnT \l__eb_bib_style_tl{authoryear} {\bibliographystyle{gbt7714-author-year}} \cs_set_eq:NN \cite\citep }{\exp_args:NV \bibliographystyle\l__eb_bib_otherstyle_tl} @@ -2051,36 +2142,39 @@ The latest version of this license is in } \cs_new_protected:Npn \__eb_put_biblatex:n #1 {\PassOptionsToPackage{#1}{biblatex}} -\cs_new_protected:Npn \__eb_biblatex_pre_set: +\cs_new_protected:Npn \EbBiblatexPreset { \tl_if_empty:NTF \l__eb_bib_otherstyle_tl { - \tl_if_eq:VnT \l__eb_bib_style_tl{numerical} + \tl_if_eq:NnT \l__eb_bib_style_tl{numerical} {\__eb_put_biblatex:n {style = gb7714-2015}} - \tl_if_eq:VnT \l__eb_bib_style_tl{authoryear} + \tl_if_eq:NnT \l__eb_bib_style_tl{authoryear} {\__eb_put_biblatex:n {style = gb7714-2015ay}} }{\__eb_put_biblatex:n {style = \l__eb_bib_otherstyle_tl}} \tl_if_empty:NF \l__eb_bib_citestyle_tl {\__eb_put_biblatex:n {citestyle = \l__eb_bib_citestyle_tl}} \__eb_put_biblatex:n {backend = biber} } -\cs_new_protected:Npn \__eb_biblatex_post_set: +\cs_new_protected:Npn \EbBiblatexPostset { \exp_args:NV \addbibresource\l__eb_bib_file_tl \cs_gset:Npn \blx@default@theheading{bibintoc} \defbibheading{bibintoc}[\bibname]{\__eb_title_mark_intoc:n {##1}} \skip_set:Nn \bibitemsep{0ex} } -\ctex_at_end_preamble:n +\__eb_at_end_preamble:n { - \bool_if:NTF \l__eb_backend_bibtex_bool + \bool_if:NT \l__eb_bib_loadpkg_bool { - \RequirePackage[sort&compress]{natbib} - \__eb_bibtex_set: - }{ - \__eb_biblatex_pre_set: - \RequirePackage{biblatex} - \__eb_biblatex_post_set: + \bool_if:NTF \l__eb_backend_bibtex_bool + { + \RequirePackage[sort&compress]{natbib} + \EbBibtexSet + }{ + \EbBiblatexPreset + \RequirePackage{biblatex} + \EbBiblatexPostset + } } } @@ -2088,7 +2182,8 @@ The latest version of this license is in { \group_begin: \footnotesize - \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont + \exp_args:Nx + \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont \skip_gset:Nn \footnotesep{\ht\strutbox} \group_end: \bool_if:NT \l__eb_chap_withpart_bool @@ -2106,14 +2201,20 @@ The latest version of this license is in } \__eb_patch_cmd:Nnn \@footnotetext {\reset@font} - {\def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp}\l__eb_font_footnote_tl} + { + \def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp} + \l__eb_font_footnote_tl + } \__eb_patch_cmd:Nnn \@mpfootnotetext {\reset@font} - {\def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp}\l__eb_font_footnote_tl} + { + \def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp} + \l__eb_font_footnote_tl + } \__eb_patch_cmd:Nnn \@makefnmark {\normalfont}{\l__eb_font_footnote_tl} -\lstdefinestyle{mystyle} +\lstdefinestyle{easy-lst-sty} { language = [LaTeX]TeX, texcsstyle = @@ -2158,7 +2259,7 @@ The latest version of this license is in } \lstset { - style = mystyle, + style = easy-lst-sty, breaklines = true, resetmargins = true, % numbers = left, @@ -2215,9 +2316,13 @@ The latest version of this license is in \UrlBreaks{\UrlOrds\__eb_add_urlbreak_points:} } \tl_const:Nn \c__eb_urlbreak_points_tl - {ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789} + { + ABCDEFGHIJKLMNOPQRSTUVWXYZ + abcdefghijklmnopqrstuvwxyz + 0123456789 + } -\keys_define:nx {ctex/link} +\__ctex_define:nx {link} { hyperlink .choice:, hyperlink/edge .code:n = {}, @@ -2252,7 +2357,7 @@ The latest version of this license is in } } } -\keys_define:nx {ctex/style} +\__ctex_define:nx {style} { color .choice:, color .value_required:n = true, @@ -2274,7 +2379,7 @@ The latest version of this license is in \__eb_allow_urlbreak: \ctex_hypersetup:n {pdfstartview = FitH} \exp_args:NV \hypersetup\l__eb_hyperref_clist - \tl_if_eq:VnTF \l__ctex_scheme_tl{chinese} + \tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} { \keys_set_known:nn {ctex} { @@ -2305,7 +2410,7 @@ The latest version of this license is in \keys_set_known:nn {ctex} { abstractname = Abstract, - lstlistlistingname = List~of~Listings, + lstlistlistingname = List~of~Codes, lstlistingname = Code } \crefformat{equation}{#2Equation~(#1)#3} diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls index c4eba751794..1388e2c4070 100644 --- a/Master/texmf-dist/tex/latex/easybook/easybook.cls +++ b/Master/texmf-dist/tex/latex/easybook/easybook.cls @@ -13,9 +13,9 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/04/07}{1.24g}{beta} +\ProvidesExplClass{easybook}{2021/04/09}{1.24i}{beta} -\cs_generate_variant:Nn \keys_define:nn {nx} +\cs_generate_variant:Nn \__ctex_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} \cs_generate_variant:Nn \dim_add:Nn {NV} \cs_generate_variant:Nn \__eb_put_hyperref:n {x} @@ -27,6 +27,8 @@ {\ctex_patch_cmd_once:NnnnTF #1{}{#2}{#3}{}{\ctex_patch_failure:N #1}} \cs_new_protected:Npn \__eb_appto_cmd:Nn #1#2 {\ctex_appto_cmd:NnnTF #1{}{#2}{}{\ctex_patch_failure:N #1}} +\cs_new_protected:Npn \__eb_at_end_preamble:n + {\ctex_gadd_ltxhook:nn {env/document/before}} \bool_set_false:N \l__eb_draft_bool \bool_set_false:N \l__eb_newline_bool @@ -132,7 +134,7 @@ withpart .initial:n = false, notomath .bool_set:N = \l__eb_notomath_bool, notomath .default:n = true, - notomath .initial:n = false, + notomath .initial:n = true, rulewidth .dim_set:N = \l__eb_rule_width_dim, rulewidth .initial:n = 0.75pt, uppercase .bool_set:N = \l__eb_uppercase_bool, @@ -168,8 +170,8 @@ fancyhdr,titletoc, caption-light,subcaption, tabularx,multirow,booktabs, - tasks,enumitem, - listings,imakeidx + enumitem, + listings } \ctex_at_end_preamble:n { @@ -285,7 +287,8 @@ \cs_new_protected:Npn \kaishu{\__eb_switch_family:n {kaishu}} \cs_new_protected:Npn \fangsong{\__eb_switch_family:n {fangsong}} } -\cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\normalfont} +\__eb_at_end_preamble:n + {\cs_if_exist:NF \kaishu{\cs_gset_eq:NN \kaishu\normalfont}} \includepdfset{fitpaper = true} \geometry @@ -353,6 +356,7 @@ \easyhead[OC]{\color{ctex@frame}\kaishu\rightmark} \easyhead[EL,OR]{\color{ctex@frame}\thepage} }, + chap-mark .cs_set:Np = \__eb_fancyhf_chap_mark:n #1, chap-mark .initial:n = { @@ -375,6 +379,17 @@ \fi }#1 }, + subsec-mark .cs_set:Np = \__eb_fancyhf_subsec_mark:n #1, + subsec-mark .initial:n = + { + \int_compare:nT {\c@secnumdepth > 1} + { + \ifodd\CTEX@subsection@numbering + \CTEXthesubsection\hspace{0.5\ccwd} + \fi + }#1 + }, + headrule .tl_gset:N = \headrule, headrule .initial:n = { @@ -401,35 +416,56 @@ {\text_uppercase:n {\__eb_fancyhf_chap_mark:n {#1}}} {\text_titlecase_first:n {\__eb_fancyhf_chap_mark:n {#1}}} } +\cs_new_protected:Npn \__eb_ifupper_sectionmark_set:n #1 + { + \bool_if:NTF \l__eb_uppercase_bool + {\text_uppercase:n {\__eb_fancyhf_sec_mark:n {#1}}} + {\text_titlecase_first:n {\__eb_fancyhf_sec_mark:n {#1}}} + } +\cs_new_protected:Npn \__eb_ifupper_subsectionmark_set:n #1 + { + \bool_if:NTF \l__eb_uppercase_bool + {\text_uppercase:n {\__eb_fancyhf_subsec_mark:n {#1}}} + {\text_titlecase_first:n {\__eb_fancyhf_subsec_mark:n {#1}}} + } \ctex_at_end_preamble:n { \exp_args:NV \geometry\g__eb_geometry_clist - \pagestyle{fancy} \fancyhf{} - \bool_if:NTF \l__eb_page_twoside_bool + \tl_use:N \l__eb_fancyhf_content_tl + \cs_gset_eq:NN \ps@plain\ps@empty + \pagestyle{fancy} + \bool_if:NTF \l__eb_class_book_bool { - \cs_gset:Npn \chaptermark#1 + \bool_if:NTF \l__eb_page_twoside_bool { - \markboth - {\__eb_ifupper_chaptermark_set:n {#1}} - {\__eb_ifupper_chaptermark_set:n {#1}} + \cs_gset:Npn \chaptermark#1 + { + \markboth + {\__eb_ifupper_chaptermark_set:n {#1}} + {\__eb_ifupper_chaptermark_set:n {#1}} + } + }{ + \cs_gset:Npn \chaptermark#1 + {\markboth{\__eb_ifupper_chaptermark_set:n {#1}}{}} } - \l__eb_fancyhf_content_tl - \cs_gset_eq:NN \ps@plain\ps@empty + \cs_gset:Npn \sectionmark#1 + {\markright{\__eb_ifupper_sectionmark_set:n {#1}}} }{ - \cs_gset:Npn \chaptermark#1 - {\markboth{\__eb_ifupper_chaptermark_set:n {#1}}{}} - \l__eb_fancyhf_content_tl - \cs_gset_eq:NN \ps@plain\ps@empty - } - \cs_gset:Npn \sectionmark#1 - { - \markright + \bool_if:NTF \l__eb_page_twoside_bool { - \bool_if:NTF \l__eb_uppercase_bool - {\text_uppercase:n {\__eb_fancyhf_sec_mark:n {#1}}} - {\text_titlecase_first:n {\__eb_fancyhf_sec_mark:n {#1}}} + \cs_gset:Npn \sectionmark#1 + { + \markboth + {\__eb_ifupper_sectionmark_set:n {#1}} + {\__eb_ifupper_sectionmark_set:n {#1}} + } + }{ + \cs_gset:Npn \sectionmark#1 + {\markboth{\__eb_ifupper_sectionmark_set:n {#1}}{}} } + \cs_gset:Npn \subsectionmark#1 + {\markright{\__eb_ifupper_subsectionmark_set:n {#1}}} } \bool_if:NT \l__eb_draft_bool { @@ -576,7 +612,7 @@ {\text_uppercase:n {#1}} {\text_titlecase_first:n {#1}} } -\cs_new_protected:Npn \__eb_markboth:n #1 +\cs_new_protected:Npn \eb@markdouble#1 { \bool_if:NTF \l__eb_page_twoside_bool { @@ -607,14 +643,14 @@ \section*{\phantomsection#1} \CTEX@addtocline{section}{#1} } - \__eb_markboth:n {#1} + \eb@markdouble{#1} } -\cs_new_protected:Npn \__eb_title_mark:n #1 +\cs_new_protected:Npn \__eb_title_mark_notoc:n #1 { \tl_if_eq:NnTF \l__eb_toc_type_tl{book} {\chapter*{\phantomsection#1}} {\section*{\phantomsection#1}} - \__eb_markboth:n {#1} + \eb@markdouble{#1} } \cs_new_protected:Npn \__eb_ifmultoc_pre_set: { @@ -643,7 +679,7 @@ \cs_new_protected:Npn \__eb_title_ifintoc_set:n #1 { \IfBooleanTF{#1} - {\__eb_title_mark:n {\eb@toc@title}} + {\__eb_title_mark_notoc:n {\eb@toc@title}} {\__eb_title_mark_intoc:n {\eb@toc@title}} } \RenewDocumentCommand{\tableofcontents}{o} @@ -652,7 +688,7 @@ \tl_set_eq:NN \eb@toc@title\contentsname \IfValueT{#1}{\keys_set:nn {listoc}{#1}} \__eb_ifmultoc_pre_set: - \__eb_title_mark:n {\eb@toc@title} + \__eb_title_mark_notoc:n {\eb@toc@title} \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{toc} \__eb_ifmultoc_post_set: @@ -698,22 +734,25 @@ \group_end: } -\makeindex[ - intoc, - options = -M~texindy~-C~utf8, - program = truexindy, - columns = 2, - columnsep = 2\ccwd - ] -\indexsetup - { - level = \bool_if:NTF \l__eb_class_book_bool{\chapter*}{\section*}, - toclevel = \bool_if:NTF \l__eb_class_book_bool{chapter}{section}, - firstpagestyle = \bool_if:NTF \l__eb_class_book_bool{plain}{fancy} +\ctex_at_end_package:nn {imakeidx} + { + \makeindex[ + intoc, + options = -M~texindy~-C~utf8, + program = truexindy, + columns = 2, + columnsep = 2\ccwd + ] + \indexsetup + { + level = \bool_if:NTF \l__eb_class_book_bool{\chapter*}{\section*}, + toclevel = \bool_if:NTF \l__eb_class_book_bool{chapter}{section}, + firstpagestyle = \bool_if:NTF \l__eb_class_book_bool{plain}{fancy} + } + \ctex_patch_cmd:Nnn \imki@indexheaders + {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} + {\eb@markdouble{\indexname}} } -\__eb_patch_cmd:Nnn \imki@indexheaders - {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} - {\__eb_markboth:n {\indexname}} \tl_new:N \l__eb_font_table_tl \tl_new:N \l__eb_font_figure_tl @@ -895,7 +934,7 @@ \cs_new_protected:Npn \__eb_thmname_set:nn #1#2 {\tl_const:cn {c__eb_name_#1_tl}{#2}} -\tl_if_eq:VnTF \l__ctex_scheme_tl{chinese} +\tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} { \clist_map_inline:nn { @@ -987,7 +1026,7 @@ name = \use:c {c__eb_name_#1_tl} ]{#1} } - \cs_gset_eq:NN \proof\relax + \cs_undefine:N \proof \declaretheorem[ style = easy-thm-sty, name = \c__eb_name_remark_tl, @@ -1001,13 +1040,16 @@ ]{proof} } -\settasks +\ctex_at_end_package:nn {tasks} { - label = (\Alph*), - after-item-skip = 0ex plus .1ex, - column-sep = .5\ccwd, - item-indent = 2\ccwd, - label-width = 1.5\ccwd + \settasks + { + label = (\Alph*), + after-item-skip = 0ex plus .1ex, + column-sep = .5\ccwd, + item-indent = 2\ccwd, + label-width = 1.5\ccwd + } } \setchemformula { @@ -1225,19 +1267,23 @@ cite-style .code:n = {\tl_set:Nn \l__eb_bib_citestyle_tl{#1}}, bibfile .tl_set:N = \l__eb_bib_file_tl, - bibfile .initial:n = refs.bib + bibfile .initial:n = refs.bib, + + bib-loadpkg .bool_set:N = \l__eb_bib_loadpkg_bool, + bib-loadpkg .default:n = true, + bib-loadpkg .initial:n = true } -\cs_new_protected:Npn \__eb_bibtex_set: +\cs_new_protected:Npn \EbBibtexSet { \tl_if_empty:NTF \l__eb_bib_otherstyle_tl { - \tl_if_eq:VnT \l__eb_bib_style_tl{numerical} + \tl_if_eq:NnT \l__eb_bib_style_tl{numerical} { \bibliographystyle{gbt7714-numerical} \setcitestyle{comma,square,super} } - \tl_if_eq:VnT \l__eb_bib_style_tl{authoryear} + \tl_if_eq:NnT \l__eb_bib_style_tl{authoryear} {\bibliographystyle{gbt7714-author-year}} \cs_set_eq:NN \cite\citep }{\exp_args:NV \bibliographystyle\l__eb_bib_otherstyle_tl} @@ -1258,36 +1304,39 @@ } \cs_new_protected:Npn \__eb_put_biblatex:n #1 {\PassOptionsToPackage{#1}{biblatex}} -\cs_new_protected:Npn \__eb_biblatex_pre_set: +\cs_new_protected:Npn \EbBiblatexPreset { \tl_if_empty:NTF \l__eb_bib_otherstyle_tl { - \tl_if_eq:VnT \l__eb_bib_style_tl{numerical} + \tl_if_eq:NnT \l__eb_bib_style_tl{numerical} {\__eb_put_biblatex:n {style = gb7714-2015}} - \tl_if_eq:VnT \l__eb_bib_style_tl{authoryear} + \tl_if_eq:NnT \l__eb_bib_style_tl{authoryear} {\__eb_put_biblatex:n {style = gb7714-2015ay}} }{\__eb_put_biblatex:n {style = \l__eb_bib_otherstyle_tl}} \tl_if_empty:NF \l__eb_bib_citestyle_tl {\__eb_put_biblatex:n {citestyle = \l__eb_bib_citestyle_tl}} \__eb_put_biblatex:n {backend = biber} } -\cs_new_protected:Npn \__eb_biblatex_post_set: +\cs_new_protected:Npn \EbBiblatexPostset { \exp_args:NV \addbibresource\l__eb_bib_file_tl \cs_gset:Npn \blx@default@theheading{bibintoc} \defbibheading{bibintoc}[\bibname]{\__eb_title_mark_intoc:n {##1}} \skip_set:Nn \bibitemsep{0ex} } -\ctex_at_end_preamble:n +\__eb_at_end_preamble:n { - \bool_if:NTF \l__eb_backend_bibtex_bool + \bool_if:NT \l__eb_bib_loadpkg_bool { - \RequirePackage[sort&compress]{natbib} - \__eb_bibtex_set: - }{ - \__eb_biblatex_pre_set: - \RequirePackage{biblatex} - \__eb_biblatex_post_set: + \bool_if:NTF \l__eb_backend_bibtex_bool + { + \RequirePackage[sort&compress]{natbib} + \EbBibtexSet + }{ + \EbBiblatexPreset + \RequirePackage{biblatex} + \EbBiblatexPostset + } } } @@ -1295,7 +1344,8 @@ { \group_begin: \footnotesize - \exp_args:Nx \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont + \exp_args:Nx + \linespread{\fp_use:N \l__eb_spread_footnote_fp}\selectfont \skip_gset:Nn \footnotesep{\ht\strutbox} \group_end: \bool_if:NT \l__eb_chap_withpart_bool @@ -1313,14 +1363,20 @@ } \__eb_patch_cmd:Nnn \@footnotetext {\reset@font} - {\def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp}\l__eb_font_footnote_tl} + { + \def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp} + \l__eb_font_footnote_tl + } \__eb_patch_cmd:Nnn \@mpfootnotetext {\reset@font} - {\def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp}\l__eb_font_footnote_tl} + { + \def\baselinestretch{\fp_use:N \l__eb_spread_footnote_fp} + \l__eb_font_footnote_tl + } \__eb_patch_cmd:Nnn \@makefnmark {\normalfont}{\l__eb_font_footnote_tl} -\lstdefinestyle{mystyle} +\lstdefinestyle{easy-lst-sty} { language = [LaTeX]TeX, texcsstyle = @@ -1365,7 +1421,7 @@ } \lstset { - style = mystyle, + style = easy-lst-sty, breaklines = true, resetmargins = true, % numbers = left, @@ -1422,9 +1478,13 @@ \UrlBreaks{\UrlOrds\__eb_add_urlbreak_points:} } \tl_const:Nn \c__eb_urlbreak_points_tl - {ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789} + { + ABCDEFGHIJKLMNOPQRSTUVWXYZ + abcdefghijklmnopqrstuvwxyz + 0123456789 + } -\keys_define:nx {ctex/link} +\__ctex_define:nx {link} { hyperlink .choice:, hyperlink/edge .code:n = {}, @@ -1459,7 +1519,7 @@ } } } -\keys_define:nx {ctex/style} +\__ctex_define:nx {style} { color .choice:, color .value_required:n = true, @@ -1481,7 +1541,7 @@ \__eb_allow_urlbreak: \ctex_hypersetup:n {pdfstartview = FitH} \exp_args:NV \hypersetup\l__eb_hyperref_clist - \tl_if_eq:VnTF \l__ctex_scheme_tl{chinese} + \tl_if_eq:NnTF \l__ctex_scheme_tl{chinese} { \keys_set_known:nn {ctex} { @@ -1512,7 +1572,7 @@ \keys_set_known:nn {ctex} { abstractname = Abstract, - lstlistlistingname = List~of~Listings, + lstlistlistingname = List~of~Codes, lstlistingname = Code } \crefformat{equation}{#2Equation~(#1)#3} -- cgit v1.2.3