From 5f3280db1e6f333f79e9930e5609d3f5175d5af7 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 17 Jun 2021 03:01:34 +0000 Subject: CTAN sync 202106170301 --- macros/latex/contrib/easybook/easybook.dtx | 145 +++++++++++++---------------- 1 file changed, 67 insertions(+), 78 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 762a7b0cd0..67902b529b 100644 --- a/macros/latex/contrib/easybook/easybook.dtx +++ b/macros/latex/contrib/easybook/easybook.dtx @@ -28,7 +28,7 @@ % % \title{\sffamily easybook 文档类手册} % \author{瞿毅} -% \date{2021/06/15\hskip\ccwd\relax v1.26c\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/06/16\hskip\ccwd\relax v1.26d\thanks{\url{https://gitee.com/texl3/easybook}}} % % \maketitle % \begin{abstract} @@ -58,7 +58,7 @@ % \end{document} % \end{frameverb} % -% 或者直接使用 \pkg{easybase} 宏包,它的宏包选项有 \opt{class}、\opt{draft} 和 \opt{floatpage},包含了节 \ref{sec:interface options} 所示各个模块接口命令的功能,目前只适用于 \cls{ctexbook} 和 \cls{ctexart} 文档类。 +% 或者直接使用 \pkg{easybase} 宏包,它的宏包选项有 \opt{class}、\opt{draft}、\opt{paper} 和 \opt{floatpage},包含了节 \ref{sec:interface options} 所示各个模块接口命令的功能,目前只适用于 \cls{ctexbook} 和 \cls{ctexart} 文档类。 % \begin{frameverb} % \documentclass{ctexbook} % @@ -157,7 +157,7 @@ % floatpage = % \end{syntax} % 开启这个选项后浮动环境 \env{table} 和 \env{figure} 的比例参数会使用默认值,关闭它则尽可能避免出现浮动页,使图表环境与正文段落更加紧凑,减少多余的空白版面。 -% \changes{v1.26c}{2021/06/15}{增加浮动环境比例参数选项 \opt{floatpage}。} +% \changes{v1.26d}{2021/06/15}{增加浮动环境比例参数选项 \opt{floatpage}。} % \end{function} % % \subsection{article 模式} @@ -239,7 +239,7 @@ % \tn{EBeforeAddBitoc*}\marg{加入目录英文标题前的代码} % \end{syntax} % \tn{appendix} 命令后的章节标题变为附录形式。英文目录中附录标题的格式用可选参数修改,英文附录目录前名字默认为 Appendix\tn{space},后名字默认为空,名字之间用一个半角逗号分开,也可以只有一部分,表示英文附录目录前名字。英文附录目录数字输出命令默认为 \tn{Alph}\{chapter\}。 -% \changes{v1.26c}{2021/06/13}{增加调整英文目录格式的钩子 \tn{EBeforeAddBitoc}。} +% \changes{v1.26d}{2021/06/13}{增加调整英文目录格式的钩子 \tn{EBeforeAddBitoc}。} % \end{function} % % \tn{EBeforeAddBitoc} 是一个作用于局部范围的英文目录钩子,可以插入标题或目录设置的命令改变英文目录中标题的显示格式,也可以覆盖上述的目录前后名字和编号等设置,带有星号的命令会重置之前的代码,放置在导言区或 \tn{bichapter} 等命令前生效。 @@ -441,7 +441,7 @@ % % \subsection{定理样式} % \label{subsec:theorem of style} -% \begin{function}[EXP,added = 2021-01-12,updated = 2021-03-13]{thmbox,within,headpunct,bodyfont,notefont,headfont,headindent,spaceabove,spacebelow,spacepost} +% \begin{function}[EXP,added = 2021-01-12,updated = 2021-06-16]{thmbox,within,headpunct,bodyfont,notefont,headfont,headindent,spaceabove,spacebelow,spacepost,headformat} % \begin{syntax} % thmbox = % within = <(chapter)|section|其它环境|空置> @@ -453,13 +453,14 @@ % spaceabove = <(0.75ex plus .1ex)> % spacebelow = <(0.75ex plus .1ex)> % spacepost = <(\tn{ccwd})> +% headformat = <(\tn{NAME}\tn{space}\tn{NUMBER}\tn{NOTE})> % \end{syntax} % \ding{229} 以上选项路径为 \opt{thmset/...} % \changes{v1.21}{2021/01/12}{增加配置定理环境样式的选项。} % \end{function} % % \begin{optdesc} -% \item[thmbox] 开启定理环境盒子的边框,需载入 \pkg{tcolorbox} 宏包才生效。 +% \item[thmbox] 开启定理环境盒子的边框,需载入 \pkg{tcolorbox} 宏包才生效。这个选项与 \pkg{thmtools} 中并不一致,\pkg{thmtools} 的同名选项包括 L、M 和 S 三个参数。 % \item[within] 定理编号跟随的计数器,默认跟随章的编号,也可以跟随其它定理环境的编号,当计数器增加时定理编号会从零开始,空置时不跟随其它计数器。 % \item[headpunct] 定理标题末尾后的标记,在换行符或第一段内容的间隔之前。 % \item[bodyfont] 定理内容部分的字体。 @@ -469,6 +470,7 @@ % \item[spaceabove] 定理环境前的间距。 % \item[spacebelow] 定理环境后的间距。 % \item[spacepost] 定理标题后与第一段内容的间隔。 +% \item[headformat] 定理开头部分各组成元素的排列和格式,这个选项一般不需要使用,其中 \tn{NAME}、\tn{NUMBER} 和 \tn{NOTE} 分别代表标题、编号和题注。 % \end{optdesc} % % \begin{function}[added = 2021-01-12,updated = 2021-06-15]{\declaretheorem,\EBNewTheorem,\declaretheoremstyle} @@ -477,32 +479,32 @@ % \tn{EBNewTheorem}\marg{定理环境名}\oarg{英文标题}\marg{中文标题}\parg{盒子样式|(tc-theorem)}\oarg{键值列表} % \tn{declaretheoremstyle}\oarg{键值列表}\marg{定理样式名} % \end{syntax} -% 文档类已预置8个定理环境,环境名及对应的定理标题名见小节 \ref{subsec:theorem},如果需要新的定理标题名或定理样式可使用这两个命令。 +% 文档类已预置8个定理环境,环境名及对应的定理标题名见小节 \ref{subsec:theorem},如果需要新的定理标题名或定理样式可使用这两个命令,由 \pkg{thmtools} 提供支持,用法与它的同名命令一致。 % \changes{v1.23}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。} % \changes{v1.24}{2021/04/25}{增加定义定理环境命令 \tn{EBNewTheorem}。} -% \changes{v1.26c}{2021/06/15}{定义新定理环境的命令调整为 \tn{declaretheorem}。} +% \changes{v1.26d}{2021/06/15}{定义新定理环境的命令调整为 \tn{declaretheorem}。} % \end{function} % % \begin{optdesc} -% \item[\tn{declaretheorem}] 定义新的定理类环境,\tn{newtheorem} 命令与它等效,可选参数与 \pkg{thmtools} 宏包创建定理命令 \tn{declaretheorem} 的参数一致。常用的选项如下 +% \item[\tn{declaretheorem}] 定义新的定理类环境,\tn{newtheorem} 命令与它等效。\meta{键值列表} 中常用的选项如下 % \begin{description} % \item[name] 定理的标题。默认值是环境的名称,并且首字母大写(英文标题)。 % \item[numbered] 值为 \opt{no}、\opt{yes} 或 \opt{unless unique}。定理可以被编号、不被编号或者只有在文档中多次出现时才被编号。 % \item[numberlike] 定理将使用此计数器进行编号,通常这是另一个定理环境的名称。 % \item[style] 用 \tn{declaretheoremstyle} 定义的定理样式的名称,定理将使用这种样式的设置。 % \end{description} -% \item[\tn{EBNewTheorem}] \tn{EBNewTheorem} 是更便捷的定理命令,它定义一个新的定理环境,键值列表支持的选项与 \tn{declaretheorem} 相同,但它们的区别有 +% \item[\tn{EBNewTheorem}] \tn{EBNewTheorem} 是更便捷的定理命令,它定义一个新的定理环境,\meta{键值列表} 支持的选项与 \tn{declaretheorem} 相同,但它们的区别有 % \begin{itemize} % \item 中英文模式下标题不同,英文标题为可选项,默认为首字母大写的环境名。 % \item 自动定义交叉引用的格式,引用标签前缀为定理名称。 % \item 定理盒子选项 \opt{thmbox} 仍然生效,盒子样式选项是用于设置定理盒子样式的名称,它需要 \pkg{tcolorbox} 的 \tn{tcbset} 接口命令设定,默认为 \opt{tc-theorem}。 % \item 默认使用 \opt{easy-theorem} 定理样式,可在最后一个选项使用 \opt{style} 更改样式。 % \end{itemize} -% \item[\tn{declaretheoremstyle}] 定义新的定理样式,可选参数中除了包括上述定理样式选项,还包括 \tn{declaretheorem} 的选项。 +% \item[\tn{declaretheoremstyle}] 定义新的定理样式,\meta{键值列表} 中包括上述定理样式以及 \tn{declaretheorem} 的所有选项。 % \end{optdesc} % % \subsubsection{新的定理样式} -% 定理由 \pkg{thmtools} 设置,预置定理的样式为 \opt{easy-theorem},上述定理样式选项将对这个定理样式生效。如果使用这个样式而只是增加新的定理名称,可以这样 +% 预置定理的样式为 \opt{easy-theorem},上述定理样式选项将对这个定理样式生效。如果使用这个样式而只是增加新的定理名称,可以这样 % \begin{ctexexam} % \EBNewTheorem{定理环境名}{中文标题}[style = other theorem] % \declaretheorem[style = easy-theorem,name = 定理名]{定理环境名} @@ -511,7 +513,7 @@ % \begin{ctexexam} % \tcolorboxenvironment{定理环境名}{tc-theorem} % \end{ctexexam} -% 定义一个新的定理样式可用于 \tn{declaretheorem} 的 \opt{style} 选项。 +% 定义一个新的定理样式可用于 \tn{declaretheorem} 的 \opt{style} 选项 % \begin{ctexexam} % \declaretheoremstyle[bodyfont = \rmfamily,spacepost = 0.5\ccwd]{定理样式名} % \end{ctexexam} @@ -586,7 +588,7 @@ % \tn{markrule}\oarg{长度|(\tn{textwidth})}\parg{颜色名}\marg{线宽|(0.75pt)}[<上间距>+<下间距>] % \end{syntax} % 命令 \tn{easyhead} 和 \tn{easyfoot} 的使用方法与 \tn{fancyhead} 和 \tn{fancyfoot} 完全相同,它们需要在 \opt{head-foot} 选项中使用,设置的是一个名为 \opt{fancy} 的页面风格。\pkg{fancyhdr} 将页眉页脚分成了左中右和奇数页(odd)、偶数页(even)共12个部分,可选参数中E、O代表偶数、奇数,L、C、R代表左、中、右部分。单面打印时,含有偶数的选项无效。 -% \changes{v1.26c}{2021/06/14}{增加页眉页脚的横线绘制命令 \tn{markrule}。} +% \changes{v1.26d}{2021/06/14}{增加页眉页脚的横线绘制命令 \tn{markrule}。} % \end{function} % % 命令 \tn{markrule} 用于绘制页眉页脚横线,长度默认为页面文本区的宽度,上下间距为横线与上下方部件的间距,带有长度单位,间距长度之间用+号分开,若只有一部分则表示上间距,这个命令也可以在正文中绘制横线。下面举一个设置页眉内容的例子 @@ -1079,7 +1081,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/06/15}{1.26c}{beta} +\ProvidesExplClass{easybook}{2021/06/16}{1.26d}{beta} \bool_set_false:N \l__eb_compile_draft_bool \bool_set_false:N \l__eb_title_newline_bool @@ -1098,10 +1100,10 @@ scheme .code:n = \eb_put_ctexbook:n { scheme = #1 }, enmode .meta:n = { newline,scheme = plain }, - font .choices:nn = + font .choices:nn = { adobe,founder,mac,windows,none } { \eb_put_ctexbook:n { fontset = \l_keys_choice_tl } }, - font/noto .code:n = + font/noto .code:n = { \bool_set_true:N \l__eb_font_noto_bool \eb_put_ctexbook:n { fontset = none } @@ -1114,16 +1116,15 @@ paper .choice:, paper .value_required:n = true, paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, - paper .initial:n = a4paper, oneside .value_forbidden:n = true, twoside .value_forbidden:n = true, - oneside .code:n = + oneside .code:n = { \bool_set_false:N \l__eb_page_twoside_bool \eb_put_ctexbook:n { oneside } }, - twoside .code:n = + twoside .code:n = { \bool_set_true:N \l__eb_page_twoside_bool \eb_put_ctexbook:n { twoside } @@ -1137,12 +1138,10 @@ \bool_set_false:N \l__eb_class_book_bool \keys_set:nn { easybook } { oneside } }, - class .initial:n = book, config .tl_set:N = \g__eb_config_tl, floatpage .bool_set:N = \l__eb_float_page_bool, floatpage .default:n = true, - floatpage .initial:n = false, unknown .code:n = { \clist_gput_right:NV \g__eb_options_clist \CurrentOption } } @@ -1328,7 +1327,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{etoolbox} -\ProvidesExplPackage{easybase}{2021/06/15}{1.26c}{beta} +\ProvidesExplPackage{easybase}{2021/06/16}{1.26d}{beta} \cs_generate_variant:Nn \eb_ctex_define:nn { nx } \cs_generate_variant:Nn \int_to_arabic:n { v } @@ -1404,6 +1403,11 @@ floatpage .default:n = true, floatpage .initial:n = false, + paper .choice:, + paper .value_required:n = true, + paper/unknown .code:n = \PassOptionsToPackage{#1}{geometry}, + paper .initial:n = a4paper, + class .choice:, class .value_required:n = true, class/book .code:n = { }, @@ -1411,7 +1415,8 @@ { \bool_set_false:N \l__eb_class_book_bool \bool_set_false:N \l__eb_page_twoside_bool - } + }, + class .initial:n = book } \clist_map_inline:nn @@ -1453,10 +1458,17 @@ } \bool_if:NF \l__eb_class_book_bool { - \cs_set_eq:NN \eb@chapter@save \chapter \cs_undefine:N \chapter \ctex_after_end_preamble:n - { \cs_set_eq:NN \chapter \eb@chapter@save } + { + \NewDocumentCommand{\chapter}{som} + {\msg_error:nn { easybase } { no-chapter }} + } + } +\msg_new:nnn { easybase } { no-chapter } + { + Your~document~class~is~in~article~mode. \\ + The~\string\chapter\space~command~will~not~be~used. } \ctex_define:n { @@ -2138,20 +2150,8 @@ \addtocontents{lol} {\protect\addvspace{\skip_use:N \l__eb_toc_lolskip_skip}} } - \bool_if:NF \l__eb_class_book_bool - { \msg_error:nn { easybase } { no-chapter } } - } - \eb_appto_cmd:Nn \@schapter - { - \bool_if:NF \l__eb_class_book_bool - { \msg_error:nn { easybase } { no-chapter } } } } -\msg_new:nnn { easybase } { no-chapter } - { - Your~document~class~is~in~article~mode. \\ - The~\string\chapter\space~command~will~not~be~used. - } \tl_set:Nx \l__eb_toc_type_tl { \bool_if:NTF \l__eb_class_book_bool { chapter } { section } } @@ -2519,7 +2519,7 @@ \skip_set:Nn \parskip { 0pt plus 2pt minus 1pt } \skip_set:Nn \intextsep { 14pt plus 2pt minus 2pt } \skip_set:Nn \textfloatsep { 16pt plus 2pt minus 4pt } -\skip_set:Nn \multicolsep { 10pt plus 4pt minus 3pt } +\skip_set:Nn \multicolsep { 12pt plus 4pt minus 3pt } \skip_set:Nn \dbltextfloatsep { 16pt plus 2pt minus 4pt } \int_gset:Nn \vbadness { 10000 } \int_gset:Nn \hbadness { 10000 } @@ -2549,7 +2549,7 @@ \setlist { labelsep = .75\ccwd,listparindent = 2\ccwd,leftmargin = *, - itemsep = .75ex plus .1ex,topsep = .75ex plus .1ex, + itemsep = 0.75ex plus .1ex,topsep = 0.75ex plus .1ex, partopsep = 0ex,parsep = 0ex } \newlist{eb@outline@list}{itemize}{1} @@ -2592,57 +2592,46 @@ {\AfterPreamble{\eb@declare@theorem@save[#1]{#2}}} \cs_set_eq:NN \newtheorem \declaretheorem -\bool_new:N \l__eb_thmbox_bool -\tl_new:N \l__eb_thm_numberwith_tl -\tl_new:N \l__eb_thm_headpunct_tl -\tl_new:N \l__eb_thm_bodyfont_tl -\tl_new:N \l__eb_thm_notefont_tl -\tl_new:N \l__eb_thm_headindent_tl -\tl_new:N \l__eb_thm_spaceabove_tl -\tl_new:N \l__eb_thm_spacebelow_tl - -\eb_ctex_define:nn { thmset } - { - thmbox .bool_set:N = \l__eb_thmbox_bool, - thmbox .default:n = true, - thmbox .initial:n = false, - within .tl_set:N = \l__eb_thm_numberwith_tl, - within .initial:n = \bool_if:NT \l__eb_class_book_bool { chapter }, - bodyfont .tl_set:N = \l__eb_thm_bodyfont_tl, - bodyfont .initial:n = { }, - notefont .tl_set:N = \l__eb_thm_notefont_tl, - notefont .initial:n = { }, - headfont .tl_set:N = \l__eb_thm_headfont_tl, - headfont .initial:n = \color{ctex@emph}\sffamily, - headpunct .tl_set:N = \l__eb_thm_headpunct_tl, - headpunct .initial:n = { }, - spacepost .tl_set:N = \l__eb_thm_spacepost_tl, - spacepost .initial:n = \ccwd, - headindent .tl_set:N = \l__eb_thm_headindent_tl, - headindent .initial:n = 0\ccwd, - spaceabove .tl_set:N = \l__eb_thm_spaceabove_tl, - spaceabove .initial:n = .75ex plus .1ex, - spacebelow .tl_set:N = \l__eb_thm_spacebelow_tl, - spacebelow .initial:n = .75ex plus .1ex - } -\tl_const:Nn \c__eb_thmtools_keyval_tl +\prop_new:N \l__eb_thmtools_entry_prop +\clist_const:Nn \c__eb_thmtools_entry_clist { spaceabove = \l__eb_thm_spaceabove_tl, spacebelow = \l__eb_thm_spacebelow_tl, headindent = \l__eb_thm_headindent_tl, headfont = \l__eb_thm_headfont_tl, notefont = \l__eb_thm_notefont_tl, - notebraces = { }{ }, + notebraces = \l__eb_thm_notebraces_tl, bodyfont = \l__eb_thm_bodyfont_tl, headpunct = \l__eb_thm_headpunct_tl, - postheadspace = \l__eb_thm_spacepost_tl, - within = \l__eb_thm_numberwith_tl, + postheadspace = \l__eb_thm_postheadspace_tl, + within = \l__eb_thm_within_tl, + headformat = \l__eb_thm_headformat_tl + } +\exp_args:NNV +\prop_set_from_keyval:Nn \l__eb_thmtools_entry_prop +\c__eb_thmtools_entry_clist +\prop_map_inline:Nn \l__eb_thmtools_entry_prop + { \eb_ctex_define:nn { thmset } { #1 .tl_set:N = #2 } } +\eb_ctex_define:nn { thmset } + { + thmbox .bool_set:N = \l__eb_thmbox_bool, + thmbox .default:n = true, + thmbox .initial:n = false + } +\ctex_set:nn { thmset } + { + spaceabove = 0.75ex plus .1ex, + spacebelow = 0.75ex plus .1ex, + headindent = 0\ccwd, + headfont = \color{ctex@emph}\sffamily, + postheadspace = \ccwd, + within = \bool_if:NT \l__eb_class_book_bool { chapter }, headformat = \NAME\space\NUMBER\NOTE } \eb_at_end_preamble:n { \exp_last_unbraced:NNV - \declaretheoremstyle[\c__eb_thmtools_keyval_tl]{easy-theorem} + \declaretheoremstyle[\c__eb_thmtools_entry_clist]{easy-theorem} \eb_thmname_set:nnn { exercise } { Exercise } { 练习 } \cs_undefine:N \proof \clist_map_inline:nn -- cgit v1.2.3