From 75db33dc347ec9cfbaa2f3ec538a2697351f571b Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 5 May 2021 03:02:17 +0000 Subject: CTAN sync 202105050302 --- macros/latex/contrib/easybook/easybook.dtx | 113 ++++++++++++++++++++++++----- 1 file changed, 96 insertions(+), 17 deletions(-) (limited to 'macros/latex/contrib/easybook/easybook.dtx') diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx index 538b1cedf8..71eec1dedc 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -24,11 +24,11 @@ % \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.25}{2021/05/03}{取消附带的示例文件,可查看历史版本及其它来源的使用样例。} +% \changes{v1.25a}{2021/05/03}{取消附带的示例文件,可查看历史版本及其它来源的使用样例。} % % \title{\sffamily easybook 文档类手册} % \author{瞿毅} -% \date{2021/05/03\hskip\ccwd\relax v1.25\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} @@ -118,6 +118,7 @@ % \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.25a}{2021/05/04}{修复使用 \pkg{xeCJK} 与 \pkg{fontspec} 宏包的字体设置命令在 \hologo{LuaLaTeX} 下失效的问题。} % \end{function} % % \begin{function}[rEXP,added = 2021-01-05,updated = 2021-01-13]{paper} @@ -146,31 +147,48 @@ % % \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 = -% 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.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{接口选项} % \label{sec:interface options} % \begin{function}[added = 2021-01-05]{\ctexset} @@ -409,7 +427,7 @@ % \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} @@ -903,7 +921,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplClass{easybook}{2021/05/03}{1.25}{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 } @@ -1123,6 +1141,18 @@ \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} } @@ -1394,7 +1424,7 @@ { \CTEXifname { - \use:c { CTEXthe#1 } + \use:c { CTEXthe #1 } \hspace{\use:c { eb@toc@#1@numsep }} }{} } @@ -1579,6 +1609,27 @@ } } +\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 } @@ -1608,7 +1659,17 @@ 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 @@ -1706,15 +1767,22 @@ \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: } @@ -1836,7 +1904,7 @@ \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:nNnT { \c@chapter } > { 0 } { \thechapter. } @@ -1846,7 +1914,7 @@ { 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:nNnT { \c@chapter } > { 0 } { @@ -1860,6 +1928,17 @@ { \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} @@ -1876,7 +1955,7 @@ \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} -- cgit v1.2.3