diff options
author | Karl Berry <karl@freefriends.org> | 2021-06-16 20:43:19 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-06-16 20:43:19 +0000 |
commit | 38ff5bfc6797433b09363c3e187b6395f9bb09da (patch) | |
tree | d56d1fb1c7e2c882e85001ca287281750acc4ed9 /Master/texmf-dist | |
parent | 06ec64595c3f158672d23aadefeff2d07439700f (diff) |
easybook (16jun21)
git-svn-id: svn://tug.org/texlive/trunk@59609 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/latex/easybook/easybook.pdf | bin | 328635 -> 333334 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/latex/easybook/easybook.dtx | 247 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/easybook/easybase.sty | 180 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/easybook/easybook.cls | 24 |
4 files changed, 248 insertions, 203 deletions
diff --git a/Master/texmf-dist/doc/latex/easybook/easybook.pdf b/Master/texmf-dist/doc/latex/easybook/easybook.pdf Binary files differindex bfa06382e0d..eae8692d09d 100644 --- a/Master/texmf-dist/doc/latex/easybook/easybook.pdf +++ b/Master/texmf-dist/doc/latex/easybook/easybook.pdf diff --git a/Master/texmf-dist/source/latex/easybook/easybook.dtx b/Master/texmf-dist/source/latex/easybook/easybook.dtx index c07e0d03c37..67902b529b3 100644 --- a/Master/texmf-dist/source/latex/easybook/easybook.dtx +++ b/Master/texmf-dist/source/latex/easybook/easybook.dtx @@ -28,7 +28,7 @@ % % \title{\sffamily easybook 文档类手册} % \author{瞿毅} -% \date{2021/06/14\hskip\ccwd\relax v1.26b\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},包含了节 \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} % @@ -148,10 +148,18 @@ % \begin{syntax} % config = <配置文件名> % \end{syntax} -% \opt{config}为载入用户配置选项,配置文件名不需加括号但需带有后缀名如 \opt{tex}、\opt{def} 和 \opt{cfg}。 +% \opt{config} 为载入用户配置选项,配置文件名不需加括号但需带有后缀名如 \opt{tex}、\opt{def} 和 \opt{cfg}。 % \changes{v1.10}{2021/01/08}{加入载入用户配置选项。} % \end{function} % +% \begin{function}[rEXP,added = 2021-06-15]{floatpage} +% \begin{syntax} +% floatpage = <true|(false)> +% \end{syntax} +% 开启这个选项后浮动环境 \env{table} 和 \env{figure} 的比例参数会使用默认值,关闭它则尽可能避免出现浮动页,使图表环境与正文段落更加紧凑,减少多余的空白版面。 +% \changes{v1.26d}{2021/06/15}{增加浮动环境比例参数选项 \opt{floatpage}。} +% \end{function} +% % \subsection{article 模式} % \begin{function}[rEXP,added = 2021-03-16]{class} % \begin{syntax} @@ -231,6 +239,7 @@ % \tn{EBeforeAddBitoc*}\marg{加入目录英文标题前的代码} % \end{syntax} % \tn{appendix} 命令后的章节标题变为附录形式。英文目录中附录标题的格式用可选参数修改,英文附录目录前名字默认为 Appendix\tn{space},后名字默认为空,名字之间用一个半角逗号分开,也可以只有一部分,表示英文附录目录前名字。英文附录目录数字输出命令默认为 \tn{Alph}\{chapter\}。 +% \changes{v1.26d}{2021/06/13}{增加调整英文目录格式的钩子 \tn{EBeforeAddBitoc}。} % \end{function} % % \tn{EBeforeAddBitoc} 是一个作用于局部范围的英文目录钩子,可以插入标题或目录设置的命令改变英文目录中标题的显示格式,也可以覆盖上述的目录前后名字和编号等设置,带有星号的命令会重置之前的代码,放置在导言区或 \tn{bichapter} 等命令前生效。 @@ -432,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 = <true|(false)> % within = <(chapter)|section|其它环境|空置> @@ -444,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] 定理内容部分的字体。 @@ -460,48 +470,50 @@ % \item[spaceabove] 定理环境前的间距。 % \item[spacebelow] 定理环境后的间距。 % \item[spacepost] 定理标题后与第一段内容的间隔。 +% \item[headformat] 定理开头部分各组成元素的排列和格式,这个选项一般不需要使用,其中 \tn{NAME}、\tn{NUMBER} 和 \tn{NOTE} 分别代表标题、编号和题注。 % \end{optdesc} % -% \begin{function}[added = 2021-01-12,updated = 2021-04-25]{\newtheorem,\EBNewTheorem,\declaretheoremstyle} +% \begin{function}[added = 2021-01-12,updated = 2021-06-15]{\declaretheorem,\EBNewTheorem,\declaretheoremstyle} % \begin{syntax} -% \tn{newtheorem}\oarg{键值列表}\marg{定理环境名} +% \tn{declaretheorem}\oarg{键值列表}\marg{定理环境名} % \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.26d}{2021/06/15}{定义新定理环境的命令调整为 \tn{declaretheorem}。} % \end{function} % % \begin{optdesc} -% \item[\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{newtheorem} 相同,但它们的区别有 +% \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{newtheorem} 的选项。 +% \item[\tn{declaretheoremstyle}] 定义新的定理样式,\meta{键值列表} 中包括上述定理样式以及 \tn{declaretheorem} 的所有选项。 % \end{optdesc} % % \subsubsection{新的定理样式} -% 定理由 \pkg{thmtools} 设置,预置定理的样式为 \opt{easy-theorem},上述定理样式选项将对这个定理样式生效。如果使用这个样式而只是增加新的定理名称,可以这样 +% 预置定理的样式为 \opt{easy-theorem},上述定理样式选项将对这个定理样式生效。如果使用这个样式而只是增加新的定理名称,可以这样 % \begin{ctexexam} % \EBNewTheorem{定理环境名}{中文标题}[style = other theorem] -% \newtheorem[style = easy-theorem,name = 定理名]{定理环境名} +% \declaretheorem[style = easy-theorem,name = 定理名]{定理环境名} % \end{ctexexam} -% \tn{newtheorem} 定义的定理环境需要手动增加盒子边框,可以如下进行设置 +% \tn{declaretheorem} 定义的定理环境需要手动增加盒子边框,可以如下进行设置 % \begin{ctexexam} % \tcolorboxenvironment{定理环境名}{tc-theorem} % \end{ctexexam} -% 定义一个新的定理样式可用于 \tn{newtheorem} 的 \opt{style} 选项。 +% 定义一个新的定理样式可用于 \tn{declaretheorem} 的 \opt{style} 选项 % \begin{ctexexam} % \declaretheoremstyle[bodyfont = \rmfamily,spacepost = 0.5\ccwd]{定理样式名} % \end{ctexexam} @@ -576,6 +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.26d}{2021/06/14}{增加页眉页脚的横线绘制命令 \tn{markrule}。} % \end{function} % % 命令 \tn{markrule} 用于绘制页眉页脚横线,长度默认为页面文本区的宽度,上下间距为横线与上下方部件的间距,带有长度单位,间距长度之间用+号分开,若只有一部分则表示上间距,这个命令也可以在正文中绘制横线。下面举一个设置页眉内容的例子 @@ -1068,7 +1081,7 @@ %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/06/14}{1.26b}{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 @@ -1087,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 } @@ -1103,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 } @@ -1126,10 +1138,11 @@ \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, - unknown .code:n = + config .tl_set:N = \g__eb_config_tl, + floatpage .bool_set:N = \l__eb_float_page_bool, + floatpage .default:n = true, + unknown .code:n = { \clist_gput_right:NV \g__eb_options_clist \CurrentOption } } @@ -1253,7 +1266,8 @@ aftername = { \bool_if:NTF \l__eb_title_newline_bool - { \par\nobreak } { \hspace{\ccwd} } + { \par\nobreak } + { \hspace{\ccwd} } } }, chapter = @@ -1267,7 +1281,8 @@ aftername = { \bool_if:NTF \l__eb_title_newline_bool - { \par\nobreak\vskip 1.5pc } { \hspace{\ccwd} } + { \par\nobreak\vskip 1.5pc } + { \hspace{\ccwd} } }, beforeskip = -1.5ex, afterskip = 3ex, @@ -1312,7 +1327,7 @@ %<*package> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{etoolbox} -\ProvidesExplPackage{easybase}{2021/06/14}{1.26b}{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 } @@ -1382,8 +1397,16 @@ \keys_define:nn { easybase } { - draft .code:n = + draft .code:n = { \bool_set_true:N \l__eb_compile_draft_bool }, + floatpage .bool_set:N = \l__eb_float_page_bool, + 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, @@ -1392,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 @@ -1426,6 +1450,26 @@ } \keys_define:nn { } { ctex/link .inherit:n = ctex/refset } \cs_set_eq:NN \link \refset +\cs_if_exist:NF \chapter + { + \newcounter{chapter} + \bool_set_false:N \l__eb_class_book_bool + \ctex_define:n { chapter/tocline .code:n = { } } + } +\bool_if:NF \l__eb_class_book_bool + { + \cs_undefine:N \chapter + \ctex_after_end_preamble:n + { + \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 { link .meta:nn = { ctex/link } {#1}, @@ -1653,11 +1697,13 @@ fnmark-num .value_required:n = true } +\cs_set_eq:NN \eb@text@uppercase \text_uppercase:n +\cs_set_eq:NN \eb@text@nouppercase \text_titlecase_first:n \cs_new:Npn \eb_mark_uppercase_bool:nn #1#2 { \bool_if:NTF \l__eb_mark_uppercase_bool - { \text_uppercase:n } - { \text_titlecase_first:n } + { \eb@text@uppercase } + { \eb@text@nouppercase } { \use:c { eb_fancyhf_#1_mark:n } {#2} } } \cs_new:Npn \eb@level@markdouble #1#2 @@ -1723,7 +1769,8 @@ \counterwithin*{footnote}{page} } \bool_if:NTF \l__eb_footnote_hang_bool - { \booltrue{FN@hangfoot} } { \boolfalse{FN@hangfoot} } + { \booltrue{FN@hangfoot} } + { \boolfalse{FN@hangfoot} } } \eb_patch_cmd:nnn { \@footnotetext,\@mpfootnotetext } { \reset@font } @@ -1867,12 +1914,6 @@ \hspace{\use:c { eb@toc@#1@numsep }} }{} } -\cs_if_exist:NF \chapter - { - \newcounter{chapter} - \bool_set_false:N \l__eb_class_book_bool - \ctex_define:n { chapter/tocline .code:n = { } } - } \newbool{eb@titletoc@hang@fix} \eb_ctex_define:nn { tocset } { @@ -1966,7 +2007,8 @@ {\thecontentspage} { \bool_if:NTF \l__eb_toc_line_align_bool - { \contentspage } { \thecontentspage } + { \contentspage } + { \thecontentspage } } } } @@ -2108,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 } } @@ -2288,11 +2318,10 @@ binmuber .tl_set:N = \CTEX@bichapter@number, binmuber .initial:n = \arabic{chapter} } -\cs_new_protected:Npn \eb_counter_set:nn #1#2 +\cs_new_protected:Npn \eb_counter_zero:n #1 { - \seq_set_from_clist:No \l__eb_counter_name_seq {#2} - \seq_map_inline:Nn \l__eb_counter_name_seq - { \setcounter{##1}{#1} } + \seq_set_from_clist:No \l__eb_counter_name_seq {#1} + \seq_map_inline:Nn \l__eb_counter_name_seq { \setcounter{##1}{0} } } \RenewDocumentCommand{\appendix} {O{Appendix\space}D(){\Alph{chapter}}} @@ -2319,7 +2348,7 @@ \gdef\CTEX@thechapter{\CTEX@appendix@number} \gdef\CTEX@postchapter{\CTEX@postappendix} \gdef\CTEX@chapter@numbering{\CTEX@appendix@numbering} - \eb_counter_set:nn { 0 } { chapter,section,bichapter,bisection } + \eb_counter_zero:n { chapter,section,bichapter,bisection } } { \gdef\thesection{\@Alph\c@section} @@ -2329,7 +2358,7 @@ \gdef\CTEX@postsection{\CTEX@postappendix} \gdef\CTEX@section@numbering{\CTEX@appendix@numbering} \ctex_set:nn { appendix } { number = \@Alph\c@section,name = { } } - \eb_counter_set:nn { 0 } { section,subsection,bisection,bisubsection } + \eb_counter_zero:n { section,subsection,bisection,bisubsection } } } @@ -2472,21 +2501,33 @@ \selectfont\ignorespaces } +\cs_new_protected:Npn \eb_float_proportion_set:nn #1#2 + { \tl_gset:cn { #1fraction } {#2} } +\bool_if:NF \l__eb_float_page_bool + { + \clist_map_inline:nn + { + { text } { 0.1 }, + { top } { 0.9 }, + { bottom } { 0.9 }, + { floatpage } {0.9 }, + { dbltop } { 0.9 }, + { dblfloatpage } { 0.9 } + } + { \eb_float_proportion_set:nn #1 } + } \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 } \setcounter{topnumber}{4} \setcounter{bottomnumber}{4} \setcounter{totalnumber}{8} -\tl_gset:Nn \textfraction { 0.15 } -\tl_gset:Nn \topfraction { 0.8 } -\tl_gset:Nn \bottomfraction { 0.8 } -\tl_gset:Nn \floatpagefraction { 0.9 } -\tl_gset:Nn \dblfloatpagefraction { 0.9 } -\tl_gset:Nn \ULthickness { 0.75pt } \allowdisplaybreaks[4] +\tl_gset:Nn \ULthickness { \eb@rule@width@dim } \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} \cs_new_protected:Npn \eb_enumitem_label_set:nn #1#2 @@ -2508,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} @@ -2546,60 +2587,51 @@ \labelformat{#1}{\tl_use:c { c__eb_name_#1_tl }~##1} } } +\cs_set_eq:NN \eb@declare@theorem@save \declaretheorem +\RenewDocumentCommand{\declaretheorem}{O{}m} + {\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 - -\RenewDocumentCommand{\newtheorem}{O{}m} - {\AfterPreamble{\declaretheorem[#1]{#2}}} -\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 @@ -3057,10 +3089,7 @@ \clist_map_inline:nn { page,none } { \tl_if_eq:NnT \l_keys_value_tl {##1} - { - \clist_map_break:n - { \colorlet{ctex@toc@number}{black} } - } + { \clist_map_break:n { \colorlet{ctex@toc@number}{black} } } } }, linktoc .default:n = all, diff --git a/Master/texmf-dist/tex/latex/easybook/easybase.sty b/Master/texmf-dist/tex/latex/easybook/easybase.sty index 6eed832fb2e..47448bdbe93 100644 --- a/Master/texmf-dist/tex/latex/easybook/easybase.sty +++ b/Master/texmf-dist/tex/latex/easybook/easybase.sty @@ -13,7 +13,7 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{etoolbox} -\ProvidesExplPackage{easybase}{2021/06/14}{1.26b}{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 } @@ -83,8 +83,16 @@ \keys_define:nn { easybase } { - draft .code:n = + draft .code:n = { \bool_set_true:N \l__eb_compile_draft_bool }, + floatpage .bool_set:N = \l__eb_float_page_bool, + 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, @@ -93,7 +101,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 @@ -127,6 +136,26 @@ } \keys_define:nn { } { ctex/link .inherit:n = ctex/refset } \cs_set_eq:NN \link \refset +\cs_if_exist:NF \chapter + { + \newcounter{chapter} + \bool_set_false:N \l__eb_class_book_bool + \ctex_define:n { chapter/tocline .code:n = { } } + } +\bool_if:NF \l__eb_class_book_bool + { + \cs_undefine:N \chapter + \ctex_after_end_preamble:n + { + \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 { link .meta:nn = { ctex/link } {#1}, @@ -354,11 +383,13 @@ fnmark-num .value_required:n = true } +\cs_set_eq:NN \eb@text@uppercase \text_uppercase:n +\cs_set_eq:NN \eb@text@nouppercase \text_titlecase_first:n \cs_new:Npn \eb_mark_uppercase_bool:nn #1#2 { \bool_if:NTF \l__eb_mark_uppercase_bool - { \text_uppercase:n } - { \text_titlecase_first:n } + { \eb@text@uppercase } + { \eb@text@nouppercase } { \use:c { eb_fancyhf_#1_mark:n } {#2} } } \cs_new:Npn \eb@level@markdouble #1#2 @@ -424,7 +455,8 @@ \counterwithin*{footnote}{page} } \bool_if:NTF \l__eb_footnote_hang_bool - { \booltrue{FN@hangfoot} } { \boolfalse{FN@hangfoot} } + { \booltrue{FN@hangfoot} } + { \boolfalse{FN@hangfoot} } } \eb_patch_cmd:nnn { \@footnotetext,\@mpfootnotetext } { \reset@font } @@ -568,12 +600,6 @@ \hspace{\use:c { eb@toc@#1@numsep }} }{} } -\cs_if_exist:NF \chapter - { - \newcounter{chapter} - \bool_set_false:N \l__eb_class_book_bool - \ctex_define:n { chapter/tocline .code:n = { } } - } \newbool{eb@titletoc@hang@fix} \eb_ctex_define:nn { tocset } { @@ -667,7 +693,8 @@ {\thecontentspage} { \bool_if:NTF \l__eb_toc_line_align_bool - { \contentspage } { \thecontentspage } + { \contentspage } + { \thecontentspage } } } } @@ -809,20 +836,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 } } @@ -989,11 +1004,10 @@ binmuber .tl_set:N = \CTEX@bichapter@number, binmuber .initial:n = \arabic{chapter} } -\cs_new_protected:Npn \eb_counter_set:nn #1#2 +\cs_new_protected:Npn \eb_counter_zero:n #1 { - \seq_set_from_clist:No \l__eb_counter_name_seq {#2} - \seq_map_inline:Nn \l__eb_counter_name_seq - { \setcounter{##1}{#1} } + \seq_set_from_clist:No \l__eb_counter_name_seq {#1} + \seq_map_inline:Nn \l__eb_counter_name_seq { \setcounter{##1}{0} } } \RenewDocumentCommand{\appendix} {O{Appendix\space}D(){\Alph{chapter}}} @@ -1020,7 +1034,7 @@ \gdef\CTEX@thechapter{\CTEX@appendix@number} \gdef\CTEX@postchapter{\CTEX@postappendix} \gdef\CTEX@chapter@numbering{\CTEX@appendix@numbering} - \eb_counter_set:nn { 0 } { chapter,section,bichapter,bisection } + \eb_counter_zero:n { chapter,section,bichapter,bisection } } { \gdef\thesection{\@Alph\c@section} @@ -1030,7 +1044,7 @@ \gdef\CTEX@postsection{\CTEX@postappendix} \gdef\CTEX@section@numbering{\CTEX@appendix@numbering} \ctex_set:nn { appendix } { number = \@Alph\c@section,name = { } } - \eb_counter_set:nn { 0 } { section,subsection,bisection,bisubsection } + \eb_counter_zero:n { section,subsection,bisection,bisubsection } } } @@ -1173,21 +1187,33 @@ \selectfont\ignorespaces } +\cs_new_protected:Npn \eb_float_proportion_set:nn #1#2 + { \tl_gset:cn { #1fraction } {#2} } +\bool_if:NF \l__eb_float_page_bool + { + \clist_map_inline:nn + { + { text } { 0.1 }, + { top } { 0.9 }, + { bottom } { 0.9 }, + { floatpage } {0.9 }, + { dbltop } { 0.9 }, + { dblfloatpage } { 0.9 } + } + { \eb_float_proportion_set:nn #1 } + } \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 } \setcounter{topnumber}{4} \setcounter{bottomnumber}{4} \setcounter{totalnumber}{8} -\tl_gset:Nn \textfraction { 0.15 } -\tl_gset:Nn \topfraction { 0.8 } -\tl_gset:Nn \bottomfraction { 0.8 } -\tl_gset:Nn \floatpagefraction { 0.9 } -\tl_gset:Nn \dblfloatpagefraction { 0.9 } -\tl_gset:Nn \ULthickness { 0.75pt } \allowdisplaybreaks[4] +\tl_gset:Nn \ULthickness { \eb@rule@width@dim } \DeclareGraphicsExtensions{.pdf,.png,.jpg,.eps,.tif} \cs_new_protected:Npn \eb_enumitem_label_set:nn #1#2 @@ -1209,7 +1235,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} @@ -1247,60 +1273,51 @@ \labelformat{#1}{\tl_use:c { c__eb_name_#1_tl }~##1} } } +\cs_set_eq:NN \eb@declare@theorem@save \declaretheorem +\RenewDocumentCommand{\declaretheorem}{O{}m} + {\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 - -\RenewDocumentCommand{\newtheorem}{O{}m} - {\AfterPreamble{\declaretheorem[#1]{#2}}} -\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 @@ -1758,10 +1775,7 @@ \clist_map_inline:nn { page,none } { \tl_if_eq:NnT \l_keys_value_tl {##1} - { - \clist_map_break:n - { \colorlet{ctex@toc@number}{black} } - } + { \clist_map_break:n { \colorlet{ctex@toc@number}{black} } } } }, linktoc .default:n = all, diff --git a/Master/texmf-dist/tex/latex/easybook/easybook.cls b/Master/texmf-dist/tex/latex/easybook/easybook.cls index a0f73b2f5ca..843df4dc485 100644 --- a/Master/texmf-dist/tex/latex/easybook/easybook.cls +++ b/Master/texmf-dist/tex/latex/easybook/easybook.cls @@ -13,7 +13,7 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/06/14}{1.26b}{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 @@ -32,10 +32,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 } @@ -48,16 +48,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 } @@ -71,10 +70,11 @@ \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, - unknown .code:n = + config .tl_set:N = \g__eb_config_tl, + floatpage .bool_set:N = \l__eb_float_page_bool, + floatpage .default:n = true, + unknown .code:n = { \clist_gput_right:NV \g__eb_options_clist \CurrentOption } } @@ -198,7 +198,8 @@ aftername = { \bool_if:NTF \l__eb_title_newline_bool - { \par\nobreak } { \hspace{\ccwd} } + { \par\nobreak } + { \hspace{\ccwd} } } }, chapter = @@ -212,7 +213,8 @@ aftername = { \bool_if:NTF \l__eb_title_newline_bool - { \par\nobreak\vskip 1.5pc } { \hspace{\ccwd} } + { \par\nobreak\vskip 1.5pc } + { \hspace{\ccwd} } }, beforeskip = -1.5ex, afterskip = 3ex, |