texlive[63891] Master/texmf-dist: ctex (14jul22)

commits+karl at tug.org commits+karl at tug.org
Thu Jul 14 22:18:14 CEST 2022


Revision: 63891
          http://tug.org/svn/texlive?view=revision&revision=63891
Author:   karl
Date:     2022-07-14 22:18:14 +0200 (Thu, 14 Jul 2022)
Log Message:
-----------
ctex (14jul22)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/ctex/ctex.pdf
    trunk/Master/texmf-dist/source/latex/ctex/ctex.dtx
    trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-adobe.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-fandol.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-founder.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-mac.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-ubuntu.tex
    trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-windows.tex
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg
    trunk/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo
    trunk/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo
    trunk/Master/texmf-dist/tex/latex/ctex/ctex.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexart.cls
    trunk/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls
    trunk/Master/texmf-dist/tex/latex/ctex/ctexbook.cls
    trunk/Master/texmf-dist/tex/latex/ctex/ctexcap.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexheading.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexhook.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexrep.cls
    trunk/Master/texmf-dist/tex/latex/ctex/ctexsize.sty
    trunk/Master/texmf-dist/tex/latex/ctex/ctexspa.def
    trunk/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
    trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict
    trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def
    trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhrm.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhsf.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhtt.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhrm.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhsf.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhtt.fd
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macnew.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macold.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def
    trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def
    trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-article.def
    trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-beamer.def
    trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-book.def
    trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-report.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def
    trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def

Modified: trunk/Master/texmf-dist/doc/latex/ctex/ctex.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/ctex/ctex.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/ctex/ctex.dtx	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/source/latex/ctex/ctex.dtx	2022-07-14 20:18:14 UTC (rev 63891)
@@ -443,7 +443,7 @@
 %<class|style|ctexcap|ctexhook|ctexpatch>\NeedsTeXFormat{LaTeX2e}
 %<class>\input{ctexbackend.cfg}
 %<class|style|ctexcap|ctexhook|ctexpatch>\RequirePackage{expl3}
-%<+!driver>\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+%<+!driver>\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
 %<ctex>  {Chinese adapter in LaTeX (CTEX)}
 %<ctex>\ProvidesExplPackage{\ExplFileName}
 %<ctexsize>  {Chinese font size definition (CTEX)}
@@ -530,7 +530,7 @@
 %<founder>\ProvidesExplFile{ctex-fontset-founder.def}
 %<ubuntu>  {Ubuntu fonts definition (CTEX)}
 %<ubuntu>\ProvidesExplFile{ctex-fontset-ubuntu.def}
-%<!driver>  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+%<!driver>  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 %</!(fd|ctexspa|dict|backend)>
 %<c19&rm>\ProvidesFile{c19rm.fd}%
 %<c19&sf>\ProvidesFile{c19sf.fd}%
@@ -548,10 +548,10 @@
 %<backend>\ProvidesFile{ctexbackend.cfg}%
 %<dict&theorem&GBK>\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}%
 %<dict&theorem&UTF8>\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}%
-%<fd>  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
-%<ctexspa>  [2022/06/04 v2.5.9 Space info for CJKpunct (CTEX)]
-%<backend>  [2022/06/04 v2.5.9 Backend configuration file (CTEX)]
-%<dict&theorem>  [2022/06/04 v2.5.9 Chinese translation for theorem name (CTEX)]
+%<fd>  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
+%<ctexspa>  [2022/07/14 v2.5.10 Space info for CJKpunct (CTEX)]
+%<backend>  [2022/07/14 v2.5.10 Backend configuration file (CTEX)]
+%<dict&theorem>  [2022/07/14 v2.5.10 Chinese translation for theorem name (CTEX)]
 %</!(driver|readme|install|zhmap|spa|docstrip)>
 %<*driver>
 \documentclass{ctxdoc}
@@ -575,7 +575,7 @@
 % \changes{v2.4.15}{2019/03/23}{同步 \LaTeXiii{} 2019/03/05。}
 % \changes{v2.5.1}{2020/05/02}{\pkg{zhconv} 更名为 \pkg{ctex-zhconv}。}
 %
-% \CheckSum{6444}
+% \CheckSum{6630}
 %
 % \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
@@ -1608,7 +1608,6 @@
 %
 % 多层选项之间用斜线分开,例如,\opt{part/name} 选项设置 \tn{part} 标题的在数
 % 字前后的名称,而 \opt{section/number} 选项设置 \tn{section} 标题的数字类型。
-% 注意,斜线 |/| 的前后不能有空格或者换行。
 %
 % 使用 \tn{ctexset} 设置多级选项时,还可以在同一个上级选项下设置多个下级选项。
 % 例如,同时设置 |part| 一级标题的 \opt{pagestyle} 选项,|chapter| 一级标题的
@@ -3294,10 +3293,13 @@
 %    \end{macrocode}
 %
 % \changes{v2.5.9}{2022/05/27}{设置消息模块的名字和类型。}
+% \changes{v2.5.10}{2022/06/10}{更新一些内部函数。}
+% \changes{v2.5.10}{2022/07/08}{不直接依赖 \pkg{xparse} 和 \pkg{l3keys2e}。}
 %
 %    \begin{macrocode}
 %<*class|style>
-\RequirePackage { xparse , l3keys2e }
+\cs_if_exist:NF \NewDocumentCommand
+  { \RequirePackage { xparse } }
 %<class>\prop_gput:Nnn \g_msg_module_type_prop { ctex } { Class }
 %<article>\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexart }
 %<book>\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexbook }
@@ -3317,7 +3319,7 @@
 % \changes{v2.4.10}{2017/07/22}{使用 \texttt{lazy} 函数对 Boolean 表达式
 % 进行最小化运算(\LaTeXiii{} 2017/07/19)。}
 %
-% 检查 \pkg{expl3} 和 \pkg{l3keys2e} 的版本。
+% 检查 \pkg{expl3} 的版本。
 %    \begin{macrocode}
 \msg_new:nnnn { ctex } { l3-too-old }
   { Support~package~`#1'~too~old. }
@@ -3326,12 +3328,8 @@
     `l3kernel'~and~`l3packages'\\\\
     using~your~TeX~package~manager~or~from~CTAN.
   }
-\@ifpackagelater { expl3 } { 2020/07/17 } { }
+\@ifpackagelater { expl3 } { 2021/02/10 } { }
   { \msg_error:nnn { ctex } { l3-too-old } { expl3 } }
-%<*class>
-\@ifpackagelater { l3keys2e } { 2015/12/20 } { }
-  { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } }
-%</class>
 %    \end{macrocode}
 %
 % \begin{variable}{\c_@@_engine_str,\c_@@_engine_file_str}
@@ -3561,10 +3559,19 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \begin{variable}{\g_@@_std_options_clist}
+% \begin{variable}{\ctex_load_std_class:n,\g_@@_std_options_clist}
 % 保存传递给标准文档类的选项。
+% 使用 \tn{PassOptionsToClass} 是为了预防可能存在的选项冲突,选项列表展开后再传递。
 %    \begin{macrocode}
 %<*class>
+\cs_new_protected:Npn \ctex_load_std_class:n #1
+  {
+    \tl_const:Nn \c_@@_class_tl {#1}
+    \exp_args:No \PassOptionsToClass
+      { \g_@@_std_options_clist }
+      {#1}
+    \LoadClass {#1}
+  }
 \clist_new:N \g_@@_std_options_clist
 %</class>
 %    \end{macrocode}
@@ -3797,7 +3804,7 @@
     space .choices:nn =
       { true , auto , false }
       {
-        \exp_args:Nx \ctex_at_end:n
+        \exp_args:Ne \ctex_at_end:n
           { \ctex_set:n { space = \l_keys_choice_tl } }
       } ,
     space  .default:n = { true } ,
@@ -3983,7 +3990,12 @@
 % 处理宏包选项。
 %    \begin{macrocode}
 %<*class|style>
-\ProcessKeysOptions { ctex / option }
+\cs_if_exist:NTF \ProcessKeyOptions
+  { \ProcessKeyOptions [ ctex / option ] }
+  {
+    \RequirePackage { l3keys2e }
+    \ProcessKeysOptions { ctex / option }
+  }
 %</class|style>
 %    \end{macrocode}
 %
@@ -4014,27 +4026,19 @@
   }
 %    \end{macrocode}
 %
-% 使用 \tn{PassOptionsToClass} 是为了预防可能存在的选项冲突。
+% 载入标准文档类。
 %    \begin{macrocode}
 %<*article>
-\tl_const:Nn \c_@@_class_tl { article }
-\PassOptionsToClass { \g_@@_std_options_clist } { article }
-\LoadClass { article }
+\ctex_load_std_class:n { article }
 %</article>
 %<*book>
-\tl_const:Nn \c_@@_class_tl { book }
-\PassOptionsToClass { \g_@@_std_options_clist } { book }
-\LoadClass { book }
+\ctex_load_std_class:n { book }
 %</book>
 %<*report>
-\tl_const:Nn \c_@@_class_tl { report }
-\PassOptionsToClass { \g_@@_std_options_clist } { report }
-\LoadClass { report }
+\ctex_load_std_class:n { report }
 %</report>
 %<*beamer>
-\tl_const:Nn \c_@@_class_tl { beamer }
-\PassOptionsToClass { \g_@@_std_options_clist } { beamer }
-\LoadClass { beamer }
+\ctex_load_std_class:n { beamer }
 %</beamer>
 %    \end{macrocode}
 %
@@ -4151,8 +4155,8 @@
           { \tl_gput_right:cn { #1 + #2 } { \ctex_add_cmap:n {#1} } }
       }
   }
-\cs_generate_variant:Nn \ctex_family_cmap:nn { x }
-\cs_new_eq:NN \CTEX at Family@CMap \ctex_family_cmap:xn
+\cs_generate_variant:Nn \ctex_family_cmap:nn { ee }
+\cs_new_eq:NN \CTEX at Family@CMap \ctex_family_cmap:ee
 %    \end{macrocode}
 % \end{macro}
 %
@@ -4160,6 +4164,7 @@
 %
 % \begin{macro}[int]{\ctex_add_cmap:n}
 % \changes{v2.5.7}{2021/06/06}{确保 cmap 文件存在。}
+% \changes{v2.5.10}{2022/07/11}{使用封装好的函数。}
 % 给 |#1| 编码的 CJK 字体加上 CMap。
 %    \begin{macrocode}
 \cs_new_protected:Npn \ctex_add_cmap:n #1
@@ -4179,12 +4184,14 @@
     \exp_args:Ne \file_get_full_name:nNTF
       { \str_lowercase:n {#2} .cmap } \l_@@_cmap_file_tl
       {
-        \tex_immediate:D \tex_pdfobj:D stream ~ file { \l_@@_cmap_file_tl }
+        \pdf_object_unnamed_write:nx
+          { fstream }
+          { { } { \l_@@_cmap_file_tl } }
         \cs_new_protected:Npx #1
           {
             \pdfnobuiltintounicode \tex_font:D
             \tex_pdffontattr:D \tex_font:D
-              { /ToUnicode ~ \int_value:w \tex_pdflastobj:D \c_space_tl 0 ~ R }
+              { /ToUnicode ~ \pdf_object_ref_last: }
           }
       }
       { \cs_new_eq:NN #1 \prg_do_nothing: }
@@ -4196,39 +4203,40 @@
 % \begin{macro}[int]{\DeclareFontFamily}
 % 只在 \pdfLaTeX{} 下加 CMap。如 \pkg{cmap} 宏包被引入,则不重复设置。
 %    \begin{macrocode}
-\group_begin:
-\char_set_catcode_other:N \#
-\sys_if_output_pdf:TF
+\sys_if_output_pdf:T
   {
-    \group_end:
-    \ctex_appto_cmd:NnnTF \DeclareFontFamily { \ExplSyntaxOff }
-      { \CTEX at Family@CMap {#1} {#2} }
+    \exp_args:Nno \use:n
+      { \cs_gset_protected:Npn \DeclareFontFamily #1#2#3 }
       {
-        \ctex_at_end_package:nn { cmap }
-          {
-            \cs_gset_eq:NN \ctex_add_cmap:n \use_none:n
-            \cs_gset_eq:NN \CTEX at Family@CMap \use_none:nn
-          }
+        \DeclareFontFamily {#1} {#2} {#3}
+        \CTEX at Family@CMap  {#1} {#2}
       }
-      { \ctex_patch_failure:N \DeclareFontFamily }
+    \ctex_at_end_package:nn { cmap }
+      {
+        \cs_gset_eq:NN \ctex_add_cmap:n \use_none:n
+        \cs_gset_eq:NN \CTEX at Family@CMap \use_none:nn
+      }
   }
-  { \group_end: }
 %    \end{macrocode}
 % \end{macro}
 %
 % 首先检查选项,决定是否载入 \pkg{zhmCJK} 宏包。
 %    \begin{macrocode}
-\if_bool:N \g_@@_zhmCJK_bool
-  \PassOptionsToPackage { encoding = \g_@@_encoding_tl } { zhmCJK }
-  \RequirePackage { zhmCJK }
+\bool_if:NTF \g_@@_zhmCJK_bool
+  {
+    \exp_args:Ne \PassOptionsToPackage
+      { encoding = \g_@@_encoding_tl }
+      { zhmCJK }
+    \RequirePackage { zhmCJK }
+  }
 %    \end{macrocode}
 % 不载入 \pkg{zhmCJK} 宏包时直接调用 \pkg{CJK} 及相关宏包。
 %    \begin{macrocode}
-\else:
-  \str_if_eq:onTF { \g_@@_encoding_tl } { GBK }
-    { \RequirePackage { CJK } }
-    { \RequirePackage { CJKutf8 } }
-  \RequirePackage { CJKpunct , CJKspace }
+  {
+    \str_if_eq:onTF { \g_@@_encoding_tl } { GBK }
+      { \RequirePackage { CJK } }
+      { \RequirePackage { CJKutf8 } }
+    \RequirePackage { CJKpunct , CJKspace }
 %    \end{macrocode}
 %
 % \changes{v2.4.4}{2016/09/09}{解决 \opt{zhmap} 文件的 \tn{catcode} 问题。}
@@ -4236,21 +4244,46 @@
 % \begin{macro}[int]{\ctex_load_zhmap:nnnn}
 % 载入 \pkg{zhmetrics} 的字体映射文件,同时设置 \tn{CJKrmdefault} 等。
 %    \begin{macrocode}
-  \cs_new_protected:Npn \ctex_load_zhmap:nnnn #1#2#3#4
-    {
-      \tl_set:Nn \CJKrmdefault {#1}
-      \tl_set:Nn \CJKsfdefault {#2}
-      \tl_set:Nn \CJKttdefault {#3}
-      \ctex_set_zhmap:n { \ctex_file_input:n { ctex-zhmap- #4 .tex } }
-    }
-  \@onlypreamble \ctex_load_zhmap:nnnn
+    \cs_new_protected:Npn \ctex_load_zhmap:nnnn #1#2#3#4
+      {
+        \tl_set:Nn \CJKrmdefault {#1}
+        \tl_set:Nn \CJKsfdefault {#2}
+        \tl_set:Nn \CJKttdefault {#3}
+        \ctex_set_zhmap:n { \ctex_file_input:n { ctex-zhmap- #4 .tex } }
+      }
+    \@onlypreamble \ctex_load_zhmap:nnnn
+  }
 %    \end{macrocode}
 % \end{macro}
 %
-% \pkg{zhmCJK} 判断结束。
+% \changes{v2.5.10}{2022/06/10}{取消 \LaTeX\ 2022-06-01 对书名号的定义。}
+%
+% \begin{macro}{\ctex_undeclare_unicode_character:n,\ctex_utfviii_char:n}
+% \LaTeX\ 2022-06-01 将通常用作中文书名号的 U+3008 和 U+3009 分别定义为
+% \tn{textlangle} 和 \tn{textrangle},这个定义会被 \pkg{CJKutf8} 包会优先使用。
+% 我们总是使用中文书名号,需要取消 \LaTeX\ 的定义,作用是局部的,不使用 \cs{cs_undefine:N}。
 %    \begin{macrocode}
-\fi:
+\cs_new_protected:Npn \ctex_undeclare_unicode_character:n #1
+  { \cs_set_eq:cN { u8 : \ctex_utfviii_char:n {#1} } \tex_undefined:D }
+\cs_new:Npn \ctex_utfviii_char:n #1
+  {
+    \exp_last_unbraced:Ne \@@_utfviii_char_aux:nnnn
+      { \char_to_utfviii_bytes:n {#1} }
+  }
+\cs_new:Npn \@@_utfviii_char_aux:nnnn #1#2#3#4
+  {
+    \char_generate:nn {#1} { 12 }
+    \tl_if_empty:nF {#2} { \char_generate:nn {#2} { 12 } }
+    \tl_if_empty:nF {#3} { \char_generate:nn {#3} { 12 } }
+    \tl_if_empty:nF {#4} { \char_generate:nn {#4} { 12 } }
+  }
+\CJKaddEncHook { UTF8 }
+  {
+    \ctex_undeclare_unicode_character:n { "3008 }
+    \ctex_undeclare_unicode_character:n { "3009 }
+  }
 %    \end{macrocode}
+% \end{macro}
 %
 % \begin{macro}[int]{\ctex_CJK_input:n,\CJK at input}
 % 载入 \pkg{CJK} 包的 \file{.enc} 和 \file{.bdg} 等文件时,需要设置 \tn{endlinechar} 为 $-1$。
@@ -4317,8 +4350,11 @@
 %    \begin{macrocode}
 \AtBeginDocument
   {
-    \str_if_eq:eeF { \l_@@_punct_tl } { quanjiao }
-      { \punctstyle { \l_@@_punct_tl } }
+    \use:e
+      {
+        \str_if_eq:nnF { \l_@@_punct_tl } { quanjiao }
+          { \exp_not:N \punctstyle { \l_@@_punct_tl } }
+      }
   }
 %    \end{macrocode}
 %
@@ -4327,22 +4363,8 @@
 \ctex_at_end_preamble:n { \ctex_update_default_family: }
 %    \end{macrocode}
 %
-% 启用中文字符功能。\opt{GBK} 编码时,将汉字的首字节设置为活动字符,并对这些
-% 字符初始化;\opt{UTF8} 编码时,上游宏包已经处理好。
-% \tn{CJK at makeActive} 应该先于 \file{ctex-name-gbk.cfg} 等文件的载入。
-% 注意 \tn{CJK at loadBinding} 需要调用补丁后的 \tn{CJK at input}。使用
-% \pkg{zhmCJK} 时,此功能已经被启用。
-%    \begin{macrocode}
-\reverse_if:N \if_bool:N \g_@@_zhmCJK_bool
-  \str_if_eq:onF { \g_@@_encoding_tl } { UTF8 }
-    {
-      \CJK at makeActive
-      \CJK at loadBinding { standard }
-    }
-%    \end{macrocode}
-%
-% 在导言区结束时调用 \tn{CJK at envStart} 启用完整的中文功能。
-%
+% 从 \LaTeX\ 2018-04-01 开始,传统引擎的默认编码被设置成 UTF-8,
+% 汉字的首字节已经被设置成活动字符,我们无需再使用 \tn{CJK at makeActive} 设置。
 % \tn{CJK at envStart} 的定义是
 % \begin{verbatim}
 %   \def\CJK at envStart#1#2#3{
@@ -4372,19 +4394,20 @@
 % 最里层,最后也就不需要 \tn{clearpage}。\pkg{zhmCJK} 已经提供类似功能。
 % 注意先使用 \cs{ctex_update_default_family:} 更新 \tn{CJKfamilydefault}。
 %    \begin{macrocode}
-  \exp_args:Nx \ctex_at_end_preamble:n
-    {
-      \exp_not:N \CJK at envStart
-        { } { \g_@@_encoding_tl } { \exp_not:N \CJKfamilydefault }
-      \exp_not:N \CJKtilde
-    }
+\bool_if:NF \g_@@_zhmCJK_bool
+  {
+    \str_if_eq:onTF { \g_@@_encoding_tl } { UTF8 }
+      { \CJK at loadBinding { UTF8 } }
+      { \CJK at loadBinding { standard } }
+    \exp_args:Ne \ctex_at_end_preamble:n
+      {
+        \exp_not:N \CJK at envStart
+          { } { \g_@@_encoding_tl } { \exp_not:N \CJKfamilydefault }
+        \exp_not:N \CJKtilde
+      }
+  }
 %    \end{macrocode}
 %
-% \pkg{zhmCJK} 判断结束。
-%    \begin{macrocode}
-\fi:
-%    \end{macrocode}
-%
 % \begin{macro}[int]{\ctex_auto_ignorespaces:}
 % 保存 \tn{CJK@@ignorespaces} 的定义,方便使用。
 %    \begin{macrocode}
@@ -4392,6 +4415,200 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \changes{v2.5.10}{2022/07/08}{解决 \pkg{CJK} 包与 \cs{text_uppercase:n} 等转化函数的冲突。}
+%
+% \begin{macro}{\CJK at X,\CJK at XX,\CJK at XXX,\CJK at XXXX}
+% 最新 \LaTeX\ 中的 \tn{MakeUppercase} 等大小写转化命令被定义为 \LaTeXiii\ 中对应的
+% \cs{text_uppercase:n} 等函数。
+% 它会先将参数用 \cs{text_expand:n} 逐步展开,这与 \pkg{CJK} 包的定义不兼容。
+% 可以有多种方法解决这个冲突,最简单直接的方法是将首字节的活动字符用 \tn{protected} 来定义,
+% 但可能有一定的兼容性问题。保险起见,我们采用将 \tn{CJK at X} 等内部宏转化为 \tn{protected}
+% 宏的方式,并将参数提前由字符转化为数字,避免在移动参数中被进一步展开。
+%    \begin{macrocode}
+\cs_new:Npn \@@_char:N #1
+  { \exp_args:Ne \CTEX at char@n { \int_value:w `#1 } }
+\cs_new:Npn \@@_char:NN #1#2
+  {
+    \token_if_eq_meaning:NNTF #2 \protect
+      { \@@_char_aux:NN #1 }
+      { \@@_char_aux:NN #1#2 }
+  }
+\cs_new:Npn \@@_char_aux:NN #1#2
+  {
+    \exp_last_unbraced:Ne \CTEX at char@nn
+      {
+        { \int_value:w `#1 }
+        { \int_value:w `#2 }
+      }
+  }
+\cs_new:Npn \@@_char:NNN #1#2#3
+  {
+    \token_if_eq_meaning:NNTF #2 \protect
+      { \@@_char_auxi:NNNN #1#3 }
+      { \@@_char_auxii:NNN #1#2#3 }
+  }
+\cs_new:Npn \@@_char_auxi:NNN #1#2#3#4
+  { \@@_char_auxii:NNN #1#2#4 }
+\cs_new:Npn \@@_char_auxii:NNN #1#2#3
+  {
+    \exp_last_unbraced:Ne \CTEX at char@nnn
+      {
+        { \int_value:w `#1 }
+        { \int_value:w `#2 }
+        { \int_value:w `#3 }
+      }
+  }
+\cs_new:Npn \@@_char:NNNN #1#2#3#4
+  {
+    \token_if_eq_meaning:NNTF #2 \protect
+      { \@@_char_auxi:NNNNN #1#3 }
+      { \@@_char_auxii:NNNN #1#2#3#4 }
+  }
+\cs_new:Npn \@@_char_auxi:NNNNN #1#2#3#4#5
+  { \@@_char_auxii:NNNN #1#2#3#5 }
+\cs_new:Npn \@@_char_auxii:NNNN #1#2#3#4
+  {
+    \exp_last_unbraced:Ne \CTEX at char@nnnn
+      {
+        { \int_value:w `#1 }
+        { \int_value:w `#2 }
+        { \int_value:w `#3 }
+        { \int_value:w `#4 }
+      }
+  }
+\cs_gset_eq:NN \CJK at X    \@@_char:N
+\cs_gset_eq:NN \CJK at XX   \@@_char:NN
+\cs_gset_eq:NN \CJK at XXX  \@@_char:NNN
+\cs_gset_eq:NN \CJK at XXXX \@@_char:NNNN
+%    \end{macrocode}
+% \pkg{CJKutf8} 包优先使用 |\u8:xxx| 的 \LaTeX\ 定义。
+%    \begin{macrocode}
+\str_if_eq:onF { \g_@@_encoding_tl } { GBK }
+  {
+    \exp_args:Nne \use:n
+      { \cs_gset:Npn \@@_char_aux:NN #1#2 }
+      {
+        \exp_not:N \cs_if_exist_use:cF
+          { u8: \exp_not:N \tl_to_str:n { #1#2 } }
+          { \exp_not:o { \@@_char_aux:NN {#1} {#2} } }
+      }
+    \exp_args:Nne \use:n
+      { \cs_gset:Npn \@@_char_auxii:NNN #1#2#3 }
+      {
+        \exp_not:N \cs_if_exist_use:cF
+          { u8: \exp_not:N \tl_to_str:n { #1#2#3 } }
+          { \exp_not:o { \@@_char_auxii:NNN {#1} {#2} {#3} } }
+      }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\mule at arg}
+% 处理文档被 |extconv| 等工具预处理过的情况,只考虑最简单的情形。
+%    \begin{macrocode}
+\group_begin:
+\char_set_catcode_active:n { "7F }
+\cs_new:Npn \@@_char_preproc:w #1 ^^7f #2 ^^7f
+  { \exp_args:No \CTEX at char@nn { \int_value:w `#1 } {#2} }
+\cs_gset_eq:NN \mule at arg \@@_char_preproc:w
+\group_end:
+\exp_args:Ne \ctex_at_end:n
+  {
+    \char_set_catcode:nn
+      { \int_value:w "7F }
+      { \char_value_catcode:n { "7F } }
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\CTEX at char@n,\CTEX at char@nn,\CTEX at char@nnn,\CTEX at char@nnnn}
+% 额外加入 \cs{mode_leave_vertical:} 是为了解决某些历史遗留问题。
+%    \begin{macrocode}
+\cs_new_protected:Npn \CTEX at char@n #1
+  {
+    \mode_leave_vertical:
+    \use:c { CJK@ #1 }
+    \CJK at ignorespaces
+  }
+\cs_new_protected:Npn \CTEX at char@nn #1#2
+  {
+    \mode_leave_vertical:
+    \use:c { CJK@ #1 } {#2}
+    \CJK at ignorespaces
+  }
+\cs_new_protected:Npn \CTEX at char@nnn  #1#2#3
+  {
+    \mode_leave_vertical:
+    \use:c { CJK@ #1 } {#2} {#3}
+    \CJK at ignorespaces
+  }
+\cs_new_protected:Npn \CTEX at char@nnnn #1#2#3#4
+  {
+    \mode_leave_vertical:
+    \use:c { CJK@ #1 } {#2} {#3} {#4}
+    \CJK at ignorespaces
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\CTEX at char@nn at n,\CTEX at char@nnn at n,\CTEX at char@nnnn at n}
+% 以下给 \tn{CTEX at char@nn} 等定义在 \cs{text_expand:n} 中的等价形式,
+% 将它们的参数用只有一个参数的 \tn{CTEX at char@nn at n} 等包装起来,
+% 并将 \tn{CTEX at char@nn at n} 等放入排除列表中,避免可能的大小写转化。
+%    \begin{macrocode}
+\cs_new_protected:Npn \CTEX at char@nn at n   #1 { \CTEX at char@nn   #1 }
+\cs_new_protected:Npn \CTEX at char@nnn at n  #1 { \CTEX at char@nnn  #1 }
+\cs_new_protected:Npn \CTEX at char@nnnn at n #1 { \CTEX at char@nnnn #1 }
+\cs_new:Npn \@@_char_wrap:nn #1#2
+  { \CTEX at char@nn at n   { {#1} {#2} } }
+\cs_new:Npn \@@_char_wrap:nnn #1#2#3
+  { \CTEX at char@nnn at n  { {#1} {#2} {#3} } }
+\cs_new:Npn \@@_char_wrap:nnnn #1#2#3#4
+  { \CTEX at char@nnnn at n { {#1} {#2} {#3} {#4} } }
+\tl_put_right:Nn \l_text_case_exclude_arg_tl
+  {
+    \CTEX at char@n
+    \CTEX at char@nn at n
+    \CTEX at char@nnn at n
+    \CTEX at char@nnnn at n
+  }
+\text_declare_expand_equivalent:Nn \CTEX at char@nn   { \@@_char_wrap:nn }
+\text_declare_expand_equivalent:Nn \CTEX at char@nnn  { \@@_char_wrap:nnn }
+\text_declare_expand_equivalent:Nn \CTEX at char@nnnn { \@@_char_wrap:nnnn }
+%    \end{macrocode}
+% 以下给 \tn{CTEX at char@nn at n} 等定义在 \cs{text_purify:n} 中的等价形式,
+% 将参数中的数字转化回字符。
+%    \begin{macrocode}
+\cs_new:Npn \@@_char_raw:n #1
+  { \char_generate:nn {#1} { 12 } }
+\cs_new:Npn \@@_char_raw:nn #1#2
+  {
+    \char_generate:nn {#1} { 12 }
+    \char_generate:nn {#2} { 12 }
+  }
+\cs_new:Npn \@@_char_raw:nnn #1#2#3
+  {
+    \char_generate:nn {#1} { 12 }
+    \char_generate:nn {#2} { 12 }
+    \char_generate:nn {#3} { 12 }
+  }
+\cs_new:Npn \@@_char_raw:nnnn #1#2#3#4
+  {
+    \char_generate:nn {#1} { 12 }
+    \char_generate:nn {#2} { 12 }
+    \char_generate:nn {#3} { 12 }
+    \char_generate:nn {#4} { 12 }
+  }
+\cs_new:Npn \@@_char_raw_nn:n   #1 { \use:e { \@@_char_raw:nn   #1 } }
+\cs_new:Npn \@@_char_raw_nnn:n  #1 { \use:e { \@@_char_raw:nnn  #1 } }
+\cs_new:Npn \@@_char_raw_nnnn:n #1 { \use:e { \@@_char_raw:nnnn #1 } }
+\text_declare_purify_equivalent:Nn \CTEX at char@n      { \@@_char_raw:n }
+\text_declare_purify_equivalent:Nn \CTEX at char@nn at n   { \@@_char_raw_nn:n }
+\text_declare_purify_equivalent:Nn \CTEX at char@nnn at n  { \@@_char_raw_nnn:n }
+\text_declare_purify_equivalent:Nn \CTEX at char@nnnn at n { \@@_char_raw_nnnn:n }
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}[int]{\ctex_ignorespaces_case:N,\ctex_set_ignorespaces:}
 % 设置忽略空格的的方式。根据 \opt{space} 选项的值重定义 \tn{CJK at ignorespaces},
 % 并保存起来供 \tn{CJKhook} 备用。
@@ -4518,7 +4735,7 @@
 % \changes{v2.4.4}{2016/09/12}{不再默认设置 \pkg{xeCJK} 的伪粗体。}
 %    \begin{macrocode}
 \RequirePackage { xeCJK }
-\exp_args:Nx \xeCJKsetup
+\exp_args:Ne \xeCJKsetup
   {
     LoadFandol   = false ,
     PunctStyle   = \l_@@_punct_tl
@@ -5187,7 +5404,7 @@
 \cs_new:Npn \ctex_ltj_if_jfont:nTF #1
   {
     \ctex_ltj_is_kenc:n { \@@_ltj_if_jfont:w #1 / \q_stop }
-    \ifin@ \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn \fi:
+    \legacy_if:nTF { in@ }
   }
 \cs_new:Npn \@@_ltj_if_jfont:w #1 / #2 \q_stop
   {#1}
@@ -6797,60 +7014,63 @@
 % 定义。\pkg{pxeverysel} 宏包取消了检查,但也需要恢复定义,避免重复使用钩子。
 % \pkg{KOMA-Script} 宏包也会进行检查,我们需要小心处理。
 %    \begin{macrocode}
-\if_bool:N \c_@@_everysel_loaded_bool
-  \if_cs_exist:N \@EverySelectfont at Init
-    \group_begin:
-      \cs_set:Npn \@@_tmp:N #1
-        {
-          \tl_set:Nn \l_@@_tmp_tl {#1}
-          \cs_new_eq:NN \CTEX at selectfont@save #1
-          \cs_new_protected:Npn \@@_restore_selectfont:
-            {
-              \cs_if_free:NF \scr at new@selectfont
-                {
+\bool_if:NTF \c_@@_everysel_loaded_bool
+  {
+    \cs_if_free:NF \@EverySelectfont at Init
+      {
+        \group_begin:
+        \cs_set:Npn \@@_tmp:N #1
+          {
+            \tl_set:Nn \l_@@_tmp_tl {#1}
+            \cs_new_eq:NN \CTEX at selectfont@save #1
+            \cs_new_protected:Npn \@@_restore_selectfont:
+              {
+                \cs_if_free:NF \scr at new@selectfont
+                  {
 %    \end{macrocode}
 % \pkg{CJK} 直接修改 \tn{selectfont} 和 \pkg{pxeverysel} 的补丁,
 % 会使 \pkg{KOMA-Script} 的 \tn{par at update} 失效。
 %    \begin{macrocode}
 %<*pdftex|uptex|aptex>
-                  \cs_if_free:NF \par at update
+                    \cs_if_free:NF \par at update
 %<*uptex|aptex>
-                    {
-                      \tl_put_right:Nn \@EverySelectfont at Init
-                        { \tl_put_right:Nn #1 { \par at update } }
-                    }
+                      {
+                        \tl_put_right:Nn \@EverySelectfont at Init
+                          { \tl_put_right:Nn #1 { \par at update } }
+                      }
 %</uptex|aptex>
 %<*pdftex>
-                    { \tl_put_right:Nn #1 { \par at update } }
-                  \cs_set_eq:NN \scr at selectfont \CTEX at selectfont@save
+                      { \tl_put_right:Nn #1 { \par at update } }
+                    \cs_set_eq:NN \scr at selectfont \CTEX at selectfont@save
 %</pdftex>
 %</pdftex|uptex|aptex>
-                  \cs_set_eq:NN \scr at new@selectfont #1
-%<!pdftex>                  \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
-                }
-              \tl_put_left:Nn \@EverySelectfont at Init
-                { \cs_set_eq:NN #1 \CTEX at selectfont@save }
-              \cs_undefine:N \@@_restore_selectfont:
-            }
-        }
-      \ctex_parse_name:NN \@@_tmp:N \selectfont
-    \exp_last_unbraced:NNo \group_end:
-    \ctex_patch_cmd_once:NnnnTF { \l_@@_tmp_tl }
-      { \ExplSyntaxOff }
-      { \size at update }
-      { \CTEX at selectfont@hook \size at update }
-      { \@@_restore_selectfont: }
-      { \ctex_patch_failure:N \selectfont }
-  \fi:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \EverySelectfont }
+                    \cs_set_eq:NN \scr at new@selectfont #1
+%<!pdftex>                    \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
+                  }
+                \tl_put_left:Nn \@EverySelectfont at Init
+                  { \cs_set_eq:NN #1 \CTEX at selectfont@save }
+                \cs_undefine:N \@@_restore_selectfont:
+              }
+          }
+        \ctex_parse_name:NN \@@_tmp:N \selectfont
+      \exp_last_unbraced:NNo \group_end:
+      \ctex_patch_cmd_once:NnnnTF { \l_@@_tmp_tl }
+        { \ExplSyntaxOff }
+        { \size at update }
+        { \CTEX at selectfont@hook \size at update }
+        { \@@_restore_selectfont: }
+        { \ctex_patch_failure:N \selectfont }
+      }
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \EverySelectfont }
+  }
 %    \end{macrocode}
 % 使用 \LaTeX \ 2021-06-01 的新钩子,不使用 \pkg{everysel} 包的情况。
 %    \begin{macrocode}
-\else:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \ctex_gadd_ltxhook:nn { selectfont } }
-\fi:
+  {
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \ctex_gadd_ltxhook:nn { selectfont } }
+  }
 %    \end{macrocode}
 % \end{macro}
 %
@@ -7281,8 +7501,13 @@
 %
 % \subsection{中文数字与日期}
 %
+% 需要注意的是,\pkg{ltkeys} 设置的选项列表是
+% |\@raw at opt@|\meta{\textbackslash @currname}|.|\meta{\textbackslash @currext},
+% 该列表不会将 \tn{PassOptionsToPackage} 传递的选项完全展开。
 %    \begin{macrocode}
-\PassOptionsToPackage { encoding = \g_@@_encoding_tl } { zhnumber }
+\exp_args:Ne \PassOptionsToPackage
+  { encoding = \g_@@_encoding_tl }
+  { zhnumber }
 \RequirePackage { zhnumber }
 %    \end{macrocode}
 %
@@ -7514,11 +7739,11 @@
 %    \begin{macrocode}
 \cs_new_protected:Npn \@@_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l_@@_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l_@@_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -7537,8 +7762,7 @@
         #1 / hang        .bool_set:N = \exp_not:c { CTEX@#1 at hang } ,
         #1 / hang         .initial:n = true ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
-        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline}
-                                       \exp_not:n { ##1##2 } ,
+        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline } ##1##2 ,
         \@@_plus_key_aux:nn {#1} { break } ,
 %</article|book|report>
         \@@_plus_key_aux:nn {#1} { format } ,
@@ -7553,9 +7777,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 %    \end{macrocode}
 % \end{macro}
@@ -7696,6 +7920,18 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \changes{v2.5.10}{2022/06/23}{展开传递 \opt{pagestyle} 的值。}
+%
+% \begin{macro}[int]{\CTEX at setthispagestyle}
+% 将 \verb"\CTEX@(part|chapter)@pagestyle" 展开后再传给 \tn{thispagestyle}。
+%    \begin{macrocode}
+%<*book|report>
+\cs_new_protected:Npn \CTEX at setthispagestyle #1
+  { \exp_args:Ne \thispagestyle { \use:c { CTEX@#1 at pagestyle } } }
+%</book|report>
+%    \end{macrocode}
+% \end{macro}
+%
 % \changes{v2.4.4}{2016/09/18}{提供 \tn{partmark}。}
 % \begin{macro}[int]{\partmark}
 % 提供 \tn{partmark}。
@@ -7791,7 +8027,7 @@
 % \fi
   \CTEX at part@break
 % \thispagestyle{plain}%
-  \thispagestyle{\CTEX at part@pagestyle}%
+  \CTEX at setthispagestyle{part}%
   \if at twocolumn
     \onecolumn
     \@tempswatrue
@@ -7966,7 +8202,7 @@
 % \if at openright\cleardoublepage\else\clearpage\fi
 % \thispagestyle{plain}%
   \CTEX at chapter@break
-  \thispagestyle{\CTEX at chapter@pagestyle}%
+  \CTEX at setthispagestyle{chapter}%
   \global\@topnum\z@
 % \@afterindentfalse
   \ifodd \CTEX at chapter@afterindent
@@ -8459,20 +8695,22 @@
 \cs_new_protected:Npn \CTEX at hyperheadinghook
   {
     \group_begin:
-      \ifHy at implicit
-        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
-        \seq_map_inline:Nn \c_@@_headings_cs_seq
-          {
-            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
-              {
-                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
-                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
-              }
-          }
-      \else:
-        \seq_map_inline:Nn \c_@@_headings_cs_seq
-          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
-      \fi:
+      \legacy_if:nTF { Hy at implicit }
+        {
+          \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+          \seq_map_inline:Nn \c_@@_headings_cs_seq
+            {
+              \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+                {
+                  \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                  \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+                }
+            }
+        }
+        {
+          \seq_map_inline:Nn \c_@@_headings_cs_seq
+            { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+        }
     \group_end:
   }
 %    \end{macrocode}
@@ -8657,7 +8895,7 @@
         \CTEX at updatettlifname
       }
     \cs_new_protected:Npn \CTEX at updatettlifname
-      { \ifttl at label \CTEX at ifnametrue \else: \CTEX at ifnamefalse \fi: }
+      { \legacy_if:nTF { ttl at label } { \CTEX at ifnametrue } { \CTEX at ifnamefalse } }
   }
 %    \end{macrocode}
 %
@@ -8813,21 +9051,23 @@
 % \changes{v2.4.11}{2017/09/13}{补充页眉空格。}
 %    \begin{macrocode}
 %<*article>
-\if at twoside
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
-    { \CTEXifname { \CTEXthesubsection \quad } { } }
-\else:
+\legacy_if:nTF { @twoside }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+      { \CTEXifname { \CTEXthesubsection \quad } { } }
+  }
 %    \end{macrocode}
 % 不知为何,标准文档类此处对 \texttt{secnumdepth} 的判断为 $0$,与 \tn{section} 的层次 $1$ 不符。
 %    \begin{macrocode}
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \m at ne \thesection \quad \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-\fi:
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \m at ne \thesection \quad \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+  }
 %</article>
 %<*book|report>
 \ctex_patch_cmd:Nnn \ps at headings
@@ -8839,11 +9079,12 @@
 %<book>    \fi \fi
   }
   { \CTEXifname { \CTEXthechapter \quad } { } }
-\if at twoside
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-\fi:
+\legacy_if:nT { @twoside }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+  }
 %</book|report>
 %    \end{macrocode}
 % \end{macro}
@@ -8877,18 +9118,20 @@
     \@ifpackagewith { fancyhdr } { headings }
       {
 %<*article>
-        \if at twoside
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
-            { \CTEXifname { \CTEXthesubsection \quad } { } }
-        \else:
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-        \fi:
+        \legacy_if:nTF { @twoside }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+              { \CTEXifname { \CTEXthesubsection \quad } { } }
+          }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+          }
 %</article>
 %<*book|report>
         \ctex_patch_cmd:Nnn \ps at headings
@@ -8900,11 +9143,12 @@
 %<book>            \fi \fi
           }
           { \CTEXifname { \CTEXthechapter \quad } { } }
-        \if at twoside
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-        \fi:
+        \legacy_if:nT { @twoside }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+          }
 %</book|report>
       }
       { }
@@ -9627,8 +9871,7 @@
 % 不使用标题定义时的通用设置,注意此处 \cs{c_@@_std_class_tl} 可能没有定义。
 %    \begin{macrocode}
 %<*generic>
-\tl_set:Nn \l_@@_tmp_tl { beamer }
-\tl_if_eq:NNTF \c_@@_std_class_tl \l_@@_tmp_tl
+\tl_if_eq:NnTF \c_@@_std_class_tl { beamer }
   {
     \str_if_eq:onTF { \g_@@_encoding_tl } { GBK }
       {
@@ -9714,7 +9957,7 @@
 \seq_new:N \c_@@_font_size_seq
 \cs_new_protected:Npn \@@_save_font_size:nn #1#2
   {
-    \use:x
+    \use:e
       {
         \prop_gput:Nnn \exp_not:N \c_@@_font_size_prop {#1}
           {
@@ -10080,7 +10323,7 @@
           {
             \file_if_exist:nF { ctex-fontset- \g_@@_fontset_tl .def }
               {
-                \use:x
+                \use:e
                   {
                     \ctex_detect_platform:
                     \msg_error:nnxx { ctex } { fontset-not-found }
@@ -10944,17 +11187,17 @@
 % 文件标识信息。
 %    \begin{macrocode}
 %<adobe>\ProvidesFile{ctex-zhmap-adobe.tex}%
-%<adobe>  [2022/06/04 v2.5.9 Adobe font map loader for DVIPDFMx (CTEX)]
+%<adobe>  [2022/07/14 v2.5.10 Adobe font map loader for DVIPDFMx (CTEX)]
 %<fandol>\ProvidesFile{ctex-zhmap-fandol.tex}%
-%<fandol>  [2022/06/04 v2.5.9 Fandol font map loader for DVIPDFMx (CTEX)]
+%<fandol>  [2022/07/14 v2.5.10 Fandol font map loader for DVIPDFMx (CTEX)]
 %<founder>\ProvidesFile{ctex-zhmap-founder.tex}%
-%<founder>  [2022/06/04 v2.5.9 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
+%<founder>  [2022/07/14 v2.5.10 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
 %<mac>\ProvidesFile{ctex-zhmap-mac.tex}%
-%<mac>  [2022/06/04 v2.5.9 Mac font map loader for DVIPDFMx (CTEX)]
+%<mac>  [2022/07/14 v2.5.10 Mac font map loader for DVIPDFMx (CTEX)]
 %<ubuntu>\ProvidesFile{ctex-zhmap-ubuntu.tex}%
-%<ubuntu>  [2022/06/04 v2.5.9 Ubuntu font map loader for DVIPDFMx (CTEX)]
+%<ubuntu>  [2022/07/14 v2.5.10 Ubuntu font map loader for DVIPDFMx (CTEX)]
 %<windows>\ProvidesFile{ctex-zhmap-windows.tex}%
-%<windows>  [2022/06/04 v2.5.9 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
+%<windows>  [2022/07/14 v2.5.10 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
 %    \end{macrocode}
 %
 % \paragraph{\pkg{ctex-zhmap-adobe.tex}}
@@ -11885,7 +12128,7 @@
           { \cs_if_exist_p:c { #1##3 } }
           {
             \group_begin:
-            \use:x
+            \use:e
               {
                 \group_end:
                 \@@_parse_name:nNNNnN
@@ -11927,7 +12170,7 @@
       }
     \cs_new:Npn \@@_parse_name:w ##1 #3 ~ ##2 #2 ##3 \q_stop { ##1##2 }
   }
-\use:x
+\use:e
   {
     \@@_tmp:w
       { \c_backslash_str }
@@ -12004,7 +12247,7 @@
     \@@_patch_rescan:NNn \l_@@_prefix_tl      \l_@@_prefix_str      {#2}
     \@@_patch_rescan:NNn \l_@@_parameter_tl   \l_@@_parameter_str   {#2}
     \@@_patch_rescan:NNn \l_@@_replacement_tl \l_@@_replacement_str {#2}
-    \use:x
+    \use:e
       {
         \exp_not:o { \l_@@_prefix_tl } \tex_def:D \exp_not:N #1
           \exp_not:o { \l_@@_parameter_tl }
@@ -12031,7 +12274,7 @@
     \group_end:
     \ctex_if_rescanable:NnTF #1 {#3}
       {
-        \use:x
+        \use:e
           {
             \@@_patch_replace:nnnTF {#2}
               { \tl_to_str:n {#4} }

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-adobe.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-adobe.tex	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-adobe.tex	2022-07-14 20:18:14 UTC (rev 63891)
@@ -75,7 +75,7 @@
 \fi
 \endgroup
 \ProvidesFile{ctex-zhmap-adobe.tex}%
-  [2022/06/04 v2.5.9 Adobe font map loader for DVIPDFMx (CTEX)]
+  [2022/07/14 v2.5.10 Adobe font map loader for DVIPDFMx (CTEX)]
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts
 \else

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-fandol.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-fandol.tex	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-fandol.tex	2022-07-14 20:18:14 UTC (rev 63891)
@@ -75,7 +75,7 @@
 \fi
 \endgroup
 \ProvidesFile{ctex-zhmap-fandol.tex}%
-  [2022/06/04 v2.5.9 Fandol font map loader for DVIPDFMx (CTEX)]
+  [2022/07/14 v2.5.10 Fandol font map loader for DVIPDFMx (CTEX)]
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts
 \else

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-founder.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-founder.tex	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-founder.tex	2022-07-14 20:18:14 UTC (rev 63891)
@@ -75,7 +75,7 @@
 \fi
 \endgroup
 \ProvidesFile{ctex-zhmap-founder.tex}%
-  [2022/06/04 v2.5.9 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2022/07/14 v2.5.10 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
 \ifzhmappdf
   \pdfmapline{=gbk at UGBK@          <FZSSK.TTF}
   \pdfmapline{=gbksong at UGBK@      <FZSSK.TTF}

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-mac.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-mac.tex	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-mac.tex	2022-07-14 20:18:14 UTC (rev 63891)
@@ -75,7 +75,7 @@
 \fi
 \endgroup
 \ProvidesFile{ctex-zhmap-mac.tex}%
-  [2022/06/04 v2.5.9 Mac font map loader for DVIPDFMx (CTEX)]
+  [2022/07/14 v2.5.10 Mac font map loader for DVIPDFMx (CTEX)]
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts
 \else

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-ubuntu.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-ubuntu.tex	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-ubuntu.tex	2022-07-14 20:18:14 UTC (rev 63891)
@@ -75,7 +75,7 @@
 \fi
 \endgroup
 \ProvidesFile{ctex-zhmap-ubuntu.tex}%
-  [2022/06/04 v2.5.9 Ubuntu font map loader for DVIPDFMx (CTEX)]
+  [2022/07/14 v2.5.10 Ubuntu font map loader for DVIPDFMx (CTEX)]
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts
 \else

Modified: trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-windows.tex
===================================================================
--- trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-windows.tex	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/generic/ctex/zhmap/ctex-zhmap-windows.tex	2022-07-14 20:18:14 UTC (rev 63891)
@@ -75,7 +75,7 @@
 \fi
 \endgroup
 \ProvidesFile{ctex-zhmap-windows.tex}%
-  [2022/06/04 v2.5.9 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2022/07/14 v2.5.10 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
 \ifzhmappdf
   \pdfmapline{=gbk at UGBK@          <simsun.ttc}
   \pdfmapline{=gbksong at UGBK@      <simsun.ttc}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Caption with encoding GBK (CTEX)}
 \ProvidesExplFile{ctex-name-gbk.cfg}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \keys_set_known:nn { ctex }
   {
     contentsname   = Ŀ¼ ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Caption with encoding UTF-8 (CTEX)}
 \ProvidesExplFile{ctex-name-utf8.cfg}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \keys_set_known:nn { ctex }
   {
     contentsname   = 目录 ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Configuration file (CTEX)}
 \ProvidesExplFile{\ExplFileName.cfg}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 %%
 %% 
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{ctexbackend.cfg}%
-  [2022/06/04 v2.5.9 Backend configuration file (CTEX)]
+  [2022/07/14 v2.5.10 Backend configuration file (CTEX)]
 \begingroup
 \expandafter\ifx\csname Umathchardef\endcsname\relax
 \else\expandafter\endgroup\expandafter\endinput\fi

Modified: trunk/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Option configuration file (CTEX)}
 \ProvidesExplFile{ctexopts.cfg}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 %%
 %% \ctex_set:nn { option } { fontset = windows }
 %% 

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {c5size option (CTEX)}
 \ProvidesExplFile{ctex-c5size.clo}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set_font_size:Nnn \normalsize { 5 }
   {
     \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {cs4size option (CTEX)}
 \ProvidesExplFile{ctex-cs4size.clo}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set_font_size:Nnn \normalsize { -4 }
   {
     \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctex.sty	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctex.sty	2022-07-14 20:18:14 UTC (rev 63891)
@@ -26,11 +26,12 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter in LaTeX (CTEX)}
 \ProvidesExplPackage{\ExplFileName}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
-\RequirePackage { xparse , l3keys2e }
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
+\cs_if_exist:NF \NewDocumentCommand
+  { \RequirePackage { xparse } }
 \msg_new:nnnn { ctex } { l3-too-old }
   { Support~package~`#1'~too~old. }
   {
@@ -38,7 +39,7 @@
     `l3kernel'~and~`l3packages'\\\\
     using~your~TeX~package~manager~or~from~CTAN.
   }
-\@ifpackagelater { expl3 } { 2020/07/17 } { }
+\@ifpackagelater { expl3 } { 2021/02/10 } { }
   { \msg_error:nnn { ctex } { l3-too-old } { expl3 } }
 \str_const:Nx \c__ctex_engine_str
   { \cs_if_exist:NTF \ngostype { aptex } { \c_sys_engine_str } }
@@ -233,7 +234,7 @@
     space .choices:nn =
       { true , auto , false }
       {
-        \exp_args:Nx \ctex_at_end:n
+        \exp_args:Ne \ctex_at_end:n
           { \ctex_set:n { space = \l_keys_choice_tl } }
       } ,
     space  .default:n = { true } ,
@@ -305,7 +306,12 @@
 \exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl }
 \tl_clear:N \l__ctex_tmp_tl
 \ctex_file_input:n { ctexopts.cfg }
-\ProcessKeysOptions { ctex / option }
+\cs_if_exist:NTF \ProcessKeyOptions
+  { \ProcessKeyOptions [ ctex / option ] }
+  {
+    \RequirePackage { l3keys2e }
+    \ProcessKeysOptions { ctex / option }
+  }
 \msg_new:nnn { ctex } { pdftex-utf8 }
   { UTF8~will~be~used~as~the~default~encoding. }
 \tl_if_empty:NT \g__ctex_encoding_tl
@@ -487,7 +493,9 @@
       { \parindent is~set~to~0pt. }
     \dim_zero:N \parindent
   }
-\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber }
+\exp_args:Ne \PassOptionsToPackage
+  { encoding = \g__ctex_encoding_tl }
+  { zhnumber }
 \RequirePackage { zhnumber }
 \cs_new:Npn \chinese { \zhnum_counter:n }
 \cs_new_eq:NN \@chinese \@zhnum
@@ -620,7 +628,7 @@
 \seq_new:N \c__ctex_font_size_seq
 \cs_new_protected:Npn \__ctex_save_font_size:nn #1#2
   {
-    \use:x
+    \use:e
       {
         \prop_gput:Nnn \exp_not:N \c__ctex_font_size_prop {#1}
           {
@@ -761,7 +769,7 @@
           {
             \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def }
               {
-                \use:x
+                \use:e
                   {
                     \ctex_detect_platform:
                     \msg_error:nnxx { ctex } { fontset-not-found }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexart.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexart.cls	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexart.cls	2022-07-14 20:18:14 UTC (rev 63891)
@@ -27,11 +27,12 @@
 \NeedsTeXFormat{LaTeX2e}
 \input{ctexbackend.cfg}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter for class article (CTEX)}
 \ProvidesExplClass{ctexart}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
-\RequirePackage { xparse , l3keys2e }
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
+\cs_if_exist:NF \NewDocumentCommand
+  { \RequirePackage { xparse } }
 \prop_gput:Nnn \g_msg_module_type_prop { ctex } { Class }
 \prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexart }
 \msg_new:nnnn { ctex } { l3-too-old }
@@ -41,10 +42,8 @@
     `l3kernel'~and~`l3packages'\\\\
     using~your~TeX~package~manager~or~from~CTAN.
   }
-\@ifpackagelater { expl3 } { 2020/07/17 } { }
+\@ifpackagelater { expl3 } { 2021/02/10 } { }
   { \msg_error:nnn { ctex } { l3-too-old } { expl3 } }
-\@ifpackagelater { l3keys2e } { 2015/12/20 } { }
-  { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } }
 \str_const:Nx \c__ctex_engine_str
   { \cs_if_exist:NTF \ngostype { aptex } { \c_sys_engine_str } }
 \msg_new:nnnn { ctex } { engine-not-supported }
@@ -122,6 +121,14 @@
 \cs_new_eq:NN \ctex_if_autoindent_touched:F \use:n
 \cs_new_eq:NN \ctex_zhmap_case:nnn \use_ii:nnn
 \cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass }
+\cs_new_protected:Npn \ctex_load_std_class:n #1
+  {
+    \tl_const:Nn \c__ctex_class_tl {#1}
+    \exp_args:No \PassOptionsToClass
+      { \g__ctex_std_options_clist }
+      {#1}
+    \LoadClass {#1}
+  }
 \clist_new:N \g__ctex_std_options_clist
 \msg_new:nnn { ctex } { invalid-option }
   { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. }
@@ -241,7 +248,7 @@
     space .choices:nn =
       { true , auto , false }
       {
-        \exp_args:Nx \ctex_at_end:n
+        \exp_args:Ne \ctex_at_end:n
           { \ctex_set:n { space = \l_keys_choice_tl } }
       } ,
     space  .default:n = { true } ,
@@ -321,7 +328,12 @@
       { \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } }
   }
 \ctex_file_input:n { ctexopts.cfg }
-\ProcessKeysOptions { ctex / option }
+\cs_if_exist:NTF \ProcessKeyOptions
+  { \ProcessKeyOptions [ ctex / option ] }
+  {
+    \RequirePackage { l3keys2e }
+    \ProcessKeysOptions { ctex / option }
+  }
 \msg_new:nnn { ctex } { pdftex-utf8 }
   { UTF8~will~be~used~as~the~default~encoding. }
 \tl_if_empty:NT \g__ctex_encoding_tl
@@ -335,9 +347,7 @@
     { 0 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } }
     { 1 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } }
   }
-\tl_const:Nn \c__ctex_class_tl { article }
-\PassOptionsToClass { \g__ctex_std_options_clist } { article }
-\LoadClass { article }
+\ctex_load_std_class:n { article }
 \@ifpackageloaded { hyperref }
   {
     \cs_new_protected:Npn \ctex_hypersetup:n #1
@@ -511,7 +521,9 @@
       { \parindent is~set~to~0pt. }
     \dim_zero:N \parindent
   }
-\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber }
+\exp_args:Ne \PassOptionsToPackage
+  { encoding = \g__ctex_encoding_tl }
+  { zhnumber }
 \RequirePackage { zhnumber }
 \cs_new:Npn \chinese { \zhnum_counter:n }
 \cs_new_eq:NN \@chinese \@zhnum
@@ -607,11 +619,11 @@
   }
 \cs_new_protected:Npn \__ctex_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l__ctex_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -629,8 +641,7 @@
         #1 / hang        .bool_set:N = \exp_not:c { CTEX@#1 at hang } ,
         #1 / hang         .initial:n = true ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
-        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline}
-                                       \exp_not:n { ##1##2 } ,
+        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline } ##1##2 ,
         \__ctex_plus_key_aux:nn {#1} { break } ,
         \__ctex_plus_key_aux:nn {#1} { format } ,
         \__ctex_plus_key_aux:nn {#1} { nameformat } ,
@@ -644,9 +655,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 \NewDocumentCommand \ctex_assign_heading_name:nn
   { m > { \SplitArgument { 1 } { , } } +m }
@@ -970,20 +981,22 @@
 \cs_new_protected:Npn \CTEX at hyperheadinghook
   {
     \group_begin:
-      \ifHy at implicit
-        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          {
-            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
-              {
-                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
-                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
-              }
-          }
-      \else:
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
-      \fi:
+      \legacy_if:nTF { Hy at implicit }
+        {
+          \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            {
+              \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+                {
+                  \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                  \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+                }
+            }
+        }
+        {
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+        }
     \group_end:
   }
 \ctex_at_end_package:nn { hyperref }
@@ -1108,7 +1121,7 @@
         \CTEX at updatettlifname
       }
     \cs_new_protected:Npn \CTEX at updatettlifname
-      { \ifttl at label \CTEX at ifnametrue \else: \CTEX at ifnamefalse \fi: }
+      { \legacy_if:nTF { ttl at label } { \CTEX at ifnametrue } { \CTEX at ifnamefalse } }
   }
 \group_begin:
 \char_set_catcode_other:N \#
@@ -1196,18 +1209,20 @@
   }
 \__ctex_patch_toc_width:n { tocloft  }
 \__ctex_patch_toc_width:n { titletoc }
-\if at twoside
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
-    { \CTEXifname { \CTEXthesubsection \quad } { } }
-\else:
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \m at ne \thesection \quad \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-\fi:
+\legacy_if:nTF { @twoside }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+      { \CTEXifname { \CTEXthesubsection \quad } { } }
+  }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \m at ne \thesection \quad \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+  }
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \f at nch@initialise
@@ -1225,18 +1240,20 @@
     \f at nch@initialise
     \@ifpackagewith { fancyhdr } { headings }
       {
-        \if at twoside
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
-            { \CTEXifname { \CTEXthesubsection \quad } { } }
-        \else:
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-        \fi:
+        \legacy_if:nTF { @twoside }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+              { \CTEXifname { \CTEXthesubsection \quad } { } }
+          }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+          }
       }
       { }
   }
@@ -1340,7 +1357,7 @@
 \seq_new:N \c__ctex_font_size_seq
 \cs_new_protected:Npn \__ctex_save_font_size:nn #1#2
   {
-    \use:x
+    \use:e
       {
         \prop_gput:Nnn \exp_not:N \c__ctex_font_size_prop {#1}
           {
@@ -1481,7 +1498,7 @@
           {
             \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def }
               {
-                \use:x
+                \use:e
                   {
                     \ctex_detect_platform:
                     \msg_error:nnxx { ctex } { fontset-not-found }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls	2022-07-14 20:18:14 UTC (rev 63891)
@@ -27,11 +27,12 @@
 \NeedsTeXFormat{LaTeX2e}
 \input{ctexbackend.cfg}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter for class beamer (CTEX)}
 \ProvidesExplClass{ctexbeamer}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
-\RequirePackage { xparse , l3keys2e }
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
+\cs_if_exist:NF \NewDocumentCommand
+  { \RequirePackage { xparse } }
 \prop_gput:Nnn \g_msg_module_type_prop { ctex } { Class }
 \prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexbeamer }
 \msg_new:nnnn { ctex } { l3-too-old }
@@ -41,10 +42,8 @@
     `l3kernel'~and~`l3packages'\\\\
     using~your~TeX~package~manager~or~from~CTAN.
   }
-\@ifpackagelater { expl3 } { 2020/07/17 } { }
+\@ifpackagelater { expl3 } { 2021/02/10 } { }
   { \msg_error:nnn { ctex } { l3-too-old } { expl3 } }
-\@ifpackagelater { l3keys2e } { 2015/12/20 } { }
-  { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } }
 \str_const:Nx \c__ctex_engine_str
   { \cs_if_exist:NTF \ngostype { aptex } { \c_sys_engine_str } }
 \msg_new:nnnn { ctex } { engine-not-supported }
@@ -120,6 +119,14 @@
 \cs_new_eq:NN \ctex_if_autoindent_touched:F \use:n
 \cs_new_eq:NN \ctex_zhmap_case:nnn \use_ii:nnn
 \cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass }
+\cs_new_protected:Npn \ctex_load_std_class:n #1
+  {
+    \tl_const:Nn \c__ctex_class_tl {#1}
+    \exp_args:No \PassOptionsToClass
+      { \g__ctex_std_options_clist }
+      {#1}
+    \LoadClass {#1}
+  }
 \clist_new:N \g__ctex_std_options_clist
 \msg_new:nnn { ctex } { invalid-option }
   { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. }
@@ -239,7 +246,7 @@
     space .choices:nn =
       { true , auto , false }
       {
-        \exp_args:Nx \ctex_at_end:n
+        \exp_args:Ne \ctex_at_end:n
           { \ctex_set:n { space = \l_keys_choice_tl } }
       } ,
     space  .default:n = { true } ,
@@ -313,7 +320,12 @@
       { \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } }
   }
 \ctex_file_input:n { ctexopts.cfg }
-\ProcessKeysOptions { ctex / option }
+\cs_if_exist:NTF \ProcessKeyOptions
+  { \ProcessKeyOptions [ ctex / option ] }
+  {
+    \RequirePackage { l3keys2e }
+    \ProcessKeysOptions { ctex / option }
+  }
 \msg_new:nnn { ctex } { pdftex-utf8 }
   { UTF8~will~be~used~as~the~default~encoding. }
 \tl_if_empty:NT \g__ctex_encoding_tl
@@ -327,9 +339,7 @@
     { 0 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } }
     { 1 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } }
   }
-\tl_const:Nn \c__ctex_class_tl { beamer }
-\PassOptionsToClass { \g__ctex_std_options_clist } { beamer }
-\LoadClass { beamer }
+\ctex_load_std_class:n { beamer }
 \@ifpackageloaded { hyperref }
   {
     \cs_new_protected:Npn \ctex_hypersetup:n #1
@@ -503,7 +513,9 @@
       { \parindent is~set~to~0pt. }
     \dim_zero:N \parindent
   }
-\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber }
+\exp_args:Ne \PassOptionsToPackage
+  { encoding = \g__ctex_encoding_tl }
+  { zhnumber }
 \RequirePackage { zhnumber }
 \cs_new:Npn \chinese { \zhnum_counter:n }
 \cs_new_eq:NN \@chinese \@zhnum
@@ -599,11 +611,11 @@
   }
 \cs_new_protected:Npn \__ctex_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l__ctex_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -628,9 +640,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 \NewDocumentCommand \ctex_assign_heading_name:nn
   { m > { \SplitArgument { 1 } { , } } +m }
@@ -813,7 +825,7 @@
 \seq_new:N \c__ctex_font_size_seq
 \cs_new_protected:Npn \__ctex_save_font_size:nn #1#2
   {
-    \use:x
+    \use:e
       {
         \prop_gput:Nnn \exp_not:N \c__ctex_font_size_prop {#1}
           {
@@ -954,7 +966,7 @@
           {
             \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def }
               {
-                \use:x
+                \use:e
                   {
                     \ctex_detect_platform:
                     \msg_error:nnxx { ctex } { fontset-not-found }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexbook.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexbook.cls	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexbook.cls	2022-07-14 20:18:14 UTC (rev 63891)
@@ -27,11 +27,12 @@
 \NeedsTeXFormat{LaTeX2e}
 \input{ctexbackend.cfg}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter for class book (CTEX)}
 \ProvidesExplClass{ctexbook}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
-\RequirePackage { xparse , l3keys2e }
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
+\cs_if_exist:NF \NewDocumentCommand
+  { \RequirePackage { xparse } }
 \prop_gput:Nnn \g_msg_module_type_prop { ctex } { Class }
 \prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexbook }
 \msg_new:nnnn { ctex } { l3-too-old }
@@ -41,10 +42,8 @@
     `l3kernel'~and~`l3packages'\\\\
     using~your~TeX~package~manager~or~from~CTAN.
   }
-\@ifpackagelater { expl3 } { 2020/07/17 } { }
+\@ifpackagelater { expl3 } { 2021/02/10 } { }
   { \msg_error:nnn { ctex } { l3-too-old } { expl3 } }
-\@ifpackagelater { l3keys2e } { 2015/12/20 } { }
-  { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } }
 \str_const:Nx \c__ctex_engine_str
   { \cs_if_exist:NTF \ngostype { aptex } { \c_sys_engine_str } }
 \msg_new:nnnn { ctex } { engine-not-supported }
@@ -122,6 +121,14 @@
 \cs_new_eq:NN \ctex_if_autoindent_touched:F \use:n
 \cs_new_eq:NN \ctex_zhmap_case:nnn \use_ii:nnn
 \cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass }
+\cs_new_protected:Npn \ctex_load_std_class:n #1
+  {
+    \tl_const:Nn \c__ctex_class_tl {#1}
+    \exp_args:No \PassOptionsToClass
+      { \g__ctex_std_options_clist }
+      {#1}
+    \LoadClass {#1}
+  }
 \clist_new:N \g__ctex_std_options_clist
 \msg_new:nnn { ctex } { invalid-option }
   { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. }
@@ -241,7 +248,7 @@
     space .choices:nn =
       { true , auto , false }
       {
-        \exp_args:Nx \ctex_at_end:n
+        \exp_args:Ne \ctex_at_end:n
           { \ctex_set:n { space = \l_keys_choice_tl } }
       } ,
     space  .default:n = { true } ,
@@ -321,7 +328,12 @@
       { \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } }
   }
 \ctex_file_input:n { ctexopts.cfg }
-\ProcessKeysOptions { ctex / option }
+\cs_if_exist:NTF \ProcessKeyOptions
+  { \ProcessKeyOptions [ ctex / option ] }
+  {
+    \RequirePackage { l3keys2e }
+    \ProcessKeysOptions { ctex / option }
+  }
 \msg_new:nnn { ctex } { pdftex-utf8 }
   { UTF8~will~be~used~as~the~default~encoding. }
 \tl_if_empty:NT \g__ctex_encoding_tl
@@ -335,9 +347,7 @@
     { 0 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } }
     { 1 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } }
   }
-\tl_const:Nn \c__ctex_class_tl { book }
-\PassOptionsToClass { \g__ctex_std_options_clist } { book }
-\LoadClass { book }
+\ctex_load_std_class:n { book }
 \@ifpackageloaded { hyperref }
   {
     \cs_new_protected:Npn \ctex_hypersetup:n #1
@@ -511,7 +521,9 @@
       { \parindent is~set~to~0pt. }
     \dim_zero:N \parindent
   }
-\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber }
+\exp_args:Ne \PassOptionsToPackage
+  { encoding = \g__ctex_encoding_tl }
+  { zhnumber }
 \RequirePackage { zhnumber }
 \cs_new:Npn \chinese { \zhnum_counter:n }
 \cs_new_eq:NN \@chinese \@zhnum
@@ -608,11 +620,11 @@
   }
 \cs_new_protected:Npn \__ctex_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l__ctex_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -630,8 +642,7 @@
         #1 / hang        .bool_set:N = \exp_not:c { CTEX@#1 at hang } ,
         #1 / hang         .initial:n = true ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
-        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline}
-                                       \exp_not:n { ##1##2 } ,
+        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline } ##1##2 ,
         \__ctex_plus_key_aux:nn {#1} { break } ,
         \__ctex_plus_key_aux:nn {#1} { format } ,
         \__ctex_plus_key_aux:nn {#1} { nameformat } ,
@@ -645,9 +656,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 \NewDocumentCommand \ctex_assign_heading_name:nn
   { m > { \SplitArgument { 1 } { , } } +m }
@@ -711,6 +722,8 @@
 \cs_new_protected:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\cs_new_protected:Npn \CTEX at setthispagestyle #1
+  { \exp_args:Ne \thispagestyle { \use:c { CTEX@#1 at pagestyle } } }
 \ProvideDocumentCommand \partmark { m }
   { \markboth { } { } }
 \cs_new_eq:NN \CTEXifname \use_ii:nn
@@ -737,7 +750,7 @@
   { \addcontentsline { toc } {#1} { \use:c { CTEX@#1 at tocline } {#1} {#2} } }
 \renewcommand\part{%
   \CTEX at part@break
-  \thispagestyle{\CTEX at part@pagestyle}%
+  \CTEX at setthispagestyle{part}%
   \if at twocolumn
     \onecolumn
     \@tempswatrue
@@ -802,7 +815,7 @@
   \fi}
 \renewcommand\chapter{%
   \CTEX at chapter@break
-  \thispagestyle{\CTEX at chapter@pagestyle}%
+  \CTEX at setthispagestyle{chapter}%
   \global\@topnum\z@
   \ifodd \CTEX at chapter@afterindent
     \@afterindenttrue
@@ -1096,20 +1109,22 @@
 \cs_new_protected:Npn \CTEX at hyperheadinghook
   {
     \group_begin:
-      \ifHy at implicit
-        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          {
-            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
-              {
-                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
-                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
-              }
-          }
-      \else:
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
-      \fi:
+      \legacy_if:nTF { Hy at implicit }
+        {
+          \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            {
+              \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+                {
+                  \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                  \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+                }
+            }
+        }
+        {
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+        }
     \group_end:
   }
 \ctex_at_end_package:nn { hyperref }
@@ -1235,7 +1250,7 @@
         \CTEX at updatettlifname
       }
     \cs_new_protected:Npn \CTEX at updatettlifname
-      { \ifttl at label \CTEX at ifnametrue \else: \CTEX at ifnamefalse \fi: }
+      { \legacy_if:nTF { ttl at label } { \CTEX at ifnametrue } { \CTEX at ifnamefalse } }
   }
 \group_begin:
 \char_set_catcode_other:N \#
@@ -1330,11 +1345,12 @@
     \fi \fi
   }
   { \CTEXifname { \CTEXthechapter \quad } { } }
-\if at twoside
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-\fi:
+\legacy_if:nT { @twoside }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+  }
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \f at nch@initialise
@@ -1359,11 +1375,12 @@
             \fi \fi
           }
           { \CTEXifname { \CTEXthechapter \quad } { } }
-        \if at twoside
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-        \fi:
+        \legacy_if:nT { @twoside }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+          }
       }
       { }
   }
@@ -1468,7 +1485,7 @@
 \seq_new:N \c__ctex_font_size_seq
 \cs_new_protected:Npn \__ctex_save_font_size:nn #1#2
   {
-    \use:x
+    \use:e
       {
         \prop_gput:Nnn \exp_not:N \c__ctex_font_size_prop {#1}
           {
@@ -1609,7 +1626,7 @@
           {
             \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def }
               {
-                \use:x
+                \use:e
                   {
                     \ctex_detect_platform:
                     \msg_error:nnxx { ctex } { fontset-not-found }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexcap.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexcap.sty	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexcap.sty	2022-07-14 20:18:14 UTC (rev 63891)
@@ -26,10 +26,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter in LaTeX (CTEX)}
 \ProvidesExplPackage{ctexcap}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \clist_new:N \l__ctex_ctexcap_options_clist
 \clist_set:Nx \l__ctex_ctexcap_options_clist
   { \exp_not:v { opt@ \@currname . \@currext } , heading }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexheading.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexheading.sty	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexheading.sty	2022-07-14 20:18:14 UTC (rev 63891)
@@ -26,11 +26,12 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading style modification (CTEX)}
 \ProvidesExplPackage{ctexheading}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
-\RequirePackage { xparse , l3keys2e }
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
+\cs_if_exist:NF \NewDocumentCommand
+  { \RequirePackage { xparse } }
 \prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexheading }
 \RequirePackage { ctexhook , ctexpatch }
 \tl_clear_new:N \l__ctex_tmp_tl
@@ -70,7 +71,12 @@
     scheme .default:n = { plain } ,
     scheme .initial:n = { plain }
   }
-\ProcessKeysOptions { ctex / option }
+\cs_if_exist:NTF \ProcessKeyOptions
+  { \ProcessKeyOptions [ ctex / option ] }
+  {
+    \RequirePackage { l3keys2e }
+    \ProcessKeysOptions { ctex / option }
+  }
 \NewDocumentCommand \ctexset { } { \ctex_set:n }
 \clist_map_inline:nn { article , book , report , beamer }
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexhook.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexhook.sty	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexhook.sty	2022-07-14 20:18:14 UTC (rev 63891)
@@ -26,10 +26,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Document and package hooks (CTEX)}
 \ProvidesExplPackage{ctexhook}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \cs_new:Npn \ctex_if_format_at_least:nTF
   { \@ifl at t@r \fmtversion }
 \cs_new_protected:Npn \ctex_file_input:n #1

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty	2022-07-14 20:18:14 UTC (rev 63891)
@@ -26,10 +26,10 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Patching commands (CTEX)}
 \ProvidesExplPackage{ctexpatch}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \cs_new_protected:Npn \ctex_patch_cmd_once:NnnnTF #1#2
   {
     \ctex_patch_boot:NNnnTF \__ctex_patch_cmd:Nnnnnw #1
@@ -87,7 +87,7 @@
           { \cs_if_exist_p:c { #1##3 } }
           {
             \group_begin:
-            \use:x
+            \use:e
               {
                 \group_end:
                 \__ctex_parse_name:nNNNnN
@@ -129,7 +129,7 @@
       }
     \cs_new:Npn \__ctex_parse_name:w ##1 #3 ~ ##2 #2 ##3 \q_stop { ##1##2 }
   }
-\use:x
+\use:e
   {
     \__ctex_tmp:w
       { \c_backslash_str }
@@ -180,7 +180,7 @@
     \__ctex_patch_rescan:NNn \l__ctex_prefix_tl      \l__ctex_prefix_str      {#2}
     \__ctex_patch_rescan:NNn \l__ctex_parameter_tl   \l__ctex_parameter_str   {#2}
     \__ctex_patch_rescan:NNn \l__ctex_replacement_tl \l__ctex_replacement_str {#2}
-    \use:x
+    \use:e
       {
         \exp_not:o { \l__ctex_prefix_tl } \tex_def:D \exp_not:N #1
           \exp_not:o { \l__ctex_parameter_tl }
@@ -201,7 +201,7 @@
     \group_end:
     \ctex_if_rescanable:NnTF #1 {#3}
       {
-        \use:x
+        \use:e
           {
             \__ctex_patch_replace:nnnTF {#2}
               { \tl_to_str:n {#4} }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexrep.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexrep.cls	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexrep.cls	2022-07-14 20:18:14 UTC (rev 63891)
@@ -27,11 +27,12 @@
 \NeedsTeXFormat{LaTeX2e}
 \input{ctexbackend.cfg}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese adapter for class report (CTEX)}
 \ProvidesExplClass{ctexrep}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
-\RequirePackage { xparse , l3keys2e }
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
+\cs_if_exist:NF \NewDocumentCommand
+  { \RequirePackage { xparse } }
 \prop_gput:Nnn \g_msg_module_type_prop { ctex } { Class }
 \prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexrep }
 \msg_new:nnnn { ctex } { l3-too-old }
@@ -41,10 +42,8 @@
     `l3kernel'~and~`l3packages'\\\\
     using~your~TeX~package~manager~or~from~CTAN.
   }
-\@ifpackagelater { expl3 } { 2020/07/17 } { }
+\@ifpackagelater { expl3 } { 2021/02/10 } { }
   { \msg_error:nnn { ctex } { l3-too-old } { expl3 } }
-\@ifpackagelater { l3keys2e } { 2015/12/20 } { }
-  { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } }
 \str_const:Nx \c__ctex_engine_str
   { \cs_if_exist:NTF \ngostype { aptex } { \c_sys_engine_str } }
 \msg_new:nnnn { ctex } { engine-not-supported }
@@ -122,6 +121,14 @@
 \cs_new_eq:NN \ctex_if_autoindent_touched:F \use:n
 \cs_new_eq:NN \ctex_zhmap_case:nnn \use_ii:nnn
 \cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass }
+\cs_new_protected:Npn \ctex_load_std_class:n #1
+  {
+    \tl_const:Nn \c__ctex_class_tl {#1}
+    \exp_args:No \PassOptionsToClass
+      { \g__ctex_std_options_clist }
+      {#1}
+    \LoadClass {#1}
+  }
 \clist_new:N \g__ctex_std_options_clist
 \msg_new:nnn { ctex } { invalid-option }
   { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. }
@@ -241,7 +248,7 @@
     space .choices:nn =
       { true , auto , false }
       {
-        \exp_args:Nx \ctex_at_end:n
+        \exp_args:Ne \ctex_at_end:n
           { \ctex_set:n { space = \l_keys_choice_tl } }
       } ,
     space  .default:n = { true } ,
@@ -321,7 +328,12 @@
       { \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } }
   }
 \ctex_file_input:n { ctexopts.cfg }
-\ProcessKeysOptions { ctex / option }
+\cs_if_exist:NTF \ProcessKeyOptions
+  { \ProcessKeyOptions [ ctex / option ] }
+  {
+    \RequirePackage { l3keys2e }
+    \ProcessKeysOptions { ctex / option }
+  }
 \msg_new:nnn { ctex } { pdftex-utf8 }
   { UTF8~will~be~used~as~the~default~encoding. }
 \tl_if_empty:NT \g__ctex_encoding_tl
@@ -335,9 +347,7 @@
     { 0 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } }
     { 1 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } }
   }
-\tl_const:Nn \c__ctex_class_tl { report }
-\PassOptionsToClass { \g__ctex_std_options_clist } { report }
-\LoadClass { report }
+\ctex_load_std_class:n { report }
 \@ifpackageloaded { hyperref }
   {
     \cs_new_protected:Npn \ctex_hypersetup:n #1
@@ -511,7 +521,9 @@
       { \parindent is~set~to~0pt. }
     \dim_zero:N \parindent
   }
-\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber }
+\exp_args:Ne \PassOptionsToPackage
+  { encoding = \g__ctex_encoding_tl }
+  { zhnumber }
 \RequirePackage { zhnumber }
 \cs_new:Npn \chinese { \zhnum_counter:n }
 \cs_new_eq:NN \@chinese \@zhnum
@@ -608,11 +620,11 @@
   }
 \cs_new_protected:Npn \__ctex_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l__ctex_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -630,8 +642,7 @@
         #1 / hang        .bool_set:N = \exp_not:c { CTEX@#1 at hang } ,
         #1 / hang         .initial:n = true ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
-        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline}
-                                       \exp_not:n { ##1##2 } ,
+        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline } ##1##2 ,
         \__ctex_plus_key_aux:nn {#1} { break } ,
         \__ctex_plus_key_aux:nn {#1} { format } ,
         \__ctex_plus_key_aux:nn {#1} { nameformat } ,
@@ -645,9 +656,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 \NewDocumentCommand \ctex_assign_heading_name:nn
   { m > { \SplitArgument { 1 } { , } } +m }
@@ -711,6 +722,8 @@
 \cs_new_protected:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\cs_new_protected:Npn \CTEX at setthispagestyle #1
+  { \exp_args:Ne \thispagestyle { \use:c { CTEX@#1 at pagestyle } } }
 \ProvideDocumentCommand \partmark { m }
   { \markboth { } { } }
 \cs_new_eq:NN \CTEXifname \use_ii:nn
@@ -737,7 +750,7 @@
   { \addcontentsline { toc } {#1} { \use:c { CTEX@#1 at tocline } {#1} {#2} } }
 \renewcommand\part{%
   \CTEX at part@break
-  \thispagestyle{\CTEX at part@pagestyle}%
+  \CTEX at setthispagestyle{part}%
   \if at twocolumn
     \onecolumn
     \@tempswatrue
@@ -802,7 +815,7 @@
   \fi}
 \renewcommand\chapter{%
   \CTEX at chapter@break
-  \thispagestyle{\CTEX at chapter@pagestyle}%
+  \CTEX at setthispagestyle{chapter}%
   \global\@topnum\z@
   \ifodd \CTEX at chapter@afterindent
     \@afterindenttrue
@@ -1091,20 +1104,22 @@
 \cs_new_protected:Npn \CTEX at hyperheadinghook
   {
     \group_begin:
-      \ifHy at implicit
-        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          {
-            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
-              {
-                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
-                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
-              }
-          }
-      \else:
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
-      \fi:
+      \legacy_if:nTF { Hy at implicit }
+        {
+          \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            {
+              \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+                {
+                  \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                  \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+                }
+            }
+        }
+        {
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+        }
     \group_end:
   }
 \ctex_at_end_package:nn { hyperref }
@@ -1230,7 +1245,7 @@
         \CTEX at updatettlifname
       }
     \cs_new_protected:Npn \CTEX at updatettlifname
-      { \ifttl at label \CTEX at ifnametrue \else: \CTEX at ifnamefalse \fi: }
+      { \legacy_if:nTF { ttl at label } { \CTEX at ifnametrue } { \CTEX at ifnamefalse } }
   }
 \group_begin:
 \char_set_catcode_other:N \#
@@ -1325,11 +1340,12 @@
     \fi
   }
   { \CTEXifname { \CTEXthechapter \quad } { } }
-\if at twoside
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-\fi:
+\legacy_if:nT { @twoside }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+  }
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \f at nch@initialise
@@ -1354,11 +1370,12 @@
             \fi
           }
           { \CTEXifname { \CTEXthechapter \quad } { } }
-        \if at twoside
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-        \fi:
+        \legacy_if:nT { @twoside }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+          }
       }
       { }
   }
@@ -1463,7 +1480,7 @@
 \seq_new:N \c__ctex_font_size_seq
 \cs_new_protected:Npn \__ctex_save_font_size:nn #1#2
   {
-    \use:x
+    \use:e
       {
         \prop_gput:Nnn \exp_not:N \c__ctex_font_size_prop {#1}
           {
@@ -1604,7 +1621,7 @@
           {
             \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def }
               {
-                \use:x
+                \use:e
                   {
                     \ctex_detect_platform:
                     \msg_error:nnxx { ctex } { fontset-not-found }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexsize.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexsize.sty	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexsize.sty	2022-07-14 20:18:14 UTC (rev 63891)
@@ -26,11 +26,12 @@
 %% 
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese font size definition (CTEX)}
 \ProvidesExplPackage{ctexsize}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
-\RequirePackage { xparse , l3keys2e }
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
+\cs_if_exist:NF \NewDocumentCommand
+  { \RequirePackage { xparse } }
 \prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexsize }
 \RequirePackage { fix-cm }
 \cs_new_protected:Npn \ctex_define_option:n
@@ -61,7 +62,12 @@
   }
 \exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl }
 \tl_clear:N \l__ctex_tmp_tl
-\ProcessKeysOptions { ctex / option }
+\cs_if_exist:NTF \ProcessKeyOptions
+  { \ProcessKeyOptions [ ctex / option ] }
+  {
+    \RequirePackage { l3keys2e }
+    \ProcessKeysOptions { ctex / option }
+  }
 \NewDocumentCommand \zihao { m }
   { \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D }
 \cs_new_protected:Npn \ctex_zihao:n #1
@@ -81,7 +87,7 @@
 \seq_new:N \c__ctex_font_size_seq
 \cs_new_protected:Npn \__ctex_save_font_size:nn #1#2
   {
-    \use:x
+    \use:e
       {
         \prop_gput:Nnn \exp_not:N \c__ctex_font_size_prop {#1}
           {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctexspa.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctexspa.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctexspa.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -26,7 +26,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{ctexspa.def}%
-  [2022/06/04 v2.5.9 Space info for CJKpunct (CTEX)]
+  [2022/07/14 v2.5.10 Space info for CJKpunct (CTEX)]
 \ctexspadef{adobezhsong}{70,15,61,8,63,14,58,7,64,13,62,12,60,11,61,15,62,14,51,6,58,5,58,8,7,5,12,12,10,68,13,63,17,63,20,69,19,69,17,63,19,70,17,55,10,10,14,63,10,65,10,61,13,62,15,61,7,49,7,56,8,58,15,69,8,61,14,63,8,57,,,}
 \ctexspadef{adobezhhei}{78,3,64,3,64,2,61,3,72,3,70,3,72,3,70,3,60,3,51,3,62,3,66,3,0,0,10,10,3,70,5,70,6,75,6,78,17,67,13,67,17,67,4,50,8,8,3,72,3,70,3,72,3,70,3,60,3,51,3,62,3,66,3,78,7,62,3,63,3,61,,,}
 \ctexspadef{adobezhkai}{76,10,55,8,63,4,62,4,71,4,65,4,71,4,74,4,54,4,54,4,62,4,62,4,0,0,11,11,5,72,6,71,7,78,7,79,18,68,18,68,18,68,2,46,14,12,4,71,4,65,4,71,4,74,4,54,4,54,4,62,4,62,10,76,8,55,4,63,4,62,,,}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls	2022-07-14 20:18:14 UTC (rev 63891)
@@ -1,7 +1,7 @@
 %%
 %% File ctxdoc.cls
 %%
-%%     Copyright (C) 2016--2020
+%%     Copyright (C) 2016--2022
 %%     CTEX.ORG and any individual authors listed in the documentation.
 %%---------------------------------------------------------------------
 %%
@@ -21,7 +21,7 @@
 %%
 \NeedsTeXFormat{LaTeX2e}
 \RequirePackage{expl3}
-\GetIdInfo$Id: ctxdoc.cls 87d629c 2022-05-23 22:55:12 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctxdoc.cls c3e8eb5 2022-06-07 19:08:17 +0800 Qing Lee <sobenlee at gmail.com> $
   {ctex documentation (CTEX)}
 \ProvidesExplClass{ctxdoc}{\ExplFileDate}{}{\ExplFileDescription}
 \ExplSyntaxOff
@@ -123,6 +123,7 @@
 \setlist[1]{labelindent=\parindent}
 \setlist[enumerate]{leftmargin=*}
 \setlist[itemize]{leftmargin=*}
+\setlist[trivlist]{topsep=\medskipamount}
 \renewlist{arguments}{enumerate}{1}
 \setlist[arguments]{nolistsep,
   leftmargin=\parindent, labelindent=0pt, labelsep=*,
@@ -169,12 +170,9 @@
 \define at key{FV}{labelref}{\def\ctexexamlabelref{\label{#1}}}
 \let\ctexexamlabelref\empty
 \newcounter{ctexexam}
-\BeforeBeginEnvironment{function}{\par\nointerlineskip}
-\AtEndEnvironment{function}{%
-  \par\xdef\ctexfixprevdepth{\prevdepth=\the\prevdepth\space}}
-\AfterEndEnvironment{function}{\ctexfixprevdepth}
+\AtEndEnvironment{function}{\ctexsetverticalspacing}
+\AfterEndEnvironment{function}{\ctexfixverticalspacing}
 \AtBeginEnvironment{syntax}{\linespread{1}\ctexplainps\ctexdisableecglue}
-\BeforeBeginEnvironment{SideBySideExample}{\par\addvspace{\medskipamount}}
 \newrobustcmd\exptarget{%
   \AddLineBeginMainAux{\csgdef{Codedoc at expstar}{}}%
   \Hy at raisedlink{\hypertarget{expstar}{}}}
@@ -184,6 +182,35 @@
 \newrobustcmd\expstar{\hyperlink{expstar}{$\star$}}
 \newrobustcmd\rexpstar{\hyperlink{rexpstar}{\ding{73}}}
 \ExplSyntaxOn
+\cs_new_protected:Npn \ctexsetverticalspacing
+  {
+    \par
+    \tl_gset:Nx \ctexfixverticalspacing
+      { \dim_set:Nn \prevdepth { \dim_use:N \prevdepth } }
+    \int_compare:nNnT \lastnodetype = { 11 }
+      {
+        \tl_gput_right:Nx \ctexfixverticalspacing
+          { \exp_not:N \skip_vertical:n { \skip_use:N \lastskip } }
+        \unskip
+      }
+  }
+\tl_new:N \ctexfixverticalspacing
+\NewDocumentCommand \SideBySideExampleSet { }
+  { \prop_put_from_keyval:Nn \l__ctxdoc_side_example_prop }
+\prop_new:N \l__ctxdoc_side_example_prop
+\prop_set_from_keyval:Nn \l__ctxdoc_side_example_prop
+  { frame=single, numbers=left, gobble=5, xrightmargin=.5\linewidth }
+\tl_put_left:Nn \SideBySideExample
+  {
+    \trivlist \item \relax
+    \exp_args:Ne \fvset
+      { \prop_to_keyval:N \l__ctxdoc_side_example_prop }
+  }
+\tl_put_right:Nn \endSideBySideExample
+  { \endtrivlist }
+\ctex_patch_cmd:Nnn \__codedoc_function_typeset_start:
+  { \bigskip }
+  { \nointerlineskip \addvspace { \bigskipamount } }
 %% l3doc 会设置列表环境中 \listparindent=\z@,我们在这里恢复它。
 \cs_set_eq:NN \list \__codedoc_oldlist:nn
 \cs_new_nopar:Npn \zihaopt #1

Modified: trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}%
-  [2022/06/04 v2.5.9 Chinese translation for theorem name (CTEX)]
+  [2022/07/14 v2.5.10 Chinese translation for theorem name (CTEX)]
 \providetranslation{Comments}{\xC6\xC0\xC2\xDB}
 \providetranslation{comments}{\xC6\xC0\xC2\xDB}
 \providetranslation{Comment}{\xC6\xC0\xC2\xDB}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}%
-  [2022/06/04 v2.5.9 Chinese translation for theorem name (CTEX)]
+  [2022/07/14 v2.5.10 Chinese translation for theorem name (CTEX)]
 \providetranslation{Comments}{评论}
 \providetranslation{comments}{评论}
 \providetranslation{Comment}{评论}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Asian pTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-aptex.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \cs_new_protected:Npn \ctex_set_zhmap:n
   { \tl_gput_right:Nx \g__ctex_zhmap_tl }
 \cs_new_protected:Npn \ctex_use_zhmap:
@@ -216,45 +216,48 @@
       { \exp_not:o { \CTEX at selectfont@hook #1 } }
   }
 \cs_new_eq:NN \CTEX at selectfont@hook \prg_do_nothing:
-\if_bool:N \c__ctex_everysel_loaded_bool
-  \if_cs_exist:N \@EverySelectfont at Init
-    \group_begin:
-      \cs_set:Npn \__ctex_tmp:N #1
-        {
-          \tl_set:Nn \l__ctex_tmp_tl {#1}
-          \cs_new_eq:NN \CTEX at selectfont@save #1
-          \cs_new_protected:Npn \__ctex_restore_selectfont:
-            {
-              \cs_if_free:NF \scr at new@selectfont
-                {
-                  \cs_if_free:NF \par at update
-                    {
-                      \tl_put_right:Nn \@EverySelectfont at Init
-                        { \tl_put_right:Nn #1 { \par at update } }
-                    }
-                  \cs_set_eq:NN \scr at new@selectfont #1
-                  \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
-                }
-              \tl_put_left:Nn \@EverySelectfont at Init
-                { \cs_set_eq:NN #1 \CTEX at selectfont@save }
-              \cs_undefine:N \__ctex_restore_selectfont:
-            }
-        }
-      \ctex_parse_name:NN \__ctex_tmp:N \selectfont
-    \exp_last_unbraced:NNo \group_end:
-    \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
-      { \ExplSyntaxOff }
-      { \size at update }
-      { \CTEX at selectfont@hook \size at update }
-      { \__ctex_restore_selectfont: }
-      { \ctex_patch_failure:N \selectfont }
-  \fi:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \EverySelectfont }
-\else:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \ctex_gadd_ltxhook:nn { selectfont } }
-\fi:
+\bool_if:NTF \c__ctex_everysel_loaded_bool
+  {
+    \cs_if_free:NF \@EverySelectfont at Init
+      {
+        \group_begin:
+        \cs_set:Npn \__ctex_tmp:N #1
+          {
+            \tl_set:Nn \l__ctex_tmp_tl {#1}
+            \cs_new_eq:NN \CTEX at selectfont@save #1
+            \cs_new_protected:Npn \__ctex_restore_selectfont:
+              {
+                \cs_if_free:NF \scr at new@selectfont
+                  {
+                    \cs_if_free:NF \par at update
+                      {
+                        \tl_put_right:Nn \@EverySelectfont at Init
+                          { \tl_put_right:Nn #1 { \par at update } }
+                      }
+                    \cs_set_eq:NN \scr at new@selectfont #1
+                    \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
+                  }
+                \tl_put_left:Nn \@EverySelectfont at Init
+                  { \cs_set_eq:NN #1 \CTEX at selectfont@save }
+                \cs_undefine:N \__ctex_restore_selectfont:
+              }
+          }
+        \ctex_parse_name:NN \__ctex_tmp:N \selectfont
+      \exp_last_unbraced:NNo \group_end:
+      \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
+        { \ExplSyntaxOff }
+        { \size at update }
+        { \CTEX at selectfont@hook \size at update }
+        { \__ctex_restore_selectfont: }
+        { \ctex_patch_failure:N \selectfont }
+      }
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \EverySelectfont }
+  }
+  {
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \ctex_gadd_ltxhook:nn { selectfont } }
+  }
 \ctex_gadd_selectfont_hook:n { \CTEX at selectfont@hook }
 \cs_new_protected:Npn \ctex_update_xkanjiskip:
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {LuaLaTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-luatex.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \msg_new:nnn { ctex } { luatexja-loaded }
   {
     Package~`luatexja'~can~not~be~loaded~before~`ctex'.\\
@@ -355,7 +355,7 @@
 \cs_new:Npn \ctex_ltj_if_jfont:nTF #1
   {
     \ctex_ltj_is_kenc:n { \__ctex_ltj_ltj_if_jfont:w #1 / \q_stop }
-    \ifin@ \exp_after:wN \use_i:nn \else: \exp_after:wN \use_ii:nn \fi:
+    \legacy_if:nTF { in@ }
   }
 \cs_new:Npn \__ctex_ltj_ltj_if_jfont:w #1 / #2 \q_stop
   {#1}
@@ -1180,40 +1180,43 @@
       { \exp_not:o { \CTEX at selectfont@hook #1 } }
   }
 \cs_new_eq:NN \CTEX at selectfont@hook \prg_do_nothing:
-\if_bool:N \c__ctex_everysel_loaded_bool
-  \if_cs_exist:N \@EverySelectfont at Init
-    \group_begin:
-      \cs_set:Npn \__ctex_tmp:N #1
-        {
-          \tl_set:Nn \l__ctex_tmp_tl {#1}
-          \cs_new_eq:NN \CTEX at selectfont@save #1
-          \cs_new_protected:Npn \__ctex_restore_selectfont:
-            {
-              \cs_if_free:NF \scr at new@selectfont
-                {
-                  \cs_set_eq:NN \scr at new@selectfont #1
-                  \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
-                }
-              \tl_put_left:Nn \@EverySelectfont at Init
-                { \cs_set_eq:NN #1 \CTEX at selectfont@save }
-              \cs_undefine:N \__ctex_restore_selectfont:
-            }
-        }
-      \ctex_parse_name:NN \__ctex_tmp:N \selectfont
-    \exp_last_unbraced:NNo \group_end:
-    \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
-      { \ExplSyntaxOff }
-      { \size at update }
-      { \CTEX at selectfont@hook \size at update }
-      { \__ctex_restore_selectfont: }
-      { \ctex_patch_failure:N \selectfont }
-  \fi:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \EverySelectfont }
-\else:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \ctex_gadd_ltxhook:nn { selectfont } }
-\fi:
+\bool_if:NTF \c__ctex_everysel_loaded_bool
+  {
+    \cs_if_free:NF \@EverySelectfont at Init
+      {
+        \group_begin:
+        \cs_set:Npn \__ctex_tmp:N #1
+          {
+            \tl_set:Nn \l__ctex_tmp_tl {#1}
+            \cs_new_eq:NN \CTEX at selectfont@save #1
+            \cs_new_protected:Npn \__ctex_restore_selectfont:
+              {
+                \cs_if_free:NF \scr at new@selectfont
+                  {
+                    \cs_set_eq:NN \scr at new@selectfont #1
+                    \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
+                  }
+                \tl_put_left:Nn \@EverySelectfont at Init
+                  { \cs_set_eq:NN #1 \CTEX at selectfont@save }
+                \cs_undefine:N \__ctex_restore_selectfont:
+              }
+          }
+        \ctex_parse_name:NN \__ctex_tmp:N \selectfont
+      \exp_last_unbraced:NNo \group_end:
+      \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
+        { \ExplSyntaxOff }
+        { \size at update }
+        { \CTEX at selectfont@hook \size at update }
+        { \__ctex_restore_selectfont: }
+        { \ctex_patch_failure:N \selectfont }
+      }
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \EverySelectfont }
+  }
+  {
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \ctex_gadd_ltxhook:nn { selectfont } }
+  }
 \ctex_gadd_selectfont_hook:n { \CTEX at selectfont@hook }
 \ctex_add_to_selectfont:n
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {(pdf)LaTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-pdftex.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \cs_new_protected:Npn \ctex_set_zhmap:n
   { \tl_gput_right:Nx \g__ctex_zhmap_tl }
 \cs_new_protected:Npn \ctex_use_zhmap:
@@ -62,8 +62,8 @@
           { \tl_gput_right:cn { #1 + #2 } { \ctex_add_cmap:n {#1} } }
       }
   }
-\cs_generate_variant:Nn \ctex_family_cmap:nn { x }
-\cs_new_eq:NN \CTEX at Family@CMap \ctex_family_cmap:xn
+\cs_generate_variant:Nn \ctex_family_cmap:nn { ee }
+\cs_new_eq:NN \CTEX at Family@CMap \ctex_family_cmap:ee
 \cs_new_protected:Npn \ctex_add_cmap:n #1
   {
     \cs_if_free:NF \CJK at plane
@@ -81,51 +81,73 @@
     \exp_args:Ne \file_get_full_name:nNTF
       { \str_lowercase:n {#2} .cmap } \l__ctex_cmap_file_tl
       {
-        \tex_immediate:D \tex_pdfobj:D stream ~ file { \l__ctex_cmap_file_tl }
+        \pdf_object_unnamed_write:nx
+          { fstream }
+          { { } { \l__ctex_cmap_file_tl } }
         \cs_new_protected:Npx #1
           {
             \pdfnobuiltintounicode \tex_font:D
             \tex_pdffontattr:D \tex_font:D
-              { /ToUnicode ~ \int_value:w \tex_pdflastobj:D \c_space_tl 0 ~ R }
+              { /ToUnicode ~ \pdf_object_ref_last: }
           }
       }
       { \cs_new_eq:NN #1 \prg_do_nothing: }
   }
 \tl_new:N \l__ctex_cmap_file_tl
-\group_begin:
-\char_set_catcode_other:N \#
-\sys_if_output_pdf:TF
+\sys_if_output_pdf:T
   {
-    \group_end:
-    \ctex_appto_cmd:NnnTF \DeclareFontFamily { \ExplSyntaxOff }
-      { \CTEX at Family@CMap {#1} {#2} }
+    \exp_args:Nno \use:n
+      { \cs_gset_protected:Npn \DeclareFontFamily #1#2#3 }
       {
-        \ctex_at_end_package:nn { cmap }
-          {
-            \cs_gset_eq:NN \ctex_add_cmap:n \use_none:n
-            \cs_gset_eq:NN \CTEX at Family@CMap \use_none:nn
-          }
+        \DeclareFontFamily {#1} {#2} {#3}
+        \CTEX at Family@CMap  {#1} {#2}
       }
-      { \ctex_patch_failure:N \DeclareFontFamily }
+    \ctex_at_end_package:nn { cmap }
+      {
+        \cs_gset_eq:NN \ctex_add_cmap:n \use_none:n
+        \cs_gset_eq:NN \CTEX at Family@CMap \use_none:nn
+      }
   }
-  { \group_end: }
-\if_bool:N \g__ctex_zhmCJK_bool
-  \PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhmCJK }
-  \RequirePackage { zhmCJK }
-\else:
-  \str_if_eq:onTF { \g__ctex_encoding_tl } { GBK }
-    { \RequirePackage { CJK } }
-    { \RequirePackage { CJKutf8 } }
-  \RequirePackage { CJKpunct , CJKspace }
-  \cs_new_protected:Npn \ctex_load_zhmap:nnnn #1#2#3#4
-    {
-      \tl_set:Nn \CJKrmdefault {#1}
-      \tl_set:Nn \CJKsfdefault {#2}
-      \tl_set:Nn \CJKttdefault {#3}
-      \ctex_set_zhmap:n { \ctex_file_input:n { ctex-zhmap- #4 .tex } }
-    }
-  \@onlypreamble \ctex_load_zhmap:nnnn
-\fi:
+\bool_if:NTF \g__ctex_zhmCJK_bool
+  {
+    \exp_args:Ne \PassOptionsToPackage
+      { encoding = \g__ctex_encoding_tl }
+      { zhmCJK }
+    \RequirePackage { zhmCJK }
+  }
+  {
+    \str_if_eq:onTF { \g__ctex_encoding_tl } { GBK }
+      { \RequirePackage { CJK } }
+      { \RequirePackage { CJKutf8 } }
+    \RequirePackage { CJKpunct , CJKspace }
+    \cs_new_protected:Npn \ctex_load_zhmap:nnnn #1#2#3#4
+      {
+        \tl_set:Nn \CJKrmdefault {#1}
+        \tl_set:Nn \CJKsfdefault {#2}
+        \tl_set:Nn \CJKttdefault {#3}
+        \ctex_set_zhmap:n { \ctex_file_input:n { ctex-zhmap- #4 .tex } }
+      }
+    \@onlypreamble \ctex_load_zhmap:nnnn
+  }
+\cs_new_protected:Npn \ctex_undeclare_unicode_character:n #1
+  { \cs_set_eq:cN { u8 : \ctex_utfviii_char:n {#1} } \tex_undefined:D }
+\cs_new:Npn \ctex_utfviii_char:n #1
+  {
+    \exp_last_unbraced:Ne \__ctex_utfviii_char_aux:nnnn
+      { \char_to_utfviii_bytes:n {#1} }
+  }
+\cs_new:Npn \__ctex_utfviii_char_aux:nnnn #1#2#3#4
+  {
+    \char_generate:nn {#1} { 12 }
+    \tl_if_empty:nF {#2} { \char_generate:nn {#2} { 12 } }
+    \tl_if_empty:nF {#3} { \char_generate:nn {#3} { 12 } }
+    \tl_if_empty:nF {#4} { \char_generate:nn {#4} { 12 } }
+  }
+\CJKaddEncHook { UTF8 }
+  {
+    \ctex_undeclare_unicode_character:n { "3008 }
+    \ctex_undeclare_unicode_character:n { "3009 }
+  }
 \cs_new_protected:Npn \ctex_CJK_input:n #1
   {
     \ctex_push_file:
@@ -166,24 +188,180 @@
   }
 \AtBeginDocument
   {
-    \str_if_eq:eeF { \l__ctex_punct_tl } { quanjiao }
-      { \punctstyle { \l__ctex_punct_tl } }
+    \use:e
+      {
+        \str_if_eq:nnF { \l__ctex_punct_tl } { quanjiao }
+          { \exp_not:N \punctstyle { \l__ctex_punct_tl } }
+      }
   }
 \ctex_at_end_preamble:n { \ctex_update_default_family: }
-\reverse_if:N \if_bool:N \g__ctex_zhmCJK_bool
-  \str_if_eq:onF { \g__ctex_encoding_tl } { UTF8 }
-    {
-      \CJK at makeActive
-      \CJK at loadBinding { standard }
-    }
-  \exp_args:Nx \ctex_at_end_preamble:n
-    {
-      \exp_not:N \CJK at envStart
-        { } { \g__ctex_encoding_tl } { \exp_not:N \CJKfamilydefault }
-      \exp_not:N \CJKtilde
-    }
-\fi:
+\bool_if:NF \g__ctex_zhmCJK_bool
+  {
+    \str_if_eq:onTF { \g__ctex_encoding_tl } { UTF8 }
+      { \CJK at loadBinding { UTF8 } }
+      { \CJK at loadBinding { standard } }
+    \exp_args:Ne \ctex_at_end_preamble:n
+      {
+        \exp_not:N \CJK at envStart
+          { } { \g__ctex_encoding_tl } { \exp_not:N \CJKfamilydefault }
+        \exp_not:N \CJKtilde
+      }
+  }
 \cs_new_eq:NN \ctex_auto_ignorespaces: \CJK@@ignorespaces
+\cs_new:Npn \__ctex_char:N #1
+  { \exp_args:Ne \CTEX at char@n { \int_value:w `#1 } }
+\cs_new:Npn \__ctex_char:NN #1#2
+  {
+    \token_if_eq_meaning:NNTF #2 \protect
+      { \__ctex_char_aux:NN #1 }
+      { \__ctex_char_aux:NN #1#2 }
+  }
+\cs_new:Npn \__ctex_char_aux:NN #1#2
+  {
+    \exp_last_unbraced:Ne \CTEX at char@nn
+      {
+        { \int_value:w `#1 }
+        { \int_value:w `#2 }
+      }
+  }
+\cs_new:Npn \__ctex_char:NNN #1#2#3
+  {
+    \token_if_eq_meaning:NNTF #2 \protect
+      { \__ctex_char_auxi:NNNN #1#3 }
+      { \__ctex_char_auxii:NNN #1#2#3 }
+  }
+\cs_new:Npn \__ctex_char_auxi:NNN #1#2#3#4
+  { \__ctex_char_auxii:NNN #1#2#4 }
+\cs_new:Npn \__ctex_char_auxii:NNN #1#2#3
+  {
+    \exp_last_unbraced:Ne \CTEX at char@nnn
+      {
+        { \int_value:w `#1 }
+        { \int_value:w `#2 }
+        { \int_value:w `#3 }
+      }
+  }
+\cs_new:Npn \__ctex_char:NNNN #1#2#3#4
+  {
+    \token_if_eq_meaning:NNTF #2 \protect
+      { \__ctex_char_auxi:NNNNN #1#3 }
+      { \__ctex_char_auxii:NNNN #1#2#3#4 }
+  }
+\cs_new:Npn \__ctex_char_auxi:NNNNN #1#2#3#4#5
+  { \__ctex_char_auxii:NNNN #1#2#3#5 }
+\cs_new:Npn \__ctex_char_auxii:NNNN #1#2#3#4
+  {
+    \exp_last_unbraced:Ne \CTEX at char@nnnn
+      {
+        { \int_value:w `#1 }
+        { \int_value:w `#2 }
+        { \int_value:w `#3 }
+        { \int_value:w `#4 }
+      }
+  }
+\cs_gset_eq:NN \CJK at X    \__ctex_char:N
+\cs_gset_eq:NN \CJK at XX   \__ctex_char:NN
+\cs_gset_eq:NN \CJK at XXX  \__ctex_char:NNN
+\cs_gset_eq:NN \CJK at XXXX \__ctex_char:NNNN
+\str_if_eq:onF { \g__ctex_encoding_tl } { GBK }
+  {
+    \exp_args:Nne \use:n
+      { \cs_gset:Npn \__ctex_char_aux:NN #1#2 }
+      {
+        \exp_not:N \cs_if_exist_use:cF
+          { u8: \exp_not:N \tl_to_str:n { #1#2 } }
+          { \exp_not:o { \__ctex_char_aux:NN {#1} {#2} } }
+      }
+    \exp_args:Nne \use:n
+      { \cs_gset:Npn \__ctex_char_auxii:NNN #1#2#3 }
+      {
+        \exp_not:N \cs_if_exist_use:cF
+          { u8: \exp_not:N \tl_to_str:n { #1#2#3 } }
+          { \exp_not:o { \__ctex_char_auxii:NNN {#1} {#2} {#3} } }
+      }
+  }
+\group_begin:
+\char_set_catcode_active:n { "7F }
+\cs_new:Npn \__ctex_char_preproc:w #1 ^^7f #2 ^^7f
+  { \exp_args:No \CTEX at char@nn { \int_value:w `#1 } {#2} }
+\cs_gset_eq:NN \mule at arg \__ctex_char_preproc:w
+\group_end:
+\exp_args:Ne \ctex_at_end:n
+  {
+    \char_set_catcode:nn
+      { \int_value:w "7F }
+      { \char_value_catcode:n { "7F } }
+  }
+\cs_new_protected:Npn \CTEX at char@n #1
+  {
+    \mode_leave_vertical:
+    \use:c { CJK@ #1 }
+    \CJK at ignorespaces
+  }
+\cs_new_protected:Npn \CTEX at char@nn #1#2
+  {
+    \mode_leave_vertical:
+    \use:c { CJK@ #1 } {#2}
+    \CJK at ignorespaces
+  }
+\cs_new_protected:Npn \CTEX at char@nnn  #1#2#3
+  {
+    \mode_leave_vertical:
+    \use:c { CJK@ #1 } {#2} {#3}
+    \CJK at ignorespaces
+  }
+\cs_new_protected:Npn \CTEX at char@nnnn #1#2#3#4
+  {
+    \mode_leave_vertical:
+    \use:c { CJK@ #1 } {#2} {#3} {#4}
+    \CJK at ignorespaces
+  }
+\cs_new_protected:Npn \CTEX at char@nn at n   #1 { \CTEX at char@nn   #1 }
+\cs_new_protected:Npn \CTEX at char@nnn at n  #1 { \CTEX at char@nnn  #1 }
+\cs_new_protected:Npn \CTEX at char@nnnn at n #1 { \CTEX at char@nnnn #1 }
+\cs_new:Npn \__ctex_char_wrap:nn #1#2
+  { \CTEX at char@nn at n   { {#1} {#2} } }
+\cs_new:Npn \__ctex_char_wrap:nnn #1#2#3
+  { \CTEX at char@nnn at n  { {#1} {#2} {#3} } }
+\cs_new:Npn \__ctex_char_wrap:nnnn #1#2#3#4
+  { \CTEX at char@nnnn at n { {#1} {#2} {#3} {#4} } }
+\tl_put_right:Nn \l_text_case_exclude_arg_tl
+  {
+    \CTEX at char@n
+    \CTEX at char@nn at n
+    \CTEX at char@nnn at n
+    \CTEX at char@nnnn at n
+  }
+\text_declare_expand_equivalent:Nn \CTEX at char@nn   { \__ctex_char_wrap:nn }
+\text_declare_expand_equivalent:Nn \CTEX at char@nnn  { \__ctex_char_wrap:nnn }
+\text_declare_expand_equivalent:Nn \CTEX at char@nnnn { \__ctex_char_wrap:nnnn }
+\cs_new:Npn \__ctex_char_raw:n #1
+  { \char_generate:nn {#1} { 12 } }
+\cs_new:Npn \__ctex_char_raw:nn #1#2
+  {
+    \char_generate:nn {#1} { 12 }
+    \char_generate:nn {#2} { 12 }
+  }
+\cs_new:Npn \__ctex_char_raw:nnn #1#2#3
+  {
+    \char_generate:nn {#1} { 12 }
+    \char_generate:nn {#2} { 12 }
+    \char_generate:nn {#3} { 12 }
+  }
+\cs_new:Npn \__ctex_char_raw:nnnn #1#2#3#4
+  {
+    \char_generate:nn {#1} { 12 }
+    \char_generate:nn {#2} { 12 }
+    \char_generate:nn {#3} { 12 }
+    \char_generate:nn {#4} { 12 }
+  }
+\cs_new:Npn \__ctex_char_raw_nn:n   #1 { \use:e { \__ctex_char_raw:nn   #1 } }
+\cs_new:Npn \__ctex_char_raw_nnn:n  #1 { \use:e { \__ctex_char_raw:nnn  #1 } }
+\cs_new:Npn \__ctex_char_raw_nnnn:n #1 { \use:e { \__ctex_char_raw:nnnn #1 } }
+\text_declare_purify_equivalent:Nn \CTEX at char@n      { \__ctex_char_raw:n }
+\text_declare_purify_equivalent:Nn \CTEX at char@nn at n   { \__ctex_char_raw_nn:n }
+\text_declare_purify_equivalent:Nn \CTEX at char@nnn at n  { \__ctex_char_raw_nnn:n }
+\text_declare_purify_equivalent:Nn \CTEX at char@nnnn at n { \__ctex_char_raw_nnnn:n }
 \cs_new_protected:Npn \ctex_ignorespaces_case:N #1
   {
     \cs_set_protected:Npn \ctex_set_ignorespaces:
@@ -367,42 +545,45 @@
       { \exp_not:o { \CTEX at selectfont@hook #1 } }
   }
 \cs_new_eq:NN \CTEX at selectfont@hook \prg_do_nothing:
-\if_bool:N \c__ctex_everysel_loaded_bool
-  \if_cs_exist:N \@EverySelectfont at Init
-    \group_begin:
-      \cs_set:Npn \__ctex_tmp:N #1
-        {
-          \tl_set:Nn \l__ctex_tmp_tl {#1}
-          \cs_new_eq:NN \CTEX at selectfont@save #1
-          \cs_new_protected:Npn \__ctex_restore_selectfont:
-            {
-              \cs_if_free:NF \scr at new@selectfont
-                {
-                  \cs_if_free:NF \par at update
-                    { \tl_put_right:Nn #1 { \par at update } }
-                  \cs_set_eq:NN \scr at selectfont \CTEX at selectfont@save
-                  \cs_set_eq:NN \scr at new@selectfont #1
-                }
-              \tl_put_left:Nn \@EverySelectfont at Init
-                { \cs_set_eq:NN #1 \CTEX at selectfont@save }
-              \cs_undefine:N \__ctex_restore_selectfont:
-            }
-        }
-      \ctex_parse_name:NN \__ctex_tmp:N \selectfont
-    \exp_last_unbraced:NNo \group_end:
-    \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
-      { \ExplSyntaxOff }
-      { \size at update }
-      { \CTEX at selectfont@hook \size at update }
-      { \__ctex_restore_selectfont: }
-      { \ctex_patch_failure:N \selectfont }
-  \fi:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \EverySelectfont }
-\else:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \ctex_gadd_ltxhook:nn { selectfont } }
-\fi:
+\bool_if:NTF \c__ctex_everysel_loaded_bool
+  {
+    \cs_if_free:NF \@EverySelectfont at Init
+      {
+        \group_begin:
+        \cs_set:Npn \__ctex_tmp:N #1
+          {
+            \tl_set:Nn \l__ctex_tmp_tl {#1}
+            \cs_new_eq:NN \CTEX at selectfont@save #1
+            \cs_new_protected:Npn \__ctex_restore_selectfont:
+              {
+                \cs_if_free:NF \scr at new@selectfont
+                  {
+                    \cs_if_free:NF \par at update
+                      { \tl_put_right:Nn #1 { \par at update } }
+                    \cs_set_eq:NN \scr at selectfont \CTEX at selectfont@save
+                    \cs_set_eq:NN \scr at new@selectfont #1
+                  }
+                \tl_put_left:Nn \@EverySelectfont at Init
+                  { \cs_set_eq:NN #1 \CTEX at selectfont@save }
+                \cs_undefine:N \__ctex_restore_selectfont:
+              }
+          }
+        \ctex_parse_name:NN \__ctex_tmp:N \selectfont
+      \exp_last_unbraced:NNo \group_end:
+      \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
+        { \ExplSyntaxOff }
+        { \size at update }
+        { \CTEX at selectfont@hook \size at update }
+        { \__ctex_restore_selectfont: }
+        { \ctex_patch_failure:N \selectfont }
+      }
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \EverySelectfont }
+  }
+  {
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \ctex_gadd_ltxhook:nn { selectfont } }
+  }
 \ctex_gadd_selectfont_hook:n
   { \cs_if_exist:NF \CJK at plane { \CTEX at selectfont@hook } }
 \ctex_define:n

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {upTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-uptex.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \cs_new_protected:Npn \ctex_set_zhmap:n
   { \tl_gput_right:Nx \g__ctex_zhmap_tl }
 \cs_new_protected:Npn \ctex_use_zhmap:
@@ -216,45 +216,48 @@
       { \exp_not:o { \CTEX at selectfont@hook #1 } }
   }
 \cs_new_eq:NN \CTEX at selectfont@hook \prg_do_nothing:
-\if_bool:N \c__ctex_everysel_loaded_bool
-  \if_cs_exist:N \@EverySelectfont at Init
-    \group_begin:
-      \cs_set:Npn \__ctex_tmp:N #1
-        {
-          \tl_set:Nn \l__ctex_tmp_tl {#1}
-          \cs_new_eq:NN \CTEX at selectfont@save #1
-          \cs_new_protected:Npn \__ctex_restore_selectfont:
-            {
-              \cs_if_free:NF \scr at new@selectfont
-                {
-                  \cs_if_free:NF \par at update
-                    {
-                      \tl_put_right:Nn \@EverySelectfont at Init
-                        { \tl_put_right:Nn #1 { \par at update } }
-                    }
-                  \cs_set_eq:NN \scr at new@selectfont #1
-                  \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
-                }
-              \tl_put_left:Nn \@EverySelectfont at Init
-                { \cs_set_eq:NN #1 \CTEX at selectfont@save }
-              \cs_undefine:N \__ctex_restore_selectfont:
-            }
-        }
-      \ctex_parse_name:NN \__ctex_tmp:N \selectfont
-    \exp_last_unbraced:NNo \group_end:
-    \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
-      { \ExplSyntaxOff }
-      { \size at update }
-      { \CTEX at selectfont@hook \size at update }
-      { \__ctex_restore_selectfont: }
-      { \ctex_patch_failure:N \selectfont }
-  \fi:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \EverySelectfont }
-\else:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \ctex_gadd_ltxhook:nn { selectfont } }
-\fi:
+\bool_if:NTF \c__ctex_everysel_loaded_bool
+  {
+    \cs_if_free:NF \@EverySelectfont at Init
+      {
+        \group_begin:
+        \cs_set:Npn \__ctex_tmp:N #1
+          {
+            \tl_set:Nn \l__ctex_tmp_tl {#1}
+            \cs_new_eq:NN \CTEX at selectfont@save #1
+            \cs_new_protected:Npn \__ctex_restore_selectfont:
+              {
+                \cs_if_free:NF \scr at new@selectfont
+                  {
+                    \cs_if_free:NF \par at update
+                      {
+                        \tl_put_right:Nn \@EverySelectfont at Init
+                          { \tl_put_right:Nn #1 { \par at update } }
+                      }
+                    \cs_set_eq:NN \scr at new@selectfont #1
+                    \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
+                  }
+                \tl_put_left:Nn \@EverySelectfont at Init
+                  { \cs_set_eq:NN #1 \CTEX at selectfont@save }
+                \cs_undefine:N \__ctex_restore_selectfont:
+              }
+          }
+        \ctex_parse_name:NN \__ctex_tmp:N \selectfont
+      \exp_last_unbraced:NNo \group_end:
+      \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
+        { \ExplSyntaxOff }
+        { \size at update }
+        { \CTEX at selectfont@hook \size at update }
+        { \__ctex_restore_selectfont: }
+        { \ctex_patch_failure:N \selectfont }
+      }
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \EverySelectfont }
+  }
+  {
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \ctex_gadd_ltxhook:nn { selectfont } }
+  }
 \ctex_gadd_selectfont_hook:n { \CTEX at selectfont@hook }
 \cs_new_protected:Npn \ctex_update_xkanjiskip:
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,12 +24,12 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {XeLaTeX adapter (CTEX)}
 \ProvidesExplFile{ctex-engine-xetex.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \RequirePackage { xeCJK }
-\exp_args:Nx \xeCJKsetup
+\exp_args:Ne \xeCJKsetup
   {
     LoadFandol   = false ,
     PunctStyle   = \l__ctex_punct_tl
@@ -78,40 +78,43 @@
       { \exp_not:o { \CTEX at selectfont@hook #1 } }
   }
 \cs_new_eq:NN \CTEX at selectfont@hook \prg_do_nothing:
-\if_bool:N \c__ctex_everysel_loaded_bool
-  \if_cs_exist:N \@EverySelectfont at Init
-    \group_begin:
-      \cs_set:Npn \__ctex_tmp:N #1
-        {
-          \tl_set:Nn \l__ctex_tmp_tl {#1}
-          \cs_new_eq:NN \CTEX at selectfont@save #1
-          \cs_new_protected:Npn \__ctex_restore_selectfont:
-            {
-              \cs_if_free:NF \scr at new@selectfont
-                {
-                  \cs_set_eq:NN \scr at new@selectfont #1
-                  \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
-                }
-              \tl_put_left:Nn \@EverySelectfont at Init
-                { \cs_set_eq:NN #1 \CTEX at selectfont@save }
-              \cs_undefine:N \__ctex_restore_selectfont:
-            }
-        }
-      \ctex_parse_name:NN \__ctex_tmp:N \selectfont
-    \exp_last_unbraced:NNo \group_end:
-    \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
-      { \ExplSyntaxOff }
-      { \size at update }
-      { \CTEX at selectfont@hook \size at update }
-      { \__ctex_restore_selectfont: }
-      { \ctex_patch_failure:N \selectfont }
-  \fi:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \EverySelectfont }
-\else:
-  \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
-    { \ctex_gadd_ltxhook:nn { selectfont } }
-\fi:
+\bool_if:NTF \c__ctex_everysel_loaded_bool
+  {
+    \cs_if_free:NF \@EverySelectfont at Init
+      {
+        \group_begin:
+        \cs_set:Npn \__ctex_tmp:N #1
+          {
+            \tl_set:Nn \l__ctex_tmp_tl {#1}
+            \cs_new_eq:NN \CTEX at selectfont@save #1
+            \cs_new_protected:Npn \__ctex_restore_selectfont:
+              {
+                \cs_if_free:NF \scr at new@selectfont
+                  {
+                    \cs_set_eq:NN \scr at new@selectfont #1
+                    \cs_set_eq:NN \CTEX at selectfont@save \scr at selectfont
+                  }
+                \tl_put_left:Nn \@EverySelectfont at Init
+                  { \cs_set_eq:NN #1 \CTEX at selectfont@save }
+                \cs_undefine:N \__ctex_restore_selectfont:
+              }
+          }
+        \ctex_parse_name:NN \__ctex_tmp:N \selectfont
+      \exp_last_unbraced:NNo \group_end:
+      \ctex_patch_cmd_once:NnnnTF { \l__ctex_tmp_tl }
+        { \ExplSyntaxOff }
+        { \size at update }
+        { \CTEX at selectfont@hook \size at update }
+        { \__ctex_restore_selectfont: }
+        { \ctex_patch_failure:N \selectfont }
+      }
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \EverySelectfont }
+  }
+  {
+    \cs_new_protected:Npn \ctex_gadd_selectfont_hook:n
+      { \ctex_gadd_ltxhook:nn { selectfont } }
+  }
 \ctex_gadd_selectfont_hook:n { \CTEX at selectfont@hook }
 \ctex_define:n
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{c19rm.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{c19sf.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{c19tt.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{c70rm.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{c70sf.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{c70tt.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 %%
 %% Chinese characters
 %%

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhrm.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhrm.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhrm.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{jt2zhrm.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 \DeclareKanjiFamily{JT2}{zhrm}{}
 \DeclareFontShape{JT2}{zhrm}{m}{n}{<-> upzhserif-v}{}
 \DeclareFontShape{JT2}{zhrm}{m}{it}{<-> upzhserifit-v}{}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhsf.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhsf.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhsf.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{jt2zhsf.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 \DeclareKanjiFamily{JT2}{zhsf}{}
 \DeclareFontShape{JT2}{zhsf}{m}{n}{<-> upzhsans-v}{}
 \DeclareFontShape{JT2}{zhsf}{b}{n}{<-> upzhsansb-v}{}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhtt.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/jt2zhtt.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{jt2zhtt.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 \DeclareKanjiFamily{JT2}{zhtt}{}
 \DeclareFontShape{JT2}{zhtt}{m}{n}{<-> upzhmono-v}{}
 %% 

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhrm.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhrm.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhrm.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{jy2zhrm.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 \DeclareKanjiFamily{JY2}{zhrm}{}
 \DeclareFontShape{JY2}{zhrm}{m}{n}{<-> upzhserif-h}{}
 \DeclareFontShape{JY2}{zhrm}{m}{it}{<-> upzhserifit-h}{}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhsf.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhsf.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhsf.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{jy2zhsf.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 \DeclareKanjiFamily{JY2}{zhsf}{}
 \DeclareFontShape{JY2}{zhsf}{m}{n}{<-> upzhsans-h}{}
 \DeclareFontShape{JY2}{zhsf}{b}{n}{<-> upzhsansb-h}{}

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhtt.fd
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhtt.fd	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fd/jy2zhtt.fd	2022-07-14 20:18:14 UTC (rev 63891)
@@ -25,7 +25,7 @@
 %% ---------------------------------------------------------------------
 %% 
 \ProvidesFile{jy2zhtt.fd}%
-  [2022/06/04 v2.5.9 Chinese font definition (CTEX)]
+  [2022/07/14 v2.5.10 Chinese font definition (CTEX)]
 \DeclareKanjiFamily{JY2}{zhtt}{}
 \DeclareFontShape{JY2}{zhtt}{m}{n}{<-> upzhmono-h}{}
 %% 

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Adobe fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-adobe.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_fontset_case:nnnn
   { \ctex_fontset_error:n { adobe } }
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Fandol fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-fandol.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_fontset_case:nnnn
   { \ctex_fontset_error:n { fandol } }
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Founder fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-founder.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_fontset_case:nnn
   {
     \ctex_zhmap_case:nnn

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {macOS fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-mac.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \file_if_exist:nTF { /System/Library/Fonts/PingFang.ttc }
   { \ctex_file_input:n { ctex-fontset-macnew.def } }
   { \ctex_file_input:n { ctex-fontset-macold.def } }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macnew.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macnew.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macnew.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {macOS fonts definition for El Capitan or later version (CTEX)}
 \ProvidesExplFile{ctex-fontset-macnew.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_fontset_case:nnnn
   { \ctex_fontset_error:n { mac } }
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macold.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macold.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macold.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {macOS fonts definition for Yosemite or earlier version (CTEX)}
 \ProvidesExplFile{ctex-fontset-macold.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_fontset_case:nnnn
   { \ctex_fontset_error:n { mac } }
   { \ctex_fontset_error:n { macold } }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Ubuntu fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-ubuntu.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_fontset_case:nnnn
   { \ctex_fontset_error:n { ubuntu } }
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Windows fonts definition (CTEX)}
 \ProvidesExplFile{ctex-fontset-windows.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \file_if_exist:nTF { \c_dollar_str WINDIR/Fonts/msyh.ttc }
   { \tl_const:Nn \c__ctex_msyh_suffix_tl { ttc } }
   {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-article.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-article.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-article.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading modification for article (CTEX)}
 \ProvidesExplFile{ctex-article.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \seq_const_from_clist:Nn \c__ctex_section_headings_seq
   { section , subsection , subsubsection , paragraph , subparagraph }
 \seq_new:N \c__ctex_headings_seq
@@ -65,11 +65,11 @@
   }
 \cs_new_protected:Npn \__ctex_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l__ctex_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -87,8 +87,7 @@
         #1 / hang        .bool_set:N = \exp_not:c { CTEX@#1 at hang } ,
         #1 / hang         .initial:n = true ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
-        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline}
-                                       \exp_not:n { ##1##2 } ,
+        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline } ##1##2 ,
         \__ctex_plus_key_aux:nn {#1} { break } ,
         \__ctex_plus_key_aux:nn {#1} { format } ,
         \__ctex_plus_key_aux:nn {#1} { nameformat } ,
@@ -102,9 +101,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 \NewDocumentCommand \ctex_assign_heading_name:nn
   { m > { \SplitArgument { 1 } { , } } +m }
@@ -428,20 +427,22 @@
 \cs_new_protected:Npn \CTEX at hyperheadinghook
   {
     \group_begin:
-      \ifHy at implicit
-        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          {
-            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
-              {
-                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
-                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
-              }
-          }
-      \else:
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
-      \fi:
+      \legacy_if:nTF { Hy at implicit }
+        {
+          \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            {
+              \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+                {
+                  \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                  \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+                }
+            }
+        }
+        {
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+        }
     \group_end:
   }
 \ctex_at_end_package:nn { hyperref }
@@ -566,7 +567,7 @@
         \CTEX at updatettlifname
       }
     \cs_new_protected:Npn \CTEX at updatettlifname
-      { \ifttl at label \CTEX at ifnametrue \else: \CTEX at ifnamefalse \fi: }
+      { \legacy_if:nTF { ttl at label } { \CTEX at ifnametrue } { \CTEX at ifnamefalse } }
   }
 \group_begin:
 \char_set_catcode_other:N \#
@@ -654,18 +655,20 @@
   }
 \__ctex_patch_toc_width:n { tocloft  }
 \__ctex_patch_toc_width:n { titletoc }
-\if at twoside
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
-    { \CTEXifname { \CTEXthesubsection \quad } { } }
-\else:
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \m at ne \thesection \quad \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-\fi:
+\legacy_if:nTF { @twoside }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+      { \CTEXifname { \CTEXthesubsection \quad } { } }
+  }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \m at ne \thesection \quad \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+  }
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \f at nch@initialise
@@ -683,18 +686,20 @@
     \f at nch@initialise
     \@ifpackagewith { fancyhdr } { headings }
       {
-        \if at twoside
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
-            { \CTEXifname { \CTEXthesubsection \quad } { } }
-        \else:
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-        \fi:
+        \legacy_if:nTF { @twoside }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \@ne \thesubsection \quad \fi }
+              { \CTEXifname { \CTEXthesubsection \quad } { } }
+          }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection \quad \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+          }
       }
       { }
   }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-beamer.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-beamer.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-beamer.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading modification for beamer (CTEX)}
 \ProvidesExplFile{ctex-beamer.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \seq_const_from_clist:Nn \c__ctex_headings_seq
   { part , section , subsection }
 \cs_new_protected:Npn \__ctex_initial_heading:n #1
@@ -62,11 +62,11 @@
   }
 \cs_new_protected:Npn \__ctex_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l__ctex_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -91,9 +91,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 \NewDocumentCommand \ctex_assign_heading_name:nn
   { m > { \SplitArgument { 1 } { , } } +m }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-book.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-book.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading modification for book (CTEX)}
 \ProvidesExplFile{ctex-book.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \seq_const_from_clist:Nn \c__ctex_section_headings_seq
   { section , subsection , subsubsection , paragraph , subparagraph }
 \seq_new:N \c__ctex_headings_seq
@@ -66,11 +66,11 @@
   }
 \cs_new_protected:Npn \__ctex_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l__ctex_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -88,8 +88,7 @@
         #1 / hang        .bool_set:N = \exp_not:c { CTEX@#1 at hang } ,
         #1 / hang         .initial:n = true ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
-        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline}
-                                       \exp_not:n { ##1##2 } ,
+        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline } ##1##2 ,
         \__ctex_plus_key_aux:nn {#1} { break } ,
         \__ctex_plus_key_aux:nn {#1} { format } ,
         \__ctex_plus_key_aux:nn {#1} { nameformat } ,
@@ -103,9 +102,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 \NewDocumentCommand \ctex_assign_heading_name:nn
   { m > { \SplitArgument { 1 } { , } } +m }
@@ -169,6 +168,8 @@
 \cs_new_protected:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\cs_new_protected:Npn \CTEX at setthispagestyle #1
+  { \exp_args:Ne \thispagestyle { \use:c { CTEX@#1 at pagestyle } } }
 \ProvideDocumentCommand \partmark { m }
   { \markboth { } { } }
 \cs_new_eq:NN \CTEXifname \use_ii:nn
@@ -195,7 +196,7 @@
   { \addcontentsline { toc } {#1} { \use:c { CTEX@#1 at tocline } {#1} {#2} } }
 \renewcommand\part{%
   \CTEX at part@break
-  \thispagestyle{\CTEX at part@pagestyle}%
+  \CTEX at setthispagestyle{part}%
   \if at twocolumn
     \onecolumn
     \@tempswatrue
@@ -260,7 +261,7 @@
   \fi}
 \renewcommand\chapter{%
   \CTEX at chapter@break
-  \thispagestyle{\CTEX at chapter@pagestyle}%
+  \CTEX at setthispagestyle{chapter}%
   \global\@topnum\z@
   \ifodd \CTEX at chapter@afterindent
     \@afterindenttrue
@@ -554,20 +555,22 @@
 \cs_new_protected:Npn \CTEX at hyperheadinghook
   {
     \group_begin:
-      \ifHy at implicit
-        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          {
-            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
-              {
-                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
-                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
-              }
-          }
-      \else:
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
-      \fi:
+      \legacy_if:nTF { Hy at implicit }
+        {
+          \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            {
+              \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+                {
+                  \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                  \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+                }
+            }
+        }
+        {
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+        }
     \group_end:
   }
 \ctex_at_end_package:nn { hyperref }
@@ -693,7 +696,7 @@
         \CTEX at updatettlifname
       }
     \cs_new_protected:Npn \CTEX at updatettlifname
-      { \ifttl at label \CTEX at ifnametrue \else: \CTEX at ifnamefalse \fi: }
+      { \legacy_if:nTF { ttl at label } { \CTEX at ifnametrue } { \CTEX at ifnamefalse } }
   }
 \group_begin:
 \char_set_catcode_other:N \#
@@ -788,11 +791,12 @@
     \fi \fi
   }
   { \CTEXifname { \CTEXthechapter \quad } { } }
-\if at twoside
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-\fi:
+\legacy_if:nT { @twoside }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+  }
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \f at nch@initialise
@@ -817,11 +821,12 @@
             \fi \fi
           }
           { \CTEXifname { \CTEXthechapter \quad } { } }
-        \if at twoside
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-        \fi:
+        \legacy_if:nT { @twoside }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+          }
       }
       { }
   }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-report.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-report.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-report.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Heading modification for report (CTEX)}
 \ProvidesExplFile{ctex-report.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \seq_const_from_clist:Nn \c__ctex_section_headings_seq
   { section , subsection , subsubsection , paragraph , subparagraph }
 \seq_new:N \c__ctex_headings_seq
@@ -66,11 +66,11 @@
   }
 \cs_new_protected:Npn \__ctex_def_heading_keys:n #1
   {
-    \tl_put_right:Nx \l__ctex_tmp_tl
+    \exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl
       {
-        #1                  .meta:nn = { ctex / #1 } { ####1 } ,
+        #1                  .meta:nn = { ctex / #1 } { ##1 } ,
         #1 / name            .code:n =
-          { \ctex_assign_heading_name:nn {#1} { ####1 } } ,
+          { \ctex_assign_heading_name:nn {#1} { ##1 } } ,
         #1 / number        .tl_set:N = \exp_not:c { CTEX at the#1 } ,
         #1 / beforeskip    .tl_set:N = \exp_not:c { CTEX@#1 at beforeskip } ,
         #1 / afterskip     .tl_set:N = \exp_not:c { CTEX@#1 at afterskip} ,
@@ -88,8 +88,7 @@
         #1 / hang        .bool_set:N = \exp_not:c { CTEX@#1 at hang } ,
         #1 / hang         .initial:n = true ,
         #1 / runin       .bool_set:N = \exp_not:c { CTEX@#1 at runin } ,
-        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline}
-                                       \exp_not:n { ##1##2 } ,
+        #1 / tocline      .cs_set:Np = \exp_not:c { CTEX@#1 at tocline } ##1##2 ,
         \__ctex_plus_key_aux:nn {#1} { break } ,
         \__ctex_plus_key_aux:nn {#1} { format } ,
         \__ctex_plus_key_aux:nn {#1} { nameformat } ,
@@ -103,9 +102,9 @@
   {
     #1 / #2   .tl_set:N = \exp_not:c { CTEX@#1@#2 } ,
     #1 / #2 +   .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } } ,
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } ,
     #1 / #2 ~ + .code:n =
-      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ####1 } }
+      { \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } }
   }
 \NewDocumentCommand \ctex_assign_heading_name:nn
   { m > { \SplitArgument { 1 } { , } } +m }
@@ -169,6 +168,8 @@
 \cs_new_protected:Npn \CTEX at setheadingskip
   { \skip_set:Nn \l__ctex_heading_skip }
 \cs_new_eq:NN \CTEX at headingskip \l__ctex_heading_skip
+\cs_new_protected:Npn \CTEX at setthispagestyle #1
+  { \exp_args:Ne \thispagestyle { \use:c { CTEX@#1 at pagestyle } } }
 \ProvideDocumentCommand \partmark { m }
   { \markboth { } { } }
 \cs_new_eq:NN \CTEXifname \use_ii:nn
@@ -195,7 +196,7 @@
   { \addcontentsline { toc } {#1} { \use:c { CTEX@#1 at tocline } {#1} {#2} } }
 \renewcommand\part{%
   \CTEX at part@break
-  \thispagestyle{\CTEX at part@pagestyle}%
+  \CTEX at setthispagestyle{part}%
   \if at twocolumn
     \onecolumn
     \@tempswatrue
@@ -260,7 +261,7 @@
   \fi}
 \renewcommand\chapter{%
   \CTEX at chapter@break
-  \thispagestyle{\CTEX at chapter@pagestyle}%
+  \CTEX at setthispagestyle{chapter}%
   \global\@topnum\z@
   \ifodd \CTEX at chapter@afterindent
     \@afterindenttrue
@@ -549,20 +550,22 @@
 \cs_new_protected:Npn \CTEX at hyperheadinghook
   {
     \group_begin:
-      \ifHy at implicit
-        \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          {
-            \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
-              {
-                \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
-                \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
-              }
-          }
-      \else:
-        \seq_map_inline:Nn \c__ctex_headings_cs_seq
-          { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
-      \fi:
+      \legacy_if:nTF { Hy at implicit }
+        {
+          \cs_set_eq:NN \H at old@chapter \Hy at org@chapter
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            {
+              \cs_if_eq:ccT { H at old@ ##1 } { CTEX@ ##1 }
+                {
+                  \cs_gset_eq:cc { @ ##1 } { CTEX@ ##1 }
+                  \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor
+                }
+            }
+        }
+        {
+          \seq_map_inline:Nn \c__ctex_headings_cs_seq
+            { \cs_gset_eq:cN { CTEX at makeanchor@ ##1 } \CTEX at makeanchor }
+        }
     \group_end:
   }
 \ctex_at_end_package:nn { hyperref }
@@ -688,7 +691,7 @@
         \CTEX at updatettlifname
       }
     \cs_new_protected:Npn \CTEX at updatettlifname
-      { \ifttl at label \CTEX at ifnametrue \else: \CTEX at ifnamefalse \fi: }
+      { \legacy_if:nTF { ttl at label } { \CTEX at ifnametrue } { \CTEX at ifnamefalse } }
   }
 \group_begin:
 \char_set_catcode_other:N \#
@@ -783,11 +786,12 @@
     \fi
   }
   { \CTEXifname { \CTEXthechapter \quad } { } }
-\if at twoside
-  \ctex_patch_cmd:Nnn \ps at headings
-    { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-    { \CTEXifname { \CTEXthesection \quad } { } }
-\fi:
+\legacy_if:nT { @twoside }
+  {
+    \ctex_patch_cmd:Nnn \ps at headings
+      { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+      { \CTEXifname { \CTEXthesection \quad } { } }
+  }
 \ctex_at_end_package:nn { fancyhdr }
   {
     \ctex_patch_cmd:Nnn \f at nch@initialise
@@ -812,11 +816,12 @@
             \fi
           }
           { \CTEXifname { \CTEXthechapter \quad } { } }
-        \if at twoside
-          \ctex_patch_cmd:Nnn \ps at headings
-            { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
-            { \CTEXifname { \CTEXthesection \quad } { } }
-        \fi:
+        \legacy_if:nT { @twoside }
+          {
+            \ctex_patch_cmd:Nnn \ps at headings
+              { \ifnum \c at secnumdepth > \z@ \thesection . ~ \ \fi }
+              { \CTEXifname { \CTEXthesection \quad } { } }
+          }
       }
       { }
   }

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for article (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese-article.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:nn { part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for beamer (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese-beamer.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:nn { part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for book (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese-book.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:nn { part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for report (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese-report.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:nn { part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,15 +24,14 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Chinese scheme for generic (CTEX)}
 \ProvidesExplFile{ctex-scheme-chinese.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:n { today = small }
 \ctex_if_autoindent_touched:F
   { \ctex_set:n { autoindent = true } }
-\tl_set:Nn \l__ctex_tmp_tl { beamer }
-\tl_if_eq:NNTF \c__ctex_std_class_tl \l__ctex_tmp_tl
+\tl_if_eq:NnTF \c__ctex_std_class_tl { beamer }
   {
     \str_if_eq:onTF { \g__ctex_encoding_tl } { GBK }
       {

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for article (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain-article.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:nn { part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for beamer (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain-beamer.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:nn { part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for book (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain-book.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:nn { part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for report (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain-report.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 \ctex_set:nn { part }
   {
     aftertitle  = \par ,

Modified: trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def
===================================================================
--- trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def	2022-07-14 20:16:39 UTC (rev 63890)
+++ trunk/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def	2022-07-14 20:18:14 UTC (rev 63891)
@@ -24,10 +24,10 @@
 %% 
 %% ---------------------------------------------------------------------
 %% 
-\GetIdInfo$Id: ctex.dtx c6b2e9c 2022-06-04 19:41:06 +0800 Qing Lee <sobenlee at gmail.com> $
+\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <sobenlee at gmail.com> $
   {Plain scheme for generic (CTEX)}
 \ProvidesExplFile{ctex-scheme-plain.def}
-  {\ExplFileDate}{2.5.9}{\ExplFileDescription}
+  {\ExplFileDate}{2.5.10}{\ExplFileDescription}
 %% 
 %%
 %% End of file `ctex-scheme-plain.def'.



More information about the tex-live-commits mailing list.