diff options
Diffstat (limited to 'macros/latex/contrib/easybook')
-rw-r--r-- | macros/latex/contrib/easybook/doc/easybook-demo.pdf | bin | 287471 -> 287389 bytes | |||
-rw-r--r-- | macros/latex/contrib/easybook/doc/easybook-demo.tex | 18 | ||||
-rw-r--r-- | macros/latex/contrib/easybook/doc/easybook.pdf | bin | 245151 -> 254087 bytes | |||
-rw-r--r-- | macros/latex/contrib/easybook/doc/easybook.tex | 97 | ||||
-rw-r--r-- | macros/latex/contrib/easybook/easybook.cls | 161 |
5 files changed, 209 insertions, 67 deletions
diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.pdf b/macros/latex/contrib/easybook/doc/easybook-demo.pdf Binary files differindex 0217ebec00..8fbd749d60 100644 --- a/macros/latex/contrib/easybook/doc/easybook-demo.pdf +++ b/macros/latex/contrib/easybook/doc/easybook-demo.pdf diff --git a/macros/latex/contrib/easybook/doc/easybook-demo.tex b/macros/latex/contrib/easybook/doc/easybook-demo.tex index 9ad0b579c1..2babe3b6b1 100644 --- a/macros/latex/contrib/easybook/doc/easybook-demo.tex +++ b/macros/latex/contrib/easybook/doc/easybook-demo.tex @@ -10,14 +10,14 @@ style = { color = seaside, - % capdash = true, % multoc = true, % withpart = true, % perpart = true, perpage = true, % notomath = false, rulewidth = 0.75pt, - % uppercase = false + % uppercase = false, + number-sep = {.} }, link = { @@ -33,7 +33,7 @@ caption = 1, footnote = 1 }, - elfont = + elsefont = { table-cap = \sffamily\zihao{5}, figure-cap = \sffamily\zihao{5}, @@ -97,11 +97,11 @@ \url{https://latexstudio.net} \\ \url{https://gitee.com/texl3/easybook}\thanks{Gitee为项目的主要发布地址。} } -\date{2021/03/14\hskip\ccwd\relax v1.23q} +\date{2021/03/15\hskip\ccwd\relax v1.23r} \frontmatter[roman] \maketitle -\tableofcontents +\tableofcontents[book,multoc = false] \mainmatter* \part{使用示例} @@ -111,9 +111,9 @@ \include{appendix} \backmatter -\printbibliography -\listoffigures -\listoftables -\listoflistings +\printbibliography[book,multoc = false] +\listoffigures[book,multoc = false] +\listoftables[book,multoc = false] +\listoflistings[book,multoc = false] \printindex \end{document}
\ No newline at end of file diff --git a/macros/latex/contrib/easybook/doc/easybook.pdf b/macros/latex/contrib/easybook/doc/easybook.pdf Binary files differindex 25192edcd6..6a2c1e0cd2 100644 --- a/macros/latex/contrib/easybook/doc/easybook.pdf +++ b/macros/latex/contrib/easybook/doc/easybook.pdf diff --git a/macros/latex/contrib/easybook/doc/easybook.tex b/macros/latex/contrib/easybook/doc/easybook.tex index b8b375c333..7d5f6e30e2 100644 --- a/macros/latex/contrib/easybook/doc/easybook.tex +++ b/macros/latex/contrib/easybook/doc/easybook.tex @@ -2,7 +2,7 @@ \title{\sffamily easybook书籍文档类} \author{瞿毅} -\date{2021/03/14\hskip\ccwd\relax v1.23q\thanks{\url{https://gitee.com/texl3/easybook}}} +\date{2021/03/15\hskip\ccwd\relax v1.23r\thanks{\url{https://gitee.com/texl3/easybook}}} \begin{document} \maketitle @@ -92,13 +92,27 @@ \end{function} \subsection{文档命令} -\begin{function}[added = 2021-02-20]{\frontmatter,\mainmatter,\backmatter,\listoffigures,\listoftables,\listoflistings} +\label{document command} +\begin{function}[added = 2021-02-20,updated = 2021-03-15]{\frontmatter,\mainmatter,\backmatter,\tableofcontents,\listoffigures,\listoftables,\listoflistings} \begin{syntax} - \tn{frontmatter}\oarg{编号格式|(Roman)} - \tn{printindex}\oarg{索引名} + \tn{frontmatter*}\oarg{编号格式|(Roman)} + \tn{mainmatter*} + \tn{backmatter} + \tn{tableofcontents*}\oarg{键值列表} + \tn{listoffigures*}\oarg{键值列表} + \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} 命令输出代码目录。 -\changes{v1.23q}{2021/02/20}{重新定义文档结构划分命令。} +\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.23r}{2021/02/20}{重新定义文档结构划分命令。} +\end{function} + +\begin{function}{multoc,book,article} +\begin{syntax} + multoc = <true|(false)> +\end{syntax} +\opt{multoc} 与 \opt{style/multoc} 选项具有相同的效果,但是具有优先性且可单独设置不同目录是否双栏排版。\opt{book} 选项使目录按照 \opt{chapter} 级别输出,\opt{article} 选项使目录按照 \opt{article} 级别输出,默认为 \opt{chapter} 级别。 +\changes{v1.23r}{2021/03/15}{为几个目录增加键值列表的选项,可设置输出级别以及是否加入主目录。} \end{function} \section{接口选项} @@ -118,10 +132,10 @@ \end{function} \subsection{风格} -\begin{function}[EXP,added = 2021-01-05,updated = 2021-02-27]{style/color,style/capdash,style/multoc,style/withpart,style/perpart,style/perpage,style/notomath,style/rulewidth,style/uppercase} +\begin{function}[EXP,added = 2021-01-05,updated = 2021-03-15]{style/...,color,multoc,withpart,perpart,perpage,notomath,rulewidth,uppercase,figure-sep,table-sep,listing-sep,equation-sep,number-sep} \begin{syntax} + 以下选项路径为 \tn{ctexset}\marg{style/...} color = <(none)|seaside|energy|cyberpunk> - capdash = <true|(false)> multoc = <true|(false)> withpart = <true|(false)> perpart = <true|(false)> @@ -129,11 +143,16 @@ notomath = <(true)|false> rulewidth = <(0.75pt)> uppercase = <(true)|false> + figure-sep = <(.)> + table-sep = <(.)> + listing-sep = <(.)> + equation-sep = <(.)> + number-sep = <(.)> \end{syntax} -\opt{style} 选项控制文章的风格。 \changes{v1.10}{2021/01/08}{更改颜色实现方式与选项名。} -\changes{v1.23q}{2021/02/02}{noto风格的数学字体独立出来,可自定义设置。} -\changes{v1.23q}{2021/02/09}{增加控制页面横线粗细的选项。} +\changes{v1.23r}{2021/02/02}{noto风格的数学字体独立出来,可自定义设置。} +\changes{v1.23r}{2021/02/09}{增加控制页面横线粗细的选项。} +\changes{v1.23r}{2021/03/15}{增加控制编号连接符的选项。} \end{function} \begin{optdesc} @@ -145,7 +164,6 @@ 主题颜色用到这三个颜色,可以使用 \tn{definecolor} 命令进行更改,类似地更改超链接颜色见小节 \ref{hyperlinks}。 \changes{v1.10}{2021/01/08}{可以自定义主题颜色。} \end{function} - \item[capdash] 将图表代码标题风格由例如\textbf{图1.1}变为\textbf{图1\textendash 1}的形式。 \item[multoc] 开启双栏目录,可与 \opt{onecolumn} 和 \opt{twocolumn} 选项配合出单栏正文、单栏目录,双栏正文、单栏目录,单栏正文、双栏目录和双栏正文、双栏目录四种方式 。 \item[withpart] 使章跟随每一部分编号,默认不跟随。 \item[perpart] 使脚注跟随每一部分编号,默认不跟随。 @@ -153,12 +171,18 @@ \item[notomath] 使用 \opt{noto} 风格的数学字体,将会加载 \pkg{newtxmath} 宏包。 \item[rulewidth] 调整页眉、定理盒子以及代码框线条的粗细。 \item[uppercase] 使用 \tn{rightmark} 及 \tn{leftmark} 获取标题内容设置页眉页脚时英文是否大小写。 + \item[figure-sep] 图片标题编号的连接符。 + \item[table-sep] 表格标题编号的连接符。 + \item[listing-sep] 代码标题编号的连接符。 + \item[equation-sep] 公式编号的连接符。 + \item[number-sep] 统一设置所有编号的连接符。 \end{optdesc} \subsection{超链接} \label{hyperlinks} -\begin{function}[EXP,added = 2021-01-05,updated = 2021-01-08]{link/hyperlink,link/linkcolor,link/linktopage} +\begin{function}[EXP,added = 2021-01-05,updated = 2021-01-08]{link/...,hyperlink,linkcolor,linktopage} \begin{syntax} + 以下选项路径为 \tn{ctexset}\marg{link/...} hyperlink = <(edge)|various|none> linkcolor = <(fresh)|cutepink|skyblue|crimson> linktopage = <true|(false)> @@ -180,17 +204,18 @@ \end{optdesc} \subsection{行距} -\begin{function}[EXP,added = 2021-01-05,updated = 2021-02-13]{spread/line,spread/table,spread/math,spread/caption,spread/footnote} +\begin{function}[EXP,added = 2021-01-05,updated = 2021-02-13]{spread/...,line,table,math,caption,footnote} \begin{syntax} + 以下选项路径为 \tn{ctexset}\marg{link/...} line = <(1.3)> table = <(1.05)> math = <(1.05)> caption = <(1)> footnote = <(1)> \end{syntax} -行距因子用于设置各种行距倍数,只能是浮点数,不能带有长度单位。\tn{ctexset} 原有的行距选项\opt{linespread}失效。各行距既可在导言区全局设置也可正文中设置对后面生效,行距的意义为 +行距因子用于设置各种行距倍数,只能是浮点数,不能带有长度单位。\tn{ctexset} 原有的行距选项 \opt{linespread} 失效。各行距既可在导言区全局设置也可正文中设置对后面生效,行距的意义为 \changes{v1.21}{2021/01/12}{增加脚注线间的距离选项。} -\changes{v1.23q}{2021/02/09}{取消使用 \pkg{zhlineskip} 宏包设置数学间距。} +\changes{v1.23r}{2021/02/09}{取消使用 \pkg{zhlineskip} 宏包设置数学间距。} \end{function} \begin{optdesc} @@ -202,8 +227,9 @@ \end{optdesc} \subsection{其它字体} -\begin{function}[EXP,added = 2021-01-08,updated = 2021-02-13]{elfont/table-cap,elfont/figure-cap,elfont/listing-cap,elfont/footnote,elfont/marginpart} +\begin{function}[EXP,added = 2021-01-08,updated = 2021-02-13]{elsefont/...,table-cap,figure-cap,listing-cap,footnote,marginpart} \begin{syntax} + 以下选项路径为 \tn{ctexset}\marg{elsefont/...} table-cap = <\tn{sffamily}\tn{small}> figure-cap = <\tn{sffamily}\tn{small}> listing-cap = <\tn{sffamily}\tn{small}> @@ -211,7 +237,7 @@ marginpart = <\tn{rmfamily}\tn{footnotesize}> \end{syntax} \changes{v1.10}{2021/01/08}{加入自定义非正文字体选项。} -\changes{v1.23q}{2021/02/08}{修复使用 \tn{zihao} 命令设置字体失效的问题。} +\changes{v1.23r}{2021/02/08}{修复使用 \tn{zihao} 命令设置字体失效的问题。} \end{function} \begin{optdesc} @@ -223,8 +249,9 @@ \end{optdesc} \subsection{参考文献} -\begin{function}[EXP,added = 2021-01-11,updated = 2021-03-08]{bibset/backend,bibset/bib-style,bibset/cite-style,bibset/bibfile,\printbibliography} +\begin{function}[EXP,added = 2021-01-11,updated = 2021-03-15]{bibset/...,backend,bib-style,cite-style,bibfile,\printbibliography} \begin{syntax} + 以下选项路径为 \tn{ctexset}\marg{bibset/...} backend = <(bibtex)|biblatex> bib-style = <(numerical)|authoryear|其它格式> cite-style = <标注风格> @@ -232,7 +259,7 @@ \tn{printbibliography}\oarg{键值列表} \end{syntax} \changes{v1.21}{2021/01/11}{增加 \opt{bibset} 选项,可以使用 \hologo{BibTeX} 或 \hologo{biber} 编译参考文献。} -\changes{v1.23q}{2021/02/23}{使用 \opt{bibset} 选项时可设置标注风格。} +\changes{v1.23r}{2021/02/23}{使用 \opt{bibset} 选项时可设置标注风格。} \end{function} \begin{optdesc} @@ -240,12 +267,20 @@ \item[bib-style] 参考文献格式为中国的参考文献推荐标准GB/T 7714-2015,有顺序编码制和著者-出版年制两种风格,理工科类一般使用顺序编码制,文科类一般使用著者-出版年制。若使用其它格式,使用 \hologo{BibTeX} 处理时需确保正确的 \opt{bst} 文件,使用 \hologo{biber} 处理可使用 \pkg{biblatex} 宏包支持的参考文献风格名称。 \item[cite-style] 标注参考文献的风格,\opt{backend = bibtex} 选项下可使用 \opt{super}(数字上标标注,默认)或 \opt{numbers}(数字标注)等 \pkg{natbib} 宏包带有的标注风格,\opt{backend = biblatex} 选项下可使用 \pkg{biblatex} 宏包支持的标注风格名称。 \item[bibfile] 参考文献的数据文件,使用 \hologo{biber} 处理时要带有 \opt{bib} 后缀,默认为一个以 \opt{refs.bib} 命名的文件。 - \item[\tn{printbibliography}] 两种方式\textbf{均使用}此命令打印参考文献,其中可选项仅在 \hologo{biber} 处理时有效。 + \item[\tn{printbibliography}] 两种方式\textbf{均使用}此命令打印参考文献,不同处理后端此命令的键值列表不同。使用 \hologo{BibTeX} 处理时选项与小节 \ref{document command} 目录的选项相同,使用 \hologo{biber} 处理时常用的选项如下 + \begin{function}{heading,title} + \begin{syntax} + heading = <bibliography|subbibliography|(bibintoc)|subbibintoc> + title = <参考文献标题名> + \end{syntax} + \opt{heading} 为参考文献标题的处理方式,\opt{bibliography} 选项以 \opt{chapter} 级别输出参考文献,不加进目录,\opt{subbibliography} 选项以 \opt{section} 级别输出参考文献,不加进目录,\opt{bibintoc} 选项以 \opt{chapter} 级别输出参考文献,加进目录,\opt{subbibintoc} 选项以 \opt{section} 级别输出参考文献,加进目录。\opt{title} 选项覆盖由 \opt{heading} 选项提供的缺省标题名。除此之外其他支持选项可见 \pkg{biblatex} 宏包说明文档。 + \end{function} \end{optdesc} \subsection{定理样式} -\begin{function}[EXP,added = 2021-01-12,updated = 2021-03-13]{thmset/thmbox,thmset/numberwith,thmset/headpunct,thmset/bodyfont,thmset/notefont,thmset/headfont,thmset/headindent,thmset/spaceabove,thmset/spacebelow,thmset/spacepost,\newtheorem, \declaretheoremstyle} +\begin{function}[EXP,added = 2021-01-12,updated = 2021-03-13]{thmset/...,thmbox,numberwith,headpunct,bodyfont,notefont,headfont,headindent,spaceabove,spacebelow,spacepost,\newtheorem, \declaretheoremstyle} \begin{syntax} + 以下选项路径为 \tn{ctexset}\marg{thmset/...} thmbox = <true|(false)> numberwith = <(chapter)|section|其它环境|空置> headpunct = <(未设置)> @@ -260,7 +295,7 @@ \tn{declaretheoremstyle}\oarg{键值列表}\marg{定理样式名} \end{syntax} \changes{v1.21}{2021/01/12}{增加配置定理环境样式的选项。} -\changes{v1.23q}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。} +\changes{v1.23r}{2021/03/12}{重新定义了新定理环境命令 \tn{newtheorem}。} \end{function} \begin{optdesc} @@ -299,8 +334,9 @@ \end{ctexexam} \subsection{页面边距} -\begin{function}[EXP,added = 2021-01-13]{geoset/left,geoset/top,geoset/hmargin,geoset/textwidth,geoset/includehead,...} +\begin{function}[EXP,added = 2021-01-13]{geoset/...,left,top,hmargin,textwidth,includehead,...} \begin{syntax} + 以下选项路径为 \tn{ctexset}\marg{geoset/...} left = <长度> top = <长度> hmargin = \marg{左边距,右边距} @@ -324,8 +360,9 @@ \end{function} \subsection{页眉页脚} -\begin{function}[EXP,added = 2021-01-13,updated = 2021-03-14]{hdrset/head-foot,hdrset/chap-mark,hdrset/sec-mark,hdrset/headrule,hdrset/footrule,hdrset/footnoterule,\easyhead,\easyfoot,...} +\begin{function}[EXP,added = 2021-01-13,updated = 2021-03-14]{hdrset/...,head-foot,chap-mark,sec-mark,headrule,footrule,footnoterule,\easyhead,\easyfoot,...} \begin{syntax} + 以下选项路径为 \tn{ctexset}\marg{hdrset/...} head-foot = <页眉页脚中的内容> chap-mark = <\tn{chaptermark} 标志命令 \tn{markboth} 中的内容> sec-mark = <\tn{sectionmark} 标志命令 \tn{markright} 中的内容> @@ -356,8 +393,8 @@ \end{ctexexam} \changes{v1.21}{2021/01/11}{修复单面文档时页眉横线消失的问题。} \changes{v1.21}{2021/01/13}{增加配置页眉页脚的选项。} -\changes{v1.23q}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 选项。} -\changes{v1.23q}{2021/03/14}{可以手动绘制页眉、页脚和脚注的横线。} +\changes{v1.23r}{2021/03/08}{优化页眉页脚设置,增加 \opt{chap-mark} 和 \opt{sec-mark} 选项。} +\changes{v1.23r}{2021/03/14}{可以手动绘制页眉、页脚和脚注的横线。} \end{function} \subsection{目录样式} @@ -471,7 +508,7 @@ \item 习题内容 \end{exercise} \end{ctexexam} -\changes{v1.23q}{2021/02/08}{增加准确的习题盒子标题目录锚点。} +\changes{v1.23r}{2021/02/08}{增加准确的习题盒子标题目录锚点。} \end{function} \subsection{盒子} @@ -521,6 +558,10 @@ \section{其它用法} +\subsection{article 风格} +当最高级别的标题命令使用 \tn{section} 而不使用 \tn{chapter} 时,会自动转变为 \opt{article} 风格,与 \cls{article} 文档类的特性相似,可用于短篇幅的文章,此时输出目录时需要配合 \opt{article} 选项使目录以 \opt{section} 级别输出,详情见小节 \ref{document command}。 +\changes{v1.23r}{2021/03/15}{增加 article 文章风格,可用于短篇幅的文章。} + \subsection{代码} \begin{function}[added = 2021-01-05]{\lstinline,lstlisting,\listoflistings} \begin{syntax} diff --git a/macros/latex/contrib/easybook/easybook.cls b/macros/latex/contrib/easybook/easybook.cls index cfb30bc1ca..4d3c1759ca 100644 --- a/macros/latex/contrib/easybook/easybook.cls +++ b/macros/latex/contrib/easybook/easybook.cls @@ -9,7 +9,7 @@ %% https://creativecommons.org/licenses/by/4.0/legalcode \NeedsTeXFormat{LaTeX2e} \RequirePackage{l3keys2e} -\ProvidesExplClass{easybook}{2021/03/14}{1.23q}{} +\ProvidesExplClass{easybook}{2021/03/15}{1.23r}{} \cs_generate_variant:Nn \keys_define:nn {nx} \cs_generate_variant:Nn \int_to_arabic:n {v} @@ -93,7 +93,6 @@ \__put_ctexbook:n {\g__options_clist} \LoadClass[UTF8]{ctexbook} -\bool_new:N \l__capdash_bool \bool_new:N \l__multoc_bool \bool_new:N \l__chap_withpart_bool \bool_new:N \l__foot_perpart_bool @@ -107,7 +106,7 @@ style .meta:nn = {ctex/style}{#1}, link .meta:nn = {ctex/link}{#1}, spread .meta:nn = {ctex/spread}{#1}, - elfont .meta:nn = {ctex/elfont}{#1}, + elsefont .meta:nn = {ctex/elsefont}{#1}, bibset .meta:nn = {ctex/bibset}{#1}, thmset .meta:nn = {ctex/thmset}{#1}, geoset .meta:nn = {ctex/geoset}{#1}, @@ -119,12 +118,8 @@ } \__ctex_define:nn {style} { - capdash .bool_set:N = \l__capdash_bool, - capdash .default:n = true, - capdash .initial:n = false, multoc .bool_set:N = \l__multoc_bool, multoc .default:n = true, - multoc .initial:n = false, withpart .bool_set:N = \l__chap_withpart_bool, withpart .default:n = true, withpart .initial:n = false, @@ -141,7 +136,17 @@ rulewidth .initial:n = 0.75pt, uppercase .bool_set:N = \l__uppercase_bool, uppercase .default:n = true, - uppercase .initial:n = true + uppercase .initial:n = true, + 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 = {.} } \RequirePackage @@ -531,19 +536,40 @@ }{} } } + +\tl_set:Nn \l__toc_type_tl{book} +\keys_define:nn {listoc} + { + article .code:n = \tl_set:Nn \l__toc_type_tl{article}, + book .code:n = {}, + multoc .bool_set:N = \l__multoc_bool, + multoc .default:n = true, + multoc .initial:n = false + } + \cs_new_protected:Npn \__title_mark_intoc:n #1 { - \chapter*{\phantomsection#1} - \CTEX@addtocline{chapter}{#1} + \tl_if_eq:NnTF \l__toc_type_tl{book} + { + \chapter*{\phantomsection#1} + \CTEX@addtocline{chapter}{#1} + }{ + \section*{\phantomsection#1} + \CTEX@addtocline{section}{#1} + } \__markboth:n {#1} } \cs_new_protected:Npn \__title_mark:n #1 { - \chapter*{\phantomsection#1} + \tl_if_eq:NnTF \l__toc_type_tl{book} + {\chapter*{\phantomsection#1}} + {\section*{\phantomsection#1}} \__markboth:n {#1} } -\cs_gset:Npn \tableofcontents +\RenewDocumentCommand{\tableofcontents}{o} { + \group_begin: + \IfValueT {#1}{\keys_set:nn {listoc}{#1}} \if@twocolumn \@restonecoltrue\onecolumn \bool_if:NT \l__multoc_bool{\twocolumn} @@ -559,9 +585,12 @@ \else \onecolumn \fi + \group_end: } -\cs_gset:Npn \listoffigures +\RenewDocumentCommand{\listoffigures}{so} { + \group_begin: + \IfValueT {#2}{\keys_set:nn {listoc}{#2}} \if@twocolumn \@restonecoltrue\onecolumn \bool_if:NT \l__multoc_bool{\twocolumn} @@ -569,7 +598,9 @@ \@restonecolfalse \bool_if:NT \l__multoc_bool{\twocolumn} \fi - \__title_mark_intoc:n {\listfigurename} + \IfBooleanTF {#1} + {\__title_mark:n {\listfigurename}} + {\__title_mark_intoc:n {\listfigurename}} \dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim \vspace*{\dim_use:N \l__toc_offset_dim} \@starttoc{lof} @@ -578,9 +609,12 @@ \else \onecolumn \fi + \group_end: } -\cs_gset:Npn \listoftables +\RenewDocumentCommand{\listoftables}{so} { + \group_begin: + \IfValueT {#2}{\keys_set:nn {listoc}{#2}} \if@twocolumn \@restonecoltrue\onecolumn \bool_if:NT \l__multoc_bool{\twocolumn} @@ -588,7 +622,9 @@ \@restonecolfalse \bool_if:NT \l__multoc_bool{\twocolumn} \fi - \__title_mark_intoc:n {\listtablename} + \IfBooleanTF {#1} + {\__title_mark:n {\listtablename}} + {\__title_mark_intoc:n {\listtablename}} \dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim \vspace*{\dim_use:N \l__toc_offset_dim} \@starttoc{lot} @@ -597,9 +633,12 @@ \else \onecolumn \fi + \group_end: } -\cs_new:Npn \listoflistings +\NewDocumentCommand{\listoflistings}{so} { + \group_begin: + \IfValueT {#2}{\keys_set:nn {listoc}{#2}} \if@twocolumn \@restonecoltrue\onecolumn \bool_if:NT \l__multoc_bool{\twocolumn} @@ -607,7 +646,9 @@ \@restonecolfalse \bool_if:NT \l__multoc_bool{\twocolumn} \fi - \__title_mark_intoc:n {\lstlistlistingname} + \IfBooleanTF {#1} + {\__title_mark:n {\lstlistlistingname}} + {\__title_mark_intoc:n {\lstlistlistingname}} \dim_add:NV \l__toc_offset_dim\l__toc_listsoffset_dim \vspace*{\dim_use:N \l__toc_offset_dim} \@starttoc{lol} @@ -616,6 +657,7 @@ \else \onecolumn \fi + \group_end: } \makeindex[ @@ -627,9 +669,9 @@ ] \indexsetup { - level = \chapter*, - toclevel = chapter, - firstpagestyle = plain + level = \int_compare:nTF {\c@chapter > 0}{\chapter*}{\section*}, + toclevel = \int_compare:nTF {\c@chapter > 0}{chapter}{section}, + firstpagestyle = \int_compare:nTF {\c@chapter > 0}{plain}{fancy} } \__patch_cmd:Nnn \imki@indexheaders {\@mkboth{\MakeUppercase\indexname}{\MakeUppercase\indexname}} @@ -640,7 +682,7 @@ \tl_new:N \l__font_listing_tl \tl_new:N \l__font_footnote_tl -\__ctex_define:nn {elfont} +\__ctex_define:nn {elsefont} { table-cap .tl_set:N = \l__font_table_tl, table-cap .initial:n = \sffamily\small, @@ -684,11 +726,47 @@ \cs_new:Npn \__arabic:n #1{\int_to_arabic:v {c@#1}} \AtBeginDocument { - \bool_if:NT \l__capdash_bool + \cs_new_protected:Npn \__separator_set:n #1 { - \cs_gset:Npn \thefigure{\thechapter\textendash\__arabic:n {figure}} - \cs_gset:Npn \thetable{\thechapter\textendash\__arabic:n {table}} - \cs_gset:Npn \thelstlisting{\thechapter\textendash\__arabic:n {lstlisting}} + \cs_set:cpn {the#1} + { + \int_compare:nT {\c@chapter > 0} + { + \thechapter + \use:c {l__#1_separator_tl} + } + \__arabic:n {#1} + } + } + \cs_gset:cpn {thesection} + { + \int_compare:nT {\c@chapter > 0}{\thechapter.} + \__arabic:n {section} + } + \clist_map_inline:nn + {{figure},{table},{lstlisting},{equation}} + {\__separator_set:n {#1}} + \cs_gset_protected:Npn \appendix + { + \int_compare:nNnTF {\c@chapter} > {0} + { + \setcounter{chapter}{0} + \setcounter{section}{0} + \gdef\thechapter{\@Alph\c@chapter} + \gdef\CTEX@prechapter{\CTEX@preappendix} + \gdef\CTEX@thechapter{\CTEX@appendix@number} + \gdef\CTEX@postchapter{\CTEX@postappendix} + \gdef\CTEX@chapter@numbering{\CTEX@appendix@numbering} + }{ + \setcounter{section}{0} + \setcounter{subsection}{0} + \gdef\thesection{\@Alph\c@section} + \gdef\CTEX@presection{\CTEX@preappendix} + \gdef\CTEX@thesection{\CTEX@appendix@number} + \gdef\CTEX@postsection{\CTEX@postappendix} + \gdef\CTEX@section@numbering{\CTEX@appendix@numbering} + \ctex_set:nn {appendix}{number = {\@Alph\c@section},name = {}} + } } } \AtBeginEnvironment{tabularx} @@ -1094,10 +1172,32 @@ } \tl_if_empty:NF \l__bib_citestyle_tl {\exp_args:NV \setcitestyle\l__bib_citestyle_tl} - \cs_set:Npn \bibsection{\__title_mark_intoc:n \bibname} \skip_set:Nn \bibsep{0ex} - \NewDocumentCommand{\printbibliography}{o} - {\exp_args:NV \bibliography\l__bib_file_tl} + \NewDocumentCommand{\printbibliography}{so} + { + \group_begin: + \IfValueT {##2}{\keys_set:nn {listoc}{##2}} + \if@twocolumn + \@restonecoltrue\onecolumn + \bool_if:NT \l__multoc_bool{\twocolumn} + \else + \@restonecolfalse + \bool_if:NT \l__multoc_bool{\twocolumn} + \fi + \cs_set:Npn \bibsection + { + \IfBooleanTF {##1} + {\__title_mark:n {\bibname}} + {\__title_mark_intoc:n {\bibname}} + } + \exp_args:NV \bibliography\l__bib_file_tl + \if@restonecol + \twocolumn + \else + \onecolumn + \fi + \group_end: + } } \cs_new_protected:Npn \__put_biblatex:n #1 {\PassOptionsToPackage{#1}{biblatex}} @@ -1119,7 +1219,8 @@ \cs_new_protected:Npn \__biblatex_after_set: { \exp_args:NV \addbibresource\l__bib_file_tl - \defbibheading{bibliography}[\bibname]{\__title_mark_intoc:n {##1}} + \cs_gset:Npn \blx@default@theheading{bibintoc} + \defbibheading{bibintoc}[\bibname]{\__title_mark_intoc:n {##1}} \skip_set:Nn \bibitemsep{0ex} } \ctex_at_end_preamble:n |