From 97eca13a92a0b8ad423b606c8970c9ce64d9b2bf Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 18 May 2021 03:01:12 +0000 Subject: CTAN sync 202105180301 --- macros/latex/contrib/easybook/easybook.dtx | 168 +++++++++++++++-------------- 1 file changed, 88 insertions(+), 80 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 10a1336759..8d861d4773 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.25j}{2021/05/03}{取消附带的示例文件,可查看历史版本及其它来源的使用样例。} +% \changes{v1.25k}{2021/05/03}{取消附带的示例文件,可查看历史版本及其它来源的使用样例。} % % \title{\sffamily easybook 文档类手册} % \author{瞿毅} -% \date{2021/05/15\hskip\ccwd\relax v1.25j\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/05/17\hskip\ccwd\relax v1.25k\thanks{\url{https://gitee.com/texl3/easybook}}} % % \maketitle % \begin{abstract} @@ -118,7 +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.25j}{2021/05/04}{修复使用 \pkg{xeCJK} 与 \pkg{fontspec} 宏包的字体设置命令在 \hologo{LuaLaTeX} 下失效的问题。} +% \changes{v1.25k}{2021/05/04}{修复使用 \pkg{xeCJK} 与 \pkg{fontspec} 宏包的字体设置命令在 \hologo{LuaLaTeX} 下失效的问题。} % \end{function} % % \begin{function}[rEXP,added = 2021-01-05,updated = 2021-01-13]{paper} @@ -169,7 +169,7 @@ % \tn{listoflistings*+}\oarg{键值列表} % \end{syntax} % \tn{listoffigures} 命令输出图片目录,\tn{listoftables} 输出表格目录,\tn{listoflistings} 输出代码目录。带有星号的目录命令不将标题添加进主文档目录,带有+号的目录命令可以使当前标题编号。\tn{tableofcontents+} 与其它命令不同是用于输出双语目录,需要与双语目录标题命令 \tn{bichapter} 等或设置图片、表格和代码等英文目录的标题配合使用,附加代码是中文与英文目录之间的代码,可以插入文本和换页命令等。目录的键值列表选项如下 -% \changes{v1.25j}{2021/05/05}{命令 \tn{tableofcontents} 可以输出双语目录。} +% \changes{v1.25k}{2021/05/05}{命令 \tn{tableofcontents} 可以输出双语目录。} % \end{function} % % \begin{function}{multoc,title,format,aftertitle,pagestyle,book,article} @@ -200,7 +200,7 @@ % 双语目录的标题命令目前设置了常用的三个级别,它们将中文标题正常输出,并使中英文标题加入双语目录,这个功能是为国内一些大学的学位论文模板的要求设计,在一般情况和英文模式下不需要使用。 % % 它们的星号变体命令使文中标题不编号,但是仍然加入双语目录,若英文标题参数空置那么仅加入中文目录而不加入英文目录,这一特点与 \tn{chapter*} 等命令的行为不太一样,在一些情况下会用到。可选参数是目录中的中文标题,默认与中文标题一致,正文标题过长时可用它设置在目录中显示的标题。双语目录的格式是一致的,共享使用 \tn{tocset} 的设置,英文目录的章级别标题名及编号的修改方式如下 -% \changes{v1.25j}{2021/05/05}{增加与双语目录配合的标题命令。} +% \changes{v1.25k}{2021/05/05}{增加与双语目录配合的标题命令。} % \end{function} % % \begin{function}{biname,binmuber} @@ -240,7 +240,7 @@ % % \subsection{风格} % \label{subsec:style} -% \begin{function}[EXP,added = 2021-01-05,updated = 2021-04-11]{color,color-all,multoc,withpart,footwith,notomath,rulewidth,uppercase,figure-sep,table-sep,listing-sep,equation-sep,number-sep} +% \begin{function}[EXP,added = 2021-01-05,updated = 2021-05-17]{color,color-all,multoc,withpart,footwith,notomath,rulewidth,uppercase,figure-sep,table-sep,listing-sep,equation-sep,number-sep,figpath} % \begin{syntax} % color = <(none)|seaside|energy|cyberpunk> % color-all = @@ -255,6 +255,7 @@ % listing-sep = <(.)> % equation-sep = <(.)> % number-sep = <(.)> +% figpath = \{\{路径名1\}\{路径名2\}\} % \end{syntax} % \ding{229} 以上选项路径为 \opt{style/...} % \changes{v1.10}{2021/01/08}{更改颜色实现方式与选项名。} @@ -284,6 +285,7 @@ % \item[listing-sep] 代码标题编号的连接符。 % \item[equation-sep] 公式编号的连接符。 % \item[number-sep] 统一设置所有编号的连接符。 +% \item[figpath] 设置插入图片的文件夹路径名,可以有多个路径名,但需要包含在括号内作为间隔,即使只有一个路径。 % \end{optdesc} % % \subsection{超链接} @@ -299,7 +301,7 @@ % \opt{refset} 将超链接选项(包括以上选项)交给 \pkg{hyperref} 处理,除了一些关于 pdf 书签的选项可能会失效,其它由键值选项命令 \tn{hypersetup} 支持的多数选项可用。 % \changes{v1.10}{2021/01/08}{修复了 \opt{linktopage} 选项关闭时目录中标题编号无超链接的问题。} % \changes{v1.24}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} -% \changes{v1.25j}{2021/05/06}{模块名 \opt{link} 改为 \opt{refset},\opt{link} 作为兼容性保留。} +% \changes{v1.25k}{2021/05/06}{模块名 \opt{link} 改为 \opt{refset},\opt{link} 作为兼容性保留。} % \end{function} % % \begin{optdesc} @@ -318,7 +320,7 @@ % % \subsection{行距} % \label{subsec:spacing} -% \begin{function}[EXP,added = 2021-01-05,updated = 2021-04-19]{line,table,math,caption,footnote,spread-all} +% \begin{function}[EXP,added = 2021-01-05,updated = 2021-05-17]{line,table,math,caption,footnote,spread-all} % \begin{syntax} % line = <数值|(1.3)> % table = <数值|(1.05)> @@ -335,7 +337,7 @@ % % \begin{optdesc} % \item[line] 正文行距,\tn{ctexset} 原有的行距选项 \opt{linespread} 失效。 -% \item[table] 表格行距。 +% \item[table] 表格行距,对传统表格环境 \env{tabular}、\env{tabularx} 以及 \pkg{tabularray} 宏包的 \env{tblr} 环境生效,同时 \env{tblr} 也自带有 \opt{stretch} 选项设置行距。 % \item[math] 数学环境行距,包括 \pkg{amsmath} 和 \pkg{mathtools} 宏包附带的环境,但并未加载 \pkg{mathtools} 宏包。 % \item[caption] 图表代码标题行距。 % \item[footnote] 脚注行距。 @@ -378,7 +380,7 @@ % \changes{v1.21}{2021/01/11}{增加 \opt{bibset} 选项,可以使用 \hologo{BibTeX} 或 \hologo{biber} 编译参考文献。} % \changes{v1.23}{2021/02/23}{使用 \opt{bibset} 选项时可设置标注风格。} % \changes{v1.24}{2021/04/09}{可以不载入参考文献包手动配置参考文献格式。} -% \changes{v1.25j}{2021/05/12}{取消 \opt{bib-loadpkg} 选项,由是否设置参考文献数据库来决定载入宏包。} +% \changes{v1.25k}{2021/05/12}{取消 \opt{bib-loadpkg} 选项,由是否设置参考文献数据库来决定载入宏包。} % \end{function} % % \begin{optdesc} @@ -572,7 +574,7 @@ % 上面几个选项用于设置脚注格式,\opt{fnparskip} 和 \opt{fnparindent} 选项仅在 \opt{fnhang = true} 时有效。\opt{fnhang} 用于将脚注设置为悬挂缩进的格式,\opt{fnmark-pos} 选项设置脚注编号的位置,正常文本或是上标形式。\opt{fnmark-num} 选项设置脚注编号的格式,默认为原生样式 \opt{plain},还可以改为 \opt{pifont} 的各个版本,从左往右依次为普通版、阴文衬线版、阳文无衬线版和阴文无衬线版,缺点是它们的编号仅包括1-10。 % % \opt{fnmark-form} 是脚注标记的格式,默认为空,在此设置字体命令会覆盖 \opt{elsefont/footnote} 的设置,最后一个格式命令可以带有一个参数,这个参数接受脚注编号,一般配合 \opt{fnmark-num = plain} 使用。\opt{afterfnmark} 是脚注标记后的代码,一般用于设置标记与文本间的距离。 -% \changes{v1.25j}{2021/05/12}{增加脚注样式设置选项。} +% \changes{v1.25k}{2021/05/12}{增加脚注样式设置选项。} % \end{function} % % \subsection{目录样式} @@ -591,7 +593,7 @@ % \opt{format} 是目录中标题的格式,可以设置字体和加入垂直间距等,垂直间距最好使用无间距重合的 \tn{addvspace} 命令,带有加号的 \opt{format+} 选项用于在已有的格式命令后附加内容。\opt{indent} 是目录中标题在页面左侧的缩进距离,应该有长度单位。\opt{rule} 选项中一般应当使用 \tn{tocrule} 命令,将会在接下来介绍。\opt{numsep} 是有编号的标题在目录中编号与标题的间距。 % \changes{v1.21}{2021/01/13}{增加配置目录样式的选项。} % \changes{v1.24}{2021/04/20}{增加目录中编号与标题的间距选项 \opt{numsep}。} -% \changes{v1.25j}{2021/05/14}{可以分别设置图片、表格和代码目录的格式。} +% \changes{v1.25k}{2021/05/14}{可以分别设置图片、表格和代码目录的格式。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-04-20]{\tocrule,\EbNumberline} @@ -668,6 +670,17 @@ % \pkg{amsmath} 宏包提供了一系列数学环境,它们可以排布各种对齐或不对齐的公式组。\env{multline} 环境用于一行无法放下的长公式,\env{gather} 环境用于每行居中的公式组,\env{align} 环境用于多列对齐的公式组。 % \end{function} % +% \subsection{表格} +% \begin{function}[added = 2021-05-17]{tblr,tabularx,tabular} +% \begin{syntax} +% \tn{begin}\marg{环境名}\marg{环境选项} +% \ <表格内容> +% \tn{end}\marg{环境名} +% \end{syntax} +% \pkg{tabularray} 是一个较新的宏包,不仅提供了 \pkg{tabularx}、\pkg{multirow}、和 \pkg{booktabs} 宏包的功能,并且不依赖其它宏包与它们同时使用不会产生冲突,还实现了用简便的键值列表方式设置表格样式。目前除了表头斜线以及跨页功能存在不足,其它方面已满足对表格绝大多数格式的需求,具体用法可见宏包的说明文档。 +% \changes{v1.25k}{2021/05/17}{使用功能更便捷齐全的 \pkg{tabularray} 宏包设置表格样式。} +% \end{function} +% % \subsection{列表} % \begin{function}[added = 2021-01-05,updated = 2021-04-08]{enumerate,enumerate*,itemize,itemize*,description,description*} % \begin{syntax} @@ -949,9 +962,7 @@ % \item[fancyhdr] 广泛控制页面的页眉和页脚。 % \item[titletoc] 设置目录中的标题格式。 % \item[caption] 在浮动环境中自定义题注。 -% \item[tabularx] 带有可调整宽度的列的表格。 -% \item[multirow] 创建跨越多行的表格单元格。 -% \item[booktabs] 为表格提供三线表式的命令。 +% \item[tabularray] 完全分离表格的内容和样式,并且可以通过键值方式完全设置表格。 % \item[enumitem] 提供列表环境的布局控制。 % \item[listings] 可以在 \LaTeX 中排版程序/编程代码。 % \item[hyperref] 处理交叉引用命令以及在文档中生成超文本链接。 @@ -967,12 +978,13 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e,etoolbox} -\ProvidesExplClass{easybook}{2021/05/15}{1.25j}{beta} +\ProvidesExplClass{easybook}{2021/05/17}{1.25k}{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 \seq_set_from_clist:Nn { No } \cs_new_protected:Npn \eb_ctex_define:nn #1 { \keys_define:nn { ctex/#1 } } \cs_new_protected:Npn \eb_put_ctexbook:n #1 @@ -982,15 +994,21 @@ \ctex_patch_cmd_once:NnnnTF #1 { } {#2} {#3} { } { \ctex_patch_failure:N #1 } } +\cs_new_protected:Npn \eb_preto_cmd:Nn #1#2 + { + \ctex_preto_cmd:NnnTF #1 { } {#2} + { } { \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_preto_cmd:Nn #1#2 +\cs_new_protected:Npn \eb_at_begin_environment:nn #1#2 { - \ctex_preto_cmd:NnnTF #1 { } {#2} - { } { \ctex_patch_failure:N #1 } + \seq_set_from_clist:No \l__eb_env_hook_name_seq {#1} + \seq_map_inline:Nn \l__eb_env_hook_name_seq + { \AtBeginEnvironment{##1}{#2} } } \cs_new_protected:Npn \eb_at_end_preamble:n { \ctex_gadd_ltxhook:nn { env/document/before } } @@ -1117,6 +1135,7 @@ uppercase .bool_set:N = \l__eb_uppercase_bool, uppercase .default:n = true, uppercase .initial:n = true, + figpath .tl_set:N = \l_eb_graphics_path_tl, footwith .choices:nn = { part,page,chapter } @@ -1142,12 +1161,12 @@ { xcolor, footmisc,setspace, - amsmath,amsthm,thmtools,cases, + amsmath,amsthm,thmtools, chemformula,siunitx,ulem,pifont, geometry,marginnote,nccfoots, pdfpages,graphicx, fancyhdr,titletoc,caption, - tabularx,multirow,booktabs, + tabularray, enumitem, listings } @@ -1465,6 +1484,8 @@ \easyfoot[C]{\color{SlateGray}\sffamily\today} \geometry{showframe} } + \tl_if_empty:NF \l_eb_graphics_path_tl + { \exp_args:No \graphicspath { \l_eb_graphics_path_tl } } } \eb_at_end_preamble:n @@ -2100,6 +2121,34 @@ marginpar .initial:n = \rmfamily\footnotesize } +\fp_new:N \l__eb_spread_line_fp +\fp_new:N \l__eb_spread_table_fp +\fp_new:N \l__eb_spread_math_fp +\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 + } + } + \DeclareCaptionLabelSeparator{ccwd}{\hspace{\ccwd}} \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{~}(#2)} \DeclareCaptionFont{eb@table@font}{\l__eb_font_table_tl} @@ -2130,6 +2179,19 @@ \captionsetup[figure][bi-second]{name = Figure} \captionsetup[table][bi-second]{name = Table} } +\prop_gset_from_keyval:Nn \g__tblr_default_tblr_table_prop + { stretch = \fp_use:N \l__eb_spread_table_fp } +\SetTblrDefault{rows = {abovesep = 4pt,belowsep = 2pt}} +\eb_at_begin_environment:nn { tabular,tabularx } + { + \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 } + \selectfont\ignorespaces + } \cs_new:Npn \eb_arabic:n #1 { \int_to_arabic:v { c@#1 } } \cs_gset:cpn { thesection } @@ -2152,50 +2214,6 @@ } } -\AtBeginEnvironment{tabularx} - { - \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 } - \selectfont\ignorespaces - } -\ctex_after_end_preamble:n - { - \exp_args:Nx \linespread { \fp_use:N \l__eb_spread_line_fp } - \selectfont\ignorespaces - } - -\fp_new:N \l__eb_spread_line_fp -\fp_new:N \l__eb_spread_table_fp -\fp_new:N \l__eb_spread_math_fp -\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 - } - } - \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 } @@ -2209,11 +2227,8 @@ \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} -\newcolumntype{R}{>{\raggedleft\arraybackslash}X} -\graphicspath{{figures/}} +\tl_gset:Nn \ULthickness { 0.75pt } +\allowdisplaybreaks[4] \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} \cs_new_protected:Npn \eb_enumitem_labelval_set:nn #1#2 @@ -2375,23 +2390,16 @@ range-units = single, group-digits = false } -\allowdisplaybreaks[4] -\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 +\eb_at_begin_environment: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 } -\seq_map_inline:Nn \c__eb_math_spread_env_seq { - \AtBeginEnvironment{#1} - { - \linespread{\fp_use:N \l__eb_spread_math_fp} - \selectfont\ignorespaces - } + \linespread{\fp_use:N \l__eb_spread_math_fp} + \selectfont\ignorespaces } \eb_patch_cmd:Nnn \start@gather { \collect@body } -- cgit v1.2.3