diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex')
62 files changed, 3804 insertions, 3661 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg index 3f53f2151a5..74898c8ade5 100644 --- a/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg +++ b/Master/texmf-dist/tex/latex/ctex/config/ctex-name-gbk.cfg @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `name,GBK') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Caption with encoding GBK (CTEX)} \ProvidesExplFile{ctex-name-gbk.cfg} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \keys_set_known:nn { ctex } { contentsname = Ŀ¼ , diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg index 37725a7f6c7..ad9ccbc4fc2 100644 --- a/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg +++ b/Master/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `name,UTF8') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ - {Caption with encoding UTF8 (CTEX)} +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ + {Caption with encoding UTF-8 (CTEX)} \ProvidesExplFile{ctex-name-utf8.cfg} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \keys_set_known:nn { ctex } { contentsname = 目录 , diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg index 45d3cea9ddd..f7e4a188bbd 100644 --- a/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg +++ b/Master/texmf-dist/tex/latex/ctex/config/ctex.cfg @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `config') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Configuration file (CTEX)} \ProvidesExplFile{\ExplFileName.cfg} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} %% %% %% diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg new file mode 100644 index 00000000000..954fcb26e2c --- /dev/null +++ b/Master/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg @@ -0,0 +1,51 @@ +%% +%% This is file `ctexbackend.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ctex.dtx (with options: `backend') +%% +%% Copyright (C) 2003--2020 +%% CTEX.ORG and any individual authors listed in the documentation. +%% --------------------------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. This version of this license is in +%% http://www.latex-project.org/lppl/lppl-1-3c.txt +%% and the latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% --------------------------------------------------------------------- +%% +\ProvidesFile{ctexbackend.cfg}% + [2020/05/02 v2.5.1 Backend configuration file (CTEX)] +\begingroup +\expandafter\ifx\csname Umathchardef\endcsname\relax +\else\expandafter\endgroup\expandafter\endinput\fi + \ifodd + \expandafter\ifx\csname pdfoutput\endcsname\relax + \expandafter\ifx\csname enablecjktoken\endcsname\relax 0\else 1\fi + \else\ifnum\pdfoutput>0 0\else 1\fi\fi\space + \def\x#1{% + \if\relax\detokenize{#1}\relax + \gdef\@classoptionslist{dvipdfmx}% + \else + \let\CTEX@add\@ne + \@tfor\x:={dvips}{dvipdfmx}{dvisvgm}\do{% + \expandafter\in@\expandafter{\expandafter,\x,}{,#1,}% + \ifin@ \let\CTEX@add\tw@ \@break@tfor \fi}% + \ifodd\CTEX@add \gdef\@classoptionslist{dvipdfmx,#1}\fi + \fi} + \expandafter\x\expandafter{\@classoptionslist} + \fi +\endgroup +%% +%% +%% End of file `ctexbackend.cfg'. diff --git a/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg b/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg index 84f62f1e10d..6ae99b93903 100644 --- a/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg +++ b/Master/texmf-dist/tex/latex/ctex/config/ctexopts.cfg @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `ctexopts') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,18 +20,16 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Option configuration file (CTEX)} \ProvidesExplFile{ctexopts.cfg} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} %% -%% \keys_set:nn { ctex / option } { fontset = windowsnew } +%% \ctex_set:nn { option } { fontset = windows } %% %% %% End of file `ctexopts.cfg'. diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo b/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo index 9f3d9794803..c22dda7f02c 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo +++ b/Master/texmf-dist/tex/latex/ctex/ctex-c5size.clo @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `c5size') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {c5size option (CTEX)} \ProvidesExplFile{ctex-c5size.clo} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \ctex_set_font_size:Nnn \normalsize { 5 } { \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@ diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo b/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo index 68f3e365f73..cd08fffa853 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo +++ b/Master/texmf-dist/tex/latex/ctex/ctex-cs4size.clo @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `cs4size') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {cs4size option (CTEX)} \ProvidesExplFile{ctex-cs4size.clo} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \ctex_set_font_size:Nnn \normalsize { -4 } { \abovedisplayskip 12\p@ \@plus3\p@ \@minus7\p@ diff --git a/Master/texmf-dist/tex/latex/ctex/ctex.sty b/Master/texmf-dist/tex/latex/ctex/ctex.sty index 14134e13433..617162c50b4 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctex.sty @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `style,ctex') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,18 +20,16 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter in LaTeX (CTEX)} \ProvidesExplPackage{\ExplFileName} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \msg_new:nnnn { ctex } { subpackage-loaded } @@ -50,11 +48,11 @@ \msg_new:nnnn { ctex } { l3-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~bundles\\\\ + Please~update~an~up-to-date~version~of~the~bundles\\\\ `l3kernel'~and~`l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2019/03/05 } { } +\@ifpackagelater { expl3 } { 2020/04/06 } { } { \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 } } @@ -68,11 +66,20 @@ } { \msg_critical:nnx { ctex } { engine-not-supported } { \c__ctex_engine_str } } \RequirePackage { ctexhook , ctexpatch } -\RequirePackage { fix-cm , everysel } +\RequirePackage { fix-cm } +\RequirePackage { everysel } \tl_clear_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \box_new:N \l__ctex_tmp_box \dim_new:N \l__ctex_tmp_dim +\cs_new_protected:Npn \ctex_define_option:n + { \keys_define:nn { ctex / option } } +\cs_new_protected:Npn \ctex_define:n + { \keys_define:nn { ctex } } +\cs_new_protected:Npn \ctex_set:n + { \keys_set:nn { ctex } } +\cs_new_protected:Npn \ctex_set:nn #1 + { \keys_set:nn { ctex / #1 } } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -88,9 +95,9 @@ #3 } } -\cs_new_protected_nopar:Npn \ctex_file_input:n #1 +\cs_new_protected:Npn \ctex_file_input:n #1 { \ctex_file_wrapper:nnn { } { \file_input:n {#1} } { } } -\cs_new_protected_nopar:Npn \ctex_scheme_input:n #1 +\cs_new_protected:Npn \ctex_scheme_input:n #1 { \ctex_file_wrapper:nnn { } @@ -110,7 +117,7 @@ \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~package~`#1'\\ + Please~update~an~up-to-date~version~of~the~package~`#1'\\ using~your~TeX~package~manager~or~from~CTAN. } \sys_if_output_pdf:TF @@ -129,45 +136,43 @@ \exp_last_unbraced:NNNNo \cs_new:Npn \__ctex_default_ccwd_aux:w #1 { \tl_to_str:n { pt } } #2 \q_stop { \tl_if_empty:nT {#2} { \ccwd } } -\tl_new:N \l__ctex_encoding_tl -\tl_set:Nx \l__ctex_encoding_tl - { \sys_if_engine_pdftex:TF { GBK } { UTF8 } } +\tl_new:N \g__ctex_encoding_tl \bool_new:N \g__ctex_zhmCJK_bool \tl_new:N \l__ctex_autoindent_tl \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_nopar:Npn \ctex_at_end:n { \AtEndOfPackage } +\cs_new_protected:Npn \ctex_at_end:n { \AtEndOfPackage } \msg_new:nnn { ctex } { invalid-option } { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. } \msg_new:nnn { ctex } { invalid-value } { Value~`#1'~is~invalid~for~the~key~`\l_keys_key_tl'. } +\cs_new_protected:Npn \ctex_deprecated_option:n + { \msg_warning:nnn { ctex } { deprecated-option } } +\cs_new_protected:Npn \ctex_set_deprecated_option:n #1 + { + \ctex_deprecated_option:n { Option~`#1'~is~set. } + \ctex_set:nn { option } {#1} + } +\cs_new_protected:Npn \ctex_deprecated_command:Nn #1#2 + { + \msg_warning:nnxx { ctex } { deprecated-command } + { \token_to_str:N #1 } { \exp_not:n {#2} } + } \msg_new:nnn { ctex } { deprecated-option } - { Option~ `\l_keys_key_tl'~ is~ deprecated.\\ #1 } + { Option~`\l_keys_key_tl'~is~deprecated.\\ #1 } \msg_new:nnn { ctex } { deprecated-command } - { Command~ #1 is~ deprecated.\\ #2 } -\msg_new:nnn { ctex } { deprecated-environment } - { Environment~ `#1'~ is~ deprecated.\\ #2 } + { Command~`#1'~is~deprecated.\\ #2 } \int_new:N \g__ctex_font_size_int -\int_set:Nn \g__ctex_font_size_int { -1 } -\keys_define:nn { ctex / option } +\int_gset:Nn \g__ctex_font_size_int { -1 } +\ctex_define_option:n { zihao .choice: , zihao .value_required:n = true , zihao / 5 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 0 } } , zihao / -4 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 1 } } , zihao / false .code:n = { \int_gset:Nn \g__ctex_font_size_int { 2 } } , - c5size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=5'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = 5 } - } , - cs4size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=-4'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = -4 } - } , + c5size .code:n = { \ctex_set_deprecated_option:n { zihao = 5 } } , + cs4size .code:n = { \ctex_set_deprecated_option:n { zihao = -4 } } , c5size .value_forbidden:n = true , cs4size .value_forbidden:n = true , linespread .fp_set:N = \l__ctex_line_spread_fp , @@ -192,56 +197,38 @@ } , indent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options.~ + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , indent .value_forbidden:n = true , noindent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options. + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , noindent .value_forbidden:n = true , - GBK .code:n = { \tl_set:Nn \l__ctex_encoding_tl { GBK } } , - UTF8 .code:n = { \tl_set:Nn \l__ctex_encoding_tl { UTF8 } } , - GBK .value_forbidden:n = true , - UTF8 .value_forbidden:n = true , - fontset .tl_gset:N = \g__ctex_fontset_tl , - nofonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=none'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = none } - } , - adobefonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=adobe'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = adobe } - } , - winfonts .code:n = + GBK .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \sys_if_engine_pdftex:TF + { \tl_gset:Nn \g__ctex_encoding_tl { GBK } } { - Option~ `fontset=windows'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. + \msg_warning:nn { ctex } { invalid-option } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } - \keys_set:nn { ctex / option } { fontset = windows } } , + UTF8 .code:n = { \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } , + GBK .value_forbidden:n = true , + UTF8 .value_forbidden:n = true , + fontset .tl_gset:N = \g__ctex_fontset_tl , + nofonts .code:n = { \ctex_set_deprecated_option:n { fontset = none } } , + adobefonts .code:n = { \ctex_set_deprecated_option:n { fontset = adobe } } , + winfonts .code:n = { \ctex_set_deprecated_option:n { fontset = windows } } , nofonts .value_forbidden:n = true , winfonts .value_forbidden:n = true , adobefonts .value_forbidden:n = true , @@ -263,35 +250,21 @@ \cs_gset_eq:NN \ctex_zhmap_case:nnn \use_iii:nnn } , nozhmap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zhmap=false'~ is~ set. } - \keys_set:nn { ctex / option } { zhmap = false } - } , + { \ctex_set_deprecated_option:n { zhmap = false } } , nozhmap .value_forbidden:n = true , punct .tl_set:N = \l__ctex_punct_tl , punct .default:n = { quanjiao } , punct .initial:n = { quanjiao } , - nopunct .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `punct=plain'~ is~ set. } - \keys_set:nn { ctex / option } { punct = plain } - } , + nopunct .code:n = \ctex_set_deprecated_option:n { punct = plain } , nopunct .value_forbidden:n = true , space .choices:nn = { true , auto , false } { \exp_args:Nx \ctex_at_end:n - { \keys_set:nn { ctex } { space = \l_keys_choice_tl } } + { \ctex_set:n { space = \l_keys_choice_tl } } } , space .default:n = { true } , - nospace .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `space=false'~ is~ set. } - \keys_set:nn { ctex / option } { space = false } - } , + nospace .code:n = { \ctex_deprecated_option:nn { space = false } } , nospace .value_forbidden:n = true , heading .bool_set:N = \l__ctex_heading_bool , sub3section .code:n = @@ -303,35 +276,37 @@ scheme .tl_set:N = \l__ctex_scheme_tl , scheme .default:n = { chinese } , scheme .initial:n = { chinese } , - cap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = chinese' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = chinese } - } , - nocap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = plain' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = plain } - } , + cap .code:n = { \ctex_set_deprecated_option:n { scheme = chinese } } , + nocap .code:n = { \ctex_set_deprecated_option:n { scheme = plain } } , cap .value_forbidden:n = true , nocap .value_forbidden:n = true , - fntef .code:n = + fntef .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `(xe)CJKfntef'~ package~ is~ always~ loaded. } + \sys_if_engine_xetex:TF + { + \ctex_deprecated_option:n { `xeCJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { xeCJKfntef } } + } + { + \sys_if_engine_pdftex:TF + { + \ctex_deprecated_option:n { `CJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { CJKfntef } } + } + { + \ctex_deprecated_option:n + { Furthermore,~option~`fntef'~is~invalid~in~current~mode. } + } + } } , fancyhdr .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `fancyhdr'~ package~ is~ loaded. } - \RequirePackage { fancyhdr } + \ctex_deprecated_option:n { `fancyhdr'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { fancyhdr } } } , hyperref .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `hyperref'~ package~ will~ be~ loaded. } + \ctex_deprecated_option:n { `hyperref'~package~will~be~loaded. } \ctex_at_end:n { \cs_if_exist:NF \hypersetup @@ -354,34 +329,50 @@ #1 .value_forbidden:n = true , } } -\use:x { \keys_define:nn { ctex / option } { \exp_not:o { \l__ctex_tmp_tl } } } +\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 } +\msg_new:nnn { ctex } { pdftex-utf8 } + { UTF8~will~be~used~as~the~default~encoding. } +\tl_if_empty:NT \g__ctex_encoding_tl + { + \sys_if_engine_pdftex:T + { \msg_warning:nn { ctex } { pdftex-utf8 } } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } + } \@ifpackageloaded { hyperref } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \hypersetup {#1} } } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \PassOptionsToPackage {#1} { hyperref } } } \ctex_file_input:n { \c__ctex_engine_file_str } -\NewDocumentCommand \ctexset { } { \keys_set:nn { ctex } } -\NewDocumentCommand \CTEXsetup { +o > { \TrimSpaces } m } +\NewDocumentCommand \ctexset { } { \ctex_set:n } +\NewDocumentCommand \CTEXsetup { +O { } > { \TrimSpaces } m } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXsetup } - { \ctexset~ {~ #2~ =~ {~ #1~ }~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex / #2 } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXsetup { } } + { + \ctex_deprecated_command:Nn \CTEXsetup + { \ctexset {~#2~=~{~#1~}~}~is~set. } + \ctex_set:nn {#2} {#1} + } } -\NewDocumentCommand \CTEXoptions { +o } +\NewDocumentCommand \CTEXoptions { +O { } } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXoptions } - { \ctexset~ {~ #1~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXoptions { } } + { + \ctex_deprecated_command:Nn \CTEXoptions + { \ctexset {~#1~}~is~set. } + \ctex_set:n {#1} + } } -\keys_define:nn { ctex } +\ctex_define:n { autoindent .choice: , autoindent .default:n = { true } , @@ -399,9 +390,9 @@ } } \NewDocumentCommand \CTEXsetfont { } { \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_select_size: +\cs_new_protected:Npn \ctex_select_size: { \cs_if_free:NTF \size@update { \ctex_update_size: } { \selectfont } } -\cs_new_protected_nopar:Npn \ctex_update_size: +\cs_new_protected:Npn \ctex_update_size: { \tl_if_eq:NNTF \l__ctex_ziju_tl \c__ctex_zero_tl { @@ -415,7 +406,7 @@ \tl_set_eq:NN \l__ctex_ziju_tl \c__ctex_zero_tl \ctex_add_to_selectfont:n { \cs_if_free:NF \size@update { \ctex_update_size: } } -\keys_define:nn { ctex } +\ctex_define:n { linestretch .code:n = { @@ -426,7 +417,7 @@ } \tl_new:N \l__ctex_line_stretch_tl \tl_set:Nn \l__ctex_line_stretch_tl { \ccwd } -\cs_new_protected_nopar:Npn \ctex_update_stretch: +\cs_new_protected:Npn \ctex_update_stretch: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_tmp_dim { \l__ctex_line_stretch_tl } @@ -461,7 +452,7 @@ \ctex_update_ccglue: } } -\cs_new_protected_nopar:Npn \ctex_update_parindent: +\cs_new_protected:Npn \ctex_update_parindent: { \tl_if_empty:NF \l__ctex_autoindent_tl { @@ -471,12 +462,12 @@ } \NewDocumentCommand \ziju { m } { \exp_args:Nx \ctex_ziju:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_ziju:n #1 +\cs_new_protected:Npn \ctex_ziju:n #1 { \tl_set:Nx \l__ctex_ziju_tl { \fp_eval:n {#1} } \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_update_ziju: +\cs_new_protected:Npn \ctex_update_ziju: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_ziju_dim { \l__ctex_ziju_tl \ccwd } @@ -508,19 +499,20 @@ \dim_new:N \l__ctex_ziju_dim \NewDocumentCommand \CTEXindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXindent } - { \parindent is~ set~ to~ 2\ccwd. } - \ctex_update_ccwd: \dim_set:Nn \parindent { 2 \ccwd } + \ctex_deprecated_command:Nn \CTEXindent + { \parindent is~set~to~2\ccwd. } + \ctex_update_ccwd: + \dim_set:Nn \parindent { 2 \ccwd } } \NewDocumentCommand \CTEXnoindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXnoindent } - { \parindent is~ set~ to~ 0pt. } + \ctex_deprecated_command:Nn \CTEXnoindent + { \parindent is~set~to~0pt. } \dim_zero:N \parindent } -\PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhnumber } +\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber } \RequirePackage { zhnumber } -\cs_new_nopar:Npn \chinese { \zhnum_counter:n } +\cs_new:Npn \chinese { \zhnum_counter:n } \cs_new_eq:NN \@chinese \@zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n @@ -538,7 +530,7 @@ \NewDocumentCommand \CTEXdigits { m m } { \protected@edef #1 { \zhdigits {#2} } } \cs_set_eq:NN \CTEX@todayold \today -\keys_define:nn { ctex } +\ctex_define:n { today .choice: , today / old .code:n = @@ -564,7 +556,7 @@ \tl_new:N \proofname \tl_set:Nn \proofname { Proof } } -\keys_define:nn { ctex } +\ctex_define:n { contentsname .tl_set:N = \contentsname , listfigurename .tl_set:N = \listfigurename , @@ -583,7 +575,7 @@ } \tl_if_exist:NTF \insertcontinuationtext { - \keys_define:nn { ctex } + \ctex_define:n { algorithmname .tl_set:N = \algorithmname , bibname .tl_set:N = \bibname , @@ -593,13 +585,13 @@ } { \tl_if_exist:NTF \bibname - { \keys_define:nn { ctex } { bibname .tl_set:N = \bibname } } + { \ctex_define:n { bibname .tl_set:N = \bibname } } { \tl_if_exist:NTF \refname - { \keys_define:nn { ctex } { bibname .tl_set:N = \refname } } + { \ctex_define:n { bibname .tl_set:N = \refname } } { \msg_warning:nn { ctex } { ctexbibname } - \keys_define:nn { ctex } { bibname .tl_set:N = \ctexbibname } + \ctex_define:n { bibname .tl_set:N = \ctexbibname } } } } @@ -629,12 +621,12 @@ { \tl_const:Nn \c__ctex_class_tl { article } } \msg_warning:nnx { ctex } { not-standard-class } { \c__ctex_class_tl } } - \ctex_file_input:n { ctex- \c__ctex_class_tl .def } + \ctex_file_input:n { ctex-heading- \c__ctex_class_tl .def } } { \ctex_scheme_input:o { \l__ctex_scheme_tl } } \NewDocumentCommand \zihao { m } { \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_zihao:n #1 +\cs_new_protected:Npn \ctex_zihao:n #1 { \prop_get:NnNTF \c__ctex_font_size_prop {#1} \l__ctex_font_size_tl { \exp_after:wN \fontsize \l__ctex_font_size_tl \selectfont } @@ -649,7 +641,7 @@ } \prop_new:N \c__ctex_font_size_prop \seq_new:N \c__ctex_font_size_seq -\cs_new_protected_nopar:Npn \__ctex_save_font_size:nn #1#2 +\cs_new_protected:Npn \__ctex_save_font_size:nn #1#2 { \use:x { @@ -681,12 +673,12 @@ { 0 } { 42 bp } } { \__ctex_save_font_size:nn #1 } -\cs_new_protected_nopar:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 +\cs_new_protected:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 { \__ctex_get_font_sizes:Nn \l__ctex_font_size_tl { {#1} {#2} {#3} {#4} } \exp_after:wN \DeclareMathSizes \l__ctex_font_size_tl } -\cs_new_protected_nopar:Npn \__ctex_get_font_sizes:Nn #1#2 +\cs_new_protected:Npn \__ctex_get_font_sizes:Nn #1#2 { \tl_clear:N #1 \tl_map_inline:nn {#2} @@ -723,13 +715,13 @@ { \msg_error:nnn { ctex } { fontsize } {#2} } } \cs_new_protected:Npn \__ctex_set_font_size:nnNn #1#2#3#4 - { \cs_set_protected_nopar:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } -\if_case:w \g__ctex_font_size_int - \ctex_file_input:n { ctex-c5size.clo } -\or: - \ctex_file_input:n { ctex-cs4size.clo } -\fi: -\fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } + { \cs_set_protected:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } +\int_case:nn { \g__ctex_font_size_int } + { + { 0 } { \ctex_file_input:n { ctex-c5size.clo } } + { 1 } { \ctex_file_input:n { ctex-cs4size.clo } } + } +\fp_if_nan:nF { \l__ctex_line_spread_fp } { \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: @@ -740,47 +732,76 @@ { C \TeX } \ctex_at_end_package:nn { hyperref } { \pdfstringdefDisableCommands { \tl_set:Nn \CTeX { CTeX } } } -\keys_define:nn { ctex } +\ctex_define:n { captiondelimiter .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 +\cs_new_protected:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } { CTeX~fontset~`#1'~is~unavailable~in~current~mode. } -\cs_new_protected_nopar:Npn \ctex_load_fontset: +\cs_new:Npx \ctex_fontset_case:nnn #1#2#3 { - \tl_if_empty:NTF \g__ctex_fontset_tl + \sys_if_engine_pdftex:TF + {#1} + { \sys_if_engine_uptex:TF {#2} {#3} } + } +\cs_new:Npx \ctex_fontset_case:nnnn #1#2#3#4 + { + \sys_if_engine_pdftex:TF + { \sys_if_output_pdf:TF {#1} {#2} } + { \sys_if_engine_uptex:TF {#3} {#4} } + } +\cs_new_protected:Npn \ctex_detect_platform: + { + \sys_if_platform_windows:TF + { \tl_gset:Nn \g__ctex_fontset_tl { windows } } { - \ctex_detected_platform: - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } + \ctex_if_platform_macos:TF + { \tl_gset:Nn \g__ctex_fontset_tl { mac } } + { \tl_gset:Nn \g__ctex_fontset_tl { fandol } } } + } +\cs_new_protected:Npn \ctex_if_platform_macos:TF + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } } +\cs_new_protected:Npn \ctex_load_fontset: + { + \tl_if_empty:NTF \g__ctex_fontset_tl + { \ctex_detect_platform: } { - \file_if_exist:nTF { ctex-fontset- \g__ctex_fontset_tl .def } - { \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } + \bool_lazy_or:nnTF + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsnew } } + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsold } } { - \use:x + \msg_warning:nnxx { ctex } { deprecated-fontset } + { \g__ctex_fontset_tl } { windows } + \tl_gset:Nn \g__ctex_fontset_tl { windows } + } + { + \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def } { - \ctex_detected_platform: - \msg_error:nnxx { ctex } { fontset-not-found } - { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + \use:x + { + \ctex_detect_platform: + \msg_error:nnxx { ctex } { fontset-not-found } + { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + } } - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } } + \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } -\@onlypreamble \ctex_load_fontset: +\msg_new:nnn { ctex } { deprecated-fontset } + { CTeX~fontset~`#1'~is~deprecated.\\ Fontset~`#2'~will~be~used~instead. } \msg_new:nnnn { ctex } { fontset-not-found } - { - CTeX~fontset~`#1'~could~not~be~found.\\ - Fontset~`#2'~will~be~used~instead. - } + { CTeX~fontset~`#1'~could~not~be~found.\\ Fontset~`#2'~will~be~used~instead. } { You~may~run~`mktexlsr'~firstly. } -\keys_define:nn { ctex } +\@onlypreamble \ctex_load_fontset: +\ctex_define:n { fontset .code:n = { @@ -810,14 +831,16 @@ } { Only~one~fontset~can~be~loaded~in~the~preamble. } \msg_new:nnn { ctex } { fontset-only-preamble } - { - The~ `fontset'~ option~ can~ be~ used~ only~ in~ preamble. - } + { The~`fontset'~option~can~be~used~only~in~preamble. } \str_if_eq:onF { \g__ctex_fontset_tl } { none } { \ctex_load_fontset: } \ctex_at_end:n { \ctex_file_input:n { ctex.cfg } } %% -%% This package consists of the file ctex.dtx, +%% This package consists of the files ctex.dtx, +%% ctxdoc.cls, +%% ctxdocstrip.tex, +%% ctex-zhconv.lua, +%% ctex-zhconv-make.lua, %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, @@ -827,16 +850,15 @@ %% ctexbook.cls, %% ctexrep.cls, %% ctexbeamer.cls, -%% ctxdoc.cls, %% ctexcap.sty, %% ctexhook.sty, %% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, -%% ctex-article.def, -%% ctex-book.def, -%% ctex-report.def, -%% ctex-beamer.def, +%% ctex-heading-article.def, +%% ctex-heading-book.def, +%% ctex-heading-report.def, +%% ctex-heading-beamer.def, %% ctex-scheme-plain.def, %% ctex-scheme-plain-article.def, %% ctex-scheme-plain-book.def, @@ -851,6 +873,7 @@ %% ctex-name-utf8.cfg, %% ctex.cfg, %% ctexopts.cfg, +%% ctexbackend.cfg, %% ctex-engine-pdftex.def, %% ctex-engine-xetex.def, %% ctex-engine-luatex.def, @@ -868,26 +891,25 @@ %% jt2zhrm.fd, %% jt2zhsf.fd, %% jt2zhtt.fd, -%% ctex-fontset-windows.def, -%% ctex-fontset-windowsnew.def, -%% ctex-fontset-windowsold.def, %% ctex-fontset-adobe.def, %% ctex-fontset-fandol.def, +%% ctex-fontset-founder.def, %% ctex-fontset-mac.def, %% ctex-fontset-macnew.def, %% ctex-fontset-macold.def, -%% ctex-fontset-founder.def, %% ctex-fontset-ubuntu.def, +%% ctex-fontset-windows.def, %% ctexspa.def, %% ctexpunct.spa, %% ctexmakespa.tex, %% ctexspamacro.tex, -%% ctxdocstrip.tex, %% zhadobefonts.tex, %% zhfandolfonts.tex, %% zhfounderfonts.tex, +%% zhmacfonts.tex, %% zhubuntufonts.tex, %% zhwindowsfonts.tex, +%% ctex-zhconv-index.lua, %% translator-theorem-dictionary-ChineseGBK.dict, %% translator-theorem-dictionary-ChineseUTF8.dict, and %% README.md. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexart.cls b/Master/texmf-dist/tex/latex/ctex/ctexart.cls index 1065d74e814..f0dabcdf0be 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexart.cls +++ b/Master/texmf-dist/tex/latex/ctex/ctexart.cls @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `class,article') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,18 +20,17 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} +\input{ctexbackend.cfg} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class article (CTEX)} \ProvidesExplClass{ctexart} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \cs_new_eq:cN { ver@ctex. \@pkgextension } \c__ctex_version_tl @@ -42,11 +41,11 @@ \msg_new:nnnn { ctex } { l3-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~bundles\\\\ + Please~update~an~up-to-date~version~of~the~bundles\\\\ `l3kernel'~and~`l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2019/03/05 } { } +\@ifpackagelater { expl3 } { 2020/04/06 } { } { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } \@ifpackagelater { l3keys2e } { 2015/12/20 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } @@ -62,11 +61,20 @@ } { \msg_critical:nnx { ctex } { engine-not-supported } { \c__ctex_engine_str } } \RequirePackage { ctexhook , ctexpatch } -\RequirePackage { fix-cm , everysel } +\RequirePackage { fix-cm } +\RequirePackage { everysel } \tl_clear_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \box_new:N \l__ctex_tmp_box \dim_new:N \l__ctex_tmp_dim +\cs_new_protected:Npn \ctex_define_option:n + { \keys_define:nn { ctex / option } } +\cs_new_protected:Npn \ctex_define:n + { \keys_define:nn { ctex } } +\cs_new_protected:Npn \ctex_set:n + { \keys_set:nn { ctex } } +\cs_new_protected:Npn \ctex_set:nn #1 + { \keys_set:nn { ctex / #1 } } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -82,9 +90,9 @@ #3 } } -\cs_new_protected_nopar:Npn \ctex_file_input:n #1 +\cs_new_protected:Npn \ctex_file_input:n #1 { \ctex_file_wrapper:nnn { } { \file_input:n {#1} } { } } -\cs_new_protected_nopar:Npn \ctex_scheme_input:n #1 +\cs_new_protected:Npn \ctex_scheme_input:n #1 { \ctex_file_wrapper:nnn { } @@ -104,7 +112,7 @@ \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~package~`#1'\\ + Please~update~an~up-to-date~version~of~the~package~`#1'\\ using~your~TeX~package~manager~or~from~CTAN. } \sys_if_output_pdf:TF @@ -123,46 +131,44 @@ \exp_last_unbraced:NNNNo \cs_new:Npn \__ctex_default_ccwd_aux:w #1 { \tl_to_str:n { pt } } #2 \q_stop { \tl_if_empty:nT {#2} { \ccwd } } -\tl_new:N \l__ctex_encoding_tl -\tl_set:Nx \l__ctex_encoding_tl - { \sys_if_engine_pdftex:TF { GBK } { UTF8 } } +\tl_new:N \g__ctex_encoding_tl \bool_new:N \g__ctex_zhmCJK_bool \tl_new:N \l__ctex_autoindent_tl \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_nopar:Npn \ctex_at_end:n { \AtEndOfClass } +\cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass } \clist_new:N \g__ctex_std_options_clist \msg_new:nnn { ctex } { invalid-option } { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. } \msg_new:nnn { ctex } { invalid-value } { Value~`#1'~is~invalid~for~the~key~`\l_keys_key_tl'. } +\cs_new_protected:Npn \ctex_deprecated_option:n + { \msg_warning:nnn { ctex } { deprecated-option } } +\cs_new_protected:Npn \ctex_set_deprecated_option:n #1 + { + \ctex_deprecated_option:n { Option~`#1'~is~set. } + \ctex_set:nn { option } {#1} + } +\cs_new_protected:Npn \ctex_deprecated_command:Nn #1#2 + { + \msg_warning:nnxx { ctex } { deprecated-command } + { \token_to_str:N #1 } { \exp_not:n {#2} } + } \msg_new:nnn { ctex } { deprecated-option } - { Option~ `\l_keys_key_tl'~ is~ deprecated.\\ #1 } + { Option~`\l_keys_key_tl'~is~deprecated.\\ #1 } \msg_new:nnn { ctex } { deprecated-command } - { Command~ #1 is~ deprecated.\\ #2 } -\msg_new:nnn { ctex } { deprecated-environment } - { Environment~ `#1'~ is~ deprecated.\\ #2 } + { Command~`#1'~is~deprecated.\\ #2 } \int_new:N \g__ctex_font_size_int -\int_set:Nn \g__ctex_font_size_int { -1 } -\keys_define:nn { ctex / option } +\int_gset:Nn \g__ctex_font_size_int { -1 } +\ctex_define_option:n { zihao .choice: , zihao .value_required:n = true , zihao / 5 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 0 } } , zihao / -4 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 1 } } , zihao / false .code:n = { \int_gset:Nn \g__ctex_font_size_int { 2 } } , - c5size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=5'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = 5 } - } , - cs4size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=-4'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = -4 } - } , + c5size .code:n = { \ctex_set_deprecated_option:n { zihao = 5 } } , + cs4size .code:n = { \ctex_set_deprecated_option:n { zihao = -4 } } , c5size .value_forbidden:n = true , cs4size .value_forbidden:n = true , linespread .fp_set:N = \l__ctex_line_spread_fp , @@ -187,56 +193,38 @@ } , indent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options.~ + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , indent .value_forbidden:n = true , noindent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options. + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , noindent .value_forbidden:n = true , - GBK .code:n = { \tl_set:Nn \l__ctex_encoding_tl { GBK } } , - UTF8 .code:n = { \tl_set:Nn \l__ctex_encoding_tl { UTF8 } } , - GBK .value_forbidden:n = true , - UTF8 .value_forbidden:n = true , - fontset .tl_gset:N = \g__ctex_fontset_tl , - nofonts .code:n = + GBK .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \sys_if_engine_pdftex:TF + { \tl_gset:Nn \g__ctex_encoding_tl { GBK } } { - Option~ `fontset=none'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. + \msg_warning:nn { ctex } { invalid-option } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } - \keys_set:nn { ctex / option } { fontset = none } - } , - adobefonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=adobe'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = adobe } - } , - winfonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=windows'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = windows } } , + UTF8 .code:n = { \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } , + GBK .value_forbidden:n = true , + UTF8 .value_forbidden:n = true , + fontset .tl_gset:N = \g__ctex_fontset_tl , + nofonts .code:n = { \ctex_set_deprecated_option:n { fontset = none } } , + adobefonts .code:n = { \ctex_set_deprecated_option:n { fontset = adobe } } , + winfonts .code:n = { \ctex_set_deprecated_option:n { fontset = windows } } , nofonts .value_forbidden:n = true , winfonts .value_forbidden:n = true , adobefonts .value_forbidden:n = true , @@ -258,35 +246,21 @@ \cs_gset_eq:NN \ctex_zhmap_case:nnn \use_iii:nnn } , nozhmap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zhmap=false'~ is~ set. } - \keys_set:nn { ctex / option } { zhmap = false } - } , + { \ctex_set_deprecated_option:n { zhmap = false } } , nozhmap .value_forbidden:n = true , punct .tl_set:N = \l__ctex_punct_tl , punct .default:n = { quanjiao } , punct .initial:n = { quanjiao } , - nopunct .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `punct=plain'~ is~ set. } - \keys_set:nn { ctex / option } { punct = plain } - } , + nopunct .code:n = \ctex_set_deprecated_option:n { punct = plain } , nopunct .value_forbidden:n = true , space .choices:nn = { true , auto , false } { \exp_args:Nx \ctex_at_end:n - { \keys_set:nn { ctex } { space = \l_keys_choice_tl } } + { \ctex_set:n { space = \l_keys_choice_tl } } } , space .default:n = { true } , - nospace .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `space=false'~ is~ set. } - \keys_set:nn { ctex / option } { space = false } - } , + nospace .code:n = { \ctex_deprecated_option:nn { space = false } } , nospace .value_forbidden:n = true , heading .bool_set:N = \l__ctex_heading_bool , sub3section .code:n = @@ -298,35 +272,37 @@ scheme .tl_set:N = \l__ctex_scheme_tl , scheme .default:n = { chinese } , scheme .initial:n = { chinese } , - cap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = chinese' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = chinese } - } , - nocap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = plain' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = plain } - } , + cap .code:n = { \ctex_set_deprecated_option:n { scheme = chinese } } , + nocap .code:n = { \ctex_set_deprecated_option:n { scheme = plain } } , cap .value_forbidden:n = true , nocap .value_forbidden:n = true , - fntef .code:n = + fntef .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `(xe)CJKfntef'~ package~ is~ always~ loaded. } + \sys_if_engine_xetex:TF + { + \ctex_deprecated_option:n { `xeCJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { xeCJKfntef } } + } + { + \sys_if_engine_pdftex:TF + { + \ctex_deprecated_option:n { `CJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { CJKfntef } } + } + { + \ctex_deprecated_option:n + { Furthermore,~option~`fntef'~is~invalid~in~current~mode. } + } + } } , fancyhdr .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `fancyhdr'~ package~ is~ loaded. } - \RequirePackage { fancyhdr } + \ctex_deprecated_option:n { `fancyhdr'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { fancyhdr } } } , hyperref .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `hyperref'~ package~ will~ be~ loaded. } + \ctex_deprecated_option:n { `hyperref'~package~will~be~loaded. } \ctex_at_end:n { \cs_if_exist:NF \hypersetup @@ -352,47 +328,63 @@ #1 .value_forbidden:n = true , } } -\use:x { \keys_define:nn { ctex / option } { \exp_not:o { \l__ctex_tmp_tl } } } +\exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl } \tl_clear:N \l__ctex_tmp_tl -\keys_define:nn { ctex / option } +\ctex_define_option:n { unknown .code:n = { \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } } } \ctex_file_input:n { ctexopts.cfg } \ProcessKeysOptions { ctex / option } -\if_case:w \g__ctex_font_size_int - \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } -\or: - \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } -\fi: +\msg_new:nnn { ctex } { pdftex-utf8 } + { UTF8~will~be~used~as~the~default~encoding. } +\tl_if_empty:NT \g__ctex_encoding_tl + { + \sys_if_engine_pdftex:T + { \msg_warning:nn { ctex } { pdftex-utf8 } } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } + } +\int_case:nn { \g__ctex_font_size_int } + { + { 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 } \@ifpackageloaded { hyperref } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \hypersetup {#1} } } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \PassOptionsToPackage {#1} { hyperref } } } \ctex_file_input:n { \c__ctex_engine_file_str } -\NewDocumentCommand \ctexset { } { \keys_set:nn { ctex } } -\NewDocumentCommand \CTEXsetup { +o > { \TrimSpaces } m } +\NewDocumentCommand \ctexset { } { \ctex_set:n } +\NewDocumentCommand \CTEXsetup { +O { } > { \TrimSpaces } m } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXsetup } - { \ctexset~ {~ #2~ =~ {~ #1~ }~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex / #2 } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXsetup { } } + { + \ctex_deprecated_command:Nn \CTEXsetup + { \ctexset {~#2~=~{~#1~}~}~is~set. } + \ctex_set:nn {#2} {#1} + } } -\NewDocumentCommand \CTEXoptions { +o } +\NewDocumentCommand \CTEXoptions { +O { } } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXoptions } - { \ctexset~ {~ #1~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXoptions { } } + { + \ctex_deprecated_command:Nn \CTEXoptions + { \ctexset {~#1~}~is~set. } + \ctex_set:n {#1} + } } -\keys_define:nn { ctex } +\ctex_define:n { autoindent .choice: , autoindent .default:n = { true } , @@ -410,9 +402,9 @@ } } \NewDocumentCommand \CTEXsetfont { } { \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_select_size: +\cs_new_protected:Npn \ctex_select_size: { \cs_if_free:NTF \size@update { \ctex_update_size: } { \selectfont } } -\cs_new_protected_nopar:Npn \ctex_update_size: +\cs_new_protected:Npn \ctex_update_size: { \tl_if_eq:NNTF \l__ctex_ziju_tl \c__ctex_zero_tl { @@ -426,7 +418,7 @@ \tl_set_eq:NN \l__ctex_ziju_tl \c__ctex_zero_tl \ctex_add_to_selectfont:n { \cs_if_free:NF \size@update { \ctex_update_size: } } -\keys_define:nn { ctex } +\ctex_define:n { linestretch .code:n = { @@ -437,7 +429,7 @@ } \tl_new:N \l__ctex_line_stretch_tl \tl_set:Nn \l__ctex_line_stretch_tl { \ccwd } -\cs_new_protected_nopar:Npn \ctex_update_stretch: +\cs_new_protected:Npn \ctex_update_stretch: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_tmp_dim { \l__ctex_line_stretch_tl } @@ -472,7 +464,7 @@ \ctex_update_ccglue: } } -\cs_new_protected_nopar:Npn \ctex_update_parindent: +\cs_new_protected:Npn \ctex_update_parindent: { \tl_if_empty:NF \l__ctex_autoindent_tl { @@ -482,12 +474,12 @@ } \NewDocumentCommand \ziju { m } { \exp_args:Nx \ctex_ziju:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_ziju:n #1 +\cs_new_protected:Npn \ctex_ziju:n #1 { \tl_set:Nx \l__ctex_ziju_tl { \fp_eval:n {#1} } \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_update_ziju: +\cs_new_protected:Npn \ctex_update_ziju: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_ziju_dim { \l__ctex_ziju_tl \ccwd } @@ -519,19 +511,20 @@ \dim_new:N \l__ctex_ziju_dim \NewDocumentCommand \CTEXindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXindent } - { \parindent is~ set~ to~ 2\ccwd. } - \ctex_update_ccwd: \dim_set:Nn \parindent { 2 \ccwd } + \ctex_deprecated_command:Nn \CTEXindent + { \parindent is~set~to~2\ccwd. } + \ctex_update_ccwd: + \dim_set:Nn \parindent { 2 \ccwd } } \NewDocumentCommand \CTEXnoindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXnoindent } - { \parindent is~ set~ to~ 0pt. } + \ctex_deprecated_command:Nn \CTEXnoindent + { \parindent is~set~to~0pt. } \dim_zero:N \parindent } -\PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhnumber } +\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber } \RequirePackage { zhnumber } -\cs_new_nopar:Npn \chinese { \zhnum_counter:n } +\cs_new:Npn \chinese { \zhnum_counter:n } \cs_new_eq:NN \@chinese \@zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n @@ -549,7 +542,7 @@ \NewDocumentCommand \CTEXdigits { m m } { \protected@edef #1 { \zhdigits {#2} } } \cs_set_eq:NN \CTEX@todayold \today -\keys_define:nn { ctex } +\ctex_define:n { today .choice: , today / old .code:n = @@ -575,7 +568,7 @@ \tl_new:N \proofname \tl_set:Nn \proofname { Proof } } -\keys_define:nn { ctex } +\ctex_define:n { contentsname .tl_set:N = \contentsname , listfigurename .tl_set:N = \listfigurename , @@ -593,7 +586,7 @@ \seq_new:N \c__ctex_headings_seq \seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq \seq_gput_left:Nn \c__ctex_headings_seq { part } -\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 +\cs_new_protected:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } \tl_new:c { CTEX@post#1 } @@ -623,7 +616,7 @@ \group_end: } } -\cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 +\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 { \tl_put_right:Nx \l__ctex_tmp_tl { @@ -647,11 +640,8 @@ #1 / hang .bool_set:N = \exp_not:c { CTEX@#1@hang } , #1 / hang .initial:n = true , #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , - #1 / tocline .code:n = - { - \cs_set:Npn \exp_not:c { CTEX@#1@tocline} - \exp_not:n { ####1####2 } { ####1 } - } , + #1 / tocline .cs_set:Np = \exp_not:c { CTEX@#1@tocline} + \exp_not:n { ##1##2 } , \__ctex_plus_key_aux:nn {#1} { break } , \__ctex_plus_key_aux:nn {#1} { format } , \__ctex_plus_key_aux:nn {#1} { nameformat } , @@ -661,7 +651,7 @@ \__ctex_plus_key_aux:nn {#1} { aftertitle } , } } -\cs_new_nopar:Npn \__ctex_plus_key_aux:nn #1#2 +\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 { #1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , #1 / #2 + .code:n = @@ -675,7 +665,7 @@ \cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 { \tl_set:cn { CTEX@pre#1 } {#2} - \IfNoValueTF {#3} + \tl_if_novalue:nTF {#3} { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } @@ -686,45 +676,57 @@ \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x +\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } +\cs_new_protected:Npn \CTEX@heading@format@initial { - \group_end: - \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } + \normalfont + \tl_clear:N \l__ctex_autoindent_tl + \int_set:Nn \tex_interlinepenalty:D { 10 000 } + \tex_noindent:D + } +\cs_new_protected:Npn \ctex_indent_box:n #1 + { + \dim_set:Nn \tex_parindent:D {#1} + \__ctex_insert_indent: + } +\cs_new_protected:Npn \__ctex_insert_indent: + { + \dim_compare:nNnF \tex_parindent:D = \c_zero_dim + { \tex_indent:D } } -\cs_new_protected_nopar:Npn \CTEX@fixheadingskip +\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n +\cs_new_protected:Npn \CTEX@fixheadingskip { \par \dim_set:Nn \tex_prevdepth:D { -1000pt } \skip_sub:Nn \l__ctex_heading_skip { \tex_parskip:D } } \skip_new:N \l__ctex_heading_skip -\cs_new_protected_nopar:Npn \CTEX@setheadingskip +\cs_new_protected:Npn \CTEX@setheadingskip { \skip_set:Nn \l__ctex_heading_skip } \cs_new_eq:NN \CTEX@headingskip \l__ctex_heading_skip \ProvideDocumentCommand \partmark { m } { \markboth { } { } } \cs_new_eq:NN \CTEXifname \use_ii:nn -\cs_new_protected_nopar:Npn \CTEX@ifnametrue +\cs_new_protected:Npn \CTEX@ifnametrue { \cs_set_eq:NN \CTEXifname \use_i:nn } -\cs_new_protected_nopar:Npn \CTEX@ifnamefalse +\cs_new_protected:Npn \CTEX@ifnamefalse { \cs_set_eq:NN \CTEXifname \use_ii:nn } \cs_new_protected:Npn \CTEX@addtocline #1#2 { \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } } -\cs_new_protected_nopar:Npn \CTEX@disableautoindent - { \tl_clear:N \l__ctex_autoindent_tl } \renewcommand\part{% - \if@noskipsec \leavevmode \fi - \par - \CTEX@part@break - \CTEX@setheadingskip \CTEX@part@beforeskip - \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi - \addvspace \CTEX@headingskip - \ifodd \CTEX@part@afterindent - \@afterindenttrue - \else - \@afterindentfalse - \fi - \secdef\@part\@spart} + \if@noskipsec \leavevmode \fi + \par + \CTEX@part@break + \CTEX@setheadingskip \CTEX@part@beforeskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \addvspace \CTEX@headingskip + \ifodd \CTEX@part@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@part\@spart} \def\@part[#1]#2{% \ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@part@numbering @@ -740,34 +742,36 @@ \fi \CTEX@gettitle{#1}% \CTEX@addtocline{part}{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}% - {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% - \CTEX@part@titleformat{#2}% - \partmark{#1}% - \CTEX@part@aftertitle}% + \partmark{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}% + {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% + \CTEX@part@titleformat{#2}% + \CTEX@part@aftertitle}\par + \endgroup \nobreak \CTEX@setheadingskip \CTEX@part@afterskip \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi \vskip \CTEX@headingskip \@afterheading} \def\@spart#1{% - \CTEX@ifnamefalse - \CTEX@makeanchor@spart{part*}% - \CTEX@gettitle{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}{}% - \CTEX@part@titleformat{#1}% - \CTEX@part@aftertitle}% - \nobreak - \CTEX@setheadingskip \CTEX@part@afterskip - \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - \@afterheading} + \CTEX@ifnamefalse + \CTEX@makeanchor@spart{part*}% + \CTEX@gettitle{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}{}% + \CTEX@part@titleformat{#1}% + \CTEX@part@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip + \@afterheading} \def\@startsection#1#2#3#4#5#6{% \if@noskipsec \leavevmode \fi \par @@ -810,22 +814,22 @@ \CTEX@gettitle{#7}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #6{% - \CTEX@hangfrom{\hskip\glueexpr #3\relax\@svsec}% - \interlinepenalty \@M + \CTEX@sectionhang{#3}{\@svsec}% \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% + \csname CTEX@#1@aftertitle\endcsname}\par \endgroup \csname #1mark\endcsname{#7}% \CTEX@addtocline{#1}{#7}% \else \def\@svsechd{% - #6{\hskip\glueexpr #3\relax - \@svsec - \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% - \csname #1mark\endcsname{#7}% - \CTEX@addtocline{#1}{#7}}% + #6{% + {\CTEX@indentbox{#3}}\@svsec + \csname CTEX@#1@titleformat\endcsname{#8}% + \csname CTEX@#1@aftertitle\endcsname}% + \csname #1mark\endcsname{#7}% + \CTEX@addtocline{#1}{#7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% @@ -833,15 +837,15 @@ \CTEX@gettitle{#5}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #4{% - \CTEX@hangfrom{\hskip\glueexpr #1\relax}% - \interlinepenalty \@M + \CTEX@sectionhang{#1}{}% \CTEX@titleformat@n{#5}% - \CTEX@aftertitle}% + \CTEX@aftertitle}\par \endgroup \else - \def\@svsechd{#4{\hskip\glueexpr #1\relax - \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{{\CTEX@indentbox{#1}}% + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} \def\@xsect#1{% @@ -861,32 +865,47 @@ \clubpenalty\@M \begingroup \@svsechd \endgroup \unskip - \hskip\glueexpr #1\relax + \CTEX@heading@glue{#1}% \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \fi \ignorespaces} -\cs_new_protected:Npn \CTEX@hangindent #1#2 +\cs_new_protected:Npn \CTEX@headinghang #1 { - \dim_set:Nn \parindent { \use:c { CTEX@#1@indent } } - \bool_if:cTF { CTEX@#1@hang } - { \@hangfrom { \__ctex_indent_aux: #2 } } - {#2} + \ctex_heading_hang:cnn + { CTEX@#1@hang } + { \use:c { CTEX@#1@indent } } } -\cs_new_protected_nopar:Npn \__ctex_indent_aux: +\cs_new_protected:Npn \CTEX@sectionhang + { \ctex_heading_hang:Nnn \CTEX@hang } +\cs_new_protected:Npn \ctex_heading_hang:Nnn #1#2#3 { - \dim_compare:nNnF \parindent = \c_zero_dim - { \skip_horizontal:n { \parindent } } + \dim_set:Nn \tex_parindent:D {#2} + \bool_if:NTF #1 + { \ctex_hang_from:n } + { \use:n } + { \__ctex_insert_indent: #3 } + } +\cs_new_protected:Npn \ctex_hang_from:n #1 + { + \tex_noindent:D + \hbox_set:Nn \l__ctex_tmp_box {#1} + \tex_hangindent:D = \box_wd:N \l__ctex_tmp_box + \box_use_drop:N \l__ctex_tmp_box } -\cs_new_protected_nopar:Npn \CTEX@hangfrom +\cs_generate_variant:Nn \ctex_heading_hang:Nnn { c } +\cs_new_protected:Npn \ctex_heading_glue:n #1 { - \bool_if:NTF \CTEX@hang - { \@hangfrom } - { \noindent \use:n } + \group_begin: + \skip_set:Nn \l__ctex_heading_skip {#1} + \dim_compare:nNnF \l__ctex_heading_skip = \c_zero_dim + { \skip_horizontal:N \l__ctex_heading_skip } + \group_end: } -\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 +\cs_new_eq:NN \CTEX@heading@glue \ctex_heading_glue:n +\cs_new_protected:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } @@ -908,7 +927,7 @@ { } #2 } -\cs_new_nopar:Npn \CTEXnumberline #1 +\cs_new:Npn \CTEXnumberline #1 { \CTEXifname { \protect \numberline { \use:c { CTEXthe #1 } } } @@ -918,7 +937,7 @@ \seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int - \cs_gset_protected_nopar:cpx {#1} + \cs_gset_protected:cpx {#1} { \exp_not:N \@startsection {#1} { \int_use:N \l__ctex_tmp_int } @@ -930,7 +949,7 @@ \cs_new:cpn { CTEX@#1@tocline } ##1##2 { \CTEXnumberline { ##1 } ##2 } } -\keys_define:nn { ctex } +\ctex_define:n { appendix .meta:nn = { ctex / appendix } {#1} , appendix / name .code:n = @@ -942,7 +961,7 @@ \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix \cs_new_eq:NN \CTEX@save@appendix \appendix -\cs_gset_protected_nopar:Npn \appendix +\cs_gset_protected:Npn \appendix { \CTEX@save@appendix \gdef \CTEX@presection { \CTEX@preappendix } @@ -950,7 +969,7 @@ \gdef \CTEX@postsection { \CTEX@postappendix } \gdef \CTEX@section@numbering { \CTEX@appendix@numbering } } -\cs_new_protected_nopar:Npn \CTEX@makeanchor #1 +\cs_new_protected:Npn \CTEX@makeanchor #1 { } \seq_const_from_clist:Nn \c__ctex_headings_cs_seq { part , spart , sect , ssect } @@ -959,7 +978,7 @@ \cs_new_eq:cc { CTEX@ #1 } { @ #1 } \cs_new_eq:cN { CTEX@makeanchor@ #1 } \CTEX@makeanchor } -\cs_new_protected_nopar:Npn \CTEX@hyperheadinghook +\cs_new_protected:Npn \CTEX@hyperheadinghook { \group_begin: \ifHy@implicit @@ -980,7 +999,7 @@ } \ctex_at_end_package:nn { hyperref } { - \cs_gset_protected_nopar:Npn \CTEX@makeanchor #1 + \cs_gset_protected:Npn \CTEX@makeanchor #1 { \Hy@MakeCurrentHrefAuto {#1} \Hy@raisedlink @@ -995,14 +1014,14 @@ { } \ctex_at_end_package:nn { nameref } { - \cs_gset_protected_nopar:Npn \CTEX@gettitle { \NR@gettitle } + \cs_gset_protected:Npn \CTEX@gettitle { \NR@gettitle } \seq_map_inline:Nn \c__ctex_headings_cs_seq { \cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 } { \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } } } } -\cs_new_protected_nopar:Npn \ctex_titlesec_hook: +\cs_new_protected:Npn \ctex_titlesec_hook: { \@ifpackagewith { titlesec } { explicit } { @@ -1022,17 +1041,17 @@ } \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n } -\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 +\cs_new_protected:Npn \__ctex_titlesec_hook:n #1 { \__ctex_titlesec_format:n {#1} \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 +\cs_new_protected:Npn \__ctex_titlesec_format:n #1 { \cs_if_free:cF { ttlf@#1 } { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format:Nn #1#2 { \tl_set:Nx #1 { @@ -1042,7 +1061,7 @@ \tl_tail:N #1 } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format_explicit:Nn #1#2 { \cs_set_nopar:Npx #1 ##1 { @@ -1052,7 +1071,7 @@ \exp_args:No \tl_tail:n { #1 { } } } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_spacing:Nn #1#2 { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } \cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 { @@ -1073,14 +1092,14 @@ { \cs_if_free:NF \ttl@tocpart { - \cs_set_protected_nopar:Npn \ttl@tocpart + \cs_set_protected:Npn \ttl@tocpart { \tl_set:Nn \ttl@a { \CTEXthepart \hspace { 1em } } } } \seq_map_inline:Nn \c__ctex_headings_seq { \cs_if_exist:cF { ttl@toc #1 } { - \cs_new_protected_nopar:cpx { ttl@toc #1 } + \cs_new_protected:cpx { ttl@toc #1 } { \tl_set:Nn \exp_not:N \ttl@a { @@ -1093,7 +1112,7 @@ } \group_begin: \char_set_catcode_other:N \# -\cs_new_protected_nopar:Npn \ctex_titleps_hook: +\cs_new_protected:Npn \ctex_titleps_hook: { \ctex_patch_cmd:Nnn \ttl@settopmark { \protect \@namedef { the#1 } { \@nameuse { the#1 } } } @@ -1115,12 +1134,12 @@ } } \group_end: -\cs_new_nopar:Npn \CTEX@titlepslabel@set #1 +\cs_new:Npn \CTEX@titlepslabel@set #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { \@nameuse { CTEXthe#1 } } } } -\cs_new_nopar:Npn \CTEX@titlepslabel@clear #1 +\cs_new:Npn \CTEX@titlepslabel@clear #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { } } @@ -1130,9 +1149,9 @@ \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: } \ctex_at_end_package:nn { titleps } { - \cs_set_protected_nopar:Npn \ttl@setifthe #1 + \cs_set_protected:Npn \ttl@setifthe #1 { - \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 } + \exp_args:Nco \cs_set:Npn { ifthe #1 } { \CTEXifname { \protect \@firstoftwo } @@ -1159,19 +1178,24 @@ { \CTEX@toc@width@n {#1} } { } { \ctex_patch_failure:N \numberline } - \@ifpackageloaded { tocloft } - { } + \cs_new_protected:Npn \__ctex_patch_toc_width:n \c_parameter_token 1 { - \ctex_at_end_package:nn { tocloft } + \@ifpackageloaded { \c_parameter_token 1 } + { } { - \ctex_preto_cmd:NnnTF \numberline - { \char_set_catcode_letter:n { 64 } } - { \CTEX@toc@width@n {#1} } - { } - { \ctex_patch_failure:N \numberline } + \ctex_at_end_package:nn { \c_parameter_token 1 } + { + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } + { \ctex_patch_failure:N \numberline } + } } } } +\__ctex_patch_toc_width:n { tocloft } +\__ctex_patch_toc_width:n { titletoc } \if@twoside \ctex_patch_cmd:Nnn \ps@headings { \ifnum \c@secnumdepth > \z@ \thesection \quad \fi } @@ -1193,7 +1217,7 @@ { \ifnum \c@secnumdepth > \@ne \thesubsection \hskip 1em \relax \fi } { \CTEXifname { \CTEXthesubsection \quad } { } } } -\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 +\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 { \protected@edef \@currentlabel { @@ -1202,17 +1226,17 @@ { \exp_not:o { \@currentlabel } } } } -\cs_new_protected_nopar:Npn \ctex_varioref_hook: +\cs_new_protected:Npn \ctex_varioref_hook: { \seq_map_inline:Nn \c__ctex_headings_seq { \ctex_fix_varioref_label:n { ##1 } } } -\cs_new_protected_nopar:Npn \ctex_fix_varioref_label:n #1 +\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 { \tl_if_empty:cT { p@#1 } - { \exp_args:Nno \labelformat {#1} { \cs:w CTEX@the#1 \cs_end: } } + { \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } } -\@ifpackageloaded { varioref } +\cs_if_exist:NTF \labelformat { \ctex_varioref_hook: } { \cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter @@ -1226,7 +1250,7 @@ \ctex_scheme_input:o { \l__ctex_scheme_tl } \NewDocumentCommand \zihao { m } { \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_zihao:n #1 +\cs_new_protected:Npn \ctex_zihao:n #1 { \prop_get:NnNTF \c__ctex_font_size_prop {#1} \l__ctex_font_size_tl { \exp_after:wN \fontsize \l__ctex_font_size_tl \selectfont } @@ -1241,7 +1265,7 @@ } \prop_new:N \c__ctex_font_size_prop \seq_new:N \c__ctex_font_size_seq -\cs_new_protected_nopar:Npn \__ctex_save_font_size:nn #1#2 +\cs_new_protected:Npn \__ctex_save_font_size:nn #1#2 { \use:x { @@ -1273,12 +1297,12 @@ { 0 } { 42 bp } } { \__ctex_save_font_size:nn #1 } -\cs_new_protected_nopar:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 +\cs_new_protected:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 { \__ctex_get_font_sizes:Nn \l__ctex_font_size_tl { {#1} {#2} {#3} {#4} } \exp_after:wN \DeclareMathSizes \l__ctex_font_size_tl } -\cs_new_protected_nopar:Npn \__ctex_get_font_sizes:Nn #1#2 +\cs_new_protected:Npn \__ctex_get_font_sizes:Nn #1#2 { \tl_clear:N #1 \tl_map_inline:nn {#2} @@ -1315,13 +1339,13 @@ { \msg_error:nnn { ctex } { fontsize } {#2} } } \cs_new_protected:Npn \__ctex_set_font_size:nnNn #1#2#3#4 - { \cs_set_protected_nopar:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } -\if_case:w \g__ctex_font_size_int - \ctex_file_input:n { ctex-c5size.clo } -\or: - \ctex_file_input:n { ctex-cs4size.clo } -\fi: -\fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } + { \cs_set_protected:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } +\int_case:nn { \g__ctex_font_size_int } + { + { 0 } { \ctex_file_input:n { ctex-c5size.clo } } + { 1 } { \ctex_file_input:n { ctex-cs4size.clo } } + } +\fp_if_nan:nF { \l__ctex_line_spread_fp } { \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: @@ -1332,47 +1356,76 @@ { C \TeX } \ctex_at_end_package:nn { hyperref } { \pdfstringdefDisableCommands { \tl_set:Nn \CTeX { CTeX } } } -\keys_define:nn { ctex } +\ctex_define:n { captiondelimiter .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 +\cs_new_protected:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } { CTeX~fontset~`#1'~is~unavailable~in~current~mode. } -\cs_new_protected_nopar:Npn \ctex_load_fontset: +\cs_new:Npx \ctex_fontset_case:nnn #1#2#3 { - \tl_if_empty:NTF \g__ctex_fontset_tl + \sys_if_engine_pdftex:TF + {#1} + { \sys_if_engine_uptex:TF {#2} {#3} } + } +\cs_new:Npx \ctex_fontset_case:nnnn #1#2#3#4 + { + \sys_if_engine_pdftex:TF + { \sys_if_output_pdf:TF {#1} {#2} } + { \sys_if_engine_uptex:TF {#3} {#4} } + } +\cs_new_protected:Npn \ctex_detect_platform: + { + \sys_if_platform_windows:TF + { \tl_gset:Nn \g__ctex_fontset_tl { windows } } { - \ctex_detected_platform: - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } + \ctex_if_platform_macos:TF + { \tl_gset:Nn \g__ctex_fontset_tl { mac } } + { \tl_gset:Nn \g__ctex_fontset_tl { fandol } } } + } +\cs_new_protected:Npn \ctex_if_platform_macos:TF + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } } +\cs_new_protected:Npn \ctex_load_fontset: + { + \tl_if_empty:NTF \g__ctex_fontset_tl + { \ctex_detect_platform: } { - \file_if_exist:nTF { ctex-fontset- \g__ctex_fontset_tl .def } - { \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } + \bool_lazy_or:nnTF + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsnew } } + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsold } } { - \use:x + \msg_warning:nnxx { ctex } { deprecated-fontset } + { \g__ctex_fontset_tl } { windows } + \tl_gset:Nn \g__ctex_fontset_tl { windows } + } + { + \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def } { - \ctex_detected_platform: - \msg_error:nnxx { ctex } { fontset-not-found } - { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + \use:x + { + \ctex_detect_platform: + \msg_error:nnxx { ctex } { fontset-not-found } + { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + } } - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } } + \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } -\@onlypreamble \ctex_load_fontset: +\msg_new:nnn { ctex } { deprecated-fontset } + { CTeX~fontset~`#1'~is~deprecated.\\ Fontset~`#2'~will~be~used~instead. } \msg_new:nnnn { ctex } { fontset-not-found } - { - CTeX~fontset~`#1'~could~not~be~found.\\ - Fontset~`#2'~will~be~used~instead. - } + { CTeX~fontset~`#1'~could~not~be~found.\\ Fontset~`#2'~will~be~used~instead. } { You~may~run~`mktexlsr'~firstly. } -\keys_define:nn { ctex } +\@onlypreamble \ctex_load_fontset: +\ctex_define:n { fontset .code:n = { @@ -1402,14 +1455,16 @@ } { Only~one~fontset~can~be~loaded~in~the~preamble. } \msg_new:nnn { ctex } { fontset-only-preamble } - { - The~ `fontset'~ option~ can~ be~ used~ only~ in~ preamble. - } + { The~`fontset'~option~can~be~used~only~in~preamble. } \str_if_eq:onF { \g__ctex_fontset_tl } { none } { \ctex_load_fontset: } \ctex_at_end:n { \ctex_file_input:n { ctex.cfg } } %% -%% This package consists of the file ctex.dtx, +%% This package consists of the files ctex.dtx, +%% ctxdoc.cls, +%% ctxdocstrip.tex, +%% ctex-zhconv.lua, +%% ctex-zhconv-make.lua, %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, @@ -1419,16 +1474,15 @@ %% ctexbook.cls, %% ctexrep.cls, %% ctexbeamer.cls, -%% ctxdoc.cls, %% ctexcap.sty, %% ctexhook.sty, %% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, -%% ctex-article.def, -%% ctex-book.def, -%% ctex-report.def, -%% ctex-beamer.def, +%% ctex-heading-article.def, +%% ctex-heading-book.def, +%% ctex-heading-report.def, +%% ctex-heading-beamer.def, %% ctex-scheme-plain.def, %% ctex-scheme-plain-article.def, %% ctex-scheme-plain-book.def, @@ -1443,6 +1497,7 @@ %% ctex-name-utf8.cfg, %% ctex.cfg, %% ctexopts.cfg, +%% ctexbackend.cfg, %% ctex-engine-pdftex.def, %% ctex-engine-xetex.def, %% ctex-engine-luatex.def, @@ -1460,26 +1515,25 @@ %% jt2zhrm.fd, %% jt2zhsf.fd, %% jt2zhtt.fd, -%% ctex-fontset-windows.def, -%% ctex-fontset-windowsnew.def, -%% ctex-fontset-windowsold.def, %% ctex-fontset-adobe.def, %% ctex-fontset-fandol.def, +%% ctex-fontset-founder.def, %% ctex-fontset-mac.def, %% ctex-fontset-macnew.def, %% ctex-fontset-macold.def, -%% ctex-fontset-founder.def, %% ctex-fontset-ubuntu.def, +%% ctex-fontset-windows.def, %% ctexspa.def, %% ctexpunct.spa, %% ctexmakespa.tex, %% ctexspamacro.tex, -%% ctxdocstrip.tex, %% zhadobefonts.tex, %% zhfandolfonts.tex, %% zhfounderfonts.tex, +%% zhmacfonts.tex, %% zhubuntufonts.tex, %% zhwindowsfonts.tex, +%% ctex-zhconv-index.lua, %% translator-theorem-dictionary-ChineseGBK.dict, %% translator-theorem-dictionary-ChineseUTF8.dict, and %% README.md. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls b/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls index f09212611a6..e6a6a8df7f3 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls +++ b/Master/texmf-dist/tex/latex/ctex/ctexbeamer.cls @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `class,beamer') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,18 +20,17 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} +\input{ctexbackend.cfg} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class beamer (CTEX)} \ProvidesExplClass{ctexbeamer} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \cs_new_eq:cN { ver@ctex. \@pkgextension } \c__ctex_version_tl @@ -42,11 +41,11 @@ \msg_new:nnnn { ctex } { l3-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~bundles\\\\ + Please~update~an~up-to-date~version~of~the~bundles\\\\ `l3kernel'~and~`l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2019/03/05 } { } +\@ifpackagelater { expl3 } { 2020/04/06 } { } { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } \@ifpackagelater { l3keys2e } { 2015/12/20 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } @@ -62,11 +61,20 @@ } { \msg_critical:nnx { ctex } { engine-not-supported } { \c__ctex_engine_str } } \RequirePackage { ctexhook , ctexpatch } -\RequirePackage { fix-cm , everysel } +\RequirePackage { fix-cm } +\RequirePackage { everysel } \tl_clear_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \box_new:N \l__ctex_tmp_box \dim_new:N \l__ctex_tmp_dim +\cs_new_protected:Npn \ctex_define_option:n + { \keys_define:nn { ctex / option } } +\cs_new_protected:Npn \ctex_define:n + { \keys_define:nn { ctex } } +\cs_new_protected:Npn \ctex_set:n + { \keys_set:nn { ctex } } +\cs_new_protected:Npn \ctex_set:nn #1 + { \keys_set:nn { ctex / #1 } } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -82,9 +90,9 @@ #3 } } -\cs_new_protected_nopar:Npn \ctex_file_input:n #1 +\cs_new_protected:Npn \ctex_file_input:n #1 { \ctex_file_wrapper:nnn { } { \file_input:n {#1} } { } } -\cs_new_protected_nopar:Npn \ctex_scheme_input:n #1 +\cs_new_protected:Npn \ctex_scheme_input:n #1 { \ctex_file_wrapper:nnn { } @@ -102,7 +110,7 @@ \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~package~`#1'\\ + Please~update~an~up-to-date~version~of~the~package~`#1'\\ using~your~TeX~package~manager~or~from~CTAN. } \sys_if_output_pdf:TF @@ -121,46 +129,44 @@ \exp_last_unbraced:NNNNo \cs_new:Npn \__ctex_default_ccwd_aux:w #1 { \tl_to_str:n { pt } } #2 \q_stop { \tl_if_empty:nT {#2} { \ccwd } } -\tl_new:N \l__ctex_encoding_tl -\tl_set:Nx \l__ctex_encoding_tl - { \sys_if_engine_pdftex:TF { GBK } { UTF8 } } +\tl_new:N \g__ctex_encoding_tl \bool_new:N \g__ctex_zhmCJK_bool \tl_new:N \l__ctex_autoindent_tl \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_nopar:Npn \ctex_at_end:n { \AtEndOfClass } +\cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass } \clist_new:N \g__ctex_std_options_clist \msg_new:nnn { ctex } { invalid-option } { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. } \msg_new:nnn { ctex } { invalid-value } { Value~`#1'~is~invalid~for~the~key~`\l_keys_key_tl'. } +\cs_new_protected:Npn \ctex_deprecated_option:n + { \msg_warning:nnn { ctex } { deprecated-option } } +\cs_new_protected:Npn \ctex_set_deprecated_option:n #1 + { + \ctex_deprecated_option:n { Option~`#1'~is~set. } + \ctex_set:nn { option } {#1} + } +\cs_new_protected:Npn \ctex_deprecated_command:Nn #1#2 + { + \msg_warning:nnxx { ctex } { deprecated-command } + { \token_to_str:N #1 } { \exp_not:n {#2} } + } \msg_new:nnn { ctex } { deprecated-option } - { Option~ `\l_keys_key_tl'~ is~ deprecated.\\ #1 } + { Option~`\l_keys_key_tl'~is~deprecated.\\ #1 } \msg_new:nnn { ctex } { deprecated-command } - { Command~ #1 is~ deprecated.\\ #2 } -\msg_new:nnn { ctex } { deprecated-environment } - { Environment~ `#1'~ is~ deprecated.\\ #2 } + { Command~`#1'~is~deprecated.\\ #2 } \int_new:N \g__ctex_font_size_int -\int_set:Nn \g__ctex_font_size_int { -1 } -\keys_define:nn { ctex / option } +\int_gset:Nn \g__ctex_font_size_int { -1 } +\ctex_define_option:n { zihao .choice: , zihao .value_required:n = true , zihao / 5 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 0 } } , zihao / -4 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 1 } } , zihao / false .code:n = { \int_gset:Nn \g__ctex_font_size_int { 2 } } , - c5size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=5'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = 5 } - } , - cs4size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=-4'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = -4 } - } , + c5size .code:n = { \ctex_set_deprecated_option:n { zihao = 5 } } , + cs4size .code:n = { \ctex_set_deprecated_option:n { zihao = -4 } } , c5size .value_forbidden:n = true , cs4size .value_forbidden:n = true , linespread .fp_set:N = \l__ctex_line_spread_fp , @@ -185,56 +191,38 @@ } , indent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options.~ + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , indent .value_forbidden:n = true , noindent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options. + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , noindent .value_forbidden:n = true , - GBK .code:n = { \tl_set:Nn \l__ctex_encoding_tl { GBK } } , - UTF8 .code:n = { \tl_set:Nn \l__ctex_encoding_tl { UTF8 } } , - GBK .value_forbidden:n = true , - UTF8 .value_forbidden:n = true , - fontset .tl_gset:N = \g__ctex_fontset_tl , - nofonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=none'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = none } - } , - adobefonts .code:n = + GBK .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \sys_if_engine_pdftex:TF + { \tl_gset:Nn \g__ctex_encoding_tl { GBK } } { - Option~ `fontset=adobe'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. + \msg_warning:nn { ctex } { invalid-option } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } - \keys_set:nn { ctex / option } { fontset = adobe } - } , - winfonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=windows'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = windows } } , + UTF8 .code:n = { \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } , + GBK .value_forbidden:n = true , + UTF8 .value_forbidden:n = true , + fontset .tl_gset:N = \g__ctex_fontset_tl , + nofonts .code:n = { \ctex_set_deprecated_option:n { fontset = none } } , + adobefonts .code:n = { \ctex_set_deprecated_option:n { fontset = adobe } } , + winfonts .code:n = { \ctex_set_deprecated_option:n { fontset = windows } } , nofonts .value_forbidden:n = true , winfonts .value_forbidden:n = true , adobefonts .value_forbidden:n = true , @@ -256,69 +244,57 @@ \cs_gset_eq:NN \ctex_zhmap_case:nnn \use_iii:nnn } , nozhmap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zhmap=false'~ is~ set. } - \keys_set:nn { ctex / option } { zhmap = false } - } , + { \ctex_set_deprecated_option:n { zhmap = false } } , nozhmap .value_forbidden:n = true , punct .tl_set:N = \l__ctex_punct_tl , punct .default:n = { quanjiao } , punct .initial:n = { quanjiao } , - nopunct .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `punct=plain'~ is~ set. } - \keys_set:nn { ctex / option } { punct = plain } - } , + nopunct .code:n = \ctex_set_deprecated_option:n { punct = plain } , nopunct .value_forbidden:n = true , space .choices:nn = { true , auto , false } { \exp_args:Nx \ctex_at_end:n - { \keys_set:nn { ctex } { space = \l_keys_choice_tl } } + { \ctex_set:n { space = \l_keys_choice_tl } } } , space .default:n = { true } , - nospace .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `space=false'~ is~ set. } - \keys_set:nn { ctex / option } { space = false } - } , + nospace .code:n = { \ctex_deprecated_option:nn { space = false } } , nospace .value_forbidden:n = true , heading .bool_set:N = \l__ctex_heading_bool , scheme .tl_set:N = \l__ctex_scheme_tl , scheme .default:n = { chinese } , scheme .initial:n = { chinese } , - cap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = chinese' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = chinese } - } , - nocap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = plain' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = plain } - } , + cap .code:n = { \ctex_set_deprecated_option:n { scheme = chinese } } , + nocap .code:n = { \ctex_set_deprecated_option:n { scheme = plain } } , cap .value_forbidden:n = true , nocap .value_forbidden:n = true , - fntef .code:n = + fntef .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `(xe)CJKfntef'~ package~ is~ always~ loaded. } + \sys_if_engine_xetex:TF + { + \ctex_deprecated_option:n { `xeCJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { xeCJKfntef } } + } + { + \sys_if_engine_pdftex:TF + { + \ctex_deprecated_option:n { `CJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { CJKfntef } } + } + { + \ctex_deprecated_option:n + { Furthermore,~option~`fntef'~is~invalid~in~current~mode. } + } + } } , fancyhdr .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `fancyhdr'~ package~ is~ loaded. } - \RequirePackage { fancyhdr } + \ctex_deprecated_option:n { `fancyhdr'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { fancyhdr } } } , hyperref .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `hyperref'~ package~ will~ be~ loaded. } + \ctex_deprecated_option:n { `hyperref'~package~will~be~loaded. } \ctex_at_end:n { \cs_if_exist:NF \hypersetup @@ -344,47 +320,63 @@ #1 .value_forbidden:n = true , } } -\use:x { \keys_define:nn { ctex / option } { \exp_not:o { \l__ctex_tmp_tl } } } +\exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl } \tl_clear:N \l__ctex_tmp_tl -\keys_define:nn { ctex / option } +\ctex_define_option:n { unknown .code:n = { \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } } } \ctex_file_input:n { ctexopts.cfg } \ProcessKeysOptions { ctex / option } -\if_case:w \g__ctex_font_size_int - \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } -\or: - \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } -\fi: +\msg_new:nnn { ctex } { pdftex-utf8 } + { UTF8~will~be~used~as~the~default~encoding. } +\tl_if_empty:NT \g__ctex_encoding_tl + { + \sys_if_engine_pdftex:T + { \msg_warning:nn { ctex } { pdftex-utf8 } } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } + } +\int_case:nn { \g__ctex_font_size_int } + { + { 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 } \@ifpackageloaded { hyperref } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \hypersetup {#1} } } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \PassOptionsToPackage {#1} { hyperref } } } \ctex_file_input:n { \c__ctex_engine_file_str } -\NewDocumentCommand \ctexset { } { \keys_set:nn { ctex } } -\NewDocumentCommand \CTEXsetup { +o > { \TrimSpaces } m } +\NewDocumentCommand \ctexset { } { \ctex_set:n } +\NewDocumentCommand \CTEXsetup { +O { } > { \TrimSpaces } m } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXsetup } - { \ctexset~ {~ #2~ =~ {~ #1~ }~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex / #2 } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXsetup { } } + { + \ctex_deprecated_command:Nn \CTEXsetup + { \ctexset {~#2~=~{~#1~}~}~is~set. } + \ctex_set:nn {#2} {#1} + } } -\NewDocumentCommand \CTEXoptions { +o } +\NewDocumentCommand \CTEXoptions { +O { } } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXoptions } - { \ctexset~ {~ #1~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXoptions { } } + { + \ctex_deprecated_command:Nn \CTEXoptions + { \ctexset {~#1~}~is~set. } + \ctex_set:n {#1} + } } -\keys_define:nn { ctex } +\ctex_define:n { autoindent .choice: , autoindent .default:n = { true } , @@ -402,9 +394,9 @@ } } \NewDocumentCommand \CTEXsetfont { } { \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_select_size: +\cs_new_protected:Npn \ctex_select_size: { \cs_if_free:NTF \size@update { \ctex_update_size: } { \selectfont } } -\cs_new_protected_nopar:Npn \ctex_update_size: +\cs_new_protected:Npn \ctex_update_size: { \tl_if_eq:NNTF \l__ctex_ziju_tl \c__ctex_zero_tl { @@ -418,7 +410,7 @@ \tl_set_eq:NN \l__ctex_ziju_tl \c__ctex_zero_tl \ctex_add_to_selectfont:n { \cs_if_free:NF \size@update { \ctex_update_size: } } -\keys_define:nn { ctex } +\ctex_define:n { linestretch .code:n = { @@ -429,7 +421,7 @@ } \tl_new:N \l__ctex_line_stretch_tl \tl_set:Nn \l__ctex_line_stretch_tl { \ccwd } -\cs_new_protected_nopar:Npn \ctex_update_stretch: +\cs_new_protected:Npn \ctex_update_stretch: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_tmp_dim { \l__ctex_line_stretch_tl } @@ -464,7 +456,7 @@ \ctex_update_ccglue: } } -\cs_new_protected_nopar:Npn \ctex_update_parindent: +\cs_new_protected:Npn \ctex_update_parindent: { \tl_if_empty:NF \l__ctex_autoindent_tl { @@ -474,12 +466,12 @@ } \NewDocumentCommand \ziju { m } { \exp_args:Nx \ctex_ziju:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_ziju:n #1 +\cs_new_protected:Npn \ctex_ziju:n #1 { \tl_set:Nx \l__ctex_ziju_tl { \fp_eval:n {#1} } \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_update_ziju: +\cs_new_protected:Npn \ctex_update_ziju: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_ziju_dim { \l__ctex_ziju_tl \ccwd } @@ -511,19 +503,20 @@ \dim_new:N \l__ctex_ziju_dim \NewDocumentCommand \CTEXindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXindent } - { \parindent is~ set~ to~ 2\ccwd. } - \ctex_update_ccwd: \dim_set:Nn \parindent { 2 \ccwd } + \ctex_deprecated_command:Nn \CTEXindent + { \parindent is~set~to~2\ccwd. } + \ctex_update_ccwd: + \dim_set:Nn \parindent { 2 \ccwd } } \NewDocumentCommand \CTEXnoindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXnoindent } - { \parindent is~ set~ to~ 0pt. } + \ctex_deprecated_command:Nn \CTEXnoindent + { \parindent is~set~to~0pt. } \dim_zero:N \parindent } -\PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhnumber } +\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber } \RequirePackage { zhnumber } -\cs_new_nopar:Npn \chinese { \zhnum_counter:n } +\cs_new:Npn \chinese { \zhnum_counter:n } \cs_new_eq:NN \@chinese \@zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n @@ -541,7 +534,7 @@ \NewDocumentCommand \CTEXdigits { m m } { \protected@edef #1 { \zhdigits {#2} } } \cs_set_eq:NN \CTEX@todayold \today -\keys_define:nn { ctex } +\ctex_define:n { today .choice: , today / old .code:n = @@ -567,7 +560,7 @@ \tl_new:N \proofname \tl_set:Nn \proofname { Proof } } -\keys_define:nn { ctex } +\ctex_define:n { contentsname .tl_set:N = \contentsname , listfigurename .tl_set:N = \listfigurename , @@ -585,7 +578,7 @@ } \seq_const_from_clist:Nn \c__ctex_headings_seq { part , section , subsection } -\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 +\cs_new_protected:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } \tl_new:c { CTEX@post#1 } @@ -615,7 +608,7 @@ \group_end: } } -\cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 +\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 { \tl_put_right:Nx \l__ctex_tmp_tl { @@ -642,7 +635,7 @@ \__ctex_plus_key_aux:nn {#1} { aftertitle } , } } -\cs_new_nopar:Npn \__ctex_plus_key_aux:nn #1#2 +\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 { #1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , #1 / #2 + .code:n = @@ -656,7 +649,7 @@ \cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 { \tl_set:cn { CTEX@pre#1 } {#2} - \IfNoValueTF {#3} + \tl_if_novalue:nTF {#3} { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } @@ -667,62 +660,73 @@ \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x +\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } +\cs_new_protected:Npn \CTEX@heading@format@initial + { + \normalfont + \tl_clear:N \l__ctex_autoindent_tl + \int_set:Nn \tex_interlinepenalty:D { 10 000 } + \tex_noindent:D + } +\cs_new_protected:Npn \ctex_indent_box:n #1 { - \group_end: - \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } + \dim_set:Nn \tex_parindent:D {#1} + \__ctex_insert_indent: } +\cs_new_protected:Npn \__ctex_insert_indent: + { + \dim_compare:nNnF \tex_parindent:D = \c_zero_dim + { \tex_indent:D } + } +\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n \ExplSyntaxOff \defbeamertemplate*{part page}{CTEX}[1][]{% \begingroup - \CTEX@disableautoindent \par \addvspace{\glueexpr\CTEX@part@beforeskip\relax}% - \CTEX@part@format - \parindent \dimexpr \CTEX@part@indent \relax - \ifodd \CTEX@part@numbering - \CTEX@partname \CTEX@part@aftername - \fi - \begin{beamercolorbox}[sep=16pt,center,#1]{part title} - \CTEX@part@titleformat \insertpart \CTEX@part@aftertitle - \end{beamercolorbox}% + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@indentbox{\CTEX@part@indent}% + \ifodd \CTEX@part@numbering + \CTEX@partname \CTEX@part@aftername + \fi + \begin{beamercolorbox}[sep=16pt,center,#1]{part title} + \CTEX@part@titleformat \insertpart \CTEX@part@aftertitle + \end{beamercolorbox}}% \par \addvspace{\glueexpr\CTEX@part@afterskip\relax}% - \endgroup -} + \endgroup} \defbeamertemplate*{section page}{CTEX}[1][]{% \begingroup - \CTEX@disableautoindent \par \addvspace{\glueexpr\CTEX@section@beforeskip\relax}% - \CTEX@section@format - \parindent \dimexpr \CTEX@section@indent \relax - \ifodd \CTEX@section@numbering - \CTEX@sectionname \CTEX@section@aftername - \fi - \begin{beamercolorbox}[sep=12pt,center,#1]{part title} - \CTEX@section@titleformat \insertsection \CTEX@section@aftertitle - \end{beamercolorbox}% + \CTEX@heading@format@initial + \CTEX@section@format{% + \CTEX@indentbox{\CTEX@section@indent}% + \ifodd \CTEX@section@numbering + \CTEX@sectionname \CTEX@section@aftername + \fi + \begin{beamercolorbox}[sep=12pt,center,#1]{part title} + \CTEX@section@titleformat \insertsection \CTEX@section@aftertitle + \end{beamercolorbox}}% \par \addvspace{\glueexpr\CTEX@section@afterskip\relax}% - \endgroup -} + \endgroup} \defbeamertemplate*{subsection page}{CTEX}[1][]{% \begingroup - \CTEX@disableautoindent \par \addvspace{\glueexpr\CTEX@subsection@beforeskip\relax}% - \CTEX@subsection@format - \parindent \dimexpr \CTEX@subsection@indent \relax - \ifodd \CTEX@subsection@numbering - \CTEX@subsectionname \CTEX@subsection@aftername - \fi - \begin{beamercolorbox}[sep=8pt,center,#1]{part title} - \CTEX@subsection@titleformat \insertsubsection \CTEX@subsection@aftertitle - \end{beamercolorbox}% + \CTEX@heading@format@initial + \CTEX@subsection@format{% + \CTEX@indentbox{\CTEX@subsection@indent}% + \ifodd \CTEX@subsection@numbering + \CTEX@subsectionname \CTEX@subsection@aftername + \fi + \begin{beamercolorbox}[sep=8pt,center,#1]{part title} + \CTEX@subsection@titleformat \insertsubsection \CTEX@subsection@aftertitle + \end{beamercolorbox}}% \par \addvspace{\glueexpr\CTEX@subsection@afterskip\relax}% - \endgroup -} + \endgroup} \defbeamertemplatealias{part page}{default}{CTEX} \defbeamertemplatealias{section page}{default}{CTEX} \defbeamertemplatealias{subsection page}{default}{CTEX} \ExplSyntaxOn -\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 +\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 { \protected@edef \@currentlabel { @@ -731,17 +735,17 @@ { \exp_not:o { \@currentlabel } } } } -\cs_new_protected_nopar:Npn \ctex_varioref_hook: +\cs_new_protected:Npn \ctex_varioref_hook: { \seq_map_inline:Nn \c__ctex_headings_seq { \ctex_fix_varioref_label:n { ##1 } } } -\cs_new_protected_nopar:Npn \ctex_fix_varioref_label:n #1 +\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 { \tl_if_empty:cT { p@#1 } - { \exp_args:Nno \labelformat {#1} { \cs:w CTEX@the#1 \cs_end: } } + { \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } } -\@ifpackageloaded { varioref } +\cs_if_exist:NTF \labelformat { \ctex_varioref_hook: } { \cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter @@ -755,7 +759,7 @@ \ctex_scheme_input:o { \l__ctex_scheme_tl } \NewDocumentCommand \zihao { m } { \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_zihao:n #1 +\cs_new_protected:Npn \ctex_zihao:n #1 { \prop_get:NnNTF \c__ctex_font_size_prop {#1} \l__ctex_font_size_tl { \exp_after:wN \fontsize \l__ctex_font_size_tl \selectfont } @@ -770,7 +774,7 @@ } \prop_new:N \c__ctex_font_size_prop \seq_new:N \c__ctex_font_size_seq -\cs_new_protected_nopar:Npn \__ctex_save_font_size:nn #1#2 +\cs_new_protected:Npn \__ctex_save_font_size:nn #1#2 { \use:x { @@ -802,12 +806,12 @@ { 0 } { 42 bp } } { \__ctex_save_font_size:nn #1 } -\cs_new_protected_nopar:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 +\cs_new_protected:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 { \__ctex_get_font_sizes:Nn \l__ctex_font_size_tl { {#1} {#2} {#3} {#4} } \exp_after:wN \DeclareMathSizes \l__ctex_font_size_tl } -\cs_new_protected_nopar:Npn \__ctex_get_font_sizes:Nn #1#2 +\cs_new_protected:Npn \__ctex_get_font_sizes:Nn #1#2 { \tl_clear:N #1 \tl_map_inline:nn {#2} @@ -844,13 +848,13 @@ { \msg_error:nnn { ctex } { fontsize } {#2} } } \cs_new_protected:Npn \__ctex_set_font_size:nnNn #1#2#3#4 - { \cs_set_protected_nopar:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } -\if_case:w \g__ctex_font_size_int - \ctex_file_input:n { ctex-c5size.clo } -\or: - \ctex_file_input:n { ctex-cs4size.clo } -\fi: -\fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } + { \cs_set_protected:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } +\int_case:nn { \g__ctex_font_size_int } + { + { 0 } { \ctex_file_input:n { ctex-c5size.clo } } + { 1 } { \ctex_file_input:n { ctex-cs4size.clo } } + } +\fp_if_nan:nF { \l__ctex_line_spread_fp } { \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: @@ -861,47 +865,76 @@ { C \TeX } \ctex_at_end_package:nn { hyperref } { \pdfstringdefDisableCommands { \tl_set:Nn \CTeX { CTeX } } } -\keys_define:nn { ctex } +\ctex_define:n { captiondelimiter .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 +\cs_new_protected:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } { CTeX~fontset~`#1'~is~unavailable~in~current~mode. } -\cs_new_protected_nopar:Npn \ctex_load_fontset: +\cs_new:Npx \ctex_fontset_case:nnn #1#2#3 { - \tl_if_empty:NTF \g__ctex_fontset_tl + \sys_if_engine_pdftex:TF + {#1} + { \sys_if_engine_uptex:TF {#2} {#3} } + } +\cs_new:Npx \ctex_fontset_case:nnnn #1#2#3#4 + { + \sys_if_engine_pdftex:TF + { \sys_if_output_pdf:TF {#1} {#2} } + { \sys_if_engine_uptex:TF {#3} {#4} } + } +\cs_new_protected:Npn \ctex_detect_platform: + { + \sys_if_platform_windows:TF + { \tl_gset:Nn \g__ctex_fontset_tl { windows } } { - \ctex_detected_platform: - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } + \ctex_if_platform_macos:TF + { \tl_gset:Nn \g__ctex_fontset_tl { mac } } + { \tl_gset:Nn \g__ctex_fontset_tl { fandol } } } + } +\cs_new_protected:Npn \ctex_if_platform_macos:TF + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } } +\cs_new_protected:Npn \ctex_load_fontset: + { + \tl_if_empty:NTF \g__ctex_fontset_tl + { \ctex_detect_platform: } { - \file_if_exist:nTF { ctex-fontset- \g__ctex_fontset_tl .def } - { \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } + \bool_lazy_or:nnTF + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsnew } } + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsold } } { - \use:x + \msg_warning:nnxx { ctex } { deprecated-fontset } + { \g__ctex_fontset_tl } { windows } + \tl_gset:Nn \g__ctex_fontset_tl { windows } + } + { + \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def } { - \ctex_detected_platform: - \msg_error:nnxx { ctex } { fontset-not-found } - { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + \use:x + { + \ctex_detect_platform: + \msg_error:nnxx { ctex } { fontset-not-found } + { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + } } - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } } + \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } -\@onlypreamble \ctex_load_fontset: +\msg_new:nnn { ctex } { deprecated-fontset } + { CTeX~fontset~`#1'~is~deprecated.\\ Fontset~`#2'~will~be~used~instead. } \msg_new:nnnn { ctex } { fontset-not-found } - { - CTeX~fontset~`#1'~could~not~be~found.\\ - Fontset~`#2'~will~be~used~instead. - } + { CTeX~fontset~`#1'~could~not~be~found.\\ Fontset~`#2'~will~be~used~instead. } { You~may~run~`mktexlsr'~firstly. } -\keys_define:nn { ctex } +\@onlypreamble \ctex_load_fontset: +\ctex_define:n { fontset .code:n = { @@ -931,14 +964,16 @@ } { Only~one~fontset~can~be~loaded~in~the~preamble. } \msg_new:nnn { ctex } { fontset-only-preamble } - { - The~ `fontset'~ option~ can~ be~ used~ only~ in~ preamble. - } + { The~`fontset'~option~can~be~used~only~in~preamble. } \str_if_eq:onF { \g__ctex_fontset_tl } { none } { \ctex_load_fontset: } \ctex_at_end:n { \ctex_file_input:n { ctex.cfg } } %% -%% This package consists of the file ctex.dtx, +%% This package consists of the files ctex.dtx, +%% ctxdoc.cls, +%% ctxdocstrip.tex, +%% ctex-zhconv.lua, +%% ctex-zhconv-make.lua, %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, @@ -948,16 +983,15 @@ %% ctexbook.cls, %% ctexrep.cls, %% ctexbeamer.cls, -%% ctxdoc.cls, %% ctexcap.sty, %% ctexhook.sty, %% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, -%% ctex-article.def, -%% ctex-book.def, -%% ctex-report.def, -%% ctex-beamer.def, +%% ctex-heading-article.def, +%% ctex-heading-book.def, +%% ctex-heading-report.def, +%% ctex-heading-beamer.def, %% ctex-scheme-plain.def, %% ctex-scheme-plain-article.def, %% ctex-scheme-plain-book.def, @@ -972,6 +1006,7 @@ %% ctex-name-utf8.cfg, %% ctex.cfg, %% ctexopts.cfg, +%% ctexbackend.cfg, %% ctex-engine-pdftex.def, %% ctex-engine-xetex.def, %% ctex-engine-luatex.def, @@ -989,26 +1024,25 @@ %% jt2zhrm.fd, %% jt2zhsf.fd, %% jt2zhtt.fd, -%% ctex-fontset-windows.def, -%% ctex-fontset-windowsnew.def, -%% ctex-fontset-windowsold.def, %% ctex-fontset-adobe.def, %% ctex-fontset-fandol.def, +%% ctex-fontset-founder.def, %% ctex-fontset-mac.def, %% ctex-fontset-macnew.def, %% ctex-fontset-macold.def, -%% ctex-fontset-founder.def, %% ctex-fontset-ubuntu.def, +%% ctex-fontset-windows.def, %% ctexspa.def, %% ctexpunct.spa, %% ctexmakespa.tex, %% ctexspamacro.tex, -%% ctxdocstrip.tex, %% zhadobefonts.tex, %% zhfandolfonts.tex, %% zhfounderfonts.tex, +%% zhmacfonts.tex, %% zhubuntufonts.tex, %% zhwindowsfonts.tex, +%% ctex-zhconv-index.lua, %% translator-theorem-dictionary-ChineseGBK.dict, %% translator-theorem-dictionary-ChineseUTF8.dict, and %% README.md. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexbook.cls b/Master/texmf-dist/tex/latex/ctex/ctexbook.cls index bc6fab18252..b98a13c6c78 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexbook.cls +++ b/Master/texmf-dist/tex/latex/ctex/ctexbook.cls @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `class,book') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,18 +20,17 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} +\input{ctexbackend.cfg} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class book (CTEX)} \ProvidesExplClass{ctexbook} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \cs_new_eq:cN { ver@ctex. \@pkgextension } \c__ctex_version_tl @@ -42,11 +41,11 @@ \msg_new:nnnn { ctex } { l3-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~bundles\\\\ + Please~update~an~up-to-date~version~of~the~bundles\\\\ `l3kernel'~and~`l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2019/03/05 } { } +\@ifpackagelater { expl3 } { 2020/04/06 } { } { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } \@ifpackagelater { l3keys2e } { 2015/12/20 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } @@ -62,11 +61,20 @@ } { \msg_critical:nnx { ctex } { engine-not-supported } { \c__ctex_engine_str } } \RequirePackage { ctexhook , ctexpatch } -\RequirePackage { fix-cm , everysel } +\RequirePackage { fix-cm } +\RequirePackage { everysel } \tl_clear_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \box_new:N \l__ctex_tmp_box \dim_new:N \l__ctex_tmp_dim +\cs_new_protected:Npn \ctex_define_option:n + { \keys_define:nn { ctex / option } } +\cs_new_protected:Npn \ctex_define:n + { \keys_define:nn { ctex } } +\cs_new_protected:Npn \ctex_set:n + { \keys_set:nn { ctex } } +\cs_new_protected:Npn \ctex_set:nn #1 + { \keys_set:nn { ctex / #1 } } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -82,9 +90,9 @@ #3 } } -\cs_new_protected_nopar:Npn \ctex_file_input:n #1 +\cs_new_protected:Npn \ctex_file_input:n #1 { \ctex_file_wrapper:nnn { } { \file_input:n {#1} } { } } -\cs_new_protected_nopar:Npn \ctex_scheme_input:n #1 +\cs_new_protected:Npn \ctex_scheme_input:n #1 { \ctex_file_wrapper:nnn { } @@ -104,7 +112,7 @@ \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~package~`#1'\\ + Please~update~an~up-to-date~version~of~the~package~`#1'\\ using~your~TeX~package~manager~or~from~CTAN. } \sys_if_output_pdf:TF @@ -123,46 +131,44 @@ \exp_last_unbraced:NNNNo \cs_new:Npn \__ctex_default_ccwd_aux:w #1 { \tl_to_str:n { pt } } #2 \q_stop { \tl_if_empty:nT {#2} { \ccwd } } -\tl_new:N \l__ctex_encoding_tl -\tl_set:Nx \l__ctex_encoding_tl - { \sys_if_engine_pdftex:TF { GBK } { UTF8 } } +\tl_new:N \g__ctex_encoding_tl \bool_new:N \g__ctex_zhmCJK_bool \tl_new:N \l__ctex_autoindent_tl \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_nopar:Npn \ctex_at_end:n { \AtEndOfClass } +\cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass } \clist_new:N \g__ctex_std_options_clist \msg_new:nnn { ctex } { invalid-option } { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. } \msg_new:nnn { ctex } { invalid-value } { Value~`#1'~is~invalid~for~the~key~`\l_keys_key_tl'. } +\cs_new_protected:Npn \ctex_deprecated_option:n + { \msg_warning:nnn { ctex } { deprecated-option } } +\cs_new_protected:Npn \ctex_set_deprecated_option:n #1 + { + \ctex_deprecated_option:n { Option~`#1'~is~set. } + \ctex_set:nn { option } {#1} + } +\cs_new_protected:Npn \ctex_deprecated_command:Nn #1#2 + { + \msg_warning:nnxx { ctex } { deprecated-command } + { \token_to_str:N #1 } { \exp_not:n {#2} } + } \msg_new:nnn { ctex } { deprecated-option } - { Option~ `\l_keys_key_tl'~ is~ deprecated.\\ #1 } + { Option~`\l_keys_key_tl'~is~deprecated.\\ #1 } \msg_new:nnn { ctex } { deprecated-command } - { Command~ #1 is~ deprecated.\\ #2 } -\msg_new:nnn { ctex } { deprecated-environment } - { Environment~ `#1'~ is~ deprecated.\\ #2 } + { Command~`#1'~is~deprecated.\\ #2 } \int_new:N \g__ctex_font_size_int -\int_set:Nn \g__ctex_font_size_int { -1 } -\keys_define:nn { ctex / option } +\int_gset:Nn \g__ctex_font_size_int { -1 } +\ctex_define_option:n { zihao .choice: , zihao .value_required:n = true , zihao / 5 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 0 } } , zihao / -4 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 1 } } , zihao / false .code:n = { \int_gset:Nn \g__ctex_font_size_int { 2 } } , - c5size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=5'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = 5 } - } , - cs4size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=-4'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = -4 } - } , + c5size .code:n = { \ctex_set_deprecated_option:n { zihao = 5 } } , + cs4size .code:n = { \ctex_set_deprecated_option:n { zihao = -4 } } , c5size .value_forbidden:n = true , cs4size .value_forbidden:n = true , linespread .fp_set:N = \l__ctex_line_spread_fp , @@ -187,56 +193,38 @@ } , indent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options.~ + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , indent .value_forbidden:n = true , noindent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options. + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , noindent .value_forbidden:n = true , - GBK .code:n = { \tl_set:Nn \l__ctex_encoding_tl { GBK } } , - UTF8 .code:n = { \tl_set:Nn \l__ctex_encoding_tl { UTF8 } } , - GBK .value_forbidden:n = true , - UTF8 .value_forbidden:n = true , - fontset .tl_gset:N = \g__ctex_fontset_tl , - nofonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=none'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = none } - } , - adobefonts .code:n = + GBK .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \sys_if_engine_pdftex:TF + { \tl_gset:Nn \g__ctex_encoding_tl { GBK } } { - Option~ `fontset=adobe'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. + \msg_warning:nn { ctex } { invalid-option } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } - \keys_set:nn { ctex / option } { fontset = adobe } - } , - winfonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=windows'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = windows } } , + UTF8 .code:n = { \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } , + GBK .value_forbidden:n = true , + UTF8 .value_forbidden:n = true , + fontset .tl_gset:N = \g__ctex_fontset_tl , + nofonts .code:n = { \ctex_set_deprecated_option:n { fontset = none } } , + adobefonts .code:n = { \ctex_set_deprecated_option:n { fontset = adobe } } , + winfonts .code:n = { \ctex_set_deprecated_option:n { fontset = windows } } , nofonts .value_forbidden:n = true , winfonts .value_forbidden:n = true , adobefonts .value_forbidden:n = true , @@ -258,35 +246,21 @@ \cs_gset_eq:NN \ctex_zhmap_case:nnn \use_iii:nnn } , nozhmap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zhmap=false'~ is~ set. } - \keys_set:nn { ctex / option } { zhmap = false } - } , + { \ctex_set_deprecated_option:n { zhmap = false } } , nozhmap .value_forbidden:n = true , punct .tl_set:N = \l__ctex_punct_tl , punct .default:n = { quanjiao } , punct .initial:n = { quanjiao } , - nopunct .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `punct=plain'~ is~ set. } - \keys_set:nn { ctex / option } { punct = plain } - } , + nopunct .code:n = \ctex_set_deprecated_option:n { punct = plain } , nopunct .value_forbidden:n = true , space .choices:nn = { true , auto , false } { \exp_args:Nx \ctex_at_end:n - { \keys_set:nn { ctex } { space = \l_keys_choice_tl } } + { \ctex_set:n { space = \l_keys_choice_tl } } } , space .default:n = { true } , - nospace .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `space=false'~ is~ set. } - \keys_set:nn { ctex / option } { space = false } - } , + nospace .code:n = { \ctex_deprecated_option:nn { space = false } } , nospace .value_forbidden:n = true , heading .bool_set:N = \l__ctex_heading_bool , sub3section .code:n = @@ -298,35 +272,37 @@ scheme .tl_set:N = \l__ctex_scheme_tl , scheme .default:n = { chinese } , scheme .initial:n = { chinese } , - cap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = chinese' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = chinese } - } , - nocap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = plain' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = plain } - } , + cap .code:n = { \ctex_set_deprecated_option:n { scheme = chinese } } , + nocap .code:n = { \ctex_set_deprecated_option:n { scheme = plain } } , cap .value_forbidden:n = true , nocap .value_forbidden:n = true , - fntef .code:n = + fntef .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `(xe)CJKfntef'~ package~ is~ always~ loaded. } + \sys_if_engine_xetex:TF + { + \ctex_deprecated_option:n { `xeCJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { xeCJKfntef } } + } + { + \sys_if_engine_pdftex:TF + { + \ctex_deprecated_option:n { `CJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { CJKfntef } } + } + { + \ctex_deprecated_option:n + { Furthermore,~option~`fntef'~is~invalid~in~current~mode. } + } + } } , fancyhdr .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `fancyhdr'~ package~ is~ loaded. } - \RequirePackage { fancyhdr } + \ctex_deprecated_option:n { `fancyhdr'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { fancyhdr } } } , hyperref .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `hyperref'~ package~ will~ be~ loaded. } + \ctex_deprecated_option:n { `hyperref'~package~will~be~loaded. } \ctex_at_end:n { \cs_if_exist:NF \hypersetup @@ -352,47 +328,63 @@ #1 .value_forbidden:n = true , } } -\use:x { \keys_define:nn { ctex / option } { \exp_not:o { \l__ctex_tmp_tl } } } +\exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl } \tl_clear:N \l__ctex_tmp_tl -\keys_define:nn { ctex / option } +\ctex_define_option:n { unknown .code:n = { \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } } } \ctex_file_input:n { ctexopts.cfg } \ProcessKeysOptions { ctex / option } -\if_case:w \g__ctex_font_size_int - \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } -\or: - \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } -\fi: +\msg_new:nnn { ctex } { pdftex-utf8 } + { UTF8~will~be~used~as~the~default~encoding. } +\tl_if_empty:NT \g__ctex_encoding_tl + { + \sys_if_engine_pdftex:T + { \msg_warning:nn { ctex } { pdftex-utf8 } } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } + } +\int_case:nn { \g__ctex_font_size_int } + { + { 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 } \@ifpackageloaded { hyperref } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \hypersetup {#1} } } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \PassOptionsToPackage {#1} { hyperref } } } \ctex_file_input:n { \c__ctex_engine_file_str } -\NewDocumentCommand \ctexset { } { \keys_set:nn { ctex } } -\NewDocumentCommand \CTEXsetup { +o > { \TrimSpaces } m } +\NewDocumentCommand \ctexset { } { \ctex_set:n } +\NewDocumentCommand \CTEXsetup { +O { } > { \TrimSpaces } m } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXsetup } - { \ctexset~ {~ #2~ =~ {~ #1~ }~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex / #2 } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXsetup { } } + { + \ctex_deprecated_command:Nn \CTEXsetup + { \ctexset {~#2~=~{~#1~}~}~is~set. } + \ctex_set:nn {#2} {#1} + } } -\NewDocumentCommand \CTEXoptions { +o } +\NewDocumentCommand \CTEXoptions { +O { } } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXoptions } - { \ctexset~ {~ #1~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXoptions { } } + { + \ctex_deprecated_command:Nn \CTEXoptions + { \ctexset {~#1~}~is~set. } + \ctex_set:n {#1} + } } -\keys_define:nn { ctex } +\ctex_define:n { autoindent .choice: , autoindent .default:n = { true } , @@ -410,9 +402,9 @@ } } \NewDocumentCommand \CTEXsetfont { } { \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_select_size: +\cs_new_protected:Npn \ctex_select_size: { \cs_if_free:NTF \size@update { \ctex_update_size: } { \selectfont } } -\cs_new_protected_nopar:Npn \ctex_update_size: +\cs_new_protected:Npn \ctex_update_size: { \tl_if_eq:NNTF \l__ctex_ziju_tl \c__ctex_zero_tl { @@ -426,7 +418,7 @@ \tl_set_eq:NN \l__ctex_ziju_tl \c__ctex_zero_tl \ctex_add_to_selectfont:n { \cs_if_free:NF \size@update { \ctex_update_size: } } -\keys_define:nn { ctex } +\ctex_define:n { linestretch .code:n = { @@ -437,7 +429,7 @@ } \tl_new:N \l__ctex_line_stretch_tl \tl_set:Nn \l__ctex_line_stretch_tl { \ccwd } -\cs_new_protected_nopar:Npn \ctex_update_stretch: +\cs_new_protected:Npn \ctex_update_stretch: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_tmp_dim { \l__ctex_line_stretch_tl } @@ -472,7 +464,7 @@ \ctex_update_ccglue: } } -\cs_new_protected_nopar:Npn \ctex_update_parindent: +\cs_new_protected:Npn \ctex_update_parindent: { \tl_if_empty:NF \l__ctex_autoindent_tl { @@ -482,12 +474,12 @@ } \NewDocumentCommand \ziju { m } { \exp_args:Nx \ctex_ziju:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_ziju:n #1 +\cs_new_protected:Npn \ctex_ziju:n #1 { \tl_set:Nx \l__ctex_ziju_tl { \fp_eval:n {#1} } \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_update_ziju: +\cs_new_protected:Npn \ctex_update_ziju: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_ziju_dim { \l__ctex_ziju_tl \ccwd } @@ -519,19 +511,20 @@ \dim_new:N \l__ctex_ziju_dim \NewDocumentCommand \CTEXindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXindent } - { \parindent is~ set~ to~ 2\ccwd. } - \ctex_update_ccwd: \dim_set:Nn \parindent { 2 \ccwd } + \ctex_deprecated_command:Nn \CTEXindent + { \parindent is~set~to~2\ccwd. } + \ctex_update_ccwd: + \dim_set:Nn \parindent { 2 \ccwd } } \NewDocumentCommand \CTEXnoindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXnoindent } - { \parindent is~ set~ to~ 0pt. } + \ctex_deprecated_command:Nn \CTEXnoindent + { \parindent is~set~to~0pt. } \dim_zero:N \parindent } -\PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhnumber } +\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber } \RequirePackage { zhnumber } -\cs_new_nopar:Npn \chinese { \zhnum_counter:n } +\cs_new:Npn \chinese { \zhnum_counter:n } \cs_new_eq:NN \@chinese \@zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n @@ -549,7 +542,7 @@ \NewDocumentCommand \CTEXdigits { m m } { \protected@edef #1 { \zhdigits {#2} } } \cs_set_eq:NN \CTEX@todayold \today -\keys_define:nn { ctex } +\ctex_define:n { today .choice: , today / old .code:n = @@ -575,7 +568,7 @@ \tl_new:N \proofname \tl_set:Nn \proofname { Proof } } -\keys_define:nn { ctex } +\ctex_define:n { contentsname .tl_set:N = \contentsname , listfigurename .tl_set:N = \listfigurename , @@ -594,7 +587,7 @@ \seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq \seq_gput_left:Nn \c__ctex_headings_seq { chapter } \seq_gput_left:Nn \c__ctex_headings_seq { part } -\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 +\cs_new_protected:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } \tl_new:c { CTEX@post#1 } @@ -624,7 +617,7 @@ \group_end: } } -\cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 +\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 { \tl_put_right:Nx \l__ctex_tmp_tl { @@ -648,11 +641,8 @@ #1 / hang .bool_set:N = \exp_not:c { CTEX@#1@hang } , #1 / hang .initial:n = true , #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , - #1 / tocline .code:n = - { - \cs_set:Npn \exp_not:c { CTEX@#1@tocline} - \exp_not:n { ####1####2 } { ####1 } - } , + #1 / tocline .cs_set:Np = \exp_not:c { CTEX@#1@tocline} + \exp_not:n { ##1##2 } , \__ctex_plus_key_aux:nn {#1} { break } , \__ctex_plus_key_aux:nn {#1} { format } , \__ctex_plus_key_aux:nn {#1} { nameformat } , @@ -662,7 +652,7 @@ \__ctex_plus_key_aux:nn {#1} { aftertitle } , } } -\cs_new_nopar:Npn \__ctex_plus_key_aux:nn #1#2 +\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 { #1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , #1 / #2 + .code:n = @@ -676,7 +666,7 @@ \cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 { \tl_set:cn { CTEX@pre#1 } {#2} - \IfNoValueTF {#3} + \tl_if_novalue:nTF {#3} { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } @@ -697,35 +687,49 @@ \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x +\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } +\cs_new_protected:Npn \CTEX@heading@format@initial { - \group_end: - \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } + \normalfont + \tl_clear:N \l__ctex_autoindent_tl + \int_set:Nn \tex_interlinepenalty:D { 10 000 } + \tex_noindent:D } -\cs_new_protected_nopar:Npn \CTEX@fixtopskip +\cs_new_protected:Npn \ctex_indent_box:n #1 + { + \dim_set:Nn \tex_parindent:D {#1} + \__ctex_insert_indent: + } +\cs_new_protected:Npn \__ctex_insert_indent: + { + \dim_compare:nNnF \tex_parindent:D = \c_zero_dim + { \tex_indent:D } + } +\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n +\cs_new_protected:Npn \CTEX@fixtopskip { \CTEX@fixheadingskip \dim_compare:nNnF \tex_pagegoal:D < \c_max_dim { \skip_sub:Nn \l__ctex_heading_skip { \tex_topskip:D } } } -\cs_new_protected_nopar:Npn \CTEX@fixheadingskip +\cs_new_protected:Npn \CTEX@fixheadingskip { \par \dim_set:Nn \tex_prevdepth:D { -1000pt } \skip_sub:Nn \l__ctex_heading_skip { \tex_parskip:D } } \skip_new:N \l__ctex_heading_skip -\cs_new_protected_nopar:Npn \CTEX@setheadingskip +\cs_new_protected:Npn \CTEX@setheadingskip { \skip_set:Nn \l__ctex_heading_skip } \cs_new_eq:NN \CTEX@headingskip \l__ctex_heading_skip \ProvideDocumentCommand \partmark { m } { \markboth { } { } } \cs_new_eq:NN \CTEXifname \use_ii:nn -\cs_new_protected_nopar:Npn \CTEX@ifnametrue +\cs_new_protected:Npn \CTEX@ifnametrue { \cs_set_eq:NN \CTEXifname \use_i:nn } -\cs_new_protected_nopar:Npn \CTEX@ifnamefalse +\cs_new_protected:Npn \CTEX@ifnamefalse { \cs_set_eq:NN \CTEXifname \use_ii:nn } -\cs_new_protected_nopar:Npn \CTEX@addloflotskip #1 +\cs_new_protected:Npn \CTEX@addloflotskip #1 { \skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@lofskip } } \skip_if_eq:nnF { \l__ctex_heading_skip } { \c_zero_skip } @@ -742,8 +746,6 @@ } \cs_new_protected:Npn \CTEX@addtocline #1#2 { \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } } -\cs_new_protected_nopar:Npn \CTEX@disableautoindent - { \tl_clear:N \l__ctex_autoindent_tl } \renewcommand\part{% \CTEX@part@break \thispagestyle{\CTEX@part@pagestyle}% @@ -772,51 +774,53 @@ \fi \CTEX@gettitle{#1}% \CTEX@addtocline{part}{#1}% - \partmark{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}% - {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% - \CTEX@part@titleformat{#2}% - \CTEX@part@aftertitle}% + \partmark{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}% + {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% + \CTEX@part@titleformat{#2}% + \CTEX@part@aftertitle}\par + \endgroup \@endpart} \def\@spart#1{% - \CTEX@ifnamefalse - \CTEX@makeanchor@spart{part*}% - \CTEX@gettitle{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}{}% - \CTEX@part@titleformat{#1}% - \CTEX@part@aftertitle}% - \@endpart} + \CTEX@ifnamefalse + \CTEX@makeanchor@spart{part*}% + \CTEX@gettitle{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}{}% + \CTEX@part@titleformat{#1}% + \CTEX@part@aftertitle}\par + \endgroup + \@endpart} \def\@endpart{% - \CTEX@setheadingskip \CTEX@part@afterskip - \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - \newpage - \if@twoside - \if@openright - \null - \thispagestyle{empty}% - \newpage - \fi - \fi - \if@tempswa - \twocolumn - \fi} + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip + \newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} \renewcommand\chapter{% - \CTEX@chapter@break - \thispagestyle{\CTEX@chapter@pagestyle}% - \global\@topnum\z@ - \ifodd \CTEX@chapter@afterindent - \@afterindenttrue - \else - \@afterindentfalse - \fi - \secdef\@chapter\@schapter} + \CTEX@chapter@break + \thispagestyle{\CTEX@chapter@pagestyle}% + \global\@topnum\z@ + \ifodd \CTEX@chapter@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter @@ -860,33 +864,33 @@ \CTEX@setheadingskip \CTEX@chapter@beforeskip \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi \vspace*{\CTEX@headingskip}% - {\CTEX@disableautoindent - \normalfont \CTEX@chapter@format - \interlinepenalty\@M - \CTEX@hangindent{chapter}% - {\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% - \CTEX@chapter@titleformat{#1}% - \CTEX@chapter@aftertitle - \nobreak - \CTEX@setheadingskip \CTEX@chapter@afterskip - \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - }} + \begingroup + \CTEX@heading@format@initial + \CTEX@chapter@format{% + \CTEX@headinghang{chapter}% + {\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip} \def\@makeschapterhead#1{% \CTEX@setheadingskip \CTEX@chapter@beforeskip \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi \vspace*{\CTEX@headingskip}% - {\CTEX@disableautoindent - \normalfont \CTEX@chapter@format - \interlinepenalty\@M - \CTEX@hangindent{chapter}{}% - \CTEX@chapter@titleformat{#1}% - \CTEX@chapter@aftertitle - \nobreak - \CTEX@setheadingskip \CTEX@chapter@afterskip - \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - }} + \begingroup + \CTEX@heading@format@initial + \CTEX@chapter@format{% + \CTEX@headinghang{chapter}{}% + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip} \def\@startsection#1#2#3#4#5#6{% \if@noskipsec \leavevmode \fi \par @@ -929,22 +933,22 @@ \CTEX@gettitle{#7}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #6{% - \CTEX@hangfrom{\hskip\glueexpr #3\relax\@svsec}% - \interlinepenalty \@M + \CTEX@sectionhang{#3}{\@svsec}% \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% + \csname CTEX@#1@aftertitle\endcsname}\par \endgroup \csname #1mark\endcsname{#7}% \CTEX@addtocline{#1}{#7}% \else \def\@svsechd{% - #6{\hskip\glueexpr #3\relax - \@svsec - \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% - \csname #1mark\endcsname{#7}% - \CTEX@addtocline{#1}{#7}}% + #6{% + {\CTEX@indentbox{#3}}\@svsec + \csname CTEX@#1@titleformat\endcsname{#8}% + \csname CTEX@#1@aftertitle\endcsname}% + \csname #1mark\endcsname{#7}% + \CTEX@addtocline{#1}{#7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% @@ -952,15 +956,15 @@ \CTEX@gettitle{#5}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #4{% - \CTEX@hangfrom{\hskip\glueexpr #1\relax}% - \interlinepenalty \@M + \CTEX@sectionhang{#1}{}% \CTEX@titleformat@n{#5}% - \CTEX@aftertitle}% + \CTEX@aftertitle}\par \endgroup \else - \def\@svsechd{#4{\hskip\glueexpr #1\relax - \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{{\CTEX@indentbox{#1}}% + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} \def\@xsect#1{% @@ -980,32 +984,47 @@ \clubpenalty\@M \begingroup \@svsechd \endgroup \unskip - \hskip\glueexpr #1\relax + \CTEX@heading@glue{#1}% \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \fi \ignorespaces} -\cs_new_protected:Npn \CTEX@hangindent #1#2 +\cs_new_protected:Npn \CTEX@headinghang #1 { - \dim_set:Nn \parindent { \use:c { CTEX@#1@indent } } - \bool_if:cTF { CTEX@#1@hang } - { \@hangfrom { \__ctex_indent_aux: #2 } } - {#2} + \ctex_heading_hang:cnn + { CTEX@#1@hang } + { \use:c { CTEX@#1@indent } } } -\cs_new_protected_nopar:Npn \__ctex_indent_aux: +\cs_new_protected:Npn \CTEX@sectionhang + { \ctex_heading_hang:Nnn \CTEX@hang } +\cs_new_protected:Npn \ctex_heading_hang:Nnn #1#2#3 { - \dim_compare:nNnF \parindent = \c_zero_dim - { \skip_horizontal:n { \parindent } } + \dim_set:Nn \tex_parindent:D {#2} + \bool_if:NTF #1 + { \ctex_hang_from:n } + { \use:n } + { \__ctex_insert_indent: #3 } } -\cs_new_protected_nopar:Npn \CTEX@hangfrom +\cs_new_protected:Npn \ctex_hang_from:n #1 { - \bool_if:NTF \CTEX@hang - { \@hangfrom } - { \noindent \use:n } + \tex_noindent:D + \hbox_set:Nn \l__ctex_tmp_box {#1} + \tex_hangindent:D = \box_wd:N \l__ctex_tmp_box + \box_use_drop:N \l__ctex_tmp_box + } +\cs_generate_variant:Nn \ctex_heading_hang:Nnn { c } +\cs_new_protected:Npn \ctex_heading_glue:n #1 + { + \group_begin: + \skip_set:Nn \l__ctex_heading_skip {#1} + \dim_compare:nNnF \l__ctex_heading_skip = \c_zero_dim + { \skip_horizontal:N \l__ctex_heading_skip } + \group_end: } -\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 +\cs_new_eq:NN \CTEX@heading@glue \ctex_heading_glue:n +\cs_new_protected:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } @@ -1034,7 +1053,7 @@ { } #2 } -\cs_new_nopar:Npn \CTEXnumberline #1 +\cs_new:Npn \CTEXnumberline #1 { \CTEXifname { \protect \numberline { \use:c { CTEXthe #1 } } } @@ -1044,7 +1063,7 @@ \seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int - \cs_gset_protected_nopar:cpx {#1} + \cs_gset_protected:cpx {#1} { \exp_not:N \@startsection {#1} { \int_use:N \l__ctex_tmp_int } @@ -1056,7 +1075,7 @@ \cs_new:cpn { CTEX@#1@tocline } ##1##2 { \CTEXnumberline { ##1 } ##2 } } -\keys_define:nn { ctex } +\ctex_define:n { appendix .meta:nn = { ctex / appendix } {#1} , appendix / name .code:n = @@ -1068,7 +1087,7 @@ \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix \cs_new_eq:NN \CTEX@save@appendix \appendix -\cs_gset_protected_nopar:Npn \appendix +\cs_gset_protected:Npn \appendix { \CTEX@save@appendix \gdef \CTEX@prechapter { \CTEX@preappendix } @@ -1076,7 +1095,7 @@ \gdef \CTEX@postchapter { \CTEX@postappendix } \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } } -\cs_new_protected_nopar:Npn \CTEX@makeanchor #1 +\cs_new_protected:Npn \CTEX@makeanchor #1 { } \seq_const_from_clist:Nn \c__ctex_headings_cs_seq { part , spart , chapter , schapter , sect , ssect } @@ -1085,7 +1104,7 @@ \cs_new_eq:cc { CTEX@ #1 } { @ #1 } \cs_new_eq:cN { CTEX@makeanchor@ #1 } \CTEX@makeanchor } -\cs_new_protected_nopar:Npn \CTEX@hyperheadinghook +\cs_new_protected:Npn \CTEX@hyperheadinghook { \group_begin: \ifHy@implicit @@ -1106,7 +1125,7 @@ } \ctex_at_end_package:nn { hyperref } { - \cs_gset_protected_nopar:Npn \CTEX@makeanchor #1 + \cs_gset_protected:Npn \CTEX@makeanchor #1 { \Hy@MakeCurrentHrefAuto {#1} \Hy@raisedlink @@ -1121,14 +1140,14 @@ { } \ctex_at_end_package:nn { nameref } { - \cs_gset_protected_nopar:Npn \CTEX@gettitle { \NR@gettitle } + \cs_gset_protected:Npn \CTEX@gettitle { \NR@gettitle } \seq_map_inline:Nn \c__ctex_headings_cs_seq { \cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 } { \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } } } } -\cs_new_protected_nopar:Npn \ctex_titlesec_hook: +\cs_new_protected:Npn \ctex_titlesec_hook: { \@ifpackagewith { titlesec } { explicit } { @@ -1148,17 +1167,17 @@ } \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n } -\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 +\cs_new_protected:Npn \__ctex_titlesec_hook:n #1 { \__ctex_titlesec_format:n {#1} \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 +\cs_new_protected:Npn \__ctex_titlesec_format:n #1 { \cs_if_free:cF { ttlf@#1 } { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format:Nn #1#2 { \tl_set:Nx #1 { @@ -1168,7 +1187,7 @@ \tl_tail:N #1 } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format_explicit:Nn #1#2 { \cs_set_nopar:Npx #1 ##1 { @@ -1178,7 +1197,7 @@ \exp_args:No \tl_tail:n { #1 { } } } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_spacing:Nn #1#2 { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } \cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 { @@ -1200,14 +1219,14 @@ \tl_set:Nn \ttl@chapterout { \typeout { \CTEXthechapter } } \cs_if_free:NF \ttl@tocpart { - \cs_set_protected_nopar:Npn \ttl@tocpart + \cs_set_protected:Npn \ttl@tocpart { \tl_set:Nn \ttl@a { \CTEXthepart \hspace { 1em } } } } \seq_map_inline:Nn \c__ctex_headings_seq { \cs_if_exist:cF { ttl@toc #1 } { - \cs_new_protected_nopar:cpx { ttl@toc #1 } + \cs_new_protected:cpx { ttl@toc #1 } { \tl_set:Nn \exp_not:N \ttl@a { @@ -1220,7 +1239,7 @@ } \group_begin: \char_set_catcode_other:N \# -\cs_new_protected_nopar:Npn \ctex_titleps_hook: +\cs_new_protected:Npn \ctex_titleps_hook: { \ctex_patch_cmd:Nnn \ttl@settopmark { \protect \@namedef { the#1 } { \@nameuse { the#1 } } } @@ -1242,12 +1261,12 @@ } } \group_end: -\cs_new_nopar:Npn \CTEX@titlepslabel@set #1 +\cs_new:Npn \CTEX@titlepslabel@set #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { \@nameuse { CTEXthe#1 } } } } -\cs_new_nopar:Npn \CTEX@titlepslabel@clear #1 +\cs_new:Npn \CTEX@titlepslabel@clear #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { } } @@ -1257,9 +1276,9 @@ \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: } \ctex_at_end_package:nn { titleps } { - \cs_set_protected_nopar:Npn \ttl@setifthe #1 + \cs_set_protected:Npn \ttl@setifthe #1 { - \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 } + \exp_args:Nco \cs_set:Npn { ifthe #1 } { \CTEXifname { \protect \@firstoftwo } @@ -1286,19 +1305,24 @@ { \CTEX@toc@width@n {#1} } { } { \ctex_patch_failure:N \numberline } - \@ifpackageloaded { tocloft } - { } + \cs_new_protected:Npn \__ctex_patch_toc_width:n \c_parameter_token 1 { - \ctex_at_end_package:nn { tocloft } + \@ifpackageloaded { \c_parameter_token 1 } + { } { - \ctex_preto_cmd:NnnTF \numberline - { \char_set_catcode_letter:n { 64 } } - { \CTEX@toc@width@n {#1} } - { } - { \ctex_patch_failure:N \numberline } + \ctex_at_end_package:nn { \c_parameter_token 1 } + { + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } + { \ctex_patch_failure:N \numberline } + } } } } +\__ctex_patch_toc_width:n { tocloft } +\__ctex_patch_toc_width:n { titletoc } \ctex_patch_cmd:Nnn \ps@headings { \ifnum \c@secnumdepth > \m@ne \if@mainmatter @@ -1320,7 +1344,7 @@ { \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } { \CTEXifname { \CTEXthesection \quad } { } } } -\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 +\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 { \protected@edef \@currentlabel { @@ -1329,17 +1353,17 @@ { \exp_not:o { \@currentlabel } } } } -\cs_new_protected_nopar:Npn \ctex_varioref_hook: +\cs_new_protected:Npn \ctex_varioref_hook: { \seq_map_inline:Nn \c__ctex_headings_seq { \ctex_fix_varioref_label:n { ##1 } } } -\cs_new_protected_nopar:Npn \ctex_fix_varioref_label:n #1 +\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 { \tl_if_empty:cT { p@#1 } - { \exp_args:Nno \labelformat {#1} { \cs:w CTEX@the#1 \cs_end: } } + { \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } } -\@ifpackageloaded { varioref } +\cs_if_exist:NTF \labelformat { \ctex_varioref_hook: } { \cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter @@ -1353,7 +1377,7 @@ \ctex_scheme_input:o { \l__ctex_scheme_tl } \NewDocumentCommand \zihao { m } { \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_zihao:n #1 +\cs_new_protected:Npn \ctex_zihao:n #1 { \prop_get:NnNTF \c__ctex_font_size_prop {#1} \l__ctex_font_size_tl { \exp_after:wN \fontsize \l__ctex_font_size_tl \selectfont } @@ -1368,7 +1392,7 @@ } \prop_new:N \c__ctex_font_size_prop \seq_new:N \c__ctex_font_size_seq -\cs_new_protected_nopar:Npn \__ctex_save_font_size:nn #1#2 +\cs_new_protected:Npn \__ctex_save_font_size:nn #1#2 { \use:x { @@ -1400,12 +1424,12 @@ { 0 } { 42 bp } } { \__ctex_save_font_size:nn #1 } -\cs_new_protected_nopar:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 +\cs_new_protected:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 { \__ctex_get_font_sizes:Nn \l__ctex_font_size_tl { {#1} {#2} {#3} {#4} } \exp_after:wN \DeclareMathSizes \l__ctex_font_size_tl } -\cs_new_protected_nopar:Npn \__ctex_get_font_sizes:Nn #1#2 +\cs_new_protected:Npn \__ctex_get_font_sizes:Nn #1#2 { \tl_clear:N #1 \tl_map_inline:nn {#2} @@ -1442,13 +1466,13 @@ { \msg_error:nnn { ctex } { fontsize } {#2} } } \cs_new_protected:Npn \__ctex_set_font_size:nnNn #1#2#3#4 - { \cs_set_protected_nopar:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } -\if_case:w \g__ctex_font_size_int - \ctex_file_input:n { ctex-c5size.clo } -\or: - \ctex_file_input:n { ctex-cs4size.clo } -\fi: -\fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } + { \cs_set_protected:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } +\int_case:nn { \g__ctex_font_size_int } + { + { 0 } { \ctex_file_input:n { ctex-c5size.clo } } + { 1 } { \ctex_file_input:n { ctex-cs4size.clo } } + } +\fp_if_nan:nF { \l__ctex_line_spread_fp } { \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: @@ -1459,47 +1483,76 @@ { C \TeX } \ctex_at_end_package:nn { hyperref } { \pdfstringdefDisableCommands { \tl_set:Nn \CTeX { CTeX } } } -\keys_define:nn { ctex } +\ctex_define:n { captiondelimiter .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 +\cs_new_protected:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } { CTeX~fontset~`#1'~is~unavailable~in~current~mode. } -\cs_new_protected_nopar:Npn \ctex_load_fontset: +\cs_new:Npx \ctex_fontset_case:nnn #1#2#3 { - \tl_if_empty:NTF \g__ctex_fontset_tl + \sys_if_engine_pdftex:TF + {#1} + { \sys_if_engine_uptex:TF {#2} {#3} } + } +\cs_new:Npx \ctex_fontset_case:nnnn #1#2#3#4 + { + \sys_if_engine_pdftex:TF + { \sys_if_output_pdf:TF {#1} {#2} } + { \sys_if_engine_uptex:TF {#3} {#4} } + } +\cs_new_protected:Npn \ctex_detect_platform: + { + \sys_if_platform_windows:TF + { \tl_gset:Nn \g__ctex_fontset_tl { windows } } { - \ctex_detected_platform: - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } + \ctex_if_platform_macos:TF + { \tl_gset:Nn \g__ctex_fontset_tl { mac } } + { \tl_gset:Nn \g__ctex_fontset_tl { fandol } } } + } +\cs_new_protected:Npn \ctex_if_platform_macos:TF + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } } +\cs_new_protected:Npn \ctex_load_fontset: + { + \tl_if_empty:NTF \g__ctex_fontset_tl + { \ctex_detect_platform: } { - \file_if_exist:nTF { ctex-fontset- \g__ctex_fontset_tl .def } - { \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } + \bool_lazy_or:nnTF + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsnew } } + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsold } } + { + \msg_warning:nnxx { ctex } { deprecated-fontset } + { \g__ctex_fontset_tl } { windows } + \tl_gset:Nn \g__ctex_fontset_tl { windows } + } { - \use:x + \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def } { - \ctex_detected_platform: - \msg_error:nnxx { ctex } { fontset-not-found } - { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + \use:x + { + \ctex_detect_platform: + \msg_error:nnxx { ctex } { fontset-not-found } + { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + } } - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } } + \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } -\@onlypreamble \ctex_load_fontset: +\msg_new:nnn { ctex } { deprecated-fontset } + { CTeX~fontset~`#1'~is~deprecated.\\ Fontset~`#2'~will~be~used~instead. } \msg_new:nnnn { ctex } { fontset-not-found } - { - CTeX~fontset~`#1'~could~not~be~found.\\ - Fontset~`#2'~will~be~used~instead. - } + { CTeX~fontset~`#1'~could~not~be~found.\\ Fontset~`#2'~will~be~used~instead. } { You~may~run~`mktexlsr'~firstly. } -\keys_define:nn { ctex } +\@onlypreamble \ctex_load_fontset: +\ctex_define:n { fontset .code:n = { @@ -1529,14 +1582,16 @@ } { Only~one~fontset~can~be~loaded~in~the~preamble. } \msg_new:nnn { ctex } { fontset-only-preamble } - { - The~ `fontset'~ option~ can~ be~ used~ only~ in~ preamble. - } + { The~`fontset'~option~can~be~used~only~in~preamble. } \str_if_eq:onF { \g__ctex_fontset_tl } { none } { \ctex_load_fontset: } \ctex_at_end:n { \ctex_file_input:n { ctex.cfg } } %% -%% This package consists of the file ctex.dtx, +%% This package consists of the files ctex.dtx, +%% ctxdoc.cls, +%% ctxdocstrip.tex, +%% ctex-zhconv.lua, +%% ctex-zhconv-make.lua, %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, @@ -1546,16 +1601,15 @@ %% ctexbook.cls, %% ctexrep.cls, %% ctexbeamer.cls, -%% ctxdoc.cls, %% ctexcap.sty, %% ctexhook.sty, %% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, -%% ctex-article.def, -%% ctex-book.def, -%% ctex-report.def, -%% ctex-beamer.def, +%% ctex-heading-article.def, +%% ctex-heading-book.def, +%% ctex-heading-report.def, +%% ctex-heading-beamer.def, %% ctex-scheme-plain.def, %% ctex-scheme-plain-article.def, %% ctex-scheme-plain-book.def, @@ -1570,6 +1624,7 @@ %% ctex-name-utf8.cfg, %% ctex.cfg, %% ctexopts.cfg, +%% ctexbackend.cfg, %% ctex-engine-pdftex.def, %% ctex-engine-xetex.def, %% ctex-engine-luatex.def, @@ -1587,26 +1642,25 @@ %% jt2zhrm.fd, %% jt2zhsf.fd, %% jt2zhtt.fd, -%% ctex-fontset-windows.def, -%% ctex-fontset-windowsnew.def, -%% ctex-fontset-windowsold.def, %% ctex-fontset-adobe.def, %% ctex-fontset-fandol.def, +%% ctex-fontset-founder.def, %% ctex-fontset-mac.def, %% ctex-fontset-macnew.def, %% ctex-fontset-macold.def, -%% ctex-fontset-founder.def, %% ctex-fontset-ubuntu.def, +%% ctex-fontset-windows.def, %% ctexspa.def, %% ctexpunct.spa, %% ctexmakespa.tex, %% ctexspamacro.tex, -%% ctxdocstrip.tex, %% zhadobefonts.tex, %% zhfandolfonts.tex, %% zhfounderfonts.tex, +%% zhmacfonts.tex, %% zhubuntufonts.tex, %% zhwindowsfonts.tex, +%% ctex-zhconv-index.lua, %% translator-theorem-dictionary-ChineseGBK.dict, %% translator-theorem-dictionary-ChineseUTF8.dict, and %% README.md. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexcap.sty b/Master/texmf-dist/tex/latex/ctex/ctexcap.sty index 8500f1a47e0..08ca51d5c20 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexcap.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctexcap.sty @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `ctexcap') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,18 +20,16 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter in LaTeX (CTEX)} \ProvidesExplPackage{ctexcap} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \clist_new:N \l__ctex_ctexcap_options_clist \clist_set:Nx \l__ctex_ctexcap_options_clist { \exp_not:v { opt@ \@currname . \@currext } , heading } diff --git a/Master/texmf-dist/tex/latex/ctex/ctexheading.sty b/Master/texmf-dist/tex/latex/ctex/ctexheading.sty index 09798c222a5..55ab37997d0 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexheading.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctexheading.sty @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `style,ctexheading') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,23 +20,29 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading style modification (CTEX)} \ProvidesExplPackage{ctexheading} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \RequirePackage { xparse , l3keys2e } \RequirePackage { ctexhook , ctexpatch } \tl_clear_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \box_new:N \l__ctex_tmp_box +\cs_new_protected:Npn \ctex_define_option:n + { \keys_define:nn { ctex / option } } +\cs_new_protected:Npn \ctex_define:n + { \keys_define:nn { ctex } } +\cs_new_protected:Npn \ctex_set:n + { \keys_set:nn { ctex } } +\cs_new_protected:Npn \ctex_set:nn #1 + { \keys_set:nn { ctex / #1 } } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -52,9 +58,9 @@ #3 } } -\cs_new_protected_nopar:Npn \ctex_file_input:n #1 +\cs_new_protected:Npn \ctex_file_input:n #1 { \ctex_file_wrapper:nnn { } { \file_input:n {#1} } { } } -\cs_new_protected_nopar:Npn \ctex_scheme_input:n #1 +\cs_new_protected:Npn \ctex_scheme_input:n #1 { \ctex_file_wrapper:nnn { } @@ -71,7 +77,7 @@ \cs_generate_variant:Nn \ctex_scheme_input:n { o } \int_new:N \g__ctex_section_depth_int \int_gset:Nn \g__ctex_section_depth_int { 2 } -\keys_define:nn { ctex / option } +\ctex_define_option:n { sub3section .code:n = { \int_gset:Nn \g__ctex_section_depth_int { 3 } } , @@ -84,7 +90,7 @@ scheme .initial:n = { plain } } \ProcessKeysOptions { ctex / option } -\NewDocumentCommand \ctexset { } { \keys_set:nn { ctex } } +\NewDocumentCommand \ctexset { } { \ctex_set:n } \clist_map_inline:nn { article , book , report , beamer } { \@ifclassloaded {#1} @@ -111,10 +117,14 @@ { \tl_const:Nn \c__ctex_class_tl { article } } \msg_warning:nnx { ctex } { not-standard-class } { \c__ctex_class_tl } } - \ctex_file_input:n { ctex- \c__ctex_class_tl .def } + \ctex_file_input:n { ctex-heading- \c__ctex_class_tl .def } } %% -%% This package consists of the file ctex.dtx, +%% This package consists of the files ctex.dtx, +%% ctxdoc.cls, +%% ctxdocstrip.tex, +%% ctex-zhconv.lua, +%% ctex-zhconv-make.lua, %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, @@ -124,16 +134,15 @@ %% ctexbook.cls, %% ctexrep.cls, %% ctexbeamer.cls, -%% ctxdoc.cls, %% ctexcap.sty, %% ctexhook.sty, %% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, -%% ctex-article.def, -%% ctex-book.def, -%% ctex-report.def, -%% ctex-beamer.def, +%% ctex-heading-article.def, +%% ctex-heading-book.def, +%% ctex-heading-report.def, +%% ctex-heading-beamer.def, %% ctex-scheme-plain.def, %% ctex-scheme-plain-article.def, %% ctex-scheme-plain-book.def, @@ -148,6 +157,7 @@ %% ctex-name-utf8.cfg, %% ctex.cfg, %% ctexopts.cfg, +%% ctexbackend.cfg, %% ctex-engine-pdftex.def, %% ctex-engine-xetex.def, %% ctex-engine-luatex.def, @@ -165,26 +175,25 @@ %% jt2zhrm.fd, %% jt2zhsf.fd, %% jt2zhtt.fd, -%% ctex-fontset-windows.def, -%% ctex-fontset-windowsnew.def, -%% ctex-fontset-windowsold.def, %% ctex-fontset-adobe.def, %% ctex-fontset-fandol.def, +%% ctex-fontset-founder.def, %% ctex-fontset-mac.def, %% ctex-fontset-macnew.def, %% ctex-fontset-macold.def, -%% ctex-fontset-founder.def, %% ctex-fontset-ubuntu.def, +%% ctex-fontset-windows.def, %% ctexspa.def, %% ctexpunct.spa, %% ctexmakespa.tex, %% ctexspamacro.tex, -%% ctxdocstrip.tex, %% zhadobefonts.tex, %% zhfandolfonts.tex, %% zhfounderfonts.tex, +%% zhmacfonts.tex, %% zhubuntufonts.tex, %% zhwindowsfonts.tex, +%% ctex-zhconv-index.lua, %% translator-theorem-dictionary-ChineseGBK.dict, %% translator-theorem-dictionary-ChineseUTF8.dict, and %% README.md. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexhook.sty b/Master/texmf-dist/tex/latex/ctex/ctexhook.sty index e6478dc9378..ee858d5c9de 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexhook.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctexhook.sty @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `ctexhook') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,25 +20,23 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Document and package hooks (CTEX)} \ProvidesExplPackage{ctexhook} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\cs_new_protected:Npn \ctex_at_end_preamble:n #1 - { \tl_gput_right:Nn \g__ctex_end_preamble_hook_tl {#1} } -\cs_new_protected:Npn \ctex_after_end_preamble:n #1 - { \tl_gput_right:Nn \g__ctex_after_end_preamble_hook_tl {#1} } -\cs_new_protected_nopar:Npn \CTEX@document@left@hook + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\cs_new_protected:Npn \ctex_at_end_preamble:n + { \tl_gput_right:Nn \g__ctex_end_preamble_hook_tl } +\cs_new_protected:Npn \ctex_after_end_preamble:n + { \tl_gput_right:Nn \g__ctex_after_end_preamble_hook_tl } +\cs_new_protected:Npn \CTEX@document@left@hook { \group_end: \g__ctex_end_preamble_hook_tl \group_begin: } -\cs_new_protected_nopar:Npn \CTEX@document@right@hook +\cs_new_protected:Npn \CTEX@document@right@hook { \scan_stop: \g__ctex_after_end_preamble_hook_tl \tex_ignorespaces:D } \cs_set_nopar:Npx \document { @@ -48,28 +46,51 @@ } \tl_new:N \g__ctex_end_preamble_hook_tl \tl_new:N \g__ctex_after_end_preamble_hook_tl -\cs_new_protected:Npn \ctex_at_end_package:nn #1#2 +\cs_new_protected:Npn \ctex_at_begin_package:nn #1 { \@ifpackageloaded {#1} - {#2} - { \ctex_gadd_hook:cn { g__ctex_at_end_ #1 _hook_tl } {#2} } + { \__ctex_package_loaded_warning:nn {#1} } + { \ctex_gadd_package_hook:nnn { begin } {#1} } + } +\cs_new_protected:Npn \__ctex_package_loaded_warning:nn #1#2 + { \msg_warning:nnx { ctex } { invalid-hook } {#1} } +\msg_new:nnn { ctex } { invalid-hook } + { + Package~`#1'~is~loaded. \\ + \token_to_str:N \ctex_at_begin_package:nn \{#1\}\{...\}~is~invalid. } -\cs_new_protected:Npn \ctex_gadd_hook:Nn #1#2 +\cs_new_protected:Npn \ctex_at_end_package:nn #1 + { + \@ifpackageloaded {#1} + { \use:n } + { \ctex_gadd_package_hook:nnn { end } {#1} } + } +\cs_new_protected:Npn \ctex_gadd_package_hook:nnn #1#2 + { \ctex_gadd_hook:cn { g__ctex_at_ #1 _ #2 _hook_tl } } +\cs_new_protected:Npn \ctex_gadd_hook:Nn #1 { \tl_if_exist:NF #1 { \tl_new:N #1 } - \tl_gput_right:Nn #1 {#2} + \tl_gput_right:Nn #1 } \cs_generate_variant:Nn \ctex_gadd_hook:Nn { c } -\cs_new_protected_nopar:Npn \ctex_package_end_hook:n #1 +\cs_new_protected:Npn \ctex_use_package_hook:nn #1#2 + { + \group_begin: \exp_args:NNc \group_end: + \__ctex_use_package_hook_aux:N { g__ctex_at_ #1 _ #2 _hook_tl } + } +\cs_new_protected:Npn \__ctex_use_package_hook_aux:N #1 + { \cs_if_exist_use:NT #1 { \cs_undefine:N #1 } } +\tl_put_right:Nn \@reset@ptions { \CTEX@reset@ptions@hook } +\cs_new_protected:Npn \CTEX@reset@ptions@hook { - \cs_if_exist_use:cT { g__ctex_at_end_ #1 _hook_tl } - { \cs_undefine:c { g__ctex_at_end_ #1 _hook_tl } } + \cs_if_eq:NNT \@currext \@pkgextension + { \ctex_use_package_hook:nn { begin } { \@currname } } } -\cs_generate_variant:Nn \ctex_package_end_hook:n { o } -\tl_put_left:Nn \@popfilename +\tl_put_left:Nn \@popfilename { \CTEX@popfilename@hook } +\cs_new_protected:Npn \CTEX@popfilename@hook { \cs_if_eq:NNT \@currext \@pkgextension - { \ctex_package_end_hook:o { \@currname } } + { \ctex_use_package_hook:nn { end } { \@currname } } } %% %% diff --git a/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty b/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty index 1773117c7bf..4ea589e0261 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctexpatch.sty @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `ctexpatch') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,19 +20,16 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Patching commands (CTEX)} \ProvidesExplPackage{ctexpatch} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\cs_if_exist:NF \str_new:N { \RequirePackage { l3str } } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \cs_new_protected:Npn \ctex_patch_cmd_once:NnnnTF #1#2 { \ctex_patch_boot:NNnnTF \__ctex_patch_cmd:Nnnnnw #1 @@ -70,14 +67,14 @@ } \cs_new_protected:Npn \ctex_patch_boot:NNnnTF #1#2#3#4#5#6 { - \tl_set:Nn \__ctex_patch_true:w {#5} - \tl_set:Nn \__ctex_patch_false:w {#6} + \cs_set_protected:Npx \__ctex_patch_true:w { \exp_not:n {#5} } + \cs_set_protected:Npx \__ctex_patch_false:w { \exp_not:n {#6} } \group_begin: \char_set_catcode_other:n { 35 } \ctex_parse_name:NN #1 #2 {#3} {#4} } -\tl_new:N \__ctex_patch_true:w -\tl_new:N \__ctex_patch_false:w +\cs_new_eq:NN \__ctex_patch_true:w \use_i:nn +\cs_new_eq:NN \__ctex_patch_false:w \use_ii:nn \cs_new_protected:Npn \ctex_parse_name:NN #1#2 { \ctex_parse_name:NNx #1#2 { \cs_to_str:N #2 } } \group_begin: @@ -98,7 +95,7 @@ \exp_not:N ##2 \exp_not:c { ##3 ~ } \exp_not:c { #1##3 } - } {##3} ##1 + } { ##3 } ##1 } { ##1##2 } } @@ -115,8 +112,8 @@ \str_if_eq:eeTF { \exp_not:n { #1@protected@ ##3 #1##3 } } { - \exp_last_unbraced:Nf \__ctex_parse_name:w - \cs_replacement_spec:N ##3 #3 ~ #2 \q_stop + \exp_last_unbraced:Ne \__ctex_parse_name:w + { \cs_replacement_spec:N ##3 } #3 ~ #2 \q_stop } { #1##5 ~ } { ##5 ~ } } diff --git a/Master/texmf-dist/tex/latex/ctex/ctexrep.cls b/Master/texmf-dist/tex/latex/ctex/ctexrep.cls index 76ca2e0dbeb..da8136b4f06 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexrep.cls +++ b/Master/texmf-dist/tex/latex/ctex/ctexrep.cls @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `class,report') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,18 +20,17 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} +\input{ctexbackend.cfg} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese adapter for class report (CTEX)} \ProvidesExplClass{ctexrep} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \tl_const:Nx \c__ctex_version_tl { \cs_if_exist_use:cF { ver@ \@currname . \@currext } { 9999/99/99 } } \cs_new_eq:cN { ver@ctex. \@pkgextension } \c__ctex_version_tl @@ -42,11 +41,11 @@ \msg_new:nnnn { ctex } { l3-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~bundles\\\\ + Please~update~an~up-to-date~version~of~the~bundles\\\\ `l3kernel'~and~`l3packages'\\\\ using~your~TeX~package~manager~or~from~CTAN. } -\@ifpackagelater { expl3 } { 2019/03/05 } { } +\@ifpackagelater { expl3 } { 2020/04/06 } { } { \msg_error:nnn { ctex } { l3-too-old } { expl3 } } \@ifpackagelater { l3keys2e } { 2015/12/20 } { } { \msg_error:nnn { ctex } { l3-too-old } { l3keys2e } } @@ -62,11 +61,20 @@ } { \msg_critical:nnx { ctex } { engine-not-supported } { \c__ctex_engine_str } } \RequirePackage { ctexhook , ctexpatch } -\RequirePackage { fix-cm , everysel } +\RequirePackage { fix-cm } +\RequirePackage { everysel } \tl_clear_new:N \l__ctex_tmp_tl \int_new:N \l__ctex_tmp_int \box_new:N \l__ctex_tmp_box \dim_new:N \l__ctex_tmp_dim +\cs_new_protected:Npn \ctex_define_option:n + { \keys_define:nn { ctex / option } } +\cs_new_protected:Npn \ctex_define:n + { \keys_define:nn { ctex } } +\cs_new_protected:Npn \ctex_set:n + { \keys_set:nn { ctex } } +\cs_new_protected:Npn \ctex_set:nn #1 + { \keys_set:nn { ctex / #1 } } \cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 { \use:x @@ -82,9 +90,9 @@ #3 } } -\cs_new_protected_nopar:Npn \ctex_file_input:n #1 +\cs_new_protected:Npn \ctex_file_input:n #1 { \ctex_file_wrapper:nnn { } { \file_input:n {#1} } { } } -\cs_new_protected_nopar:Npn \ctex_scheme_input:n #1 +\cs_new_protected:Npn \ctex_scheme_input:n #1 { \ctex_file_wrapper:nnn { } @@ -104,7 +112,7 @@ \msg_new:nnnn { ctex } { package-too-old } { Support~package~`#1'~too~old. } { - Please~update~an~up~to~date~version~of~the~package~`#1'\\ + Please~update~an~up-to-date~version~of~the~package~`#1'\\ using~your~TeX~package~manager~or~from~CTAN. } \sys_if_output_pdf:TF @@ -123,46 +131,44 @@ \exp_last_unbraced:NNNNo \cs_new:Npn \__ctex_default_ccwd_aux:w #1 { \tl_to_str:n { pt } } #2 \q_stop { \tl_if_empty:nT {#2} { \ccwd } } -\tl_new:N \l__ctex_encoding_tl -\tl_set:Nx \l__ctex_encoding_tl - { \sys_if_engine_pdftex:TF { GBK } { UTF8 } } +\tl_new:N \g__ctex_encoding_tl \bool_new:N \g__ctex_zhmCJK_bool \tl_new:N \l__ctex_autoindent_tl \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_nopar:Npn \ctex_at_end:n { \AtEndOfClass } +\cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass } \clist_new:N \g__ctex_std_options_clist \msg_new:nnn { ctex } { invalid-option } { Option~`\l_keys_key_tl'~is~invalid~in~current~mode. } \msg_new:nnn { ctex } { invalid-value } { Value~`#1'~is~invalid~for~the~key~`\l_keys_key_tl'. } +\cs_new_protected:Npn \ctex_deprecated_option:n + { \msg_warning:nnn { ctex } { deprecated-option } } +\cs_new_protected:Npn \ctex_set_deprecated_option:n #1 + { + \ctex_deprecated_option:n { Option~`#1'~is~set. } + \ctex_set:nn { option } {#1} + } +\cs_new_protected:Npn \ctex_deprecated_command:Nn #1#2 + { + \msg_warning:nnxx { ctex } { deprecated-command } + { \token_to_str:N #1 } { \exp_not:n {#2} } + } \msg_new:nnn { ctex } { deprecated-option } - { Option~ `\l_keys_key_tl'~ is~ deprecated.\\ #1 } + { Option~`\l_keys_key_tl'~is~deprecated.\\ #1 } \msg_new:nnn { ctex } { deprecated-command } - { Command~ #1 is~ deprecated.\\ #2 } -\msg_new:nnn { ctex } { deprecated-environment } - { Environment~ `#1'~ is~ deprecated.\\ #2 } + { Command~`#1'~is~deprecated.\\ #2 } \int_new:N \g__ctex_font_size_int -\int_set:Nn \g__ctex_font_size_int { -1 } -\keys_define:nn { ctex / option } +\int_gset:Nn \g__ctex_font_size_int { -1 } +\ctex_define_option:n { zihao .choice: , zihao .value_required:n = true , zihao / 5 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 0 } } , zihao / -4 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 1 } } , zihao / false .code:n = { \int_gset:Nn \g__ctex_font_size_int { 2 } } , - c5size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=5'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = 5 } - } , - cs4size .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zihao=-4'~ is~ set. } - \keys_set:nn { ctex / option } { zihao = -4 } - } , + c5size .code:n = { \ctex_set_deprecated_option:n { zihao = 5 } } , + cs4size .code:n = { \ctex_set_deprecated_option:n { zihao = -4 } } , c5size .value_forbidden:n = true , cs4size .value_forbidden:n = true , linespread .fp_set:N = \l__ctex_line_spread_fp , @@ -187,56 +193,38 @@ } , indent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options.~ + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , indent .value_forbidden:n = true , noindent .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { - The~ functionality~ has~ been~ removed.\\ - It's~ better~ to~ set~ the~ heading~ styles~ via~ `afterindent'~ - options. + The~functionality~has~been~removed.\\ + It's~better~to~set~the~heading~styles~via~`afterindent'~option. } } , noindent .value_forbidden:n = true , - GBK .code:n = { \tl_set:Nn \l__ctex_encoding_tl { GBK } } , - UTF8 .code:n = { \tl_set:Nn \l__ctex_encoding_tl { UTF8 } } , - GBK .value_forbidden:n = true , - UTF8 .value_forbidden:n = true , - fontset .tl_gset:N = \g__ctex_fontset_tl , - nofonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=none'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = none } - } , - adobefonts .code:n = + GBK .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \sys_if_engine_pdftex:TF + { \tl_gset:Nn \g__ctex_encoding_tl { GBK } } { - Option~ `fontset=adobe'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. + \msg_warning:nn { ctex } { invalid-option } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } - \keys_set:nn { ctex / option } { fontset = adobe } - } , - winfonts .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { - Option~ `fontset=windows'~ is~ set.~ It~ is~ better~ to~ use~ - fontset~ option. - } - \keys_set:nn { ctex / option } { fontset = windows } } , + UTF8 .code:n = { \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } , + GBK .value_forbidden:n = true , + UTF8 .value_forbidden:n = true , + fontset .tl_gset:N = \g__ctex_fontset_tl , + nofonts .code:n = { \ctex_set_deprecated_option:n { fontset = none } } , + adobefonts .code:n = { \ctex_set_deprecated_option:n { fontset = adobe } } , + winfonts .code:n = { \ctex_set_deprecated_option:n { fontset = windows } } , nofonts .value_forbidden:n = true , winfonts .value_forbidden:n = true , adobefonts .value_forbidden:n = true , @@ -258,35 +246,21 @@ \cs_gset_eq:NN \ctex_zhmap_case:nnn \use_iii:nnn } , nozhmap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `zhmap=false'~ is~ set. } - \keys_set:nn { ctex / option } { zhmap = false } - } , + { \ctex_set_deprecated_option:n { zhmap = false } } , nozhmap .value_forbidden:n = true , punct .tl_set:N = \l__ctex_punct_tl , punct .default:n = { quanjiao } , punct .initial:n = { quanjiao } , - nopunct .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `punct=plain'~ is~ set. } - \keys_set:nn { ctex / option } { punct = plain } - } , + nopunct .code:n = \ctex_set_deprecated_option:n { punct = plain } , nopunct .value_forbidden:n = true , space .choices:nn = { true , auto , false } { \exp_args:Nx \ctex_at_end:n - { \keys_set:nn { ctex } { space = \l_keys_choice_tl } } + { \ctex_set:n { space = \l_keys_choice_tl } } } , space .default:n = { true } , - nospace .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `space=false'~ is~ set. } - \keys_set:nn { ctex / option } { space = false } - } , + nospace .code:n = { \ctex_deprecated_option:nn { space = false } } , nospace .value_forbidden:n = true , heading .bool_set:N = \l__ctex_heading_bool , sub3section .code:n = @@ -298,35 +272,37 @@ scheme .tl_set:N = \l__ctex_scheme_tl , scheme .default:n = { chinese } , scheme .initial:n = { chinese } , - cap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = chinese' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = chinese } - } , - nocap .code:n = - { - \msg_warning:nnn { ctex } { deprecated-option } - { Option~ `scheme = plain' ~ is~ set. } - \keys_set:nn { ctex / option } { scheme = plain } - } , + cap .code:n = { \ctex_set_deprecated_option:n { scheme = chinese } } , + nocap .code:n = { \ctex_set_deprecated_option:n { scheme = plain } } , cap .value_forbidden:n = true , nocap .value_forbidden:n = true , - fntef .code:n = + fntef .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `(xe)CJKfntef'~ package~ is~ always~ loaded. } + \sys_if_engine_xetex:TF + { + \ctex_deprecated_option:n { `xeCJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { xeCJKfntef } } + } + { + \sys_if_engine_pdftex:TF + { + \ctex_deprecated_option:n { `CJKfntef'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { CJKfntef } } + } + { + \ctex_deprecated_option:n + { Furthermore,~option~`fntef'~is~invalid~in~current~mode. } + } + } } , fancyhdr .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `fancyhdr'~ package~ is~ loaded. } - \RequirePackage { fancyhdr } + \ctex_deprecated_option:n { `fancyhdr'~package~is~loaded. } + \ctex_at_end:n { \RequirePackage { fancyhdr } } } , hyperref .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } - { `hyperref'~ package~ will~ be~ loaded. } + \ctex_deprecated_option:n { `hyperref'~package~will~be~loaded. } \ctex_at_end:n { \cs_if_exist:NF \hypersetup @@ -352,47 +328,63 @@ #1 .value_forbidden:n = true , } } -\use:x { \keys_define:nn { ctex / option } { \exp_not:o { \l__ctex_tmp_tl } } } +\exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl } \tl_clear:N \l__ctex_tmp_tl -\keys_define:nn { ctex / option } +\ctex_define_option:n { unknown .code:n = { \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } } } \ctex_file_input:n { ctexopts.cfg } \ProcessKeysOptions { ctex / option } -\if_case:w \g__ctex_font_size_int - \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } -\or: - \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } -\fi: +\msg_new:nnn { ctex } { pdftex-utf8 } + { UTF8~will~be~used~as~the~default~encoding. } +\tl_if_empty:NT \g__ctex_encoding_tl + { + \sys_if_engine_pdftex:T + { \msg_warning:nn { ctex } { pdftex-utf8 } } + \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } + } +\int_case:nn { \g__ctex_font_size_int } + { + { 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 } \@ifpackageloaded { hyperref } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \hypersetup {#1} } } { - \cs_new_protected_nopar:Npn \ctex_hypersetup:n #1 + \cs_new_protected:Npn \ctex_hypersetup:n #1 { \PassOptionsToPackage {#1} { hyperref } } } \ctex_file_input:n { \c__ctex_engine_file_str } -\NewDocumentCommand \ctexset { } { \keys_set:nn { ctex } } -\NewDocumentCommand \CTEXsetup { +o > { \TrimSpaces } m } +\NewDocumentCommand \ctexset { } { \ctex_set:n } +\NewDocumentCommand \CTEXsetup { +O { } > { \TrimSpaces } m } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXsetup } - { \ctexset~ {~ #2~ =~ {~ #1~ }~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex / #2 } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXsetup { } } + { + \ctex_deprecated_command:Nn \CTEXsetup + { \ctexset {~#2~=~{~#1~}~}~is~set. } + \ctex_set:nn {#2} {#1} + } } -\NewDocumentCommand \CTEXoptions { +o } +\NewDocumentCommand \CTEXoptions { +O { } } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXoptions } - { \ctexset~ {~ #1~ }~ is~ set. } - \IfNoValueF {#1} { \keys_set:nn { ctex } {#1} } + \tl_if_blank:nTF {#1} + { \ctex_deprecated_command:Nn \CTEXoptions { } } + { + \ctex_deprecated_command:Nn \CTEXoptions + { \ctexset {~#1~}~is~set. } + \ctex_set:n {#1} + } } -\keys_define:nn { ctex } +\ctex_define:n { autoindent .choice: , autoindent .default:n = { true } , @@ -410,9 +402,9 @@ } } \NewDocumentCommand \CTEXsetfont { } { \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_select_size: +\cs_new_protected:Npn \ctex_select_size: { \cs_if_free:NTF \size@update { \ctex_update_size: } { \selectfont } } -\cs_new_protected_nopar:Npn \ctex_update_size: +\cs_new_protected:Npn \ctex_update_size: { \tl_if_eq:NNTF \l__ctex_ziju_tl \c__ctex_zero_tl { @@ -426,7 +418,7 @@ \tl_set_eq:NN \l__ctex_ziju_tl \c__ctex_zero_tl \ctex_add_to_selectfont:n { \cs_if_free:NF \size@update { \ctex_update_size: } } -\keys_define:nn { ctex } +\ctex_define:n { linestretch .code:n = { @@ -437,7 +429,7 @@ } \tl_new:N \l__ctex_line_stretch_tl \tl_set:Nn \l__ctex_line_stretch_tl { \ccwd } -\cs_new_protected_nopar:Npn \ctex_update_stretch: +\cs_new_protected:Npn \ctex_update_stretch: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_tmp_dim { \l__ctex_line_stretch_tl } @@ -472,7 +464,7 @@ \ctex_update_ccglue: } } -\cs_new_protected_nopar:Npn \ctex_update_parindent: +\cs_new_protected:Npn \ctex_update_parindent: { \tl_if_empty:NF \l__ctex_autoindent_tl { @@ -482,12 +474,12 @@ } \NewDocumentCommand \ziju { m } { \exp_args:Nx \ctex_ziju:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_ziju:n #1 +\cs_new_protected:Npn \ctex_ziju:n #1 { \tl_set:Nx \l__ctex_ziju_tl { \fp_eval:n {#1} } \ctex_select_size: } -\cs_new_protected_nopar:Npn \ctex_update_ziju: +\cs_new_protected:Npn \ctex_update_ziju: { \ctex_update_em_unit: \dim_set:Nn \l__ctex_ziju_dim { \l__ctex_ziju_tl \ccwd } @@ -519,19 +511,20 @@ \dim_new:N \l__ctex_ziju_dim \NewDocumentCommand \CTEXindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXindent } - { \parindent is~ set~ to~ 2\ccwd. } - \ctex_update_ccwd: \dim_set:Nn \parindent { 2 \ccwd } + \ctex_deprecated_command:Nn \CTEXindent + { \parindent is~set~to~2\ccwd. } + \ctex_update_ccwd: + \dim_set:Nn \parindent { 2 \ccwd } } \NewDocumentCommand \CTEXnoindent { } { - \msg_warning:nnnn { ctex } { deprecated-command } { \CTEXnoindent } - { \parindent is~ set~ to~ 0pt. } + \ctex_deprecated_command:Nn \CTEXnoindent + { \parindent is~set~to~0pt. } \dim_zero:N \parindent } -\PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhnumber } +\PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhnumber } \RequirePackage { zhnumber } -\cs_new_nopar:Npn \chinese { \zhnum_counter:n } +\cs_new:Npn \chinese { \zhnum_counter:n } \cs_new_eq:NN \@chinese \@zhnum \cs_new_eq:NN \Chinese \chinese \cs_new_eq:NN \CTEXcounter \use_none:n @@ -549,7 +542,7 @@ \NewDocumentCommand \CTEXdigits { m m } { \protected@edef #1 { \zhdigits {#2} } } \cs_set_eq:NN \CTEX@todayold \today -\keys_define:nn { ctex } +\ctex_define:n { today .choice: , today / old .code:n = @@ -575,7 +568,7 @@ \tl_new:N \proofname \tl_set:Nn \proofname { Proof } } -\keys_define:nn { ctex } +\ctex_define:n { contentsname .tl_set:N = \contentsname , listfigurename .tl_set:N = \listfigurename , @@ -594,7 +587,7 @@ \seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq \seq_gput_left:Nn \c__ctex_headings_seq { chapter } \seq_gput_left:Nn \c__ctex_headings_seq { part } -\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 +\cs_new_protected:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } \tl_new:c { CTEX@post#1 } @@ -624,7 +617,7 @@ \group_end: } } -\cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 +\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 { \tl_put_right:Nx \l__ctex_tmp_tl { @@ -648,11 +641,8 @@ #1 / hang .bool_set:N = \exp_not:c { CTEX@#1@hang } , #1 / hang .initial:n = true , #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , - #1 / tocline .code:n = - { - \cs_set:Npn \exp_not:c { CTEX@#1@tocline} - \exp_not:n { ####1####2 } { ####1 } - } , + #1 / tocline .cs_set:Np = \exp_not:c { CTEX@#1@tocline} + \exp_not:n { ##1##2 } , \__ctex_plus_key_aux:nn {#1} { break } , \__ctex_plus_key_aux:nn {#1} { format } , \__ctex_plus_key_aux:nn {#1} { nameformat } , @@ -662,7 +652,7 @@ \__ctex_plus_key_aux:nn {#1} { aftertitle } , } } -\cs_new_nopar:Npn \__ctex_plus_key_aux:nn #1#2 +\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 { #1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , #1 / #2 + .code:n = @@ -676,7 +666,7 @@ \cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 { \tl_set:cn { CTEX@pre#1 } {#2} - \IfNoValueTF {#3} + \tl_if_novalue:nTF {#3} { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } @@ -697,35 +687,49 @@ \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x +\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } +\cs_new_protected:Npn \CTEX@heading@format@initial { - \group_end: - \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } + \normalfont + \tl_clear:N \l__ctex_autoindent_tl + \int_set:Nn \tex_interlinepenalty:D { 10 000 } + \tex_noindent:D } -\cs_new_protected_nopar:Npn \CTEX@fixtopskip +\cs_new_protected:Npn \ctex_indent_box:n #1 + { + \dim_set:Nn \tex_parindent:D {#1} + \__ctex_insert_indent: + } +\cs_new_protected:Npn \__ctex_insert_indent: + { + \dim_compare:nNnF \tex_parindent:D = \c_zero_dim + { \tex_indent:D } + } +\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n +\cs_new_protected:Npn \CTEX@fixtopskip { \CTEX@fixheadingskip \dim_compare:nNnF \tex_pagegoal:D < \c_max_dim { \skip_sub:Nn \l__ctex_heading_skip { \tex_topskip:D } } } -\cs_new_protected_nopar:Npn \CTEX@fixheadingskip +\cs_new_protected:Npn \CTEX@fixheadingskip { \par \dim_set:Nn \tex_prevdepth:D { -1000pt } \skip_sub:Nn \l__ctex_heading_skip { \tex_parskip:D } } \skip_new:N \l__ctex_heading_skip -\cs_new_protected_nopar:Npn \CTEX@setheadingskip +\cs_new_protected:Npn \CTEX@setheadingskip { \skip_set:Nn \l__ctex_heading_skip } \cs_new_eq:NN \CTEX@headingskip \l__ctex_heading_skip \ProvideDocumentCommand \partmark { m } { \markboth { } { } } \cs_new_eq:NN \CTEXifname \use_ii:nn -\cs_new_protected_nopar:Npn \CTEX@ifnametrue +\cs_new_protected:Npn \CTEX@ifnametrue { \cs_set_eq:NN \CTEXifname \use_i:nn } -\cs_new_protected_nopar:Npn \CTEX@ifnamefalse +\cs_new_protected:Npn \CTEX@ifnamefalse { \cs_set_eq:NN \CTEXifname \use_ii:nn } -\cs_new_protected_nopar:Npn \CTEX@addloflotskip #1 +\cs_new_protected:Npn \CTEX@addloflotskip #1 { \skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@lofskip } } \skip_if_eq:nnF { \l__ctex_heading_skip } { \c_zero_skip } @@ -742,8 +746,6 @@ } \cs_new_protected:Npn \CTEX@addtocline #1#2 { \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } } -\cs_new_protected_nopar:Npn \CTEX@disableautoindent - { \tl_clear:N \l__ctex_autoindent_tl } \renewcommand\part{% \CTEX@part@break \thispagestyle{\CTEX@part@pagestyle}% @@ -772,51 +774,53 @@ \fi \CTEX@gettitle{#1}% \CTEX@addtocline{part}{#1}% - \partmark{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}% - {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% - \CTEX@part@titleformat{#2}% - \CTEX@part@aftertitle}% + \partmark{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}% + {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% + \CTEX@part@titleformat{#2}% + \CTEX@part@aftertitle}\par + \endgroup \@endpart} \def\@spart#1{% - \CTEX@ifnamefalse - \CTEX@makeanchor@spart{part*}% - \CTEX@gettitle{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}{}% - \CTEX@part@titleformat{#1}% - \CTEX@part@aftertitle}% - \@endpart} + \CTEX@ifnamefalse + \CTEX@makeanchor@spart{part*}% + \CTEX@gettitle{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}{}% + \CTEX@part@titleformat{#1}% + \CTEX@part@aftertitle}\par + \endgroup + \@endpart} \def\@endpart{% - \CTEX@setheadingskip \CTEX@part@afterskip - \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - \newpage - \if@twoside - \if@openright - \null - \thispagestyle{empty}% - \newpage - \fi - \fi - \if@tempswa - \twocolumn - \fi} + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip + \newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} \renewcommand\chapter{% - \CTEX@chapter@break - \thispagestyle{\CTEX@chapter@pagestyle}% - \global\@topnum\z@ - \ifodd \CTEX@chapter@afterindent - \@afterindenttrue - \else - \@afterindentfalse - \fi - \secdef\@chapter\@schapter} + \CTEX@chapter@break + \thispagestyle{\CTEX@chapter@pagestyle}% + \global\@topnum\z@ + \ifodd \CTEX@chapter@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@chapter@numbering @@ -855,33 +859,33 @@ \CTEX@setheadingskip \CTEX@chapter@beforeskip \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi \vspace*{\CTEX@headingskip}% - {\CTEX@disableautoindent - \normalfont \CTEX@chapter@format - \interlinepenalty\@M - \CTEX@hangindent{chapter}% - {\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% - \CTEX@chapter@titleformat{#1}% - \CTEX@chapter@aftertitle - \nobreak - \CTEX@setheadingskip \CTEX@chapter@afterskip - \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - }} + \begingroup + \CTEX@heading@format@initial + \CTEX@chapter@format{% + \CTEX@headinghang{chapter}% + {\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip} \def\@makeschapterhead#1{% \CTEX@setheadingskip \CTEX@chapter@beforeskip \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi \vspace*{\CTEX@headingskip}% - {\CTEX@disableautoindent - \normalfont \CTEX@chapter@format - \interlinepenalty\@M - \CTEX@hangindent{chapter}{}% - \CTEX@chapter@titleformat{#1}% - \CTEX@chapter@aftertitle - \nobreak - \CTEX@setheadingskip \CTEX@chapter@afterskip - \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - }} + \begingroup + \CTEX@heading@format@initial + \CTEX@chapter@format{% + \CTEX@headinghang{chapter}{}% + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip} \def\@startsection#1#2#3#4#5#6{% \if@noskipsec \leavevmode \fi \par @@ -924,22 +928,22 @@ \CTEX@gettitle{#7}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #6{% - \CTEX@hangfrom{\hskip\glueexpr #3\relax\@svsec}% - \interlinepenalty \@M + \CTEX@sectionhang{#3}{\@svsec}% \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% + \csname CTEX@#1@aftertitle\endcsname}\par \endgroup \csname #1mark\endcsname{#7}% \CTEX@addtocline{#1}{#7}% \else \def\@svsechd{% - #6{\hskip\glueexpr #3\relax - \@svsec - \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% - \csname #1mark\endcsname{#7}% - \CTEX@addtocline{#1}{#7}}% + #6{% + {\CTEX@indentbox{#3}}\@svsec + \csname CTEX@#1@titleformat\endcsname{#8}% + \csname CTEX@#1@aftertitle\endcsname}% + \csname #1mark\endcsname{#7}% + \CTEX@addtocline{#1}{#7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% @@ -947,15 +951,15 @@ \CTEX@gettitle{#5}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #4{% - \CTEX@hangfrom{\hskip\glueexpr #1\relax}% - \interlinepenalty \@M + \CTEX@sectionhang{#1}{}% \CTEX@titleformat@n{#5}% - \CTEX@aftertitle}% + \CTEX@aftertitle}\par \endgroup \else - \def\@svsechd{#4{\hskip\glueexpr #1\relax - \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{{\CTEX@indentbox{#1}}% + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} \def\@xsect#1{% @@ -975,32 +979,47 @@ \clubpenalty\@M \begingroup \@svsechd \endgroup \unskip - \hskip\glueexpr #1\relax + \CTEX@heading@glue{#1}% \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \fi \ignorespaces} -\cs_new_protected:Npn \CTEX@hangindent #1#2 +\cs_new_protected:Npn \CTEX@headinghang #1 { - \dim_set:Nn \parindent { \use:c { CTEX@#1@indent } } - \bool_if:cTF { CTEX@#1@hang } - { \@hangfrom { \__ctex_indent_aux: #2 } } - {#2} + \ctex_heading_hang:cnn + { CTEX@#1@hang } + { \use:c { CTEX@#1@indent } } } -\cs_new_protected_nopar:Npn \__ctex_indent_aux: +\cs_new_protected:Npn \CTEX@sectionhang + { \ctex_heading_hang:Nnn \CTEX@hang } +\cs_new_protected:Npn \ctex_heading_hang:Nnn #1#2#3 { - \dim_compare:nNnF \parindent = \c_zero_dim - { \skip_horizontal:n { \parindent } } + \dim_set:Nn \tex_parindent:D {#2} + \bool_if:NTF #1 + { \ctex_hang_from:n } + { \use:n } + { \__ctex_insert_indent: #3 } } -\cs_new_protected_nopar:Npn \CTEX@hangfrom +\cs_new_protected:Npn \ctex_hang_from:n #1 { - \bool_if:NTF \CTEX@hang - { \@hangfrom } - { \noindent \use:n } + \tex_noindent:D + \hbox_set:Nn \l__ctex_tmp_box {#1} + \tex_hangindent:D = \box_wd:N \l__ctex_tmp_box + \box_use_drop:N \l__ctex_tmp_box + } +\cs_generate_variant:Nn \ctex_heading_hang:Nnn { c } +\cs_new_protected:Npn \ctex_heading_glue:n #1 + { + \group_begin: + \skip_set:Nn \l__ctex_heading_skip {#1} + \dim_compare:nNnF \l__ctex_heading_skip = \c_zero_dim + { \skip_horizontal:N \l__ctex_heading_skip } + \group_end: } -\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 +\cs_new_eq:NN \CTEX@heading@glue \ctex_heading_glue:n +\cs_new_protected:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } @@ -1029,7 +1048,7 @@ { } #2 } -\cs_new_nopar:Npn \CTEXnumberline #1 +\cs_new:Npn \CTEXnumberline #1 { \CTEXifname { \protect \numberline { \use:c { CTEXthe #1 } } } @@ -1039,7 +1058,7 @@ \seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int - \cs_gset_protected_nopar:cpx {#1} + \cs_gset_protected:cpx {#1} { \exp_not:N \@startsection {#1} { \int_use:N \l__ctex_tmp_int } @@ -1051,7 +1070,7 @@ \cs_new:cpn { CTEX@#1@tocline } ##1##2 { \CTEXnumberline { ##1 } ##2 } } -\keys_define:nn { ctex } +\ctex_define:n { appendix .meta:nn = { ctex / appendix } {#1} , appendix / name .code:n = @@ -1063,7 +1082,7 @@ \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix \cs_new_eq:NN \CTEX@save@appendix \appendix -\cs_gset_protected_nopar:Npn \appendix +\cs_gset_protected:Npn \appendix { \CTEX@save@appendix \gdef \CTEX@prechapter { \CTEX@preappendix } @@ -1071,7 +1090,7 @@ \gdef \CTEX@postchapter { \CTEX@postappendix } \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } } -\cs_new_protected_nopar:Npn \CTEX@makeanchor #1 +\cs_new_protected:Npn \CTEX@makeanchor #1 { } \seq_const_from_clist:Nn \c__ctex_headings_cs_seq { part , spart , chapter , schapter , sect , ssect } @@ -1080,7 +1099,7 @@ \cs_new_eq:cc { CTEX@ #1 } { @ #1 } \cs_new_eq:cN { CTEX@makeanchor@ #1 } \CTEX@makeanchor } -\cs_new_protected_nopar:Npn \CTEX@hyperheadinghook +\cs_new_protected:Npn \CTEX@hyperheadinghook { \group_begin: \ifHy@implicit @@ -1101,7 +1120,7 @@ } \ctex_at_end_package:nn { hyperref } { - \cs_gset_protected_nopar:Npn \CTEX@makeanchor #1 + \cs_gset_protected:Npn \CTEX@makeanchor #1 { \Hy@MakeCurrentHrefAuto {#1} \Hy@raisedlink @@ -1116,14 +1135,14 @@ { } \ctex_at_end_package:nn { nameref } { - \cs_gset_protected_nopar:Npn \CTEX@gettitle { \NR@gettitle } + \cs_gset_protected:Npn \CTEX@gettitle { \NR@gettitle } \seq_map_inline:Nn \c__ctex_headings_cs_seq { \cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 } { \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } } } } -\cs_new_protected_nopar:Npn \ctex_titlesec_hook: +\cs_new_protected:Npn \ctex_titlesec_hook: { \@ifpackagewith { titlesec } { explicit } { @@ -1143,17 +1162,17 @@ } \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n } -\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 +\cs_new_protected:Npn \__ctex_titlesec_hook:n #1 { \__ctex_titlesec_format:n {#1} \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 +\cs_new_protected:Npn \__ctex_titlesec_format:n #1 { \cs_if_free:cF { ttlf@#1 } { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format:Nn #1#2 { \tl_set:Nx #1 { @@ -1163,7 +1182,7 @@ \tl_tail:N #1 } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format_explicit:Nn #1#2 { \cs_set_nopar:Npx #1 ##1 { @@ -1173,7 +1192,7 @@ \exp_args:No \tl_tail:n { #1 { } } } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_spacing:Nn #1#2 { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } \cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 { @@ -1195,14 +1214,14 @@ \tl_set:Nn \ttl@chapterout { \typeout { \CTEXthechapter } } \cs_if_free:NF \ttl@tocpart { - \cs_set_protected_nopar:Npn \ttl@tocpart + \cs_set_protected:Npn \ttl@tocpart { \tl_set:Nn \ttl@a { \CTEXthepart \hspace { 1em } } } } \seq_map_inline:Nn \c__ctex_headings_seq { \cs_if_exist:cF { ttl@toc #1 } { - \cs_new_protected_nopar:cpx { ttl@toc #1 } + \cs_new_protected:cpx { ttl@toc #1 } { \tl_set:Nn \exp_not:N \ttl@a { @@ -1215,7 +1234,7 @@ } \group_begin: \char_set_catcode_other:N \# -\cs_new_protected_nopar:Npn \ctex_titleps_hook: +\cs_new_protected:Npn \ctex_titleps_hook: { \ctex_patch_cmd:Nnn \ttl@settopmark { \protect \@namedef { the#1 } { \@nameuse { the#1 } } } @@ -1237,12 +1256,12 @@ } } \group_end: -\cs_new_nopar:Npn \CTEX@titlepslabel@set #1 +\cs_new:Npn \CTEX@titlepslabel@set #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { \@nameuse { CTEXthe#1 } } } } -\cs_new_nopar:Npn \CTEX@titlepslabel@clear #1 +\cs_new:Npn \CTEX@titlepslabel@clear #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { } } @@ -1252,9 +1271,9 @@ \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: } \ctex_at_end_package:nn { titleps } { - \cs_set_protected_nopar:Npn \ttl@setifthe #1 + \cs_set_protected:Npn \ttl@setifthe #1 { - \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 } + \exp_args:Nco \cs_set:Npn { ifthe #1 } { \CTEXifname { \protect \@firstoftwo } @@ -1281,19 +1300,24 @@ { \CTEX@toc@width@n {#1} } { } { \ctex_patch_failure:N \numberline } - \@ifpackageloaded { tocloft } - { } + \cs_new_protected:Npn \__ctex_patch_toc_width:n \c_parameter_token 1 { - \ctex_at_end_package:nn { tocloft } + \@ifpackageloaded { \c_parameter_token 1 } + { } { - \ctex_preto_cmd:NnnTF \numberline - { \char_set_catcode_letter:n { 64 } } - { \CTEX@toc@width@n {#1} } - { } - { \ctex_patch_failure:N \numberline } + \ctex_at_end_package:nn { \c_parameter_token 1 } + { + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } + { \ctex_patch_failure:N \numberline } + } } } } +\__ctex_patch_toc_width:n { tocloft } +\__ctex_patch_toc_width:n { titletoc } \ctex_patch_cmd:Nnn \ps@headings { \ifnum \c@secnumdepth > \m@ne @@ -1315,7 +1339,7 @@ { \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } { \CTEXifname { \CTEXthesection \quad } { } } } -\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 +\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 { \protected@edef \@currentlabel { @@ -1324,17 +1348,17 @@ { \exp_not:o { \@currentlabel } } } } -\cs_new_protected_nopar:Npn \ctex_varioref_hook: +\cs_new_protected:Npn \ctex_varioref_hook: { \seq_map_inline:Nn \c__ctex_headings_seq { \ctex_fix_varioref_label:n { ##1 } } } -\cs_new_protected_nopar:Npn \ctex_fix_varioref_label:n #1 +\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 { \tl_if_empty:cT { p@#1 } - { \exp_args:Nno \labelformat {#1} { \cs:w CTEX@the#1 \cs_end: } } + { \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } } -\@ifpackageloaded { varioref } +\cs_if_exist:NTF \labelformat { \ctex_varioref_hook: } { \cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter @@ -1348,7 +1372,7 @@ \ctex_scheme_input:o { \l__ctex_scheme_tl } \NewDocumentCommand \zihao { m } { \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_zihao:n #1 +\cs_new_protected:Npn \ctex_zihao:n #1 { \prop_get:NnNTF \c__ctex_font_size_prop {#1} \l__ctex_font_size_tl { \exp_after:wN \fontsize \l__ctex_font_size_tl \selectfont } @@ -1363,7 +1387,7 @@ } \prop_new:N \c__ctex_font_size_prop \seq_new:N \c__ctex_font_size_seq -\cs_new_protected_nopar:Npn \__ctex_save_font_size:nn #1#2 +\cs_new_protected:Npn \__ctex_save_font_size:nn #1#2 { \use:x { @@ -1395,12 +1419,12 @@ { 0 } { 42 bp } } { \__ctex_save_font_size:nn #1 } -\cs_new_protected_nopar:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 +\cs_new_protected:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 { \__ctex_get_font_sizes:Nn \l__ctex_font_size_tl { {#1} {#2} {#3} {#4} } \exp_after:wN \DeclareMathSizes \l__ctex_font_size_tl } -\cs_new_protected_nopar:Npn \__ctex_get_font_sizes:Nn #1#2 +\cs_new_protected:Npn \__ctex_get_font_sizes:Nn #1#2 { \tl_clear:N #1 \tl_map_inline:nn {#2} @@ -1437,13 +1461,13 @@ { \msg_error:nnn { ctex } { fontsize } {#2} } } \cs_new_protected:Npn \__ctex_set_font_size:nnNn #1#2#3#4 - { \cs_set_protected_nopar:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } -\if_case:w \g__ctex_font_size_int - \ctex_file_input:n { ctex-c5size.clo } -\or: - \ctex_file_input:n { ctex-cs4size.clo } -\fi: -\fp_compare:nNnF { \l__ctex_line_spread_fp } ? { \c_zero_fp } + { \cs_set_protected:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } +\int_case:nn { \g__ctex_font_size_int } + { + { 0 } { \ctex_file_input:n { ctex-c5size.clo } } + { 1 } { \ctex_file_input:n { ctex-cs4size.clo } } + } +\fp_if_nan:nF { \l__ctex_line_spread_fp } { \exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } \group_begin: \footnotesize \exp_args:NNNo \group_end: @@ -1454,47 +1478,76 @@ { C \TeX } \ctex_at_end_package:nn { hyperref } { \pdfstringdefDisableCommands { \tl_set:Nn \CTeX { CTeX } } } -\keys_define:nn { ctex } +\ctex_define:n { captiondelimiter .code:n = { - \msg_warning:nnn { ctex } { deprecated-option } + \ctex_deprecated_option:n { You~can~load~the~package~`caption'~to~get~its~functionality. } } } -\cs_new_protected_nopar:Npn \ctex_fontset_error:n #1 +\cs_new_protected:Npn \ctex_fontset_error:n #1 { \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } \msg_new:nnn { ctex } { fontset-unavailable } { CTeX~fontset~`#1'~is~unavailable~in~current~mode. } -\cs_new_protected_nopar:Npn \ctex_load_fontset: +\cs_new:Npx \ctex_fontset_case:nnn #1#2#3 { - \tl_if_empty:NTF \g__ctex_fontset_tl + \sys_if_engine_pdftex:TF + {#1} + { \sys_if_engine_uptex:TF {#2} {#3} } + } +\cs_new:Npx \ctex_fontset_case:nnnn #1#2#3#4 + { + \sys_if_engine_pdftex:TF + { \sys_if_output_pdf:TF {#1} {#2} } + { \sys_if_engine_uptex:TF {#3} {#4} } + } +\cs_new_protected:Npn \ctex_detect_platform: + { + \sys_if_platform_windows:TF + { \tl_gset:Nn \g__ctex_fontset_tl { windows } } { - \ctex_detected_platform: - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } + \ctex_if_platform_macos:TF + { \tl_gset:Nn \g__ctex_fontset_tl { mac } } + { \tl_gset:Nn \g__ctex_fontset_tl { fandol } } } + } +\cs_new_protected:Npn \ctex_if_platform_macos:TF + { \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } } +\cs_new_protected:Npn \ctex_load_fontset: + { + \tl_if_empty:NTF \g__ctex_fontset_tl + { \ctex_detect_platform: } { - \file_if_exist:nTF { ctex-fontset- \g__ctex_fontset_tl .def } - { \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } + \bool_lazy_or:nnTF + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsnew } } + { \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsold } } + { + \msg_warning:nnxx { ctex } { deprecated-fontset } + { \g__ctex_fontset_tl } { windows } + \tl_gset:Nn \g__ctex_fontset_tl { windows } + } { - \use:x + \file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def } { - \ctex_detected_platform: - \msg_error:nnxx { ctex } { fontset-not-found } - { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + \use:x + { + \ctex_detect_platform: + \msg_error:nnxx { ctex } { fontset-not-found } + { \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } + } } - \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } } + \ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } } -\@onlypreamble \ctex_load_fontset: +\msg_new:nnn { ctex } { deprecated-fontset } + { CTeX~fontset~`#1'~is~deprecated.\\ Fontset~`#2'~will~be~used~instead. } \msg_new:nnnn { ctex } { fontset-not-found } - { - CTeX~fontset~`#1'~could~not~be~found.\\ - Fontset~`#2'~will~be~used~instead. - } + { CTeX~fontset~`#1'~could~not~be~found.\\ Fontset~`#2'~will~be~used~instead. } { You~may~run~`mktexlsr'~firstly. } -\keys_define:nn { ctex } +\@onlypreamble \ctex_load_fontset: +\ctex_define:n { fontset .code:n = { @@ -1524,14 +1577,16 @@ } { Only~one~fontset~can~be~loaded~in~the~preamble. } \msg_new:nnn { ctex } { fontset-only-preamble } - { - The~ `fontset'~ option~ can~ be~ used~ only~ in~ preamble. - } + { The~`fontset'~option~can~be~used~only~in~preamble. } \str_if_eq:onF { \g__ctex_fontset_tl } { none } { \ctex_load_fontset: } \ctex_at_end:n { \ctex_file_input:n { ctex.cfg } } %% -%% This package consists of the file ctex.dtx, +%% This package consists of the files ctex.dtx, +%% ctxdoc.cls, +%% ctxdocstrip.tex, +%% ctex-zhconv.lua, +%% ctex-zhconv-make.lua, %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, @@ -1541,16 +1596,15 @@ %% ctexbook.cls, %% ctexrep.cls, %% ctexbeamer.cls, -%% ctxdoc.cls, %% ctexcap.sty, %% ctexhook.sty, %% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, -%% ctex-article.def, -%% ctex-book.def, -%% ctex-report.def, -%% ctex-beamer.def, +%% ctex-heading-article.def, +%% ctex-heading-book.def, +%% ctex-heading-report.def, +%% ctex-heading-beamer.def, %% ctex-scheme-plain.def, %% ctex-scheme-plain-article.def, %% ctex-scheme-plain-book.def, @@ -1565,6 +1619,7 @@ %% ctex-name-utf8.cfg, %% ctex.cfg, %% ctexopts.cfg, +%% ctexbackend.cfg, %% ctex-engine-pdftex.def, %% ctex-engine-xetex.def, %% ctex-engine-luatex.def, @@ -1582,26 +1637,25 @@ %% jt2zhrm.fd, %% jt2zhsf.fd, %% jt2zhtt.fd, -%% ctex-fontset-windows.def, -%% ctex-fontset-windowsnew.def, -%% ctex-fontset-windowsold.def, %% ctex-fontset-adobe.def, %% ctex-fontset-fandol.def, +%% ctex-fontset-founder.def, %% ctex-fontset-mac.def, %% ctex-fontset-macnew.def, %% ctex-fontset-macold.def, -%% ctex-fontset-founder.def, %% ctex-fontset-ubuntu.def, +%% ctex-fontset-windows.def, %% ctexspa.def, %% ctexpunct.spa, %% ctexmakespa.tex, %% ctexspamacro.tex, -%% ctxdocstrip.tex, %% zhadobefonts.tex, %% zhfandolfonts.tex, %% zhfounderfonts.tex, +%% zhmacfonts.tex, %% zhubuntufonts.tex, %% zhwindowsfonts.tex, +%% ctex-zhconv-index.lua, %% translator-theorem-dictionary-ChineseGBK.dict, %% translator-theorem-dictionary-ChineseUTF8.dict, and %% README.md. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexsize.sty b/Master/texmf-dist/tex/latex/ctex/ctexsize.sty index 868a30b57de..8b030787cd5 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexsize.sty +++ b/Master/texmf-dist/tex/latex/ctex/ctexsize.sty @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `style,ctexsize') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,22 +20,40 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese font size definition (CTEX)} \ProvidesExplPackage{ctexsize} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \RequirePackage { xparse , l3keys2e } +\RequirePackage { fix-cm } +\cs_new_protected:Npn \ctex_define_option:n + { \keys_define:nn { ctex / option } } +\cs_new_protected:Npn \ctex_file_wrapper:nnn #1#2#3 + { + \use:x + { + \ExplSyntaxOff + \char_set_catcode_letter:n { 64 } + #1 + \exp_not:n {#2} + \bool_if:NTF \l__kernel_expl_bool + { \ExplSyntaxOn } + { \ExplSyntaxOff } + \char_set_catcode:nn { 64 } { \char_value_catcode:n { 64 } } + #3 + } + } +\cs_new_protected:Npn \ctex_file_input:n #1 + { \ctex_file_wrapper:nnn { } { \file_input:n {#1} } { } } \int_new:N \g__ctex_font_size_int -\int_set:Nn \g__ctex_font_size_int { -1 } -\keys_define:nn { ctex / option } +\int_gset:Nn \g__ctex_font_size_int { -1 } +\ctex_define_option:n { zihao .choice: , zihao .value_required:n = true , @@ -57,12 +75,12 @@ #1 .value_forbidden:n = true , } } -\use:x { \keys_define:nn { ctex / option } { \exp_not:o { \l__ctex_tmp_tl } } } +\exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl } \tl_clear:N \l__ctex_tmp_tl \ProcessKeysOptions { ctex / option } \NewDocumentCommand \zihao { m } { \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_zihao:n #1 +\cs_new_protected:Npn \ctex_zihao:n #1 { \prop_get:NnNTF \c__ctex_font_size_prop {#1} \l__ctex_font_size_tl { \exp_after:wN \fontsize \l__ctex_font_size_tl \selectfont } @@ -77,7 +95,7 @@ } \prop_new:N \c__ctex_font_size_prop \seq_new:N \c__ctex_font_size_seq -\cs_new_protected_nopar:Npn \__ctex_save_font_size:nn #1#2 +\cs_new_protected:Npn \__ctex_save_font_size:nn #1#2 { \use:x { @@ -109,12 +127,12 @@ { 0 } { 42 bp } } { \__ctex_save_font_size:nn #1 } -\cs_new_protected_nopar:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 +\cs_new_protected:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 { \__ctex_get_font_sizes:Nn \l__ctex_font_size_tl { {#1} {#2} {#3} {#4} } \exp_after:wN \DeclareMathSizes \l__ctex_font_size_tl } -\cs_new_protected_nopar:Npn \__ctex_get_font_sizes:Nn #1#2 +\cs_new_protected:Npn \__ctex_get_font_sizes:Nn #1#2 { \tl_clear:N #1 \tl_map_inline:nn {#2} @@ -151,15 +169,19 @@ { \msg_error:nnn { ctex } { fontsize } {#2} } } \cs_new_protected:Npn \__ctex_set_font_size:nnNn #1#2#3#4 - { \cs_set_protected_nopar:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } -\if_case:w \g__ctex_font_size_int - \ctex_file_input:n { ctex-c5size.clo } -\or: - \ctex_file_input:n { ctex-cs4size.clo } -\fi: + { \cs_set_protected:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } +\int_case:nn { \g__ctex_font_size_int } + { + { 0 } { \ctex_file_input:n { ctex-c5size.clo } } + { 1 } { \ctex_file_input:n { ctex-cs4size.clo } } + } \normalsize %% -%% This package consists of the file ctex.dtx, +%% This package consists of the files ctex.dtx, +%% ctxdoc.cls, +%% ctxdocstrip.tex, +%% ctex-zhconv.lua, +%% ctex-zhconv-make.lua, %% and the derived files ctex.pdf, %% ctex.ins, %% ctex.sty, @@ -169,16 +191,15 @@ %% ctexbook.cls, %% ctexrep.cls, %% ctexbeamer.cls, -%% ctxdoc.cls, %% ctexcap.sty, %% ctexhook.sty, %% ctexpatch.sty, %% ctex-c5size.clo, %% ctex-cs4size.clo, -%% ctex-article.def, -%% ctex-book.def, -%% ctex-report.def, -%% ctex-beamer.def, +%% ctex-heading-article.def, +%% ctex-heading-book.def, +%% ctex-heading-report.def, +%% ctex-heading-beamer.def, %% ctex-scheme-plain.def, %% ctex-scheme-plain-article.def, %% ctex-scheme-plain-book.def, @@ -193,6 +214,7 @@ %% ctex-name-utf8.cfg, %% ctex.cfg, %% ctexopts.cfg, +%% ctexbackend.cfg, %% ctex-engine-pdftex.def, %% ctex-engine-xetex.def, %% ctex-engine-luatex.def, @@ -210,26 +232,25 @@ %% jt2zhrm.fd, %% jt2zhsf.fd, %% jt2zhtt.fd, -%% ctex-fontset-windows.def, -%% ctex-fontset-windowsnew.def, -%% ctex-fontset-windowsold.def, %% ctex-fontset-adobe.def, %% ctex-fontset-fandol.def, +%% ctex-fontset-founder.def, %% ctex-fontset-mac.def, %% ctex-fontset-macnew.def, %% ctex-fontset-macold.def, -%% ctex-fontset-founder.def, %% ctex-fontset-ubuntu.def, +%% ctex-fontset-windows.def, %% ctexspa.def, %% ctexpunct.spa, %% ctexmakespa.tex, %% ctexspamacro.tex, -%% ctxdocstrip.tex, %% zhadobefonts.tex, %% zhfandolfonts.tex, %% zhfounderfonts.tex, +%% zhmacfonts.tex, %% zhubuntufonts.tex, %% zhwindowsfonts.tex, +%% ctex-zhconv-index.lua, %% translator-theorem-dictionary-ChineseGBK.dict, %% translator-theorem-dictionary-ChineseUTF8.dict, and %% README.md. diff --git a/Master/texmf-dist/tex/latex/ctex/ctexspa.def b/Master/texmf-dist/tex/latex/ctex/ctexspa.def index 6a6785982f3..fbb45d19a99 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctexspa.def +++ b/Master/texmf-dist/tex/latex/ctex/ctexspa.def @@ -7,9 +7,9 @@ %% ctex.dtx (with options: `ctexspa') %% ctexpunct.spa %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -21,14 +21,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{ctexspa.def}% - [2019/05/29 v2.4.16 Space info for CJKpunct (CTEX)] + [2020/05/02 v2.5.1 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,,,} @@ -48,9 +46,23 @@ \ctexspadef{founderzhli}{69,19,58,9,48,21,45,27,48,25,47,32,48,27,48,39,48,21,43,17,47,33,47,33,0,0,11,11,11,61,13,63,17,66,7,80,20,70,19,68,20,70,3,54,9,9,25,48,32,47,27,48,40,48,21,48,17,43,33,47,33,47,19,69,9,58,21,48,27,45,,,} \ctexspadef{founderzhyou}{67,16,61,11,48,11,45,14,48,20,48,17,48,16,48,39,48,12,42,16,48,30,48,30,0,0,12,11,11,61,9,59,17,67,11,83,20,70,18,69,21,70,4,54,12,12,20,48,17,48,16,48,39,48,12,48,16,41,30,48,29,48,16,67,11,61,11,48,14,45,,,} \ctexspadef{founderzhyoub}{69,18,60,10,46,13,43,16,46,17,45,20,46,18,46,31,45,13,38,14,44,29,46,30,-3,0,10,9,9,61,9,59,19,69,7,82,18,68,18,67,20,69,2,52,17,17,17,46,20,45,18,46,32,46,13,45,14,38,29,44,30,46,19,69,10,60,14,46,17,43,,,} -\ctexspadef{ubuntuzhsong}{66,21,58,7,58,8,55,11,59,18,71,7,71,2,40,38,58,13,52,4,64,6,58,14,7,7,11,10,38,38,38,38,17,73,21,70,13,78,13,75,27,63,4,52,4,5,18,59,7,71,2,71,38,40,13,58,4,51,6,64,14,58,16,70,8,56,10,58,11,54,,,} -\ctexspadef{ubuntuzhhei}{6,6,4,4,60,10,61,11,62,12,65,15,67,15,62,15,63,13,57,6,19,52,63,13,-0,0,11,11,10,70,10,68,44,44,45,44,44,44,44,44,43,45,27,27,19,16,12,62,15,65,15,67,15,62,13,63,6,56,3,68,13,63,6,6,4,4,10,60,11,61,,,} -\ctexspadef{ubuntuzhkai}{68,20,58,9,58,8,55,11,59,18,59,20,59,18,53,23,58,13,52,4,58,8,58,14,7,7,11,10,38,38,38,38,40,42,43,43,43,43,43,43,43,43,25,28,10,11,18,59,20,59,18,59,24,53,13,58,4,51,8,58,14,58,17,70,9,58,10,58,11,54,,,} +\ctexspadef{maczhsong}{4,4,4,4,63,14,59,7,63,13,64,13,70,12,59,13,61,12,47,7,56,7,58,8,0,0,11,11,10,68,13,63,17,68,20,70,20,70,18,68,20,70,12,59,18,18,14,62,10,66,12,69,9,64,12,61,7,47,7,56,8,58,4,4,4,4,14,63,7,59,,,} +\ctexspadef{maczhsongb}{4,4,4,4,62,13,49,13,62,10,65,10,59,13,62,14,61,12,43,9,56,4,56,14,0,0,11,10,7,67,13,62,15,66,18,67,18,69,16,66,18,69,10,60,14,10,10,62,10,64,12,60,14,62,12,61,9,43,4,56,14,56,4,4,4,4,12,62,12,50,,,} +\ctexspadef{maczhhei}{68,15,58,4,62,13,56,6,61,11,65,12,66,16,63,12,59,14,51,5,55,5,60,10,0,0,8,11,13,60,13,62,20,70,20,70,20,70,20,70,20,70,3,54,9,10,10,62,12,65,16,65,9,66,14,60,7,48,5,55,10,60,14,68,4,58,13,62,6,56,,,} +\ctexspadef{maczhheil}{71,17,65,7,60,11,56,6,59,9,67,10,66,15,64,13,58,14,51,6,53,6,60,8,0,0,9,10,10,61,12,62,20,70,20,70,20,70,20,70,21,71,4,55,9,9,9,59,10,67,15,66,13,64,14,58,6,51,6,53,8,60,17,71,7,65,11,60,6,56,,,} +\ctexspadef{maczhkai}{5,5,6,3,63,14,59,7,63,13,62,12,60,11,61,15,61,12,47,7,56,7,58,8,0,0,12,11,10,68,13,63,18,67,20,69,19,69,17,67,19,70,14,57,15,10,14,62,10,65,10,60,13,63,12,61,7,47,7,56,8,58,4,4,4,5,14,63,7,59,,,} +\ctexspadef{maczhkaib}{5,6,4,4,65,10,54,8,62,14,63,9,65,10,60,14,61,13,50,8,58,10,60,10,0,0,10,10,11,68,13,63,17,68,18,68,18,68,17,68,19,69,11,59,15,12,13,62,9,63,9,66,13,60,13,61,8,50,10,58,10,61,6,5,4,4,9,65,8,55,,,} +\ctexspadef{maczhfs}{71,14,62,8,63,14,59,7,63,13,62,12,60,11,61,15,61,12,47,7,56,7,58,8,0,0,12,11,10,68,13,63,18,67,20,69,19,69,17,67,19,70,7,58,15,10,14,62,10,65,10,60,13,63,12,61,7,47,7,56,8,58,15,68,8,60,14,63,7,59,,,} +\ctexspadef{maczhli}{4,2,7,4,69,2,61,4,65,6,62,6,48,2,46,1,67,5,52,4,61,3,65,3,0,-0,10,7,10,64,11,66,18,67,43,41,18,67,15,67,19,67,11,57,14,13,4,67,6,63,2,47,1,50,5,67,4,52,3,61,3,65,4,2,7,4,6,67,4,61,,,} +\ctexspadef{maczhyou}{5,5,5,9,71,4,58,4,71,4,75,6,75,6,69,5,73,4,57,4,59,4,63,4,0,0,12,12,12,64,13,66,19,70,15,75,19,72,18,71,19,72,5,58,11,11,4,71,6,75,6,75,5,69,4,73,4,57,4,59,4,63,5,5,7,10,4,71,4,58,,,} +\ctexspadef{maczhyoub}{3,3,4,7,69,2,57,2,70,2,74,4,74,6,67,3,71,2,55,2,58,4,63,4,0,0,10,10,9,62,12,62,17,68,13,72,17,68,16,68,18,68,4,56,10,10,2,70,4,74,6,74,3,67,2,71,2,55,4,58,4,63,3,4,5,7,2,69,2,57,,,} +\ctexspadef{maczhpf}{12,8,12,8,65,3,62,3,67,3,70,8,72,4,67,4,65,8,51,6,63,3,66,5,0,0,11,11,13,63,12,62,12,74,12,76,19,69,18,68,19,69,3,53,8,8,3,67,8,70,4,72,4,67,8,65,6,51,3,63,5,66,8,12,8,12,3,65,3,62,,,} +\ctexspadef{maczhpfb}{12,8,12,8,64,3,61,3,66,3,67,8,70,4,65,4,63,8,47,6,61,3,64,5,0,0,9,9,11,61,11,61,11,71,11,73,17,67,17,66,17,67,2,52,7,7,3,66,8,67,4,70,4,65,8,63,6,47,3,61,5,64,8,12,8,12,3,64,3,61,,,} +\ctexspadef{ubuntuzhsong}{77,8,57,8,66,4,60,4,71,4,65,6,71,4,58,3,53,4,52,4,61,4,62,4,4,4,11,11,4,71,4,68,8,77,9,78,17,70,15,70,19,69,6,55,9,9,4,71,6,65,4,71,3,58,4,53,4,52,4,61,4,62,8,77,8,57,4,66,4,60,,,} +\ctexspadef{ubuntuzhsongb}{75,8,53,8,65,3,62,3,72,3,64,6,72,3,57,3,53,3,53,3,62,3,63,3,4,4,11,11,3,69,4,68,5,77,6,77,18,65,18,65,17,67,4,54,7,7,3,72,6,64,3,72,3,57,3,53,3,53,3,62,3,63,8,75,8,53,3,65,3,62,,,} +\ctexspadef{ubuntuzhhei}{81,5,62,4,65,3,60,3,71,4,70,5,71,3,70,4,59,5,53,4,62,3,67,3,5,5,10,10,5,66,4,65,14,67,16,68,18,67,15,66,19,69,3,54,8,8,4,71,5,70,3,71,4,70,5,59,4,53,3,62,3,67,5,81,4,62,3,65,3,60,,,} +\ctexspadef{ubuntuzhheib}{80,4,60,2,64,3,60,3,69,2,66,4,71,3,68,3,56,5,52,3,63,3,66,3,5,5,9,9,4,64,3,64,16,61,18,62,16,66,13,64,16,66,3,53,5,5,2,69,4,66,3,71,3,68,5,56,3,52,3,63,3,66,4,80,2,60,3,64,3,60,,,} +\ctexspadef{ubuntuzhkai}{53,33,53,19,58,8,59,9,61,11,60,10,62,12,60,10,56,6,54,4,58,8,58,8,7,7,15,15,26,53,29,53,19,67,22,68,30,60,27,59,26,63,7,57,25,23,11,61,10,60,12,62,10,60,6,56,3,54,8,58,8,58,32,54,19,53,8,58,9,59,,,} \ctexspadef{windowszhsong}{67,13,46,13,62,14,61,14,65,17,57,14,55,14,53,18,64,11,54,10,47,11,49,14,3,3,10,10,11,64,14,64,11,71,13,73,12,73,12,73,23,63,14,52,15,13,16,66,14,57,14,55,19,52,11,66,9,54,11,48,14,51,14,68,13,48,14,62,14,61,,,} \ctexspadef{windowszhhei}{78,9,56,9,50,20,50,20,50,23,61,11,54,14,50,26,50,16,50,7,47,11,49,14,0,0,9,11,14,64,13,63,14,72,14,73,19,68,18,68,25,64,15,48,12,12,22,50,11,60,14,55,25,50,16,50,7,50,11,48,14,51,8,79,8,56,18,50,18,50,,,} \ctexspadef{windowszhkai}{67,13,46,13,50,20,50,20,50,23,61,11,54,14,50,26,50,16,50,7,47,11,49,14,0,0,10,10,11,64,13,63,11,71,13,73,17,68,17,68,23,63,15,48,12,12,22,50,11,60,14,55,25,50,16,50,7,50,11,48,14,51,14,68,13,48,18,50,18,50,,,} diff --git a/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls b/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls index 88a7be91711..4cd102e4961 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls +++ b/Master/texmf-dist/tex/latex/ctex/ctxdoc.cls @@ -1,15 +1,10 @@ %% -%% This is file `ctxdoc.cls', -%% generated with the docstrip utility. +%% File ctxdoc.cls %% -%% The original source files were: -%% -%% ctex.dtx (with options: `ctxdoc') -%% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2016--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ -%% +%%--------------------------------------------------------------------- +%% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either %% version 1.3c of this license or (at your option) any later @@ -19,39 +14,27 @@ %% http://www.latex-project.org/lppl.txt %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. -%% -%% This work has the LPPL maintenance status `maintained'. -%% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ -%% +%% +%% This work has the LPPL maintenance status "maintained". +%% +%%--------------------------------------------------------------------- +%% \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctxdoc.cls 25394ad 2020-04-20 20:56:32 +0800 Qing Lee <sobenlee@gmail.com> $ {ctex documentation (CTEX)} -\ProvidesExplClass{ctxdoc} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} +\ProvidesExplClass{ctxdoc}{\ExplFileDate}{}{\ExplFileDescription} \ExplSyntaxOff -\let\pdfmdfivesum\mdfivesum \DeclareOption*{\PassOptionsToClass{\CurrentOption}{l3doc}} \PassOptionsToClass{a4paper,full}{l3doc} \ProcessOptions -\@namedef{ver@thumbpdf.sty}{9999/99/99} \LoadClass{l3doc} -\RequirePackage[UTF8, punct = kaiming, heading, fontset = none, - linespread = 1.2, sub3section]{ctex} -\ifxetex - \xeCJKsetup{AutoFakeBold=false} -\fi +\RequirePackage[UTF8, punct=kaiming, heading, linespread=1.2, sub3section]{ctex} \ctexset{ - fontset, abstractname = 简介, indexname = 代码索引, - section = { - format = \Large\bfseries\raggedright, - name = {第,节}, - }, + section/format = \Large\bfseries\raggedright, + section/name = {第,节}, } \RequirePackage[toc]{multitoc} \RequirePackage{geometry} @@ -64,17 +47,30 @@ \RequirePackage{caption} \RequirePackage{fancyvrb-ex} \RequirePackage{zref-base} -\geometry{includemp,hmargin={0mm,15mm},vmargin={25mm,15mm},footskip=7mm} -\hypersetup{pdfstartview=FitH,bookmarksdepth=subparagraph} +\geometry{includemp, hmargin={0mm,15mm}, vmargin={25mm,15mm}, footskip=7mm} +\hypersetup{pdfstartview=FitH, bookmarksdepth=subparagraph} \setcounter{secnumdepth}{4} \setcounter{tocdepth}{2} \newcommand*\email{\nolinkurl} -\setmainfont{TeX Gyre Pagella} -\setsansfont{TeX Gyre Heros} -\setmonofont[ - HyphenChar = None , - UprightFont=* Light, BoldFont=* Bold, - SlantedFont=* Light Oblique]{CMU Typewriter Text} +\setmainfont{texgyrepagella}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic] +\setsansfont{texgyreheros}[ + Extension = .otf, + UprightFont = *-regular, + BoldFont = *-bold, + ItalicFont = *-italic, + BoldItalicFont = *-bolditalic] +\setmonofont{cmun}[ + Extension = .otf, + UprightFont = *btl, + BoldFont = *tb, + ItalicFont = *bto, + BoldItalicFont = *tx, + HyphenChar = None] \setmathfont{texgyrepagella-math.otf} \captionsetup{strut=off, labelsep=quad, labelfont+=bf} %% <--- http://tex.stackexchange.com/a/40896 @@ -129,7 +125,7 @@ %% 设置间距为 \marginparsep,与 l3doc 一致 \setlist[optdesc]{% font=\mdseries\small\ttfamily,align=right,listparindent=\parindent, - labelsep=\marginparsep,labelindent=-\marginparsep,leftmargin=*} + labelsep=\marginparsep,labelindent=-\marginparsep,leftmargin=0pt} %% 重新定义 threeparttable 包的 tablenotes 环境 \renewlist{tablenotes}{description}{1} \setlist[tablenotes]{% @@ -286,7 +282,7 @@ \exp_args:Nx \href { http \c_colon_str //www.ctan.org/pkg/ - \IfNoValueTF {#1} { \str_fold_case:n {#2} } {#1} + \IfNoValueTF {#1} { \str_lowercase:n {#2} } {#1} } { \pkg {#2} } } @@ -599,10 +595,15 @@ #1 \g__codedoc_module_name_tl } } -\cs_new_protected:Npn \__ctxdoc_replace_at_at_aux:Nn #1#2 +\cs_new_protected:Npx \__ctxdoc_replace_at_at_aux:Nn #1#2 { - \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 } - \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 } + \tl_replace_all:Nnn #1 { \token_to_str:N @ } { @ } + \tl_replace_all:Nnn #1 { \token_to_str:N _ } { _ } + \tl_replace_all:Nnn #1 { @ @ @ @ } { \token_to_str:N a a } + \tl_replace_all:Nnn #1 { _ _ @ @ } { _ _ #2 } + \tl_replace_all:Nnn #1 { _ @ @ } { _ _ #2 } + \tl_replace_all:Nnn #1 { @ @ } { _ _ #2 } + \tl_replace_all:Nnn #1 { \token_to_str:N a a } { @ @ } } \cs_new_protected:Npn \__ctxdoc_output_line:n #1 { @@ -861,6 +862,6 @@ \EnableCrossrefs \CodelineIndex \RecordChanges -%% %% -%% End of file `ctxdoc.cls'. +%% +%% End of file ctxdoc.cls. diff --git a/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict b/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict index cf849838e94..053bc8e942c 100644 --- a/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict +++ b/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseGBK.dict @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `dict,theorem,GBK') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesDictionary{translator-theorem-dictionary}{ChineseGBK}% - [2019/05/29 v2.4.16 Chinese translation for theorem name (CTEX)] + [2020/05/02 v2.5.1 Chinese translation for theorem name (CTEX)] \providetranslation{Comments}{} \providetranslation{comments}{} \providetranslation{Comment}{} diff --git a/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict b/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict index 09659c2f52e..8ae4d9a629d 100644 --- a/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict +++ b/Master/texmf-dist/tex/latex/ctex/dictionary/translator-theorem-dictionary-ChineseUTF8.dict @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `dict,theorem,UTF8') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesDictionary{translator-theorem-dictionary}{ChineseUTF8}% - [2019/05/29 v2.4.16 Chinese translation for theorem name (CTEX)] + [2020/05/02 v2.5.1 Chinese translation for theorem name (CTEX)] \providetranslation{Comments}{评论} \providetranslation{comments}{评论} \providetranslation{Comment}{评论} diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def index 8cd15c75bb6..24584de60d4 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-aptex.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `aptex') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,57 +20,42 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Asian pTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-aptex.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1 - { - \AtBeginDvi {#1} - \ctex_at_end_package:nn { atbegshi } - { \AtBeginShipoutFirst {#1} } - } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\cs_new_protected:Npn \ctex_set_zhmap:n + { \tl_gput_right:Nx \g__ctex_zhmap_tl } +\cs_new_protected:Npn \ctex_use_zhmap: + { \tl_use:N \g__ctex_zhmap_tl } +\cs_new_protected:Npn \ctex_add_dvi_zhmap: + { \AtBeginDvi { \ctex_use_zhmap: } } +\ctex_after_end_preamble:n { \ctex_add_dvi_zhmap: } +\ctex_at_end_package:nn { atbegshi } + { + \AtBeginShipoutFirst { \ctex_use_zhmap: } + \cs_gset_eq:NN \ctex_add_dvi_zhmap: \prg_do_nothing: + } +\tl_new:N \g__ctex_zhmap_tl \@onlypreamble \ctex_set_zhmap:n -\tl_set:Nn \CJKrmdefault { zhrm } -\tl_set:Nn \CJKsfdefault { zhsf } -\tl_set:Nn \CJKttdefault { zhtt } -\tl_set:Nn \CJKfamilydefault { \CJKrmdefault } +\tl_if_exist:NF \CJKfamilydefault + { \tl_const:Nn \CJKfamilydefault { \CJKrmdefault } } +\tl_if_exist:NF \CJKrmdefault { \tl_const:Nn \CJKrmdefault { zhrm } } +\tl_if_exist:NF \CJKsfdefault { \tl_const:Nn \CJKsfdefault { zhsf } } +\tl_if_exist:NF \CJKttdefault { \tl_const:Nn \CJKttdefault { zhtt } } \tl_set:Nn \kanjifamilydefault { \CJKfamilydefault } -\RenewDocumentCommand \rmfamily { } - { - \not@math@alphabet \rmfamily \mathrm - \romanfamily \rmdefault - \kanjifamily \CJKrmdefault - \selectfont - } -\RenewDocumentCommand \sffamily { } - { - \not@math@alphabet \sffamily \mathsf - \romanfamily \sfdefault - \kanjifamily \CJKsfdefault - \selectfont - } -\RenewDocumentCommand \ttfamily { } - { - \not@math@alphabet \ttfamily \mathtt - \romanfamily \ttdefault - \kanjifamily \CJKttdefault - \selectfont - } +\g@addto@macro \@rmfamilyhook { \kanjifamily { \CJKrmdefault } } +\g@addto@macro \@sffamilyhook { \kanjifamily { \CJKsfdefault } } +\g@addto@macro \@ttfamilyhook { \kanjifamily { \CJKttdefault } } \NewDocumentCommand \CJKfamily { m } - { - \kanjifamily {#1} - \selectfont - } -\DeclareErrorKanjiFont{JY2}{zhrm}{m}{n}{10} -\DeclareKanjiSubstitution{JY2}{zhrm}{m}{n} -\DeclareKanjiSubstitution{JT2}{zhrm}{m}{n} + { \kanjifamily {#1} \selectfont } +\DeclareErrorKanjiFont {JY2}{zhrm}{m}{n}{10} +\DeclareKanjiSubstitution {JY2}{zhrm}{m}{n} +\DeclareKanjiSubstitution {JT2}{zhrm}{m}{n} \DeclareSymbolFont{mincho}{JY2}{zhrm}{m}{n} \SetSymbolFont{mincho}{bold}{JY2}{zhrm}{bx}{n} \jfam \symmincho @@ -87,43 +72,59 @@ { \eminnershape \else \itshape } } \cs_set_nopar:Npn \eminnershape { \upshape } -\cs_new_protected_nopar:Npn \ctex_set_upfamily:nnn #1 #2 #3 +\cs_new_protected:Npn \ctex_set_upfamily:nnn #1#2#3 { \DeclareKanjiFamily{JY2}{#1}{} \DeclareKanjiFamily{JT2}{#1}{} \DeclareFontShape{JY2}{#1}{m}{n}{<->~ #2-h}{} \DeclareFontShape{JT2}{#1}{m}{n}{<->~ #2-v}{} - \tl_if_empty:nF { #3 } + \tl_if_empty:nF {#3} { + \DeclareFontShape{JY2}{#1}{b}{n}{<->~ #3-h}{} + \DeclareFontShape{JT2}{#1}{b}{n}{<->~ #3-v}{} \DeclareFontShape{JY2}{#1}{bx}{n}{<->~ #3-h}{} \DeclareFontShape{JT2}{#1}{bx}{n}{<->~ #3-v}{} } } -\@onlypreamble \ctex_set_upfamily:nnn -\cs_new_protected_nopar:Npn \ctex_set_upmap:nnn #1 #2 #3 +\cs_new_protected:Npn \ctex_set_upmap:nnn #1#2#3 { \ctex_set_zhmap:n { - \special{ pdf:mapline~ #1-h~ UniGB-UTF16-H~ #2 } - \special{ pdf:mapline~ #1-v~ UniGB-UTF16-V~ #2 } - \tl_if_empty:nF { #3 } + \special { pdf:mapline~#1-h~UniGB-UTF16-H~#2 } + \special { pdf:mapline~#1-v~UniGB-UTF16-V~#2 } + \tl_if_empty:nF {#3} { - \special{ pdf:mapline~ #1b-h~ UniGB-UTF16-H~ #3 } - \special{ pdf:mapline~ #1b-v~ UniGB-UTF16-V~ #3 } + \special { pdf:mapline~#1b-h~UniGB-UTF16-H~#3 } + \special { pdf:mapline~#1b-v~UniGB-UTF16-V~#3 } } } } -\@onlypreamble \ctex_set_upmap:nnn -\cs_new_protected_nopar:Npn \ctex_set_upfonts:nnnnnn #1 #2 #3 #4 #5 #6 +\cs_new_protected:Npn \ctex_set_upmap_unicode:nnn #1#2#3 + { + \ctex_set_zhmap:n + { + \special { pdf:mapline~#1-h~unicode~#2 } + \special { pdf:mapline~#1-v~unicode~#2 } + \tl_if_empty:nF {#3} + { + \special { pdf:mapline~#1b-h~unicode~#3 } + \special { pdf:mapline~#1b-v~unicode~#3 } + } + } + } +\cs_new_protected:Npn \ctex_set_upfonts:nnnnnn #1#2#3#4#5#6 { - \ctex_set_upmap:nnn { upserif } { #1 } { #2 } - \ctex_set_upmap:nnn { upserifit } { #3 } {} - \ctex_set_upmap:nnn { upsans } { #4 } { #5 } - \ctex_set_upmap:nnn { upmono } { #6 } {} + \ctex_set_upmap:nnn { upserif } {#1} {#2} + \ctex_set_upmap:nnn { upserifit } {#3} {} + \ctex_set_upmap:nnn { upsans } {#4} {#5} + \ctex_set_upmap:nnn { upmono } {#6} {} } +\@onlypreamble \ctex_set_upfamily:nnn +\@onlypreamble \ctex_set_upmap:nnn +\@onlypreamble \ctex_set_upmap_unicode:nnn \@onlypreamble \ctex_set_upfonts:nnnnnn \RequirePackage { pxeverysel } -\cs_new_protected_nopar:Npn \ctex_update_default_family: +\cs_new_protected:Npn \ctex_update_default_family: { \tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl { @@ -150,34 +151,13 @@ { \exp_not:o { \CJKfamilydefault } } } \tl_gset_eq:NN \CJKfamilydefault \l__ctex_family_default_init_tl -\cs_new_protected_nopar:Npn \ctex_detected_platform: - { - \tl_gset:Nx \g__ctex_fontset_tl - { - \str_case:onF { \ngostype } - { - { Win32 } { windows } - { Win64 } { windows } - { Darwin } { mac } - } - { fandol } - } - } \ctex_hypersetup:n { driverfallback = dvipdfmx } \ctex_at_end_package:nn { hyperref } - { \AtBeginShipoutFirst { \special { pdf:tounicode~ UTF8-UTF16 } } } -\msg_new:nnn { ctex } { fntef-not-available } - { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ ApLaTeX. } -\msg_warning:nn { ctex } { fntef-not-available } -\clist_map_inline:nn - { underdot , underline , underdblline , underwave , sout , xout } - { \cs_new_eq:cN { CTEX#1 } \use:n } -\cs_new_eq:NN \CTEXfilltwosides \use_none:n -\cs_new_eq:NN \endCTEXfilltwosides \prg_do_nothing: -\cs_new_protected_nopar:Npn \ctex_update_ccwd: + { \AtBeginShipoutFirst { \special { pdf:tounicode~UTF8-UTF16 } } } +\cs_new_protected:Npn \ctex_update_ccwd: { \skip_set:Nn \ccwd { 1zw + \tex_kanjiskip:D } } \dim_new:N \ccwd -\cs_new_protected_nopar:Npn \ctex_update_ccglue: +\cs_new_protected:Npn \ctex_update_ccglue: { \skip_set_eq:NN \tex_kanjiskip:D \l__ctex_ccglue_skip } \skip_new:N \l__ctex_ccglue_skip \prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF } @@ -185,11 +165,11 @@ \skip_if_eq:nnTF { \l__ctex_ccglue_skip } { \tex_kanjiskip:D } { \prg_return_false: } { \prg_return_true: } } -\cs_new_protected_nopar:Npn \ctex_update_em_unit: +\cs_new_protected:Npn \ctex_update_em_unit: { \dim_set:Nn \ccwd { 1zw } } \cs_new_protected:Npn \ctex_add_to_selectfont:n #1 { - \cs_set_protected_nopar:Npx \CTEX@selectfont@hook + \cs_set_protected:Npx \CTEX@selectfont@hook { \exp_not:o { \CTEX@selectfont@hook #1 } } } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: @@ -199,10 +179,20 @@ { \tl_set:Nn \l__ctex_tmp_tl {#1} \cs_new_eq:NN \CTEX@selectfont@save #1 - \cs_new_protected_nopar:Npn \__ctex_restore_selectfont: + \cs_new_protected:Npn \__ctex_restore_selectfont: { + \cs_if_free:NF \scr@new@selectfont + { + \cs_if_free:NF \par@update + { + \tl_put_right:Nn \@EverySelectfont@Init + { \tl_put_right:Nn #1 { \par@update } } + } + \cs_set_eq:NN \scr@new@selectfont #1 + \cs_set_eq:NN \CTEX@selectfont@save \scr@selectfont + } \tl_put_left:Nn \@EverySelectfont@Init - { \let #1 \CTEX@selectfont@save } + { \cs_set_eq:NN #1 \CTEX@selectfont@save } \cs_undefine:N \__ctex_restore_selectfont: } } @@ -216,7 +206,7 @@ { \ctex_patch_failure:N \selectfont } \fi: \EverySelectfont { \CTEX@selectfont@hook } -\cs_new_protected_nopar:Npn \ctex_update_xkanjiskip: +\cs_new_protected:Npn \ctex_update_xkanjiskip: { \skip_if_eq:nnT { \tex_xkanjiskip:D } { \l__ctex_xkanjiskip_skip } @@ -232,21 +222,20 @@ \skip_set:Nn \l__ctex_xkanjiskip_skip { \tex_xkanjiskip:D } \ctex_add_to_selectfont:n { \ctex_update_xkanjiskip: } -\keys_define:nn { ctex } +\ctex_define:n { space .code:n = { \msg_warning:nn { ctex } { invalid-option } } } -\keys_define:nn { ctex } +\ctex_define:n { punct .code:n = { - \tl_set:Nx \l__ctex_punct_tl { #1 } + \tl_set:Nx \l__ctex_punct_tl {#1} \msg_warning:nn { ctex } { invalid-option } } , punct .default:n = { quanjiao } , } -\tl_set:Nn \l__ctex_encoding_tl { UTF8 } %% %% %% End of file `ctex-engine-aptex.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def index 351bb810745..6ccee7c96a2 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `luatex') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {LuaLaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-luatex.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \msg_new:nnn { ctex } { luatexja-loaded } { Package~`luatexja'~can~not~be~loaded~before~`ctex'.\\ @@ -39,28 +37,29 @@ { \msg_critical:nnx { ctex } { luatexja-loaded } { \g_file_curr_name_str } } { \tl_const:cn { ver@ltj-latex.\@pkgextension } { 9999/99/99 } } \RequirePackage { luatexja } -\@ifpackagelater { luatexja } { 2015/09/21 } { } +\@ifpackagelater { luatexja } { 2020/04/12 } { } { \msg_error:nnn { ctex } { package-too-old } { luatexja } } \RequirePackage { fontspec } -\@ifpackagelater { fontspec } { 2014/05/25 } { } +\@ifpackagelater { fontspec } { 2020/02/21 } { } { \msg_error:nnn { ctex } { package-too-old } { fontspec } } \ExplSyntaxOff \ltjdefcharrange{1}{"80-"36F, "1E00-"1EFF} \ltjdefcharrange{2}{"370-"4FF, "1F00-"1FFF} \ltjdefcharrange{3}{% - "2000-"206F, "2070-"243F, "2460-"24FF, "2500-"27BF, "2900-"29FF, - "2B00-"2BFF} + "2000-"243F, "2460-"24FF, "2500-"27BF, "2900-"29FF, "2B00-"2BFF} \ltjdefcharrange{4}{% "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF, - "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A82F, "A840-"ABFF, "FB00-"FE0F, - "FE20-"FE2F, "FE70-"FEFF, "10000-"1FFFF, "E000-"F8FF} % non-Japanese + "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A95F, "A980-"ABFF, "E000-"F8FF, + "FB00-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "10000-"1AFFF, "1B170-"1F0FF, + "1F300-"1FFFF, "2000-"206F} \ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF} \ltjdefcharrange{6}{% "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF, - "4E00-"9FFF, "F900-"FAFF, "FE10-"FE6F, "20000-"2FFFF, "E0100-"E01EF} + "4E00-"9FFF, "F900-"FAFF, "FE10-"FE1F, "FE30-"FE6F, "FF00-"FFEF, + "1B000-"1B16F, "1F100-"1F2FF, "20000-"3FFFF, "E0100-"E01EF} \ltjdefcharrange{7}{% - "1100-"11FF, "2F00-"2FFF, "3100-"31EF, "A000-"A4CF, - "A830-"A83F, "AC00-"D7FF} + "1100-"11FF, "2F00-"2FFF, "3100-"318F, "31A0-"31EF, "A000-"A4CF, + "A960-"A97F, "AC00-"D7FF} \ltjdefcharrange{8}{"A7, "A8, "B0, "B1, "B4, "B6, "D7, "F7} \ltjdefcharrange{9}{% "2018, "2019, "201C, "201D, "2013, "2014, "2025, "2026, "2027, "2E3A} @@ -78,42 +77,112 @@ } \ExplSyntaxOn \RequirePackage { xunicode-addon } -\AtBeginUTFCommand +\AtBeginUTFCommand { \CTEX@beginallalchar } +\AtEndUTFCommand { \CTEX@endallalchar } +\cs_new_protected:Npn \CTEX@beginallalchar { \group_begin: - \lua_now:e { tex.globaldefs = 0 } - \ltj@allalchar - } -\AtEndUTFCommand { \group_end: } -\cs_set_protected:Npn \fontspec_visible_space: - { - \tex_iffontchar:D \tex_font:D "2423 \exp_stop_f: - \ltjalchar "2423 \exp_stop_f: - \else: - \fontspec_visible_space_fallback: - \fi: + \ctex_ltj_zero_globaldefs: + \ltj@allalchar } +\cs_new_protected:Npn \CTEX@endallalchar + { \group_end: } \ctex_at_end_package:nn { listings } + { \RequirePackage { lltjp-listings } } +\group_begin: +\char_set_catcode_space:n { 32 } +\lua_now:e { - \use:x - { - \exp_not:N \RequirePackage { lltjp-listings } - \tl_set:Nn \exp_not:N \lstlistingname - { \exp_not:o { \lstlistingname } } - \tl_set:Nn \exp_not:N \lstlistlistingname - { \exp_not:o { \lstlistlistingname } } - } + local func = lua.get_functions_table() + local ltjfont = luatexja.jfont + local getattribute = tex.getattribute + local set_lua = token.set_lua + local scan_int, scan_arg = token.scan_int, token.scan_argument + local new_luafunction = luatexbase.new_luafunction + local id = new_luafunction("ctex") + func[id] = ltjfont.add_kyenc_list + set_lua("ctex_ltj_add_kyenc:n", id, "global", "protected") + local id = new_luafunction("ctex") + func[id] = ltjfont.is_kenc + set_lua("ctex_ltj_is_kenc:n", id, "global") + local id = new_luafunction("ctex") + func[id] = function () + local s = scan_arg() + local is_braced, is_quoted + if s:sub(1,1) == '{' and s:sub(-1)=='}' then + is_braced = true; s = s:sub(2,-2) + end + if s:sub(1,1) == '"' and s:sub(-1) == '"' then + is_quoted = true; s = s:sub(2,-2) + end + s = s .. ltjfont.print_aftl_address() + if is_braced then s = '{'..s..'}' + elseif is_quoted then s = '"'..s..'"' + end + tex.sprint(-2, s) + end + set_lua("ctex_ltj_patch_external_font:n", id, "global") + local id = new_luafunction("ctex") + func[id] = function () + font.current(getattribute("ltj@curjfnt")) + end + set_lua("ctex_ltj_use_jfont:", id, "global", "protected") + local id = new_luafunction("ctex") + func[id] = function () + local b = tonumber(scan_arg()) + local e = tonumber(scan_arg()) + local alt = scan_arg() + local base = scan_arg() + ltjfont.set_alt_font_latex(b, e, alt, base) + end + set_lua("ctex_ltj_set_alt_font:nnnn", id, "global", "protected") + local id = new_luafunction("ctex") + func[id] = function () + local base = scan_arg() + ltjfont.clear_alt_font_latex(base) + end + set_lua("ctex_ltj_clear_alt_font:n", id, "global", "protected") + local id = new_luafunction("ctex") + func[id] = function () + local base = scan_arg() + local size = scan_arg() + ltjfont.output_alt_font_cmd("y", base) + ltjfont.pickup_alt_font_a(size) + end + set_lua("ctex_ltj_pickup_alt_font:nn", id, "global", "protected") + local id = new_luafunction("ctex") + func[id] = function () + local num = scan_int() + local base = scan_arg() + ltjfont.pickup_alt_font_b(num, base) + end + set_lua("__ctex_ltj_pickup_alt_font:Nn", id, "global", "protected") + local id = new_luafunction("ctex") + func[id] = \LuaTeXjaversion > 20200412.0 + and ltjfont.does_alt_set + or function () + local base = scan_arg() + ltjfont.does_alt_set(base) + end + set_lua("__ctex_ltj_if_alt_set:nT", id, "global") + local id = new_luafunction("ctex") + func[id] = function () + tex.set("globaldefs", 0) + end + set_lua("ctex_ltj_zero_globaldefs:", id, "global", "protected") } -\cs_new_protected_nopar:Npn \ctex_ltj_select_font: +\group_end: +\cs_new_protected:Npn \ctex_ltj_select_font: { - \cs_if_exist_use:cF { \l__ctex_ltj_current_font_tl } + \group_begin: \exp_args:NNc \group_end: + \cs_if_exist_use:NF { \l__ctex_ltj_current_font_tl } { \tl_if_empty:NF \CJK@family { \__ctex_ltj_select_font_aux: } } } \tl_new:N \CJK@family \tl_new:N \l__ctex_ltj_current_font_tl \tl_set:Nn \l__ctex_ltj_current_font_tl { \CJK@encoding / \CJK@family / \f@series / \f@shape / \f@size } -\cs_new_protected_nopar:Npn \__ctex_ltj_select_font_aux: +\cs_new_protected:Npn \__ctex_ltj_select_font_aux: { \group_begin: \tl_set_eq:NN \f@encoding \CJK@encoding @@ -126,14 +195,18 @@ \cs_if_exist:cF { \l__ctex_ltj_current_font_tl } { \__ctex_ltj_select_font_aux: } } -\cs_new_protected_nopar:Npn \__ctex_ltj_push_fontname:n #1 +\cs_new_protected:Npn \__ctex_ltj_push_fontname:n #1 { - \cs_gset_eq:NN \__ctex_ltj_save_fontname:w \font@name + \seq_gpush:No \g__ctex_ltj_fontname_seq { \font@name } \cs_gset_nopar:Npx \font@name {#1} } -\cs_new_protected_nopar:Npn \__ctex_ltj_pop_fontname: - { \cs_gset_eq:NN \font@name \__ctex_ltj_save_fontname:w } -\cs_new_protected_nopar:Npn \ctex_ltj_pickup_font: +\cs_new_protected:Npn \__ctex_ltj_pop_fontname: + { + \seq_gpop:NNT \g__ctex_ltj_fontname_seq \l__ctex_ltj_tmp_tl + { \cs_gset_eq:NN \font@name \l__ctex_ltj_tmp_tl } + } +\seq_new:N \g__ctex_ltj_fontname_seq +\cs_new_protected:Npn \ctex_ltj_pickup_font: { \exp_after:wN \cs_if_exist:NF \font@name { @@ -155,7 +228,7 @@ } \exp_after:wN \globaljfont \font@name \external@font \scan_stop: \font@name - \lua_now:e { font.current(tex.getattribute('ltj@curjfnt')) } + \ctex_ltj_use_jfont: \use:c { \f@encoding + \f@family } \use:c { \curr@fontshape } } @@ -181,53 +254,46 @@ } \prg_new_conditional:Npnn \ctex_ltj_if_alternate_shape_exist:n #1 { T , F , TF } { - \lua_now:e { luatexja.jfont.does_alt_set ('\lua_escape:e {#1}') } - \prg_return_true: \else: \prg_return_false: \fi: + \__ctex_ltj_if_alt_set:nT {#1} { \prg_return_true: \use_none:n } + \prg_return_false: } -\cs_new_nopar:Npn \__ctex_ltj_patch_external_font:w #1 ~ at - { #1 \lua_now:e { luatexja.jfont.print_aftl_address() } ~ at } -\cs_new_protected_nopar:Npn \ctex_ltj_select_alternate_font: +\cs_new:Npn \__ctex_ltj_patch_external_font:w #1 ~ at + { \ctex_ltj_patch_external_font:n {#1} ~ at } +\cs_new_protected:Npn \ctex_ltj_select_alternate_font: { \ctex_ltj_if_alternate_shape_exist:nT { \l__ctex_ltj_current_shape_tl } { - \lua_now:e - { - luatexja.jfont.output_alt_font_cmd - ('y', '\lua_escape:e { \l__ctex_ltj_current_shape_tl }') - } - \lua_now:e { luatexja.jfont.pickup_alt_font_a ('\f@size') } + \ctex_ltj_pickup_alt_font:nn + { \l__ctex_ltj_current_shape_tl } { \f@size } } } \tl_new:N \l__ctex_ltj_current_shape_tl \tl_set:Nn \l__ctex_ltj_current_shape_tl { \CJK@encoding / \CJK@family / \f@series / \f@shape } -\cs_new_protected_nopar:Npn \ltj@pickup@altfont@auxy #1 +\cs_new_protected:Npn \ltj@pickup@altfont@auxy #1 { \cs_if_exist:cF { #1/\f@size } { \group_begin: - \use:x { \exp_not:N \split@name #1 / \f@size } \@nil + \use:e { \exp_not:N \split@name #1 / \f@size } \@nil \__ctex_ltj_push_fontname:n { \use:c { \curr@fontshape / \f@size } } \ctex_ltj_pickup_font: \group_end: \__ctex_ltj_pop_fontname: } } -\cs_new_protected_nopar:Npn \ltj@pickup@altfont@copy #1#2 +\cs_new_protected:Npn \ltj@pickup@altfont@copy #1#2 { \ltj@@getjfontnumber #1 - \lua_now:e - { - luatexja.jfont.pickup_alt_font_b - ( \int_use:N \ltj@tempcntc, '\lua_escape:e {#2}' ) - } + \__ctex_ltj_pickup_alt_font:Nn \ltj@tempcntc {#2} } \cs_new:Npn \ctex_ltj_if_jfont:nTF #1 { - \lua_now:e - { luatexja.jfont.is_kenc( string.match('\lua_escape:e {#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: } +\cs_new:Npn \__ctex_ltj_ltj_if_jfont:w #1 / #2 \q_stop + {#1} \cs_new:Npn \ctex_ltj_if_jfont_math:NTF #1 { \exp_after:wN \__ctex_ltj_if_jfont_math:w \token_to_str:N #1 \q_stop } \group_begin: @@ -235,16 +301,16 @@ \cs_new:Npn \__ctex_ltj_if_jfont_math:w #1 M #2#3 \q_stop { \ctex_ltj_if_jfont:nTF {#3} } \group_end: -\cs_new_protected_nopar:Npn \ctex_ltj_get_and_define_fonts:nN #1#2 +\cs_new_protected:Npn \ctex_ltj_get_and_define_fonts:nN #1#2 { - \ctex_ltj_if_jfont:nTF { \token_to_str:N #2 } + \exp_args:No \ctex_ltj_if_jfont:nTF { \token_to_str:N #2 } { \ctex_ltj_get_and_define_fonts_ja:nN } { \ctex_ltj_get_and_define_fonts_al:nN } {#1} #2 } \cs_new_eq:NN \ctex_ltj_get_and_define_fonts_al:nN \getanddefine@fonts \cs_set_eq:NN \getanddefine@fonts \ctex_ltj_get_and_define_fonts:nN -\cs_new_protected_nopar:Npn \ctex_ltj_get_and_define_fonts_ja:nN #1#2 +\cs_new_protected:Npn \ctex_ltj_get_and_define_fonts_ja:nN #1#2 { \tl_gset:Nx \font@name { \use:c { \token_to_str:N #2 / \tf@size } } \ctex_ltj_pickup_font: \tl_set_eq:NN \textfont@name \font@name @@ -260,7 +326,7 @@ \ltj@@set@stackfont #1 , \font@name \c_colon_str { MJSS } } } -\cs_new_protected_nopar:Npn \ctex_ltj_use_math_group:Nn #1#2 +\cs_new_protected:Npn \ctex_ltj_use_math_group:Nn #1#2 { \mode_if_math:T { @@ -292,14 +358,14 @@ } { \cs_set_eq:NN \use@mathgroup \ctex_ltj_use_math_group:Nn - \cs_set_protected_nopar:Npn \ctex_ltj_math_group_hook: + \cs_set_protected:Npn \ctex_ltj_math_group_hook: { \__um_switchto_literal: } \ctex_ltj_set_math_letter:NN \__um_sym:nnn \__um_input_math_symbol_table: } } -\cs_new_protected_nopar:Npn \ctex_mono_jfm:n #1 +\cs_new_protected:Npn \ctex_mono_jfm:n #1 { \str_if_eq:nnTF {#1} { plain } { \tl_set:Nn \l__ctex_ltj_jfm_tl { mono } } @@ -310,24 +376,22 @@ \ctex_mono_jfm:o { \l__ctex_punct_tl } \tl_const:Nn \CJK@encoding { LTJY3 } \DeclareFontEncoding { \CJK@encoding } { } { } -\use:x +\use:e { \exp_not:N \DeclareFontSubstitution - { \CJK@encoding } { song } { \mddefault } { \updefault } + { \CJK@encoding } { song } { \mddefault } { \shapedefault } } -\lua_now:e { luatexja.jfont.add_kyenc_list('\CJK@encoding') } -\cs_new_protected_nopar:Npn \__ctex_ltj_change_encoding: - { \tl_set_eq:NN \g_fontspec_encoding_tl \CJK@encoding } +\ctex_ltj_add_kyenc:n { \CJK@encoding } \DeclareFontFamily { \CJK@encoding } { song } { } -\DeclareFontShape { \CJK@encoding } { song } { \mddefault } { \updefault } +\DeclareFontShape { \CJK@encoding } { song } { \mddefault } { \shapedefault } { <-> psft:SimSun:cid=Adobe-GB1-5;jfm=\l__ctex_ltj_jfm_tl } { } -\DeclareFontShape { \CJK@encoding } { song } { \bfdefault } { \updefault } +\DeclareFontShape { \CJK@encoding } { song } { \bfdefault } { \shapedefault } { <-> psft:SimHei:cid=Adobe-GB1-5;jfm=\l__ctex_ltj_jfm_tl } { } \tl_const:Nn \c__ctex_ltj_math_tl { CJKmath } \DeclareSymbolFont { \c__ctex_ltj_math_tl } - { \CJK@encoding } { song } { \mddefault } { \updefault } + { \CJK@encoding } { song } { \mddefault } { \shapedefault } \SetSymbolFont { \c__ctex_ltj_math_tl } { bold } - { \CJK@encoding } { song } { \bfdefault } { \updefault } + { \CJK@encoding } { song } { \bfdefault } { \shapedefault } \int_const:Nn \c__ctex_ltj_math_fam_int { \use:c { sym \c__ctex_ltj_math_tl } } \jfam \c__ctex_ltj_math_fam_int \newfontfeature { CID } { cid = #1 } @@ -343,7 +407,7 @@ { \group_begin: \clist_clear:N \l__ctex_ltj_char_range_clist - \seq_clear:N \l__ctex_ltj_alternate_seq + \prop_clear:N \l__ctex_ltj_alternate_prop \tl_set:Nn \l__ctex_ltj_base_CJKfamily_tl {#1} \keys_set_known:nnN { ctex_ltj / fontspec } {#2} \l__ctex_ltj_tmp_tl \clist_set:No \l__ctex_ltj_font_options_clist { \l__ctex_ltj_tmp_tl } @@ -360,15 +424,16 @@ } \tl_new:N \l__ctex_ltj_base_CJKfamily_tl \clist_new:N \l__ctex_ltj_font_options_clist -\cs_new_protected_nopar:Npn \__ctex_ltj_use_global_options:N #1 +\cs_new_protected:Npn \__ctex_ltj_use_global_options:N #1 { \clist_concat:NNN #1 \g__ctex_ltj_default_features_clist #1 - \clist_put_left:Nx #1 { JFM = \l__ctex_ltj_jfm_tl } + \clist_put_left:Nx #1 + { NFSSEncoding = \CJK@encoding , JFM = \l__ctex_ltj_jfm_tl } } \prop_new:N \g__ctex_ltj_family_name_prop \prop_new:N \g__ctex_ltj_family_font_name_prop \prop_new:N \g__ctex_ltj_family_font_options_prop -\cs_new_protected_nopar:Npn \__ctex_ltj_check_family:n #1 +\cs_new_protected:Npn \__ctex_ltj_check_family:n #1 { \prop_gpop:NnNT \g__ctex_ltj_family_font_name_prop {#1} \l__ctex_ltj_tmp_tl { @@ -387,28 +452,24 @@ \tl_new:N \l__ctex_ltj_tmp_tl \msg_new:nnn { ctex } { redefine-family } { Redefining~CJKfamily~`\__ctex_ltj_msg_family_map:n {#1}'~(#2). } -\cs_new_protected_nopar:Npn \__ctex_ltj_gset_family_cs:nn #1#2 +\cs_new_protected:Npn \__ctex_ltj_gset_family_cs:nn #1#2 { - \cs_gset_protected_nopar:cpx { \__ctex_ltj_family_csname:n {#1} } + \cs_gset_protected:cpx { \__ctex_ltj_family_csname:n {#1} } { \group_begin: - \__ctex_ltj_change_encoding: \exp_not:n { \cs_set_eq:NN \CJKfamily \use_none:n } - \exp_not:n { \cs_set_eq:NN \CTEX@fontfamily \use_none:n } - \exp_not:n { \fontspec_set_family:Nnn \g__ctex_ltj_fontspec_family_tl } + \exp_not:n { \fontspec_gset_family:Nnn \g__ctex_ltj_fontspec_family_tl } { \exp_not:o { \l__ctex_ltj_font_options_clist } } {#2} \prop_gput:Nno \exp_not:N \g__ctex_ltj_family_name_prop {#1} { \exp_not:N \g__ctex_ltj_fontspec_family_tl } - \tl_gset_eq:NN \exp_not:N \g__ctex_ltj_fontspec_family_tl - \exp_not:N \g__ctex_ltj_fontspec_family_tl \__ctex_ltj_set_alternate_family:n {#1} \group_end: } } \tl_new:N \l__ctex_ltj_base_family_tl \tl_new:N \g__ctex_ltj_fontspec_family_tl -\cs_new_nopar:Npn \__ctex_ltj_family_csname:n #1 { ctex_ltj/family/#1 } -\cs_new_protected_nopar:Npn \__ctex_ltj_set_alternate_family:n #1 +\cs_new:Npn \__ctex_ltj_family_csname:n #1 { ctex_ltj/family/#1 } +\cs_new_protected:Npn \__ctex_ltj_set_alternate_family:n #1 { \tl_set:Nn \l__ctex_ltj_base_CJKfamily_tl {#1} \tl_set_eq:NN \l__ctex_ltj_base_family_tl \g__ctex_ltj_fontspec_family_tl @@ -418,7 +479,7 @@ \cs_new:Npn \__ctex_ltj_alternate_cs:n #1 { ctex_ltj/alternate_family/#1 } \NewDocumentCommand \CJKfamily { m } { \ctex_ltj_switch_family:x {#1} \tex_ignorespaces:D } -\cs_new_protected_nopar:Npn \ctex_ltj_switch_family:n #1 +\cs_new_protected:Npn \ctex_ltj_switch_family:n #1 { \ctex_ltj_family_if_exist:nNTF {#1} \CJK@family { @@ -443,7 +504,7 @@ } } \prg_generate_conditional_variant:Nnn \ctex_ltj_family_if_exist:nN { x } { T , F , TF } -\cs_new_protected_nopar:Npn \__ctex_ltj_family_unknown_warning:n #1 +\cs_new_protected:Npn \__ctex_ltj_family_unknown_warning:n #1 { \prop_if_empty:NF \g__ctex_ltj_family_font_name_prop { @@ -460,7 +521,7 @@ Unknown~CJK~family~`\__ctex_ltj_msg_family_map:n {#1}'~is~being~ignored.\\ Try~to~use~`\__ctex_ltj_msg_def_family_map:n {#1}'~to~define~it. } -\cs_new_nopar:Npn \__ctex_ltj_msg_def_family_map:n #1 +\cs_new:Npn \__ctex_ltj_msg_def_family_map:n #1 { \str_case_e:nnF {#1} { @@ -471,7 +532,7 @@ { \token_to_str:N \setCJKfamilyfont \{ #1 \} } [...]\{...\} } -\cs_new_nopar:Npn \__ctex_ltj_msg_family_map:n #1 +\cs_new:Npn \__ctex_ltj_msg_family_map:n #1 { \str_case_e:nnF {#1} { @@ -481,21 +542,21 @@ } {#1} } -\cs_new_protected_nopar:Npn \ctex_ltj_fontspec:nn #1#2 +\cs_new_protected:Npn \ctex_ltj_fontspec:nn #1#2 { \prop_get:NnNTF \g__ctex_ltj_fontspec_prop { CJKfontspec/#1/#2/id } \l_ctex_ltj_family_tl { \ctex_ltj_switch_family:x { \l_ctex_ltj_family_tl } } { \int_gincr:N \g__ctex_ltj_family_int - \__ctex_ltj_fontspec:xnn + \__ctex_ltj_fontspec:enn { CJKfontspec ( \int_use:N \g__ctex_ltj_family_int ) } {#1} {#2} } } -\cs_new_protected_nopar:Npn \ctex_ltj_fontspec:xx #1#2 - { \use:x { \ctex_ltj_fontspec:nn {#1} {#2} } } -\cs_new_protected_nopar:Npn \__ctex_ltj_fontspec:nnn #1#2#3 +\cs_new_protected:Npn \ctex_ltj_fontspec:ee #1#2 + { \use:e { \ctex_ltj_fontspec:nn {#1} {#2} } } +\cs_new_protected:Npn \__ctex_ltj_fontspec:nnn #1#2#3 { \bool_if:NT \l__ctex_ltj_add_alternate_bool { @@ -515,11 +576,11 @@ \ctex_ltj_set_family:nnn {#1} {#2} {#3} \ctex_ltj_switch_family:n {#1} } -\cs_generate_variant:Nn \__ctex_ltj_fontspec:nnn { x } +\cs_generate_variant:Nn \__ctex_ltj_fontspec:nnn { e } \prop_new:N \g__ctex_ltj_fontspec_prop -\cs_new_protected_nopar:Npn \ctex_ltj_add_font_features:n #1 +\cs_new_protected:Npn \ctex_ltj_add_font_features:n #1 { \ctex_ltj_add_font_features:xn { \l_ctex_ltj_family_tl } {#1} } -\cs_new_protected_nopar:Npn \ctex_ltj_add_font_features:nn #1#2 +\cs_new_protected:Npn \ctex_ltj_add_font_features:nn #1#2 { \prop_get:NnNTF \g__ctex_ltj_family_font_name_prop {#1} \l__ctex_ltj_tmp_tl @@ -528,7 +589,7 @@ {#1} \l__ctex_ltj_font_options_clist \clist_put_right:Nn \l__ctex_ltj_font_options_clist {#2} \bool_set_true:N \l__ctex_ltj_add_alternate_bool - \ctex_ltj_fontspec:xx + \ctex_ltj_fontspec:ee { \exp_not:o { \l__ctex_ltj_font_options_clist } } { \exp_not:o { \l__ctex_ltj_tmp_tl } } } @@ -544,16 +605,16 @@ } \cs_new_protected:Npn \__ctex_ltj_pass_args:nnnn #1#2#3#4 { - \IfNoValueTF {#2} + \tl_if_novalue:nTF {#2} { \__ctex_ltj_post_arg:w {#1} {#3} {#4} } { - \use:x { #1 {#2} {#3} } + \use:e { #1 {#2} {#3} } #4 } } \NewDocumentCommand \__ctex_ltj_post_arg:w { m m m O { } } { - \use:x { #1 {#4} {#2} } + \use:e { #1 {#4} {#2} } #3 } \NewDocumentCommand \setCJKfamilyfont { m o m } @@ -565,8 +626,8 @@ \NewDocumentCommand \newCJKfontfamily { o m o m } { \tl_set:Nx \l__ctex_ltj_tmp_tl - { \IfNoValueTF {#1} { \cs_to_str:N #2 } {#1} } - \cs_new_protected_nopar:Npx #2 + { \tl_if_novalue:nTF {#1} { \cs_to_str:N #2 } {#1} } + \cs_new_protected:Npx #2 { \ctex_ltj_switch_family:n { \l__ctex_ltj_tmp_tl } } \__ctex_ltj_pass_args:nnnn { \ctex_ltj_set_family:nnn { \l__ctex_ltj_tmp_tl } } {#3} {#4} @@ -623,29 +684,12 @@ \tl_if_exist:NF \CJKrmdefault { \tl_const:Nn \CJKrmdefault { rm } } \tl_if_exist:NF \CJKsfdefault { \tl_const:Nn \CJKsfdefault { sf } } \tl_if_exist:NF \CJKttdefault { \tl_const:Nn \CJKttdefault { tt } } -\RenewDocumentCommand \fontfamily { m } - { - \tl_set:Nx \f@family {#1} - \CTEX@fontfamily {#1} - } -\cs_new_protected_nopar:Npn \CTEX@fontfamily #1 - { - \str_if_eq:nnTF {#1} { \familydefault } - { \CJKfamily { \CJKfamilydefault } } - { \__ctex_ltj_update_family_aux: } - } -\cs_new_protected_nopar:Npn \__ctex_ltj_update_family_aux: - { - \str_case_e:nn { \f@family } - { - { \rmdefault } { \CJKfamily { \CJKrmdefault } } - { \sfdefault } { \CJKfamily { \CJKsfdefault } } - { \ttdefault } { \CJKfamily { \CJKttdefault } } - { \familydefault } { \CJKfamily { \CJKfamilydefault } } - } - } +\g@addto@macro \@rmfamilyhook { \CJKfamily { \CJKrmdefault } } +\g@addto@macro \@sffamilyhook { \CJKfamily { \CJKsfdefault } } +\g@addto@macro \@ttfamilyhook { \CJKfamily { \CJKttdefault } } +\g@addto@macro \@defaultfamilyhook { \CJKfamily { \CJKfamilydefault } } \ctex_at_end_preamble:n { \ctex_update_default_family: } -\cs_new_protected_nopar:Npn \ctex_ltj_ensure_default_family: +\cs_new_protected:Npn \ctex_ltj_ensure_default_family: { \prop_if_empty:NF \g__ctex_ltj_family_font_name_prop { @@ -670,7 +714,7 @@ \ctex_ltj_update_mathfont: } } -\cs_new_protected_nopar:Npn \ctex_ltj_update_mathfont: +\cs_new_protected:Npn \ctex_ltj_update_mathfont: { \ctex_ltj_family_if_exist:xNTF { \c__ctex_ltj_math_tl } \l__ctex_ltj_tmp_tl { \ctex_ltj_update_mathfont:n { \l__ctex_ltj_tmp_tl } } @@ -679,91 +723,93 @@ { \ctex_ltj_update_mathfont:n { \l__ctex_ltj_tmp_tl } } } } -\cs_new_protected_nopar:Npn \ctex_ltj_update_mathfont:n #1 +\cs_new_protected:Npn \ctex_ltj_update_mathfont:n #1 { \tl_const:Nx \c__ctex_ltj_math_family_tl {#1} \DeclareSymbolFont { \c__ctex_ltj_math_tl } { \CJK@encoding } - { \c__ctex_ltj_math_family_tl } { \mddefault } { \updefault } + { \c__ctex_ltj_math_family_tl } { \mddefault } { \shapedefault } \cs_if_free:cTF - { \CJK@encoding/\c__ctex_ltj_math_family_tl/\bfdefault/\updefault } + { \CJK@encoding/\c__ctex_ltj_math_family_tl/\bfdefault/\shapedefault } { \SetSymbolFont { \c__ctex_ltj_math_tl } { bold } { \CJK@encoding } - { \c__ctex_ltj_math_family_tl } { \mddefault } { \updefault } + { \c__ctex_ltj_math_family_tl } { \mddefault } { \shapedefault } } { \SetSymbolFont { \c__ctex_ltj_math_tl } { bold } { \CJK@encoding } - { \c__ctex_ltj_math_family_tl } { \bfdefault } { \updefault } + { \c__ctex_ltj_math_family_tl } { \bfdefault } { \shapedefault } } } \keys_define:nn { ctex_ltj / fontspec } { - AlternateFont .code:n = \ctex_ltj_set_alternate_seq:n {#1} , + AlternateFont .code:n = \ctex_ltj_set_alternate_prop:n {#1} , AlternateFont .value_required:n = true , CharRange .clist_set:N = \l__ctex_ltj_char_range_clist , CharRange .value_required:n = true } -\group_begin: - \char_set_catcode_other:N \| - \cs_set:Npn \__ctex_ltj_tmp:w #1 - { - \cs_new_protected:Npn \ctex_ltj_set_alternate_seq:n ##1 - { - \clist_if_empty:NT \l__ctex_ltj_char_range_clist - { - \tl_set:Nn \l__ctex_ltj_tmp_tl { ##1 } - \tl_replace_all:Nnn \l__ctex_ltj_tmp_tl {#1} { || } - \seq_set_split:NnV \l__ctex_ltj_tmp_seq { || } \l__ctex_ltj_tmp_tl - \seq_set_filter:NNn \l__ctex_ltj_tmp_seq \l__ctex_ltj_tmp_seq - { ! \tl_if_blank_p:n { ####1 } } - \seq_concat:NNN \l__ctex_ltj_alternate_seq - \l__ctex_ltj_alternate_seq \l__ctex_ltj_tmp_seq - } - } - } - \char_set_catcode_active:N \| - \__ctex_ltj_tmp:w { || } -\group_end: -\seq_new:N \l__ctex_ltj_tmp_seq -\seq_new:N \l__ctex_ltj_alternate_seq -\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:nnF #1#2#3 +\cs_new_protected:Npn \ctex_ltj_set_alternate_prop:n #1 + { \clist_map_function:nN {#1} \__ctex_ltj_push_alternate_prop:n } +\cs_new_protected:Npn \__ctex_ltj_push_alternate_prop:n #1 + { + \clist_set:Nx \l__ctex_ltj_tmp_clist { \tl_head:n {#1} } + \tl_remove_all:Nn \l__ctex_ltj_tmp_clist { ~ } + \exp_args:No \__ctex_ltj_push_alternate_prop:nn + { \l__ctex_ltj_tmp_clist } {#1} + } +\cs_new_protected:Npn \__ctex_ltj_push_alternate_prop:nn #1 + { + \prop_remove:Nn \l__ctex_ltj_alternate_prop {#1} + \prop_put:Nnn \l__ctex_ltj_alternate_prop {#1} + } +\clist_new:N \l__ctex_ltj_tmp_clist +\prop_new:N \l__ctex_ltj_alternate_prop +\cs_new_protected:Npn \ctex_ltj_set_alternate_family:nnF { \clist_if_empty:NTF \l__ctex_ltj_char_range_clist - { - \__ctex_ltj_check_family:n {#1} - \seq_if_empty:NF \l__ctex_ltj_alternate_seq - { \ctex_ltj_save_alternate_seq:cn { \__ctex_ltj_alternate_cs:n {#1} } {#2} } - #3 - } - { \ctex_ltj_set_alternate_family:nn {#1} {#2} } + { \__ctex_ltj_set_family_aux:nnn } + { \__ctex_ltj_set_alternate_family_aux:nnn } } -\cs_new_protected_nopar:Npn \ctex_ltj_save_alternate_seq:Nn #1#2 +\cs_new_protected:Npn \__ctex_ltj_set_family_aux:nnn #1#2#3 { - \seq_map_inline:Nn \l__ctex_ltj_alternate_seq - { \ctex_ltj_save_alternate_seq:Nnnwnw #1 {#2} ##1 { } \q_stop } + \__ctex_ltj_check_family:n {#1} + \prop_if_empty:NF \l__ctex_ltj_alternate_prop + { \ctex_ltj_save_alternate_seq:cn { \__ctex_ltj_alternate_cs:n {#1} } {#2} } + #3 } -\cs_generate_variant:Nn \ctex_ltj_save_alternate_seq:Nn { c } -\NewDocumentCommand \ctex_ltj_save_alternate_seq:Nnnwnw - { m m m +O{ } m u{ \q_stop } } +\cs_new_protected:Npn \__ctex_ltj_set_alternate_family_aux:nnn #1#2#3 + { \ctex_ltj_set_alternate_family:nn {#1} {#2} } +\cs_new_protected:Npn \ctex_ltj_save_alternate_seq:Nn #1#2 + { + \prop_map_inline:Nn \l__ctex_ltj_alternate_prop + { \__ctex_ltj_save_alternate_auxi:w ##2 { } \q_mark #1 {#2} } + } +\cs_new_protected:Npn \__ctex_ltj_save_alternate_auxi:w #1#2# { - \clist_set:Nn \l__ctex_ltj_char_range_clist {#3} - \clist_set:Nn \l__ctex_ltj_alternate_options_clist {#4} + \tl_if_blank:nTF {#2} + { \__ctex_ltj_save_alternate_auxii:w {#1} } + { \__ctex_ltj_save_alternate_auxii:w {#1} {#2} } + } +\cs_new_protected:Npn \__ctex_ltj_save_alternate_auxii:w #1#2#3 #4 \q_mark #5#6 + { + \clist_set:Nn \l__ctex_ltj_char_range_clist {#1} + \clist_set:Nn \l__ctex_ltj_alternate_options_clist {#3} \__ctex_ltj_use_global_options:N \l__ctex_ltj_alternate_options_clist - \tl_if_blank:nTF {#5} - { \tl_set:Nn \l__ctex_ltj_tmp_tl {#2} } + \tl_if_blank:nTF {#2} + { \tl_set:Nn \l__ctex_ltj_tmp_tl {#6} } { - \tl_set:Nn \l__ctex_ltj_tmp_tl {#5} - \tl_replace_all:Nnn \l__ctex_ltj_tmp_tl { * } {#2} + \tl_set:Nx \l__ctex_ltj_tmp_tl { \tl_trim_spaces:n {#2} } + \tl_replace_all:Nnn \l__ctex_ltj_tmp_tl { * } {#6} } - \use:x + \use:e { - \ctex_ltj_save_alternate_family:Nnnn \exp_not:N #1 + \ctex_ltj_save_alternate_family:Nnnn \exp_not:N #5 { \exp_not:o { \l__ctex_ltj_char_range_clist } } { \exp_not:o { \l__ctex_ltj_alternate_options_clist } } { \exp_not:o { \l__ctex_ltj_tmp_tl } } } } \clist_new:N \l__ctex_ltj_alternate_options_clist -\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:nn #1#2 +\cs_generate_variant:Nn \ctex_ltj_save_alternate_seq:Nn { c } +\cs_new_protected:Npn \ctex_ltj_set_alternate_family:nn #1#2 { \__ctex_ltj_update_family_uid:N \l__ctex_ltj_font_options_clist \__ctex_ltj_use_global_options:N \l__ctex_ltj_font_options_clist @@ -772,23 +818,22 @@ { \l__ctex_ltj_char_range_clist } { \l__ctex_ltj_font_options_clist } {#2} {#1} } -\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:Nnnnn #1#2#3#4#5 +\cs_new_protected:Npn \ctex_ltj_set_alternate_family:Nnnnn #1#2#3#4#5 { \prop_get:NnNT \g__ctex_ltj_family_name_prop {#5} \l__ctex_ltj_base_family_tl { \ctex_ltj_set_alternate_family:nnn {#2} {#3} {#4} } \ctex_ltj_save_alternate_family:Nnnn #1 {#2} {#3} {#4} } \cs_generate_variant:Nn \ctex_ltj_set_alternate_family:Nnnnn { coo } -\cs_new_protected_nopar:Npn \ctex_ltj_save_alternate_family:Nnnn #1#2#3#4 +\cs_new_protected:Npn \ctex_ltj_save_alternate_family:Nnnn #1#2#3#4 { \cs_if_exist:NF #1 { \cs_set_eq:NN #1 \prg_do_nothing: } - \cs_gset_protected_nopar:Npx #1 + \cs_gset_protected:Npx #1 { \exp_not:o { #1 \ctex_ltj_set_alternate_family:nnn {#2} {#3} {#4} } } } -\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_family:nnn #1#2#3 +\cs_new_protected:Npn \ctex_ltj_set_alternate_family:nnn #1#2#3 { \group_begin: - \__ctex_ltj_change_encoding: \cs_set_eq:NN \CJKfamily \use_none:n \ctex_ltj_swap_cs:NN \DeclareFontShape@ \ctex_ltj_declare_alternate_shape:nnnnnn @@ -805,7 +850,7 @@ \cs_undefine:N \__ctex_ltj_tmp:w } \keys_define:nn { fontspec } { LTJFONTUID .code:n = } -\cs_new_protected_nopar:Npn \__ctex_ltj_update_family_uid:N #1 +\cs_new_protected:Npn \__ctex_ltj_update_family_uid:N #1 { \int_gincr:N \g__ctex_ltj_family_int \clist_put_right:Nx #1 { LTJFONTUID = \int_use:N \g__ctex_ltj_family_int } @@ -815,10 +860,9 @@ { \ctex_ltj_declare_alternate_shape:nnnnnn {#1} {#2} {#3} {#4} {#5} {#6} \ctex_ltj_set_alternate_shape:Nnnnnnn \l__ctex_ltj_char_range_clist - { \l__ctex_ltj_base_family_tl } {#3} {#4} - { \l_fontspec_family_tl } {#3} {#4} + { \l__ctex_ltj_base_family_tl } {#3} {#4} {#2} {#3} {#4} } -\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:Nnnnnnn #1#2#3#4#5#6#7 +\cs_new_protected:Npn \ctex_ltj_set_alternate_shape:Nnnnnnn #1#2#3#4#5#6#7 { \clist_map_inline:Nn #1 { @@ -829,73 +873,67 @@ } { \ctex_ltj_set_alternate_shape:nnn { #2/#3/#4 } { #5/#6/#7 } { ##1 } } } - \__ctex_ltj_save_alternate_shape:cnn + \__ctex_ltj_save_alternate_shape:cn { \__ctex_ltj_alternate_cs:n { clear / \l__ctex_ltj_base_CJKfamily_tl } } - { luatexja.jfont.clear_alt_font_latex } - { '\lua_escape:e { \CJK@encoding/#2/#3/#4 }' } + { \ctex_ltj_clear_alt_font:n { \CJK@encoding/#2/#3/#4 } } } \NewDocumentCommand \ctex_ltj_set_alternate_shape:nnn { m m > { \SplitArgument { 1 } { -> } } m } { \ctex_ltj_set_alternate_shape:nnnn {#1} {#2} #3 } -\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:nnnn #1#2#3#4 +\cs_new_protected:Npn \ctex_ltj_set_alternate_shape:nnnn #1#2#3#4 { - \ctex_ltj_set_alternate_shape:n + \ctex_ltj_set_alternate_shape:e { - \IfNoValueTF {#4} - { \int_eval:n {#3} , \int_eval:n {#3} , } - { - \int_eval:n { \tl_if_blank:nTF {#3} { "80 } {#3} } , - \int_eval:n { \tl_if_blank:nTF {#4} { "10FFFF } {#4} } , - } - '\lua_escape:e { \CJK@encoding/#2 }' , - '\lua_escape:e { \CJK@encoding/#1 }' + \__ctex_ltj_range_normalization:nn {#3} {#4} + { \CJK@encoding / \exp_not:n {#2} } + { \CJK@encoding / \exp_not:n {#1} } } } -\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:n #1 +\cs_new_protected:Npn \ctex_ltj_set_alternate_shape:n #1 { - \lua_now:e { luatexja.jfont.set_alt_font_latex ( #1 ) } - \__ctex_ltj_save_alternate_shape:cnn + \ctex_ltj_set_alt_font:nnnn #1 + \__ctex_ltj_save_alternate_shape:cn { \__ctex_ltj_alternate_cs:n { reset / \l__ctex_ltj_base_CJKfamily_tl } } - { luatexja.jfont.set_alt_font_latex } {#1} + { \ctex_ltj_set_alt_font:nnnn #1 } } -\cs_new_protected_nopar:Npn \ctex_ltj_set_alternate_shape:nnN #1#2#3 +\cs_generate_variant:Nn \ctex_ltj_set_alternate_shape:n { e } +\cs_new_protected:Npn \ctex_ltj_set_alternate_shape:nnN #1#2#3 { \tl_map_inline:Nn #3 { \ctex_ltj_set_alternate_shape:n { - ##1 , - '\lua_escape:e { \CJK@encoding/#2 }' , - '\lua_escape:e { \CJK@encoding/#1 }' + ##1 + { \CJK@encoding/#2 } + { \CJK@encoding/#1 } } } } -\cs_new_protected_nopar:Npn \__ctex_ltj_save_alternate_shape:Nnn #1#2#3 +\cs_new_protected:Npn \__ctex_ltj_save_alternate_shape:Nn #1#2 { \group_begin: - \cs_if_exist:NF #1 { \cs_set_eq:NN #1 \prg_do_nothing: } - \cs_set_eq:NN \l__ctex_ltj_base_family_tl \scan_stop: - \cs_set_eq:NN \lua_escape:e \scan_stop: - \cs_gset_protected_nopar:Npx #1 - { \exp_not:o {#1} \exp_not:N \lua_now:e { #2 ( #3 ) } } + \cs_if_exist:NF #1 { \cs_set_eq:NN #1 \prg_do_nothing: } + \cs_set_eq:NN \l__ctex_ltj_base_family_tl \scan_stop: + \cs_gset_protected:Npx #1 { \exp_not:o {#1} #2 } \group_end: } -\cs_generate_variant:Nn \__ctex_ltj_save_alternate_shape:Nnn { c } -\keys_define:nn { ctex } +\cs_generate_variant:Nn \__ctex_ltj_save_alternate_shape:Nn { c } +\ctex_define:n { clearalternatefont .code:n = - { \clist_map_function:xN {#1} \ctex_ltj_clear_alternate_font:n } , + { \clist_map_function:eN {#1} \ctex_ltj_clear_alternate_font:n } , resetalternatefont .code:n = - { \clist_map_function:xN {#1} \ctex_ltj_reset_alternate_font:n } , + { \clist_map_function:eN {#1} \ctex_ltj_reset_alternate_font:n } , clearalternatefont .default:n = \l_ctex_ltj_family_tl , resetalternatefont .default:n = \l_ctex_ltj_family_tl } -\cs_new_protected_nopar:Npn \ctex_ltj_clear_alternate_font:n #1 +\cs_new_protected:Npn \ctex_ltj_clear_alternate_font:n #1 { \group_begin: \ctex_ltj_family_if_exist:xNTF {#1} \l__ctex_ltj_base_family_tl { - \cs_if_exist_use:cT { \__ctex_ltj_alternate_cs:n { clear / #1 } } + \cs_if_exist_use:cT + { \__ctex_ltj_alternate_cs:n { clear / #1 } } { \prop_gput:Nno \g__ctex_ltj_reset_alternate_prop {#1} { \l__ctex_ltj_base_family_tl } @@ -906,7 +944,7 @@ { \__ctex_ltj_family_unknown_warning:n {#1} } \group_end: } -\cs_new_protected_nopar:Npn \ctex_ltj_reset_alternate_font:n #1 +\cs_new_protected:Npn \ctex_ltj_reset_alternate_font:n #1 { \group_begin: \prop_gpop:NnNT \g__ctex_ltj_reset_alternate_prop {#1} \CJK@family @@ -918,18 +956,18 @@ \group_end: } \prop_new:N \g__ctex_ltj_reset_alternate_prop -\cs_generate_variant:Nn \clist_map_function:nN { x } -\keys_define:nn { ctex } +\cs_generate_variant:Nn \clist_map_function:nN { e } +\ctex_define:n { - declarecharrange .code:n = \ctex_ltj_declare_char_range:x {#1} , + declarecharrange .code:n = \ctex_ltj_declare_char_range:e {#1} , declarecharrange .value_required:n = true } -\cs_new_protected_nopar:Npn \ctex_ltj_declare_char_range:n #1 +\cs_new_protected:Npn \ctex_ltj_declare_char_range:n #1 { \clist_map_inline:nn {#1} { \__ctex_ltj_declare_char_range:nn ##1 } } -\cs_generate_variant:Nn \ctex_ltj_declare_char_range:n { x } -\cs_new_protected_nopar:Npn \__ctex_ltj_declare_char_range:nn #1#2 - { \use:x { \ctex_ltj_declare_char_range:nn { \tl_trim_spaces:n {#1} } } {#2} } -\cs_new_protected_nopar:Npn \ctex_ltj_declare_char_range:nn #1#2 +\cs_generate_variant:Nn \ctex_ltj_declare_char_range:n { e } +\cs_new_protected:Npn \__ctex_ltj_declare_char_range:nn #1 + { \exp_args:Ne \ctex_ltj_declare_char_range:nn { \tl_trim_spaces:n {#1} } } +\cs_new_protected:Npn \ctex_ltj_declare_char_range:nn #1#2 { \tl_clear:N \l__ctex_ltj_char_range_tl \clist_map_function:nN {#2} \ctex_ltj_save_char_range:n @@ -942,19 +980,26 @@ \NewDocumentCommand \ctex_ltj_save_char_range:n { > { \SplitArgument { 1 } { -> } } m } { \ctex_ltj_save_char_range:nn #1 } -\cs_new_protected_nopar:Npn \ctex_ltj_save_char_range:nn #1#2 +\cs_new_protected:Npn \ctex_ltj_save_char_range:nn #1#2 { \tl_put_right:Nx \l__ctex_ltj_char_range_tl - { { - \IfNoValueTF {#2} - { \int_eval:n {#1} , \int_eval:n {#1} } - { - \int_eval:n { \tl_if_blank:nTF {#1} { "80 } {#1} } , - \int_eval:n { \tl_if_blank:nTF {#2} { "10FFFF } {#2} } - } - } } + { { \__ctex_ltj_range_normalization:nn {#1} {#2} } } + } +\cs_new:Npn \__ctex_ltj_range_normalization:nn #1#2 + { + \tl_if_novalue:nTF {#2} + { + { \int_eval:n {#1} } + { \int_eval:n {#1} } + } + { + { \int_eval:n { \tl_if_blank:nTF {#1} { \c__ctex_ltj_range_min_int } {#1} } } + { \int_eval:n { \tl_if_blank:nTF {#2} { \c__ctex_ltj_range_max_int } {#2} } } + } } -\cs_new_protected_nopar:Npn \ctex_ltj_def_char_range_key:n #1 +\int_const:Nn \c__ctex_ltj_range_min_int { "80 } +\int_const:Nn \c__ctex_ltj_range_max_int { \c_max_char_int } +\cs_new_protected:Npn \ctex_ltj_def_char_range_key:n #1 { \keys_if_exist:nnF { ctex_ltj / fontspec } {#1} { @@ -965,28 +1010,8 @@ \cs_new_protected:Npn \ctex_ltj_char_range_key:nn #1#2 { \tl_if_blank:nTF {#2} - { \tl_set:Nn \l__ctex_ltj_char_range_clist {#1} } - { - \clist_if_empty:NT \l__ctex_ltj_char_range_clist - { - \tl_set:Nn \l__ctex_ltj_tmp_tl { {#1} } - \__ctex_ltj_char_range_parse_feature:w #2 \q_stop - } - } - } -\NewDocumentCommand \__ctex_ltj_char_range_parse_feature:w - { +o o u { \q_stop } } - { - \exp_args:NNf \tl_put_right:Nn \l__ctex_ltj_tmp_tl - { - \IfNoValueTF {#1} { {#3} } - { - \IfNoValueTF {#2} - { \tl_if_blank:nTF {#3} { { [#1] } } { [ {#1} ] {#3} } } - { [ {#1} ] { [#2] } } - } - } - \seq_put_right:No \l__ctex_ltj_alternate_seq { \l__ctex_ltj_tmp_tl } + { \clist_set:Nn \l__ctex_ltj_char_range_clist {#1} } + { \__ctex_ltj_push_alternate_prop:nn {#1} { {#1} #2 } } } \AtBeginDocument { @@ -996,14 +1021,14 @@ { } { \ctex_patch_failure:N \verbatim@font } } -\cs_new_protected_nopar:Npn \CTEX@verbatim@font@hook +\cs_new_protected:Npn \CTEX@verbatim@font@hook { \ltjsetparameter { autospacing = false , autoxspacing = false } } \cs_set_eq:NN \@@italiccorr \/ -\cs_new_protected_nopar:Npn \ctex_ltj_set_kanjiskip:N +\cs_new_protected:Npn \ctex_ltj_set_kanjiskip:N { \ltj@setpar@global \ltjsetkanjiskip } -\cs_new_protected_nopar:Npn \ctex_ltj_set_xkanjiskip:N +\cs_new_protected:Npn \ctex_ltj_set_xkanjiskip:N { \ltj@setpar@global \ltjsetxkanjiskip } -\cs_new_protected_nopar:Npn \ctex_update_default_family: +\cs_new_protected:Npn \ctex_update_default_family: { \tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl { @@ -1031,35 +1056,11 @@ { \exp_not:o { \CJKfamilydefault } } } \tl_gset_eq:NN \CJKfamilydefault \l__ctex_family_default_init_tl -\cs_new_protected_nopar:Npn \ctex_detected_platform: - { - \tl_gset:Nx \g__ctex_fontset_tl - { - \lua_now:e - { - if ~ os.name == 'windows' then ~ - tex.sprint ( 'windows' ) - elseif ~ os.name == 'macosx' then ~ - tex.sprint ( 'mac' ) - else ~ - tex.sprint ( 'fandol' ) - end - } - } - } \ctex_hypersetup:n { pdfencoding = unicode } -\msg_new:nnn { ctex } { fntef-not-available } - { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ LuaLaTeX. } -\msg_warning:nn { ctex } { fntef-not-available } -\clist_map_inline:nn - { underdot , underline , underdblline , underwave , sout , xout } - { \cs_new_eq:cN { CTEX#1 } \use:n } -\cs_new_eq:NN \CTEXfilltwosides \use_none:n -\cs_new_eq:NN \endCTEXfilltwosides \prg_do_nothing: -\cs_new_protected_nopar:Npn \ctex_update_ccwd: +\cs_new_protected:Npn \ctex_update_ccwd: { \skip_set:Nn \ccwd { \ltjgetparameter { kanjiskip } + \zw } } \dim_new:N \ccwd -\cs_new_protected_nopar:Npn \ctex_update_ccglue: +\cs_new_protected:Npn \ctex_update_ccglue: { \ctex_ltj_set_kanjiskip:N \l__ctex_ccglue_skip } \skip_new:N \l__ctex_ccglue_skip \prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF } @@ -1067,11 +1068,11 @@ \skip_if_eq:nnTF { \l__ctex_ccglue_skip } { \ltjgetparameter { kanjiskip } } { \prg_return_false: } { \prg_return_true: } } -\cs_new_protected_nopar:Npn \ctex_update_em_unit: +\cs_new_protected:Npn \ctex_update_em_unit: { \dim_set:Nn \ccwd { \zw } } \cs_new_protected:Npn \ctex_add_to_selectfont:n #1 { - \cs_set_protected_nopar:Npx \CTEX@selectfont@hook + \cs_set_protected:Npx \CTEX@selectfont@hook { \exp_not:o { \CTEX@selectfont@hook #1 } } } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: @@ -1081,10 +1082,15 @@ { \tl_set:Nn \l__ctex_tmp_tl {#1} \cs_new_eq:NN \CTEX@selectfont@save #1 - \cs_new_protected_nopar:Npn \__ctex_restore_selectfont: + \cs_new_protected:Npn \__ctex_restore_selectfont: { + \cs_if_free:NF \scr@new@selectfont + { + \cs_set_eq:NN \scr@new@selectfont #1 + \cs_set_eq:NN \CTEX@selectfont@save \scr@selectfont + } \tl_put_left:Nn \@EverySelectfont@Init - { \let #1 \CTEX@selectfont@save } + { \cs_set_eq:NN #1 \CTEX@selectfont@save } \cs_undefine:N \__ctex_restore_selectfont: } } @@ -1105,7 +1111,7 @@ } \tl_set:Nn \CJK@family { song } \selectfont \tl_clear:N \CJK@family -\cs_new_protected_nopar:Npn \ctex_update_xkanjiskip: +\cs_new_protected:Npn \ctex_update_xkanjiskip: { \skip_if_eq:nnT { \ltjgetparameter { xkanjiskip } } { \l__ctex_xkanjiskip_skip } @@ -1124,44 +1130,42 @@ \dim_new:N \cht \dim_new:N \cdp \dim_new:N \cwd -\newluafunction \g__ctex_kanjisize_func \group_begin: \char_set_catcode_space:n { 32 } \lua_now:e { local nulltable = { } - local t = lua.get_functions_table() local fmt = luatexja.jfont.font_metric_table local getattribute = tex.getattribute local setdimen = tex.setdimen - t[\int_use:N \g__ctex_kanjisize_func] = function () - local ft = fmt[getattribute('ltj@curjfnt')] or nulltable + local func = lua.get_functions_table() + local id = luatexbase.new_luafunction("ctex") + func[id] = function () + local ft = fmt[getattribute("ltj@curjfnt")] or nulltable local ft = ft and ft.char_type or nulltable local fk = ft and ft[0] or nulltable - setdimen('cht', fk.height or 0) - setdimen('cdp', fk.depth or 0) - setdimen('cwd', fk.width or ft.zw or 0) + setdimen("cht", fk.height or 0) + setdimen("cdp", fk.depth or 0) + setdimen("cwd", fk.width or ft.zw or 0) end + token.set_lua("ctex_update_kanjisize:", id, "global", "protected") } \group_end: -\cs_new_protected_nopar:Npn \ctex_update_kanjisize: - { \tex_luafunction:D \g__ctex_kanjisize_func } \ctex_add_to_selectfont:n { \ctex_update_kanjisize: } -\keys_define:nn { ctex } +\ctex_define:n { space .code:n = { \msg_warning:nn { ctex } { invalid-option } } } -\keys_define:nn { ctex } +\ctex_define:n { punct .code:n = { - \tl_set:Nx \l__ctex_punct_tl { #1 } + \tl_set:Nx \l__ctex_punct_tl {#1} \ctex_mono_jfm:o { \l__ctex_punct_tl } } , punct .default:n = { quanjiao } , } -\tl_set:Nn \l__ctex_encoding_tl { UTF8 } %% %% %% End of file `ctex-engine-luatex.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def index 04b47108953..e447c91fff9 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-pdftex.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `pdftex') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,26 +20,31 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {(pdf)LaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-pdftex.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1 + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\cs_new_protected:Npn \ctex_set_zhmap:n + { \tl_gput_right:Nx \g__ctex_zhmap_tl } +\cs_new_protected:Npn \ctex_use_zhmap: + { \tl_use:N \g__ctex_zhmap_tl } +\cs_new_protected:Npn \ctex_add_dvi_zhmap: + { \AtBeginDvi { \ctex_use_zhmap: } } +\ctex_after_end_preamble:n { \ctex_add_dvi_zhmap: } +\ctex_at_end_package:nn { atbegshi } { - \AtBeginDvi {#1} - \ctex_at_end_package:nn { atbegshi } - { \AtBeginShipoutFirst {#1} } + \AtBeginShipoutFirst { \ctex_use_zhmap: } + \cs_gset_eq:NN \ctex_add_dvi_zhmap: \prg_do_nothing: } +\tl_new:N \g__ctex_zhmap_tl \@onlypreamble \ctex_set_zhmap:n \seq_const_from_clist:Nn \c__ctex_cmap_encoding_seq { C19 , C10 , C00 , C09 , C40 , C60 } -\cs_new_protected_nopar:Npn \ctex_family_cmap:nn #1#2 +\cs_new_protected:Npn \ctex_family_cmap:nn #1#2 { \cs_if_free:cF { #1 + #2 } { @@ -49,22 +54,22 @@ } \cs_generate_variant:Nn \ctex_family_cmap:nn { x } \cs_new_eq:NN \CTEX@Family@CMap \ctex_family_cmap:xn -\cs_new_protected_nopar:Npn \ctex_add_cmap:n #1 +\cs_new_protected:Npn \ctex_add_cmap:n #1 { \cs_if_free:NF \CJK@plane { \ctex_add_cmap:cn { __ctex_add_cmap_ #1 \CJK@plane : } {#1} } } -\cs_new_protected_nopar:Npn \ctex_add_cmap:Nn #1#2 +\cs_new_protected:Npn \ctex_add_cmap:Nn #1#2 { \cs_if_exist:NF #1 { \__ctex_save_cmap:Nn #1 {#2} } #1 } \cs_generate_variant:Nn \ctex_add_cmap:Nn { c } -\cs_new_protected_nopar:Npn \__ctex_save_cmap:Nn #1#2 +\cs_new_protected:Npn \__ctex_save_cmap:Nn #1#2 { - \tl_set:Nx \l__ctex_tmp_tl { \str_lower_case:n {#2} \CJK@plane } + \tl_set:Nx \l__ctex_tmp_tl { \str_lowercase:n {#2} \CJK@plane } \tex_immediate:D \tex_pdfobj:D stream ~ file { \l__ctex_tmp_tl .cmap } - \cs_new_protected_nopar:Npx #1 + \cs_new_protected:Npx #1 { \exp_not:N \tex_pdffontattr:D \exp_not:N \tex_font:D { /ToUnicode ~ \int_use:N \tex_pdflastobj:D \c_space_tl 0 ~ R } @@ -85,14 +90,14 @@ } { \group_end: } \if_bool:N \g__ctex_zhmCJK_bool - \PassOptionsToPackage { encoding = \l__ctex_encoding_tl } { zhmCJK } + \PassOptionsToPackage { encoding = \g__ctex_encoding_tl } { zhmCJK } \RequirePackage { zhmCJK } \else: - \str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + \str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \RequirePackage { CJK } } { \RequirePackage { CJKutf8 } } \RequirePackage { CJKpunct , CJKspace } - \cs_new_protected_nopar:Npn \ctex_load_zhmap:nnnn #1#2#3#4 + \cs_new_protected:Npn \ctex_load_zhmap:nnnn #1#2#3#4 { \tl_set:Nn \CJKrmdefault {#1} \tl_set:Nn \CJKsfdefault {#2} @@ -100,7 +105,7 @@ \ctex_set_zhmap:n { \ctex_zhmap_input:n {#4} } } \@onlypreamble \ctex_load_zhmap:nnnn - \cs_new_protected_nopar:Npn \ctex_zhmap_input:n #1 + \cs_new_protected:Npn \ctex_zhmap_input:n #1 { \ctex_file_wrapper:nnn { @@ -118,24 +123,12 @@ \tl_if_exist:NF \CJKrmdefault { \tl_new:N \CJKrmdefault } \tl_if_exist:NF \CJKsfdefault { \tl_new:N \CJKsfdefault } \tl_if_exist:NF \CJKttdefault { \tl_new:N \CJKttdefault } - \ctex_preto_cmd:NnnTF \rmfamily { \ExplSyntaxOff } - { \CJKfamily { \CJKrmdefault } } - { } - { \ctex_patch_failure:N \rmfamily } - \ctex_preto_cmd:NnnTF \sffamily { \ExplSyntaxOff } - { \CJKfamily { \CJKsfdefault } } - { } - { \ctex_patch_failure:N \sffamily } - \ctex_preto_cmd:NnnTF \ttfamily { \ExplSyntaxOff } - { \CJKfamily { \CJKttdefault } } - { } - { \ctex_patch_failure:N \ttfamily } - \ctex_preto_cmd:NnnTF \normalfont { \ExplSyntaxOff } - { \CJKfamily { \CJKfamilydefault } } - { \cs_set_eq:NN \reset@font \normalfont } - { \ctex_patch_failure:N \normalfont } + \g@addto@macro \@rmfamilyhook { \CJKfamily { \CJKrmdefault } } + \g@addto@macro \@sffamilyhook { \CJKfamily { \CJKsfdefault } } + \g@addto@macro \@ttfamilyhook { \CJKfamily { \CJKttdefault } } + \g@addto@macro \@defaultfamilyhook { \CJKfamily { \CJKfamilydefault } } \fi: -\cs_new_protected_nopar:Npn \ctex_CJK_input:n #1 +\cs_new_protected:Npn \ctex_CJK_input:n #1 { \ctex_file_wrapper:nnn { @@ -152,7 +145,7 @@ } \cs_set_eq:NN \CJK@input \ctex_CJK_input:n \if_cs_exist:N \CJK@surr - \cs_new_protected_nopar:Npn \ctex_plane_to_utfxvibe:Nn #1#2 + \cs_new_protected:Npn \ctex_plane_to_utfxvibe:Nn #1#2 { \tl_set:Nx \l__ctex_tmp_tl {#2} \int_set:Nn \l__ctex_tmp_int @@ -179,7 +172,7 @@ } \ctex_at_end_preamble:n { \ctex_update_default_family: } \reverse_if:N \if_bool:N \g__ctex_zhmCJK_bool - \str_if_eq:onF { \l__ctex_encoding_tl } { UTF8 } + \str_if_eq:onF { \g__ctex_encoding_tl } { UTF8 } { \CJK@makeActive \CJK@loadBinding { standard } @@ -187,21 +180,21 @@ \exp_args:Nx \ctex_at_end_preamble:n { \exp_not:N \CJK@envStart - { } { \l__ctex_encoding_tl } { \exp_not:N \CJKfamilydefault } + { } { \g__ctex_encoding_tl } { \exp_not:N \CJKfamilydefault } \exp_not:N \CJKtilde } \fi: \cs_new_eq:NN \ctex_auto_ignorespaces: \CJK@@ignorespaces -\cs_new_protected_nopar:Npn \ctex_ignorespaces_case:N #1 +\cs_new_protected:Npn \ctex_ignorespaces_case:N #1 { - \cs_set_protected_nopar:Npn \ctex_set_ignorespaces: + \cs_set_protected:Npn \ctex_set_ignorespaces: { \cs_set_eq:NN \CJK@ignorespaces #1 } \ctex_set_ignorespaces: } -\cs_new_protected_nopar:Npn \ctex_set_ignorespaces: +\cs_new_protected:Npn \ctex_set_ignorespaces: { \cs_set_eq:NN \CJK@ignorespaces \ctex_auto_ignorespaces: } \ctex_gadd_hook:Nn \CJKhook { \ctex_set_ignorespaces: } -\cs_new_protected_nopar:Npn \ctex_punct_set:n #1 +\cs_new_protected:Npn \ctex_punct_set:n #1 { \clist_map_inline:Nn \c__ctex_punct_family_clist { @@ -218,12 +211,12 @@ zhsong , zhhei , zhfs , zhkai , zhli , zhyou , zhsongb , zhheil , zhheib , zhyoub , zhyahei , zhyaheib } -\cs_new_protected_nopar:Npn \ctex_punct_map_family:nn #1#2 +\cs_new_protected:Npn \ctex_punct_map_family:nn #1#2 { \cs_if_free:cF { CJKpunct@ #2 @spaces } { \cs_set_eq:cc { CJKpunct@ #1 @spaces } { CJKpunct@ #2 @spaces } } } -\cs_new_protected_nopar:Npn \ctex_punct_map_bfseries:nn #1#2 +\cs_new_protected:Npn \ctex_punct_map_bfseries:nn #1#2 { \clist_map_inline:nn {#1} { @@ -231,7 +224,7 @@ \ctex_punct_map_series:nnn { ##1 } { bx } {#2} } } -\cs_new_protected_nopar:Npn \ctex_punct_map_series:nnn #1#2#3 +\cs_new_protected:Npn \ctex_punct_map_series:nnn #1#2#3 { \CJKpunctmapfamily { C19 } {#1} {#2} { m } {#3} \CJKpunctmapfamily { C19 } {#1} {#2} { it } {#3} @@ -240,7 +233,7 @@ \CJKpunctmapfamily { C70 } {#1} {#2} { it } {#3} \CJKpunctmapfamily { C70 } {#1} {#2} { sl } {#3} } -\cs_new_protected_nopar:Npn \ctex_punct_map_itshape:nn #1#2 +\cs_new_protected:Npn \ctex_punct_map_itshape:nn #1#2 { \CJKpunctmapfamily { C19 } {#1} { m } { it } {#2} \CJKpunctmapfamily { C19 } {#1} { b } { it } {#2} @@ -249,11 +242,11 @@ \CJKpunctmapfamily { C70 } {#1} { b } { it } {#2} \CJKpunctmapfamily { C70 } {#1} { bx } { it } {#2} } -\cs_new_protected_nopar:Npn \ctex_punct_space:nn #1#2 +\cs_new_protected:Npn \ctex_punct_space:nn #1#2 { \tl_const:cn { c__ctex_ #1 _punct_spaces_tl } {#2} } \cs_new_eq:NN \ctexspadef \ctex_punct_space:nn \ctex_file_input:n { ctexspa.def } -\cs_new_protected_nopar:Npn \ctex_update_default_family: +\cs_new_protected:Npn \ctex_update_default_family: { \tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl { @@ -280,31 +273,8 @@ { \exp_not:o { \CJKfamilydefault } } } \tl_gset_eq:NN \CJKfamilydefault \l__ctex_family_default_init_tl -\cs_new_protected_nopar:Npn \ctex_detected_platform: - { - \file_if_exist:nTF { /dev/null } - { - \file_if_exist:nTF { nul: } - { - \file_if_exist:nTF { \c__ctex_upper_case_file_str } - { \ctex_if_macosx:TF { mac } { windows } } - { \ctex_if_macosx:TF { mac } { fandol } } - } - { \ctex_if_macosx:TF { mac } { fandol } } - } - { \tl_gset:Nn \g__ctex_fontset_tl { windows } } - } -\str_const:Nx \c__ctex_upper_case_file_str - { \exp_args:No \str_upper_case:n { \g_file_curr_name_str } } -\cs_new_protected_nopar:Npn \ctex_if_macosx:TF #1#2 - { - \file_if_exist:nTF { \c__ctex_macosx_file_str } - { \tl_gset:Nn \g__ctex_fontset_tl {#1} } - { \tl_gset:Nn \g__ctex_fontset_tl {#2} } - } -\str_const:Nn \c__ctex_macosx_file_str { /Library/Fonts/Songti.ttc } \ctex_hypersetup:n { driverfallback = dvipdfmx } -\str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } +\str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \ctex_hypersetup:n { CJKbookmarks = true } \sys_if_output_pdf:TF @@ -322,49 +292,24 @@ } } { \ctex_hypersetup:n { pdfencoding = unicode } } -\RequirePackage { CJKfntef } -\normalem -\cs_new_protected_nopar:Npn \__ctex_clear_fntef_color:n #1 - { \tl_clear:c { CJK#1color } } -\clist_map_inline:nn - { underdot , underline , underdblline , underwave , sout , xout } +\ctex_at_end_package:nn { CJKfntef } { - \__ctex_clear_fntef_color:n {#1} - \cs_new_protected_nopar:cpx { CTEX#1 } - { - \msg_warning:nnnn { ctex } { deprecated-command } { \exp_not:c { CTEX#1 } } - { You~ can~ use~ the~ command~ with~ prefix~ \exp_not:N \CJK~ instead. } - \exp_not:c { CJK#1 } - } - } -\cs_new_protected_nopar:Npn { \CTEXfilltwosides } - { - \msg_warning:nnnn { ctex } { deprecated-environment } { CTEXfilltwosides } - { You~ can~ use~ `CJKfilltwosides'~ environment~ instead. } - \CJKfilltwosides - } -\cs_new_protected_nopar:Npn { \endCTEXfilltwosides } { \endCJKfilltwosides } -\clist_map_inline:nn - { - underdotbasesep , underdotsep , underlinebasesep , - underlinesep , underdbllinesep , underdbllinebasesep , - underwavebasesep , underwavesep , southeight , - underdotcolor , underwavecolor , underlinecolor , - underdbllinecolor , soutcolor , xoutcolor + \normalem + \cs_new_protected:Npn \__ctex_clear_fntef_color:n #1 + { \tl_clear:c { CJK#1color } } + \clist_map_inline:nn + { underdot , underline , underdblline , underwave , sout , xout } + { \__ctex_clear_fntef_color:n {#1} } } - { - \cs_new_eq:cc { CTEX#1 } { CJK#1 } - \cs_set_nopar:cpx { CJK#1 } { \exp_not:c { CTEX#1 } } - } -\cs_new_protected_nopar:Npn \ctex_update_ccwd: +\cs_new_protected:Npn \ctex_update_ccwd: { \hbox_set:Nn \l__ctex_tmp_box { \CJKglue } \dim_set:Nn \ccwd { \box_wd:N \l__ctex_tmp_box + \f@size \p@ } } \dim_new:N \ccwd -\cs_new_protected_nopar:Npn \ctex_update_ccglue: +\cs_new_protected:Npn \ctex_update_ccglue: { - \cs_set_protected_nopar:Npn \CJKglue + \cs_set_protected:Npn \CJKglue { \skip_horizontal:N \l__ctex_ccglue_skip } } \skip_new:N \l__ctex_ccglue_skip @@ -374,11 +319,11 @@ \prg_return_false: \else: \prg_return_true: \fi: } \ctex_at_end:n { \cs_new_eq:NN \__ctex_ccglue: \CJKglue } -\cs_new_protected_nopar:Npn \ctex_update_em_unit: +\cs_new_protected:Npn \ctex_update_em_unit: { \dim_set:Nn \ccwd { \f@size \p@ } } \cs_new_protected:Npn \ctex_add_to_selectfont:n #1 { - \cs_set_protected_nopar:Npx \CTEX@selectfont@hook + \cs_set_protected:Npx \CTEX@selectfont@hook { \exp_not:o { \CTEX@selectfont@hook #1 } } } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: @@ -388,10 +333,17 @@ { \tl_set:Nn \l__ctex_tmp_tl {#1} \cs_new_eq:NN \CTEX@selectfont@save #1 - \cs_new_protected_nopar:Npn \__ctex_restore_selectfont: + \cs_new_protected:Npn \__ctex_restore_selectfont: { + \cs_if_free:NF \scr@new@selectfont + { + \cs_if_free:NF \par@update + { \tl_put_right:Nn #1 { \par@update } } + \cs_set_eq:NN \scr@selectfont \CTEX@selectfont@save + \cs_set_eq:NN \scr@new@selectfont #1 + } \tl_put_left:Nn \@EverySelectfont@Init - { \let #1 \CTEX@selectfont@save } + { \cs_set_eq:NN #1 \CTEX@selectfont@save } \cs_undefine:N \__ctex_restore_selectfont: } } @@ -405,7 +357,7 @@ { \ctex_patch_failure:N \selectfont } \fi: \EverySelectfont { \cs_if_exist:NF \CJK@plane { \CTEX@selectfont@hook } } -\keys_define:nn { ctex } +\ctex_define:n { space .choice: , space / true .code:n = @@ -417,11 +369,11 @@ space .default:n = { true } , space .initial:n = { auto } } -\keys_define:nn { ctex } +\ctex_define:n { punct .code:n = { - \tl_set:Nx \l__ctex_punct_tl { #1 } + \tl_set:Nx \l__ctex_punct_tl {#1} \punctstyle { \l__ctex_punct_tl } } , punct .default:n = { quanjiao } , diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def index 0ef4edfae63..7f24ee2da25 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-uptex.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `uptex') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,57 +20,42 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {upTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-uptex.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\cs_new_protected_nopar:Npn \ctex_set_zhmap:n #1 - { - \AtBeginDvi {#1} - \ctex_at_end_package:nn { atbegshi } - { \AtBeginShipoutFirst {#1} } - } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\cs_new_protected:Npn \ctex_set_zhmap:n + { \tl_gput_right:Nx \g__ctex_zhmap_tl } +\cs_new_protected:Npn \ctex_use_zhmap: + { \tl_use:N \g__ctex_zhmap_tl } +\cs_new_protected:Npn \ctex_add_dvi_zhmap: + { \AtBeginDvi { \ctex_use_zhmap: } } +\ctex_after_end_preamble:n { \ctex_add_dvi_zhmap: } +\ctex_at_end_package:nn { atbegshi } + { + \AtBeginShipoutFirst { \ctex_use_zhmap: } + \cs_gset_eq:NN \ctex_add_dvi_zhmap: \prg_do_nothing: + } +\tl_new:N \g__ctex_zhmap_tl \@onlypreamble \ctex_set_zhmap:n -\tl_set:Nn \CJKrmdefault { zhrm } -\tl_set:Nn \CJKsfdefault { zhsf } -\tl_set:Nn \CJKttdefault { zhtt } -\tl_set:Nn \CJKfamilydefault { \CJKrmdefault } +\tl_if_exist:NF \CJKfamilydefault + { \tl_const:Nn \CJKfamilydefault { \CJKrmdefault } } +\tl_if_exist:NF \CJKrmdefault { \tl_const:Nn \CJKrmdefault { zhrm } } +\tl_if_exist:NF \CJKsfdefault { \tl_const:Nn \CJKsfdefault { zhsf } } +\tl_if_exist:NF \CJKttdefault { \tl_const:Nn \CJKttdefault { zhtt } } \tl_set:Nn \kanjifamilydefault { \CJKfamilydefault } -\RenewDocumentCommand \rmfamily { } - { - \not@math@alphabet \rmfamily \mathrm - \romanfamily \rmdefault - \kanjifamily \CJKrmdefault - \selectfont - } -\RenewDocumentCommand \sffamily { } - { - \not@math@alphabet \sffamily \mathsf - \romanfamily \sfdefault - \kanjifamily \CJKsfdefault - \selectfont - } -\RenewDocumentCommand \ttfamily { } - { - \not@math@alphabet \ttfamily \mathtt - \romanfamily \ttdefault - \kanjifamily \CJKttdefault - \selectfont - } +\g@addto@macro \@rmfamilyhook { \kanjifamily { \CJKrmdefault } } +\g@addto@macro \@sffamilyhook { \kanjifamily { \CJKsfdefault } } +\g@addto@macro \@ttfamilyhook { \kanjifamily { \CJKttdefault } } \NewDocumentCommand \CJKfamily { m } - { - \kanjifamily {#1} - \selectfont - } -\DeclareErrorKanjiFont{JY2}{zhrm}{m}{n}{10} -\DeclareKanjiSubstitution{JY2}{zhrm}{m}{n} -\DeclareKanjiSubstitution{JT2}{zhrm}{m}{n} + { \kanjifamily {#1} \selectfont } +\DeclareErrorKanjiFont {JY2}{zhrm}{m}{n}{10} +\DeclareKanjiSubstitution {JY2}{zhrm}{m}{n} +\DeclareKanjiSubstitution {JT2}{zhrm}{m}{n} \DeclareSymbolFont{mincho}{JY2}{zhrm}{m}{n} \SetSymbolFont{mincho}{bold}{JY2}{zhrm}{bx}{n} \jfam \symmincho @@ -87,43 +72,59 @@ { \eminnershape \else \itshape } } \cs_set_nopar:Npn \eminnershape { \upshape } -\cs_new_protected_nopar:Npn \ctex_set_upfamily:nnn #1 #2 #3 +\cs_new_protected:Npn \ctex_set_upfamily:nnn #1#2#3 { \DeclareKanjiFamily{JY2}{#1}{} \DeclareKanjiFamily{JT2}{#1}{} \DeclareFontShape{JY2}{#1}{m}{n}{<->~ #2-h}{} \DeclareFontShape{JT2}{#1}{m}{n}{<->~ #2-v}{} - \tl_if_empty:nF { #3 } + \tl_if_empty:nF {#3} { + \DeclareFontShape{JY2}{#1}{b}{n}{<->~ #3-h}{} + \DeclareFontShape{JT2}{#1}{b}{n}{<->~ #3-v}{} \DeclareFontShape{JY2}{#1}{bx}{n}{<->~ #3-h}{} \DeclareFontShape{JT2}{#1}{bx}{n}{<->~ #3-v}{} } } -\@onlypreamble \ctex_set_upfamily:nnn -\cs_new_protected_nopar:Npn \ctex_set_upmap:nnn #1 #2 #3 +\cs_new_protected:Npn \ctex_set_upmap:nnn #1#2#3 { \ctex_set_zhmap:n { - \special{ pdf:mapline~ #1-h~ UniGB-UTF16-H~ #2 } - \special{ pdf:mapline~ #1-v~ UniGB-UTF16-V~ #2 } - \tl_if_empty:nF { #3 } + \special { pdf:mapline~#1-h~UniGB-UTF16-H~#2 } + \special { pdf:mapline~#1-v~UniGB-UTF16-V~#2 } + \tl_if_empty:nF {#3} { - \special{ pdf:mapline~ #1b-h~ UniGB-UTF16-H~ #3 } - \special{ pdf:mapline~ #1b-v~ UniGB-UTF16-V~ #3 } + \special { pdf:mapline~#1b-h~UniGB-UTF16-H~#3 } + \special { pdf:mapline~#1b-v~UniGB-UTF16-V~#3 } } } } -\@onlypreamble \ctex_set_upmap:nnn -\cs_new_protected_nopar:Npn \ctex_set_upfonts:nnnnnn #1 #2 #3 #4 #5 #6 +\cs_new_protected:Npn \ctex_set_upmap_unicode:nnn #1#2#3 + { + \ctex_set_zhmap:n + { + \special { pdf:mapline~#1-h~unicode~#2 } + \special { pdf:mapline~#1-v~unicode~#2 } + \tl_if_empty:nF {#3} + { + \special { pdf:mapline~#1b-h~unicode~#3 } + \special { pdf:mapline~#1b-v~unicode~#3 } + } + } + } +\cs_new_protected:Npn \ctex_set_upfonts:nnnnnn #1#2#3#4#5#6 { - \ctex_set_upmap:nnn { upserif } { #1 } { #2 } - \ctex_set_upmap:nnn { upserifit } { #3 } {} - \ctex_set_upmap:nnn { upsans } { #4 } { #5 } - \ctex_set_upmap:nnn { upmono } { #6 } {} + \ctex_set_upmap:nnn { upserif } {#1} {#2} + \ctex_set_upmap:nnn { upserifit } {#3} {} + \ctex_set_upmap:nnn { upsans } {#4} {#5} + \ctex_set_upmap:nnn { upmono } {#6} {} } +\@onlypreamble \ctex_set_upfamily:nnn +\@onlypreamble \ctex_set_upmap:nnn +\@onlypreamble \ctex_set_upmap_unicode:nnn \@onlypreamble \ctex_set_upfonts:nnnnnn \RequirePackage { pxeverysel } -\cs_new_protected_nopar:Npn \ctex_update_default_family: +\cs_new_protected:Npn \ctex_update_default_family: { \tl_if_eq:NNT \CJKfamilydefault \l__ctex_family_default_init_tl { @@ -150,44 +151,13 @@ { \exp_not:o { \CJKfamilydefault } } } \tl_gset_eq:NN \CJKfamilydefault \l__ctex_family_default_init_tl -\cs_new_protected_nopar:Npn \ctex_detected_platform: - { - \file_if_exist:nTF { /dev/null } - { - \file_if_exist:nTF { nul: } - { - \file_if_exist:nTF { \c__ctex_upper_case_file_str } - { \ctex_if_macosx:TF { mac } { windows } } - { \ctex_if_macosx:TF { mac } { fandol } } - } - { \ctex_if_macosx:TF { mac } { fandol } } - } - { \tl_gset:Nn \g__ctex_fontset_tl { windows } } - } -\str_const:Nx \c__ctex_upper_case_file_str - { \exp_args:No \str_upper_case:n { \g_file_curr_name_str } } -\cs_new_protected_nopar:Npn \ctex_if_macosx:TF #1#2 - { - \file_if_exist:nTF { \c__ctex_macosx_file_str } - { \tl_gset:Nn \g__ctex_fontset_tl {#1} } - { \tl_gset:Nn \g__ctex_fontset_tl {#2} } - } -\str_const:Nn \c__ctex_macosx_file_str { /Library/Fonts/Songti.ttc } \ctex_hypersetup:n { driverfallback = dvipdfmx } \ctex_at_end_package:nn { hyperref } - { \AtBeginShipoutFirst { \special { pdf:tounicode~ UTF8-UTF16 } } } -\msg_new:nnn { ctex } { fntef-not-available } - { Functions~ of~ `CJKfntef'~ is~ not~ available~ in~ upLaTeX. } -\msg_warning:nn { ctex } { fntef-not-available } -\clist_map_inline:nn - { underdot , underline , underdblline , underwave , sout , xout } - { \cs_new_eq:cN { CTEX#1 } \use:n } -\cs_new_eq:NN \CTEXfilltwosides \use_none:n -\cs_new_eq:NN \endCTEXfilltwosides \prg_do_nothing: -\cs_new_protected_nopar:Npn \ctex_update_ccwd: + { \AtBeginShipoutFirst { \special { pdf:tounicode~UTF8-UTF16 } } } +\cs_new_protected:Npn \ctex_update_ccwd: { \skip_set:Nn \ccwd { 1zw + \tex_kanjiskip:D } } \dim_new:N \ccwd -\cs_new_protected_nopar:Npn \ctex_update_ccglue: +\cs_new_protected:Npn \ctex_update_ccglue: { \skip_set_eq:NN \tex_kanjiskip:D \l__ctex_ccglue_skip } \skip_new:N \l__ctex_ccglue_skip \prg_new_conditional:Npnn \ctex_if_ccglue_touched: { TF } @@ -195,11 +165,11 @@ \skip_if_eq:nnTF { \l__ctex_ccglue_skip } { \tex_kanjiskip:D } { \prg_return_false: } { \prg_return_true: } } -\cs_new_protected_nopar:Npn \ctex_update_em_unit: +\cs_new_protected:Npn \ctex_update_em_unit: { \dim_set:Nn \ccwd { 1zw } } \cs_new_protected:Npn \ctex_add_to_selectfont:n #1 { - \cs_set_protected_nopar:Npx \CTEX@selectfont@hook + \cs_set_protected:Npx \CTEX@selectfont@hook { \exp_not:o { \CTEX@selectfont@hook #1 } } } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: @@ -209,10 +179,20 @@ { \tl_set:Nn \l__ctex_tmp_tl {#1} \cs_new_eq:NN \CTEX@selectfont@save #1 - \cs_new_protected_nopar:Npn \__ctex_restore_selectfont: + \cs_new_protected:Npn \__ctex_restore_selectfont: { + \cs_if_free:NF \scr@new@selectfont + { + \cs_if_free:NF \par@update + { + \tl_put_right:Nn \@EverySelectfont@Init + { \tl_put_right:Nn #1 { \par@update } } + } + \cs_set_eq:NN \scr@new@selectfont #1 + \cs_set_eq:NN \CTEX@selectfont@save \scr@selectfont + } \tl_put_left:Nn \@EverySelectfont@Init - { \let #1 \CTEX@selectfont@save } + { \cs_set_eq:NN #1 \CTEX@selectfont@save } \cs_undefine:N \__ctex_restore_selectfont: } } @@ -226,7 +206,7 @@ { \ctex_patch_failure:N \selectfont } \fi: \EverySelectfont { \CTEX@selectfont@hook } -\cs_new_protected_nopar:Npn \ctex_update_xkanjiskip: +\cs_new_protected:Npn \ctex_update_xkanjiskip: { \skip_if_eq:nnT { \tex_xkanjiskip:D } { \l__ctex_xkanjiskip_skip } @@ -242,21 +222,20 @@ \skip_set:Nn \l__ctex_xkanjiskip_skip { \tex_xkanjiskip:D } \ctex_add_to_selectfont:n { \ctex_update_xkanjiskip: } -\keys_define:nn { ctex } +\ctex_define:n { space .code:n = { \msg_warning:nn { ctex } { invalid-option } } } -\keys_define:nn { ctex } +\ctex_define:n { punct .code:n = { - \tl_set:Nx \l__ctex_punct_tl { #1 } + \tl_set:Nx \l__ctex_punct_tl {#1} \msg_warning:nn { ctex } { invalid-option } } , punct .default:n = { quanjiao } , } -\tl_set:Nn \l__ctex_encoding_tl { UTF8 } %% %% %% End of file `ctex-engine-uptex.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def index 3b3752a9bca..26435410903 100644 --- a/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def +++ b/Master/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `xetex') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {XeLaTeX adapter (CTEX)} \ProvidesExplFile{ctex-engine-xetex.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \RequirePackage { xeCJK } \exp_args:Nx \xeCJKsetup { @@ -38,67 +36,31 @@ } \@ifpackagelater { fontspec } { 2014/05/25 } { } { \msg_error:nnn { ctex } { package-too-old } { fontspec } } -\cs_new_protected_nopar:Npn \ctex_detected_platform: +\ctex_hypersetup:n { pdfencoding = unicode } +\ctex_at_end_package:nn { xeCJKfntef } { - \file_if_exist:nTF { /dev/null } + \@ifpackagelater { xeCJKfntef } { 2014/11/04 } { - \file_if_exist:nTF { nul: } - { - \file_if_exist:nTF { \c__ctex_upper_case_file_str } - { \ctex_if_macosx:TF { mac } { windows } } - { \ctex_if_macosx:TF { mac } { fandol } } - } - { \ctex_if_macosx:TF { mac } { fandol } } + \cs_new_protected:Npn \__ctex_clear_fntef_color:n #1 + { \xeCJKsetup { #1 / format = { } } } } - { \tl_gset:Nn \g__ctex_fontset_tl { windows } } - } -\str_const:Nx \c__ctex_upper_case_file_str - { \exp_args:No \str_upper_case:n { \g_file_curr_name_str } } -\cs_new_protected_nopar:Npn \ctex_if_macosx:TF #1#2 - { - \file_if_exist:nTF { \c__ctex_macosx_file_str } - { \tl_gset:Nn \g__ctex_fontset_tl {#1} } - { \tl_gset:Nn \g__ctex_fontset_tl {#2} } - } -\str_const:Nn \c__ctex_macosx_file_str { /Library/Fonts/Songti.ttc } -\ctex_hypersetup:n { pdfencoding = unicode } -\RequirePackage { xeCJKfntef } -\@ifpackagelater { xeCJKfntef } { 2014/11/04 } - { - \cs_new_protected_nopar:Npn \__ctex_clear_fntef_color:n #1 - { \xeCJKsetup { #1 / format = { } } } - } - { - \cs_new_protected_nopar:Npn \__ctex_clear_fntef_color:n #1 - { \tl_clear:c { CJK#1color } } - } -\clist_map_inline:nn - { underdot , underline , underdblline , underwave , sout , xout } - { - \__ctex_clear_fntef_color:n {#1} - \cs_new_protected_nopar:cpx { CTEX#1 } { - \msg_warning:nnnn { ctex } { deprecated-command } { \exp_not:c { CTEX#1 } } - { You~ can~ use~ the~ command~ with~ prefix~ \exp_not:N \CJK~ instead. } - \exp_not:c { CJK#1 } + \cs_new_protected:Npn \__ctex_clear_fntef_color:n #1 + { \tl_clear:c { CJK#1color } } } + \clist_map_inline:nn + { underdot , underline , underdblline , underwave , sout , xout } + { \__ctex_clear_fntef_color:n {#1} } } -\cs_new_protected_nopar:Npn { \CTEXfilltwosides } - { - \msg_warning:nnnn { ctex } { deprecated-environment } { CTEXfilltwosides } - { You~ can~ use~ `CJKfilltwosides'~ environment~ instead. } - \CJKfilltwosides - } -\cs_new_protected_nopar:Npn { \endCTEXfilltwosides } { \endCJKfilltwosides } -\cs_new_protected_nopar:Npn \ctex_update_ccwd: +\cs_new_protected:Npn \ctex_update_ccwd: { \hbox_set:Nn \l__ctex_tmp_box { \CJKglue } \dim_set:Nn \ccwd { \box_wd:N \l__ctex_tmp_box + \f@size \p@ } } \dim_new:N \ccwd -\cs_new_protected_nopar:Npn \ctex_update_ccglue: +\cs_new_protected:Npn \ctex_update_ccglue: { - \cs_set_protected_nopar:Npn \CJKglue + \cs_set_protected:Npn \CJKglue { \skip_horizontal:N \l__ctex_ccglue_skip } } \skip_new:N \l__ctex_ccglue_skip @@ -108,11 +70,11 @@ \prg_return_false: \else: \prg_return_true: \fi: } \ctex_at_end:n { \cs_new_eq:NN \__ctex_ccglue: \CJKglue } -\cs_new_protected_nopar:Npn \ctex_update_em_unit: +\cs_new_protected:Npn \ctex_update_em_unit: { \dim_set:Nn \ccwd { \f@size \p@ } } \cs_new_protected:Npn \ctex_add_to_selectfont:n #1 { - \cs_set_protected_nopar:Npx \CTEX@selectfont@hook + \cs_set_protected:Npx \CTEX@selectfont@hook { \exp_not:o { \CTEX@selectfont@hook #1 } } } \cs_new_eq:NN \CTEX@selectfont@hook \prg_do_nothing: @@ -122,10 +84,15 @@ { \tl_set:Nn \l__ctex_tmp_tl {#1} \cs_new_eq:NN \CTEX@selectfont@save #1 - \cs_new_protected_nopar:Npn \__ctex_restore_selectfont: + \cs_new_protected:Npn \__ctex_restore_selectfont: { + \cs_if_free:NF \scr@new@selectfont + { + \cs_set_eq:NN \scr@new@selectfont #1 + \cs_set_eq:NN \CTEX@selectfont@save \scr@selectfont + } \tl_put_left:Nn \@EverySelectfont@Init - { \let #1 \CTEX@selectfont@save } + { \cs_set_eq:NN #1 \CTEX@selectfont@save } \cs_undefine:N \__ctex_restore_selectfont: } } @@ -139,7 +106,7 @@ { \ctex_patch_failure:N \selectfont } \fi: \EverySelectfont { \CTEX@selectfont@hook } -\keys_define:nn { ctex } +\ctex_define:n { space .choice: , space / true .code:n = @@ -151,16 +118,15 @@ space .default:n = { true } , space .initial:n = { auto } } -\keys_define:nn { ctex } +\ctex_define:n { punct .code:n = { - \tl_set:Nx \l__ctex_punct_tl { #1 } + \tl_set:Nx \l__ctex_punct_tl {#1} \xeCJKsetup { PunctStyle = \l__ctex_punct_tl } } , punct .default:n = { quanjiao } , } -\tl_set:Nn \l__ctex_encoding_tl { UTF8 } %% %% %% End of file `ctex-engine-xetex.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd b/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd index f61163a9e2a..0ca6dc60295 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c19rm.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,rm,c19') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{c19rm.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd b/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd index 69ed84c3cf2..f83711edfb0 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c19sf.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,sf,c19') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{c19sf.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd b/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd index 7fa18f73d53..8c506eadec4 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c19tt.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,tt,c19') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{c19tt.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd b/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd index d6b677a68e1..66664982e7f 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c70rm.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,rm,c70') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{c70rm.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd b/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd index 5ef3fa5e676..6b989c6ff8f 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c70sf.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,sf,c70') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{c70sf.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd b/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd index a2096c243fa..fc43c692198 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/c70tt.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,tt,c70') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{c70tt.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] %% %% Chinese characters %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/jt2zhrm.fd b/Master/texmf-dist/tex/latex/ctex/fd/jt2zhrm.fd index b4f3d7264d0..0b9838bc423 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/jt2zhrm.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/jt2zhrm.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,rm,jt2') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,16 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{jt2zhrm.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] \DeclareKanjiFamily{JT2}{zhrm}{} \DeclareFontShape{JT2}{zhrm}{m}{n}{<-> upzhserif-v}{} \DeclareFontShape{JT2}{zhrm}{m}{it}{<-> upzhserifit-v}{} +\DeclareFontShape{JT2}{zhrm}{b}{n}{<-> upzhserifb-v}{} \DeclareFontShape{JT2}{zhrm}{bx}{n}{<-> upzhserifb-v}{} %% %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/jt2zhsf.fd b/Master/texmf-dist/tex/latex/ctex/fd/jt2zhsf.fd index 97e474ccf6b..7ea78b75124 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/jt2zhsf.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/jt2zhsf.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,sf,jt2') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{jt2zhsf.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] \DeclareKanjiFamily{JT2}{zhsf}{} \DeclareFontShape{JT2}{zhsf}{m}{n}{<-> upzhsans-v}{} +\DeclareFontShape{JT2}{zhsf}{b}{n}{<-> upzhsansb-v}{} \DeclareFontShape{JT2}{zhsf}{bx}{n}{<-> upzhsansb-v}{} %% %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/jt2zhtt.fd b/Master/texmf-dist/tex/latex/ctex/fd/jt2zhtt.fd index 44be7f39f27..b2fe15a09b4 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/jt2zhtt.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/jt2zhtt.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,tt,jt2') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{jt2zhtt.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] \DeclareKanjiFamily{JT2}{zhtt}{} \DeclareFontShape{JT2}{zhtt}{m}{n}{<-> upzhmono-v}{} %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/jy2zhrm.fd b/Master/texmf-dist/tex/latex/ctex/fd/jy2zhrm.fd index ecf164789af..1433d7b52d0 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/jy2zhrm.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/jy2zhrm.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,rm,jy2') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,16 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{jy2zhrm.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] \DeclareKanjiFamily{JY2}{zhrm}{} \DeclareFontShape{JY2}{zhrm}{m}{n}{<-> upzhserif-h}{} \DeclareFontShape{JY2}{zhrm}{m}{it}{<-> upzhserifit-h}{} +\DeclareFontShape{JY2}{zhrm}{b}{n}{<-> upzhserifb-h}{} \DeclareFontShape{JY2}{zhrm}{bx}{n}{<-> upzhserifb-h}{} %% %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/jy2zhsf.fd b/Master/texmf-dist/tex/latex/ctex/fd/jy2zhsf.fd index 9c3461c4f55..1a3c2389bef 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/jy2zhsf.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/jy2zhsf.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,sf,jy2') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{jy2zhsf.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] \DeclareKanjiFamily{JY2}{zhsf}{} \DeclareFontShape{JY2}{zhsf}{m}{n}{<-> upzhsans-h}{} +\DeclareFontShape{JY2}{zhsf}{b}{n}{<-> upzhsansb-h}{} \DeclareFontShape{JY2}{zhsf}{bx}{n}{<-> upzhsansb-h}{} %% %% diff --git a/Master/texmf-dist/tex/latex/ctex/fd/jy2zhtt.fd b/Master/texmf-dist/tex/latex/ctex/fd/jy2zhtt.fd index dd75814554c..df2ba694b86 100644 --- a/Master/texmf-dist/tex/latex/ctex/fd/jy2zhtt.fd +++ b/Master/texmf-dist/tex/latex/ctex/fd/jy2zhtt.fd @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fd,tt,jy2') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,14 +20,12 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% \ProvidesFile{jy2zhtt.fd}% - [2019/05/29 v2.4.16 Chinese font definition (CTEX)] + [2020/05/02 v2.5.1 Chinese font definition (CTEX)] \DeclareKanjiFamily{JY2}{zhtt}{} \DeclareFontShape{JY2}{zhtt}{m}{n}{<-> upzhmono-h}{} %% diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def index 4c981401a65..675a1ce373c 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-adobe.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fontset,adobe') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,86 +20,80 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Adobe fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-adobe.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\sys_if_engine_pdftex:TF + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_fontset_case:nnnn + { \ctex_fontset_error:n { adobe } } { - \sys_if_output_pdf:TF - { \ctex_fontset_error:n { adobe } } + \ctex_zhmap_case:nnn { - \ctex_zhmap_case:nnn - { - \setCJKmainfont - [ - cmap = UniGB-UTF16-H , - BoldFont = AdobeHeitiStd-Regular.otf , - ItalicFont = AdobeKaitiStd-Regular.otf - ] { AdobeSongStd-Light.otf } - \setCJKsansfont [ cmap = UniGB-UTF16-H ] { AdobeHeitiStd-Regular.otf } - \setCJKmonofont [ cmap = UniGB-UTF16-H ] { AdobeFangsongStd-Regular.otf } - \setCJKfamilyfont { zhsong } - [ cmap = UniGB-UTF16-H ] { AdobeSongStd-Light.otf } - \setCJKfamilyfont { zhhei } - [ cmap = UniGB-UTF16-H ] { AdobeHeitiStd-Regular.otf } - \setCJKfamilyfont { zhkai } - [ cmap = UniGB-UTF16-H ] { AdobeKaitiStd-Regular.otf } - \setCJKfamilyfont { zhfs } - [ cmap = UniGB-UTF16-H ] { AdobeFangsongStd-Regular.otf } - \ctex_punct_set:n { adobe } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_family:nn { \CJKsfdefault } { zhhei } - \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - } - { - \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhadobefonts } - \ctex_punct_set:n { adobe } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - } - { \ctex_fontset_error:n { adobe } } + \setCJKmainfont { AdobeSongStd-Light.otf } + [ + cmap = UniGB-UTF16-H, + BoldFont = AdobeHeitiStd-Regular.otf, + ItalicFont = AdobeKaitiStd-Regular.otf + ] + \setCJKsansfont { AdobeHeitiStd-Regular.otf } + [ cmap = UniGB-UTF16-H ] + \setCJKmonofont { AdobeFangsongStd-Regular.otf } + [ cmap = UniGB-UTF16-H ] + \setCJKfamilyfont { zhsong } { AdobeSongStd-Light.otf } + [ cmap = UniGB-UTF16-H ] + \setCJKfamilyfont { zhhei } { AdobeHeitiStd-Regular.otf } + [ cmap = UniGB-UTF16-H ] + \setCJKfamilyfont { zhkai } { AdobeKaitiStd-Regular.otf } + [ cmap = UniGB-UTF16-H ] + \setCJKfamilyfont { zhfs } { AdobeFangsongStd-Regular.otf } + [ cmap = UniGB-UTF16-H ] + \ctex_punct_set:n { adobe } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_family:nn { \CJKsfdefault } { zhhei } + \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } + \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } } - } - { - \sys_if_engine_uptex:TF { - \ctex_set_upfonts:nnnnnn - {AdobeSongStd-Light.otf} {AdobeHeitiStd-Regular.otf} {AdobeKaitiStd-Regular.otf} - {AdobeHeitiStd-Regular.otf} {AdobeHeitiStd-Regular.otf} - {AdobeFangsongStd-Regular.otf} - \ctex_set_upfamily:nnn { zhsong } { upzhserif } {} - \ctex_set_upfamily:nnn { zhhei } { upzhsans } {} - \ctex_set_upfamily:nnn { zhfs } { upzhmono} {} - \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} - } - { - \setCJKmainfont - [ - BoldFont = AdobeHeitiStd-Regular , - ItalicFont = AdobeKaitiStd-Regular - ] { AdobeSongStd-Light } - \setCJKsansfont { AdobeHeitiStd-Regular} - \setCJKmonofont { AdobeFangsongStd-Regular} - \setCJKfamilyfont { zhsong } { AdobeSongStd-Light } - \setCJKfamilyfont { zhhei } { AdobeHeitiStd-Regular } - \setCJKfamilyfont { zhfs } { AdobeFangsongStd-Regular } - \setCJKfamilyfont { zhkai } { AdobeKaitiStd-Regular } + \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhadobefonts } + \ctex_punct_set:n { adobe } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } } + { \ctex_fontset_error:n { adobe } } + } + { + \ctex_set_upfonts:nnnnnn + { AdobeSongStd-Light.otf } + { AdobeHeitiStd-Regular.otf } + { AdobeKaitiStd-Regular.otf } + { AdobeHeitiStd-Regular.otf } + { AdobeHeitiStd-Regular.otf } + { AdobeFangsongStd-Regular.otf } + \ctex_set_upfamily:nnn { zhsong } { upzhserif } {} + \ctex_set_upfamily:nnn { zhhei } { upzhsans } {} + \ctex_set_upfamily:nnn { zhfs } { upzhmono } {} + \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} + } + { + \setCJKmainfont { AdobeSongStd-Light } + [ BoldFont = AdobeHeitiStd-Regular, ItalicFont = AdobeKaitiStd-Regular ] + \setCJKsansfont { AdobeHeitiStd-Regular } + \setCJKmonofont { AdobeFangsongStd-Regular } + \setCJKfamilyfont { zhsong } { AdobeSongStd-Light } + \setCJKfamilyfont { zhhei } { AdobeHeitiStd-Regular } + \setCJKfamilyfont { zhfs } { AdobeFangsongStd-Regular } + \setCJKfamilyfont { zhkai } { AdobeKaitiStd-Regular } } -\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } -\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } -\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } -\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } +\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } +\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } +\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } +\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } %% %% %% End of file `ctex-fontset-adobe.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def index 03853321971..2ff57b29633 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fontset,fandol') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,101 +20,91 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Fandol fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-fandol.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\sys_if_engine_pdftex:TF - { - \sys_if_output_pdf:TF - { \ctex_fontset_error:n { fandol } } - { - \ctex_zhmap_case:nnn - { - \setCJKmainfont - [ - cmap = UniGB-UTF16-H , - BoldFont = FandolSong-Bold.otf , - ItalicFont = FandolKai-Regular.otf - ] { FandolSong-Regular.otf } - \setCJKsansfont - [ - cmap = UniGB-UTF16-H , - BoldFont = FandolHei-Bold.otf - ] { FandolHei-Regular.otf } - \setCJKmonofont [ cmap = UniGB-UTF16-H ] { FandolFang-Regular.otf } - \setCJKfamilyfont { zhsong } - [ - cmap = UniGB-UTF16-H , - BoldFont = FandolSong-Bold.otf - ] { FandolSong-Regular.otf } - \setCJKfamilyfont { zhhei } - [ - cmap = UniGB-UTF16-H , - BoldFont = FandolHei-Bold.otf - ] { FandolHei-Regular.otf } - \setCJKfamilyfont { zhfs } - [ cmap = UniGB-UTF16-H ] { FandolFang-Regular.otf } - \setCJKfamilyfont { zhkai } - [ cmap = UniGB-UTF16-H ] { FandolKai-Regular.otf } - \ctex_punct_set:n { fandol } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_family:nn { \CJKsfdefault } { zhhei } - \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - \ctex_punct_map_bfseries:nn { \CJKrmdefault , zhsong } { zhsongb } - \ctex_punct_map_bfseries:nn { \CJKsfdefault , zhhei } { zhheib } - } - { - \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhfandolfonts } - \ctex_punct_set:n { fandol } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - } - { \ctex_fontset_error:n { fandol } } - } - } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_fontset_case:nnnn + { \ctex_fontset_error:n { fandol } } { - \sys_if_engine_uptex:TF - { - \ctex_set_upfonts:nnnnnn - {FandolSong-Regular.otf} {FandolSong-Bold.otf} {FandolKai-Regular.otf} - {FandolHei-Regular.otf} {FandolHei-Bold.otf} - {FandolFang-Regular.otf} - \ctex_set_upfamily:nnn { zhsong } { upzhserif } { upzhserifb } - \ctex_set_upfamily:nnn { zhhei } { upzhsans } { upzhsansb } - \ctex_set_upfamily:nnn { zhfs } { upzhmono} {} - \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} - } + \ctex_zhmap_case:nnn { - \setCJKmainfont + \setCJKmainfont { FandolSong-Regular.otf } [ - Extension = .otf , - BoldFont = FandolSong-Bold , ItalicFont = FandolKai-Regular + cmap = UniGB-UTF16-H, + BoldFont = FandolSong-Bold.otf, + ItalicFont = FandolKai-Regular.otf ] - { FandolSong-Regular } - \setCJKsansfont - [ Extension = .otf , BoldFont = FandolHei-Bold ] { FandolHei-Regular } - \setCJKmonofont [ Extension = .otf ] { FandolFang-Regular } - \setCJKfamilyfont { zhsong } - [ Extension = .otf , BoldFont = FandolSong-Bold ] { FandolSong-Regular } - \setCJKfamilyfont { zhhei } - [ Extension = .otf , BoldFont = FandolHei-Bold ] { FandolHei-Regular } - \setCJKfamilyfont { zhfs } [ Extension = .otf ] { FandolFang-Regular } - \setCJKfamilyfont { zhkai } [ Extension = .otf ] { FandolKai-Regular } + \setCJKsansfont { FandolHei-Regular.otf } + [ cmap = UniGB-UTF16-H, BoldFont = FandolHei-Bold.otf ] + \setCJKmonofont { FandolFang-Regular.otf } + [ cmap = UniGB-UTF16-H ] + \setCJKfamilyfont { zhsong } { FandolSong-Regular.otf } + [ cmap = UniGB-UTF16-H, BoldFont = FandolSong-Bold.otf ] + \setCJKfamilyfont { zhhei } { FandolHei-Regular.otf } + [ cmap = UniGB-UTF16-H, BoldFont = FandolHei-Bold.otf ] + \setCJKfamilyfont { zhfs } { FandolFang-Regular.otf } + [ cmap = UniGB-UTF16-H ] + \setCJKfamilyfont { zhkai } { FandolKai-Regular.otf } + [ cmap = UniGB-UTF16-H ] + \ctex_punct_set:n { fandol } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_family:nn { \CJKsfdefault } { zhhei } + \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } + \ctex_punct_map_bfseries:nn { \CJKrmdefault, zhsong } { zhsongb } + \ctex_punct_map_bfseries:nn { \CJKsfdefault, zhhei } { zhheib } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } } + { + \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhfandolfonts } + \ctex_punct_set:n { fandol } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } + } + { \ctex_fontset_error:n { fandol } } + } + { + \ctex_set_upfonts:nnnnnn + { FandolSong-Regular.otf } + { FandolSong-Bold.otf } + { FandolKai-Regular.otf } + { FandolHei-Regular.otf } + { FandolHei-Bold.otf } + { FandolFang-Regular.otf } + \ctex_set_upfamily:nnn { zhsong } { upzhserif } { upzhserifb } + \ctex_set_upfamily:nnn { zhhei } { upzhsans } { upzhsansb } + \ctex_set_upfamily:nnn { zhfs } { upzhmono } {} + \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} + } + { + \setCJKmainfont { FandolSong-Regular } + [ + Extension = .otf, + BoldFont = FandolSong-Bold, + ItalicFont = FandolKai-Regular + ] + \setCJKsansfont { FandolHei-Regular } + [ Extension = .otf, BoldFont = FandolHei-Bold ] + \setCJKmonofont { FandolFang-Regular } + [ Extension = .otf ] + \setCJKfamilyfont { zhsong } { FandolSong-Regular } + [ Extension = .otf, BoldFont = FandolSong-Bold ] + \setCJKfamilyfont { zhhei } { FandolHei-Regular } + [ Extension = .otf, BoldFont = FandolHei-Bold ] + \setCJKfamilyfont { zhfs } { FandolFang-Regular } + [ Extension = .otf ] + \setCJKfamilyfont { zhkai } { FandolKai-Regular } + [ Extension = .otf ] } -\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } -\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } -\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } -\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } +\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } +\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } +\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } +\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } %% %% %% End of file `ctex-fontset-fandol.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def index 034ba79de24..c9b117e17f8 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-founder.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fontset,founder') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,83 +20,83 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Founder fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-founder.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\sys_if_engine_pdftex:TF + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_fontset_case:nnn { \ctex_zhmap_case:nnn { - \setCJKmainfont - [ BoldFont = FZXBSK.TTF , ItalicFont = FZKTK.TTF ] { FZSSK.TTF } - \setCJKsansfont [ BoldFont = FZHTK.TTF ] { FZXH1K.TTF } + \setCJKmainfont { FZSSK.TTF } + [ BoldFont = FZXBSK.TTF, ItalicFont = FZKTK.TTF ] + \setCJKsansfont { FZXH1K.TTF } [ BoldFont = FZHTK.TTF ] \setCJKmonofont { FZFSK.TTF } - \setCJKfamilyfont { zhsong } [ BoldFont = FZXBSK.TTF ] { FZSSK.TTF } - \setCJKfamilyfont { zhhei } { FZHTK.TTF } - \setCJKfamilyfont { zhkai } { FZKTK.TTF } - \setCJKfamilyfont { zhfs } { FZFSK.TTF } - \setCJKfamilyfont { zhli } { FZLSK.TTF } - \setCJKfamilyfont { zhyou } [ BoldFont = FZY3K.TTF ] { FZY1K.TTF } + \setCJKfamilyfont { zhsong } { FZSSK.TTF } [ BoldFont = FZXBSK.TTF ] + \setCJKfamilyfont { zhhei } { FZHTK.TTF } + \setCJKfamilyfont { zhkai } { FZKTK.TTF } + \setCJKfamilyfont { zhfs } { FZFSK.TTF } + \setCJKfamilyfont { zhli } { FZLSK.TTF } + \setCJKfamilyfont { zhyou } { FZY1K.TTF } [ BoldFont = FZY3K.TTF ] \ctex_punct_set:n { founder } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_family:nn { \CJKsfdefault } { zhheil } - \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - \ctex_punct_map_bfseries:nn { \CJKrmdefault , zhsong } { zhsongb } - \ctex_punct_map_bfseries:nn { \CJKsfdefault } { zhhei } - \ctex_punct_map_bfseries:nn { zhyou } { zhyoub } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_family:nn { \CJKsfdefault } { zhheil } + \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } + \ctex_punct_map_bfseries:nn { \CJKrmdefault, zhsong } { zhsongb } + \ctex_punct_map_bfseries:nn { \CJKsfdefault } { zhhei } + \ctex_punct_map_bfseries:nn { zhyou } { zhyoub } } { \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhfounderfonts } \ctex_punct_set:n { founder } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } } { \ctex_fontset_error:n { founder } } } { - \sys_if_engine_uptex:TF - { - \ctex_set_upfonts:nnnnnn - { FZSSK.TTF } { FZXBSK.TTF } { FZKTK.TTF } - { FZXH1K.TTF } { FZHTK.TTF } - { FZFSK.TTF } - \ctex_set_upfamily:nnn { zhsong } { upzhserif } { upzhserifb } - \ctex_set_upfamily:nnn { zhhei } { upzhsans } { upzhsansb } - \ctex_set_upfamily:nnn { zhfs } { upzhmono} {} - \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} - \ctex_set_upfamily:nnn { zhli } { upschrm } {} - \ctex_set_upmap:nnn { upstsl } { FZLSK.TTF } {} - \ctex_set_upfamily:nnn { zhyou } { upschgt } {} - \ctex_set_upmap:nnn { upstht } { FZY1K.TTF } {} - } - { - \setCJKmainfont - [ BoldFont = FZXiaoBiaoSong-B05 , ItalicFont = FZKai-Z03 ] { FZShuSong-Z01 } - \setCJKsansfont [ BoldFont = FZHei-B01 ] { FZXiHeiI-Z08 } - \setCJKmonofont { FZFangSong-Z02 } - \setCJKfamilyfont { zhsong } [ BoldFont = FZXiaoBiaoSong-B05 ] { FZShuSong-Z01 } - \setCJKfamilyfont { zhhei } { FZHei-B01 } - \setCJKfamilyfont { zhkai } { FZKai-Z03 } - \setCJKfamilyfont { zhfs } { FZFangSong-Z02 } - \setCJKfamilyfont { zhli } { FZLiShu-S01 } - \setCJKfamilyfont { zhyou } [ BoldFont = FZZhunYuan-M02 ] { FZXiYuan-M01 } - } + \ctex_set_upfonts:nnnnnn + { FZSSK.TTF } + { FZXBSK.TTF } + { FZKTK.TTF } + { FZXH1K.TTF } + { FZHTK.TTF } + { FZFSK.TTF } + \ctex_set_upfamily:nnn { zhsong } { upzhserif } { upzhserifb } + \ctex_set_upfamily:nnn { zhhei } { upzhsans } { upzhsansb } + \ctex_set_upfamily:nnn { zhfs } { upzhmono } {} + \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} + \ctex_set_upfamily:nnn { zhli } { upschrm } {} + \ctex_set_upfamily:nnn { zhyou } { upschgt } {} + \ctex_set_upmap:nnn { upstsl } { FZLSK.TTF } {} + \ctex_set_upmap:nnn { upstht } { FZY1K.TTF } {} + } + { + \setCJKmainfont { FZShuSong-Z01 } + [ BoldFont = FZXiaoBiaoSong-B05, ItalicFont = FZKai-Z03 ] + \setCJKsansfont { FZXiHeiI-Z08 } [ BoldFont = FZHei-B01 ] + \setCJKmonofont { FZFangSong-Z02 } + \setCJKfamilyfont { zhsong } { FZShuSong-Z01 } + [ BoldFont = FZXiaoBiaoSong-B05 ] + \setCJKfamilyfont { zhhei } { FZHei-B01 } + \setCJKfamilyfont { zhkai } { FZKai-Z03 } + \setCJKfamilyfont { zhfs } { FZFangSong-Z02 } + \setCJKfamilyfont { zhli } { FZLiShu-S01 } + \setCJKfamilyfont { zhyou } { FZXiYuan-M01 } + [ BoldFont = FZZhunYuan-M02 ] } -\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } -\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } -\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } -\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } -\NewDocumentCommand \lishu { } { \CJKfamily { zhli } } -\NewDocumentCommand \youyuan { } { \CJKfamily { zhyou } } +\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } +\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } +\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } +\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } +\NewDocumentCommand \lishu { } { \CJKfamily { zhli } } +\NewDocumentCommand \youyuan { } { \CJKfamily { zhyou } } %% %% %% End of file `ctex-fontset-founder.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def index a3c6b43a561..16357dbe17e 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-mac.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fontset,mac') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ - {Mac OS X fonts definition (CTEX)} +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ + {macOS fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-mac.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\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 } } diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macnew.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macnew.def index ff07af939d4..9dc1dfa9c9a 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macnew.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macnew.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fontset,macnew') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,48 +20,99 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ - {Mac OS X fonts definition for El Capitan or later version (CTEX)} +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ + {macOS fonts definition for El Capitan or later version (CTEX)} \ProvidesExplFile{ctex-fontset-macnew.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\sys_if_engine_pdftex:TF + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_fontset_case:nnnn { \ctex_fontset_error:n { mac } } { - \sys_if_engine_uptex:TF - { \ctex_fontset_error:n { mac } } + \ctex_zhmap_case:nnn { - \setCJKmainfont - [ - UprightFont = *~Light , - BoldFont = *~Bold , - ItalicFont = Kaiti~SC , - BoldItalicFont = Kaiti~SC~Bold - ] { Songti~SC } - \setCJKsansfont { PingFang~SC } - \setCJKmonofont { STFangsong } - \setCJKfamilyfont { zhsong } + \setCJKmainfont { :3:Songti.ttc } [ - UprightFont = *~Light , - BoldFont = *~Bold , - ] { Songti~SC } - \setCJKfamilyfont { zhhei } { Heiti~SC } - \setCJKfamilyfont { zhpf } { PingFang~SC } - \setCJKfamilyfont { zhfs } { STFangsong } -\setCJKfamilyfont { zhkai } { Kaiti~SC } + BoldFont = :1:Songti.ttc, + ItalicFont = :0:Kaiti.ttc, + BoldItalicFont = :3:Kaiti.ttc, + ] + \setCJKsansfont { :2:PingFang.ttc } [ BoldFont = :8:PingFang.ttc ] + \setCJKmonofont { STFANGSO.ttf } + \setCJKfamilyfont { zhsong } { :3:Songti.ttc } [ BoldFont = :1:Songti.ttc ] + \setCJKfamilyfont { zhhei } { :2:PingFang.ttc } [ BoldFont = :8:PingFang.ttc ] + \setCJKfamilyfont { zhkai } { :0:Kaiti.ttc } [ BoldFont = :3:Kaiti.ttc ] + \setCJKfamilyfont { zhfs } { STFANGSO.ttf } + \setCJKfamilyfont { zhli } { :0:Baoli.ttc } + \setCJKfamilyfont { zhyou } { :4:Yuanti.ttc } [ BoldFont = :0:Yuanti.ttc ] + \ctex_punct_set:n { mac } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_family:nn { \CJKsfdefault } { zhheil } + \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } + \ctex_punct_map_bfseries:nn { \CJKrmdefault, zhsong } { zhsongb } + \ctex_punct_map_bfseries:nn { \CJKsfdefault } { zhhei } + \ctex_punct_map_bfseries:nn { zhyou } { zhyoub } + } + { + \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhmacfonts } + \ctex_punct_set:n { mac } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } } + { \ctex_fontset_error:n { macnew } } + } + { + \ctex_set_upmap:nnn { upserif } { :3:Songti.ttc } { :1:Songti.ttc } + \ctex_set_upmap:nnn { upserifit } { :0:Kaiti.ttc } { } + \ctex_set_upmap:nnn { upstsl } { :0:Baoli.ttc } { } + \ctex_set_upmap:nnn { upstht } { :4:Yuanti.ttc } { } + \ctex_set_upmap_unicode:nnn { upsans } { :2:PingFang.ttc } { :8:PingFang.ttc } + \ctex_set_upmap_unicode:nnn { upmono } { STFANGSO.ttf } { } + \ctex_set_upfamily:nnn { zhsong } { upzhserif } { upzhserifb } + \ctex_set_upfamily:nnn { zhhei } { upzhsans } { upzhsansb } + \ctex_set_upfamily:nnn { zhfs } { upzhmono } { } + \ctex_set_upfamily:nnn { zhkai } { upzhserifit } { } + \ctex_set_upfamily:nnn { zhli } { upschrm } { } + \ctex_set_upfamily:nnn { zhyou } { upschgt } { } + } + { + \setCJKmainfont { Songti~SC~Light } + [ + BoldFont = Songti~SC~Bold, + ItalicFont = Kaiti~SC, + BoldItalicFont = Kaiti~SC~Bold + ] + \setCJKsansfont { PingFang~SC } + \setCJKmonofont { STFangsong } + \setCJKfamilyfont { zhsong } { Songti~SC~Light } [ BoldFont = Songti~SC~Bold ] + \setCJKfamilyfont { zhhei } { Heiti~SC~Light } [ BoldFont = Heiti~SC~Medium ] + \setCJKfamilyfont { zhpf } { PingFang~SC } + \setCJKfamilyfont { zhfs } { STFangsong } + \setCJKfamilyfont { zhkai } { Kaiti~SC } [ BoldFont = Kaiti~SC~Bold ] + \setCJKfamilyfont { zhli } { Baoli~SC } + \setCJKfamilyfont { zhyou } { Yuanti~SC~Light } [ BoldFont = Yuanti~SC~Regular ] + } +\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } +\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } +\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } +\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } +\NewDocumentCommand \lishu { } { \CJKfamily { zhli } } +\NewDocumentCommand \youyuan { } { \CJKfamily { zhyou } } +\bool_lazy_or:nnTF + { \sys_if_engine_pdftex_p: } + { \sys_if_engine_uptex_p: } + { + \cs_new_eq:NN \yahei \heiti + \cs_new_eq:NN \pingfang \heiti + } + { + \NewDocumentCommand \yahei { } { \CJKfamily { zhpf } } + \NewDocumentCommand \pingfang { } { \CJKfamily { zhpf } } } -\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } -\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } -\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } -\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } -\NewDocumentCommand \yahei { } { \CJKfamily { zhpf } } -\NewDocumentCommand \pingfang { } { \CJKfamily { zhpf } } %% %% %% End of file `ctex-fontset-macnew.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macold.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macold.def index 8047567fb8a..509c23e34f4 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macold.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-macold.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fontset,macold') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,35 +20,32 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ - {Mac OS X fonts definition for Yosemite or earlier version (CTEX)} +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ + {macOS fonts definition for Yosemite or earlier version (CTEX)} \ProvidesExplFile{ctex-fontset-macold.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\sys_if_engine_pdftex:TF + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_fontset_case:nnnn { \ctex_fontset_error:n { mac } } + { \ctex_fontset_error:n { macold } } + { \ctex_fontset_error:n { macold } } { - \sys_if_engine_uptex:TF - { \ctex_fontset_error:n { mac } } - { - \setCJKmainfont [ BoldFont = STHeiti , ItalicFont = STKaiti ] { STSong } - \setCJKsansfont [ BoldFont = STHeiti ] { STXihei } - \setCJKmonofont { STFangsong } - \setCJKfamilyfont { zhsong } { STSong } - \setCJKfamilyfont { zhhei } { STHeiti } - \setCJKfamilyfont { zhfs } { STFangsong } -\setCJKfamilyfont { zhkai } { STKaiti } - } + \setCJKmainfont { STSong } + [ BoldFont = STHeiti, ItalicFont = STKaiti ] + \setCJKsansfont { STXihei } [ BoldFont = STHeiti ] + \setCJKmonofont { STFangsong } + \setCJKfamilyfont { zhsong } { STSong } + \setCJKfamilyfont { zhhei } { STHeiti } + \setCJKfamilyfont { zhfs } { STFangsong } + \setCJKfamilyfont { zhkai } { STKaiti } } -\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } -\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } -\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } -\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } +\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } +\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } +\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } +\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } %% %% %% End of file `ctex-fontset-macold.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def index 4c7862412b7..0493c6ee8e0 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-ubuntu.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fontset,ubuntu') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,67 +20,69 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Ubuntu fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-ubuntu.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\sys_if_engine_pdftex:TF + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_fontset_case:nnnn + { \ctex_fontset_error:n { ubuntu } } { \ctex_zhmap_case:nnn { - \setCJKmainfont - [ BoldFont = wqy-zenhei.ttc , ItalicFont = ukai.ttc ] { uming.ttc } - \setCJKsansfont { wqy-zenhei.ttc } - \setCJKmonofont { uming.ttc } - \setCJKfamilyfont { zhsong } { uming.ttc } - \setCJKfamilyfont { zhhei } { wqy-zenhei.ttc } - \setCJKfamilyfont { zhkai } { ukai.ttc } - \ctex_punct_set:n { ubuntu } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_family:nn { \CJKsfdefault } { zhhei } - \ctex_punct_map_family:nn { \CJKttdefault } { zhsong } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \setCJKmainfont { :2:NotoSerifCJK-Regular.ttc } + [ BoldFont = :2:NotoSerifCJK-Bold.ttc, ItalicFont = gkai00mp.ttf ] + \setCJKsansfont { :2:NotoSansCJK-Regular.ttc } + [ BoldFont = :2:NotoSansCJK-Bold.ttc ] + \setCJKmonofont { :2:NotoSerifCJK-Regular.ttc } + [ BoldFont = :2:NotoSerifCJK-Bold.ttc ] + \setCJKfamilyfont { zhsong } { :2:NotoSerifCJK-Regular.ttc } + [ BoldFont = :2:NotoSerifCJK-Bold.ttc ] + \setCJKfamilyfont { zhhei } { :2:NotoSansCJK-Regular.ttc } + [ BoldFont = :2:NotoSansCJK-Bold.ttc ] + \setCJKfamilyfont { zhkai } { gkai00mp.ttf } + \ctex_punct_set:n { fandol } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_family:nn { \CJKsfdefault } { zhhei } + \ctex_punct_map_bfseries:nn { \CJKrmdefault, zhsong } { zhsongb } + \ctex_punct_map_bfseries:nn { \CJKsfdefault, zhhei } { zhheib } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } } { \ctex_load_zhmap:nnnn { rm } { zhhei } { zhsong } { zhubuntufonts } \ctex_punct_set:n { ubuntu } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } } { \ctex_fontset_error:n { ubuntu } } } { - \sys_if_engine_uptex:TF - { - \ctex_set_upfonts:nnnnnn - { uming.ttc } { wqy-zenhei.ttc } { ukai.ttc } - { wqy-zenhei.ttc } { wqy-zenhei.ttc } - { uming.ttc } - \ctex_set_upfamily:nnn { zhsong } { upzhserif } {} - \ctex_set_upfamily:nnn { zhhei } { upzhsans } {} - \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} - } - { - \setCJKmainfont - [ BoldFont = WenQuanYi~Zen~Hei , ItalicFont = AR~PL~UKai~CN ] { AR~PL~UMing~CN } - \setCJKsansfont { WenQuanYi~Zen~Hei } - \setCJKmonofont { AR~PL~UMing~CN } - \setCJKfamilyfont { zhsong } { AR~PL~UMing~CN } - \setCJKfamilyfont { zhhei } { WenQuanYi~Zen~Hei } - \setCJKfamilyfont { zhkai } { AR~PL~UKai~CN } - } + \ctex_set_upmap_unicode:nnn { upserif } + { :2:NotoSerifCJK-Regular.ttc } { :2:NotoSerifCJK-Bold.ttc } + \ctex_set_upmap_unicode:nnn { upsans } + { :2:NotoSansCJK-Regular.ttc } { :2:NotoSansCJK-Bold.ttc } + \ctex_set_upmap_unicode:nnn { upmono } + { :2:NotoSerifCJK-Regular.ttc } { } + \ctex_set_upmap:nnn { upserifit } { gkai00mp.ttf } { } + \ctex_set_upfamily:nnn { zhsong } { upzhserif } { upzhserifb } + \ctex_set_upfamily:nnn { zhhei } { upzhsans } { upzhsansb } + \ctex_set_upfamily:nnn { zhkai } { upzhserifit } { } + } + { + \setCJKmainfont { Noto~Serif~CJK~SC } [ ItalicFont = AR~PL~KaitiM~GB ] + \setCJKsansfont { Noto~Sans~CJK~SC } + \setCJKmonofont { Noto~Serif~CJK~SC } + \setCJKfamilyfont { zhsong } { Noto~Serif~CJK~SC } + \setCJKfamilyfont { zhhei } { Noto~Sans~CJK~SC } + \setCJKfamilyfont { zhkai } { AR~PL~KaitiM~GB } } -\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } -\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } -\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } +\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } +\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } +\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } %% %% %% End of file `ctex-fontset-ubuntu.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def index 84c015cd8f7..daeb2dc02e1 100644 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def +++ b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `fontset,windows') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,19 +20,96 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Windows fonts definition (CTEX)} \ProvidesExplFile{ctex-fontset-windows.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\file_if_exist:nTF { C:/bootfont.bin } - { \ctex_file_input:n { ctex-fontset-windowsold.def } } - { \ctex_file_input:n { ctex-fontset-windowsnew.def } } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\file_if_exist:nTF { \c_dollar_str WINDIR/Fonts/msyh.ttc } + { \tl_const:Nn \c__ctex_msyh_suffix_tl { ttc } } + { + \file_if_exist:nTF { msyh.ttc } + { \tl_const:Nn \c__ctex_msyh_suffix_tl { ttc } } + { \tl_const:Nn \c__ctex_msyh_suffix_tl { ttf } } + } +\ctex_fontset_case:nnn + { + \ctex_zhmap_case:nnn + { + \ctex_punct_set:n { windows } + \setCJKmainfont { simsun.ttc } + [ BoldFont = simhei.ttf, ItalicFont = simkai.ttf ] + \setCJKsansfont { msyh.\c__ctex_msyh_suffix_tl } + [ BoldFont = msyhbd.\c__ctex_msyh_suffix_tl ] + \setCJKmonofont { simfang.ttf } + \setCJKfamilyfont { zhsong } { simsun.ttc } + \setCJKfamilyfont { zhhei } { simhei.ttf } + \setCJKfamilyfont { zhfs } { simfang.ttf } + \setCJKfamilyfont { zhkai } { simkai.ttf } + \setCJKfamilyfont { zhyahei } { msyh.\c__ctex_msyh_suffix_tl } + [ BoldFont = msyhbd.\c__ctex_msyh_suffix_tl ] + \setCJKfamilyfont { zhli } { simli.ttf } + \setCJKfamilyfont { zhyou } { simyou.ttf } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } + \ctex_punct_map_family:nn { \CJKsfdefault } { zhyahei } + \ctex_punct_map_bfseries:nn { \CJKsfdefault, zhyahei } { zhyaheib } + \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } + } + { + \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhwindowsfonts } + \ctex_punct_set:n { windows } + \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } + \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } + \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } + } + { + \tl_set:Nn \CJKrmdefault { rm } + \tl_set:Nn \CJKsfdefault { sf } + \tl_set:Nn \CJKttdefault { tt } + } + } + { + \ctex_set_upfonts:nnnnnn + { simsun.ttc } + { simhei.ttf } + { simkai.ttf } + { msyh.\c__ctex_msyh_suffix_tl } + { msyhbd.\c__ctex_msyh_suffix_tl } + { simfang.ttf } + \ctex_set_upfamily:nnn { zhsong } { upzhserif } {} + \ctex_set_upfamily:nnn { zhhei } { upzhserifb } {} + \ctex_set_upfamily:nnn { zhfs } { upzhmono } {} + \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} + \ctex_set_upfamily:nnn { zhyahei } { upzhsans } { upzhsansb } + \ctex_set_upfamily:nnn { zhli } { upschrm } {} + \ctex_set_upfamily:nnn { zhyou } { upschgt } {} + \ctex_set_upmap:nnn { upstsl } { simli.ttf } {} + \ctex_set_upmap:nnn { upstht } { simyou.ttf } {} + } + { + \setCJKmainfont { SimSun } [ BoldFont = SimHei , ItalicFont = KaiTi ] + \setCJKsansfont { Microsoft~YaHei } [ BoldFont = *~Bold ] + \setCJKmonofont { FangSong } + \setCJKfamilyfont { zhsong } { SimSun } + \setCJKfamilyfont { zhhei } { SimHei } + \setCJKfamilyfont { zhfs } { FangSong } + \setCJKfamilyfont { zhkai } { KaiTi } + \setCJKfamilyfont { zhyahei } { Microsoft~YaHei } [ BoldFont = *~Bold ] + \setCJKfamilyfont { zhli } { LiSu } + \setCJKfamilyfont { zhyou } { YouYuan } + } +\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } +\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } +\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } +\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } +\NewDocumentCommand \lishu { } { \CJKfamily { zhli } } +\NewDocumentCommand \youyuan { } { \CJKfamily { zhyou } } +\NewDocumentCommand \yahei { } { \CJKfamily { zhyahei } } %% %% %% End of file `ctex-fontset-windows.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def deleted file mode 100644 index 55957b1283d..00000000000 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsnew.def +++ /dev/null @@ -1,120 +0,0 @@ -%% -%% This is file `ctex-fontset-windowsnew.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% ctex.dtx (with options: `fontset,windowsnew') -%% -%% Copyright (C) 2003--2019 -%% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either -%% version 1.3c of this license or (at your option) any later -%% version. This version of this license is in -%% http://www.latex-project.org/lppl/lppl-1-3c.txt -%% and the latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of -%% LaTeX version 2005/12/01 or later. -%% -%% This work has the LPPL maintenance status `maintained'. -%% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ - {Windows fonts definition for Vista or later version (CTEX)} -\ProvidesExplFile{ctex-fontset-windowsnew.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\tl_new:N \l__ctex_msyh_suffix_tl -\tl_set:Nn \l__ctex_msyh_suffix_tl { .ttc } -\file_if_exist:nF { C:/Windows/Fonts/msyh.ttc } - { - \file_if_exist:nF { msyh.ttc } - { \tl_set:Nn \l__ctex_msyh_suffix_tl { .ttf } } - } -\sys_if_engine_pdftex:TF - { - \ctex_zhmap_case:nnn - { - \ctex_punct_set:n { windows } - \setCJKmainfont - [ BoldFont = simhei.ttf , ItalicFont = simkai.ttf ] { simsun.ttc } - \setCJKsansfont - [ BoldFont = msyhbd\l__ctex_msyh_suffix_tl ] { msyh\l__ctex_msyh_suffix_tl } - \setCJKfamilyfont { zhyahei } - [ BoldFont = msyhbd\l__ctex_msyh_suffix_tl ] { msyh\l__ctex_msyh_suffix_tl } - \ctex_punct_map_family:nn { \CJKsfdefault } { zhyahei } - \ctex_punct_map_bfseries:nn { \CJKsfdefault , zhyahei } { zhyaheib } - \setCJKmonofont { simfang.ttf } - \setCJKfamilyfont { zhkai } { simkai.ttf } - \setCJKfamilyfont { zhfs } { simfang.ttf } - \setCJKfamilyfont { zhsong } { simsun.ttc } - \setCJKfamilyfont { zhhei } { simhei.ttf } - \setCJKfamilyfont { zhli } { simli.ttf } - \setCJKfamilyfont { zhyou } { simyou.ttf } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - } - { - \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhwindowsfonts } - \ctex_punct_set:n { windows } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - } - { - \tl_set:Nn \CJKrmdefault { rm } - \tl_set:Nn \CJKsfdefault { sf } - \tl_set:Nn \CJKttdefault { tt } - } - } - { - \sys_if_engine_uptex:TF - { - \ctex_set_upfonts:nnnnnn - {simsun.ttc} {simhei.ttf} {simkai.ttf} - {msyh\l__ctex_msyh_suffix_tl} {msyhbd\l__ctex_msyh_suffix_tl} - {simfang.ttf} - \ctex_set_upfamily:nnn { zhsong } { upzhserif } {} - \ctex_set_upfamily:nnn { zhhei } { upzhserifb } {} - \ctex_set_upfamily:nnn { zhfs } { upzhmono} {} - \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} - \ctex_set_upfamily:nnn { zhyahei } { upzhsans } { upzhsansb } - \ctex_set_upfamily:nnn { zhli } { upschrm } {} - \ctex_set_upmap:nnn { upstsl } { simli.ttf } {} - \ctex_set_upfamily:nnn { zhyou } { upschgt } {} - \ctex_set_upmap:nnn { upstht } { simyou.ttf } {} - } - { - \setCJKmainfont - [ BoldFont = SimHei , ItalicFont = KaiTi ] { SimSun } - \setCJKsansfont - [ BoldFont = { *~Bold } ] { Microsoft~YaHei } - \setCJKmonofont { FangSong } - \setCJKfamilyfont { zhkai } { KaiTi } - \setCJKfamilyfont { zhfs } { FangSong } - \setCJKfamilyfont { zhsong } { SimSun } - \setCJKfamilyfont { zhhei } { SimHei } - \setCJKfamilyfont { zhli } { LiSu } - \setCJKfamilyfont { zhyou } { YouYuan } - \setCJKfamilyfont { zhyahei } - [ BoldFont = { *~Bold } ] { Microsoft~YaHei } - } - } -\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } -\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } -\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } -\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } -\NewDocumentCommand \lishu { } { \CJKfamily { zhli } } -\NewDocumentCommand \youyuan { } { \CJKfamily { zhyou } } -\NewDocumentCommand \yahei { } { \CJKfamily { zhyahei } } -%% -%% -%% End of file `ctex-fontset-windowsnew.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def b/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def deleted file mode 100644 index 8c6ed74b725..00000000000 --- a/Master/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windowsold.def +++ /dev/null @@ -1,104 +0,0 @@ -%% -%% This is file `ctex-fontset-windowsold.def', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% ctex.dtx (with options: `fontset,windowsold') -%% -%% Copyright (C) 2003--2019 -%% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ -%% -%% This work may be distributed and/or modified under the -%% conditions of the LaTeX Project Public License, either -%% version 1.3c of this license or (at your option) any later -%% version. This version of this license is in -%% http://www.latex-project.org/lppl/lppl-1-3c.txt -%% and the latest version of this license is in -%% http://www.latex-project.org/lppl.txt -%% and version 1.3 or later is part of all distributions of -%% LaTeX version 2005/12/01 or later. -%% -%% This work has the LPPL maintenance status `maintained'. -%% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. -%% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ - {Windows fonts definition for XP or earlier version (CTEX)} -\ProvidesExplFile{ctex-fontset-windowsold.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\sys_if_engine_pdftex:TF - { - \ctex_zhmap_case:nnn - { - \ctex_punct_set:n { windows } - \setCJKmainfont - [ BoldFont = simhei.ttf , ItalicFont = simkai.ttf ] { simsun.ttc } - \setCJKsansfont { simhei.ttf } - \ctex_punct_map_family:nn { \CJKsfdefault } { zhhei } - \setCJKmonofont { simfang.ttf } - \setCJKfamilyfont { zhkai } { simkai.ttf } - \setCJKfamilyfont { zhfs } { simfang.ttf } - \setCJKfamilyfont { zhsong } { simsun.ttc } - \setCJKfamilyfont { zhhei } { simhei.ttf } - \setCJKfamilyfont { zhli } { simli.ttf } - \setCJKfamilyfont { zhyou } { simyou.ttf } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_family:nn { \CJKttdefault } { zhfs } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - } - { - \ctex_load_zhmap:nnnn { rm } { zhhei } { zhfs } { zhwindowsfonts } - \ctex_punct_set:n { windows } - \ctex_punct_map_family:nn { \CJKrmdefault } { zhsong } - \ctex_punct_map_bfseries:nn { \CJKrmdefault } { zhhei } - \ctex_punct_map_itshape:nn { \CJKrmdefault } { zhkai } - } - { - \tl_set:Nn \CJKrmdefault { rm } - \tl_set:Nn \CJKsfdefault { sf } - \tl_set:Nn \CJKttdefault { tt } - } - } - { - \sys_if_engine_uptex:TF - { - \ctex_set_upfonts:nnnnnn - {simsun.ttc} {simhei.ttf} {simkai.ttf} - {simhei.ttf} {simhei.ttf} - {simfang.ttf} - \ctex_set_upfamily:nnn { zhsong } { upzhserif } {} - \ctex_set_upfamily:nnn { zhhei } { upzhserifb } {} - \ctex_set_upfamily:nnn { zhfs } { upzhmono} {} - \ctex_set_upfamily:nnn { zhkai } { upzhserifit } {} - \ctex_set_upfamily:nnn { zhli } { upschrm } {} - \ctex_set_upmap:nnn { upstsl } { simli.ttf } {} - \ctex_set_upfamily:nnn { zhyou } { upschgt } {} - \ctex_set_upmap:nnn { upstht } { simyou.ttf } {} - } - { - \setCJKmainfont - [ BoldFont = SimHei , ItalicFont = KaiTi_GB2312 ] { SimSun } - \setCJKsansfont { SimHei } - \setCJKmonofont { FangSong_GB2312 } - \setCJKfamilyfont { zhkai } { KaiTi_GB2312 } - \setCJKfamilyfont { zhfs } { FangSong_GB2312 } - \setCJKfamilyfont { zhsong } { SimSun } - \setCJKfamilyfont { zhhei } { SimHei } - \setCJKfamilyfont { zhli } { LiSu } - \setCJKfamilyfont { zhyou } { YouYuan } - } - } -\NewDocumentCommand \songti { } { \CJKfamily { zhsong } } -\NewDocumentCommand \heiti { } { \CJKfamily { zhhei } } -\NewDocumentCommand \fangsong { } { \CJKfamily { zhfs } } -\NewDocumentCommand \kaishu { } { \CJKfamily { zhkai } } -\NewDocumentCommand \lishu { } { \CJKfamily { zhli } } -\NewDocumentCommand \youyuan { } { \CJKfamily { zhyou } } -%% -%% -%% End of file `ctex-fontset-windowsold.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-article.def b/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-article.def index 95d29bee36b..ea14835dcfa 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-article.def +++ b/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-article.def @@ -1,14 +1,14 @@ %% -%% This is file `ctex-article.def', +%% This is file `ctex-heading-article.def', %% generated with the docstrip utility. %% %% The original source files were: %% %% ctex.dtx (with options: `heading,article') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,22 +20,20 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading modification for article (CTEX)} \ProvidesExplFile{ctex-article.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \seq_const_from_clist:Nn \c__ctex_section_headings_seq { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq \seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq \seq_gput_left:Nn \c__ctex_headings_seq { part } -\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 +\cs_new_protected:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } \tl_new:c { CTEX@post#1 } @@ -65,7 +63,7 @@ \group_end: } } -\cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 +\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 { \tl_put_right:Nx \l__ctex_tmp_tl { @@ -89,11 +87,8 @@ #1 / hang .bool_set:N = \exp_not:c { CTEX@#1@hang } , #1 / hang .initial:n = true , #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , - #1 / tocline .code:n = - { - \cs_set:Npn \exp_not:c { CTEX@#1@tocline} - \exp_not:n { ####1####2 } { ####1 } - } , + #1 / tocline .cs_set:Np = \exp_not:c { CTEX@#1@tocline} + \exp_not:n { ##1##2 } , \__ctex_plus_key_aux:nn {#1} { break } , \__ctex_plus_key_aux:nn {#1} { format } , \__ctex_plus_key_aux:nn {#1} { nameformat } , @@ -103,7 +98,7 @@ \__ctex_plus_key_aux:nn {#1} { aftertitle } , } } -\cs_new_nopar:Npn \__ctex_plus_key_aux:nn #1#2 +\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 { #1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , #1 / #2 + .code:n = @@ -117,7 +112,7 @@ \cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 { \tl_set:cn { CTEX@pre#1 } {#2} - \IfNoValueTF {#3} + \tl_if_novalue:nTF {#3} { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } @@ -128,45 +123,57 @@ \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x +\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } +\cs_new_protected:Npn \CTEX@heading@format@initial { - \group_end: - \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } + \normalfont + \tl_clear:N \l__ctex_autoindent_tl + \int_set:Nn \tex_interlinepenalty:D { 10 000 } + \tex_noindent:D + } +\cs_new_protected:Npn \ctex_indent_box:n #1 + { + \dim_set:Nn \tex_parindent:D {#1} + \__ctex_insert_indent: } -\cs_new_protected_nopar:Npn \CTEX@fixheadingskip +\cs_new_protected:Npn \__ctex_insert_indent: + { + \dim_compare:nNnF \tex_parindent:D = \c_zero_dim + { \tex_indent:D } + } +\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n +\cs_new_protected:Npn \CTEX@fixheadingskip { \par \dim_set:Nn \tex_prevdepth:D { -1000pt } \skip_sub:Nn \l__ctex_heading_skip { \tex_parskip:D } } \skip_new:N \l__ctex_heading_skip -\cs_new_protected_nopar:Npn \CTEX@setheadingskip +\cs_new_protected:Npn \CTEX@setheadingskip { \skip_set:Nn \l__ctex_heading_skip } \cs_new_eq:NN \CTEX@headingskip \l__ctex_heading_skip \ProvideDocumentCommand \partmark { m } { \markboth { } { } } \cs_new_eq:NN \CTEXifname \use_ii:nn -\cs_new_protected_nopar:Npn \CTEX@ifnametrue +\cs_new_protected:Npn \CTEX@ifnametrue { \cs_set_eq:NN \CTEXifname \use_i:nn } -\cs_new_protected_nopar:Npn \CTEX@ifnamefalse +\cs_new_protected:Npn \CTEX@ifnamefalse { \cs_set_eq:NN \CTEXifname \use_ii:nn } \cs_new_protected:Npn \CTEX@addtocline #1#2 { \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } } -\cs_new_protected_nopar:Npn \CTEX@disableautoindent - { \tl_clear:N \l__ctex_autoindent_tl } \renewcommand\part{% - \if@noskipsec \leavevmode \fi - \par - \CTEX@part@break - \CTEX@setheadingskip \CTEX@part@beforeskip - \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi - \addvspace \CTEX@headingskip - \ifodd \CTEX@part@afterindent - \@afterindenttrue - \else - \@afterindentfalse - \fi - \secdef\@part\@spart} + \if@noskipsec \leavevmode \fi + \par + \CTEX@part@break + \CTEX@setheadingskip \CTEX@part@beforeskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \addvspace \CTEX@headingskip + \ifodd \CTEX@part@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@part\@spart} \def\@part[#1]#2{% \ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@part@numbering @@ -182,34 +189,36 @@ \fi \CTEX@gettitle{#1}% \CTEX@addtocline{part}{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}% - {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% - \CTEX@part@titleformat{#2}% - \partmark{#1}% - \CTEX@part@aftertitle}% + \partmark{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}% + {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% + \CTEX@part@titleformat{#2}% + \CTEX@part@aftertitle}\par + \endgroup \nobreak \CTEX@setheadingskip \CTEX@part@afterskip \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi \vskip \CTEX@headingskip \@afterheading} \def\@spart#1{% - \CTEX@ifnamefalse - \CTEX@makeanchor@spart{part*}% - \CTEX@gettitle{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}{}% - \CTEX@part@titleformat{#1}% - \CTEX@part@aftertitle}% - \nobreak - \CTEX@setheadingskip \CTEX@part@afterskip - \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - \@afterheading} + \CTEX@ifnamefalse + \CTEX@makeanchor@spart{part*}% + \CTEX@gettitle{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}{}% + \CTEX@part@titleformat{#1}% + \CTEX@part@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip + \@afterheading} \def\@startsection#1#2#3#4#5#6{% \if@noskipsec \leavevmode \fi \par @@ -252,22 +261,22 @@ \CTEX@gettitle{#7}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #6{% - \CTEX@hangfrom{\hskip\glueexpr #3\relax\@svsec}% - \interlinepenalty \@M + \CTEX@sectionhang{#3}{\@svsec}% \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% + \csname CTEX@#1@aftertitle\endcsname}\par \endgroup \csname #1mark\endcsname{#7}% \CTEX@addtocline{#1}{#7}% \else \def\@svsechd{% - #6{\hskip\glueexpr #3\relax - \@svsec - \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% - \csname #1mark\endcsname{#7}% - \CTEX@addtocline{#1}{#7}}% + #6{% + {\CTEX@indentbox{#3}}\@svsec + \csname CTEX@#1@titleformat\endcsname{#8}% + \csname CTEX@#1@aftertitle\endcsname}% + \csname #1mark\endcsname{#7}% + \CTEX@addtocline{#1}{#7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% @@ -275,15 +284,15 @@ \CTEX@gettitle{#5}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #4{% - \CTEX@hangfrom{\hskip\glueexpr #1\relax}% - \interlinepenalty \@M + \CTEX@sectionhang{#1}{}% \CTEX@titleformat@n{#5}% - \CTEX@aftertitle}% + \CTEX@aftertitle}\par \endgroup \else - \def\@svsechd{#4{\hskip\glueexpr #1\relax - \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{{\CTEX@indentbox{#1}}% + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} \def\@xsect#1{% @@ -303,32 +312,47 @@ \clubpenalty\@M \begingroup \@svsechd \endgroup \unskip - \hskip\glueexpr #1\relax + \CTEX@heading@glue{#1}% \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \fi \ignorespaces} -\cs_new_protected:Npn \CTEX@hangindent #1#2 +\cs_new_protected:Npn \CTEX@headinghang #1 { - \dim_set:Nn \parindent { \use:c { CTEX@#1@indent } } - \bool_if:cTF { CTEX@#1@hang } - { \@hangfrom { \__ctex_indent_aux: #2 } } - {#2} + \ctex_heading_hang:cnn + { CTEX@#1@hang } + { \use:c { CTEX@#1@indent } } } -\cs_new_protected_nopar:Npn \__ctex_indent_aux: +\cs_new_protected:Npn \CTEX@sectionhang + { \ctex_heading_hang:Nnn \CTEX@hang } +\cs_new_protected:Npn \ctex_heading_hang:Nnn #1#2#3 { - \dim_compare:nNnF \parindent = \c_zero_dim - { \skip_horizontal:n { \parindent } } + \dim_set:Nn \tex_parindent:D {#2} + \bool_if:NTF #1 + { \ctex_hang_from:n } + { \use:n } + { \__ctex_insert_indent: #3 } } -\cs_new_protected_nopar:Npn \CTEX@hangfrom +\cs_new_protected:Npn \ctex_hang_from:n #1 { - \bool_if:NTF \CTEX@hang - { \@hangfrom } - { \noindent \use:n } + \tex_noindent:D + \hbox_set:Nn \l__ctex_tmp_box {#1} + \tex_hangindent:D = \box_wd:N \l__ctex_tmp_box + \box_use_drop:N \l__ctex_tmp_box } -\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 +\cs_generate_variant:Nn \ctex_heading_hang:Nnn { c } +\cs_new_protected:Npn \ctex_heading_glue:n #1 + { + \group_begin: + \skip_set:Nn \l__ctex_heading_skip {#1} + \dim_compare:nNnF \l__ctex_heading_skip = \c_zero_dim + { \skip_horizontal:N \l__ctex_heading_skip } + \group_end: + } +\cs_new_eq:NN \CTEX@heading@glue \ctex_heading_glue:n +\cs_new_protected:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } @@ -350,7 +374,7 @@ { } #2 } -\cs_new_nopar:Npn \CTEXnumberline #1 +\cs_new:Npn \CTEXnumberline #1 { \CTEXifname { \protect \numberline { \use:c { CTEXthe #1 } } } @@ -360,7 +384,7 @@ \seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int - \cs_gset_protected_nopar:cpx {#1} + \cs_gset_protected:cpx {#1} { \exp_not:N \@startsection {#1} { \int_use:N \l__ctex_tmp_int } @@ -372,7 +396,7 @@ \cs_new:cpn { CTEX@#1@tocline } ##1##2 { \CTEXnumberline { ##1 } ##2 } } -\keys_define:nn { ctex } +\ctex_define:n { appendix .meta:nn = { ctex / appendix } {#1} , appendix / name .code:n = @@ -384,7 +408,7 @@ \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix \cs_new_eq:NN \CTEX@save@appendix \appendix -\cs_gset_protected_nopar:Npn \appendix +\cs_gset_protected:Npn \appendix { \CTEX@save@appendix \gdef \CTEX@presection { \CTEX@preappendix } @@ -392,7 +416,7 @@ \gdef \CTEX@postsection { \CTEX@postappendix } \gdef \CTEX@section@numbering { \CTEX@appendix@numbering } } -\cs_new_protected_nopar:Npn \CTEX@makeanchor #1 +\cs_new_protected:Npn \CTEX@makeanchor #1 { } \seq_const_from_clist:Nn \c__ctex_headings_cs_seq { part , spart , sect , ssect } @@ -401,7 +425,7 @@ \cs_new_eq:cc { CTEX@ #1 } { @ #1 } \cs_new_eq:cN { CTEX@makeanchor@ #1 } \CTEX@makeanchor } -\cs_new_protected_nopar:Npn \CTEX@hyperheadinghook +\cs_new_protected:Npn \CTEX@hyperheadinghook { \group_begin: \ifHy@implicit @@ -422,7 +446,7 @@ } \ctex_at_end_package:nn { hyperref } { - \cs_gset_protected_nopar:Npn \CTEX@makeanchor #1 + \cs_gset_protected:Npn \CTEX@makeanchor #1 { \Hy@MakeCurrentHrefAuto {#1} \Hy@raisedlink @@ -437,14 +461,14 @@ { } \ctex_at_end_package:nn { nameref } { - \cs_gset_protected_nopar:Npn \CTEX@gettitle { \NR@gettitle } + \cs_gset_protected:Npn \CTEX@gettitle { \NR@gettitle } \seq_map_inline:Nn \c__ctex_headings_cs_seq { \cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 } { \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } } } } -\cs_new_protected_nopar:Npn \ctex_titlesec_hook: +\cs_new_protected:Npn \ctex_titlesec_hook: { \@ifpackagewith { titlesec } { explicit } { @@ -464,17 +488,17 @@ } \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n } -\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 +\cs_new_protected:Npn \__ctex_titlesec_hook:n #1 { \__ctex_titlesec_format:n {#1} \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 +\cs_new_protected:Npn \__ctex_titlesec_format:n #1 { \cs_if_free:cF { ttlf@#1 } { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format:Nn #1#2 { \tl_set:Nx #1 { @@ -484,7 +508,7 @@ \tl_tail:N #1 } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format_explicit:Nn #1#2 { \cs_set_nopar:Npx #1 ##1 { @@ -494,7 +518,7 @@ \exp_args:No \tl_tail:n { #1 { } } } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_spacing:Nn #1#2 { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } \cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 { @@ -515,14 +539,14 @@ { \cs_if_free:NF \ttl@tocpart { - \cs_set_protected_nopar:Npn \ttl@tocpart + \cs_set_protected:Npn \ttl@tocpart { \tl_set:Nn \ttl@a { \CTEXthepart \hspace { 1em } } } } \seq_map_inline:Nn \c__ctex_headings_seq { \cs_if_exist:cF { ttl@toc #1 } { - \cs_new_protected_nopar:cpx { ttl@toc #1 } + \cs_new_protected:cpx { ttl@toc #1 } { \tl_set:Nn \exp_not:N \ttl@a { @@ -535,7 +559,7 @@ } \group_begin: \char_set_catcode_other:N \# -\cs_new_protected_nopar:Npn \ctex_titleps_hook: +\cs_new_protected:Npn \ctex_titleps_hook: { \ctex_patch_cmd:Nnn \ttl@settopmark { \protect \@namedef { the#1 } { \@nameuse { the#1 } } } @@ -557,12 +581,12 @@ } } \group_end: -\cs_new_nopar:Npn \CTEX@titlepslabel@set #1 +\cs_new:Npn \CTEX@titlepslabel@set #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { \@nameuse { CTEXthe#1 } } } } -\cs_new_nopar:Npn \CTEX@titlepslabel@clear #1 +\cs_new:Npn \CTEX@titlepslabel@clear #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { } } @@ -572,9 +596,9 @@ \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: } \ctex_at_end_package:nn { titleps } { - \cs_set_protected_nopar:Npn \ttl@setifthe #1 + \cs_set_protected:Npn \ttl@setifthe #1 { - \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 } + \exp_args:Nco \cs_set:Npn { ifthe #1 } { \CTEXifname { \protect \@firstoftwo } @@ -601,19 +625,24 @@ { \CTEX@toc@width@n {#1} } { } { \ctex_patch_failure:N \numberline } - \@ifpackageloaded { tocloft } - { } + \cs_new_protected:Npn \__ctex_patch_toc_width:n \c_parameter_token 1 { - \ctex_at_end_package:nn { tocloft } + \@ifpackageloaded { \c_parameter_token 1 } + { } { - \ctex_preto_cmd:NnnTF \numberline - { \char_set_catcode_letter:n { 64 } } - { \CTEX@toc@width@n {#1} } - { } - { \ctex_patch_failure:N \numberline } + \ctex_at_end_package:nn { \c_parameter_token 1 } + { + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } + { \ctex_patch_failure:N \numberline } + } } } } +\__ctex_patch_toc_width:n { tocloft } +\__ctex_patch_toc_width:n { titletoc } \if@twoside \ctex_patch_cmd:Nnn \ps@headings { \ifnum \c@secnumdepth > \z@ \thesection \quad \fi } @@ -635,7 +664,7 @@ { \ifnum \c@secnumdepth > \@ne \thesubsection \hskip 1em \relax \fi } { \CTEXifname { \CTEXthesubsection \quad } { } } } -\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 +\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 { \protected@edef \@currentlabel { @@ -644,17 +673,17 @@ { \exp_not:o { \@currentlabel } } } } -\cs_new_protected_nopar:Npn \ctex_varioref_hook: +\cs_new_protected:Npn \ctex_varioref_hook: { \seq_map_inline:Nn \c__ctex_headings_seq { \ctex_fix_varioref_label:n { ##1 } } } -\cs_new_protected_nopar:Npn \ctex_fix_varioref_label:n #1 +\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 { \tl_if_empty:cT { p@#1 } - { \exp_args:Nno \labelformat {#1} { \cs:w CTEX@the#1 \cs_end: } } + { \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } } -\@ifpackageloaded { varioref } +\cs_if_exist:NTF \labelformat { \ctex_varioref_hook: } { \cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter @@ -668,4 +697,4 @@ \ctex_scheme_input:o { \l__ctex_scheme_tl } %% %% -%% End of file `ctex-article.def'. +%% End of file `ctex-heading-article.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-beamer.def b/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-beamer.def index c0a046c25ab..438a97a00c2 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-beamer.def +++ b/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-beamer.def @@ -1,14 +1,14 @@ %% -%% This is file `ctex-beamer.def', +%% This is file `ctex-heading-beamer.def', %% generated with the docstrip utility. %% %% The original source files were: %% %% ctex.dtx (with options: `heading,beamer') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,19 +20,17 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading modification for beamer (CTEX)} \ProvidesExplFile{ctex-beamer.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \seq_const_from_clist:Nn \c__ctex_headings_seq { part , section , subsection } -\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 +\cs_new_protected:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } \tl_new:c { CTEX@post#1 } @@ -62,7 +60,7 @@ \group_end: } } -\cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 +\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 { \tl_put_right:Nx \l__ctex_tmp_tl { @@ -89,7 +87,7 @@ \__ctex_plus_key_aux:nn {#1} { aftertitle } , } } -\cs_new_nopar:Npn \__ctex_plus_key_aux:nn #1#2 +\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 { #1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , #1 / #2 + .code:n = @@ -103,7 +101,7 @@ \cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 { \tl_set:cn { CTEX@pre#1 } {#2} - \IfNoValueTF {#3} + \tl_if_novalue:nTF {#3} { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } @@ -114,62 +112,73 @@ \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x +\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } +\cs_new_protected:Npn \CTEX@heading@format@initial + { + \normalfont + \tl_clear:N \l__ctex_autoindent_tl + \int_set:Nn \tex_interlinepenalty:D { 10 000 } + \tex_noindent:D + } +\cs_new_protected:Npn \ctex_indent_box:n #1 + { + \dim_set:Nn \tex_parindent:D {#1} + \__ctex_insert_indent: + } +\cs_new_protected:Npn \__ctex_insert_indent: { - \group_end: - \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } + \dim_compare:nNnF \tex_parindent:D = \c_zero_dim + { \tex_indent:D } } +\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n \ExplSyntaxOff \defbeamertemplate*{part page}{CTEX}[1][]{% \begingroup - \CTEX@disableautoindent \par \addvspace{\glueexpr\CTEX@part@beforeskip\relax}% - \CTEX@part@format - \parindent \dimexpr \CTEX@part@indent \relax - \ifodd \CTEX@part@numbering - \CTEX@partname \CTEX@part@aftername - \fi - \begin{beamercolorbox}[sep=16pt,center,#1]{part title} - \CTEX@part@titleformat \insertpart \CTEX@part@aftertitle - \end{beamercolorbox}% + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@indentbox{\CTEX@part@indent}% + \ifodd \CTEX@part@numbering + \CTEX@partname \CTEX@part@aftername + \fi + \begin{beamercolorbox}[sep=16pt,center,#1]{part title} + \CTEX@part@titleformat \insertpart \CTEX@part@aftertitle + \end{beamercolorbox}}% \par \addvspace{\glueexpr\CTEX@part@afterskip\relax}% - \endgroup -} + \endgroup} \defbeamertemplate*{section page}{CTEX}[1][]{% \begingroup - \CTEX@disableautoindent \par \addvspace{\glueexpr\CTEX@section@beforeskip\relax}% - \CTEX@section@format - \parindent \dimexpr \CTEX@section@indent \relax - \ifodd \CTEX@section@numbering - \CTEX@sectionname \CTEX@section@aftername - \fi - \begin{beamercolorbox}[sep=12pt,center,#1]{part title} - \CTEX@section@titleformat \insertsection \CTEX@section@aftertitle - \end{beamercolorbox}% + \CTEX@heading@format@initial + \CTEX@section@format{% + \CTEX@indentbox{\CTEX@section@indent}% + \ifodd \CTEX@section@numbering + \CTEX@sectionname \CTEX@section@aftername + \fi + \begin{beamercolorbox}[sep=12pt,center,#1]{part title} + \CTEX@section@titleformat \insertsection \CTEX@section@aftertitle + \end{beamercolorbox}}% \par \addvspace{\glueexpr\CTEX@section@afterskip\relax}% - \endgroup -} + \endgroup} \defbeamertemplate*{subsection page}{CTEX}[1][]{% \begingroup - \CTEX@disableautoindent \par \addvspace{\glueexpr\CTEX@subsection@beforeskip\relax}% - \CTEX@subsection@format - \parindent \dimexpr \CTEX@subsection@indent \relax - \ifodd \CTEX@subsection@numbering - \CTEX@subsectionname \CTEX@subsection@aftername - \fi - \begin{beamercolorbox}[sep=8pt,center,#1]{part title} - \CTEX@subsection@titleformat \insertsubsection \CTEX@subsection@aftertitle - \end{beamercolorbox}% + \CTEX@heading@format@initial + \CTEX@subsection@format{% + \CTEX@indentbox{\CTEX@subsection@indent}% + \ifodd \CTEX@subsection@numbering + \CTEX@subsectionname \CTEX@subsection@aftername + \fi + \begin{beamercolorbox}[sep=8pt,center,#1]{part title} + \CTEX@subsection@titleformat \insertsubsection \CTEX@subsection@aftertitle + \end{beamercolorbox}}% \par \addvspace{\glueexpr\CTEX@subsection@afterskip\relax}% - \endgroup -} + \endgroup} \defbeamertemplatealias{part page}{default}{CTEX} \defbeamertemplatealias{section page}{default}{CTEX} \defbeamertemplatealias{subsection page}{default}{CTEX} \ExplSyntaxOn -\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 +\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 { \protected@edef \@currentlabel { @@ -178,17 +187,17 @@ { \exp_not:o { \@currentlabel } } } } -\cs_new_protected_nopar:Npn \ctex_varioref_hook: +\cs_new_protected:Npn \ctex_varioref_hook: { \seq_map_inline:Nn \c__ctex_headings_seq { \ctex_fix_varioref_label:n { ##1 } } } -\cs_new_protected_nopar:Npn \ctex_fix_varioref_label:n #1 +\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 { \tl_if_empty:cT { p@#1 } - { \exp_args:Nno \labelformat {#1} { \cs:w CTEX@the#1 \cs_end: } } + { \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } } -\@ifpackageloaded { varioref } +\cs_if_exist:NTF \labelformat { \ctex_varioref_hook: } { \cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter @@ -202,4 +211,4 @@ \ctex_scheme_input:o { \l__ctex_scheme_tl } %% %% -%% End of file `ctex-beamer.def'. +%% End of file `ctex-heading-beamer.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-book.def b/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-book.def index 3766e4b4652..df344f2c679 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-book.def +++ b/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-book.def @@ -1,14 +1,14 @@ %% -%% This is file `ctex-book.def', +%% This is file `ctex-heading-book.def', %% generated with the docstrip utility. %% %% The original source files were: %% %% ctex.dtx (with options: `heading,book') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,23 +20,21 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading modification for book (CTEX)} \ProvidesExplFile{ctex-book.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \seq_const_from_clist:Nn \c__ctex_section_headings_seq { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq \seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq \seq_gput_left:Nn \c__ctex_headings_seq { chapter } \seq_gput_left:Nn \c__ctex_headings_seq { part } -\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 +\cs_new_protected:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } \tl_new:c { CTEX@post#1 } @@ -66,7 +64,7 @@ \group_end: } } -\cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 +\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 { \tl_put_right:Nx \l__ctex_tmp_tl { @@ -90,11 +88,8 @@ #1 / hang .bool_set:N = \exp_not:c { CTEX@#1@hang } , #1 / hang .initial:n = true , #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , - #1 / tocline .code:n = - { - \cs_set:Npn \exp_not:c { CTEX@#1@tocline} - \exp_not:n { ####1####2 } { ####1 } - } , + #1 / tocline .cs_set:Np = \exp_not:c { CTEX@#1@tocline} + \exp_not:n { ##1##2 } , \__ctex_plus_key_aux:nn {#1} { break } , \__ctex_plus_key_aux:nn {#1} { format } , \__ctex_plus_key_aux:nn {#1} { nameformat } , @@ -104,7 +99,7 @@ \__ctex_plus_key_aux:nn {#1} { aftertitle } , } } -\cs_new_nopar:Npn \__ctex_plus_key_aux:nn #1#2 +\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 { #1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , #1 / #2 + .code:n = @@ -118,7 +113,7 @@ \cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 { \tl_set:cn { CTEX@pre#1 } {#2} - \IfNoValueTF {#3} + \tl_if_novalue:nTF {#3} { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } @@ -139,35 +134,49 @@ \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x +\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } +\cs_new_protected:Npn \CTEX@heading@format@initial { - \group_end: - \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } + \normalfont + \tl_clear:N \l__ctex_autoindent_tl + \int_set:Nn \tex_interlinepenalty:D { 10 000 } + \tex_noindent:D + } +\cs_new_protected:Npn \ctex_indent_box:n #1 + { + \dim_set:Nn \tex_parindent:D {#1} + \__ctex_insert_indent: + } +\cs_new_protected:Npn \__ctex_insert_indent: + { + \dim_compare:nNnF \tex_parindent:D = \c_zero_dim + { \tex_indent:D } } -\cs_new_protected_nopar:Npn \CTEX@fixtopskip +\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n +\cs_new_protected:Npn \CTEX@fixtopskip { \CTEX@fixheadingskip \dim_compare:nNnF \tex_pagegoal:D < \c_max_dim { \skip_sub:Nn \l__ctex_heading_skip { \tex_topskip:D } } } -\cs_new_protected_nopar:Npn \CTEX@fixheadingskip +\cs_new_protected:Npn \CTEX@fixheadingskip { \par \dim_set:Nn \tex_prevdepth:D { -1000pt } \skip_sub:Nn \l__ctex_heading_skip { \tex_parskip:D } } \skip_new:N \l__ctex_heading_skip -\cs_new_protected_nopar:Npn \CTEX@setheadingskip +\cs_new_protected:Npn \CTEX@setheadingskip { \skip_set:Nn \l__ctex_heading_skip } \cs_new_eq:NN \CTEX@headingskip \l__ctex_heading_skip \ProvideDocumentCommand \partmark { m } { \markboth { } { } } \cs_new_eq:NN \CTEXifname \use_ii:nn -\cs_new_protected_nopar:Npn \CTEX@ifnametrue +\cs_new_protected:Npn \CTEX@ifnametrue { \cs_set_eq:NN \CTEXifname \use_i:nn } -\cs_new_protected_nopar:Npn \CTEX@ifnamefalse +\cs_new_protected:Npn \CTEX@ifnamefalse { \cs_set_eq:NN \CTEXifname \use_ii:nn } -\cs_new_protected_nopar:Npn \CTEX@addloflotskip #1 +\cs_new_protected:Npn \CTEX@addloflotskip #1 { \skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@lofskip } } \skip_if_eq:nnF { \l__ctex_heading_skip } { \c_zero_skip } @@ -184,8 +193,6 @@ } \cs_new_protected:Npn \CTEX@addtocline #1#2 { \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } } -\cs_new_protected_nopar:Npn \CTEX@disableautoindent - { \tl_clear:N \l__ctex_autoindent_tl } \renewcommand\part{% \CTEX@part@break \thispagestyle{\CTEX@part@pagestyle}% @@ -214,51 +221,53 @@ \fi \CTEX@gettitle{#1}% \CTEX@addtocline{part}{#1}% - \partmark{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}% - {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% - \CTEX@part@titleformat{#2}% - \CTEX@part@aftertitle}% + \partmark{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}% + {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% + \CTEX@part@titleformat{#2}% + \CTEX@part@aftertitle}\par + \endgroup \@endpart} \def\@spart#1{% - \CTEX@ifnamefalse - \CTEX@makeanchor@spart{part*}% - \CTEX@gettitle{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}{}% - \CTEX@part@titleformat{#1}% - \CTEX@part@aftertitle}% - \@endpart} + \CTEX@ifnamefalse + \CTEX@makeanchor@spart{part*}% + \CTEX@gettitle{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}{}% + \CTEX@part@titleformat{#1}% + \CTEX@part@aftertitle}\par + \endgroup + \@endpart} \def\@endpart{% - \CTEX@setheadingskip \CTEX@part@afterskip - \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - \newpage - \if@twoside - \if@openright - \null - \thispagestyle{empty}% - \newpage - \fi - \fi - \if@tempswa - \twocolumn - \fi} + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip + \newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} \renewcommand\chapter{% - \CTEX@chapter@break - \thispagestyle{\CTEX@chapter@pagestyle}% - \global\@topnum\z@ - \ifodd \CTEX@chapter@afterindent - \@afterindenttrue - \else - \@afterindentfalse - \fi - \secdef\@chapter\@schapter} + \CTEX@chapter@break + \thispagestyle{\CTEX@chapter@pagestyle}% + \global\@topnum\z@ + \ifodd \CTEX@chapter@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter @@ -302,33 +311,33 @@ \CTEX@setheadingskip \CTEX@chapter@beforeskip \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi \vspace*{\CTEX@headingskip}% - {\CTEX@disableautoindent - \normalfont \CTEX@chapter@format - \interlinepenalty\@M - \CTEX@hangindent{chapter}% - {\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% - \CTEX@chapter@titleformat{#1}% - \CTEX@chapter@aftertitle - \nobreak - \CTEX@setheadingskip \CTEX@chapter@afterskip - \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - }} + \begingroup + \CTEX@heading@format@initial + \CTEX@chapter@format{% + \CTEX@headinghang{chapter}% + {\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip} \def\@makeschapterhead#1{% \CTEX@setheadingskip \CTEX@chapter@beforeskip \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi \vspace*{\CTEX@headingskip}% - {\CTEX@disableautoindent - \normalfont \CTEX@chapter@format - \interlinepenalty\@M - \CTEX@hangindent{chapter}{}% - \CTEX@chapter@titleformat{#1}% - \CTEX@chapter@aftertitle - \nobreak - \CTEX@setheadingskip \CTEX@chapter@afterskip - \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - }} + \begingroup + \CTEX@heading@format@initial + \CTEX@chapter@format{% + \CTEX@headinghang{chapter}{}% + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip} \def\@startsection#1#2#3#4#5#6{% \if@noskipsec \leavevmode \fi \par @@ -371,22 +380,22 @@ \CTEX@gettitle{#7}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #6{% - \CTEX@hangfrom{\hskip\glueexpr #3\relax\@svsec}% - \interlinepenalty \@M + \CTEX@sectionhang{#3}{\@svsec}% \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% + \csname CTEX@#1@aftertitle\endcsname}\par \endgroup \csname #1mark\endcsname{#7}% \CTEX@addtocline{#1}{#7}% \else \def\@svsechd{% - #6{\hskip\glueexpr #3\relax - \@svsec - \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% - \csname #1mark\endcsname{#7}% - \CTEX@addtocline{#1}{#7}}% + #6{% + {\CTEX@indentbox{#3}}\@svsec + \csname CTEX@#1@titleformat\endcsname{#8}% + \csname CTEX@#1@aftertitle\endcsname}% + \csname #1mark\endcsname{#7}% + \CTEX@addtocline{#1}{#7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% @@ -394,15 +403,15 @@ \CTEX@gettitle{#5}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #4{% - \CTEX@hangfrom{\hskip\glueexpr #1\relax}% - \interlinepenalty \@M + \CTEX@sectionhang{#1}{}% \CTEX@titleformat@n{#5}% - \CTEX@aftertitle}% + \CTEX@aftertitle}\par \endgroup \else - \def\@svsechd{#4{\hskip\glueexpr #1\relax - \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{{\CTEX@indentbox{#1}}% + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} \def\@xsect#1{% @@ -422,32 +431,47 @@ \clubpenalty\@M \begingroup \@svsechd \endgroup \unskip - \hskip\glueexpr #1\relax + \CTEX@heading@glue{#1}% \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \fi \ignorespaces} -\cs_new_protected:Npn \CTEX@hangindent #1#2 +\cs_new_protected:Npn \CTEX@headinghang #1 + { + \ctex_heading_hang:cnn + { CTEX@#1@hang } + { \use:c { CTEX@#1@indent } } + } +\cs_new_protected:Npn \CTEX@sectionhang + { \ctex_heading_hang:Nnn \CTEX@hang } +\cs_new_protected:Npn \ctex_heading_hang:Nnn #1#2#3 { - \dim_set:Nn \parindent { \use:c { CTEX@#1@indent } } - \bool_if:cTF { CTEX@#1@hang } - { \@hangfrom { \__ctex_indent_aux: #2 } } - {#2} + \dim_set:Nn \tex_parindent:D {#2} + \bool_if:NTF #1 + { \ctex_hang_from:n } + { \use:n } + { \__ctex_insert_indent: #3 } } -\cs_new_protected_nopar:Npn \__ctex_indent_aux: +\cs_new_protected:Npn \ctex_hang_from:n #1 { - \dim_compare:nNnF \parindent = \c_zero_dim - { \skip_horizontal:n { \parindent } } + \tex_noindent:D + \hbox_set:Nn \l__ctex_tmp_box {#1} + \tex_hangindent:D = \box_wd:N \l__ctex_tmp_box + \box_use_drop:N \l__ctex_tmp_box } -\cs_new_protected_nopar:Npn \CTEX@hangfrom +\cs_generate_variant:Nn \ctex_heading_hang:Nnn { c } +\cs_new_protected:Npn \ctex_heading_glue:n #1 { - \bool_if:NTF \CTEX@hang - { \@hangfrom } - { \noindent \use:n } + \group_begin: + \skip_set:Nn \l__ctex_heading_skip {#1} + \dim_compare:nNnF \l__ctex_heading_skip = \c_zero_dim + { \skip_horizontal:N \l__ctex_heading_skip } + \group_end: } -\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 +\cs_new_eq:NN \CTEX@heading@glue \ctex_heading_glue:n +\cs_new_protected:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } @@ -476,7 +500,7 @@ { } #2 } -\cs_new_nopar:Npn \CTEXnumberline #1 +\cs_new:Npn \CTEXnumberline #1 { \CTEXifname { \protect \numberline { \use:c { CTEXthe #1 } } } @@ -486,7 +510,7 @@ \seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int - \cs_gset_protected_nopar:cpx {#1} + \cs_gset_protected:cpx {#1} { \exp_not:N \@startsection {#1} { \int_use:N \l__ctex_tmp_int } @@ -498,7 +522,7 @@ \cs_new:cpn { CTEX@#1@tocline } ##1##2 { \CTEXnumberline { ##1 } ##2 } } -\keys_define:nn { ctex } +\ctex_define:n { appendix .meta:nn = { ctex / appendix } {#1} , appendix / name .code:n = @@ -510,7 +534,7 @@ \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix \cs_new_eq:NN \CTEX@save@appendix \appendix -\cs_gset_protected_nopar:Npn \appendix +\cs_gset_protected:Npn \appendix { \CTEX@save@appendix \gdef \CTEX@prechapter { \CTEX@preappendix } @@ -518,7 +542,7 @@ \gdef \CTEX@postchapter { \CTEX@postappendix } \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } } -\cs_new_protected_nopar:Npn \CTEX@makeanchor #1 +\cs_new_protected:Npn \CTEX@makeanchor #1 { } \seq_const_from_clist:Nn \c__ctex_headings_cs_seq { part , spart , chapter , schapter , sect , ssect } @@ -527,7 +551,7 @@ \cs_new_eq:cc { CTEX@ #1 } { @ #1 } \cs_new_eq:cN { CTEX@makeanchor@ #1 } \CTEX@makeanchor } -\cs_new_protected_nopar:Npn \CTEX@hyperheadinghook +\cs_new_protected:Npn \CTEX@hyperheadinghook { \group_begin: \ifHy@implicit @@ -548,7 +572,7 @@ } \ctex_at_end_package:nn { hyperref } { - \cs_gset_protected_nopar:Npn \CTEX@makeanchor #1 + \cs_gset_protected:Npn \CTEX@makeanchor #1 { \Hy@MakeCurrentHrefAuto {#1} \Hy@raisedlink @@ -563,14 +587,14 @@ { } \ctex_at_end_package:nn { nameref } { - \cs_gset_protected_nopar:Npn \CTEX@gettitle { \NR@gettitle } + \cs_gset_protected:Npn \CTEX@gettitle { \NR@gettitle } \seq_map_inline:Nn \c__ctex_headings_cs_seq { \cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 } { \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } } } } -\cs_new_protected_nopar:Npn \ctex_titlesec_hook: +\cs_new_protected:Npn \ctex_titlesec_hook: { \@ifpackagewith { titlesec } { explicit } { @@ -590,17 +614,17 @@ } \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n } -\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 +\cs_new_protected:Npn \__ctex_titlesec_hook:n #1 { \__ctex_titlesec_format:n {#1} \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 +\cs_new_protected:Npn \__ctex_titlesec_format:n #1 { \cs_if_free:cF { ttlf@#1 } { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format:Nn #1#2 { \tl_set:Nx #1 { @@ -610,7 +634,7 @@ \tl_tail:N #1 } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format_explicit:Nn #1#2 { \cs_set_nopar:Npx #1 ##1 { @@ -620,7 +644,7 @@ \exp_args:No \tl_tail:n { #1 { } } } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_spacing:Nn #1#2 { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } \cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 { @@ -642,14 +666,14 @@ \tl_set:Nn \ttl@chapterout { \typeout { \CTEXthechapter } } \cs_if_free:NF \ttl@tocpart { - \cs_set_protected_nopar:Npn \ttl@tocpart + \cs_set_protected:Npn \ttl@tocpart { \tl_set:Nn \ttl@a { \CTEXthepart \hspace { 1em } } } } \seq_map_inline:Nn \c__ctex_headings_seq { \cs_if_exist:cF { ttl@toc #1 } { - \cs_new_protected_nopar:cpx { ttl@toc #1 } + \cs_new_protected:cpx { ttl@toc #1 } { \tl_set:Nn \exp_not:N \ttl@a { @@ -662,7 +686,7 @@ } \group_begin: \char_set_catcode_other:N \# -\cs_new_protected_nopar:Npn \ctex_titleps_hook: +\cs_new_protected:Npn \ctex_titleps_hook: { \ctex_patch_cmd:Nnn \ttl@settopmark { \protect \@namedef { the#1 } { \@nameuse { the#1 } } } @@ -684,12 +708,12 @@ } } \group_end: -\cs_new_nopar:Npn \CTEX@titlepslabel@set #1 +\cs_new:Npn \CTEX@titlepslabel@set #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { \@nameuse { CTEXthe#1 } } } } -\cs_new_nopar:Npn \CTEX@titlepslabel@clear #1 +\cs_new:Npn \CTEX@titlepslabel@clear #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { } } @@ -699,9 +723,9 @@ \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: } \ctex_at_end_package:nn { titleps } { - \cs_set_protected_nopar:Npn \ttl@setifthe #1 + \cs_set_protected:Npn \ttl@setifthe #1 { - \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 } + \exp_args:Nco \cs_set:Npn { ifthe #1 } { \CTEXifname { \protect \@firstoftwo } @@ -728,19 +752,24 @@ { \CTEX@toc@width@n {#1} } { } { \ctex_patch_failure:N \numberline } - \@ifpackageloaded { tocloft } - { } + \cs_new_protected:Npn \__ctex_patch_toc_width:n \c_parameter_token 1 { - \ctex_at_end_package:nn { tocloft } + \@ifpackageloaded { \c_parameter_token 1 } + { } { - \ctex_preto_cmd:NnnTF \numberline - { \char_set_catcode_letter:n { 64 } } - { \CTEX@toc@width@n {#1} } - { } - { \ctex_patch_failure:N \numberline } + \ctex_at_end_package:nn { \c_parameter_token 1 } + { + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } + { \ctex_patch_failure:N \numberline } + } } } } +\__ctex_patch_toc_width:n { tocloft } +\__ctex_patch_toc_width:n { titletoc } \ctex_patch_cmd:Nnn \ps@headings { \ifnum \c@secnumdepth > \m@ne \if@mainmatter @@ -762,7 +791,7 @@ { \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } { \CTEXifname { \CTEXthesection \quad } { } } } -\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 +\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 { \protected@edef \@currentlabel { @@ -771,17 +800,17 @@ { \exp_not:o { \@currentlabel } } } } -\cs_new_protected_nopar:Npn \ctex_varioref_hook: +\cs_new_protected:Npn \ctex_varioref_hook: { \seq_map_inline:Nn \c__ctex_headings_seq { \ctex_fix_varioref_label:n { ##1 } } } -\cs_new_protected_nopar:Npn \ctex_fix_varioref_label:n #1 +\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 { \tl_if_empty:cT { p@#1 } - { \exp_args:Nno \labelformat {#1} { \cs:w CTEX@the#1 \cs_end: } } + { \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } } -\@ifpackageloaded { varioref } +\cs_if_exist:NTF \labelformat { \ctex_varioref_hook: } { \cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter @@ -795,4 +824,4 @@ \ctex_scheme_input:o { \l__ctex_scheme_tl } %% %% -%% End of file `ctex-book.def'. +%% End of file `ctex-heading-book.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/ctex-report.def b/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-report.def index 1107fd0582b..751de60273c 100644 --- a/Master/texmf-dist/tex/latex/ctex/ctex-report.def +++ b/Master/texmf-dist/tex/latex/ctex/heading/ctex-heading-report.def @@ -1,14 +1,14 @@ %% -%% This is file `ctex-report.def', +%% This is file `ctex-heading-report.def', %% generated with the docstrip utility. %% %% The original source files were: %% %% ctex.dtx (with options: `heading,report') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,23 +20,21 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Heading modification for report (CTEX)} \ProvidesExplFile{ctex-report.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} \seq_const_from_clist:Nn \c__ctex_section_headings_seq { section , subsection , subsubsection , paragraph , subparagraph } \seq_new:N \c__ctex_headings_seq \seq_gset_eq:NN \c__ctex_headings_seq \c__ctex_section_headings_seq \seq_gput_left:Nn \c__ctex_headings_seq { chapter } \seq_gput_left:Nn \c__ctex_headings_seq { part } -\cs_new_protected_nopar:Npn \__ctex_initial_heading:n #1 +\cs_new_protected:Npn \__ctex_initial_heading:n #1 { \tl_new:c { CTEX@pre#1 } \tl_new:c { CTEX@post#1 } @@ -66,7 +64,7 @@ \group_end: } } -\cs_new_protected_nopar:Npn \__ctex_def_heading_keys:n #1 +\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 { \tl_put_right:Nx \l__ctex_tmp_tl { @@ -90,11 +88,8 @@ #1 / hang .bool_set:N = \exp_not:c { CTEX@#1@hang } , #1 / hang .initial:n = true , #1 / runin .bool_set:N = \exp_not:c { CTEX@#1@runin } , - #1 / tocline .code:n = - { - \cs_set:Npn \exp_not:c { CTEX@#1@tocline} - \exp_not:n { ####1####2 } { ####1 } - } , + #1 / tocline .cs_set:Np = \exp_not:c { CTEX@#1@tocline} + \exp_not:n { ##1##2 } , \__ctex_plus_key_aux:nn {#1} { break } , \__ctex_plus_key_aux:nn {#1} { format } , \__ctex_plus_key_aux:nn {#1} { nameformat } , @@ -104,7 +99,7 @@ \__ctex_plus_key_aux:nn {#1} { aftertitle } , } } -\cs_new_nopar:Npn \__ctex_plus_key_aux:nn #1#2 +\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 { #1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , #1 / #2 + .code:n = @@ -118,7 +113,7 @@ \cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 { \tl_set:cn { CTEX@pre#1 } {#2} - \IfNoValueTF {#3} + \tl_if_novalue:nTF {#3} { \tl_clear:c { CTEX@post#1 } } { \tl_set:cn { CTEX@post#1 } {#3} } } @@ -139,35 +134,49 @@ \__ctex_initial_heading:n {#1} \__ctex_def_heading_keys:n {#1} } -\use:x +\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } +\cs_new_protected:Npn \CTEX@heading@format@initial { - \group_end: - \keys_define:nn { ctex } { \exp_not:o { \l__ctex_tmp_tl } } + \normalfont + \tl_clear:N \l__ctex_autoindent_tl + \int_set:Nn \tex_interlinepenalty:D { 10 000 } + \tex_noindent:D + } +\cs_new_protected:Npn \ctex_indent_box:n #1 + { + \dim_set:Nn \tex_parindent:D {#1} + \__ctex_insert_indent: + } +\cs_new_protected:Npn \__ctex_insert_indent: + { + \dim_compare:nNnF \tex_parindent:D = \c_zero_dim + { \tex_indent:D } } -\cs_new_protected_nopar:Npn \CTEX@fixtopskip +\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n +\cs_new_protected:Npn \CTEX@fixtopskip { \CTEX@fixheadingskip \dim_compare:nNnF \tex_pagegoal:D < \c_max_dim { \skip_sub:Nn \l__ctex_heading_skip { \tex_topskip:D } } } -\cs_new_protected_nopar:Npn \CTEX@fixheadingskip +\cs_new_protected:Npn \CTEX@fixheadingskip { \par \dim_set:Nn \tex_prevdepth:D { -1000pt } \skip_sub:Nn \l__ctex_heading_skip { \tex_parskip:D } } \skip_new:N \l__ctex_heading_skip -\cs_new_protected_nopar:Npn \CTEX@setheadingskip +\cs_new_protected:Npn \CTEX@setheadingskip { \skip_set:Nn \l__ctex_heading_skip } \cs_new_eq:NN \CTEX@headingskip \l__ctex_heading_skip \ProvideDocumentCommand \partmark { m } { \markboth { } { } } \cs_new_eq:NN \CTEXifname \use_ii:nn -\cs_new_protected_nopar:Npn \CTEX@ifnametrue +\cs_new_protected:Npn \CTEX@ifnametrue { \cs_set_eq:NN \CTEXifname \use_i:nn } -\cs_new_protected_nopar:Npn \CTEX@ifnamefalse +\cs_new_protected:Npn \CTEX@ifnamefalse { \cs_set_eq:NN \CTEXifname \use_ii:nn } -\cs_new_protected_nopar:Npn \CTEX@addloflotskip #1 +\cs_new_protected:Npn \CTEX@addloflotskip #1 { \skip_set:Nn \l__ctex_heading_skip { \use:c { CTEX@#1@lofskip } } \skip_if_eq:nnF { \l__ctex_heading_skip } { \c_zero_skip } @@ -184,8 +193,6 @@ } \cs_new_protected:Npn \CTEX@addtocline #1#2 { \addcontentsline { toc } {#1} { \use:c { CTEX@#1@tocline } {#1} {#2} } } -\cs_new_protected_nopar:Npn \CTEX@disableautoindent - { \tl_clear:N \l__ctex_autoindent_tl } \renewcommand\part{% \CTEX@part@break \thispagestyle{\CTEX@part@pagestyle}% @@ -214,51 +221,53 @@ \fi \CTEX@gettitle{#1}% \CTEX@addtocline{part}{#1}% - \partmark{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}% - {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% - \CTEX@part@titleformat{#2}% - \CTEX@part@aftertitle}% + \partmark{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}% + {\CTEXifname{\CTEX@partname\CTEX@part@aftername}{}}% + \CTEX@part@titleformat{#2}% + \CTEX@part@aftertitle}\par + \endgroup \@endpart} \def\@spart#1{% - \CTEX@ifnamefalse - \CTEX@makeanchor@spart{part*}% - \CTEX@gettitle{#1}% - {\interlinepenalty \@M - \CTEX@disableautoindent - \normalfont \CTEX@part@format - \CTEX@hangindent{part}{}% - \CTEX@part@titleformat{#1}% - \CTEX@part@aftertitle}% - \@endpart} + \CTEX@ifnamefalse + \CTEX@makeanchor@spart{part*}% + \CTEX@gettitle{#1}% + \begingroup + \CTEX@heading@format@initial + \CTEX@part@format{% + \CTEX@headinghang{part}{}% + \CTEX@part@titleformat{#1}% + \CTEX@part@aftertitle}\par + \endgroup + \@endpart} \def\@endpart{% - \CTEX@setheadingskip \CTEX@part@afterskip - \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - \newpage - \if@twoside - \if@openright - \null - \thispagestyle{empty}% - \newpage - \fi - \fi - \if@tempswa - \twocolumn - \fi} + \CTEX@setheadingskip \CTEX@part@afterskip + \ifodd \CTEX@part@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip + \newpage + \if@twoside + \if@openright + \null + \thispagestyle{empty}% + \newpage + \fi + \fi + \if@tempswa + \twocolumn + \fi} \renewcommand\chapter{% - \CTEX@chapter@break - \thispagestyle{\CTEX@chapter@pagestyle}% - \global\@topnum\z@ - \ifodd \CTEX@chapter@afterindent - \@afterindenttrue - \else - \@afterindentfalse - \fi - \secdef\@chapter\@schapter} + \CTEX@chapter@break + \thispagestyle{\CTEX@chapter@pagestyle}% + \global\@topnum\z@ + \ifodd \CTEX@chapter@afterindent + \@afterindenttrue + \else + \@afterindentfalse + \fi + \secdef\@chapter\@schapter} \def\@chapter[#1]#2{% \ifnum \c@secnumdepth >\m@ne \ifodd \CTEX@chapter@numbering @@ -297,33 +306,33 @@ \CTEX@setheadingskip \CTEX@chapter@beforeskip \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi \vspace*{\CTEX@headingskip}% - {\CTEX@disableautoindent - \normalfont \CTEX@chapter@format - \interlinepenalty\@M - \CTEX@hangindent{chapter}% - {\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% - \CTEX@chapter@titleformat{#1}% - \CTEX@chapter@aftertitle - \nobreak - \CTEX@setheadingskip \CTEX@chapter@afterskip - \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - }} + \begingroup + \CTEX@heading@format@initial + \CTEX@chapter@format{% + \CTEX@headinghang{chapter}% + {\CTEXifname{\CTEX@chaptername\CTEX@chapter@aftername}{}}% + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip} \def\@makeschapterhead#1{% \CTEX@setheadingskip \CTEX@chapter@beforeskip \ifodd \CTEX@chapter@fixskip \CTEX@fixtopskip \fi \vspace*{\CTEX@headingskip}% - {\CTEX@disableautoindent - \normalfont \CTEX@chapter@format - \interlinepenalty\@M - \CTEX@hangindent{chapter}{}% - \CTEX@chapter@titleformat{#1}% - \CTEX@chapter@aftertitle - \nobreak - \CTEX@setheadingskip \CTEX@chapter@afterskip - \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi - \vskip \CTEX@headingskip - }} + \begingroup + \CTEX@heading@format@initial + \CTEX@chapter@format{% + \CTEX@headinghang{chapter}{}% + \CTEX@chapter@titleformat{#1}% + \CTEX@chapter@aftertitle}\par + \endgroup + \nobreak + \CTEX@setheadingskip \CTEX@chapter@afterskip + \ifodd \CTEX@chapter@fixskip \CTEX@fixheadingskip \fi + \vskip \CTEX@headingskip} \def\@startsection#1#2#3#4#5#6{% \if@noskipsec \leavevmode \fi \par @@ -366,22 +375,22 @@ \CTEX@gettitle{#7}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #6{% - \CTEX@hangfrom{\hskip\glueexpr #3\relax\@svsec}% - \interlinepenalty \@M + \CTEX@sectionhang{#3}{\@svsec}% \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% + \csname CTEX@#1@aftertitle\endcsname}\par \endgroup \csname #1mark\endcsname{#7}% \CTEX@addtocline{#1}{#7}% \else \def\@svsechd{% - #6{\hskip\glueexpr #3\relax - \@svsec - \csname CTEX@#1@titleformat\endcsname{#8}% - \csname CTEX@#1@aftertitle\endcsname}% - \csname #1mark\endcsname{#7}% - \CTEX@addtocline{#1}{#7}}% + #6{% + {\CTEX@indentbox{#3}}\@svsec + \csname CTEX@#1@titleformat\endcsname{#8}% + \csname CTEX@#1@aftertitle\endcsname}% + \csname #1mark\endcsname{#7}% + \CTEX@addtocline{#1}{#7}}% \fi \@xsect{#5}} \def\@ssect#1#2#3#4#5{% @@ -389,15 +398,15 @@ \CTEX@gettitle{#5}% \unless \ifodd \CTEX@runin \begingroup + \CTEX@heading@format@initial #4{% - \CTEX@hangfrom{\hskip\glueexpr #1\relax}% - \interlinepenalty \@M + \CTEX@sectionhang{#1}{}% \CTEX@titleformat@n{#5}% - \CTEX@aftertitle}% + \CTEX@aftertitle}\par \endgroup \else - \def\@svsechd{#4{\hskip\glueexpr #1\relax - \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% + \def\@svsechd{#4{{\CTEX@indentbox{#1}}% + \CTEX@titleformat@n{#5}\CTEX@aftertitle}}% \fi \@xsect{#3}} \def\@xsect#1{% @@ -417,32 +426,47 @@ \clubpenalty\@M \begingroup \@svsechd \endgroup \unskip - \hskip\glueexpr #1\relax + \CTEX@heading@glue{#1}% \else \clubpenalty \@clubpenalty \everypar{}% \fi}% \fi \ignorespaces} -\cs_new_protected:Npn \CTEX@hangindent #1#2 +\cs_new_protected:Npn \CTEX@headinghang #1 + { + \ctex_heading_hang:cnn + { CTEX@#1@hang } + { \use:c { CTEX@#1@indent } } + } +\cs_new_protected:Npn \CTEX@sectionhang + { \ctex_heading_hang:Nnn \CTEX@hang } +\cs_new_protected:Npn \ctex_heading_hang:Nnn #1#2#3 { - \dim_set:Nn \parindent { \use:c { CTEX@#1@indent } } - \bool_if:cTF { CTEX@#1@hang } - { \@hangfrom { \__ctex_indent_aux: #2 } } - {#2} + \dim_set:Nn \tex_parindent:D {#2} + \bool_if:NTF #1 + { \ctex_hang_from:n } + { \use:n } + { \__ctex_insert_indent: #3 } } -\cs_new_protected_nopar:Npn \__ctex_indent_aux: +\cs_new_protected:Npn \ctex_hang_from:n #1 { - \dim_compare:nNnF \parindent = \c_zero_dim - { \skip_horizontal:n { \parindent } } + \tex_noindent:D + \hbox_set:Nn \l__ctex_tmp_box {#1} + \tex_hangindent:D = \box_wd:N \l__ctex_tmp_box + \box_use_drop:N \l__ctex_tmp_box } -\cs_new_protected_nopar:Npn \CTEX@hangfrom +\cs_generate_variant:Nn \ctex_heading_hang:Nnn { c } +\cs_new_protected:Npn \ctex_heading_glue:n #1 { - \bool_if:NTF \CTEX@hang - { \@hangfrom } - { \noindent \use:n } + \group_begin: + \skip_set:Nn \l__ctex_heading_skip {#1} + \dim_compare:nNnF \l__ctex_heading_skip = \c_zero_dim + { \skip_horizontal:N \l__ctex_heading_skip } + \group_end: } -\cs_new_protected_nopar:Npn \CTEX@update@sectionformat@n #1 +\cs_new_eq:NN \CTEX@heading@glue \ctex_heading_glue:n +\cs_new_protected:Npn \CTEX@update@sectionformat@n #1 { \cs_set_eq:Nc \CTEX@titleformat@n { CTEX@#1@titleformat } \cs_set_eq:Nc \CTEX@aftertitle { CTEX@#1@aftertitle } @@ -471,7 +495,7 @@ { } #2 } -\cs_new_nopar:Npn \CTEXnumberline #1 +\cs_new:Npn \CTEXnumberline #1 { \CTEXifname { \protect \numberline { \use:c { CTEXthe #1 } } } @@ -481,7 +505,7 @@ \seq_map_inline:Nn \c__ctex_section_headings_seq { \int_incr:N \l__ctex_tmp_int - \cs_gset_protected_nopar:cpx {#1} + \cs_gset_protected:cpx {#1} { \exp_not:N \@startsection {#1} { \int_use:N \l__ctex_tmp_int } @@ -493,7 +517,7 @@ \cs_new:cpn { CTEX@#1@tocline } ##1##2 { \CTEXnumberline { ##1 } ##2 } } -\keys_define:nn { ctex } +\ctex_define:n { appendix .meta:nn = { ctex / appendix } {#1} , appendix / name .code:n = @@ -505,7 +529,7 @@ \tl_new:N \CTEX@preappendix \tl_new:N \CTEX@postappendix \cs_new_eq:NN \CTEX@save@appendix \appendix -\cs_gset_protected_nopar:Npn \appendix +\cs_gset_protected:Npn \appendix { \CTEX@save@appendix \gdef \CTEX@prechapter { \CTEX@preappendix } @@ -513,7 +537,7 @@ \gdef \CTEX@postchapter { \CTEX@postappendix } \gdef \CTEX@chapter@numbering { \CTEX@appendix@numbering } } -\cs_new_protected_nopar:Npn \CTEX@makeanchor #1 +\cs_new_protected:Npn \CTEX@makeanchor #1 { } \seq_const_from_clist:Nn \c__ctex_headings_cs_seq { part , spart , chapter , schapter , sect , ssect } @@ -522,7 +546,7 @@ \cs_new_eq:cc { CTEX@ #1 } { @ #1 } \cs_new_eq:cN { CTEX@makeanchor@ #1 } \CTEX@makeanchor } -\cs_new_protected_nopar:Npn \CTEX@hyperheadinghook +\cs_new_protected:Npn \CTEX@hyperheadinghook { \group_begin: \ifHy@implicit @@ -543,7 +567,7 @@ } \ctex_at_end_package:nn { hyperref } { - \cs_gset_protected_nopar:Npn \CTEX@makeanchor #1 + \cs_gset_protected:Npn \CTEX@makeanchor #1 { \Hy@MakeCurrentHrefAuto {#1} \Hy@raisedlink @@ -558,14 +582,14 @@ { } \ctex_at_end_package:nn { nameref } { - \cs_gset_protected_nopar:Npn \CTEX@gettitle { \NR@gettitle } + \cs_gset_protected:Npn \CTEX@gettitle { \NR@gettitle } \seq_map_inline:Nn \c__ctex_headings_cs_seq { \cs_if_eq:ccT { NR@ #1 } { CTEX@ #1 } { \cs_gset_eq:cc { @ #1 } { CTEX@ #1 } } } } -\cs_new_protected_nopar:Npn \ctex_titlesec_hook: +\cs_new_protected:Npn \ctex_titlesec_hook: { \@ifpackagewith { titlesec } { explicit } { @@ -585,17 +609,17 @@ } \seq_map_function:NN \c__ctex_section_headings_seq \__ctex_titlesec_hook:n } -\cs_new_protected_nopar:Npn \__ctex_titlesec_hook:n #1 +\cs_new_protected:Npn \__ctex_titlesec_hook:n #1 { \__ctex_titlesec_format:n {#1} \exp_args:Nc \__ctex_titlesec_spacing:Nn { ttls@#1 } {#1} } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:n #1 +\cs_new_protected:Npn \__ctex_titlesec_format:n #1 { \cs_if_free:cF { ttlf@#1 } { \exp_args:Nc \__ctex_titlesec_format:Nn { ttlf@#1 } {#1} } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format:Nn #1#2 { \tl_set:Nx #1 { @@ -605,7 +629,7 @@ \tl_tail:N #1 } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_format_explicit:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_format_explicit:Nn #1#2 { \cs_set_nopar:Npx #1 ##1 { @@ -615,7 +639,7 @@ \exp_args:No \tl_tail:n { #1 { } } } } -\cs_new_protected_nopar:Npn \__ctex_titlesec_spacing:Nn #1#2 +\cs_new_protected:Npn \__ctex_titlesec_spacing:Nn #1#2 { \tl_set:Nx #1 { \exp_after:wN \__ctex_titlesec_spacing:nnnnnn #1 {#2} } } \cs_new:Npn \__ctex_titlesec_spacing:nnnnnn #1#2#3#4#5#6 { @@ -637,14 +661,14 @@ \tl_set:Nn \ttl@chapterout { \typeout { \CTEXthechapter } } \cs_if_free:NF \ttl@tocpart { - \cs_set_protected_nopar:Npn \ttl@tocpart + \cs_set_protected:Npn \ttl@tocpart { \tl_set:Nn \ttl@a { \CTEXthepart \hspace { 1em } } } } \seq_map_inline:Nn \c__ctex_headings_seq { \cs_if_exist:cF { ttl@toc #1 } { - \cs_new_protected_nopar:cpx { ttl@toc #1 } + \cs_new_protected:cpx { ttl@toc #1 } { \tl_set:Nn \exp_not:N \ttl@a { @@ -657,7 +681,7 @@ } \group_begin: \char_set_catcode_other:N \# -\cs_new_protected_nopar:Npn \ctex_titleps_hook: +\cs_new_protected:Npn \ctex_titleps_hook: { \ctex_patch_cmd:Nnn \ttl@settopmark { \protect \@namedef { the#1 } { \@nameuse { the#1 } } } @@ -679,12 +703,12 @@ } } \group_end: -\cs_new_nopar:Npn \CTEX@titlepslabel@set #1 +\cs_new:Npn \CTEX@titlepslabel@set #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { \@nameuse { CTEXthe#1 } } } } -\cs_new_nopar:Npn \CTEX@titlepslabel@clear #1 +\cs_new:Npn \CTEX@titlepslabel@clear #1 { \cs_if_free:cF { CTEXthe#1 } { \protect \@namedef { CTEXthe#1 } { } } @@ -694,9 +718,9 @@ \ctex_at_end_package:nn { titleps } { \ctex_titleps_hook: } \ctex_at_end_package:nn { titleps } { - \cs_set_protected_nopar:Npn \ttl@setifthe #1 + \cs_set_protected:Npn \ttl@setifthe #1 { - \exp_args:Nco \cs_set_nopar:Npn { ifthe #1 } + \exp_args:Nco \cs_set:Npn { ifthe #1 } { \CTEXifname { \protect \@firstoftwo } @@ -723,19 +747,24 @@ { \CTEX@toc@width@n {#1} } { } { \ctex_patch_failure:N \numberline } - \@ifpackageloaded { tocloft } - { } + \cs_new_protected:Npn \__ctex_patch_toc_width:n \c_parameter_token 1 { - \ctex_at_end_package:nn { tocloft } + \@ifpackageloaded { \c_parameter_token 1 } + { } { - \ctex_preto_cmd:NnnTF \numberline - { \char_set_catcode_letter:n { 64 } } - { \CTEX@toc@width@n {#1} } - { } - { \ctex_patch_failure:N \numberline } + \ctex_at_end_package:nn { \c_parameter_token 1 } + { + \ctex_preto_cmd:NnnTF \numberline + { \char_set_catcode_letter:n { 64 } } + { \CTEX@toc@width@n {#1} } + { } + { \ctex_patch_failure:N \numberline } + } } } } +\__ctex_patch_toc_width:n { tocloft } +\__ctex_patch_toc_width:n { titletoc } \ctex_patch_cmd:Nnn \ps@headings { \ifnum \c@secnumdepth > \m@ne @@ -757,7 +786,7 @@ { \ifnum \c@secnumdepth > \z@ \thesection . ~ \ \fi } { \CTEXifname { \CTEXthesection \quad } { } } } -\cs_new_protected_nopar:Npn \CTEX@setcurrentlabel@n #1 +\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 { \protected@edef \@currentlabel { @@ -766,17 +795,17 @@ { \exp_not:o { \@currentlabel } } } } -\cs_new_protected_nopar:Npn \ctex_varioref_hook: +\cs_new_protected:Npn \ctex_varioref_hook: { \seq_map_inline:Nn \c__ctex_headings_seq { \ctex_fix_varioref_label:n { ##1 } } } -\cs_new_protected_nopar:Npn \ctex_fix_varioref_label:n #1 +\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 { \tl_if_empty:cT { p@#1 } - { \exp_args:Nno \labelformat {#1} { \cs:w CTEX@the#1 \cs_end: } } + { \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } } -\@ifpackageloaded { varioref } +\cs_if_exist:NTF \labelformat { \ctex_varioref_hook: } { \cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter @@ -790,4 +819,4 @@ \ctex_scheme_input:o { \l__ctex_scheme_tl } %% %% -%% End of file `ctex-report.def'. +%% End of file `ctex-heading-report.def'. diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def index 209f8079d4b..144c3d6f476 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-article.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,article,chinese') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for article (CTEX)} \ProvidesExplFile{ctex-scheme-chinese-article.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex / part } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:nn { part } { aftertitle = \par , hang = false , @@ -41,7 +39,7 @@ aftername = \quad , afterindent = true } -\keys_set:nn { ctex / section } +\ctex_set:nn { section } { number = \thesection , aftername = \quad , @@ -53,7 +51,7 @@ format = \Large \bfseries \centering , afterindent = true } -\keys_set:nn { ctex / subsection } +\ctex_set:nn { subsection } { number = \thesubsection , format = \large \bfseries , @@ -65,7 +63,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / subsubsection } +\ctex_set:nn { subsubsection } { number = \thesubsubsection , format = \normalsize \bfseries , @@ -77,7 +75,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / paragraph } +\ctex_set:nn { paragraph } { number = \theparagraph , format = \normalsize \bfseries , @@ -86,7 +84,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / subparagraph } +\ctex_set:nn { subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , @@ -97,7 +95,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 2 { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -105,7 +103,7 @@ } } { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { afterskip = 1em , runin = true @@ -113,7 +111,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 3 { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -121,27 +119,27 @@ } } { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { afterskip = 1em , runin = true } } \int_compare:nNnTF \g__ctex_section_depth_int > 2 - { \keys_set:nn { ctex / subparagraph } { indent = \c_zero_dim } } - { \keys_set:nn { ctex / subparagraph } { indent = \parindent } } -\keys_set:nn { ctex / appendix } + { \ctex_set:nn { subparagraph } { indent = \c_zero_dim } } + { \ctex_set:nn { subparagraph } { indent = \parindent } } +\ctex_set:nn { appendix } { number = \@Alph \c@section } \pagestyle { headings } -\keys_set:nn { ctex } { today = small } +\ctex_set:n { today = small } \ctex_if_autoindent_touched:F - { \keys_set:nn { ctex } { autoindent = true } } -\str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + { \ctex_set:n { autoindent = true } } +\str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \ctex_file_input:n { ctex-name-gbk.cfg } } { \ctex_file_input:n { ctex-name-utf8.cfg } } \int_compare:nNnF \g__ctex_font_size_int > { -1 } { \int_gset:Nn \g__ctex_font_size_int { 0 } } -\fp_compare:nNnT { \l__ctex_line_spread_fp } ? { \c_zero_fp } +\fp_if_nan:nT { \l__ctex_line_spread_fp } { \fp_set:Nn \l__ctex_line_spread_fp { 1.3 } } \ctex_patch_cmd:Nnn \verse { -1.5em } { -2 \ccwd } \ctex_patch_cmd:Nnn \verse { 1.5em } { 2 \ccwd } diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def index 9a0b8cdbe16..c290f86a614 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-beamer.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,beamer,chinese') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for beamer (CTEX)} \ProvidesExplFile{ctex-scheme-chinese-beamer.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex / part } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:nn { part } { aftertitle = \par , number = \chinese { part } , @@ -40,7 +38,7 @@ aftername = \vskip 1em \par , titleformat = \usebeamerfont { part ~ title } } -\keys_set:nn { ctex / section } +\ctex_set:nn { section } { format = \centering , number = \insertsectionnumber , @@ -50,7 +48,7 @@ titleformat = \usebeamerfont { section ~ title } , aftertitle = \par } -\keys_set:nn { ctex / subsection } +\ctex_set:nn { subsection } { number = \arabic { section } . \arabic { subsection } , format = \centering , @@ -60,10 +58,10 @@ titleformat = \usebeamerfont { subsection ~ title } , aftertitle = \par } -\keys_set:nn { ctex } { today = small } +\ctex_set:n { today = small } \ctex_if_autoindent_touched:F - { \keys_set:nn { ctex } { autoindent = true } } -\str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + { \ctex_set:n { autoindent = true } } +\str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \uselanguage { ChineseGBK } \languagealias { chinese } { ChineseGBK } diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def index 22b0d7cc354..c35e5602359 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,book,chinese') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for book (CTEX)} \ProvidesExplFile{ctex-scheme-chinese-book.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex / part } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:nn { part } { aftertitle = \par , hang = false , @@ -42,7 +40,7 @@ break = \if@openright \cleardoublepage \else \clearpage \fi , format = \huge \bfseries \centering } -\keys_set:nn { ctex / chapter } +\ctex_set:nn { chapter } { pagestyle = plain , aftertitle = \par , @@ -57,7 +55,7 @@ aftername = \quad , afterindent = true } -\keys_set:nn { ctex / section } +\ctex_set:nn { section } { number = \thesection , aftername = \quad , @@ -69,7 +67,7 @@ format = \Large \bfseries \centering , afterindent = true } -\keys_set:nn { ctex / subsection } +\ctex_set:nn { subsection } { number = \thesubsection , format = \large \bfseries , @@ -81,7 +79,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / subsubsection } +\ctex_set:nn { subsubsection } { number = \thesubsubsection , format = \normalsize \bfseries , @@ -93,7 +91,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / paragraph } +\ctex_set:nn { paragraph } { number = \theparagraph , format = \normalsize \bfseries , @@ -102,7 +100,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / subparagraph } +\ctex_set:nn { subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , @@ -113,7 +111,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 2 { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -121,7 +119,7 @@ } } { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { afterskip = 1em , runin = true @@ -129,7 +127,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 3 { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -137,30 +135,30 @@ } } { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { afterskip = 1em , runin = true } } \int_compare:nNnTF \g__ctex_section_depth_int > 2 - { \keys_set:nn { ctex / subparagraph } { indent = \c_zero_dim } } - { \keys_set:nn { ctex / subparagraph } { indent = \parindent } } -\keys_set:nn { ctex / appendix } + { \ctex_set:nn { subparagraph } { indent = \c_zero_dim } } + { \ctex_set:nn { subparagraph } { indent = \parindent } } +\ctex_set:nn { appendix } { name = \appendixname \space , number = \@Alph \c@chapter } \pagestyle { headings } -\keys_set:nn { ctex } { today = small } +\ctex_set:n { today = small } \ctex_if_autoindent_touched:F - { \keys_set:nn { ctex } { autoindent = true } } -\str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + { \ctex_set:n { autoindent = true } } +\str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \ctex_file_input:n { ctex-name-gbk.cfg } } { \ctex_file_input:n { ctex-name-utf8.cfg } } \int_compare:nNnF \g__ctex_font_size_int > { -1 } { \int_gset:Nn \g__ctex_font_size_int { 0 } } -\fp_compare:nNnT { \l__ctex_line_spread_fp } ? { \c_zero_fp } +\fp_if_nan:nT { \l__ctex_line_spread_fp } { \fp_set:Nn \l__ctex_line_spread_fp { 1.3 } } \ctex_patch_cmd:Nnn \verse { -1.5em } { -2 \ccwd } \ctex_patch_cmd:Nnn \verse { 1.5em } { 2 \ccwd } diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def index 8fa5249d020..59e4dcc76ae 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-report.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,report,chinese') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for report (CTEX)} \ProvidesExplFile{ctex-scheme-chinese-report.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex / part } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:nn { part } { aftertitle = \par , hang = false , @@ -42,7 +40,7 @@ break = \if@openright \cleardoublepage \else \clearpage \fi , format = \huge \bfseries \centering } -\keys_set:nn { ctex / chapter } +\ctex_set:nn { chapter } { pagestyle = plain , aftertitle = \par , @@ -57,7 +55,7 @@ aftername = \quad , afterindent = true } -\keys_set:nn { ctex / section } +\ctex_set:nn { section } { number = \thesection , aftername = \quad , @@ -69,7 +67,7 @@ format = \Large \bfseries \centering , afterindent = true } -\keys_set:nn { ctex / subsection } +\ctex_set:nn { subsection } { number = \thesubsection , format = \large \bfseries , @@ -81,7 +79,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / subsubsection } +\ctex_set:nn { subsubsection } { number = \thesubsubsection , format = \normalsize \bfseries , @@ -93,7 +91,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / paragraph } +\ctex_set:nn { paragraph } { number = \theparagraph , format = \normalsize \bfseries , @@ -102,7 +100,7 @@ break = \addpenalty \@secpenalty , afterindent = true } -\keys_set:nn { ctex / subparagraph } +\ctex_set:nn { subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , @@ -113,7 +111,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 2 { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -121,7 +119,7 @@ } } { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { afterskip = 1em , runin = true @@ -129,7 +127,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 3 { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -137,30 +135,30 @@ } } { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { afterskip = 1em , runin = true } } \int_compare:nNnTF \g__ctex_section_depth_int > 2 - { \keys_set:nn { ctex / subparagraph } { indent = \c_zero_dim } } - { \keys_set:nn { ctex / subparagraph } { indent = \parindent } } -\keys_set:nn { ctex / appendix } + { \ctex_set:nn { subparagraph } { indent = \c_zero_dim } } + { \ctex_set:nn { subparagraph } { indent = \parindent } } +\ctex_set:nn { appendix } { name = \appendixname \space , number = \@Alph \c@chapter } \pagestyle { headings } -\keys_set:nn { ctex } { today = small } +\ctex_set:n { today = small } \ctex_if_autoindent_touched:F - { \keys_set:nn { ctex } { autoindent = true } } -\str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + { \ctex_set:n { autoindent = true } } +\str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \ctex_file_input:n { ctex-name-gbk.cfg } } { \ctex_file_input:n { ctex-name-utf8.cfg } } \int_compare:nNnF \g__ctex_font_size_int > { -1 } { \int_gset:Nn \g__ctex_font_size_int { 0 } } -\fp_compare:nNnT { \l__ctex_line_spread_fp } ? { \c_zero_fp } +\fp_if_nan:nT { \l__ctex_line_spread_fp } { \fp_set:Nn \l__ctex_line_spread_fp { 1.3 } } \ctex_patch_cmd:Nnn \verse { -1.5em } { -2 \ccwd } \ctex_patch_cmd:Nnn \verse { 1.5em } { 2 \ccwd } diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def index 8bf9e5551f6..bcdabc1787c 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,generic,chinese') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,23 +20,21 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Chinese scheme for generic (CTEX)} \ProvidesExplFile{ctex-scheme-chinese.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex } { today = small } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:n { today = small } \ctex_if_autoindent_touched:F - { \keys_set:nn { ctex } { autoindent = true } } + { \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 { - \str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + \str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \uselanguage { ChineseGBK } \languagealias { chinese } { ChineseGBK } @@ -50,12 +48,12 @@ \clist_put_left:Nn \trans@languagepath { chinese } } { - \str_if_eq:onTF { \l__ctex_encoding_tl } { GBK } + \str_if_eq:onTF { \g__ctex_encoding_tl } { GBK } { \ctex_file_input:n { ctex-name-gbk.cfg } } { \ctex_file_input:n { ctex-name-utf8.cfg } } \int_compare:nNnF \g__ctex_font_size_int > { -1 } { \int_gset:Nn \g__ctex_font_size_int { 0 } } - \fp_compare:nNnT { \l__ctex_line_spread_fp } ? { \c_zero_fp } + \fp_if_nan:nT { \l__ctex_line_spread_fp } { \fp_set:Nn \l__ctex_line_spread_fp { 1.3 } } \tl_if_exist:NT \c__ctex_std_class_tl { \RequirePackage { indentfirst } } diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def index 7d24f3b7fe9..803fd2a5fee 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-article.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,article,plain') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for article (CTEX)} \ProvidesExplFile{ctex-scheme-plain-article.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex / part } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:nn { part } { aftertitle = \par , hang = false , @@ -44,7 +42,7 @@ titleformat = \huge \bfseries , afterindent = false } -\keys_set:nn { ctex / section } +\ctex_set:nn { section } { number = \thesection , aftername = \quad , @@ -56,7 +54,7 @@ format = \Large \bfseries , afterindent = false } -\keys_set:nn { ctex / subsection } +\ctex_set:nn { subsection } { number = \thesubsection , format = \large \bfseries , @@ -68,7 +66,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / subsubsection } +\ctex_set:nn { subsubsection } { number = \thesubsubsection , format = \normalsize \bfseries , @@ -80,7 +78,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / paragraph } +\ctex_set:nn { paragraph } { number = \theparagraph , format = \normalsize \bfseries , @@ -89,7 +87,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / subparagraph } +\ctex_set:nn { subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , @@ -100,7 +98,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 2 { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -108,7 +106,7 @@ } } { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { afterskip = 1em , runin = true @@ -116,7 +114,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 3 { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -124,16 +122,16 @@ } } { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { afterskip = 1em , runin = true } } \int_compare:nNnTF \g__ctex_section_depth_int > 2 - { \keys_set:nn { ctex / subparagraph } { indent = \c_zero_dim } } - { \keys_set:nn { ctex / subparagraph } { indent = \parindent } } -\keys_set:nn { ctex / appendix } + { \ctex_set:nn { subparagraph } { indent = \c_zero_dim } } + { \ctex_set:nn { subparagraph } { indent = \parindent } } +\ctex_set:nn { appendix } { number = \@Alph \c@section } %% %% diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def index 92f67b60812..c103ca8b61c 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-beamer.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,beamer,plain') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for beamer (CTEX)} \ProvidesExplFile{ctex-scheme-plain-beamer.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex / part } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:nn { part } { aftertitle = \par , name = \partname \space , @@ -41,7 +39,7 @@ aftername = \vskip 1em \par , titleformat = \usebeamerfont { part ~ title } } -\keys_set:nn { ctex / section } +\ctex_set:nn { section } { name = \sectionname \space , format = \centering , @@ -52,7 +50,7 @@ titleformat = \usebeamerfont { section ~ title } , aftertitle = \par } -\keys_set:nn { ctex / subsection } +\ctex_set:nn { subsection } { name = \subsectionname \space , number = \insertsubsectionnumber , diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def index 25ad8806276..7c0f0f6bd89 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-book.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,book,plain') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for book (CTEX)} \ProvidesExplFile{ctex-scheme-plain-book.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex / part } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:nn { part } { aftertitle = \par , hang = false , @@ -45,7 +43,7 @@ nameformat = \huge \bfseries , titleformat = \Huge \bfseries } -\keys_set:nn { ctex / chapter } +\ctex_set:nn { chapter } { pagestyle = plain , aftertitle = \par , @@ -64,7 +62,7 @@ afterindent = false , tocline = \CTEXnumberline {#1} #2 } -\keys_set:nn { ctex / section } +\ctex_set:nn { section } { number = \thesection , aftername = \quad , @@ -76,7 +74,7 @@ format = \Large \bfseries , afterindent = false } -\keys_set:nn { ctex / subsection } +\ctex_set:nn { subsection } { number = \thesubsection , format = \large \bfseries , @@ -88,7 +86,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / subsubsection } +\ctex_set:nn { subsubsection } { number = \thesubsubsection , format = \normalsize \bfseries , @@ -100,7 +98,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / paragraph } +\ctex_set:nn { paragraph } { number = \theparagraph , format = \normalsize \bfseries , @@ -109,7 +107,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / subparagraph } +\ctex_set:nn { subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , @@ -120,7 +118,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 2 { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -128,7 +126,7 @@ } } { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { afterskip = 1em , runin = true @@ -136,7 +134,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 3 { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -144,16 +142,16 @@ } } { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { afterskip = 1em , runin = true } } \int_compare:nNnTF \g__ctex_section_depth_int > 2 - { \keys_set:nn { ctex / subparagraph } { indent = \c_zero_dim } } - { \keys_set:nn { ctex / subparagraph } { indent = \parindent } } -\keys_set:nn { ctex / appendix } + { \ctex_set:nn { subparagraph } { indent = \c_zero_dim } } + { \ctex_set:nn { subparagraph } { indent = \parindent } } +\ctex_set:nn { appendix } { name = \appendixname \space , number = \@Alph \c@chapter diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def index 347d75b590e..e353a1281b8 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain-report.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,report,plain') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,17 +20,15 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for report (CTEX)} \ProvidesExplFile{ctex-scheme-plain-report.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} -\keys_set:nn { ctex / part } + {\ExplFileDate}{2.5.1}{\ExplFileDescription} +\ctex_set:nn { part } { aftertitle = \par , hang = false , @@ -45,7 +43,7 @@ nameformat = \huge \bfseries , titleformat = \Huge \bfseries } -\keys_set:nn { ctex / chapter } +\ctex_set:nn { chapter } { pagestyle = plain , aftertitle = \par , @@ -64,7 +62,7 @@ afterindent = false , tocline = \CTEXnumberline {#1} #2 } -\keys_set:nn { ctex / section } +\ctex_set:nn { section } { number = \thesection , aftername = \quad , @@ -76,7 +74,7 @@ format = \Large \bfseries , afterindent = false } -\keys_set:nn { ctex / subsection } +\ctex_set:nn { subsection } { number = \thesubsection , format = \large \bfseries , @@ -88,7 +86,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / subsubsection } +\ctex_set:nn { subsubsection } { number = \thesubsubsection , format = \normalsize \bfseries , @@ -100,7 +98,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / paragraph } +\ctex_set:nn { paragraph } { number = \theparagraph , format = \normalsize \bfseries , @@ -109,7 +107,7 @@ break = \addpenalty \@secpenalty , afterindent = false } -\keys_set:nn { ctex / subparagraph } +\ctex_set:nn { subparagraph } { number = \thesubparagraph , format = \normalsize \bfseries , @@ -120,7 +118,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 2 { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -128,7 +126,7 @@ } } { - \keys_set:nn { ctex / paragraph } + \ctex_set:nn { paragraph } { afterskip = 1em , runin = true @@ -136,7 +134,7 @@ } \int_compare:nNnTF \g__ctex_section_depth_int > 3 { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { aftertitle = \@@par , afterskip = 1ex \@plus .2ex , @@ -144,16 +142,16 @@ } } { - \keys_set:nn { ctex / subparagraph } + \ctex_set:nn { subparagraph } { afterskip = 1em , runin = true } } \int_compare:nNnTF \g__ctex_section_depth_int > 2 - { \keys_set:nn { ctex / subparagraph } { indent = \c_zero_dim } } - { \keys_set:nn { ctex / subparagraph } { indent = \parindent } } -\keys_set:nn { ctex / appendix } + { \ctex_set:nn { subparagraph } { indent = \c_zero_dim } } + { \ctex_set:nn { subparagraph } { indent = \parindent } } +\ctex_set:nn { appendix } { name = \appendixname \space , number = \@Alph \c@chapter diff --git a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def index f2ac6d86d0a..be3e922893f 100644 --- a/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def +++ b/Master/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-plain.def @@ -6,9 +6,9 @@ %% %% ctex.dtx (with options: `scheme,generic,plain') %% -%% Copyright (C) 2003--2019 +%% Copyright (C) 2003--2020 %% CTEX.ORG and any individual authors listed in the documentation. -%% ------------------------------------------------------------------------------ +%% --------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -20,16 +20,14 @@ %% and version 1.3 or later is part of all distributions of %% LaTeX version 2005/12/01 or later. %% -%% This work has the LPPL maintenance status `maintained'. +%% This work has the LPPL maintenance status "maintained". %% -%% The Current Maintainers of this work are Leo Liu, Qing Lee and Liam Huang. +%% --------------------------------------------------------------------- %% -%% ------------------------------------------------------------------------------ -%% -\GetIdInfo$Id: ctex.dtx 735dfe2 2019-05-29 21:42:29 +0800 Qing Lee <sobenlee@gmail.com> $ +\GetIdInfo$Id: ctex.dtx 320df30 2020-05-02 06:45:05 +0800 Qing Lee <sobenlee@gmail.com> $ {Plain scheme for generic (CTEX)} \ProvidesExplFile{ctex-scheme-plain.def} - {\ExplFileDate}{2.4.16}{\ExplFileDescription} + {\ExplFileDate}{2.5.1}{\ExplFileDescription} %% %% %% End of file `ctex-scheme-plain.def'. |