summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/easybook
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-06-16 03:01:15 +0000
committerNorbert Preining <norbert@preining.info>2021-06-16 03:01:15 +0000
commit2c0c7988beae1efa245bfb9fec0a25d41d88047d (patch)
treeeb29ed898d242ae356a592081c53f11dbd751870 /macros/latex/contrib/easybook
parent2faf2507ca4d1d6d153f4c2b4c4c78479d459f06 (diff)
CTAN sync 202106160301
Diffstat (limited to 'macros/latex/contrib/easybook')
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx132
-rw-r--r--macros/latex/contrib/easybook/easybook.pdfbin328635 -> 331393 bytes
2 files changed, 86 insertions, 46 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index c07e0d03c3..762a7b0cd0 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/14\hskip\ccwd\relax v1.26b\thanks{\url{https://gitee.com/texl3/easybook}}}
+% \date{2021/06/15\hskip\ccwd\relax v1.26c\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{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.26c}{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.26c}{2021/06/13}{增加调整英文目录格式的钩子 \tn{EBeforeAddBitoc}。}
% \end{function}
%
% \tn{EBeforeAddBitoc} 是一个作用于局部范围的英文目录钩子,可以插入标题或目录设置的命令改变英文目录中标题的显示格式,也可以覆盖上述的目录前后名字和编号等设置,带有星号的命令会重置之前的代码,放置在导言区或 \tn{bichapter} 等命令前生效。
@@ -462,46 +471,47 @@
% \item[spacepost] 定理标题后与第一段内容的间隔。
% \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},如果需要新的定理标题名或定理样式可使用这两个命令。
% \changes{v1.23}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。}
% \changes{v1.24}{2021/04/25}{增加定义定理环境命令 \tn{EBNewTheorem}。}
+% \changes{v1.26c}{2021/06/15}{定义新定理环境的命令调整为 \tn{declaretheorem}。}
% \end{function}
%
% \begin{optdesc}
-% \item[\tn{newtheorem}] 定义新的定理类环境,可选参数与 \pkg{thmtools} 宏包定理命令 \tn{declaretheorem} 的参数一致。常用的选项如下
+% \item[\tn{declaretheorem}] 定义新的定理类环境,\tn{newtheorem} 命令与它等效,可选参数与 \pkg{thmtools} 宏包创建定理命令 \tn{declaretheorem} 的参数一致。常用的选项如下
% \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} 是更便捷的定理命令,它定义一个新的定理环境,键值列表支持的选项与 \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}] 定义新的定理样式,可选参数中除了包括上述定理样式选项,还包括 \tn{declaretheorem} 的选项。
% \end{optdesc}
%
% \subsubsection{新的定理样式}
% 定理由 \pkg{thmtools} 设置,预置定理的样式为 \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 +586,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}。}
% \end{function}
%
% 命令 \tn{markrule} 用于绘制页眉页脚横线,长度默认为页面文本区的宽度,上下间距为横线与上下方部件的间距,带有长度单位,间距长度之间用+号分开,若只有一部分则表示上间距,这个命令也可以在正文中绘制横线。下面举一个设置页眉内容的例子
@@ -1068,7 +1079,7 @@
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/06/14}{1.26b}{beta}
+\ProvidesExplClass{easybook}{2021/06/15}{1.26c}{beta}
\bool_set_false:N \l__eb_compile_draft_bool
\bool_set_false:N \l__eb_title_newline_bool
@@ -1128,8 +1139,11 @@
},
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,
+ floatpage .initial:n = false,
+ unknown .code:n =
{ \clist_gput_right:NV \g__eb_options_clist \CurrentOption }
}
@@ -1253,7 +1267,8 @@
aftername =
{
\bool_if:NTF \l__eb_title_newline_bool
- { \par\nobreak } { \hspace{\ccwd} }
+ { \par\nobreak }
+ { \hspace{\ccwd} }
}
},
chapter =
@@ -1267,7 +1282,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 +1328,7 @@
%<*package>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{etoolbox}
-\ProvidesExplPackage{easybase}{2021/06/14}{1.26b}{beta}
+\ProvidesExplPackage{easybase}{2021/06/15}{1.26c}{beta}
\cs_generate_variant:Nn \eb_ctex_define:nn { nx }
\cs_generate_variant:Nn \int_to_arabic:n { v }
@@ -1382,8 +1398,11 @@
\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,
class .choice:,
class .value_required:n = true,
@@ -1426,6 +1445,19 @@
}
\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_set_eq:NN \eb@chapter@save \chapter
+ \cs_undefine:N \chapter
+ \ctex_after_end_preamble:n
+ { \cs_set_eq:NN \chapter \eb@chapter@save }
+ }
\ctex_define:n
{
link .meta:nn = { ctex/link } {#1},
@@ -1653,11 +1685,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 +1757,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 +1902,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 +1995,8 @@
{\thecontentspage}
{
\bool_if:NTF \l__eb_toc_line_align_bool
- { \contentspage } { \thecontentspage }
+ { \contentspage }
+ { \thecontentspage }
}
}
}
@@ -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 \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
@@ -2546,6 +2587,10 @@
\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
@@ -2556,8 +2601,6 @@
\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,
@@ -3057,10 +3100,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/macros/latex/contrib/easybook/easybook.pdf b/macros/latex/contrib/easybook/easybook.pdf
index bfa06382e0..68ec807580 100644
--- a/macros/latex/contrib/easybook/easybook.pdf
+++ b/macros/latex/contrib/easybook/easybook.pdf
Binary files differ