diff options
author | Karl Berry <karl@freefriends.org> | 2016-09-25 21:05:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2016-09-25 21:05:03 +0000 |
commit | cdbf5b2c845ca6b373fff9043f2e00b14807950a (patch) | |
tree | 21be6d681fafea69eabe39b80de24707f9a13d14 /Master/texmf-dist/source/latex | |
parent | d74756a7c618d3f8e58046afb5f5f7d5a07e429f (diff) |
ctex
git-svn-id: svn://tug.org/texlive/trunk@42148 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/ctex/ctex.dtx | 696 |
1 files changed, 538 insertions, 158 deletions
diff --git a/Master/texmf-dist/source/latex/ctex/ctex.dtx b/Master/texmf-dist/source/latex/ctex/ctex.dtx index b1d710ff91b..035769e8f6c 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)> %<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\NeedsTeXFormat{LaTeX2e} %<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\RequirePackage{expl3} -%<+!driver>\GetIdInfo$Id: ctex.dtx e653f84 2016-08-27 11:05:06 +0800 Qing Lee <sobenlee@gmail.com> $ +%<+!driver>\GetIdInfo$Id: ctex.dtx b7f83de 2016-09-21 21:27:31 +0800 Qing Lee <sobenlee@gmail.com> $ %<ctxdoc> {ctex documentation (CTEX)} %<ctxdoc>\ProvidesExplClass{ctxdoc} %<ctex> {Chinese adapter in LaTeX (CTEX)} @@ -502,7 +502,7 @@ Copyright and Licence %<founder>\ProvidesExplFile{ctex-fontset-founder.def} %<ubuntu> {Ubuntu fonts definition (CTEX)} %<ubuntu>\ProvidesExplFile{ctex-fontset-ubuntu.def} -%<!driver> {\ExplFileDate}{2.4.3}{\ExplFileDescription} +%<!driver> {\ExplFileDate}{2.4.4}{\ExplFileDescription} %</!(c19|c70|ctexspa|dict)> %<c19&rm>\ProvidesFile{c19rm.fd}% %<c19&sf>\ProvidesFile{c19sf.fd}% @@ -513,9 +513,9 @@ Copyright and Licence %<ctexspa>\ProvidesFile{ctexspa.def}% %<dict&theorem&GBK>\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}% %<dict&theorem&UTF8>\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}% -%<c19|c70> [2016/08/27 v2.4.3 Chinese font definition (CTEX)] -%<ctexspa> [2016/08/27 v2.4.3 Space info for CJKpunct (CTEX)] -%<dict&theorem> [2016/08/27 v2.4.3 Chinese translation for theorem name (CTEX)] +%<c19|c70> [2016/09/21 v2.4.4 Chinese font definition (CTEX)] +%<ctexspa> [2016/09/21 v2.4.4 Space info for CJKpunct (CTEX)] +%<dict&theorem> [2016/09/21 v2.4.4 Chinese translation for theorem name (CTEX)] %</!(driver|readme|install|zhmap|spa|docstrip)> %<*driver> \documentclass{ctxdoc} @@ -537,7 +537,7 @@ Copyright and Licence % \changes{v2.4}{2015/02/19}{加强 \pkg{beamer} 宏包支持。} % % -% \CheckSum{5629} +% \CheckSum{5793} % % \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 @@ -1478,7 +1478,7 @@ Copyright and Licence % \pagestyle{fancy} % % \sectionmark 的重定义需要在 \pagestyle 之后生效 % \renewcommand\sectionmark[1]{% -% \markright{\CTEXthesection——#1}} +% \markright{\CTEXifname{\CTEXthesection——}{}#1}} % % \begin{document} % @@ -1515,13 +1515,13 @@ Copyright and Licence % \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{fixskip}, -% \opt{indent}, \opt{pagestyle} 等。 +% \opt{indent}, \opt{pagestyle}, \opt{break} 等。 % % 注意,对 \cls{article} 及其衍生的 \cls{ctexart} 等文档类,没有 |chapter| % 级别的标题。而对于 \cls{beamer} 文档类,这些选项控制的是由 \tn{partpage}, % \tn{sectionpage} 和 \tn{subsectionpage} 产生的标题格式,此时只有 |part|, -% |section| 和 |subsection| 这三层级别,并且 \opt{runin}, \opt{afterindent} -% 和 \opt{fixskip} 这三个格式无效。 +% |section| 和 |subsection| 这三层级别,并且 \opt{runin}, \opt{afterindent}, +% \opt{fixskip} 和 \opt{break} 这四个格式无效。 % % 多级选项之间用斜线分开,例如,\opt{part/name} 选项设置 \tn{part} 标题的在数 % 字前后的名称,而 \opt{section/number} 选项设置 \tn{section} 标题的数字类型。 @@ -1663,6 +1663,25 @@ Copyright and Licence % 节的完整编号。例如用于帮助定义自定义的目录格式、页眉格式等。 % \end{function} % +% \begin{function}[added=2016-09-18]{\CTEXifname} +% \begin{syntax} +% \tn{CTEXifname} \Arg{有名字时的格式命令} \Arg{无名字时的格式命令} +% \end{syntax} +% \tn{CTEXifname} 用于根据当前章节的名字的有无设置不同的格式。 +% +% 它可用于 \opt{format}, \opt{titleformat}, \opt{aftertitle}, \opt{afterskip}, +% \opt{indent} 这五个选项和 \tn{chapter} 标题 \opt{beforeskip} 选项的格式设置之中。 +% 也可用于帮助定义自定义的目录格式、页眉格式等。 +% +% 例如,设置章的标题有名字时左对齐,无名字时居中对齐,并且在标题后画一条横线。 +% \begin{ctexexam} +% \ctexset{ +% chapter/format = \CTEXifname{\raggedright}{\centering}, +% chapter/aftertitle = \par\CTEXifname{}{\hrule}, +% } +% \end{ctexexam} +% \end{function} +% % \begin{function}[EXP,updated=2015-06-30]{.../format, .../format+} % \begin{syntax} % format = \Arg{格式命令} @@ -1674,13 +1693,13 @@ Copyright and Licence % 带加号的 \opt{format+} 选项则用于在已有格式之后追加新的格式命令。 % % 例如,设置章格式为无衬线字体左对齐,为节格式增加无衬线字体设置: -% \end{function} % \begin{ctexexam} % \ctexset{ % chapter/format = \sffamily\raggedright, % section/format += \sffamily % } % \end{ctexexam} +% \end{function} % % \begin{table}[htbp] % \small\centering @@ -2116,6 +2135,43 @@ Copyright and Licence % \end{tabular} % \end{table} % +% \begin{function}[EXP,added=2016-09-19]{.../break, .../break+} +% \begin{syntax} +% break = \Arg{格式命令} +% break+= \Arg{格式命令} +% \end{syntax} +% \opt{break} 选项用于控制章节标题与之前正文的分隔关系。一般用于设置是否在标题之前分页或者设置行间罚点。 +% +% 带加号的 \opt{break+} 选项则用于在已有格式之后追加新的格式命令。 +% +% \opt{break} 选项的默认值,在 \opt{scheme} 选项的不同取值下相同。 +% +% 例如,若当前页剩余高度小于正文高度的一半时,则另起一页输出 \tn{section} 标题: +% \begin{ctexexam} +% \usepackage{needspace} +% \ctexset{section/break = \Needspace{.5\textheight}} +% \end{ctexexam} +% \end{function} +% +% \begin{table}[htbp] +% \small\centering +% \caption{\opt{break} 选项的默认设置} +% \begin{tabular}{ll} +% \toprule +% 标题名 & 默认值 \\ +% \midrule +% part (article) & |{}| \\ +% part & |\if@openright\cleardoublepage\else\clearpage\fi| \\ +% chapter & 同上 \\ +% section & |\addpenalty{\@secpenalty}| \\ +% subsection & 同上 \\ +% subsubsection & 同上 \\ +% paragraph & 同上 \\ +% subparagraph & 同上 \\ +% \bottomrule +% \end{tabular} +% \end{table} +% % \begin{function}[EXP,added=2015-06-21]{appendix/numbering} % \begin{syntax} % numbering = \TTF @@ -2939,12 +2995,13 @@ Copyright and Licence % % \subsection{内部函数与变量} % -% \begin{variable}[int]{\l_@@_tmp_tl,\l_@@_tmp_int,\l_@@_tmp_dim,\l_@@_tmp_box} +% \begin{variable}[int]{\l_@@_tmp_tl,\l_@@_tmp_int,\l_@@_tmp_box,\l_@@_tmp_dim} +% 临时变量。 % \begin{macrocode} \tl_new:N \l_@@_tmp_tl \int_new:N \l_@@_tmp_int -%<!ctexheading>\dim_new:N \l_@@_tmp_dim \box_new:N \l_@@_tmp_box +%<!ctexheading>\dim_new:N \l_@@_tmp_dim % \end{macrocode} % \end{variable} % @@ -3637,9 +3694,9 @@ Copyright and Licence %<*pdftex|uptex|aptex> \cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1 { - \AtBeginDvi { #1 } + \AtBeginDvi {#1} \ctex_at_end_package:nn { atbegshi } - { \AtBeginShipoutFirst { #1 } } + { \AtBeginShipoutFirst {#1} } } \@onlypreamble \ctex_set_zhmap:n %</pdftex|uptex|aptex> @@ -3747,12 +3804,32 @@ Copyright and Licence \tl_set:Nn \CJKrmdefault {#1} \tl_set:Nn \CJKsfdefault {#2} \tl_set:Nn \CJKttdefault {#3} - \ctex_set_zhmap:n { \file_input:n {#4} } + \ctex_set_zhmap:n { \ctex_zhmap_input:n {#4} } } \@onlypreamble \ctex_load_zhmap:nnnn % \end{macrocode} % \end{macro} % +% \changes{v2.4.4}{2016/09/09}{解决 \opt{zhmap} 文件的 \tn{catcode} 问题。} +% \begin{macro}[int]{\ctex_zhmap_input:n} +% 载入字体映射文件时,确认 |%| 和 |\| 的 \tn{catcode}。 +% \begin{macrocode} + \cs_new_protected_nopar:Npn \ctex_zhmap_input:n #1 + { + \ctex_file_wrapper:nnn + { + \char_set_catcode_comment:n { 37 } % % + \char_set_catcode_escape:n { 92 } % \ + } + { \file_input:n {#1} } + { + \char_set_catcode:nn { 37 } { \char_value_catcode:n { 37 } } + \char_set_catcode:nn { 92 } { \char_value_catcode:n { 92 } } + } + } +% \end{macrocode} +% \end{macro} +% % \begin{macrocode} \tl_if_exist:NF \CJKfamilydefault { \tl_const:Nn \CJKfamilydefault { \CJKrmdefault } } @@ -4042,12 +4119,12 @@ Copyright and Licence %<*xetex> % \end{macrocode} % +% \changes{v2.4.4}{2016/09/12}{不再默认设置 \pkg{xeCJK} 的伪粗体。} % \begin{macrocode} \RequirePackage { xeCJK } \exp_args:Nx \xeCJKsetup { LoadFandol = false , - AutoFakeBold = true , PunctStyle = \l_@@_punct_tl } % \end{macrocode} @@ -4132,7 +4209,7 @@ Copyright and Licence local s = kpse.find_file('ltj-kinsoku.lua', 'tex') luatexja.stack.charprop_stack_table[0] = s and dofile(s) or {} } -\ltjsetparameter{kanjiskip=\z@ plus .4pt minus .4pt, +\ltjsetparameter{kanjiskip=\z@ plus .4pt minus .5pt, xkanjiskip=.25\zw plus 1pt minus 1pt, autospacing, autoxspacing, jacharrange={-1}, yalbaselineshift=\z@, yjabaselineshift=\z@, @@ -5920,9 +5997,7 @@ Copyright and Licence %<*uptex|aptex> \ctex_hypersetup:n { driverfallback = dvipdfmx } \ctex_at_end_package:nn { hyperref } - { - \AtBeginShipoutFirst{ \special{ pdf:tounicode~ UTF8-UTF16 } } - } + { \AtBeginShipoutFirst { \special { pdf:tounicode~ UTF8-UTF16 } } } %</uptex|aptex> % \end{macrocode} % @@ -6704,6 +6779,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}。} +% \changes{v2.4.4}{2016/09/19}{新的标题格式选项 \opt{break}。} % % \begin{macro}[int]{\@@_def_heading_keys:n} % \begin{macrocode} @@ -6729,6 +6805,9 @@ Copyright and Licence #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 / break .tl_set:N = \exp_not:c { CTEX@#1@break } , + #1 / break+ .code:n = + { \tl_put_right:Nn \exp_not:c { CTEX@#1@break } { ####1 } } , %</article|book|report> #1 / format+ .code:n = { \tl_put_right:Nn \exp_not:c { CTEX@#1@format } { ####1 } } , @@ -6817,15 +6896,6 @@ Copyright and Licence % % \subsubsection{标准标题命令的修改} % -% \begin{macro}[int]{\CTEX@makeheadinganchor} -% 用于 |numbering=false| 时,设置超链接跳转描点。 -% \begin{macrocode} -\cs_new_protected_nopar:Npn \CTEX@makeheadinganchor { } -\ctex_at_end_package:nn { hyperref } - { \cs_gset_protected_nopar:Npn \CTEX@makeheadinganchor { \phantomsection } } -% \end{macrocode} -% \end{macro} -% % \begin{macro}[int]{\CTEX@fixtopskip} % 修正 \cls{book} 和 \cls{report} 类的 \tn{part} 和 \tn{chapter} 标题之前的多余空行。 % \begin{macrocode} @@ -6859,6 +6929,29 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \changes{v2.4.4}{2016/09/18}{提供 \tn{partmark}。} +% \begin{macro}[int]{\partmark} +% 提供 \tn{partmark}。 +% \begin{macrocode} +\ProvideDocumentCommand \partmark { m } + { \markboth { } { } } +% \end{macrocode} +% \end{macro} +% +% \changes{v2.4.4}{2016/09/19}{提供 \tn{CTEXifname}。} +% \begin{macro}{\CTEXifname} +% \begin{macro}[int]{\CTEX@ifnametrue,\CTEX@ifnamefalse} +% 用于判断当前标题是否有编号。 +% \begin{macrocode} +\cs_new_eq:NN \CTEXifname \use_i:nn +\cs_new_protected_nopar:Npn \CTEX@ifnametrue + { \cs_set_eq:NN \CTEXifname \use_i:nn } +\cs_new_protected_nopar:Npn \CTEX@ifnamefalse + { \cs_set_eq:NN \CTEXifname \use_ii:nn } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \changes{v2.2}{2015/06/27}{\opt{beforeskip}、\opt{afterskip} 和 \opt{indent} % 选项支持表达式。} % @@ -6877,6 +6970,7 @@ Copyright and Licence \renewcommand\part{% \if@noskipsec \leavevmode \fi \par + \CTEX@part@break % \addvspace{4ex}% \CTEX@setheadingskip \CTEX@part@beforeskip \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi @@ -6890,11 +6984,12 @@ Copyright and Licence %</article> %<*book|report> \renewcommand\part{% - \if@openright - \cleardoublepage - \else - \clearpage - \fi +% \if@openright +% \cleardoublepage +% \else +% \clearpage +% \fi + \CTEX@part@break % \thispagestyle{plain}% \thispagestyle{\CTEX@part@pagestyle}% \if@twocolumn @@ -6918,14 +7013,18 @@ Copyright and Licence \def\@part[#1]#2{% \ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@part@numbering + \CTEX@ifnametrue \refstepcounter{part}% % \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% \else - \CTEX@makeheadinganchor + \CTEX@ifnamefalse + \CTEX@makeanchor{part*}% \addcontentsline{toc}{part}{#1}% \fi \else + \CTEX@ifnamefalse + \CTEX@makeanchor@part{part*}% \addcontentsline{toc}{part}{#1}% \fi {\interlinepenalty \@M @@ -6937,7 +7036,8 @@ Copyright and Licence \fi \fi % \huge\bfseries #2% \CTEX@part@titleformat{#2}% - \markboth{}{}% +% \markboth{}{}% + \partmark{#1}% \CTEX@part@aftertitle}% \nobreak % \vskip 3ex @@ -6950,17 +7050,22 @@ Copyright and Licence \def\@part[#1]#2{% \ifnum \c@secnumdepth >-2\relax \ifodd \CTEX@part@numbering + \CTEX@ifnametrue \refstepcounter{part}% % \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% \addcontentsline{toc}{part}{\CTEXthepart\hspace{1em}#1}% \else - \CTEX@makeheadinganchor + \CTEX@ifnamefalse + \CTEX@makeanchor{part*}% \addcontentsline{toc}{part}{#1}% \fi \else + \CTEX@ifnamefalse + \CTEX@makeanchor@part{part*}% \addcontentsline{toc}{part}{#1}% \fi - \markboth{}{}% +% \markboth{}{}% + \partmark{#1}% {\interlinepenalty \@M % \normalfont \centering \normalfont \CTEX@part@format @@ -6980,6 +7085,8 @@ Copyright and Licence % \begin{macrocode} %<*article> \def\@spart#1{% + \CTEX@ifnamefalse + \CTEX@makeanchor@spart{part*}% {\interlinepenalty \@M % \normalfont \parindent \z@ \raggedright \normalfont \parindent \dimexpr \CTEX@part@indent \relax @@ -6996,6 +7103,8 @@ Copyright and Licence %</article> %<*book|report> \def\@spart#1{% + \CTEX@ifnamefalse + \CTEX@makeanchor@spart{part*}% {\interlinepenalty \@M % \normalfont \centering \normalfont \CTEX@part@format @@ -7038,8 +7147,10 @@ Copyright and Licence % % \begin{macro}[int]{\chapter} % \begin{macrocode} -\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi +\renewcommand\chapter{% +% \if@openright\cleardoublepage\else\clearpage\fi % \thispagestyle{plain}% + \CTEX@chapter@break \thispagestyle{\CTEX@chapter@pagestyle}% \global\@topnum\z@ % \@afterindentfalse @@ -7058,6 +7169,7 @@ Copyright and Licence \ifnum \c@secnumdepth >\m@ne %<book> \if@mainmatter \ifodd \CTEX@chapter@numbering + \CTEX@ifnametrue \refstepcounter{chapter}% % \typeout{\@chapapp\space\thechapter.}% \typeout{\CTEXthechapter}% @@ -7065,13 +7177,18 @@ Copyright and Licence % {\protect\numberline{\thechapter}#1}% {\protect\numberline{\CTEXthechapter\hspace{0.3em}}#1}% \else - \CTEX@makeheadinganchor + \CTEX@ifnamefalse + \CTEX@makeanchor{\Hy@chapapp*}% \addcontentsline{toc}{chapter}{#1}% \fi %<book> \else +%<book> \CTEX@ifnamefalse +%<book> \CTEX@makeanchor@chapter{\Hy@chapapp*}% %<book> \addcontentsline{toc}{chapter}{#1}% %<book> \fi \else + \CTEX@ifnamefalse + \CTEX@makeanchor@chapter{\Hy@chapapp*}% \addcontentsline{toc}{chapter}{#1}% \fi \chaptermark{#1}% @@ -7086,6 +7203,20 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \begin{macro}[int]{\@schapter} +% \begin{macrocode} +\def\@schapter#1{% + \CTEX@ifnamefalse + \CTEX@makeanchor@schapter{\Hy@chapapp*}% + \if@twocolumn + \@topnewpage[\@makeschapterhead{#1}]% + \else + \@makeschapterhead{#1}% + \@afterheading + \fi} +% \end{macrocode} +% \end{macro} +% % \begin{macro}[int]{\@makechapterhead} % \begin{macrocode} \def\@makechapterhead#1{% @@ -7096,14 +7227,12 @@ Copyright and Licence % {\normalfont \parindent \z@ \raggedright {\normalfont \parindent \dimexpr \CTEX@chapter@indent \relax \CTEX@chapter@format - \ifnum \c@secnumdepth >\m@ne -%<book> \if@mainmatter - \ifodd \CTEX@chapter@numbering -% \huge\bfseries\@chapapp\space\thechapter\par\nobreak\vskip 20\p@ - \CTEX@chaptername \CTEX@chapter@aftername - \fi -%<book> \fi - \fi +% \ifnum \c@secnumdepth >\m@ne +% \if@mainmatter +% \huge\bfseries\@chapapp\space\thechapter\par\nobreak\vskip 20\p@ +% \fi +% \fi + \CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}% \interlinepenalty\@M % \Huge \bfseries #1\par\nobreak \CTEX@chapter@titleformat{#1}% @@ -7166,13 +7295,13 @@ Copyright and Licence \everypar{}% \else % \addpenalty\@secpenalty\addvspace\@tempskipa - \addpenalty\@secpenalty + \csname CTEX@#1@break\endcsname \CTEX@setheadingskip{#4}% \ifodd \CTEX@fixskip \CTEX@fixheadingskip \fi \addvspace \CTEX@headingskip \fi \@ifstar - {\@ssect{#3}{#4}{#5}{#6}}% + {\CTEX@makeanchor@ssect{#1*}\@ssect{#3}{#4}{#5}{#6}}% {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}} % \end{macrocode} % \end{macro} @@ -7181,7 +7310,8 @@ Copyright and Licence % \begin{macrocode} \def\@seccntformat#1{% % \csname the#1\endcsname\quad}% - \csname CTEX@#1name\endcsname \csname CTEX@#1@aftername\endcsname} + \csname CTEX@#1name\endcsname + \csname CTEX@#1@aftername\endcsname} % \end{macrocode} % \end{macro} % @@ -7189,13 +7319,17 @@ Copyright and Licence % \begin{macrocode} \def\@sect#1#2#3#4#5#6[#7]#8{% \ifnum #2>\c@secnumdepth + \CTEX@ifnamefalse + \CTEX@makeanchor@sect{#1*}% \let\@svsec\@empty \else \ifodd \csname CTEX@#1@numbering\endcsname + \CTEX@ifnametrue \refstepcounter{#1}% \protected@edef\@svsec{\@seccntformat{#1}\relax}% \else - \CTEX@makeheadinganchor + \CTEX@ifnamefalse + \CTEX@makeanchor{#1*}% \let\@svsec\@empty \fi \fi @@ -7212,12 +7346,10 @@ Copyright and Licence \endgroup \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% - \ifnum #2>\c@secnumdepth \else - \ifodd \csname CTEX@#1@numbering\endcsname -% \protect\numberline{\csname the#1\endcsname}% - \protect\numberline{\csname CTEXthe#1\endcsname}% - \fi - \fi +% \ifnum #2>\c@secnumdepth \else +% \protect\numberline{\csname the#1\endcsname}% +% \fi + \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}% #7}% \else \def\@svsechd{% @@ -7228,12 +7360,10 @@ Copyright and Licence \csname CTEX@#1@aftertitle\endcsname}% \csname #1mark\endcsname{#7}% \addcontentsline{toc}{#1}{% - \ifnum #2>\c@secnumdepth \else - \ifodd \csname CTEX@#1@numbering\endcsname -% \protect\numberline{\csname the#1\endcsname}% - \protect\numberline{\csname CTEXthe#1\endcsname}% - \fi - \fi +% \ifnum #2>\c@secnumdepth \else +% \protect\numberline{\csname the#1\endcsname}% +% \fi + \CTEXifname{\protect\numberline{\csname CTEXthe#1\endcsname}}{}% #7}}% \fi \@xsect{#5}} @@ -7243,6 +7373,7 @@ Copyright and Licence % \begin{macro}[int]{\@ssect} % \begin{macrocode} \def\@ssect#1#2#3#4#5{% + \CTEX@ifnamefalse % \@tempskipa #3\relax % \ifdim \@tempskipa>\z@ \unless \ifodd \CTEX@runin @@ -7377,6 +7508,76 @@ Copyright and Licence % \end{macrocode} % \end{macro} % +% \paragraph{设置 \pkg{hyperref} 宏包的标题锚点} +% +% \changes{v2.4.4}{2016/09/12}{改进 \pkg{hyperref} 宏包的标题锚点设置。} +% +% \begin{macro}[int]{\CTEX@makeanchor} +% 设置超链接跳转锚点,在 \pkg{hyperref} 载入后才有意义。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \CTEX@makeanchor #1 + { } +% \end{macrocode} +% \end{macro} +% +% \begin{variable}[int]{\c_@@_headings_cs_seq} +% 保存内部标题命令的 \CTeX{} 定义,用于随后比较。 +% \begin{macrocode} +\seq_new:N \c_@@_headings_cs_seq +\seq_gset_from_clist:Nn \c_@@_headings_cs_seq +%<article> { part , spart , sect , ssect } +%<book|report> { part , spart , chapter , schapter , sect , ssect } +\seq_map_inline:Nn \c_@@_headings_cs_seq + { + \cs_new_eq:cc { CTEX@ #1 } { @ #1 } + \cs_new_eq:cN { CTEX@makeanchor@ #1 } \CTEX@makeanchor + } +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[int]{\CTEX@hyperheadinghook} +% \pkg{hyperref} 会重定义内部标题命令,目的在于为没有编号的标题设置锚点(这一功能受他的 +% \opt{implicit} 选项的控制)。我们在上面对标题命令的修改已经包含这一功能,如果这些标题命令在 +% \pkg{hyperref} 载入之前没有被修改过,则恢复 \CTeX{} 的定义。 +% \begin{macrocode} +\cs_new_protected_nopar:Npn \CTEX@hyperheadinghook + { + \group_begin: + \ifHy@implicit + \cs_set_eq:NN \H@old@chapter \Hy@org@chapter + \seq_map_inline:Nn \c_@@_headings_cs_seq + { + \cs_if_eq:ccT { H@old@ ##1 } { CTEX@ ##1 } + { + \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 } + \cs_gset_eq:cN { CTEX@makeanchor@ ##1 } \CTEX@makeanchor + } + } + \else: + \seq_map_inline:Nn \c_@@_headings_cs_seq + { \cs_gset_eq:cN { CTEX@makeanchor@ ##1 } \CTEX@makeanchor } + \fi: + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\ctex_at_end_package:nn { hyperref } + { + \cs_gset_protected_nopar:Npn \CTEX@makeanchor #1 + { + \Hy@MakeCurrentHrefAuto {#1} + \Hy@raisedlink + { + \hyper@anchorstart { \@currentHref } + \hyper@anchorend + } + } + \CTEX@hyperheadinghook + } +% \end{macrocode} +% % \paragraph{兼容 \pkg{titlesec} 宏包} % % 我们修改了 \tn{@startsection} 的定义,它的第四个(\meta{beforeskip})和 @@ -7477,6 +7678,36 @@ Copyright and Licence } % \end{macrocode} % +% \changes{v2.4.4}{2016/09/13}{使用 \pkg{titlesec} 时,章节目录也使用 \CTeX{} 的编号。} +% 让编译时终端显示 \tn{CTEXthechapter},目录使用 |\CTEXtheXXX| 编号。 +% \begin{macrocode} +\ctex_at_end_package:nn { titlesec } + { +%<*book|report> + \tl_set:Nn \ttl@chapterout { \typeout { \CTEXthechapter } } +%</book|report> + \cs_if_free:NF \ttl@tocpart + { + \cs_set_protected_nopar:Npn \ttl@tocpart + { \tl_set:Nn \ttl@a { \CTEXthepart \hspace { 1em } } } + } + \seq_map_inline:Nn \c_@@_headings_seq + { + \cs_if_exist:cF { ttl@toc #1 } + { + \cs_new_protected_nopar:cpx { ttl@toc #1 } + { + \tl_set:Nn \exp_not:N \ttl@a + { + \exp_not:N \protect + \exp_not:N \numberline { \exp_not:c { CTEXthe #1 } } + } + } + } + } + } +% \end{macrocode} +% % \paragraph{兼容 \pkg{titleps} 宏包} % % \changes{v2.3}{2015/12/25}{兼容 \pkg{titleps} 宏包。} @@ -7546,6 +7777,24 @@ Copyright and Licence % \end{verbatim} % 但 \tn{newtitlemark} 不包含章节间的层次信息,功能上不及修改内部命令完整。 % +% \begin{macro}[int]{\ttl@setifthe} +% 使 |\iftheXXX| 等命令在页眉设置中可用。 +% \begin{macrocode} +\ctex_at_end_package:nn { titleps } + { + \cs_set_protected_nopar:Npn \ttl@setifthe #1 + { + \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 } + { + \CTEXifname + { \protect \@firstoftwo } + { \protect \@secondoftwo } + } + } + } +% \end{macrocode} +% \end{macro} +% % % \subsubsection{目录标签的宽度} % @@ -7591,22 +7840,26 @@ Copyright and Licence % \begin{macrocode} %<*article> \ctex_patch_cmd:Nnn \ps@headings - { \thesection \quad } - { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } + { \ifnum \c@secnumdepth > \z@ \thesection \quad \fi } + { \CTEXifname { \CTEXthesection \quad } { } } \if@twoside \ctex_patch_cmd:Nnn \ps@headings - { \thesubsection \quad } - { \ifodd \CTEX@subsection@numbering \CTEXthesubsection \quad \fi } + { \ifnum \c@secnumdepth > \@ne \thesubsection \quad \fi } + { \CTEXifname { \CTEXthesubsection \quad } { } } \fi: %</article> %<*book|report> \ctex_patch_cmd:Nnn \ps@headings - { \@chapapp\ \thechapter.~\ } - { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi } + { + \ifnum \c@secnumdepth > \m@ne \if@mainmatter + \@chapapp \ \thechapter . ~ \ + \fi \fi + } + { \CTEXifname { \CTEXthechapter \quad } { } } \if@twoside \ctex_patch_cmd:Nnn \ps@headings - { \thesection.~\ } - { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } + { \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } + { \CTEXifname { \CTEXthesection } { } } \fi: %</book|report> % \end{macrocode} @@ -7622,20 +7875,19 @@ Copyright and Licence { %<*article> \ctex_patch_cmd:Nnn \ps@fancy - { \thesection \hskip 1em \relax } - { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } + { \ifnum \c@secnumdepth > \z@ \thesection \hskip 1em \relax \fi } + { \CTEXifname { \CTEXthesection \quad } { } } \ctex_patch_cmd:Nnn \ps@fancy - { \thesubsection \hskip 1em \relax } - { \ifodd \CTEX@subsection@numbering \CTEXthesubsection \quad \fi } + { \ifnum \c@secnumdepth > \@ne \thesubsection \hskip 1em \relax \fi } + { \CTEXifname { \CTEXthesubsection \quad } { } } %</article> %<*book|report> \ctex_patch_cmd:Nnn \ps@fancy - { \@chapapp\ \thechapter.~\ } -%<book> { \if@mainmatter \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi \fi } -%<report> { \ifodd \CTEX@chapter@numbering \CTEXthechapter \quad \fi } + { \ifnum \c@secnumdepth > \m@ne \@chapapp \ \thechapter . ~ \ \fi } + { \CTEXifname { \CTEXthechapter \quad } { } } \ctex_patch_cmd:Nnn \ps@fancy - { \thesection.~\ } - { \ifodd \CTEX@section@numbering \CTEXthesection \quad \fi } + { \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } + { \CTEXifname { \CTEXthesection } { } } %</book|report> } % \end{macrocode} @@ -7862,6 +8114,7 @@ Copyright and Licence beforeskip = 0pt \@plus 1fil , afterskip = 0pt \@plus 1fil , pagestyle = plain , + break = \if@openright \cleardoublepage \else \clearpage \fi , %<*plain> format = \centering , nameformat = \huge \bfseries , @@ -7889,6 +8142,7 @@ Copyright and Licence aftertitle = \par , beforeskip = 50 \p@ , afterskip = 40 \p@ , + break = \if@openright \cleardoublepage \else \clearpage \fi , %<*plain> name = \chaptername \space , number = \thechapter , @@ -7922,6 +8176,7 @@ Copyright and Licence beforeskip = 3.5ex \@plus 1ex \@minus .2ex , afterskip = 2.3ex \@plus .2ex , runin = false , + break = \addpenalty \@secpenalty , %<*plain> format = \Large \bfseries , afterindent = false @@ -7957,6 +8212,7 @@ Copyright and Licence beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , runin = false , + break = \addpenalty \@secpenalty , %<*plain> afterindent = false %</plain> @@ -7996,6 +8252,7 @@ Copyright and Licence beforeskip = 3.25ex \@plus 1ex \@minus .2ex , afterskip = 1.5ex \@plus .2ex , runin = false , + break = \addpenalty \@secpenalty , %<*plain> afterindent = false %</plain> @@ -8012,6 +8269,7 @@ Copyright and Licence format = \normalsize \bfseries , aftername = \quad , beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + break = \addpenalty \@secpenalty , %<*plain> afterindent = false %</plain> @@ -8028,6 +8286,7 @@ Copyright and Licence format = \normalsize \bfseries , aftername = \quad , beforeskip = 3.25ex \@plus 1ex \@minus .2ex , + break = \addpenalty \@secpenalty , %<*plain> afterindent = false %</plain> @@ -9506,7 +9765,7 @@ Copyright and Licence % \begin{macrocode} %<*windows> \ProvidesFile{zhwindowsfonts.tex}% - [2016/08/27 v2.4.3 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2016/09/21 v2.4.4 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ <simsun.ttc} @@ -9578,7 +9837,7 @@ Copyright and Licence % \begin{macrocode} %<*adobe> \ProvidesFile{zhadobefonts.tex}% - [2016/08/27 v2.4.3 Adobe font map loader for DVIPDFMx (CTEX)] + [2016/09/21 v2.4.4 Adobe font map loader for DVIPDFMx (CTEX)] \ifzhmappdf %% pdfTeX does not support OTF fonts @@ -9614,7 +9873,7 @@ Copyright and Licence % \begin{macrocode} %<*fandol> \ProvidesFile{zhfandolfonts.tex}% - [2016/08/27 v2.4.3 Fandol font map loader for DVIPDFMx (CTEX)] + [2016/09/21 v2.4.4 Fandol font map loader for DVIPDFMx (CTEX)] \ifzhmappdf %% pdfTeX does not support OTF fonts @@ -9650,7 +9909,7 @@ Copyright and Licence % \begin{macrocode} %<*founder> \ProvidesFile{zhfounderfonts.tex}% - [2016/08/27 v2.4.3 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2016/09/21 v2.4.4 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ <FZSSK.TTF} @@ -9722,7 +9981,7 @@ Copyright and Licence % \begin{macrocode} %<*ubuntu> \ProvidesFile{zhubuntufonts.tex}% - [2016/08/27 v2.4.3 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)] + [2016/09/21 v2.4.4 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)] \ifzhmappdf \pdfmapline{=gbk@UGBK@ <uming.ttc} @@ -10555,6 +10814,7 @@ Copyright and Licence \RequirePackage{xcolor} \RequirePackage{caption} \RequirePackage{fvrb-ex} +\RequirePackage{zref-base} \geometry{includemp,hmargin={0mm,15mm},vmargin={25mm,15mm},footskip=7mm} \hypersetup{pdfstartview=FitH,bookmarksdepth=subparagraph} \setcounter{secnumdepth}{4} @@ -10563,6 +10823,7 @@ Copyright and Licence \setmainfont{TeX Gyre Pagella} \setsansfont{TeX Gyre Heros} \setmonofont[ + HyphenChar = None , UprightFont=* Light, BoldFont=* Bold, SlantedFont=* Light Oblique]{CMU Typewriter Text} \setmathfont{texgyrepagella-math.otf} @@ -10663,10 +10924,6 @@ Copyright and Licence \AfterEndEnvironment{function}{\ctexfixprevdepth} \AtBeginEnvironment{syntax}{\linespread{1}\ctexplainps\ctexdisableecglue} \BeforeBeginEnvironment{SideBySideExample}{\par\addvspace{\medskipamount}} -\preto\MacroFont{\linespread{1}} -\appto\MacroFont{\hyphenchar\font\m@ne\ctexdocverbaddon} -\preto\AltMacroFont{\linespread{1}} -\appto\AltMacroFont{\hyphenchar\font\m@ne\ctexdocverbaddon} \newcommand*\exptarget{\Hy@raisedlink{\hypertarget{expstar}{}}} \newcommand*\rexptarget{\Hy@raisedlink{\hypertarget{rexpstar}{}}} \newcommand*\expstar{\hyperlink{expstar}{$\star$}} @@ -10712,29 +10969,57 @@ Copyright and Licence { \MacroFont \hbox:n } { \iow_term:n { *** ~ SUCCESS ~ *** } } { \iow_term:n { *** ~ FAIL ~ *** } } -\ctex_patch_cmd_once:NnnnTF \__codedoc_macro_typeset_one:nN - { } - { \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 ~ *** } } +\cs_set_eq:NN \__codedoc_macro_end_style:n \use_none:n +\cs_set_protected:Npn \__codedoc_macro_typeset_one:nN #1#2 + { + \vbox_set:Nn \l__codedoc_macro_box + { + \MacroFont + \vbox_unpack_clear:N \l__codedoc_macro_box + \hbox_set:Nn \l_tmpa_box + { \__codedoc_print_macroname:nN {#1} #2 } + \dim_set:Nn \l_tmpa_dim { \marginparwidth - \labelsep } + \dim_compare:nNnT { \box_wd:N \l_tmpa_box } > \l_tmpa_dim + { + \box_resize_to_wd_and_ht:Nnn \l_tmpa_box + { \l_tmpa_dim } + { \box_ht:N \l_tmpa_box } + } + \hbox_overlap_left:n + { + \box_use:N \l_tmpa_box + \skip_horizontal:n { \marginparsep - \labelsep } + } + } + \int_incr:N \l__codedoc_macro_int + } +\cs_set_protected:Npn \__codedoc_print_macroname:nN #1#2 + { + \strut + \__codedoc_get_hyper_target:xN + { + \exp_not:n {#1} + \bool_if:NT #2 { \tl_to_str:n {TF} } + } + \l__codedoc_tmpa_tl + \cs_if_exist:cTF { r@ \l__codedoc_tmpa_tl } + { \exp_args:NNo \label@hyperref [ \l__codedoc_tmpa_tl ] } + { \use:n } + { + \tl_set:Nn \l__codedoc_tmpa_tl {#1} + \tl_replace_all:Non \l__codedoc_tmpa_tl + { \c_catcode_other_space_tl } + { \fontspec_visible_space: } + \__codedoc_macroname_prefix:o \l__codedoc_tmpa_tl + \__codedoc_macroname_suffix:N #2 + } + } \AtBeginEnvironment { syntax } { \char_set_catcode_active:N \| @@ -10769,9 +11054,6 @@ Copyright and Licence { \fileinfo } } \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 { @@ -10790,18 +11072,24 @@ Copyright and Licence \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 + \int_zero:N \l_tmpa_int + \seq_set_split:Nnn \l_tmpa_seq { . } {#1} + \seq_map_function:NN \l_tmpa_seq \@@_version_zfill:n + \int_compare:nNnF \l_tmpa_int > \c_two + { + \tl_put_right:Nx \l_@@_tmp_tl + { \prg_replicate:nn { \c_three - \l_tmpa_int } { 00000 } } + } \@@_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 { + \int_incr:N \l_tmpa_int \tl_put_right:Nx \l_@@_tmp_tl { \prg_replicate:nn - { \int_max:nn { 0 } { 10 - \tl_count:n {#1} } } { 0 } + { \int_max:nn { 0 } { 5 - \tl_count:n {#1} } } { 0 } \exp_not:n {#1} } } @@ -10957,7 +11245,7 @@ Copyright and Licence \tl_gclear:N \g_@@_verbatim_verb_stop_tl \cs_gset_eq:NN \@@_verbatim_process_line: \@@_process_normal_line: \@@_output_module:nn - { slash@guard } + { \color { verb@guard } } { \@@_module_pop:n { \l_@@_verbatim_line_tl } } } { \tl_use:N \l_@@_verbatim_line_tl } @@ -10992,45 +11280,39 @@ Copyright and Licence \cs_new_protected:Npn \@@_module_star:w #1 > #2 \q_stop { \@@_output_module:nn - { star@guard } + { \@@_star_color: } { \@@_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} + \@@_star_format: } \cs_new_protected:Npn \@@_module_slash:w #1 > #2 \q_stop { \@@_output_module:nn - { slash@guard } + { \@@_slash_color: } { \@@_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} + \@@_slash_format: } \cs_new_protected:Npn \@@_module_at:w @ @ = #1 > #2 \q_stop { \@@_output_module:nn - { at@guard } + { \color { 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} } + \tex_noindent:D + \hbox_overlap_left:n + { + \@@_output_module:nn + { \@@_pm_color: } + { \@@_module_angle:n {#1} } + \skip_horizontal:n { \leftskip + \smallskipamount } + } \group_begin: - \int_compare:nNnF \guard@level < \c@StandardModuleDepth - { \AltMacroFont } + \@@_pm_format: \@@_output_line:n {#2} \group_end: } @@ -11040,7 +11322,7 @@ Copyright and Licence \tl_gset:Nx \g_@@_verbatim_verb_stop_tl { \c_percent_str \tl_tail:n {#1} } \@@_output_module:nn - { star@guard } + { \color { verb@guard } } { \@@_module_push:n { \l_@@_verbatim_line_tl } } } \group_end: @@ -11088,43 +11370,141 @@ Copyright and Licence \group_end: } \cs_new_protected_nopar:Npn \@@_module_push:n - { \exp_args:Nx \@@_module_push_aux:nn { \int_use:N \c@HD@hypercount } } + { \exp_args:No \@@_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 } + \hypersetup { hidelinks } + \exp_args:Nx \hdclindex + { \zref@extractdefault { HD.#1 } { guard@end } { 1 } } { } } \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 } { } - } + { \exp_args:No \@@_module_pop_aux:nn { \l_@@_tmp_tl } } { \BOOM \use:n } } +\cs_new_protected:Npn \@@_module_pop_aux:nn #1 + { + \zref@labelbylist { HD.#1 } { ctxdoc } + \hypersetup { hidelinks } + \hdclindex {#1} { } + } \seq_new:N \g_@@_module_dest_seq +\zref@newlist { ctxdoc } +\zref@newprop { guard@end } [ 1 ] + { \int_eval:n { \c@HD@hypercount - 1 } } +\zref@addprop { ctxdoc } { guard@end } +\cs_new_protected_nopar:Npn \@@_star_format: + { + \seq_gpush:No \g_@@_slash_format_seq { \macro@font } + \seq_gpop:NNF \g_@@_star_format_seq \l_@@_format_tl + { \@@_pop_format: } + \@@_select_format: + } +\cs_new_protected_nopar:Npn \@@_slash_format: + { + \seq_gpop:NNTF \g_@@_slash_format_seq \l_@@_format_tl + { + \seq_gpush:No \g_@@_star_format_seq { \macro@font } + \@@_select_format: + } + { \BOOM } + } +\cs_new_protected_nopar:Npn \@@_pm_format: + { + \seq_get:NNF \g_@@_star_format_seq \l_@@_format_tl + { + \@@_pop_format: + \seq_gpush:No \g_@@_star_format_seq { \l_@@_format_tl } + } + \cs_if_eq:NNF \macro@font \l_@@_format_tl + { \l_@@_format_tl } + } +\cs_new_protected_nopar:Npn \@@_pop_format: + { + \seq_gpop_left:NN \g_@@_format_seq \l_@@_format_tl + \seq_gput_right:No \g_@@_format_seq { \l_@@_format_tl } + } +\cs_new_protected_nopar:Npn \@@_select_format: + { + \cs_if_eq:NNF \macro@font \l_@@_format_tl + { + \cs_gset_eq:NN \macro@font \l_@@_format_tl + \macro@font + } + } +\tl_new:N \l_@@_format_tl +\seq_new:N \g_@@_format_seq +\seq_new:N \g_@@_star_format_seq +\seq_new:N \g_@@_slash_format_seq +\seq_gput_right:Nn \g_@@_format_seq { \MacroFont } +\seq_gput_right:Nn \g_@@_format_seq { \AltMacroFont } +\cs_set_protected:Npn \MacroFont + { + \linespread { 1 } + \small + \fontseries { \mddefault } + \fontshape { \updefault } + \ttfamily + \ctexdocverbaddon + } +\cs_set_protected:Npn \AltMacroFont + { + \linespread { 1 } + \small + \fontseries { \mddefault } + \fontshape { \sldefault } + \ttfamily + \ctexdocverbaddon + } +\AtBeginDocument + { + \tl_gset:Nx \macro@font + { \seq_item:Nn \g_@@_format_seq { 1 } } + } \cs_new_protected:Npn \@@_output_module:nn #1#2 { \tex_noindent:D \group_begin: - \color {#1} \footnotesize \normalfont \sffamily #2 + #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 } +\cs_new_protected_nopar:Npn \@@_star_color: + { + \seq_gpop:NNTF \g_@@_star_color_seq \current@color + { \set@color } + { \@@_select_color: } + \seq_gpush:No \g_@@_slash_color_seq { \current@color } + } +\cs_new_protected_nopar:Npn \@@_slash_color: + { + \seq_gpop:NNTF \g_@@_slash_color_seq \current@color + { + \set@color + \seq_gpush:No \g_@@_star_color_seq { \current@color } + } + { \BOOM } + } +\cs_new_protected_nopar:Npn \@@_pm_color: + { + \seq_get:NNTF \g_@@_star_color_seq \current@color + { \set@color } + { + \@@_select_color: + \seq_gpush:No \g_@@_star_color_seq { \current@color } + } + } +\seq_new:N \g_@@_star_color_seq +\seq_new:N \g_@@_slash_color_seq +\cs_new_protected_nopar:Npn \@@_select_color: + { \color { guard@series!!+ } } +\definecolorseries { guard@series } + { cmyk } { last } { blue } { purple } +\resetcolorseries [ 3 ] { guard@series } +\definecolor { verb@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 } |