summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/easybook/easybook.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/easybook/easybook.dtx')
-rw-r--r--macros/latex/contrib/easybook/easybook.dtx135
1 files changed, 66 insertions, 69 deletions
diff --git a/macros/latex/contrib/easybook/easybook.dtx b/macros/latex/contrib/easybook/easybook.dtx
index cd6abe176e..338c72d9b4 100644
--- a/macros/latex/contrib/easybook/easybook.dtx
+++ b/macros/latex/contrib/easybook/easybook.dtx
@@ -55,7 +55,7 @@ The latest version of this license is in
%
% \title{\sffamily easybook书籍文档类}
% \author{瞿毅}
-% \date{2021/04/03\hskip\ccwd\relax v1.24c\thanks{\url{https://gitee.com/texl3/easybook}}}
+% \date{2021/04/04\hskip\ccwd\relax v1.24d\thanks{\url{https://gitee.com/texl3/easybook}}}
% \maketitle
% \begin{abstract}
% \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装。虽然\CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并载入一些常用宏包实现一般的排版需求,它适用于排版中英文书籍或笔记,甚至可稍加调整成为学位论文模板。
@@ -151,7 +151,7 @@ The latest version of this license is in
%
% \subsection{文档命令}
% \label{subsec:document command}
-% \begin{function}[added = 2021-02-20,updated = 2021-03-15]{\frontmatter,\mainmatter,\backmatter,\tableofcontents,\listoffigures,\listoftables,\listoflistings}
+% \begin{function}[added = 2021-02-20,updated = 2021-04-04]{\frontmatter,\mainmatter,\backmatter,\tableofcontents,\listoffigures,\listoftables,\listoflistings}
% \begin{syntax}
% \tn{frontmatter*}\oarg{编号格式|(Roman)}
% \tn{mainmatter*}
@@ -161,16 +161,18 @@ The latest version of this license is in
% \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{listoffigures} 命令输出图片目录,\tn{listoftables} 命令输出表格目录,\tn{listoflistings} 命令输出代码目录。带有星号的目录命令不会添加进主文档目录中,目录的键值列表选项如下
+% \tn{frontmatter} 为前言区命令,章标题不编号,页码可设置为例如 \opt{roman}、\opt{Alph} 等格式,带有星号的命令 \tn{frontmatter*} 不使用 \tn{cleardoublepage}。\tn{mainmatter} 为主文区命令,章标题正常编号且页码为从1开始计数的阿拉伯数字,\tn{mainmatter*} 命令不使用 \tn{cleardoublepage}。\tn{backmatter} 为后记区命令,页码格式与编号保持不变,章标题不编号。\tn{listoffigures} 命令输出图片目录,\tn{listoftables} 输出表格目录,\tn{listoflistings} 输出代码目录。带有星号的目录命令不会添加进主文档目录中,目录的键值列表选项如下
% \changes{v1.23}{2021/02/20}{重新定义文档结构划分命令。}
% \end{function}
%
-% \begin{function}{multoc,book,article}
+% \begin{function}{multoc,title,book,article}
% \begin{syntax}
% multoc = <true|(false)>
+% title = <目录标题名称>
% \end{syntax}
-% \opt{multoc} 与 \opt{style/multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同目录是否双栏排版。\opt{book} 选项使目录标题按照 \opt{chapter} 级别输出,\opt{article} 选项使目录标题按照 \opt{article} 级别输出,默认为 \opt{chapter} 级别。
+% \opt{multoc} 与 \opt{style/multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同目录是否双栏排版。已经预置了中英文的目录标题,可以使用 \opt{title} 选项更改目录标题的名称。\opt{book} 选项使目录标题按照 \opt{chapter} 级别输出,\opt{article} 选项使目录标题按照 \opt{article} 级别输出,默认为 \opt{chapter} 级别。
% \changes{v1.23}{2021/03/15}{为几个目录增加键值列表的选项,可设置标题输出级别以及是否加入主目录。}
+% \changes{v1.24d}{2021/04/04}{目录命令的可选参数增加标题键值。}
% \end{function}
%
% \section{接口选项}
@@ -788,7 +790,7 @@ The latest version of this license is in
%<*class>
\NeedsTeXFormat{LaTeX2e}[2020/10/01]
\RequirePackage{l3keys2e}
-\ProvidesExplClass{easybook}{2021/04/03}{1.24c}{beta}
+\ProvidesExplClass{easybook}{2021/04/04}{1.24d}{beta}
\cs_generate_variant:Nn \keys_define:nn {nx}
\cs_generate_variant:Nn \int_to_arabic:n {v}
@@ -819,20 +821,17 @@ The latest version of this license is in
english .code:n = \bool_set_false:N \l__lang_chinese_bool,
enstyle .meta:n = {newline,entitle,english},
- font .choice:,
- font .value_required:n = true,
- font/overleaf .code:n = {},
- font/adobe .code:n = \__put_ctexbook:n {fontset = #1},
- font/founder .code:n = \__put_ctexbook:n {fontset = #1},
- font/mac .code:n = \__put_ctexbook:n {fontset = #1},
- font/windows .code:n = \__put_ctexbook:n {fontset = #1},
- font/linux .code:n = \__put_ctexbook:n {fontset = ubuntu},
- font/none .code:n = \__put_ctexbook:n {fontset = #1},
+ font .choices:nn =
+ {adobe,founder,mac,windows,none}
+ {\__put_ctexbook:n {fontset = \l_keys_choice_tl}},
font/noto .code:n =
{
\bool_set_true:N \l__font_noto_bool
\__put_ctexbook:n {fontset = none}
},
+ font/overleaf .code:n = {},
+ font/linux .code:n = \__put_ctexbook:n {fontset = ubuntu},
+ font .value_required:n = true,
font .initial:n = overleaf,
paper .choice:,
@@ -906,39 +905,36 @@ The latest version of this license is in
}
\__ctex_define:nn {style}
{
- multoc .bool_set:N = \l__multoc_bool,
- multoc .default:n = true,
- withpart .bool_set:N = \l__chap_withpart_bool,
- withpart .default:n = true,
- withpart .initial:n = false,
- notomath .bool_set:N = \l__notomath_bool,
- notomath .default:n = true,
- notomath .initial:n = false,
- rulewidth .dim_set:N = \l__rule_width_dim,
- rulewidth .initial:n = 0.75pt,
- uppercase .bool_set:N = \l__uppercase_bool,
- uppercase .default:n = true,
- uppercase .initial:n = true,
+ multoc .bool_set:N = \l__multoc_bool,
+ multoc .default:n = true,
+ withpart .bool_set:N = \l__chap_withpart_bool,
+ withpart .default:n = true,
+ withpart .initial:n = false,
+ notomath .bool_set:N = \l__notomath_bool,
+ notomath .default:n = true,
+ notomath .initial:n = false,
+ rulewidth .dim_set:N = \l__rule_width_dim,
+ rulewidth .initial:n = 0.75pt,
+ uppercase .bool_set:N = \l__uppercase_bool,
+ uppercase .default:n = true,
+ uppercase .initial:n = true,
- footwith .choice:,
- footwith .value_required:n = true,
- footwith/part .code:n =
- {\tl_set:Nn \l__foot_numberwith_tl{#1}},
- footwith/page .code:n =
- {\tl_set:Nn \l__foot_numberwith_tl{#1}},
- footwith/chapter .code:n = {},
- footwith .initial:n = chapter,
+ footwith .choices:nn =
+ {part,page,chapter}
+ {\tl_set_eq:NN \l__foot_numberwith_tl\l_keys_choice_tl},
+ footwith .value_required:n = true,
+ footwith .initial:n = chapter,
- figure-sep .tl_set:N = \l__figure_separator_tl,
- table-sep .tl_set:N = \l__table_separator_tl,
- listing-sep .tl_set:N = \l__lstlisting_separator_tl,
- equation-sep .tl_set:N = \l__equation_separator_tl,
- number-sep .meta:n =
+ figure-sep .tl_set:N = \l__figure_separator_tl,
+ table-sep .tl_set:N = \l__table_separator_tl,
+ listing-sep .tl_set:N = \l__lstlisting_separator_tl,
+ equation-sep .tl_set:N = \l__equation_separator_tl,
+ number-sep .meta:n =
{
figure-sep = {#1},table-sep = {#1},
listing-sep = {#1},equation-sep = {#1}
},
- number-sep .initial:n = {.}
+ number-sep .initial:n = {.}
}
\RequirePackage
@@ -1362,7 +1358,8 @@ The latest version of this license is in
book .code:n = {},
multoc .bool_set:N = \l__multoc_bool,
multoc .default:n = true,
- multoc .initial:n = false
+ multoc .initial:n = false,
+ title .tl_set:N = \toc@title
}
\cs_new_protected:Npn \__title_mark_intoc:n #1
@@ -1408,12 +1405,19 @@ The latest version of this license is in
\fi
}{\tl_set:Nn \l__toc_type_tl{article}}
}
+\cs_new_protected:Npn \__title_ifintoc_set:n #1
+ {
+ \IfBooleanTF{#1}
+ {\__title_mark:n {\toc@title}}
+ {\__title_mark_intoc:n {\toc@title}}
+ }
\RenewDocumentCommand{\tableofcontents}{o}
{
\group_begin:
+ \tl_set_eq:NN \toc@title\contentsname
\IfValueT{#1}{\keys_set:nn {listoc}{#1}}
\__ifmultoc_pre_set:
- \__title_mark:n {\contentsname}
+ \__title_mark:n {\toc@title}
\vspace*{\dim_use:N \l__toc_offset_dim}
\@starttoc{toc}
\__ifmultoc_post_set:
@@ -1422,11 +1426,10 @@ The latest version of this license is in
\RenewDocumentCommand{\listoffigures}{so}
{
\group_begin:
+ \tl_set_eq:NN \toc@title\listfigurename
\IfValueT{#2}{\keys_set:nn {listoc}{#2}}
\__ifmultoc_pre_set:
- \IfBooleanTF{#1}
- {\__title_mark:n {\listfigurename}}
- {\__title_mark_intoc:n {\listfigurename}}
+ \__title_ifintoc_set:n {#1}
\dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim
\vspace*{\dim_use:N \l__toc_offset_dim}
\@starttoc{lof}
@@ -1436,11 +1439,10 @@ The latest version of this license is in
\RenewDocumentCommand{\listoftables}{so}
{
\group_begin:
+ \tl_set_eq:NN \toc@title\listtablename
\IfValueT{#2}{\keys_set:nn {listoc}{#2}}
\__ifmultoc_pre_set:
- \IfBooleanTF{#1}
- {\__title_mark:n {\listtablename}}
- {\__title_mark_intoc:n {\listtablename}}
+ \__title_ifintoc_set:n {#1}
\dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim
\vspace*{\dim_use:N \l__toc_offset_dim}
\@starttoc{lot}
@@ -1450,11 +1452,10 @@ The latest version of this license is in
\NewDocumentCommand{\listoflistings}{so}
{
\group_begin:
+ \tl_set_eq:NN \toc@title\lstlistlistingname
\IfValueT{#2}{\keys_set:nn {listoc}{#2}}
\__ifmultoc_pre_set:
- \IfBooleanTF{#1}
- {\__title_mark:n {\lstlistlistingname}}
- {\__title_mark_intoc:n {\lstlistlistingname}}
+ \__title_ifintoc_set:n {#1}
\dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim
\vspace*{\dim_use:N \l__toc_offset_dim}
\@starttoc{lol}
@@ -2001,14 +2002,10 @@ The latest version of this license is in
\NewDocumentCommand{\printbibliography}{so}
{
\group_begin:
+ \tl_set_eq:NN \toc@title\bibname
\IfValueT{##2}{\keys_set:nn {listoc}{##2}}
\__ifmultoc_pre_set:
- \cs_set:Npn \bibsection
- {
- \IfBooleanTF{##1}
- {\__title_mark:n {\bibname}}
- {\__title_mark_intoc:n {\bibname}}
- }
+ \cs_set:Npn \bibsection{\__title_ifintoc_set:n {##1}}
\exp_args:NV \bibliography\l__bib_file_tl
\__ifmultoc_post_set:
\group_end:
@@ -2235,13 +2232,13 @@ The latest version of this license is in
{
\keys_set_known:nn {ctex}
{
- contentsname = {目\hspace{\ccwd}录},
- indexname = {索\hspace{\ccwd}引},
- listfigurename = {图片索引},
- listtablename = {表格索引},
- abstractname = {摘\hspace{\ccwd}要},
- lstlistlistingname = {代码索引},
- lstlistingname = {代码}
+ contentsname = 目\hspace{\ccwd}录,
+ indexname = 索\hspace{\ccwd}引,
+ listfigurename = 图片索引,
+ listtablename = 表格索引,
+ abstractname = 摘\hspace{\ccwd}要,
+ lstlistlistingname = 代码索引,
+ lstlistingname = 代码
}
\crefformat{equation}{#2式(#1)#3}
\crefformat{align}{#2式(#1)#3}
@@ -2261,9 +2258,9 @@ The latest version of this license is in
}{
\keys_set_known:nn {ctex}
{
- abstractname = {Abstract},
- lstlistlistingname = {List~of~Listings},
- lstlistingname = {Code}
+ abstractname = Abstract,
+ lstlistlistingname = List~of~Listings,
+ lstlistingname = Code
}
\crefformat{equation}{#2Equation~(#1)#3}
\crefformat{align}{#2Equation~(#1)#3}