From 5bf4853ebb35ad3d6545264980e6d6d600951622 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 22 Nov 2016 22:49:28 +0000
Subject: ctex (22nov16)

git-svn-id: svn://tug.org/texlive/trunk@42554 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/ctex/ctex.dtx | 103 ++++++++++++++++++---------
 1 file changed, 71 insertions(+), 32 deletions(-)

(limited to 'Master/texmf-dist/source/latex/ctex/ctex.dtx')

diff --git a/Master/texmf-dist/source/latex/ctex/ctex.dtx b/Master/texmf-dist/source/latex/ctex/ctex.dtx
index cf5013e2899..cd63f6a57ec 100644
--- a/Master/texmf-dist/source/latex/ctex/ctex.dtx
+++ b/Master/texmf-dist/source/latex/ctex/ctex.dtx
@@ -413,7 +413,7 @@ Copyright and Licence
 %<*!(c19|c70|ctexspa|dict)>
 %<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\NeedsTeXFormat{LaTeX2e}
 %<class|style|ctexcap|ctexhook|ctexpatch|ctxdoc>\RequirePackage{expl3}
-%<+!driver>\GetIdInfo$Id: ctex.dtx 575f038 2016-10-25 17:56:58 +0800 Qing Lee <sobenlee@gmail.com> $
+%<+!driver>\GetIdInfo$Id: ctex.dtx 88a59e5 2016-11-22 17:09:10 +0800 Qing Lee <sobenlee@gmail.com> $
 %<ctxdoc>  {ctex documentation (CTEX)}
 %<ctxdoc>\ProvidesExplClass{ctxdoc}
 %<ctex>  {Chinese adapter in LaTeX (CTEX)}
@@ -502,7 +502,7 @@ Copyright and Licence
 %<founder>\ProvidesExplFile{ctex-fontset-founder.def}
 %<ubuntu>  {Ubuntu fonts definition (CTEX)}
 %<ubuntu>\ProvidesExplFile{ctex-fontset-ubuntu.def}
-%<!driver>  {\ExplFileDate}{2.4.5}{\ExplFileDescription}
+%<!driver>  {\ExplFileDate}{2.4.6}{\ExplFileDescription}
 %</!(c19|c70|ctexspa|dict)>
 %<c19&rm>\ProvidesFile{c19rm.fd}%
 %<c19&sf>\ProvidesFile{c19sf.fd}%
@@ -513,9 +513,9 @@ Copyright and Licence
 %<ctexspa>\ProvidesFile{ctexspa.def}%
 %<dict&theorem&GBK>\ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}%
 %<dict&theorem&UTF8>\ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}%
-%<c19|c70>  [2016/10/25 v2.4.5 Chinese font definition (CTEX)]
-%<ctexspa>  [2016/10/25 v2.4.5 Space info for CJKpunct (CTEX)]
-%<dict&theorem>  [2016/10/25 v2.4.5 Chinese translation for theorem name (CTEX)]
+%<c19|c70>  [2016/11/22 v2.4.6 Chinese font definition (CTEX)]
+%<ctexspa>  [2016/11/22 v2.4.6 Space info for CJKpunct (CTEX)]
+%<dict&theorem>  [2016/11/22 v2.4.6 Chinese translation for theorem name (CTEX)]
 %</!(driver|readme|install|zhmap|spa|docstrip)>
 %<*driver>
 \documentclass{ctxdoc}
@@ -537,7 +537,7 @@ Copyright and Licence
 % \changes{v2.4}{2015/02/19}{加强 \pkg{beamer} 宏包支持。}
 %
 %
-% \CheckSum{5862}
+% \CheckSum{5876}
 %
 % \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
@@ -4789,8 +4789,6 @@ Copyright and Licence
       }
     \group_end:
   }
-\cs_new_protected:Npn \ctex_ltj_set_family:xxx #1#2#3
-  { \use:x { \ctex_ltj_set_family:nnn {#1} {#2} {#3} } }
 \tl_new:N \l_@@_base_CJKfamily_tl
 \clist_new:N \l_@@_font_options_clist
 \cs_new_protected_nopar:Npn \@@_use_global_options:N #1
@@ -5025,23 +5023,52 @@ Copyright and Licence
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}[int]{\@@_pass_args:nnnn}
+% 为了支持字体属性可选项在前在后两种语法，给出两个辅助工具，自带展开功能。
+%    \begin{macrocode}
+\cs_new_protected:Npn \@@_pass_args:nnnn #1#2#3#4
+  {
+    \IfNoValueTF {#2}
+      { \@@_post_arg:w {#1} {#3} {#4} }
+      {
+        \use:x { #1 {#2} {#3} }
+        #4
+      }
+  }
+\NewDocumentCommand \@@_post_arg:w { m m m O { } }
+  {
+    \use:x { #1 {#4} {#2} }
+    #3
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+% \changes{v2.4.6}{2016/11/20}{支持字体属性可选项在后的新语法。}
+%
 % \begin{macro}[int]
 % {\setCJKfamilyfont,\newCJKfontfamily,\CJKfontspec,\addCJKfontfeatures}
 %    \begin{macrocode}
-\NewDocumentCommand \setCJKfamilyfont { m O { } m }
-  { \ctex_ltj_set_family:xxx {#1} {#2} {#3} }
-\NewDocumentCommand \newCJKfontfamily { o m O { } m }
+\NewDocumentCommand \setCJKfamilyfont { m o m }
+  {
+    \@@_pass_args:nnnn
+      { \ctex_ltj_set_family:nnn {#1} } {#2} {#3}
+      { }
+  }
+\NewDocumentCommand \newCJKfontfamily { o m o m }
   {
     \tl_set:Nx \l_@@_tmp_tl
       { \IfNoValueTF {#1} { \cs_to_str:N #2 } {#1} }
     \cs_new_protected_nopar:Npx #2
       { \ctex_ltj_switch_family:n { \l_@@_tmp_tl } }
-    \ctex_ltj_set_family:xxx { \l_@@_tmp_tl } {#3} {#4}
+    \@@_pass_args:nnnn
+      { \ctex_ltj_set_family:nnn { \l_@@_tmp_tl } } {#3} {#4}
+      { }
   }
-\NewDocumentCommand \CJKfontspec { O { } m }
+\NewDocumentCommand \CJKfontspec { o m }
   {
-    \ctex_ltj_fontspec:xx {#1} {#2}
-    \tex_ignorespaces:D
+    \@@_pass_args:nnnn
+      { \ctex_ltj_fontspec:nn } {#1} {#2}
+      { \tex_ignorespaces:D }
   }
 \NewDocumentCommand \addCJKfontfeatures { m }
   {
@@ -5056,24 +5083,31 @@ Copyright and Licence
 % {\setCJKmainfont,\setCJKsansfont,\setCJKmonofont,
 %  \setCJKmathfont,\defaultCJKfontfeatures}
 %    \begin{macrocode}
-\NewDocumentCommand \setCJKmainfont { O { } m }
+\NewDocumentCommand \setCJKmainfont { o m }
   {
-    \ctex_ltj_set_family:xxx { \CJKrmdefault } {#1} {#2}
-    \normalfont
+    \@@_pass_args:nnnn
+      { \ctex_ltj_set_family:nnn { \CJKrmdefault } } {#1} {#2}
+      { \normalfont }
   }
 \cs_new_eq:NN \setCJKromanfont \setCJKmainfont
-\NewDocumentCommand \setCJKsansfont { O { } m }
+\NewDocumentCommand \setCJKsansfont { o m }
   {
-    \ctex_ltj_set_family:xxx { \CJKsfdefault } {#1} {#2}
-    \normalfont
+    \@@_pass_args:nnnn
+      { \ctex_ltj_set_family:nnn { \CJKsfdefault } } {#1} {#2}
+      { \normalfont }
   }
-\NewDocumentCommand \setCJKmonofont { O { } m }
+\NewDocumentCommand \setCJKmonofont { o m }
   {
-    \ctex_ltj_set_family:xxx { \CJKttdefault } {#1} {#2}
-    \normalfont
+    \@@_pass_args:nnnn
+      { \ctex_ltj_set_family:nnn { \CJKttdefault } } {#1} {#2}
+      { \normalfont }
+  }
+\NewDocumentCommand \setCJKmathfont { o m }
+  {
+    \@@_pass_args:nnnn
+      { \ctex_ltj_set_family:nnn { \c_@@_math_tl } } {#1} {#2}
+      { }
   }
-\NewDocumentCommand \setCJKmathfont { O { } m }
-  { \ctex_ltj_set_family:xxx { \c_@@_math_tl } {#1} {#2} }
 \NewDocumentCommand \defaultCJKfontfeatures { m }
   { \clist_gset:Nn \g_@@_default_features_clist {#1} }
 \clist_new:N \g_@@_default_features_clist
@@ -7015,11 +7049,12 @@ Copyright and Licence
 % \end{macro}
 %
 % \changes{v2.4.4}{2016/09/19}{提供 \tn{CTEXifname}。}
+% \changes{v2.4.6}{2016/10/31}{\tn{CTEXifname} 初始为假。}
 % \begin{macro}{\CTEXifname}
 % \begin{macro}[int]{\CTEX@ifnametrue,\CTEX@ifnamefalse}
 % 用于判断当前标题是否有编号。
 %    \begin{macrocode}
-\cs_new_eq:NN \CTEXifname \use_i:nn
+\cs_new_eq:NN \CTEXifname \use_ii:nn
 \cs_new_protected_nopar:Npn \CTEX@ifnametrue
   { \cs_set_eq:NN \CTEXifname \use_i:nn }
 \cs_new_protected_nopar:Npn \CTEX@ifnamefalse
@@ -7585,6 +7620,7 @@ Copyright and Licence
       { }
     #2
   }
+%<*book|report>
 \cs_new:Npn \CTEX@chapter@tocline #1#2
   {
     \CTEXifname
@@ -7592,6 +7628,7 @@ Copyright and Licence
       { }
     #2
   }
+%</book|report>
 %    \end{macrocode}
 % \end{macro}
 %
@@ -7934,6 +7971,7 @@ Copyright and Licence
 % \end{verbatim}
 % 但 \tn{newtitlemark} 不包含章节间的层次信息，功能上不及修改内部命令完整。
 %
+% \changes{v2.4.6}{2016/10/31}{重新初始化 \tn{ifthechapter} 等。}
 % \begin{macro}[int]{\ttl@setifthe}
 % 使 |\iftheXXX| 等命令在页眉设置中可用。
 %    \begin{macrocode}
@@ -7948,6 +7986,7 @@ Copyright and Licence
               { \protect \@secondoftwo }
           }
       }
+    \seq_map_function:NN \c_@@_headings_seq \ttl@setifthe
   }
 %    \end{macrocode}
 % \end{macro}
@@ -9933,7 +9972,7 @@ Copyright and Licence
 %    \begin{macrocode}
 %<*windows>
 \ProvidesFile{zhwindowsfonts.tex}%
-  [2016/10/25 v2.4.5 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/11/22 v2.4.6 Windows font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk@UGBK@     <simsun.ttc}
@@ -10005,7 +10044,7 @@ Copyright and Licence
 %    \begin{macrocode}
 %<*adobe>
 \ProvidesFile{zhadobefonts.tex}%
-  [2016/10/25 v2.4.5 Adobe font map loader for DVIPDFMx (CTEX)]
+  [2016/11/22 v2.4.6 Adobe font map loader for DVIPDFMx (CTEX)]
 
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts
@@ -10041,7 +10080,7 @@ Copyright and Licence
 %    \begin{macrocode}
 %<*fandol>
 \ProvidesFile{zhfandolfonts.tex}%
-  [2016/10/25 v2.4.5 Fandol font map loader for DVIPDFMx (CTEX)]
+  [2016/11/22 v2.4.6 Fandol font map loader for DVIPDFMx (CTEX)]
 
 \ifzhmappdf
 %% pdfTeX does not support OTF fonts
@@ -10077,7 +10116,7 @@ Copyright and Licence
 %    \begin{macrocode}
 %<*founder>
 \ProvidesFile{zhfounderfonts.tex}%
-  [2016/10/25 v2.4.5 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/11/22 v2.4.6 Founder font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk@UGBK@     <FZSSK.TTF}
@@ -10149,7 +10188,7 @@ Copyright and Licence
 %    \begin{macrocode}
 %<*ubuntu>
 \ProvidesFile{zhubuntufonts.tex}%
-  [2016/10/25 v2.4.5 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)]
+  [2016/11/22 v2.4.6 Ubuntu font map loader for pdfTeX and DVIPDFMx (CTEX)]
 
 \ifzhmappdf
   \pdfmapline{=gbk@UGBK@     <uming.ttc}
-- 
cgit v1.2.3

