summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/ctex.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-05-02 22:24:14 +0000
committerKarl Berry <karl@freefriends.org>2020-05-02 22:24:14 +0000
commit15f0c94913f0d5cb24dd909c5358b3a997994dd7 (patch)
tree9043df32cd0199835f5b3f9804ad132907857139 /Master/texmf-dist/tex/latex/ctex/ctex.sty
parent151fbc4b66cb3705f6ce20368a2c6f7c06b8d57d (diff)
ctex (2may20)
git-svn-id: svn://tug.org/texlive/trunk@54976 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctex.sty')
-rw-r--r--Master/texmf-dist/tex/latex/ctex/ctex.sty400
1 files changed, 211 insertions, 189 deletions
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.