diff options
author | Norbert Preining <preining@logic.at> | 2021-04-06 22:21:57 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2021-04-06 22:21:57 +0000 |
commit | 1906ed95bf482669e832e9e8a6f3d46ad8ae362f (patch) | |
tree | 90c4457667488fc169e532b006b89a8b3f25af6b /Master/texmf-dist/source/latex | |
parent | fe7a462e9038e451159bab3929c8f9abb6ac5504 (diff) |
easybook (7apr21)
git-svn-id: svn://tug.org/texlive/trunk@58775 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/easybook/easybook.dtx | 121 |
1 files changed, 79 insertions, 42 deletions
diff --git a/Master/texmf-dist/source/latex/easybook/easybook.dtx b/Master/texmf-dist/source/latex/easybook/easybook.dtx index 338c72d9b45..80c214a5277 100644 --- a/Master/texmf-dist/source/latex/easybook/easybook.dtx +++ b/Master/texmf-dist/source/latex/easybook/easybook.dtx @@ -55,7 +55,7 @@ The latest version of this license is in % % \title{\sffamily easybook书籍文档类} % \author{瞿毅} -% \date{2021/04/04\hskip\ccwd\relax v1.24d\thanks{\url{https://gitee.com/texl3/easybook}}} +% \date{2021/04/05\hskip\ccwd\relax v1.24e\thanks{\url{https://gitee.com/texl3/easybook}}} % \maketitle % \begin{abstract} % \cls{easybook} 是基于 \cls{ctexbook} 书籍文档类创建以极简为风格的模板,可以看作对 \cls{ctexbook} 的进一步包装。虽然\CTeX 文档类提供了较好的中文支持,但想实现个性化功能一般需要在其基础上载入更多宏包来定制。\cls{easybook} 考虑了一些细节并载入一些常用宏包实现一般的排版需求,它适用于排版中英文书籍或笔记,甚至可稍加调整成为学位论文模板。 @@ -78,11 +78,7 @@ The latest version of this license is in % xelatex -shell-escape easybook-demo % xelatex -shell-escape easybook-demo % \end{frameverb} -% -% 需注意,正确\textbf{编译索引}需要增加 \opt{-shell-escape} 命令行选项。若不需要索引和参考文献,可以在正文中注释掉命令。若出现以下警告,再编译一次即可。 -% \begin{frameverb} -% LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. -% \end{frameverb} +% 需注意,正确\textbf{编译索引}需要增加 \opt{-shell-escape} 命令行选项。 % % \subsection{字体设置} % \label{subsec:font settings} @@ -172,7 +168,7 @@ The latest version of this license is in % \end{syntax} % \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}{目录命令的可选参数增加标题键值。} +% \changes{v1.24e}{2021/04/04}{目录命令的可选参数增加标题键值。} % \end{function} % % \section{接口选项} @@ -251,14 +247,16 @@ The latest version of this license is in % % \subsection{超链接} % \label{subsec:hyperlinks} -% \begin{function}[EXP,added = 2021-01-05,updated = 2021-01-08]{hyperlink,linkcolor,linktopage} +% \begin{function}[EXP,added = 2021-01-05,updated = 2021-04-05]{hyperlink,linkcolor,linktoc} % \begin{syntax} % hyperlink = <(edge)|various|none> % linkcolor = <(fresh)|cutepink|skyblue|crimson> -% linktopage = <true|(false)> +% linktoc = <none|section|page|(all)> % \end{syntax} -% \ding{229} 以上选项路径为 \opt{link/...} +% \ding{229} 以上选项路径为 \opt{link/...} \\ +% \opt{link} 将超链接选项(包括以上选项)交给 \pkg{hyperref} 处理,除了一些关于 pdf 书签的选项可能会失效,其它由键值选项命令 \tn{hypersetup} 支持的多数选项可用。 % \changes{v1.10}{2021/01/08}{修复了 \opt{linktopage} 选项关闭时目录中标题编号无超链接的问题。} +% \changes{v1.24e}{2021/04/05}{增加 \pkg{hyperref} 超链接选项完整的支持。} % \end{function} % % \begin{optdesc} @@ -271,7 +269,7 @@ The latest version of this license is in % 超链接颜色用到这三个颜色,可以使用 \tn{definecolor} 命令进行更改。 % \changes{v1.10}{2021/01/08}{可以自定义超链接颜色。} % \end{function} -% \item[linktopage] 将目录中的超链接置于页码上,默认是置于标题上。 +% \item[linktoc] 将目录中的超链接取消、置于标题上、置于页码上或置于标题和页码上。 % \end{optdesc} % % \subsection{行距} @@ -410,9 +408,9 @@ The latest version of this license is in % \end{optdesc} % % \subsubsection{新的定理样式} -% 定理由 \pkg{thmtools} 设置,预置定理的样式为 \opt{easythm},上述定理样式选项将对这个定理样式生效。如果使用这个样式而只是增加新的定理名称,可以这样 +% 定理由 \pkg{thmtools} 设置,预置定理的样式为 \opt{easy-thm-sty},上述定理样式选项将对这个定理样式生效。如果使用这个样式而只是增加新的定理名称,可以这样 % \begin{ctexexam} -% \newtheorem[style = easythm,name = 定理名]{定理环境名} +% \newtheorem[style = easy-thm-sty,name = 定理名]{定理环境名} % \end{ctexexam} % 若要给定理环境增加边框,可以如下进行设置 % \begin{ctexexam} @@ -507,13 +505,26 @@ The latest version of this license is in % \changes{v1.21}{2021/01/13}{增加配置目录样式的选项。} % \end{function} % -% \begin{function}[EXP,added = 2021-01-13,updated = 2021-01-15]{lists/lolskip,lists/belowoffset,tocset/belowoffset} +% \begin{function}[EXP,added = 2021-01-13,updated = 2021-04-05]{lists/lolskip,lists/labelname-fig,lists/labelname-tab,lists/labelname-lst,lists/belowoffset,tocset/belowoffset} % \begin{syntax} % lolskip = <(0.8pc)> +% labelname-fig = <图片目录标签> +% labelname-tab = <表格目录标签> +% labelname-lst = <代码目录标签> % belowoffset = <(0pc)> % belowoffset = <(-1pc)> % \end{syntax} -% \opt{lolskip} 是代码目录中章之间的代码标题的距离,与\CTeX 的表格目录和图片目录中章之间的标题距离选项 \opt{lotskip} 和 \opt{lofskip} 类似,它们的值均默认0.8 pc,在 \opt{article} 模式中此选项失效。\opt{belowoffset} 选项为主目录标题 \tn{contentsname} 后的间距补偿,一般为负值,用于抵消 \opt{format} 中设置的垂直间距。\opt{lists} 中的 \opt{belowoffset} 与之意义类似,但是一般为正值,可以在 \opt{article} 模式中使用。建议 \opt{lists/lolskip(0.8pc) + lists/format/addvspace(0.2pc) + lists/belowoffset(0pc) = belowoffset(-1pc)}。 +% \opt{lolskip} 是代码目录中章之间的代码标题的距离,与\CTeX 的表格目录和图片目录中章之间的标题距离选项 \opt{lotskip} 和 \opt{lofskip} 类似,它们的值均默认0.8 pc,在 \opt{article} 模式中此选项失效。目录标签整体使用 \opt{labelname} 设置,也可使用小节 \ref{subsec:page margins} 的 \opt{list-labelsep} 选项只设置编号与标题的间距。在图表标签的参数中,\#1与\#2分别代表编号和标题,代码标签的编号和标题则是 \tn{thelstlisting} 和 \tn{lst@@caption},标签中还可包含标签名称,默认标签名称与图、表和代码环境的标题名称一致。下面举个设置标签的例子 +% \begin{ctexexam} +% \tocset +% { +% lists/labelname-fig = 图#1\hspace{\ccwd}#2 +% lists/labelname-lst = 代码\thelstlisting\hspace{\ccwd}\lst@@caption +% } +% \end{ctexexam} +% +% \opt{belowoffset} 选项为主目录标题 \tn{contentsname} 后的间距补偿,一般为负值,用于抵消 \opt{format} 中设置的垂直间距。\opt{lists} 中的 \opt{belowoffset} 与之意义类似,但是一般为正值,可以在 \opt{article} 模式中使用。建议 \opt{lists/lolskip(0.8pc) + lists/format/addvspace(0.2pc) + lists/belowoffset(0pc) = belowoffset(-1pc)}。 +% \changes{v1.24e}{2021/04/05}{可以设置图、表和代码目录的标签。} % \end{function} % % \begin{function}[added = 2021-01-13,updated = 2021-01-15]{\tocrule} @@ -790,11 +801,12 @@ The latest version of this license is in %<*class> \NeedsTeXFormat{LaTeX2e}[2020/10/01] \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/04/04}{1.24d}{beta} +\ProvidesExplClass{easybook}{2021/04/05}{1.24e}{beta} \cs_generate_variant:Nn \keys_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} \cs_generate_variant:Nn \dim_add:Nn {NV} +\cs_generate_variant:Nn \__put_hyperref:n {x} \cs_new_protected:Npn \__ctex_define:nn #1 {\keys_define:nn {ctex/#1}} \cs_new_protected:Npn \__put_ctexbook:n #1 @@ -869,6 +881,7 @@ The latest version of this license is in {hang,stable}{footmisc}, {normalem}{ulem}, {protrusion = false}{microtype}, + {list = off}{bicaption}, {shortlabels,inline}{enumitem}, {many}{tcolorbox}, {xindy}{imakeidx}, @@ -1242,12 +1255,25 @@ The latest version of this license is in } \__ctex_define:nn {tocset} { - lists/lolskip .skip_set:N = \l__toc_lolskip_skip, - lists/lolskip .initial:n = 0.8pc, - lists/belowoffset .dim_set:N = \l__toc_listsoffset_dim, - lists/belowoffset .initial:n = 0pc, - belowoffset .dim_set:N = \l__toc_offset_dim, - belowoffset .initial:n = -1pc + lists/lolskip .skip_set:N = \l__toc_lolskip_skip, + lists/lolskip .initial:n = 0.8pc, + lists/belowoffset .dim_set:N = \l__toc_listsoffset_dim, + lists/belowoffset .initial:n = 0pc, + lists/labelname-fig .cs_set:Np = \labelname@lof#1#2, + lists/labelname-fig .initial:n = + {\figurename\space#1\hspace{\list@labelsep}#2}, + lists/labelname-tab .cs_set:Np = \labelname@lot#1#2, + lists/labelname-tab .initial:n = + {\tablename\space#1\hspace{\list@labelsep}#2}, + lists/labelname-lst .tl_set:N = \labelname@lol, + lists/labelname-lst .initial:n = + { + \lstlistingname\space + \thelstlisting\hspace{\list@labelsep} + \lst@@caption + }, + belowoffset .dim_set:N = \l__toc_offset_dim, + belowoffset .initial:n = -1pc } \ctex_set:nn {tocset} { @@ -1295,17 +1321,22 @@ The latest version of this license is in {table}{lists}, {lstlisting}{lists} }{\__titlecontents_set:nn #1} -\ctex_patch_cmd:Nnn \caption@@@addcontentsline - {\addcontentsline{#1}{#2}{\protect\numberline{#3}{#4}}} - {\addcontentsline{#1}{#2}{#3\hspace{\list@labelsep}#4}} +\prop_new:N \l_label_name_prop +\prop_set_from_keyval:Nn \l_label_name_prop + { + figure = \labelname@lof, + table = \labelname@lot + } +\cs_gset:Npn \caption@@@addcontentsline#1#2#3#4 + { + \addcontentsline{#1}{#2} + {\prop_item:Nn \l_label_name_prop{#2}{#3}{#4}} + } \ctex_patch_cmd:Nnn \lst@MakeCaption { \addcontentsline{lol}{lstlisting} {\protect\numberline{\thelstlisting}\lst@@caption} - }{ - \addcontentsline{lol}{lstlisting} - {\thelstlisting\hspace{\list@labelsep}\lst@@caption} - } + }{\addcontentsline{lol}{lstlisting}{\labelname@lol}} \__appto_cmd:Nn \@chapter { \skip_if_eq:nnF {\l__toc_lolskip_skip}{\c_zero_skip} @@ -1729,25 +1760,25 @@ The latest version of this license is in postheadspace = \l__thm_spacepost_tl, within = \l__thm_numberwith_tl, headformat = \NAME\space\NUMBER\NOTE - ]{easythm} + ]{easy-thm-sty} \clist_map_inline:nn { example,definition,theorem, proposition,lemma,corollary }{ \declaretheorem[ - style = easythm, + style = easy-thm-sty, name = \use:c {c__name_#1_tl} ]{#1} } \cs_gset_eq:NN \proof\relax \declaretheorem[ - style = easythm, + style = easy-thm-sty, name = \c__name_remark_tl, numbered = no ]{remark} \declaretheorem[ - style = easythm, + style = easy-thm-sty, name = \proofname, numbered = no, qed = \qedsymbol @@ -1993,9 +2024,7 @@ The latest version of this license is in \tl_if_eq:VnT \l__bib_style_tl{authoryear} {\bibliographystyle{gbt7714-author-year}} \cs_set_eq:NN \cite\citep - }{ - \exp_args:NV \bibliographystyle\l__bib_otherstyle_tl - } + }{\exp_args:NV \bibliographystyle\l__bib_otherstyle_tl} \tl_if_empty:NF \l__bib_citestyle_tl {\exp_args:NV \setcitestyle\l__bib_citestyle_tl} \skip_set:Nn \bibsep{0ex} @@ -2200,11 +2229,19 @@ The latest version of this license is in linkcolor .default:n = fresh, linkcolor .initial:n = fresh, - linktopage .choice:, - linktopage/true .code:n = \__put_hyperref:n {linktocpage}, - linktopage/false .code:n = {}, - linktopage .default:n = true, - linktopage .initial:n = false + linktoc .choice:, + linktoc/unknown .code:n = \__put_hyperref:n {linktoc = \exp_not:n {#1}}, + linktoc .default:n = all, + linktoc .initial:n = all, + unknown .code:n = + { + \__put_hyperref:x + { + \exp_not:N \l_keys_key_str + \exp_not:N \tl_if_empty:NF + \exp_not:N \l_keys_value_tl{ = \exp_not:n {#1}} + } + } } \keys_define:nx {ctex/style} { @@ -2226,7 +2263,7 @@ The latest version of this license is in \RequirePackage{hyperref,cleveref} \urlstyle{same} \__allow_urlbreak: - \ctex_hypersetup:n {pdfstartview = FitH,bookmarksnumbered} + \ctex_hypersetup:n {pdfstartview = FitH} \exp_args:NV \hypersetup\l__hyperref_clist \bool_if:NTF \l__lang_chinese_bool { |