diff options
author | Karl Berry <karl@freefriends.org> | 2021-05-04 22:26:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-05-04 22:26:44 +0000 |
commit | b0bd9715b1c3d53f6da98005d98f487af1b9f1f2 (patch) | |
tree | 765dcdb7dfe591afa570cee795f1e0a3a3c488c9 /Master/texmf-dist/source | |
parent | 91807c5514100ebba5c8825abdc9d92bcf13d2ee (diff) |
easybook (5may21)
git-svn-id: svn://tug.org/texlive/trunk@59076 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/easybook/easybook.dtx | 298 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/easybook/easybook.ins | 25 |
2 files changed, 209 insertions, 114 deletions
diff --git a/Master/texmf-dist/source/latex/easybook/easybook.dtx b/Master/texmf-dist/source/latex/easybook/easybook.dtx index 73f3c1ead7b..71eec1dedc0 100644 --- a/Master/texmf-dist/source/latex/easybook/easybook.dtx +++ b/Master/texmf-dist/source/latex/easybook/easybook.dtx @@ -6,38 +6,9 @@ % conditions of the CC-BY 4.0 License. % The latest version of this license is in % https://creativecommons.org/licenses/by/4.0/legalcode -%<*driver> -\def\nameofplainTeX{plain} -\ifx\fmtname\nameofplainTeX -\else - \expandafter\begingroup -\fi -%<*install> -\input ctxdocstrip -\keepsilent -\askforoverwritefalse -% -\preamble -Copyright (C) 2021 by Qu Yi <quee123@foxmail.com> - -This work may be distributed and/or modified under the -conditions of the CC-BY 4.0 License. -The latest version of this license is in - https://creativecommons.org/licenses/by/4.0/legalcode -\endpreamble -% -\generate - { - \usedir{tex/latex/\jobname} - \file{\jobname.cls}{\from{\jobname.dtx}{class}} - } -%</install> -\ifx\fmtname\nameofplainTeX - \expandafter\endbatchfile -\else - \expandafter\endgroup -\fi -%</driver> +% \fi +% +% \iffalse %<*driver> \documentclass{ctxdoc} \OnlyDescription @@ -53,40 +24,57 @@ The latest version of this license is in % \changes{v1.20}{2021/01/09}{修改和完善用户文档。} % \changes{v1.20}{2021/01/09}{模板更改为使用 CC-BY 许可协议。} % \changes{v1.23}{2021/03/19}{修复在 \pkg{ctex} v2.5.6 更新后 \cls{easybook} 与 \pkg{hyperref} 冲突问题。} +% \changes{v1.25a}{2021/05/03}{取消附带的示例文件,可查看历史版本及其它来源的使用样例。} % % \title{\sffamily easybook 文档类手册} % \author{瞿毅} -% \date{2021/05/02\hskip\ccwd\relax v1.24z\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/05/04\hskip\ccwd\relax v1.25a\thanks{\url{https://gitee.com/texl3/easybook}}} % % \maketitle % \begin{abstract} -% \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装。虽然\CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并已载入一些常用宏包用于实现一般的排版需求,同时也具有 \cls{article} 文档类的功能,使用户可以简便地进行设置。它适用于排版中英文学术书籍、笔记或者是学位论文。 +% \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装与增强。虽然 \CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并已载入一些常用宏包用于实现一般的排版需求,同时也具有 \cls{article} 文档类的功能,使用户可以简便地进行设置。它适用于排版中英文学术书籍、笔记或者是学位论文。 % \end{abstract} % \tableofcontents % -% \begin{documentation} -% \section{编译方式} -% 编译文档类的一个使用示例文件 \opt{easybook-demo.tex} 前建议满足以下的条件 +% \section{使用说明} +% 使用 \cls{easybook} 文档类编写文档前您可能需要满足以下的条件 % \begin{itemize} % \item 使用 \hologo{XeLaTeX}(推荐)或 \hologo{LuaLaTeX} 两种编译方式。 -% \item 由于用到了一些\LaTeX 和宏包较新的功能,建议安装最新的\TeX 发行版,例如 \TeX Live 2021或 \hologo{MiKTeX} 21.2之后的版本。 +% \item 由于用到了一些 \LaTeX 和宏包较新的功能,建议安装最新的 \TeX 发行版,例如 \TeX Live 2021或 \hologo{MiKTeX} 21.2之后的版本。 % \end{itemize} % -% \subsection{编译步骤} +% \subsection{基本用法} +% 以下一份简单的 \TeX 文档演示了 \cls{easybook} 的最基本用法,在导言区进行宏包载入与文档设置,一些详细的使用样例会不定期上传在 \href{https://www.latexstudio.net/}{\LaTeX 工作室} 的网站。 % \begin{frameverb} -% xelatex -shell-escape easybook-demo -% bibtex easybook-demo -% makeindex easybook-demo -% xelatex -shell-escape easybook-demo -% xelatex -shell-escape easybook-demo +% \documentclass{easybook} +% +% \ctexset{键值列表} +% \usepackage{宏包列表} +% +% \begin{document} +% \chapter{欢迎} +% \section{Welcome to easybook} +% Hello, \LaTeX +% \end{document} % \end{frameverb} +% +% \subsection{编译方式} +% 假设您的 \TeX 源文件名为 \opt{easybook.tex},需要使用参考文献和索引功能,并使用 \hologo{XeLaTeX} 和 \hologo{BibTeX} 引擎编译文档,那么需要在命令行中执行 +% \begin{frameverb} +% xelatex -shell-escape easybook +% bibtex easybook +% makeindex easybook +% xelatex -shell-escape easybook +% xelatex -shell-escape easybook +% \end{frameverb} +% 当然也可以使用 \opt{latexmk} 及一些软件自带的编译工具,这里就不做介绍。 \\ % \ding{72} 需要注意正确\textbf{编译索引}要增加 \opt{-shell-escape} 命令行选项。 % % \subsection{字体设置} % \label{subsec:font settings} -% 默认使用\CTeX 预置中文字库,当开启 \opt{font = noto} 选项时需要安装开源字体,中文使用方正系列的{\songti 方正书宋}、{\heiti 方正黑体}、{\kaishu 方正楷体}和{\fangsong 方正仿宋},英文使用思源系列的{\rmfamily Noto Serif}、{\sffamily Noto Sans}和{\ttfamily Noto Sans Mono},数学字体使用 \pkg{notomath}。相关选项可以见节 \ref{sec:document class options} 中的 \opt{font} 选项,字体点击此处下载\href{https://wws.lanzous.com/b01ns361i}{下载地址}。 +% 默认使用 \CTeX 预置中文字库,当开启 \opt{font = noto} 选项时需要安装开源字体,中文使用方正系列的{\songti 方正书宋}、{\heiti 方正黑体}、{\kaishu 方正楷体}和{\fangsong 方正仿宋},英文使用思源系列的{\rmfamily Noto Serif}、{\sffamily Noto Sans}和{\ttfamily Noto Sans Mono},数学字体使用 \pkg{notomath}。相关选项可以见节 \ref{sec:document class options} 中的 \opt{font} 选项,字体点击此处下载\href{https://wws.lanzous.com/b01ns361i}{下载地址}。 % -% 如果您不想使用\CTeX 默认字体和方正、思源字体,\textbf{自定义字体}需启用选项 \opt{font = none},并可在导言区设置中文字体,粗体与斜体不设置会产生警告。 +% 如果您不想使用 \CTeX 默认字体和方正、思源字体,\textbf{自定义字体}需启用选项 \opt{font = none},并可在导言区设置中文字体,粗体与斜体不设置会产生警告。 % \begin{ctexexam} % \setCJKmainfont{SimSun}[BoldFont = SimHei,ItalicFont = KaiTi] % \setCJKsansfont{SimHei} @@ -98,7 +86,7 @@ The latest version of this license is in % 标准 \cls{book} 文类与 \cls{ctexbook} 文类的选项同样适用于本文档。除此之外选项分为两类 % \begin{itemize} % \item 带有 \rexptarget\rexpstar{} 号的选项,需要在引入文档类的时候设定。 -% \item 带有 \exptarget\expstar{} 号的选项,需要通过\CTeX 宏集提供的用户接口命令 \tn{ctexset} 或节 \ref{sec:interface options} 中此选项所属模块接口命令设定。 +% \item 带有 \exptarget\expstar{} 号的选项,需要通过 \CTeX 宏集提供的用户接口命令 \tn{ctexset} 或节 \ref{sec:interface options} 中此选项所属模块接口命令设定。 % \end{itemize} % % \begin{function}[rEXP,added = 2021-01-05]{draft} @@ -117,7 +105,7 @@ The latest version of this license is in % \begin{syntax} % scheme = <(chinese)|plain> % \end{syntax} -% \opt{scheme} 代表文档的主题,扩展了此选项在\CTeX 文档类中原有的作用范围,\opt{plain} 选项可使各类标题变为英文形式。包括章节标题、图表标题和定理标题等。如\textbf{第一章}变为\textbf{Chapter 1},\textbf{图1.1} 变为 \textbf{Table 1.1}。 +% \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,updated = 2021-04-29]{enmode} @@ -129,7 +117,8 @@ The latest version of this license is in % font = <adobe|founder|mac|windows|linux|(overleaf)|noto|none> % \end{syntax} % 传递给 \cls{ctexbook} 设置字体,最好不要使用原有的 \opt{fontset} 选项,默认情况下使用自定义字体而不开启这个选项,可根据安装的字体及电脑系统选取。\opt{noto} 与 \opt{none} 选项的相关描述见小节 \ref{subsec:font settings},\opt{overleaf} 是一个各系统通用选项,会检测系统环境选取对应字体。 -% \changes{v1.21}{2021/01/12}{默认字体与\CTeX 一致,不再是自定义字体。} +% \changes{v1.21}{2021/01/12}{默认字体与 \CTeX 一致,不再是自定义字体。} +% \changes{v1.25a}{2021/05/04}{修复使用 \pkg{xeCJK} 与 \pkg{fontspec} 宏包的字体设置命令在 \hologo{LuaLaTeX} 下失效的问题。} % \end{function} % % \begin{function}[rEXP,added = 2021-01-05,updated = 2021-01-13]{paper} @@ -158,29 +147,46 @@ The latest version of this license is in % % \subsection{文档命令} % \label{subsec:document command} -% \begin{function}[added = 2021-02-20,updated = 2021-04-29]{\frontmatter,\mainmatter,\backmatter,\cleardoublepage,\tableofcontents,\listoffigures,\listoftables,\listoflistings} +% \begin{function}[added = 2021-02-20,updated = 2021-04-29]{\frontmatter,\mainmatter,\backmatter,\cleardoublepage} % \begin{syntax} % \tn{frontmatter*}\oarg{编号格式|(Roman)} % \tn{mainmatter*} % \tn{backmatter} % \tn{cleardoublepage}\oarg{页面风格|(empty)} -% \tn{tableofcontents}\oarg{键值列表} +% \end{syntax} +% \tn{frontmatter} 为前言区命令,章标题不编号,页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,带有星号的命令 \tn{frontmatter*} 不使用清双页命令 \tn{cleardoublepage}。\tn{mainmatter} 为主文区命令,章标题正常编号且页码为从1开始计数的阿拉伯数字,\tn{mainmatter*} 命令不使用 \tn{cleardoublepage}。\tn{backmatter} 为后记区命令,页码格式与编号保持不变,章标题不编号。在奇数页使用命令 \tn{cleardoublepage} 时可选参数为下一页多出的空白偶数页的页面风格,默认为 \opt{empty} 即空的页眉页脚。 +% \changes{v1.23}{2021/02/20}{重新定义文档结构划分命令。} +% \end{function} +% +% \begin{function}[added = 2021-02-20,updated = 2021-05-04]{\tableofcontents,\listoffigures,\listoftables,\listoflistings} +% \begin{syntax} +% \tn{tableofcontents+}\oarg{键值列表} % \tn{listoffigures*+}\oarg{键值列表} % \tn{listoftables*+}\oarg{键值列表} % \tn{listoflistings*+}\oarg{键值列表} % \end{syntax} -% \tn{frontmatter} 为前言区命令,章标题不编号,页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,带有星号的命令 \tn{frontmatter*} 不使用清双页命令 \tn{cleardoublepage}。\tn{mainmatter} 为主文区命令,章标题正常编号且页码为从1开始计数的阿拉伯数字,\tn{mainmatter*} 命令不使用 \tn{cleardoublepage}。\tn{backmatter} 为后记区命令,页码格式与编号保持不变,章标题不编号。在奇数页使用命令 \tn{cleardoublepage} 时可选参数为下一页多出的空白偶数页的页面风格,默认为 \opt{empty} 即空的页眉页脚。\tn{listoffigures} 命令输出图片目录,\tn{listoftables} 输出表格目录,\tn{listoflistings} 输出代码目录。带有星号的目录命令不将标题添加进主文档目录,带有+号的目录命令可以使当前标题编号。目录的键值列表选项如下 -% \changes{v1.23}{2021/02/20}{重新定义文档结构划分命令。} +% \tn{listoffigures} 命令输出图片目录,\tn{listoftables} 输出表格目录,\tn{listoflistings} 输出代码目录。带有星号的目录命令不将标题添加进主文档目录,带有+号的目录命令可以使当前标题编号。\tn{tableofcontents+} 与其它命令不同是用于输出双语目录,需要与双语目录标题命令 \tn{bichapter} 等配合使用。目录的键值列表选项如下 +% \changes{v1.25a}{2021/05/04}{命令 \tn{tableofcontents} 可以输出双语目录。} % \end{function} % % \begin{function}{multoc,title,book,article} % \begin{syntax} % multoc = <true|(false)> -% title = <目录标题名称> +% title = \{<中文目录标题>,<英文目录标题>\} % \end{syntax} -% \opt{multoc} 与 \opt{style/multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同目录是否双栏排版。已经预置了中英文的目录标题,可以使用 \opt{title} 选项更改目录标题的名称。\opt{book} 选项使目录标题按照 \opt{chapter} 级别输出,\opt{article} 选项使目录标题按照 \opt{article} 级别输出,默认为 \opt{chapter} 级别。 +% \opt{multoc} 与 \opt{style/multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同目录是否双栏排版。\opt{title} 选项用于更改目录的标题,标题之间用一个半角逗号分开,也可以只有一部分,表示中文目录的标题,不过英文目录标题目前仅对 \tn{tableofcontents} 命令有效。\opt{book} 选项使目录标题按照 \opt{chapter} 级别输出,\opt{article} 选项使目录标题按照 \opt{article} 级别输出,默认为 \opt{chapter} 级别。 % \changes{v1.23}{2021/03/15}{为几个目录增加键值列表的选项,可设置标题输出级别以及是否加入主目录。} -% \changes{v1.24z}{2021/04/04}{目录命令的可选参数增加标题键值。} +% \changes{v1.24}{2021/04/04}{目录命令的可选参数增加标题键值。} +% \end{function} +% +% \begin{function}[added = 2021-05-04]{\bichapter,\bisection,\bisubsection} +% \begin{syntax} +% \tn{bichapter}\marg{中文标题}\marg{英文标题(在目录中)} +% \tn{bichapter}\marg{中文标题}\marg{英文标题(在目录中)} +% \tn{bichapter}\marg{中文标题}\marg{英文标题(在目录中)} +% \end{syntax} +% 双语目录的标题命令目前设置了三个级别,它们将中文标题正常输出,并将中英文标题加入双语目录,这个功能是为国内一些大学的学位论文模板的要求设计,当然在英文模式下不需要使用。双语目录的格式是一致的,使用 \tn{tocset} 设置,英文目录的章级别标题名为 Chapter 暂不支持修改。 +% \changes{v1.25a}{2021/05/04}{增加与双语目录配合的标题命令。} % \end{function} % % \section{接口选项} @@ -189,7 +195,7 @@ The latest version of this license is in % \begin{syntax} % \tn{ctexset}\marg{键值列表} % \end{syntax} -% \cls{easybook} 扩展了\CTeX 宏集\LaTeX 3风格键值的通用控制命令 \tn{ctexset},接口选项同样可用它设置, 原有的键值列表仍然可用。本文档类目前有九个模块用于实现常规的排版功能,如下表所示,它们既是统一接口 \tn{ctexset} 的路径,也是相关模块的接口命令名 +% \cls{easybook} 扩展了 \CTeX 宏集\LaTeX 3风格键值的通用控制命令 \tn{ctexset},接口选项同样可用它设置, 原有的键值列表仍然可用。本文档类目前有九个模块用于实现常规的排版功能,如下表所示,它们既是统一接口 \tn{ctexset} 的路径,也是相关模块的接口命令名 % \begin{center} % \begin{tabular}{*{5}{c}} % \toprule @@ -263,7 +269,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.24z}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} +% \changes{v1.24}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} % \end{function} % % \begin{optdesc} @@ -284,12 +290,12 @@ The latest version of this license is in % \label{subsec:spacing} % \begin{function}[EXP,added = 2021-01-05,updated = 2021-04-19]{line,table,math,caption,footnote,spread-all} % \begin{syntax} -% line = <(1.3)> -% table = <(1.05)> -% math = <(1.05)> -% caption = <(1)> -% footnote = <(1)> -% spread-all = <(empty)> +% line = <数值|(1.3)> +% table = <数值|(1.05)> +% math = <数值|(1.05)> +% caption = <数值|(1)> +% footnote = <数值|(1)> +% spread-all = <数值|(empty)> % \end{syntax} % \ding{229} 以上选项路径为 \opt{spread/...} \\ % 行距因子用于设置各种行距倍数,只能是浮点数,不能带有长度单位。各行距既可在导言区全局设置也可正文中设置对后面生效,行距的意义为 @@ -342,7 +348,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.24z}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} +% \changes{v1.24}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} % \end{function} % % \begin{optdesc} @@ -380,9 +386,9 @@ The latest version of this license is in % \begin{syntax} % thmbox = <true|(false)> % within = <(chapter)|section|其它环境|空置> -% headpunct = <(未设置)> -% bodyfont = <(未设置)> -% notefont = <(未设置)> +% headpunct = <(empty)> +% bodyfont = <(empty)> +% notefont = <(empty)> % headfont = <(\tn{color}\marg{ctex@emph}\tn{sffamily})> % headindent = <(0\tn{ccwd})> % spaceabove = <(0.75ex plus .1ex)> @@ -414,14 +420,14 @@ The latest version of this license is in % \end{syntax} % 文档类已预置8个定理环境,环境名及对应的定理标题名见小节 \ref{subsec:theorem},如果需要新的定理标题名或定理样式可使用这两个命令。 % \changes{v1.23}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。} -% \changes{v1.24z}{2021/04/25}{增加定义定理环境命令 \tn{EbNewtheorem}。} +% \changes{v1.24}{2021/04/25}{增加定义定理环境命令 \tn{EbNewtheorem}。} % \end{function} % % \begin{optdesc} % \item[\tn{newtheorem}] 定义新的定理类环境,可选参数与 \pkg{thmtools} 宏包定理命令 \tn{declaretheorem} 的参数一致。常用的选项如下 % \begin{description} % \item[name] 定理的标题。默认值是环境的名称,并且首字母大写(英文标题)。 -% \item[numbered] 值为 \opt{no}、\opt{yes} 或 \opt{unless unique}。定理将被编号,而不是编号,或者只有在文档中多次出现时才被编号。 +% \item[numbered] 值为 \opt{no}、\opt{yes} 或 \opt{unless unique}。定理可以被编号、不被编号或者只有在文档中多次出现时才被编号。 % \item[numberlike] 定理将使用此计数器进行编号,通常这是另一个定理环境的名称。 % \item[style] 用 \tn{declaretheoremstyle} 定义的定理样式的名称,定理将使用这种样式的设置。 % \end{description} @@ -471,10 +477,11 @@ The latest version of this license is in % \begin{ctexexam} % \geoset % { -% top = 2.5cm, -% bottom = 2.5cm, -% left = 3.2cm, -% right = 3.2cm +% top = 2.5cm, +% bottom = 2.5cm, +% left = 3.2cm, +% right = 3.2cm, +% ignoreall % } % \end{ctexexam} % @@ -498,7 +505,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.24z}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} +% \changes{v1.24}{2021/04/09}{增加 \opt{subsec-mark} 标志选项,仅在 \opt{article} 模式生效。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-03-14]{\easyhead,\easyfoot} @@ -518,8 +525,8 @@ The latest version of this license is in % \easyhead[OL]{\rightmark} % \easyhead[EL,OR]{\textbf{\thepage}} % }, -% sec-mark = \CTEXthesection\hspace{0.5\ccwd}#1, -% headrule = \hrule width \textwidth height 1pt +% sec-mark = \CTEXthesection\hspace{0.5\ccwd}#1, +% headrule = \hrule width \textwidth height 1pt % } % \end{ctexexam} % @@ -538,7 +545,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.24z}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} +% \changes{v1.24}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-04-20]{\tocrule,\EbNumberline} @@ -548,7 +555,7 @@ The latest version of this license is in % \end{syntax} % \tn{tocrule} 命令生成目录引导线,需要在 \opt{rule} 选项中使用。带有星号的命令会使当前级别的目录引导线右边与页码连接而不是对齐。引导点间距需带有长度单位,引导点大小不带单位,为引导点符号正常大小的倍数,引导点一般为英文句号或 \tn{cdot} 中心点符号。页码格式的内容位于页码前面,可以设置页码字体、距离。 % -% \tn{EbNumberline} 命令类似\CTeX 的 \tn{CTEXnumberline} 命令,用于 \opt{tocline} 选项中设置目录标签的编号。区别是它需要在 \opt{tocset/hang = false} 时使用,否则目录中无法显示标题编号,使用它的时候 \opt{numsep} 选项仍然有效。\meta{编号类型} 为 \opt{chapter} 和 \opt{section} 等,也可用参数\#1代替当前级别类型,标题名用参数\#2代替一般不变。 +% \tn{EbNumberline} 命令类似 \CTeX 的 \tn{CTEXnumberline} 命令,用于 \opt{tocline} 选项中设置目录标签的编号。区别是它需要在 \opt{tocset/hang = false} 时使用,否则目录中无法显示标题编号,使用它的时候 \opt{numsep} 选项仍然有效。\meta{编号类型} 为 \opt{chapter} 和 \opt{section} 等,也可用参数\#1代替当前级别类型,标题名用参数\#2代替一般不变。 % \end{function} % % \begin{ctexexam} @@ -556,9 +563,9 @@ The latest version of this license is in % { % chapter = % { -% format = \addvspace{8pt}\large, -% indent = 1.5\ccwd, -% rule = \tocrule[0.6pc](1.1){.}[\zihao{5}] +% format = \addvspace{8pt}\large, +% indent = 1.5\ccwd, +% rule = \tocrule[0.6pc](1.1){.}[\zihao{5}] % } % } % \end{ctexexam} @@ -578,20 +585,20 @@ The latest version of this license is in % rule-all = <目录引导线样式> % \end{syntax} % \ding{229} 以上选项路径为 \opt{tocset/list/...} 或 \opt{tocset/...} -% \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} 选项。} +% \changes{v1.24}{2021/04/05}{可以设置图、表和代码目录的标签。} +% \changes{v1.24}{2021/04/06}{增加目录引导线右边对齐方式。} +% \changes{v1.24}{2021/04/19}{给目录增加 \opt{hang} 样式选项。} +% \changes{v1.24}{2021/05/01}{给目录增加 \opt{format+} 和 \opt{rule-all} 选项。} % \end{function} % % \begin{optdesc} -% \item[lolskip] \opt{lolskip} 是代码目录中章之间的代码标题的距离,与\CTeX 的表格目录和图片目录中章之间的标题距离选项 \opt{lotskip} 和 \opt{lofskip} 类似,它们的值均默认0.8 pc,在 \opt{article} 模式中此选项失效。 +% \item[lolskip] \opt{lolskip} 是代码目录中章之间的代码标题的距离,与 \CTeX 的表格目录和图片目录中章之间的标题距离选项 \opt{lotskip} 和 \opt{lofskip} 类似,它们的值均默认0.8 pc,在 \opt{article} 模式中此选项失效。 % \item[belowoffset] \opt{belowoffset} 选项为主目录标题 \tn{contentsname} 后的间距补偿,一般为负值,用于抵消 \opt{format} 中设置的垂直间距。\opt{list} 中的 \opt{belowoffset} 与之意义类似,但是一般为正值,可以在 \opt{article} 模式中使用。建议 \opt{list/lolskip(0.8pc) + list/format/addvspace(0.2pc) + list/belowoffset(0pc) = belowoffset(-1pc)}。 % \item[tocline] 目录标签整体使用 \opt{tocline} 设置,在图表标签的参数中\#1代表编号,代码标签中则是 \tn{thelstlisting} 代表编号,标签中还可包含标签名称,默认标签名称与图、表和代码环境的标题名称一致。下面举个设置标签的例子 % \begin{ctexexam} % \tocset % { -% hang = false, +% hang = false, % tocline-fig = 图#1\hspace{\ccwd}, % tocline-lst = 代码\thelstlisting\hspace{\ccwd} % } @@ -623,7 +630,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.24z}{2021/04/08}{重新优化列表环境的配置。} +% \changes{v1.24}{2021/04/08}{重新优化列表环境的配置。} % \end{function} % % \begin{ctexexam} @@ -742,7 +749,7 @@ The latest version of this license is in % \tn{end}\marg{ebparbox} % \end{syntax} % 环境 \env{ebparbox} 与 \env{easybox} 类似,同样带有三个可选参数。当使用星号参数时盒子左边带有一条竖线,\meta{颜色名} 选项可以自定义竖线颜色,使用不带有星号的环境则盒子带有竖线颜色的浅色背景。\meta{段落标题} 选项可以设置标题,默认无标题。 -% \changes{v1.24z}{2021/04/19}{优化盒子环境的选项,增加可带有标题的扁平盒子 \env{ebparbox}。} +% \changes{v1.24}{2021/04/19}{优化盒子环境的选项,增加可带有标题的扁平盒子 \env{ebparbox}。} % \end{function} % % \subsubsection{行内盒子} @@ -764,7 +771,7 @@ The latest version of this license is in % \ <行间代码> % \tn{end}\marg{lstlisting} % \end{syntax} -% 加载 \pkg{listings} 宏包以对代码格式进行高度定制,代码样式可使用 \tn{lstset} 命令设置,预置的代码样式名为 \opt{easy-listings}。\opt{lstlistlistingname} 和 \opt{lstlistingname} 分别是代码目录名与代码环境标题名,与\CTeX 使用手册中标题汉化一节用法相同,可使用 \tn{ctexset} 直接定义。 +% 加载 \pkg{listings} 宏包以对代码格式进行高度定制,代码样式可使用 \tn{lstset} 命令设置,预置的代码样式名为 \opt{easy-listings}。\opt{lstlistlistingname} 和 \opt{lstlistingname} 分别是代码目录名与代码环境标题名,与 \CTeX 使用手册中标题汉化一节用法相同,可使用 \tn{ctexset} 直接定义。 % \end{function} % % \subsection{物理量} @@ -800,8 +807,8 @@ The latest version of this license is in % \tn{ref}\marg{标签} % \tn{labelformat}\marg{计数器}\marg{标签引用格式} % \end{syntax} -% 使用 \tn{ref} 命令进行引用将会自动检测环境并添加相应的前缀,\tn{labelformat} 可以设置标签引用格式,第二个参数中\#1代表 \tn{the}\meta{计数器},可以设置引用序号的前缀和后缀。 -% \changes{v1.24z}{2021/04/11}{取消载入 \pkg{cleveref} 宏包来交叉引用。} +% 使用 \tn{ref} 命令引用 \tn{label} 设置的标签,将会自动检测环境并添加相应的前缀,比如图表、章节标题和定理等。\tn{labelformat} 可以设置标签引用格式,第二个参数中\#1代表 \tn{the}\meta{计数器},可以设置引用序号的前缀和后缀。 +% \changes{v1.24}{2021/04/11}{取消载入 \pkg{cleveref} 宏包来交叉引用。} % \end{function} % % \subsubsection{索引} @@ -811,7 +818,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.24z}{2021/05/01}{重新定义 \tn{printindex} 命令与文档适配。} +% \changes{v1.24}{2021/05/01}{重新定义 \tn{printindex} 命令与文档适配。} % \end{function} % % \subsubsection{自定义脚注} @@ -909,13 +916,12 @@ The latest version of this license is in % \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,etoolbox} -\ProvidesExplClass{easybook}{2021/05/02}{1.24z}{beta} +\ProvidesExplClass{easybook}{2021/05/04}{1.25a}{beta} \cs_generate_variant:Nn \eb_ctex_define:nn { nx } \cs_generate_variant:Nn \int_to_arabic:n { v } @@ -1070,8 +1076,10 @@ The latest version of this license is in 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 + figure-sep = #1, + table-sep = #1, + listing-sep = #1, + equation-sep = #1 }, number-sep .initial:n = { . } } @@ -1133,6 +1141,18 @@ The latest version of this license is in \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_font_double_engine_set:n #1 + { + \exp_args:Nc \RenewDocumentCommand {set #1 font}{O{}mO{}} + { + \ctex_at_end_preamble:n + { \use:c { eb_set #1 font:nn }{##2}{##1,##3} } + } + } +\seq_const_from_clist:Nn \c__eb_font_reset_family_seq + { main,sans,mono,CJKmain,CJKsans,CJKmono } +\seq_map_inline:Nn \c__eb_font_reset_family_seq + { \eb_font_double_engine_set:n {#1} } \cs_new_protected:Npn \eb_setmainfont:nn #1#2 { \__fontspec_main_setmainfont:nn {#2} {#1} } @@ -1289,7 +1309,7 @@ The latest version of this license is in chap-mark .cs_set:Np = \eb_fancyhf_chapter_mark:n #1, chap-mark .initial:n = { - \int_compare:nT { \c@secnumdepth > -1 } + \int_compare:nNnT { \c@secnumdepth } > { -1 } { \ifbool{@mainmatter} { @@ -1301,7 +1321,7 @@ The latest version of this license is in sec-mark .cs_set:Np = \eb_fancyhf_section_mark:n #1, sec-mark .initial:n = { - \int_compare:nT { \c@secnumdepth > 0 } + \int_compare:nNnT { \c@secnumdepth } > { 0 } { \int_if_odd:nT { \CTEX@section@numbering } { \CTEXthesection\hspace{0.5\ccwd} } @@ -1310,7 +1330,7 @@ The latest version of this license is in subsec-mark .cs_set:Np = \eb_fancyhf_subsection_mark:n #1, subsec-mark .initial:n = { - \int_compare:nT { \c@secnumdepth > 1 } + \int_compare:nNnT { \c@secnumdepth } > { 1 } { \int_if_odd:nT { \CTEX@subsection@numbering } { \CTEXthesubsection\hspace{0.5\ccwd} } @@ -1404,7 +1424,7 @@ The latest version of this license is in { \CTEXifname { - \use:c { CTEXthe#1 } + \use:c { CTEXthe #1 } \hspace{\use:c { eb@toc@#1@numsep }} }{} } @@ -1580,7 +1600,8 @@ The latest version of this license is in { \addcontentsline{lol}{lstlisting} {\protect\numberline{\thelstlisting}\lst@@caption} - }{ + } + { \addcontentsline{lol}{lstlisting} { \ifbool{eb@titletoc@hang@fix}{\protect\numberline}{} @@ -1588,6 +1609,27 @@ The latest version of this license is in } } +\contentsuse{}{bitoc} +\cs_set_protected:Npn \CTEX@addbitocline #1#2 + { + \group_begin: + \ctex_set:n + { + chapter/name = Chapter\space, + chapter/number = \arabic{chapter} + } + \addcontentsline{bitoc}{#1} + {\use:c { CTEX@#1@tocline }{#1}{#2}} + \group_end: + } +\seq_const_from_clist:Nn \c__eb_bitoc_title_level_seq + { chapter,section,subsection } +\seq_map_inline:Nn \c__eb_bitoc_title_level_seq + { + \cs_new_protected:cpn {bi #1} ##1##2 + { \use:c {#1}{##1}\CTEX@addbitocline{#1}{##2} } + } + \eb_appto_cmd:Nn \@chapter { \skip_if_eq:nnF { \l__eb_toc_lolskip_skip } { \c_zero_skip } @@ -1617,7 +1659,17 @@ The latest version of this license is in multoc .bool_set:N = \l__eb_multoc_bool, multoc .default:n = true, multoc .initial:n = false, - title .tl_set:N = \eb@toc@title + title .code:n = \eb_assign_toc_title:n {#1} + } +\NewDocumentCommand \eb_assign_toc_title:n + {>{\SplitArgument{1}{,}}m} + {\eb_assign_toc_title:nn #1} +\cs_new_protected:Npn \eb_assign_toc_title:nn #1#2 + { + \tl_set:Nn \eb@toc@title {#1} + \tl_if_novalue:nTF {#2} + { \tl_clear:N \eb@bitoc@title } + { \tl_set:Nn \eb@bitoc@title {#2} } } \cs_new:Npn \eb_upper_nonumber_mark_bool:n #1 @@ -1715,15 +1767,22 @@ The latest version of this license is in \bool_if:NT \l__eb_class_book_bool { \ifbool{@restonecol}{\twocolumn}{\onecolumn} } } -\RenewDocumentCommand{\tableofcontents}{o} +\RenewDocumentCommand{\tableofcontents}{t+o} { \group_begin: \tl_set_eq:NN \eb@toc@title \contentsname - \IfValueT{#1}{\keys_set:nn { eb/listoc } {#1}} + \tl_set:Nn \eb@bitoc@title { Contents } + \IfValueT{#2}{\keys_set:nn { eb/listoc } {#2}} \eb_multoc_pre_bool: \eb_title_mark_notoc:n { \eb@toc@title } \vspace*{\dim_use:N \l__eb_toc_offset_dim} \@starttoc{toc} + \IfBooleanT{#1} + { + \eb_title_mark_notoc:n { \eb@bitoc@title } + \vspace*{\dim_use:N \l__eb_toc_offset_dim} + \@starttoc{bitoc} + } \eb_multoc_post_bool: \group_end: } @@ -1845,19 +1904,19 @@ The latest version of this license is in \captionsetup[table][bi-second]{name = Table} } -\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@#1 } } +\cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@ #1 } } \cs_gset:cpn { thesection } { - \int_compare:nT { \c@chapter > 0 } { \thechapter. } + \int_compare:nNnT { \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:nNnT { \c@chapter } > { 0 } { \thechapter \use:c { l__eb_#1_separator_tl } @@ -1869,6 +1928,17 @@ The latest version of this license is in { \int_compare:nNnTF { \c@chapter } > { 0 } { + \ExplSyntaxOn\char_set_catcode_letter:N \@ + \eb_patch_cmd:Nnn \CTEX@addbitocline + { + chapter/name = Chapter\space, + chapter/number = \arabic{chapter} + } + { + chapter/name = Appendix\space, + chapter/number = \alph{chapter} + } + \ExplSyntaxOff\char_set_catcode_other:N \@ \setcounter{chapter}{0} \setcounter{section}{0} \gdef\thechapter{\@Alph\c@chapter} @@ -1885,7 +1955,7 @@ 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} @@ -2050,7 +2120,7 @@ The latest version of this license is in headindent = \l__eb_thm_headindent_tl, headfont = \l__eb_thm_headfont_tl, notefont = \l__eb_thm_notefont_tl, - notebraces = {}{}, + notebraces = { }{ }, bodyfont = \l__eb_thm_bodyfont_tl, headpunct = \l__eb_thm_headpunct_tl, postheadspace = \l__eb_thm_spacepost_tl, @@ -2160,7 +2230,7 @@ The latest version of this license is in \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 } } + { \msg_redirect_module:nnn { unicode-math } { warning } { none } } \ctex_at_end_package:nn { tcolorbox } { @@ -2475,7 +2545,7 @@ The latest version of this license is in rulecolor = \color{ctex@frame}, commentstyle = \color{SlateGray}, emphstyle = \color{ctex@emph}, - emph = {caption,multirow,subcaption,tabularx}, + % emph = {}, morekeywords = { includegraphics,setmainfont,setsansfont,setmonofont,setCJKmainfont,setCJKsansfont,setCJKmonofont,setCJKfamilyfont,RequirePackage diff --git a/Master/texmf-dist/source/latex/easybook/easybook.ins b/Master/texmf-dist/source/latex/easybook/easybook.ins new file mode 100644 index 00000000000..af8f3f81340 --- /dev/null +++ b/Master/texmf-dist/source/latex/easybook/easybook.ins @@ -0,0 +1,25 @@ +% +% Copyright (C) 2021 by Qu Yi <quee123@foxmail.com> +% +% This work may be distributed and/or modified under the +% conditions of the CC-BY 4.0 License. +% The latest version of this license is in +% https://creativecommons.org/licenses/by/4.0/legalcode +\input ctxdocstrip +\keepsilent +\askforoverwritefalse + +\usedir{tex/latex/easybook} + +\preamble +Copyright (C) 2021 by Qu Yi <quee123@foxmail.com> + +This work may be distributed and/or modified under the +conditions of the CC-BY 4.0 License. +The latest version of this license is in + https://creativecommons.org/licenses/by/4.0/legalcode +\endpreamble + +\generate{\file{\jobname.cls}{\from{\jobname.dtx}{class}}} + +\endbatchfile
\ No newline at end of file |