From 5fd39aa8867152c78c0dd8676a185880b9a797b6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 27 Aug 2016 22:15:39 +0000 Subject: ctex (27aug16) git-svn-id: svn://tug.org/texlive/trunk@41937 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/source/latex/ctex/ctex.dtx | 806 ++++++++++++++++++++------- 1 file changed, 607 insertions(+), 199 deletions(-) (limited to 'Master/texmf-dist/source/latex/ctex') diff --git a/Master/texmf-dist/source/latex/ctex/ctex.dtx b/Master/texmf-dist/source/latex/ctex/ctex.dtx index ca15d4b916f..b1d710ff91b 100644 --- a/Master/texmf-dist/source/latex/ctex/ctex.dtx +++ b/Master/texmf-dist/source/latex/ctex/ctex.dtx @@ -413,7 +413,7 @@ Copyright and Licence %<*!(c19|c70|ctexspa|dict)> %\NeedsTeXFormat{LaTeX2e} %\RequirePackage{expl3} -%<+!driver>\GetIdInfo$Id$ +%<+!driver>\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee $ % {ctex documentation (CTEX)} %\ProvidesExplClass{ctxdoc} % {Chinese adapter in LaTeX (CTEX)} @@ -502,7 +502,7 @@ Copyright and Licence %\ProvidesExplFile{ctex-fontset-founder.def} % {Ubuntu fonts definition (CTEX)} %\ProvidesExplFile{ctex-fontset-ubuntu.def} -% {\ExplFileDate}{2.4.2}{\ExplFileDescription} +% {\ExplFileDate}{2.4.3}{\ExplFileDescription} % %\ProvidesFile{c19rm.fd}% %\ProvidesFile{c19sf.fd}% @@ -513,9 +513,9 @@ Copyright and Licence %\ProvidesFile{ctexspa.def}% %\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}% %\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}% -% [2016/05/16 v2.4.2 Chinese font definition (CTEX)] -% [2016/05/16 v2.4.2 Space info for CJKpunct (CTEX)] -% [2016/05/16 v2.4.2 Chinese translation for theorem name (CTEX)] +% [2016/08/27 v2.4.3 Chinese font definition (CTEX)] +% [2016/08/27 v2.4.3 Space info for CJKpunct (CTEX)] +% [2016/08/27 v2.4.3 Chinese translation for theorem name (CTEX)] % %<*driver> \documentclass{ctxdoc} @@ -537,7 +537,7 @@ Copyright and Licence % \changes{v2.4}{2015/02/19}{加强 \pkg{beamer} 宏包支持。} % % -% \CheckSum{5600} +% \CheckSum{5629} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -1514,14 +1514,14 @@ Copyright and Licence % |subsubsection|, |paragraph|, |subparagraph|;而可用的格式包括 \opt{numbering}, % \opt{name}, \opt{number}, \opt{format}, \opt{nameformat}, \opt{numberformat}, % \opt{aftername}, \opt{titleformat}, \opt{aftertitle}, \opt{runin}, -% \opt{afterindent}, \opt{beforeskip}, \opt{afterskip}, \opt{indent}, -% \opt{pagestyle} 等。 +% \opt{afterindent}, \opt{beforeskip}, \opt{afterskip}, \opt{fixskip}, +% \opt{indent}, \opt{pagestyle} 等。 % % 注意,对 \cls{article} 及其衍生的 \cls{ctexart} 等文档类,没有 |chapter| -% 级别的标题。而对于 \cls{beamer} 文档类,这些选项控制的是由 \tn{partpage}、 -% \tn{sectionpage} 和 \tn{subsectionpage} 产生的标题格式,此时只有 |part|、 -% |section| 和 |subsection| 这三层级别,并且 \opt{runin} 和 \opt{afterindent} -% 这两个格式无效。 +% 级别的标题。而对于 \cls{beamer} 文档类,这些选项控制的是由 \tn{partpage}, +% \tn{sectionpage} 和 \tn{subsectionpage} 产生的标题格式,此时只有 |part|, +% |section| 和 |subsection| 这三层级别,并且 \opt{runin}, \opt{afterindent} +% 和 \opt{fixskip} 这三个格式无效。 % % 多级选项之间用斜线分开,例如,\opt{part/name} 选项设置 \tn{part} 标题的在数 % 字前后的名称,而 \opt{section/number} 选项设置 \tn{section} 标题的数字类型。 @@ -2001,15 +2001,6 @@ Copyright and Licence % \end{tabular} % \end{table} % -% \begin{function}[EXP,added=2016-05-10]{part/fixbeforeskip,chapter/fixbeforeskip} -% \begin{syntax} -% fixbeforeskip = \TFF -% \end{syntax} -% \cls{book} 和 \cls{report} 类的 \tn{part} 和 \tn{chapter} 标题与正文顶部的距离除了由 -% \opt{beforeskip} 选项设置的垂直间距外,还会有一个空行。 -% \opt{fixbeforeskip} 选项用于抑制这个多余空行。 -% \end{function} -% % \begin{function}[EXP,updated=2015-06-27]{.../afterskip} % \begin{syntax} % afterskip = \Arg{弹性间距} @@ -2074,6 +2065,15 @@ Copyright and Licence % \end{minipage} % \end{table} % +% \begin{function}[EXP,added=2016-06-03]{.../fixskip} +% \begin{syntax} +% fixskip = \TFF +% \end{syntax} +% 默认情况下,\cls{article}、\cls{book} 和 \cls{report} 类的标题与正文的距离除了由 +% \opt{beforeskip} 和 \opt{afterskip} 选项设置的垂直间距外,还会有一些多余的间距。 +% \opt{fixskip} 选项用于抑制这些多余间距。 +% \end{function} +% % \begin{function}[EXP,updated=2015-06-27]{.../indent} % \begin{syntax} % indent = \Arg{缩进间距} @@ -2190,13 +2190,13 @@ Copyright and Licence % \begin{ctexexam}[labelref=exam:miscopt] % \ctexset { % chapter = { -% beforeskip = 0pt, -% fixbeforeskip = true, -% format = \Huge\bfseries, -% nameformat = \rule{\linewidth}{1bp}\par\bigskip\hfill\chapternamebox, -% number = \arabic{chapter}, -% aftername = \par\medskip, -% aftertitle = \par\bigskip\nointerlineskip\rule{\linewidth}{2bp}\par +% beforeskip = 0pt, +% fixskip = true, +% format = \Huge\bfseries, +% nameformat = \rule{\linewidth}{1bp}\par\bigskip\hfill\chapternamebox, +% number = \arabic{chapter}, +% aftername = \par\medskip, +% aftertitle = \par\bigskip\nointerlineskip\rule{\linewidth}{2bp}\par % } % } % \newcommand\chapternamebox[1]{% @@ -2220,7 +2220,7 @@ Copyright and Licence % \label{sec:useful-commands} % \subsection{字号与间距} % -% \begin{function}[updated=2014-03-08]{\zihao} +% \begin{function}[updated = 2014-03-08, label = ]{\zihao} % \begin{syntax} % \tn{zihao} \Arg{字号} % \end{syntax} @@ -2559,7 +2559,7 @@ Copyright and Licence % 来确定。 % \end{function} % -% \begin{function}{zhmap, nozhmap} +% \begin{function}[label = ]{zhmap, nozhmap} % \opt{zhmap} 宏包选项增加了参数,扩充了功能,除了支持真假值参数外,还支持选择 % \pkg{zhmCJK} 作为底层中文处理宏包。(\ref{subs:options-CJK-font}~节) % @@ -2576,7 +2576,7 @@ Copyright and Licence % (\ref{subs:options-CJK-font}~节)。 % \end{function} % -% \begin{function}{punct, nopunct} +% \begin{function}[label = ]{punct, nopunct} % 旧版本中宏包 \opt{punct} 选项没有参数,现在可以用参数设定标点风格 % (\ref{subs:options-type-style}~节)。原有无参形式的 \opt{punct} 选项相当 % 于 |punct=quanjiao|。 @@ -2592,7 +2592,7 @@ Copyright and Licence % 于 |scheme = plain|。它们均已过时,仅因兼容性而保留。 % \end{function} % -% \begin{function}{space, nospace} +% \begin{function}[label = ]{space, nospace} % 新版本宏包 \opt{space} 选项增加真假值参数。 % (\ref{subs:options-type-style}~节) % @@ -2717,6 +2717,12 @@ Copyright and Licence % 并设置相应的 \opt{runin} 选项为 \opt{true}。 % \end{function} % +% \subsection{\CTeX\ 2.4.1 和 2.4.2} +% +% \begin{function}{part/fixbeforeskip, chapter/fixbeforeskip} +% 这两个选项已经被删除,相应功能由新的选项 \opt{fixskip} 提供。 +% \end{function} +% % \section{宏集依赖情况与手工安装方法} % \label{sec:dep-ins} % @@ -2730,19 +2736,17 @@ Copyright and Licence % % \begin{itemize} % \item \pkg{expl3}、\pkg{xparse} 和 \pkg{l3keys2e} 宏包。它们属于 \pkg{l3kernel} -% 和 \pkg{l3packages} 宏集,它们还依赖 -% \begin{itemize} -% \item \pkg{etex} 宏包。 -% \end{itemize} +% 和 \pkg{l3packages} 宏集。 % \item \pkg{indentfirst} 宏包,属于 \pkg{tools} 宏集。 % \item \pkg{everysel} 宏包,属于 \pkg{ms} 宏集。 +% \item \pkg{ulem} 宏包。 % \item \pkg{zhnumber} 宏包。 % \item[\ding{229}] 以上是各种编译方式都必需的依赖项。 -% \item \pkg{CJK} 宏集,它的下划线功能依赖 \pkg{ulem} 宏包。 +% \item \pkg{CJK} 宏集。 % \item \pkg{CJKpunct} 宏包。 % \item \pkg{xCJK2uni} 宏包。 % \item \pkg{zhmetrics} 宏包。 -% \item \pkg{zhmCJK} 宏包。 +% \item \pkg{zhmCJK} 宏包,它还依赖 \pkg{oberdiek} 宏集。 % \item[\ding{229}] 以上是使用 \pdfLaTeX{} 或 \LaTeX{} + \dvipdfmx{} 的编译方式所需要 % 的依赖项,其中 \pkg{zhmCJK} 是可选的。 % \item \pkg{xeCJK} 宏包,它还依赖 @@ -2750,16 +2754,25 @@ Copyright and Licence % \item \pkg{fontspec} 宏包,它还依赖 % \begin{itemize} % \item \pkg{euenc} 宏包。 -% \item \pkg{xunicode} 宏包,它还依赖 \pkg{tipa} 宏包。 +% \item \pkg{xunicode} 宏包,它还依赖 +% \begin{itemize} +% \item \pkg{graphics} 宏集。 +% \item \pkg{graphics-cfg} 宏包。 +% \item \pkg{graphics-def} 宏包。 +% \end{itemize} % \end{itemize} % \end{itemize} +% \item \pkg{environ} 宏包,它还依赖 \pkg{trimspaces} 宏包。 % \item[\ding{229}] 以上是使用 \XeLaTeX{} 编译时的依赖项。 % \item \pkg{LuaTeX-ja} 宏集,它还依赖 % \begin{itemize} +% \item \pkg{adobemapping} 宏包。 +% \item \pkg{fontspec} 宏包。 +% \item \pkg{lualibs} 宏包。 +% \item \pkg{luaotfload} 宏包。 +% \item \pkg{luatexbase} 宏包,它还依赖 \pkg{ctablestack} 宏包。 % \item \pkg{oberdiek} 宏集。 % \item \pkg{xkeyval} 宏包。 -% \item \pkg{lualibs} 宏包。 -% \item \pkg{luaotfload} 宏包,它还依赖 \pkg{luatexbase} 宏包。 % \end{itemize} % \item[\ding{229}] 以上是使用 \LuaLaTeX{} 编译时的依赖项。 % \item \pkg{zhmetrics-uptex} 宏包。 @@ -4152,66 +4165,53 @@ Copyright and Licence } \AtEndUTFCommand { \group_end: } % \end{macrocode} +% % \changes{v2.4.2}{2016/05/15}{恢复 \pkg{luatexja} 对 \tn{emshape} 和 % \tn{eminnershape} 的重定义。} -% 对 \pkg{fontspec} 沿用 \pkg{LuaTeX-ja} 的补丁。但恢复对 \tn{emshape} 和 -% \tn{eminnershape} 的修改。 +% \changes{v2.4.3}{2016/08/26}{简化 \pkg{fontspec} 补丁。} +% \begin{macro}[int]{\fontspec_visible_space:} +% 我们不使用 \pkg{luatexja} 对 \pkg{fontspec} 的补丁,直接处理。 % \begin{macrocode} -\RequirePackage { lltjp-fontspec } -\cs_set:Npn \emshape { \itshape } -\cs_set:Npn \eminnershape { \upshape } +\cs_set_protected:Npn \fontspec_visible_space: + { + \font_glyph_if_exist:NnTF \font { "2423 } + { \ltjalchar "2423 \exp_stop_f: } + { \fontspec_visible_space_fallback: } + } % \end{macrocode} -% \pkg{lltjp-unicode-math} 让数学符号命令成为普通的文字宏。为了避免它被展开,应该 -% 用 \tn{protected} 来定义。 +% \end{macro} +% +% \changes{v2.4.3}{2016/08/25}{更新 \pkg{unicode-math} 补丁。} +% 对 \pkg{unicode-math} 的补丁主要是将 \file{unicode-math-table.tex} 中的数学符号设置为 +% \pkg{luatexja} 中的数学字母。 % \begin{macrocode} -\cs_new_protected_nopar:Npn \@@_um_define_math_chars: +\cs_new_protected:Npn \ctex_ltj_set_math_letter:NN #1#2 { \group_begin: - \cs_set_protected:Npn \__um_sym:nnn ##1##2##3 - { - \tl_if_in:nnT - { - \mathord \mathalpha \mathbin \mathrel - \mathpunct \mathop \mathfence - } - { ##3 } - { \@@_um_char:Nn ##2 { ##1 } } - } - \__um_input_math_symbol_table: + \cs_set_protected:Npn #1 ##1##2##3 + { \ltjsetmathletter { ##1 } } + #2 \group_end: } -\cs_new_protected:Npn \@@_um_char:Nn #1#2 - { - \@@_um_char_aux:Nx #1 { \char_generate:nn {#2} { 12 } } - \ltjsetmathletter {#2} - } -\cs_new_protected:Npn \@@_um_char_aux:Nn #1#2 +\ctex_at_end_package:nn { unicode-math } { - \cs_gset_protected_nopar:Npn #1 + \cs_if_exist:NTF \um_input_math_symbol_table: { - \mode_if_math:TF - {#2} - { - { - \lua_now_x:n { tex.globaldefs = 0 } - \ltj@allalchar #2 - } - } + \ctex_ltj_set_math_letter:NN + \um_sym:nnn + \um_input_math_symbol_table: } - } -\cs_generate_variant:Nn \@@_um_char_aux:Nn { Nx } -\ctex_at_end_package:nn { unicode-math } - { - \cs_set_eq:NN \__um_define_math_chars: \@@_um_define_math_chars: - \@ifpackagelater { unicode-math } { 2015/06/28 } { \cs_set_eq:NN \use@mathgroup \ctex_ltj_use_math_group:Nn \cs_set_protected_nopar:Npn \ctex_ltj_math_group_hook: { \__um_switchto_literal: } + \ctex_ltj_set_math_letter:NN + \__um_sym:nnn + \__um_input_math_symbol_table: } - { } } % \end{macrocode} +% % 对 \pkg{listings} 的补丁是让代码环境支持 JAchar 类。\pkg{LuaTeX-ja} 的补丁会将 % 代码目录标题改为日文,我们不需要。 % \begin{macrocode} @@ -4986,12 +4986,12 @@ Copyright and Licence { \prop_if_empty:NF \g_@@_family_font_name_prop { - \ctex_ltj_family_if_exist:xNF { \CJKfamilydefault } \l_@@_tmpa_tl + \ctex_ltj_family_if_exist:xNF { \CJKfamilydefault } \l_@@_tmp_tl { \str_if_eq_x:nnTF { \CJKfamilydefault } { \CJKrmdefault } { \use:n } { - \ctex_ltj_family_if_exist:xNTF { \CJKrmdefault } \l_@@_tmpa_tl + \ctex_ltj_family_if_exist:xNTF { \CJKrmdefault } \l_@@_tmp_tl { \tl_gset:Nn \CJKfamilydefault { \CJKrmdefault } \use_none:n } { \use:n } } @@ -5558,7 +5558,7 @@ Copyright and Licence \ctex_at_end_preamble:n { \ctex_update_default_family: } % \end{macrocode} % -% \begin{macro}{\em} +% \begin{macro}[int]{\em} % \changes{v2.4.2}{2016/05/15}{兼容 \upLaTeX{} 2016/05/07u00 的定义。} % 取消 \upLaTeX{} 对 \tn{em} 使用 |\mcfamily|、|\gtfamily| 命令的重定义,恢复 % \LaTeXe{} 对 \tn{em} 的原始定义。如果用户已经重定义了 \tn{em},则新定义保持 @@ -6550,6 +6550,18 @@ Copyright and Licence % \subsection{其它中文标题定义} % % \changes{v2.0}{2014/03/08}{将标题汉化功能加入 \pkg{ctex.sty}。} +% \changes{v2.4.3}{2016/08/18}{确保 \tn{proofname} 非空。} +% +% \begin{macro}[int]{\proofname} +% \tn{proofname} 未在标准文档类中定义,需要确保它非空。 +% \begin{macrocode} +\tl_if_exist:NF \proofname + { + \tl_new:N \proofname + \tl_set:Nn \proofname { Proof } + } +% \end{macrocode} +% \end{macro} % % \begin{macrocode} \keys_define:nn { ctex } @@ -6691,6 +6703,7 @@ Copyright and Licence % 不再有特殊意义。} % \changes{v2.2}{2015/06/27}{新的标题格式选项 \opt{afterindent}。} % \changes{v2.2}{2015/06/27}{新的标题格式选项 \opt{runin}。} +% \changes{v2.4.3}{2016/06/03}{新的标题格式选项 \opt{fixskip}。} % % \begin{macro}[int]{\@@_def_heading_keys:n} % \begin{macrocode} @@ -6714,6 +6727,7 @@ Copyright and Licence #1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , %<*article|book|report> #1 / afterindent .bool_set:N = \exp_not:c { CTEX@#1@afterindent } , + #1 / fixskip .bool_set:N = \exp_not:c { CTEX@#1@fixskip } , #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , % #1 / format+ .code:n = @@ -6763,19 +6777,18 @@ Copyright and Licence % \changes{v2.0}{2014/03/21}{标题设置新增 \opt{pagestyle} 选项。} % \changes{v2.4.1}{2016/05/10}{新的标题格式选项 \opt{part/fixbeforeskip} 和 % \opt{chapter/fixbeforeskip}。} +% \changes{v2.4.3}{2016/06/03}{删除选项 \opt{part/fixbeforeskip} 和 +% \opt{chapter/fixbeforeskip}。} % -% \begin{macro}{part/pagestyle,chapter/pagestyle, -% part/fixbeforeskip,chapter/fixbeforeskip} +% \begin{macro}{part/pagestyle,chapter/pagestyle} % 只在 \cls{ctexbook} 和 \cls{ctexrep} 下有定义。 % \begin{macrocode} \group_begin: %<*book|report> \tl_set:Nn \l_@@_tmp_tl { - part / pagestyle .tl_set:N = \CTEX@part@pagestyle , - chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle , - part / fixbeforeskip .bool_set:N = \CTEX@part@fixbeforeskip , - chapter / fixbeforeskip .bool_set:N = \CTEX@chapter@fixbeforeskip , + part / pagestyle .tl_set:N = \CTEX@part@pagestyle , + chapter / pagestyle .tl_set:N = \CTEX@chapter@pagestyle , } % %<*article|beamer> @@ -6813,26 +6826,39 @@ Copyright and Licence % \end{macrocode} % \end{macro} % -% \begin{macro}[int]{\CTEX@fixbeforeskip} +% \begin{macro}[int]{\CTEX@fixtopskip} % 修正 \cls{book} 和 \cls{report} 类的 \tn{part} 和 \tn{chapter} 标题之前的多余空行。 -% 事实上,减掉 \tn{parskip} 有一定的风险。如果接下来的内容不会进入水平模式(例如在 \opt{format} -% 选项中使用 \tn{hrule} 或者 \tn{hbox}),\TeX{} 就不会加上 \tn{parskip}。这时候就需要用户把 -% \tn{parskip} 加到 \opt{beforeskip} 上作为修正。 % \begin{macrocode} %<*book|report> -\cs_new_protected_nopar:Npn \CTEX@fixbeforeskip +\cs_new_protected_nopar:Npn \CTEX@fixtopskip { - \par - \ifdim \pagegoal = \maxdimen - \advance \@tempskipa -\topskip - \advance \@tempskipa -\parskip - \nointerlineskip - \fi + \CTEX@fixheadingskip + \dim_compare:nNnF \tex_pagegoal:D < \c_max_dim + { \skip_sub:Nn \l_@@_heading_skip { \tex_topskip:D } } } % % \end{macrocode} % \end{macro} % +% \begin{macro}[int]{\CTEX@fixheadingskip} +% 抑制行间粘连,修正标题前后的多余间距。事实上,减掉 \tn{parskip},有一定的风险。 +% 如果接下来的内容不会进入水平模式(例如在 \opt{format} 选项中使用 \tn{hrule} 或者 \tn{hbox}), +% \TeX{} 就不会加上 \tn{parskip}。这时候就需要用户把 \tn{parskip} 加到 \opt{beforeskip} +% 或者 \opt{afterskip} 作为修正。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \CTEX@fixheadingskip + { + \par + \dim_set:Nn \tex_prevdepth:D { -1000pt } + \skip_sub:Nn \l_@@_heading_skip { \tex_parskip:D } + } +\skip_new:N \l_@@_heading_skip +\cs_new_protected_nopar:Npn \CTEX@setheadingskip + { \skip_set:Nn \l_@@_heading_skip } +\cs_new_eq:NN \CTEX@headingskip \l_@@_heading_skip +% \end{macrocode} +% \end{macro} +% % \changes{v2.2}{2015/06/27}{\opt{beforeskip}、\opt{afterskip} 和 \opt{indent} % 选项支持表达式。} % @@ -6852,7 +6878,9 @@ Copyright and Licence \if@noskipsec \leavevmode \fi \par % \addvspace{4ex}% - \addvspace{\glueexpr\CTEX@part@beforeskip\relax}% + \CTEX@setheadingskip \CTEX@part@beforeskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \addvspace \CTEX@headingskip \ifodd \CTEX@part@afterindent \@afterindenttrue \else @@ -6876,11 +6904,9 @@ Copyright and Licence \@tempswafalse \fi % \null\vfil - \@tempskipa = \glueexpr \CTEX@part@beforeskip \relax - \ifodd \CTEX@part@fixbeforeskip - \CTEX@fixbeforeskip - \fi - \vspace*{\@tempskipa}% + \CTEX@setheadingskip \CTEX@part@beforeskip + \ifodd \CTEX@part@fixskip \CTEX@fixtopskip \fi + \vspace*{\CTEX@headingskip}% \secdef\@part\@spart} % % \end{macrocode} @@ -6915,7 +6941,9 @@ Copyright and Licence \CTEX@part@aftertitle}% \nobreak % \vskip 3ex - \vskip \glueexpr \CTEX@part@afterskip \relax + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip \@afterheading} % %<*book|report> @@ -6961,7 +6989,9 @@ Copyright and Licence \CTEX@part@aftertitle}% \nobreak % \vskip 3ex - \vskip \glueexpr \CTEX@part@afterskip \relax + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip \@afterheading} % %<*book|report> @@ -6982,7 +7012,9 @@ Copyright and Licence %<*book|report> \def\@endpart{% % \vfil - \vskip \glueexpr \CTEX@part@afterskip \relax + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip \newpage \if@twoside \if@openright @@ -7058,11 +7090,9 @@ Copyright and Licence % \begin{macrocode} \def\@makechapterhead#1{% % \vspace*{50\p@}% - \@tempskipa = \glueexpr \CTEX@chapter@beforeskip \relax - \ifodd \CTEX@chapter@fixbeforeskip - \CTEX@fixbeforeskip - \fi - \vspace*{\@tempskipa}% + \CTEX@setheadingskip \CTEX@chapter@beforeskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi + \vspace*{\CTEX@headingskip}% % {\normalfont \parindent \z@ \raggedright {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax \CTEX@chapter@format @@ -7080,7 +7110,9 @@ Copyright and Licence \CTEX@chapter@aftertitle \nobreak % \vskip 40\p@ - \vskip \glueexpr \CTEX@chapter@afterskip \relax + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip }} % \end{macrocode} % \end{macro} @@ -7089,11 +7121,9 @@ Copyright and Licence % \begin{macrocode} \def\@makeschapterhead#1{% % \vspace*{50\p@}% - \@tempskipa = \glueexpr \CTEX@chapter@beforeskip \relax - \ifodd \CTEX@chapter@fixbeforeskip - \CTEX@fixbeforeskip - \fi - \vspace*{\@tempskipa}% + \CTEX@setheadingskip \CTEX@chapter@beforeskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi + \vspace*{\CTEX@headingskip}% % {\normalfont \parindent \z@ \raggedright {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax \CTEX@chapter@format @@ -7103,7 +7133,9 @@ Copyright and Licence \CTEX@chapter@aftertitle \nobreak % \vskip 40\p@ - \vskip \glueexpr \CTEX@chapter@afterskip \relax + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip }} % \end{macrocode} % \end{macro} @@ -7134,7 +7166,10 @@ Copyright and Licence \everypar{}% \else % \addpenalty\@secpenalty\addvspace\@tempskipa - \addpenalty\@secpenalty\addvspace{\glueexpr #4\relax}% + \addpenalty\@secpenalty + \CTEX@setheadingskip{#4}% + \ifodd \CTEX@fixskip \CTEX@fixheadingskip \fi + \addvspace \CTEX@headingskip \fi \@ifstar {\@ssect{#3}{#4}{#5}{#6}}% @@ -7236,7 +7271,9 @@ Copyright and Licence \unless \ifodd \CTEX@runin \par \nobreak % \vskip \@tempskipa - \vskip\glueexpr #1\relax + \CTEX@setheadingskip{#1}% + \ifodd \CTEX@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip \@afterheading \else \@nobreakfalse @@ -7272,11 +7309,13 @@ Copyright and Licence \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } \cs_set_eq:Nc \CTEX@afterindent { CTEX@#1@afterindent } + \cs_set_eq:Nc \CTEX@fixskip { CTEX@#1@fixskip } \cs_set_eq:Nc \CTEX@runin { CTEX@#1@runin } } \cs_new_eq:NN \CTEX@titleformat@n \use:n \cs_new_eq:NN \CTEX@aftertitle \prg_do_nothing: \cs_new_eq:NN \CTEX@afterindent \c_true_bool +\cs_new_eq:NN \CTEX@fixskip \c_false_bool \cs_new_eq:NN \CTEX@runin \c_false_bool % \end{macrocode} % \end{macro} @@ -9467,7 +9506,7 @@ Copyright and Licence % \begin{macrocode} %<*windows> \ProvidesFile{zhwindowsfonts.tex}% - [2016/05/16 v2.4.2 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2016/08/27 v2.4.3 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ \ProvidesFile{zhadobefonts.tex}% - [2016/05/16 v2.4.2 Adobe font map loader for DVIPDFMx (CTEX)] + [2016/08/27 v2.4.3 Adobe font map loader for DVIPDFMx (CTEX)] \ifzhmappdf %% pdfTeX does not support OTF fonts @@ -9575,7 +9614,7 @@ Copyright and Licence % \begin{macrocode} %<*fandol> \ProvidesFile{zhfandolfonts.tex}% - [2016/05/16 v2.4.2 Fandol font map loader for DVIPDFMx (CTEX)] + [2016/08/27 v2.4.3 Fandol font map loader for DVIPDFMx (CTEX)] \ifzhmappdf %% pdfTeX does not support OTF fonts @@ -9611,7 +9650,7 @@ Copyright and Licence % \begin{macrocode} %<*founder> \ProvidesFile{zhfounderfonts.tex}% - [2016/05/16 v2.4.2 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2016/08/27 v2.4.3 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ \ProvidesFile{zhubuntufonts.tex}% - [2016/05/16 v2.4.2 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2016/08/27 v2.4.3 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ +% \end{macrocode} +% +% \begin{macrocode} +%<@@=ctxdoc> +% \end{macrocode} +% +% \begin{macrocode} \ExplSyntaxOff +\let\pdfmdfivesum\mdfivesum \DeclareOption*{\PassOptionsToClass{\CurrentOption}{l3doc}} \PassOptionsToClass{a4paper,full}{l3doc} \ProcessOptions @@ -10620,8 +10667,6 @@ Copyright and Licence \appto\MacroFont{\hyphenchar\font\m@ne\ctexdocverbaddon} \preto\AltMacroFont{\linespread{1}} \appto\AltMacroFont{\hyphenchar\font\m@ne\ctexdocverbaddon} -\def\Module#1{\mbox{% - \color{purple}\footnotesize\normalfont\sffamily\textlangle#1\textrangle}} \newcommand*\exptarget{\Hy@raisedlink{\hypertarget{expstar}{}}} \newcommand*\rexptarget{\Hy@raisedlink{\hypertarget{rexpstar}{}}} \newcommand*\expstar{\hyperlink{expstar}{$\star$}} @@ -10632,7 +10677,7 @@ Copyright and Licence \cs_new_nopar:Npn \zihaopt #1 { \exp_last_unbraced:Nf \tl_head:w - { \prop_item:Nn \c_@@_font_size_prop {#1} } { } \q_stop + { \prop_item:Nn \c__ctex_font_size_prop {#1} } { } \q_stop } %% 抑制首段的 \parskip \ctex_patch_cmd_once:NnnnTF \__codedoc_function_descr_start:w @@ -10655,62 +10700,41 @@ Copyright and Licence { \skip_zero:N \medskipamount } { \skip_add:Nn \medskipamount { \parskip } } } -%% 用 \vtop 让函数名字和语法盒子首行对齐 -\ctex_patch_cmd_once:NnnnTF \__codedoc_syntax:w +%% 左侧边注的函数列表采用单倍行距 +\ctex_preto_cmd:NnnTF \__codedoc_typeset_functions: { } - { { minipage } { \l__codedoc_syntax_dim } } - { { minipage } [t] { \l__codedoc_syntax_dim } } + { \MacroFont } { \iow_term:n { *** ~ SUCCESS ~ *** } } { \iow_term:n { *** ~ FAIL ~ *** } } -%% 左侧边注的函数列表采用单倍行距 -\ctex_preto_cmd:NnnTF \__codedoc_typeset_names: +\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_init: { } - { \linespread { 1 } } + { \hbox:n } + { \MacroFont \hbox:n } { \iow_term:n { *** ~ SUCCESS ~ *** } } { \iow_term:n { *** ~ FAIL ~ *** } } -\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_typeset_one:n +\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_typeset_one:nN { } { \vbox_unpack_clear:N } - { \linespread { 1 } \selectfont \vbox_unpack_clear:N } + { \MacroFont \vbox_unpack_clear:N } + { \iow_term:n { *** ~ SUCCESS ~ *** } } + { \iow_term:n { *** ~ FAIL ~ *** } } +\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_dump: + { } + { \hbox_unpack_clear:N } + { \MacroFont \hbox_unpack_clear:N } + { \iow_term:n { *** ~ SUCCESS ~ *** } } + { \iow_term:n { *** ~ FAIL ~ *** } } +\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_end: + { } + { \endtrivlist } + { \@noparlisttrue \endtrivlist } + { \iow_term:n { *** ~ SUCCESS ~ *** } } + { \iow_term:n { *** ~ FAIL ~ *** } } +\ctex_appto_cmd:NnnTF \__codedoc_macro_end_style:n + { } + { \@endparenv } { \iow_term:n { *** ~ SUCCESS ~ *** } } { \iow_term:n { *** ~ FAIL ~ *** } } -%% 不重复使用 \HD@target,避免索引出现重复页码 -\cs_set_protected:Npn \__codedoc_special_index_aux:nnnnn #1#2#3#4#5 - { - \__codedoc_special_index_set:Nn \l__codedoc_index_escaped_macro_tl {#2} - \str_if_eq:onTF { \@currenvir } { macrocode } - { \codeline@wrindex } - { - \HD@target - \index - } - { - \tl_if_empty:nF { #3 #4 } - { #3 \actualchar #4 \levelchar } - #1 - \actualchar - { - \token_to_str:N \verbatim@font \c_space_tl - \l__codedoc_index_escaped_macro_tl - } - \encapchar - hdclindex{\the\c@HD@hypercount}{#5} - } - } -\DeclareDocumentCommand \cs { O{} m } - { \__codedoc_cmd_aux:no {#1} { \c__codedoc_backslash_tl #2 } } -\DeclareDocumentCommand \tn { O{} m } - { - \__codedoc_cmd_aux:no - { index = TeX , replace = false , #1 } - { \c__codedoc_backslash_tl #2 } - } -\DeclareDocumentCommand \meta { +m } - { \__codedoc_meta_aux:n {#1} } -\DeclareExpandableDocumentCommand \bookmarkcstn { O{} m } - { \textbackslash \tl_to_str:n {#2} } -\cs_new:Npn \bookmarkmeta #1 { < \tl_to_str:n {#1} > } -\cs_generate_variant:Nn \__codedoc_cmd_aux:nn { no } \AtBeginEnvironment { syntax } { \char_set_catcode_active:N \| @@ -10720,7 +10744,7 @@ Copyright and Licence } %% 不对目录中出现的 \cs 和 \tn 等编索引 \DeclareDocumentCommand \StopSpecialIndexModule { } - { \cs_set_eq:NN \__codedoc_special_index_module:nnnn \use_none:nnnn } + { \cs_set_eq:NN \__codedoc_special_index_module:nnnnN \use_none:nnnnn } \tl_map_inline:nn { \actualchar \encapchar \levelchar } { \exp_args:Nx \DoNotIndex { \bslash \tl_to_str:N #1 } } \DeclareDocumentCommand \package { o m } @@ -10735,22 +10759,410 @@ Copyright and Licence \DeclareDocumentCommand \GetFileId { m } { \GetFileInfo {#1} - \ior_open:NnTF \g_@@_doc_ior { \c_sys_jobname_str .id } + \ior_open:NnTF \g_@@_id_ior { \c_sys_jobname_str .id } { - \ior_get:NN \g_@@_doc_ior \l_@@_tmp_tl - \ior_close:N \g_@@_doc_ior + \ior_get:NN \g_@@_id_ior \l_@@_tmp_tl + \ior_close:N \g_@@_id_ior \exp_after:wN \GetIdInfo \l_@@_tmp_tl } { \GetIdInfo $Id$ } { \fileinfo } } -\ior_new:N \g_@@_doc_ior +\ior_new:N \g_@@_id_ior +\ctex_patch_cmd:Nnn \changes@ + { \space \actualchar } + { \actualchar } +\cs_new_eq:NN \@@_ltx_changes:nnn \changes@ +\cs_set_protected:Npn \changes@ #1#2 + { + \@@_save_version_date:nn {#1} {#2} + \tl_if_empty:nTF {#1} + { \@@_ltx_changes:nnn } + { \@@_version_zfill:wnnn #1 \q_stop } + {#1} {#2} + } +\cs_new_protected:Npn \@@_version_zfill:wnnn #1#2 \q_stop + { + \str_if_eq:nnTF {#1} { v } + { \@@_version_zfill:nnnn {#2} } + { \@@_ltx_changes:nnn } + } +\cs_new_protected:Npn \@@_version_zfill:nnnn #1#2 + { + \tl_clear:N \l_@@_tmp_tl + \seq_set_split:Nnn \l_@@_tmp_seq { . } {#1} + \seq_map_function:NN \l_@@_tmp_seq \@@_version_zfill:n + \@@_ltx_changes:nnn { \l_@@_tmp_tl \actualchar #2 } + } +\tl_new:N \l_@@_tmp_tl +\seq_new:N \l_@@_tmp_seq +\cs_new_protected:Npn \@@_version_zfill:n #1 + { + \tl_put_right:Nx \l_@@_tmp_tl + { + \prg_replicate:nn + { \int_max:nn { 0 } { 10 - \tl_count:n {#1} } } { 0 } + \exp_not:n {#1} + } + } +\cs_new_protected:Npn \@@_save_version_date:nn #1#2 + { + \prop_get:NnNTF \g_@@_version_date_prop {#1} \l_@@_tmp_tl + { \exp_after:wN \@@_save_version_date:nnnn \l_@@_tmp_tl {#2} {#1} } + { \@@_save_version_date:nnn {#1} {#2} {#2} } + } +\cs_new_protected:Npn \@@_save_version_date:nnnn #1#2#3#4 + { + \@@_if_date_later:nnTF {#1} {#3} + { \@@_save_version_date:nnn {#4} {#3} {#2} } + { + \@@_if_date_later:nnT {#3} {#2} + { \@@_save_version_date:nnn {#4} {#1} {#3} } + } + } +\prg_new_conditional:Npnn \@@_if_date_later:nn #1#2 { TF , T } + { + \if_int_compare:w \@@_parse_date:w #1 / / / 0 \q_stop > + \@@_parse_date:w #2 / / / 0 \q_stop \exp_stop_f: + \prg_return_true: \else: \prg_return_false: \fi: + } +\cs_new:Npn \@@_parse_date:w #1/#2/#3/ #4 \q_stop + { #1#2#3 } +\cs_new_protected:Npn \@@_save_version_date:nnn #1#2#3 + { \prop_gput:Nnn \g_@@_version_date_prop {#1} { {#2} {#3} } } +\cs_new_protected:Npn \CTEX@versionitem #1 \efill + { + \@idxitem + \prop_get:NnNTF \g_@@_version_date_prop {#1} \l_@@_tmp_tl + { \exp_after:wN \@@_version_item:nnn \l_@@_tmp_tl {#1} } + { \BOOM } + } +\cs_new_protected:Npn \@@_version_item:nnn #1#2#3 + { + \noindent + \Hy@raisedlink { \belowpdfbookmark {#3} { HD.#3 } } + \textbf {#3} \hfill + \hbox:n + { + \footnotesize + \str_if_eq:nnTF {#1} {#2} + { ( #1 ) } + { ( #1 ~ -- ~ #2 ) } + } + \par \nopagebreak + } +\prop_new:N \g_@@_version_date_prop +\ctex_patch_cmd:Nnn \HDorg@theglossary + { \let \item \@idxitem } + { \let \item \CTEX@versionitem } +\ctex_patch_cmd:Nnn \l@section { 2.5em } { 1.5em } +\ctex_patch_cmd:Nnn \l@subsection { 2.5em } { 1.5em } +\ctex_patch_cmd:Nnn \@wrglossary + { hdpindex } + { + \ifnum \c@HD@hypercount = \z@ + hdpindex + \else + hdclindex { \the \c@HD@hypercount } + \fi + } +%% 重定义 macrocode 环境的实现,逐行处理 +\cs_set_protected_nopar:Npn \xmacro@code + { \@@_marco_code:w } +\cs_set_protected_nopar:Npn \sxmacro@code + { + \fontspec_print_visible_spaces: + \xmacro@code + } +\cs_new_protected_nopar:Npn \@@_marco_code:w + { + \ifcodeline@index + \@@_marco_every_par:n { \@@_code_line_no: } + \else: + \@@_marco_every_par:n { } + \fi: + \exp_args:Nx \@@_make_finish_tag:n { \@currenvir } + \@@_verbatim_start:w + } +\cs_new_protected:Npn \@@_marco_every_par:n #1 + { + \everypar + { + \everypar {#1} + \if@inlabel + \global \@inlabelfalse + \llap { \box \@labels \hskip \leftskip } + \fi + #1 + } + } +\ctex_patch_cmd:Nnn \macro@code + { \if@inlabel \leavevmode \fi } + { } +\group_begin: + \int_set_eq:NN \tex_endlinechar:D \c_minus_one + \use:n + { + \char_set_catcode_active:n { 32 } + \tl_const:Nn \c_@@_active_space_tl + } + { } +\group_end: +\group_begin: + \char_set_catcode_active:n { 13 } + \cs_new_protected:Npx \@@_make_finish_tag:n #1 + { + \tl_set:Nn \exp_not:N \l_@@_verbatim_finish_tl + { + \c_percent_str + \prg_replicate:nn { 4 } + { \exp_not:o { \c_@@_active_space_tl } } + \exp_not:o { \active@escape@char } end + \c_left_brace_str #1 \c_right_brace_str + \exp_not:N ^^M + } + } + \cs_new_protected:Npn \@@_verbatim_start:w #1 + { + \str_if_eq:nnTF {#1} { ^^M } + { \@@_verbatim_read_line:w } + { \@@_verbatim_read_line:w #1 } + } + \cs_new_protected:Npn \@@_verbatim_read_line:w #1 ^^M + { + \tl_set:Nn \l_@@_verbatim_line_tl { #1 ^^M } + \tl_if_eq:NNTF \l_@@_verbatim_line_tl \l_@@_verbatim_finish_tl + { \exp_args:Nx \end { \@currenvir } } + { + \@@_verbatim_process_line: + \@@_verbatim_read_line:w + } + } + \tl_const:Nn \c_@@_active_cr_tl { ^^M } +\group_end: +\tl_new:N \l_@@_verbatim_line_tl +\tl_new:N \l_@@_verbatim_finish_tl +\tl_new:N \g_@@_verbatim_verb_stop_tl +\cs_new_protected_nopar:Npn \@@_process_normal_line: + { + \str_if_eq_x:nnTF + { \str_head:N \l_@@_verbatim_line_tl } { \c_percent_str } + { \@@_check_angle:x { \tl_tail:N \l_@@_verbatim_line_tl } } + { \@@_output_line: } + } +\cs_new_protected_nopar:Npn \@@_process_verb_line: + { + \tl_if_eq:NNTF \l_@@_verbatim_line_tl \g_@@_verbatim_verb_stop_tl + { + \tl_gclear:N \g_@@_verbatim_verb_stop_tl + \cs_gset_eq:NN \@@_verbatim_process_line: \@@_process_normal_line: + \@@_output_module:nn + { slash@guard } + { \@@_module_pop:n { \l_@@_verbatim_line_tl } } + } + { \tl_use:N \l_@@_verbatim_line_tl } + } +\cs_new_eq:NN \@@_verbatim_process_line: \@@_process_normal_line: +\DeclareDocumentCommand \CheckModules { } + { \cs_set_eq:NN \@@_verbatim_process_line: \@@_process_normal_line: } +\DeclareDocumentCommand \DontCheckModules { } + { \cs_set_eq:NN \@@_verbatim_process_line: \@@_output_line: } +\cs_new_protected:Npn \@@_check_angle:n #1 + { + \str_if_eq_x:nnTF { \str_head:n {#1} } { < } + { \@@_check_module:x { \tl_tail:n {#1} } } + { \@@_output_percent_line: } + } +\cs_generate_variant:Nn \@@_check_angle:n { x } +\cs_new_protected:Npn \@@_check_module:n #1 + { + \exp_args:Nx \str_case:nnF { \str_head:n {#1} } + { + { * } { \@@_module_star:w } + { / } { \@@_module_slash:w } + { @ } { \@@_module_at:w } + { < } { \@@_module_verb:w } + } + { \@@_module_pm:w } + #1 \q_stop + } +\cs_generate_variant:Nn \@@_check_module:n { x } +\group_begin: + \char_set_catcode_active:N \> + \cs_new_protected:Npn \@@_module_star:w #1 > #2 \q_stop + { + \@@_output_module:nn + { star@guard } + { \@@_module_push:n { \@@_module_angle:n {#1} } } + \int_compare:nNnF \guard@level < \c@StandardModuleDepth + { + \cs_gset_eq:NN \macro@font \AltMacroFont + \macro@font + } + \int_gincr:N \guard@level + \@@_output_line:n {#2} + } + \cs_new_protected:Npn \@@_module_slash:w #1 > #2 \q_stop + { + \@@_output_module:nn + { slash@guard } + { \@@_module_pop:n { \@@_module_angle:n {#1} } } + \int_gdecr:N \guard@level + \int_compare:nNnF \guard@level < \c@StandardModuleDepth + { + \cs_gset_eq:NN \macro@font \MacroFont + \macro@font + } + \@@_output_line:n {#2} + } + \cs_new_protected:Npn \@@_module_at:w @ @ = #1 > #2 \q_stop + { + \@@_output_module:nn + { at@guard } + { \@@_module_angle:n { @ @ = #1 } } + \tl_gset:Nn \g__codedoc_module_name_tl {#1} + \@@_output_line:n {#2} + } + \cs_new_protected:Npn \@@_module_pm:w #1 > #2 \q_stop + { + \@@_output_module:nn + { pm@guard } + { \@@_module_angle:n {#1} } + \group_begin: + \int_compare:nNnF \guard@level < \c@StandardModuleDepth + { \AltMacroFont } + \@@_output_line:n {#2} + \group_end: + } + \cs_new_protected:Npn \@@_module_verb:w #1 \q_stop + { + \cs_gset_eq:NN \@@_verbatim_process_line: \@@_process_verb_line: + \tl_gset:Nx \g_@@_verbatim_verb_stop_tl + { \c_percent_str \tl_tail:n {#1} } + \@@_output_module:nn + { star@guard } + { \@@_module_push:n { \l_@@_verbatim_line_tl } } + } +\group_end: +\cs_new_protected_nopar:Npn \@@_output_line: + { + \tex_noindent:D + \@@_replace_at_at:N \l_@@_verbatim_line_tl + \tl_use:N \l_@@_verbatim_line_tl + } +\cs_new_protected:Npn \@@_replace_at_at:N #1 + { + \tl_if_empty:NF \g__codedoc_module_name_tl + { + \exp_args:NNo \@@_replace_at_at_aux:Nn + #1 \g__codedoc_module_name_tl + } + } +\cs_new_protected:Npn \@@_replace_at_at_aux:Nn #1#2 + { + \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 } + \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 } + } +\cs_new_protected:Npn \@@_output_line:n #1 + { + \tl_set:Nn \l_@@_verbatim_line_tl {#1} + \tl_if_eq:NNTF \l_@@_verbatim_line_tl \c_@@_active_cr_tl + { \tl_use:N \l_@@_verbatim_line_tl } + { + \str_if_eq_x:nnTF + { \str_head:N \l_@@_verbatim_line_tl } + { \c_percent_str } + { \@@_output_percent_line: } + { \@@_output_line: } + } + } +\cs_new_protected:Npn \@@_output_percent_line: + { + \tex_noindent:D + \group_begin: + \color { code@gray } + \str_if_eq_x:nnTF { \f@shape } { \updefault } + { \slshape } + { \upshape } + \@@_output_line: + \group_end: + } +\cs_new_protected_nopar:Npn \@@_module_push:n + { \exp_args:Nx \@@_module_push_aux:nn { \int_use:N \c@HD@hypercount } } +\cs_new_protected:Npn \@@_module_push_aux:nn #1 + { + \seq_gpush:Nn \g_@@_module_dest_seq {#1} + \HD@savedest@add {#1} + \cs_if_exist:cTF { r@HD. #1 } + { + \hypersetup { hidelinks } + \hyperref [ HD. #1 ] + } + { \use:n } + } +\cs_new_protected_nopar:Npn \@@_module_pop:n + { + \seq_gpop:NNTF \g_@@_module_dest_seq \l_@@_tmp_tl + { + \tl_set:Nx \@currentlabel { \int_use:N \c@HD@hypercount } + \HD@savedest@add { \@currentlabel } + \Hy@MakeCurrentHref { HD. \@currentlabel } + \label { HD. \l_@@_tmp_tl } + \hypersetup { hidelinks } + \hdclindex { \l_@@_tmp_tl } { } + } + { \BOOM \use:n } + } +\seq_new:N \g_@@_module_dest_seq +\cs_new_protected:Npn \@@_output_module:nn #1#2 + { + \tex_noindent:D + \group_begin: + \color {#1} \footnotesize \normalfont \sffamily #2 + \group_end: + } +\definecolor { star@guard } { rgb } { 0 , 0 , 0.55 } +\definecolor { slash@guard } { rgb } { 0.75 , 0 , 0.25 } +\definecolor { pm@guard } { rgb } { 0.5 , 0.5 , 0 } +\definecolor { at@guard } { rgb } { 0.5 , 0 , 0.5 } +\definecolor { code@gray } { gray } { 0.5 } +\cs_new_protected:Npn \@@_module_angle:n #1 + { \textlangle #1 \textrangle } +\cs_new_protected_nopar:Npn \@@_code_line_no: + { + \int_gincr:N \c@CodelineNo + \hbox_overlap_left:n + { + \hbox_to_wd:nn + { \MacroIndent } + { + \HD@target + \tex_hss:D + \@@_code_line_no_style: + \theCodelineNo \enspace + } + \tex_kern:D \@totalleftmargin + } + } +\tl_set:Nn \theCodelineNo + { \arabic { CodelineNo } } +\cs_new_protected_nopar:Npn \@@_code_line_no_style: + { \color { code@gray } \normalfont \sffamily \tiny } +\cs_set_protected:Npn \HD@SetMacroIndent #1 + { + \group_begin: + \settowidth \MacroIndent + { + \@@_code_line_no_style: + \prg_replicate:nn { \tl_count:n {#1} } { 0 } + \enspace + } + \dim_gset_eq:NN \MacroIndent \MacroIndent + \group_end: + } \ExplSyntaxOff \AtBeginDocument{\addtocontents{toc}{\StopSpecialIndexModule}} \pdfstringdefDisableCommands{% - \let\cs\bookmarkcstn - \let\tn\bookmarkcstn - \let\meta\bookmarkmeta \let\path\meta \let\opt\@firstofone} \preto\@thehead{\cslet{MakeUppercase\space}{\@iden}} @@ -10788,19 +11200,12 @@ Copyright and Licence \def\ctexkit{\href{https://github.com/CTeX-org/ctex-kit/}{\texttt{ctex-kit}}} \def\ctexkitrev#1{% \href{https://github.com/CTeX-org/ctex-kit/commit/#1}{\texttt{ctex-kit} rev. #1}} -\patchcmd\theCodelineNo{\sffamily\tiny}{\normalfont\sffamily\tiny}{}{} \appto\GlossaryParms{% + \raggedcolumns + \let\Hy@writebookmark\HDorg@writebookmark \def\@idxitem{\par\hangindent 2em }% \def\subitem{\@idxitem\hspace*{1em}}% \def\subsubitem{\@idxitem\hspace*{2em}}} -\patchcmd\l@section{2.5em}{1.5em}{}{} -\patchcmd\l@subsection{2.5em}{1.5em}{}{} -\patchcmd\changes@{\space}{\lbrack}{}{} -\patchcmd\@wrglossary{hdpindex}{% - \ifnum\c@HD@hypercount=\z@ - hdpindex% - \else - hdclindex{\the\c@HD@hypercount}\fi}{}{} \def\glossaryname{版本历史} \GlossaryPrologue{\section{\glossaryname}} \IndexPrologue{% @@ -10816,6 +11221,9 @@ Copyright and Licence \EnableCrossrefs \CodelineIndex \RecordChanges +% \end{macrocode} +% +% \begin{macrocode} % % \end{macrocode} % @@ -10847,9 +11255,9 @@ Copyright and Licence \ifeof\inputcheck\else \read \inputcheck to \inLine \closein\inputcheck - \fi - \ifx\inLine\empty\else - \let\ctxID\inLine + \ifx\inLine\empty\else + \let\ctxID\inLine + \fi \fi \maybeMsg{^^J\ctxID^^J}% \def\inLine{\ctxCMD\ctxID}% -- cgit v1.2.3