| 1 |
%% |
| 2 |
%% This is file `ctexbeamer.cls', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% ctex.dtx (with options: `class,beamer') |
| 8 |
%% |
| 9 |
%% Copyright (C) 2003--2022 |
| 10 |
%% CTEX.ORG and any individual authors listed in the documentation. |
| 11 |
%% --------------------------------------------------------------------- |
| 12 |
%% |
| 13 |
%% This work may be distributed and/or modified under the |
| 14 |
%% conditions of the LaTeX Project Public License, either |
| 15 |
%% version 1.3c of this license or (at your option) any later |
| 16 |
%% version. This version of this license is in |
| 17 |
%% http://www.latex-project.org/lppl/lppl-1-3c.txt |
| 18 |
%% and the latest version of this license is in |
| 19 |
%% http://www.latex-project.org/lppl.txt |
| 20 |
%% and version 1.3 or later is part of all distributions of |
| 21 |
%% LaTeX version 2005/12/01 or later. |
| 22 |
%% |
| 23 |
%% This work has the LPPL maintenance status "maintained". |
| 24 |
%% |
| 25 |
%% --------------------------------------------------------------------- |
| 26 |
%% |
| 27 |
\NeedsTeXFormat{LaTeX2e} |
| 28 |
\input{ctexbackend.cfg} |
| 29 |
\RequirePackage{expl3} |
| 30 |
\GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <[email protected]> $ |
| 31 |
{Chinese adapter for class beamer (CTEX)} |
| 32 |
\ProvidesExplClass{ctexbeamer} |
| 33 |
{\ExplFileDate}{2.5.10}{\ExplFileDescription} |
| 34 |
\cs_if_exist:NF \NewDocumentCommand |
| 35 |
{ \RequirePackage { xparse } } |
| 36 |
\prop_gput:Nnn \g_msg_module_type_prop { ctex } { Class } |
| 37 |
\prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexbeamer } |
| 38 |
\msg_new:nnnn { ctex } { l3-too-old } |
| 39 |
{ Support~package~`#1'~too~old. } |
| 40 |
{ |
| 41 |
Please~update~an~up-to-date~version~of~the~bundles\\\\ |
| 42 |
`l3kernel'~and~`l3packages'\\\\ |
| 43 |
using~your~TeX~package~manager~or~from~CTAN. |
| 44 |
} |
| 45 |
\@ifpackagelater { expl3 } { 2021/02/10 } { } |
| 46 |
{ \msg_error:nnn { ctex } { l3-too-old } { expl3 } } |
| 47 |
\str_const:Nx \c__ctex_engine_str |
| 48 |
{ \cs_if_exist:NTF \ngostype { aptex } { \c_sys_engine_str } } |
| 49 |
\msg_new:nnnn { ctex } { engine-not-supported } |
| 50 |
{ Engine~`#1'~is~not~yet~supported,~ctex~will~abort! } |
| 51 |
{ You~can~switch~to~xelatex,~lualatex,~pdflatex,~uplatex,~or~aplatex. } |
| 52 |
\file_if_exist:nTF { ctex-engine- \c__ctex_engine_str .def } |
| 53 |
{ |
| 54 |
\str_const:Nx \c__ctex_engine_file_str |
| 55 |
{ ctex-engine- \c__ctex_engine_str .def } |
| 56 |
} |
| 57 |
{ \msg_critical:nnx { ctex } { engine-not-supported } { \c__ctex_engine_str } } |
| 58 |
\RequirePackage { ctexhook , ctexpatch } |
| 59 |
\RequirePackage { fix-cm } |
| 60 |
\ctex_disable_package:n { ctex } |
| 61 |
\ctex_disable_package:n { ctexcap } |
| 62 |
\ctex_disable_package:n { ctexsize } |
| 63 |
\ctex_disable_package:n { ctexheading } |
| 64 |
\ctex_if_format_at_least:nTF { 2021/06/01 } |
| 65 |
{ \bool_const:Nn \c__ctex_everysel_loaded_bool { \c_false_bool } } |
| 66 |
{ |
| 67 |
\RequirePackage { everysel } |
| 68 |
\bool_const:Nn \c__ctex_everysel_loaded_bool { \c_true_bool } |
| 69 |
} |
| 70 |
\tl_clear_new:N \l__ctex_tmp_tl |
| 71 |
\int_new:N \l__ctex_tmp_int |
| 72 |
\box_new:N \l__ctex_tmp_box |
| 73 |
\dim_new:N \l__ctex_tmp_dim |
| 74 |
\cs_new_protected:Npn \ctex_define_option:n |
| 75 |
{ \keys_define:nn { ctex / option } } |
| 76 |
\cs_new_protected:Npn \ctex_define:n |
| 77 |
{ \keys_define:nn { ctex } } |
| 78 |
\cs_new_protected:Npn \ctex_set:n |
| 79 |
{ \keys_set:nn { ctex } } |
| 80 |
\cs_new_protected:Npn \ctex_set:nn #1 |
| 81 |
{ \keys_set:nn { ctex / #1 } } |
| 82 |
\cs_new_protected:Npn \ctex_scheme_input:n #1 |
| 83 |
{ |
| 84 |
\ctex_push_file: |
| 85 |
\tl_if_exist:NTF \c__ctex_class_tl |
| 86 |
{ |
| 87 |
\file_if_exist_input:nF { ctex-scheme- #1 - \c__ctex_class_tl .def } |
| 88 |
{ \file_input:n { ctex-scheme- #1 .def } } |
| 89 |
} |
| 90 |
{ \file_input:n { ctex-scheme- #1 .def } } |
| 91 |
\ctex_pop_file: |
| 92 |
} |
| 93 |
\cs_generate_variant:Nn \ctex_scheme_input:n { o } |
| 94 |
\msg_new:nnnn { ctex } { package-too-old } |
| 95 |
{ Support~package~`#1'~too~old. } |
| 96 |
{ |
| 97 |
Please~update~an~up-to-date~version~of~the~package~`#1'\\ |
| 98 |
using~your~TeX~package~manager~or~from~CTAN. |
| 99 |
} |
| 100 |
\sys_if_output_pdf:TF |
| 101 |
{ \cs_new_eq:NN \ifctexpdf \if_true: } |
| 102 |
{ \cs_new_eq:NN \ifctexpdf \if_false: } |
| 103 |
\cs_new_eq:NN \ctex_if_preamble:TF \use_i:nn |
| 104 |
\ctex_after_end_preamble:n { \cs_set_eq:NN \ctex_if_preamble:TF \use_ii:nn } |
| 105 |
\cs_new_protected:Npn \ctex_set_default_ccwd:Nn #1#2 |
| 106 |
{ \tl_set:Nx #1 { \__ctex_default_ccwd_aux:n {#2} } } |
| 107 |
\cs_new:Npn \__ctex_default_ccwd_aux:n #1 |
| 108 |
{ |
| 109 |
\exp_not:n {#1} |
| 110 |
\exp_after:wN \__ctex_default_ccwd_aux:w |
| 111 |
\dim_use:N \tex_dimexpr:D #1 pt \scan_stop: \q_stop |
| 112 |
} |
| 113 |
\exp_last_unbraced:NNNNo |
| 114 |
\cs_new:Npn \__ctex_default_ccwd_aux:w #1 { \tl_to_str:n { pt } } #2 \q_stop |
| 115 |
{ \tl_if_empty:nT {#2} { \ccwd } } |
| 116 |
\tl_new:N \g__ctex_encoding_tl |
| 117 |
\bool_new:N \g__ctex_zhmCJK_bool |
| 118 |
\tl_new:N \l__ctex_autoindent_tl |
| 119 |
\cs_new_eq:NN \ctex_if_autoindent_touched:F \use:n |
| 120 |
\cs_new_eq:NN \ctex_zhmap_case:nnn \use_ii:nnn |
| 121 |
\cs_new_protected:Npn \ctex_at_end:n { \AtEndOfClass } |
| 122 |
\cs_new_protected:Npn \ctex_load_std_class:n #1 |
| 123 |
{ |
| 124 |
\tl_const:Nn \c__ctex_class_tl {#1} |
| 125 |
\exp_args:No \PassOptionsToClass |
| 126 |
{ \g__ctex_std_options_clist } |
| 127 |
{#1} |
| 128 |
\LoadClass {#1} |
| 129 |
} |
| 130 |
\clist_new:N \g__ctex_std_options_clist |
| 131 |
\msg_new:nnn { ctex } { invalid-option } |
| 132 |
{ Option~`\l_keys_key_tl'~is~invalid~in~current~mode. } |
| 133 |
\msg_new:nnn { ctex } { invalid-value } |
| 134 |
{ Value~`#1'~is~invalid~for~the~key~`\l_keys_key_tl'. } |
| 135 |
\cs_new_protected:Npn \ctex_deprecated_option:n |
| 136 |
{ \msg_warning:nnn { ctex } { deprecated-option } } |
| 137 |
\cs_new_protected:Npn \ctex_set_deprecated_option:n #1 |
| 138 |
{ |
| 139 |
\ctex_deprecated_option:n { Option~`#1'~is~set. } |
| 140 |
\ctex_set:nn { option } {#1} |
| 141 |
} |
| 142 |
\cs_new_protected:Npn \ctex_deprecated_command:Nn #1#2 |
| 143 |
{ |
| 144 |
\msg_warning:nnxx { ctex } { deprecated-command } |
| 145 |
{ \token_to_str:N #1 } { \exp_not:n {#2} } |
| 146 |
} |
| 147 |
\msg_new:nnn { ctex } { deprecated-option } |
| 148 |
{ Option~`\l_keys_key_tl'~is~deprecated.\\ #1 } |
| 149 |
\msg_new:nnn { ctex } { deprecated-command } |
| 150 |
{ Command~`#1'~is~deprecated.\\ #2 } |
| 151 |
\int_new:N \g__ctex_font_size_int |
| 152 |
\int_gset:Nn \g__ctex_font_size_int { -1 } |
| 153 |
\ctex_define_option:n |
| 154 |
{ |
| 155 |
zihao .choice: , |
| 156 |
zihao .value_required:n = true , |
| 157 |
zihao / 5 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 0 } } , |
| 158 |
zihao / -4 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 1 } } , |
| 159 |
zihao / false .code:n = { \int_gset:Nn \g__ctex_font_size_int { 2 } } , |
| 160 |
c5size .code:n = { \ctex_set_deprecated_option:n { zihao = 5 } } , |
| 161 |
cs4size .code:n = { \ctex_set_deprecated_option:n { zihao = -4 } } , |
| 162 |
c5size .value_forbidden:n = true , |
| 163 |
cs4size .value_forbidden:n = true , |
| 164 |
linespread .fp_set:N = \l__ctex_line_spread_fp , |
| 165 |
linespread .initial:n = { \c_nan_fp } , |
| 166 |
linespread .value_required:n = true , |
| 167 |
autoindent .choice: , |
| 168 |
autoindent .default:n = { true } , |
| 169 |
autoindent / true .code:n = |
| 170 |
{ |
| 171 |
\tl_set:Nn \l__ctex_autoindent_tl { 2 \ccwd } |
| 172 |
\cs_set_eq:NN \ctex_if_autoindent_touched:F \use_none:n |
| 173 |
} , |
| 174 |
autoindent / false .code:n = |
| 175 |
{ |
| 176 |
\tl_clear:N \l__ctex_autoindent_tl |
| 177 |
\cs_set_eq:NN \ctex_if_autoindent_touched:F \use_none:n |
| 178 |
} , |
| 179 |
autoindent / unknown .code:n = |
| 180 |
{ |
| 181 |
\ctex_set_default_ccwd:Nn \l__ctex_autoindent_tl {#1} |
| 182 |
\cs_set_eq:NN \ctex_if_autoindent_touched:F \use_none:n |
| 183 |
} , |
| 184 |
indent .code:n = |
| 185 |
{ |
| 186 |
\ctex_deprecated_option:n |
| 187 |
{ |
| 188 |
The~functionality~has~been~removed.\\ |
| 189 |
It's~better~to~set~the~heading~styles~via~`afterindent'~option. |
| 190 |
} |
| 191 |
} , |
| 192 |
indent .value_forbidden:n = true , |
| 193 |
noindent .code:n = |
| 194 |
{ |
| 195 |
\ctex_deprecated_option:n |
| 196 |
{ |
| 197 |
The~functionality~has~been~removed.\\ |
| 198 |
It's~better~to~set~the~heading~styles~via~`afterindent'~option. |
| 199 |
} |
| 200 |
} , |
| 201 |
noindent .value_forbidden:n = true , |
| 202 |
GBK .code:n = |
| 203 |
{ |
| 204 |
\sys_if_engine_pdftex:TF |
| 205 |
{ \tl_gset:Nn \g__ctex_encoding_tl { GBK } } |
| 206 |
{ |
| 207 |
\msg_warning:nn { ctex } { invalid-option } |
| 208 |
\tl_gset:Nn \g__ctex_encoding_tl { UTF8 } |
| 209 |
} |
| 210 |
} , |
| 211 |
UTF8 .code:n = { \tl_gset:Nn \g__ctex_encoding_tl { UTF8 } } , |
| 212 |
GBK .value_forbidden:n = true , |
| 213 |
UTF8 .value_forbidden:n = true , |
| 214 |
fontset .tl_gset:N = \g__ctex_fontset_tl , |
| 215 |
nofonts .code:n = { \ctex_set_deprecated_option:n { fontset = none } } , |
| 216 |
adobefonts .code:n = { \ctex_set_deprecated_option:n { fontset = adobe } } , |
| 217 |
winfonts .code:n = { \ctex_set_deprecated_option:n { fontset = windows } } , |
| 218 |
nofonts .value_forbidden:n = true , |
| 219 |
winfonts .value_forbidden:n = true , |
| 220 |
adobefonts .value_forbidden:n = true , |
| 221 |
zhmap .choice: , |
| 222 |
zhmap .default:n = { true } , |
| 223 |
zhmap / zhmCJK .code:n = |
| 224 |
{ |
| 225 |
\bool_gset_true:N \g__ctex_zhmCJK_bool |
| 226 |
\cs_gset_eq:NN \ctex_zhmap_case:nnn \use_i:nnn |
| 227 |
} , |
| 228 |
zhmap / true .code:n = |
| 229 |
{ |
| 230 |
\bool_gset_false:N \g__ctex_zhmCJK_bool |
| 231 |
\cs_gset_eq:NN \ctex_zhmap_case:nnn \use_ii:nnn |
| 232 |
} , |
| 233 |
zhmap / false .code:n = |
| 234 |
{ |
| 235 |
\bool_gset_false:N \g__ctex_zhmCJK_bool |
| 236 |
\cs_gset_eq:NN \ctex_zhmap_case:nnn \use_iii:nnn |
| 237 |
} , |
| 238 |
nozhmap .code:n = |
| 239 |
{ \ctex_set_deprecated_option:n { zhmap = false } } , |
| 240 |
nozhmap .value_forbidden:n = true , |
| 241 |
punct .tl_set:N = \l__ctex_punct_tl , |
| 242 |
punct .default:n = { quanjiao } , |
| 243 |
punct .initial:n = { quanjiao } , |
| 244 |
nopunct .code:n = \ctex_set_deprecated_option:n { punct = plain } , |
| 245 |
nopunct .value_forbidden:n = true , |
| 246 |
space .choices:nn = |
| 247 |
{ true , auto , false } |
| 248 |
{ |
| 249 |
\exp_args:Ne \ctex_at_end:n |
| 250 |
{ \ctex_set:n { space = \l_keys_choice_tl } } |
| 251 |
} , |
| 252 |
space .default:n = { true } , |
| 253 |
nospace .code:n = { \ctex_deprecated_option:nn { space = false } } , |
| 254 |
nospace .value_forbidden:n = true , |
| 255 |
heading .bool_set:N = \l__ctex_heading_bool , |
| 256 |
scheme .tl_set:N = \l__ctex_scheme_tl , |
| 257 |
scheme .default:n = { chinese } , |
| 258 |
scheme .initial:n = { chinese } , |
| 259 |
cap .code:n = { \ctex_set_deprecated_option:n { scheme = chinese } } , |
| 260 |
nocap .code:n = { \ctex_set_deprecated_option:n { scheme = plain } } , |
| 261 |
cap .value_forbidden:n = true , |
| 262 |
nocap .value_forbidden:n = true , |
| 263 |
fntef .code:n = |
| 264 |
{ |
| 265 |
\sys_if_engine_xetex:TF |
| 266 |
{ |
| 267 |
\ctex_deprecated_option:n { `xeCJKfntef'~package~is~loaded. } |
| 268 |
\ctex_at_end:n { \RequirePackage { xeCJKfntef } } |
| 269 |
} |
| 270 |
{ |
| 271 |
\sys_if_engine_pdftex:TF |
| 272 |
{ |
| 273 |
\ctex_deprecated_option:n { `CJKfntef'~package~is~loaded. } |
| 274 |
\ctex_at_end:n { \RequirePackage { CJKfntef } } |
| 275 |
} |
| 276 |
{ |
| 277 |
\ctex_deprecated_option:n |
| 278 |
{ Furthermore,~option~`fntef'~is~invalid~in~current~mode. } |
| 279 |
} |
| 280 |
} |
| 281 |
} , |
| 282 |
fancyhdr .code:n = |
| 283 |
{ |
| 284 |
\ctex_deprecated_option:n { `fancyhdr'~package~is~loaded. } |
| 285 |
\ctex_at_end:n { \RequirePackage { fancyhdr } } |
| 286 |
} , |
| 287 |
hyperref .code:n = |
| 288 |
{ |
| 289 |
\ctex_deprecated_option:n { `hyperref'~package~will~be~loaded. } |
| 290 |
\ctex_at_end:n |
| 291 |
{ |
| 292 |
\cs_if_exist:NF \hypersetup |
| 293 |
{ \cs_new_eq:NN \hypersetup \ctex_hypersetup:n } |
| 294 |
} |
| 295 |
\ctex_at_end_preamble:n { \RequirePackage { hyperref } } |
| 296 |
} , |
| 297 |
} |
| 298 |
\tl_clear_new:N \l__ctex_tmp_tl |
| 299 |
\clist_map_inline:nn |
| 300 |
{ |
| 301 |
10pt , 11pt , 12pt , |
| 302 |
8pt , 9pt , 14pt , 17pt , 20pt , 25pt , 30pt , 36pt , 48pt , 60pt |
| 303 |
} |
| 304 |
{ |
| 305 |
\tl_put_right:Nn \l__ctex_tmp_tl |
| 306 |
{ |
| 307 |
#1 .code:n = |
| 308 |
{ |
| 309 |
\int_gset:Nn \g__ctex_font_size_int { 2 } |
| 310 |
\clist_gput_right:Nn \g__ctex_std_options_clist {#1} |
| 311 |
} , |
| 312 |
#1 .value_forbidden:n = true , |
| 313 |
} |
| 314 |
} |
| 315 |
\exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl } |
| 316 |
\tl_clear:N \l__ctex_tmp_tl |
| 317 |
\ctex_define_option:n |
| 318 |
{ |
| 319 |
unknown .code:n = |
| 320 |
{ \clist_gput_right:No \g__ctex_std_options_clist { \CurrentOption } } |
| 321 |
} |
| 322 |
\ctex_file_input:n { ctexopts.cfg } |
| 323 |
\cs_if_exist:NTF \ProcessKeyOptions |
| 324 |
{ \ProcessKeyOptions [ ctex / option ] } |
| 325 |
{ |
| 326 |
\RequirePackage { l3keys2e } |
| 327 |
\ProcessKeysOptions { ctex / option } |
| 328 |
} |
| 329 |
\msg_new:nnn { ctex } { pdftex-utf8 } |
| 330 |
{ UTF8~will~be~used~as~the~default~encoding. } |
| 331 |
\tl_if_empty:NT \g__ctex_encoding_tl |
| 332 |
{ |
| 333 |
\sys_if_engine_pdftex:T |
| 334 |
{ \msg_warning:nn { ctex } { pdftex-utf8 } } |
| 335 |
\tl_gset:Nn \g__ctex_encoding_tl { UTF8 } |
| 336 |
} |
| 337 |
\int_case:nn { \g__ctex_font_size_int } |
| 338 |
{ |
| 339 |
{ 0 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 10pt } } |
| 340 |
{ 1 } { \clist_gput_right:Nn \g__ctex_std_options_clist { 12pt } } |
| 341 |
} |
| 342 |
\ctex_load_std_class:n { beamer } |
| 343 |
\@ifpackageloaded { hyperref } |
| 344 |
{ |
| 345 |
\cs_new_protected:Npn \ctex_hypersetup:n #1 |
| 346 |
{ \hypersetup {#1} } |
| 347 |
} |
| 348 |
{ |
| 349 |
\cs_new_protected:Npn \ctex_hypersetup:n #1 |
| 350 |
{ \PassOptionsToPackage {#1} { hyperref } } |
| 351 |
} |
| 352 |
\ctex_file_input:n { \c__ctex_engine_file_str } |
| 353 |
\NewDocumentCommand \ctexset { } { \ctex_set:n } |
| 354 |
\NewDocumentCommand \CTEXsetup { +O { } > { \TrimSpaces } m } |
| 355 |
{ |
| 356 |
\tl_if_blank:nTF {#1} |
| 357 |
{ \ctex_deprecated_command:Nn \CTEXsetup { } } |
| 358 |
{ |
| 359 |
\ctex_deprecated_command:Nn \CTEXsetup |
| 360 |
{ \ctexset {~#2~=~{~#1~}~}~is~set. } |
| 361 |
\ctex_set:nn {#2} {#1} |
| 362 |
} |
| 363 |
} |
| 364 |
\NewDocumentCommand \CTEXoptions { +O { } } |
| 365 |
{ |
| 366 |
\tl_if_blank:nTF {#1} |
| 367 |
{ \ctex_deprecated_command:Nn \CTEXoptions { } } |
| 368 |
{ |
| 369 |
\ctex_deprecated_command:Nn \CTEXoptions |
| 370 |
{ \ctexset {~#1~}~is~set. } |
| 371 |
\ctex_set:n {#1} |
| 372 |
} |
| 373 |
} |
| 374 |
\ctex_define:n |
| 375 |
{ |
| 376 |
autoindent .choice: , |
| 377 |
autoindent .default:n = { true } , |
| 378 |
autoindent / true .code:n = |
| 379 |
{ |
| 380 |
\tl_set:Nn \l__ctex_autoindent_tl { 2 \ccwd } |
| 381 |
\ctex_select_size: |
| 382 |
} , |
| 383 |
autoindent / false .code:n = |
| 384 |
{ \tl_clear:N \l__ctex_autoindent_tl } , |
| 385 |
autoindent / unknown .code:n = |
| 386 |
{ |
| 387 |
\ctex_set_default_ccwd:Nn \l__ctex_autoindent_tl {#1} |
| 388 |
\ctex_select_size: |
| 389 |
} |
| 390 |
} |
| 391 |
\NewDocumentCommand \CTEXsetfont { } { \ctex_select_size: } |
| 392 |
\cs_new_protected:Npn \ctex_select_size: |
| 393 |
{ \cs_if_free:NTF \size@update { \ctex_update_size: } { \selectfont } } |
| 394 |
\cs_new_protected:Npn \ctex_update_size: |
| 395 |
{ |
| 396 |
\tl_if_eq:NNTF \l__ctex_ziju_tl \c__ctex_zero_tl |
| 397 |
{ |
| 398 |
\ctex_update_stretch: |
| 399 |
\ctex_update_parindent: |
| 400 |
} |
| 401 |
{ \ctex_update_ziju: } |
| 402 |
} |
| 403 |
\tl_const:Nx \c__ctex_zero_tl { \fp_use:N \c_zero_fp } |
| 404 |
\tl_new:N \l__ctex_ziju_tl |
| 405 |
\tl_set_eq:NN \l__ctex_ziju_tl \c__ctex_zero_tl |
| 406 |
\ctex_add_to_selectfont:n |
| 407 |
{ \cs_if_free:NF \size@update { \ctex_update_size: } } |
| 408 |
\ctex_define:n |
| 409 |
{ |
| 410 |
linestretch .code:n = |
| 411 |
{ |
| 412 |
\ctex_set_default_ccwd:Nn \l__ctex_line_stretch_tl {#1} |
| 413 |
\ctex_select_size: |
| 414 |
} , |
| 415 |
linestretch .value_required:n = true |
| 416 |
} |
| 417 |
\tl_new:N \l__ctex_line_stretch_tl |
| 418 |
\tl_set:Nn \l__ctex_line_stretch_tl { \ccwd } |
| 419 |
\cs_new_protected:Npn \ctex_update_stretch: |
| 420 |
{ |
| 421 |
\ctex_update_em_unit: |
| 422 |
\dim_set:Nn \l__ctex_tmp_dim { \l__ctex_line_stretch_tl } |
| 423 |
\dim_compare:nNnTF \l__ctex_tmp_dim = \c_max_dim |
| 424 |
{ \__ctex_update_stretch_auxi: } |
| 425 |
{ \__ctex_update_stretch_auxii: } |
| 426 |
} |
| 427 |
\cs_new_protected:Npn \__ctex_update_stretch_auxi: |
| 428 |
{ |
| 429 |
\ctex_if_ccglue_touched:TF |
| 430 |
{ \ctex_update_ccwd: } |
| 431 |
{ |
| 432 |
\dim_set:Nn \l__ctex_tmp_dim |
| 433 |
{ \baselinestretch \tex_glueexpr:D \f@baselineskip \scan_stop: } |
| 434 |
\skip_set:Nn \l__ctex_ccglue_skip |
| 435 |
{ \c_zero_dim plus .08 \l__ctex_tmp_dim } |
| 436 |
\ctex_update_ccglue: |
| 437 |
} |
| 438 |
} |
| 439 |
\cs_new_protected:Npn \__ctex_update_stretch_auxii: |
| 440 |
{ |
| 441 |
\int_set:Nn \l__ctex_tmp_int |
| 442 |
{ \tex_dimexpr:D \linewidth - \ccwd - \l__ctex_tmp_dim \scan_stop: } |
| 443 |
\tex_divide:D \l__ctex_tmp_int \ccwd |
| 444 |
\int_compare:nNnTF \l__ctex_tmp_int > \c_zero_int |
| 445 |
{ |
| 446 |
\skip_set:Nn \l__ctex_ccglue_skip |
| 447 |
{ |
| 448 |
\c_zero_dim plus \dim_eval:n |
| 449 |
{ |
| 450 |
( \linewidth - \ccwd - \l__ctex_tmp_int \ccwd ) / |
| 451 |
\l__ctex_tmp_int |
| 452 |
} |
| 453 |
} |
| 454 |
} |
| 455 |
{ \skip_zero:N \l__ctex_ccglue_skip } |
| 456 |
\ctex_update_ccglue: |
| 457 |
} |
| 458 |
\cs_new_protected:Npn \ctex_update_parindent: |
| 459 |
{ |
| 460 |
\tl_if_empty:NF \l__ctex_autoindent_tl |
| 461 |
{ |
| 462 |
\dim_compare:nNnF \parindent = \c_zero_dim |
| 463 |
{ \dim_set:Nn \parindent { \l__ctex_autoindent_tl } } |
| 464 |
} |
| 465 |
} |
| 466 |
\NewDocumentCommand \ziju { m } |
| 467 |
{ \exp_args:Nx \ctex_ziju:n {#1} \tex_ignorespaces:D } |
| 468 |
\cs_new_protected:Npn \ctex_ziju:n #1 |
| 469 |
{ |
| 470 |
\tl_set:Nx \l__ctex_ziju_tl { \fp_eval:n {#1} } |
| 471 |
\ctex_select_size: |
| 472 |
} |
| 473 |
\cs_new_protected:Npn \ctex_update_ziju: |
| 474 |
{ |
| 475 |
\ctex_update_em_unit: |
| 476 |
\dim_set:Nn \l__ctex_ziju_dim { \l__ctex_ziju_tl \ccwd } |
| 477 |
\dim_add:Nn \ccwd { \l__ctex_ziju_dim } |
| 478 |
\dim_compare:nNnTF \ccwd > \c_zero_dim |
| 479 |
{ |
| 480 |
\dim_set:Nn \l__ctex_tmp_dim |
| 481 |
{ \linewidth - \ccwd + \l__ctex_ziju_dim } |
| 482 |
\int_set:Nn \l__ctex_tmp_int { \l__ctex_tmp_dim } |
| 483 |
\tex_divide:D \l__ctex_tmp_int \ccwd |
| 484 |
\dim_sub:Nn \l__ctex_tmp_dim { \l__ctex_tmp_int \ccwd } |
| 485 |
\dim_compare:nNnF \parindent = \c_zero_dim |
| 486 |
{ |
| 487 |
\int_compare:nNnF \l__ctex_tmp_int < 3 |
| 488 |
{ \int_sub:Nn \l__ctex_tmp_int { 2 } } |
| 489 |
} |
| 490 |
\skip_set:Nn \l__ctex_ccglue_skip |
| 491 |
{ |
| 492 |
\l__ctex_ziju_dim |
| 493 |
plus \dim_eval:n { \l__ctex_tmp_dim / \l__ctex_tmp_int } |
| 494 |
minus \dim_min:nn { \dim_abs:n { \l__ctex_ziju_dim } } |
| 495 |
{ ( \ccwd - \l__ctex_tmp_dim ) / ( \l__ctex_tmp_int + 1 ) } |
| 496 |
} |
| 497 |
} |
| 498 |
{ \skip_set:Nn \l__ctex_ccglue_skip { \l__ctex_ziju_dim } } |
| 499 |
\ctex_update_ccglue: |
| 500 |
\ctex_update_parindent: |
| 501 |
} |
| 502 |
\dim_new:N \l__ctex_ziju_dim |
| 503 |
\NewDocumentCommand \CTEXindent { } |
| 504 |
{ |
| 505 |
\ctex_deprecated_command:Nn \CTEXindent |
| 506 |
{ \parindent is~set~to~2\ccwd. } |
| 507 |
\ctex_update_ccwd: |
| 508 |
\dim_set:Nn \parindent { 2 \ccwd } |
| 509 |
} |
| 510 |
\NewDocumentCommand \CTEXnoindent { } |
| 511 |
{ |
| 512 |
\ctex_deprecated_command:Nn \CTEXnoindent |
| 513 |
{ \parindent is~set~to~0pt. } |
| 514 |
\dim_zero:N \parindent |
| 515 |
} |
| 516 |
\exp_args:Ne \PassOptionsToPackage |
| 517 |
{ encoding = \g__ctex_encoding_tl } |
| 518 |
{ zhnumber } |
| 519 |
\RequirePackage { zhnumber } |
| 520 |
\cs_new:Npn \chinese { \zhnum_counter:n } |
| 521 |
\cs_new_eq:NN \@chinese \@zhnum |
| 522 |
\cs_new_eq:NN \Chinese \chinese |
| 523 |
\cs_new_eq:NN \CTEXcounter \use_none:n |
| 524 |
\ctex_at_end_package:nn { enumitem } |
| 525 |
{ |
| 526 |
\cs_if_free:NF \AddEnumerateCounter |
| 527 |
{ |
| 528 |
\AddEnumerateCounter * { \zhnum } { \@zhnum } { 1 } |
| 529 |
\AddEnumerateCounter * { \zhdig } { \@zhdig } { 1 } |
| 530 |
\AddEnumerateCounter * { \chinese } { \@chinese } { 1 } |
| 531 |
} |
| 532 |
} |
| 533 |
\NewDocumentCommand \CTEXnumber { m m } |
| 534 |
{ \protected@edef #1 { \zhnumber {#2} } } |
| 535 |
\NewDocumentCommand \CTEXdigits { m m } |
| 536 |
{ \protected@edef #1 { \zhdigits {#2} } } |
| 537 |
\cs_set_eq:NN \CTEX@todayold \today |
| 538 |
\ctex_define:n |
| 539 |
{ |
| 540 |
today .choice: , |
| 541 |
today / old .code:n = |
| 542 |
{ \cs_set_eq:NN \today \CTEX@todayold } , |
| 543 |
today / small .code:n = |
| 544 |
{ |
| 545 |
\cs_set_eq:NN \today \zhtoday |
| 546 |
\zhnumsetup { time = Arabic } |
| 547 |
} , |
| 548 |
today / big .code:n = |
| 549 |
{ |
| 550 |
\cs_set_eq:NN \today \zhtoday |
| 551 |
\zhnumsetup { time = Chinese } |
| 552 |
} , |
| 553 |
today / unknown .code:n = |
| 554 |
{ \msg_error:nnx { ctex } { today-undef } {#1} } |
| 555 |
} |
| 556 |
\msg_new:nnnn { ctex } { today-undef } |
| 557 |
{ Today~format~`#1'~is~undefined. } |
| 558 |
{ Available~today~formats~are~`old',~`small',~and~`big'. } |
| 559 |
\tl_if_exist:NF \proofname |
| 560 |
{ |
| 561 |
\tl_new:N \proofname |
| 562 |
\tl_set:Nn \proofname { Proof } |
| 563 |
} |
| 564 |
\ctex_define:n |
| 565 |
{ |
| 566 |
contentsname .tl_set:N = \contentsname , |
| 567 |
listfigurename .tl_set:N = \listfigurename , |
| 568 |
listtablename .tl_set:N = \listtablename , |
| 569 |
figurename .tl_set:N = \figurename , |
| 570 |
tablename .tl_set:N = \tablename , |
| 571 |
abstractname .tl_set:N = \abstractname , |
| 572 |
indexname .tl_set:N = \indexname , |
| 573 |
appendixname .tl_set:N = \appendixname , |
| 574 |
proofname .tl_set:N = \proofname , |
| 575 |
algorithmname .tl_set:N = \algorithmname , |
| 576 |
bibname .tl_set:N = \bibname , |
| 577 |
refname .tl_set:N = \refname , |
| 578 |
continuation .tl_set:N = \insertcontinuationtext |
| 579 |
} |
| 580 |
\seq_const_from_clist:Nn \c__ctex_headings_seq |
| 581 |
{ part , section , subsection } |
| 582 |
\cs_new_protected:Npn \__ctex_initial_heading:n #1 |
| 583 |
{ |
| 584 |
\tl_new:c { CTEX@pre#1 } |
| 585 |
\tl_new:c { CTEX@post#1 } |
| 586 |
\tl_const:cx { CTEXthe#1 } |
| 587 |
{ |
| 588 |
\exp_not:c { CTEX@pre#1 } |
| 589 |
\exp_not:c { CTEX@the#1 } |
| 590 |
\exp_not:c { CTEX@post#1 } |
| 591 |
} |
| 592 |
\tl_const:cx { CTEX@#1name } |
| 593 |
{ |
| 594 |
\group_begin: |
| 595 |
\exp_not:c { CTEX@#1@nameformat } |
| 596 |
{ |
| 597 |
\exp_not:c { CTEX@pre#1 } |
| 598 |
\exp_not:N \tl_if_empty:NTF |
| 599 |
\exp_not:c { CTEX@#1@numberformat } |
| 600 |
{ \exp_not:c { CTEX@the#1 } } |
| 601 |
{ |
| 602 |
\group_begin: |
| 603 |
\exp_not:c { CTEX@#1@numberformat } |
| 604 |
\exp_not:c { CTEX@the#1 } |
| 605 |
\group_end: |
| 606 |
} |
| 607 |
\exp_not:c { CTEX@post#1 } |
| 608 |
} |
| 609 |
\group_end: |
| 610 |
} |
| 611 |
} |
| 612 |
\cs_new_protected:Npn \__ctex_def_heading_keys:n #1 |
| 613 |
{ |
| 614 |
\exp_args:NNe \tl_put_right:Nn \l__ctex_tmp_tl |
| 615 |
{ |
| 616 |
#1 .meta:nn = { ctex / #1 } { ##1 } , |
| 617 |
#1 / name .code:n = |
| 618 |
{ \ctex_assign_heading_name:nn {#1} { ##1 } } , |
| 619 |
#1 / number .tl_set:N = \exp_not:c { CTEX@the#1 } , |
| 620 |
#1 / beforeskip .tl_set:N = \exp_not:c { CTEX@#1@beforeskip } , |
| 621 |
#1 / afterskip .tl_set:N = \exp_not:c { CTEX@#1@afterskip} , |
| 622 |
#1 / indent .tl_set:N = \exp_not:c { CTEX@#1@indent } , |
| 623 |
#1 / numbering .bool_set:N = \exp_not:c { CTEX@#1@numbering } , |
| 624 |
#1 / numbering .initial:n = true , |
| 625 |
#1 / beforeskip .initial:n = \c_zero_skip , |
| 626 |
#1 / afterskip .initial:n = \c_zero_skip , |
| 627 |
#1 / indent .initial:n = \c_zero_dim , |
| 628 |
#1 / beforeskip .value_required:n = true , |
| 629 |
#1 / afterskip .value_required:n = true , |
| 630 |
#1 / indent .value_required:n = true , |
| 631 |
\__ctex_plus_key_aux:nn {#1} { format } , |
| 632 |
\__ctex_plus_key_aux:nn {#1} { nameformat } , |
| 633 |
\__ctex_plus_key_aux:nn {#1} { numberformat } , |
| 634 |
\__ctex_plus_key_aux:nn {#1} { titleformat } , |
| 635 |
\__ctex_plus_key_aux:nn {#1} { aftername } , |
| 636 |
\__ctex_plus_key_aux:nn {#1} { aftertitle } , |
| 637 |
} |
| 638 |
} |
| 639 |
\cs_new:Npn \__ctex_plus_key_aux:nn #1#2 |
| 640 |
{ |
| 641 |
#1 / #2 .tl_set:N = \exp_not:c { CTEX@#1@#2 } , |
| 642 |
#1 / #2 + .code:n = |
| 643 |
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } , |
| 644 |
#1 / #2 ~ + .code:n = |
| 645 |
{ \tl_put_right:Nn \exp_not:c { CTEX@#1@#2 } { ##1 } } |
| 646 |
} |
| 647 |
\NewDocumentCommand \ctex_assign_heading_name:nn |
| 648 |
{ m > { \SplitArgument { 1 } { , } } +m } |
| 649 |
{ \__ctex_assign_heading_name:nnn {#1} #2 } |
| 650 |
\cs_new_protected:Npn \__ctex_assign_heading_name:nnn #1#2#3 |
| 651 |
{ |
| 652 |
\tl_set:cn { CTEX@pre#1 } {#2} |
| 653 |
\tl_if_novalue:nTF {#3} |
| 654 |
{ \tl_clear:c { CTEX@post#1 } } |
| 655 |
{ \tl_set:cn { CTEX@post#1 } {#3} } |
| 656 |
} |
| 657 |
\group_begin: |
| 658 |
\tl_clear:N \l__ctex_tmp_tl |
| 659 |
\seq_map_inline:Nn \c__ctex_headings_seq |
| 660 |
{ |
| 661 |
\__ctex_initial_heading:n {#1} |
| 662 |
\__ctex_def_heading_keys:n {#1} |
| 663 |
} |
| 664 |
\exp_args:NNo \group_end: \ctex_define:n { \l__ctex_tmp_tl } |
| 665 |
\cs_new_protected:Npn \CTEX@heading@format@initial |
| 666 |
{ |
| 667 |
\normalfont |
| 668 |
\tl_clear:N \l__ctex_autoindent_tl |
| 669 |
\int_set:Nn \tex_interlinepenalty:D { 10 000 } |
| 670 |
\tex_noindent:D |
| 671 |
} |
| 672 |
\cs_new_protected:Npn \ctex_indent_box:n #1 |
| 673 |
{ |
| 674 |
\dim_set:Nn \tex_parindent:D {#1} |
| 675 |
\__ctex_insert_indent: |
| 676 |
} |
| 677 |
\cs_new_protected:Npn \__ctex_insert_indent: |
| 678 |
{ |
| 679 |
\dim_compare:nNnF \tex_parindent:D = \c_zero_dim |
| 680 |
{ \tex_indent:D } |
| 681 |
} |
| 682 |
\cs_new_eq:NN \CTEX@indentbox \ctex_indent_box:n |
| 683 |
\ExplSyntaxOff |
| 684 |
\defbeamertemplate*{part page}{CTEX}[1][]{% |
| 685 |
\begingroup |
| 686 |
\par \addvspace{\glueexpr\CTEX@part@beforeskip\relax}% |
| 687 |
\CTEX@heading@format@initial |
| 688 |
\CTEX@part@format{% |
| 689 |
\CTEX@indentbox{\CTEX@part@indent}% |
| 690 |
\ifodd \CTEX@part@numbering |
| 691 |
\CTEX@partname \CTEX@part@aftername |
| 692 |
\fi |
| 693 |
\begin{beamercolorbox}[sep=16pt,center,#1]{part title} |
| 694 |
\CTEX@part@titleformat \insertpart \CTEX@part@aftertitle |
| 695 |
\end{beamercolorbox}}% |
| 696 |
\par \addvspace{\glueexpr\CTEX@part@afterskip\relax}% |
| 697 |
\endgroup} |
| 698 |
\defbeamertemplate*{section page}{CTEX}[1][]{% |
| 699 |
\begingroup |
| 700 |
\par \addvspace{\glueexpr\CTEX@section@beforeskip\relax}% |
| 701 |
\CTEX@heading@format@initial |
| 702 |
\CTEX@section@format{% |
| 703 |
\CTEX@indentbox{\CTEX@section@indent}% |
| 704 |
\ifodd \CTEX@section@numbering |
| 705 |
\CTEX@sectionname \CTEX@section@aftername |
| 706 |
\fi |
| 707 |
\begin{beamercolorbox}[sep=12pt,center,#1]{part title} |
| 708 |
\CTEX@section@titleformat \insertsection \CTEX@section@aftertitle |
| 709 |
\end{beamercolorbox}}% |
| 710 |
\par \addvspace{\glueexpr\CTEX@section@afterskip\relax}% |
| 711 |
\endgroup} |
| 712 |
\defbeamertemplate*{subsection page}{CTEX}[1][]{% |
| 713 |
\begingroup |
| 714 |
\par \addvspace{\glueexpr\CTEX@subsection@beforeskip\relax}% |
| 715 |
\CTEX@heading@format@initial |
| 716 |
\CTEX@subsection@format{% |
| 717 |
\CTEX@indentbox{\CTEX@subsection@indent}% |
| 718 |
\ifodd \CTEX@subsection@numbering |
| 719 |
\CTEX@subsectionname \CTEX@subsection@aftername |
| 720 |
\fi |
| 721 |
\begin{beamercolorbox}[sep=8pt,center,#1]{part title} |
| 722 |
\CTEX@subsection@titleformat \insertsubsection \CTEX@subsection@aftertitle |
| 723 |
\end{beamercolorbox}}% |
| 724 |
\par \addvspace{\glueexpr\CTEX@subsection@afterskip\relax}% |
| 725 |
\endgroup} |
| 726 |
\defbeamertemplatealias{part page}{default}{CTEX} |
| 727 |
\defbeamertemplatealias{section page}{default}{CTEX} |
| 728 |
\defbeamertemplatealias{subsection page}{default}{CTEX} |
| 729 |
\ExplSyntaxOn |
| 730 |
\ctex_define:n |
| 731 |
{ |
| 732 |
tocdepth .code:n = \ctex_heading_depth:ne { tocdepth } {#1} , |
| 733 |
tocdepth .value_required:n = true |
| 734 |
} |
| 735 |
\cs_new_protected:Npn \ctex_heading_depth:nn #1#2 |
| 736 |
{ |
| 737 |
\prop_get:NnNTF \c__ctex_heading_level_prop {#2} \l__ctex_tmp_tl |
| 738 |
{ \setcounter {#1} { \l__ctex_tmp_tl } } |
| 739 |
{ \setcounter {#1} { \int_eval:n {#2} } } |
| 740 |
} |
| 741 |
\cs_generate_variant:Nn \ctex_heading_depth:nn { ne } |
| 742 |
\prop_const_from_keyval:Nn \c__ctex_heading_level_prop |
| 743 |
{ |
| 744 |
part = 0 , |
| 745 |
section = 1 , |
| 746 |
subsection = 2 , |
| 747 |
subsubsection = 3 , |
| 748 |
paragraph = 4 , |
| 749 |
subparagraph = 5 |
| 750 |
} |
| 751 |
\cs_new_protected:Npn \CTEX@setcurrentlabel@n #1 |
| 752 |
{ |
| 753 |
\protected@edef \@currentlabel |
| 754 |
{ |
| 755 |
\cs_if_exist:cTF { CTEX@the#1 } |
| 756 |
{ \exp_args:cc { p@#1 } { CTEX@the#1 } } |
| 757 |
{ \exp_not:o { \@currentlabel } } |
| 758 |
} |
| 759 |
} |
| 760 |
\cs_new_protected:Npn \ctex_varioref_hook: |
| 761 |
{ |
| 762 |
\seq_map_inline:Nn \c__ctex_headings_seq |
| 763 |
{ \ctex_fix_varioref_label:n { ##1 } } |
| 764 |
\ctex_at_end_package:nn { cleveref } { \ctex_cleveref_hook: } |
| 765 |
} |
| 766 |
\cs_new_protected:Npn \ctex_fix_varioref_label:n #1 |
| 767 |
{ |
| 768 |
\tl_if_empty:cT { p@#1 } |
| 769 |
{ \exp_args:Nnx \labelformat {#1} { \exp_not:c { CTEX@the#1 } } } |
| 770 |
} |
| 771 |
\cs_new_protected:Npn \ctex_cleveref_hook: |
| 772 |
{ |
| 773 |
\@ifpackageloaded { hyperref } |
| 774 |
{ |
| 775 |
\@ifpackagewith { hyperref } { implicit = false } |
| 776 |
{ } |
| 777 |
{ \__ctex_cleveref_hook_aux:N \H@refstepcounter } |
| 778 |
} |
| 779 |
{ |
| 780 |
\__ctex_cleveref_hook_aux:N \refstepcounter@noarg |
| 781 |
\__ctex_cleveref_hook_aux:N \refstepcounter@optarg |
| 782 |
} |
| 783 |
\__ctex_cleveref_hook_aux:N \appendix |
| 784 |
} |
| 785 |
\cs_new_protected:Npn \__ctex_cleveref_hook_aux:N #1 |
| 786 |
{ |
| 787 |
\ctex_patch_cmd_all:NnnnTF #1 |
| 788 |
{ |
| 789 |
\ExplSyntaxOff |
| 790 |
\char_set_catcode_letter:n { 64 } |
| 791 |
} |
| 792 |
{ \endcsname \csname the } |
| 793 |
{ \expandafter \endcsname \csname the } |
| 794 |
{ } |
| 795 |
{ \ctex_patch_failure:N #1 } |
| 796 |
} |
| 797 |
\cs_if_exist:NTF \labelformat |
| 798 |
{ \ctex_varioref_hook: } |
| 799 |
{ |
| 800 |
\cs_new_eq:NN \CTEX@save@refstepcounter \refstepcounter |
| 801 |
\RenewDocumentCommand \refstepcounter { m } |
| 802 |
{ |
| 803 |
\CTEX@save@refstepcounter {#1} |
| 804 |
\CTEX@setcurrentlabel@n {#1} |
| 805 |
} |
| 806 |
\ctex_at_end_package:nn { varioref } { \ctex_varioref_hook: } |
| 807 |
} |
| 808 |
\ctex_scheme_input:o { \l__ctex_scheme_tl } |
| 809 |
\NewDocumentCommand \zihao { m } |
| 810 |
{ \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D } |
| 811 |
\cs_new_protected:Npn \ctex_zihao:n #1 |
| 812 |
{ |
| 813 |
\prop_get:NnNTF \c__ctex_font_size_prop {#1} \l__ctex_font_size_tl |
| 814 |
{ \exp_after:wN \fontsize \l__ctex_font_size_tl \selectfont } |
| 815 |
{ \msg_error:nnn { ctex } { fontsize } {#1} } |
| 816 |
} |
| 817 |
\msg_new:nnnn { ctex } { fontsize } |
| 818 |
{ Undefined~Chinese~font~size~`#1'~in~command~\token_to_str:N \zihao.} |
| 819 |
{ |
| 820 |
The~old~font~size~is~used~if~you~continue.\\ |
| 821 |
The~available~font~sizes~are~listed~as~follow.\\ |
| 822 |
\seq_use:Nnnn \c__ctex_font_size_seq { ~and~ } { ,~ } { ,~and~ }. |
| 823 |
} |
| 824 |
\prop_new:N \c__ctex_font_size_prop |
| 825 |
\seq_new:N \c__ctex_font_size_seq |
| 826 |
\cs_new_protected:Npn \__ctex_save_font_size:nn #1#2 |
| 827 |
{ |
| 828 |
\use:e |
| 829 |
{ |
| 830 |
\prop_gput:Nnn \exp_not:N \c__ctex_font_size_prop {#1} |
| 831 |
{ |
| 832 |
{ \dim_to_decimal:n {#2} } |
| 833 |
{ \dim_to_decimal:n { (#2) * 6 / 5 } } |
| 834 |
} |
| 835 |
} |
| 836 |
\seq_gput_right:Nn \c__ctex_font_size_seq {#1} |
| 837 |
} |
| 838 |
\clist_map_inline:nn |
| 839 |
{ |
| 840 |
{ 8 } { 5 bp } , |
| 841 |
{ 7 } { 5.5 bp } , |
| 842 |
{ -6 } { 6.5 bp } , |
| 843 |
{ 6 } { 7.5 bp } , |
| 844 |
{ -5 } { 9 bp } , |
| 845 |
{ 5 } { 10.5 bp } , |
| 846 |
{ -4 } { 12 bp } , |
| 847 |
{ 4 } { 14 bp } , |
| 848 |
{ -3 } { 15 bp } , |
| 849 |
{ 3 } { 16 bp } , |
| 850 |
{ -2 } { 18 bp } , |
| 851 |
{ 2 } { 22 bp } , |
| 852 |
{ -1 } { 24 bp } , |
| 853 |
{ 1 } { 26 bp } , |
| 854 |
{ -0 } { 36 bp } , |
| 855 |
{ 0 } { 42 bp } |
| 856 |
} |
| 857 |
{ \__ctex_save_font_size:nn #1 } |
| 858 |
\cs_new_protected:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4 |
| 859 |
{ |
| 860 |
\__ctex_get_font_sizes:Nn \l__ctex_font_size_tl { {#1} {#2} {#3} {#4} } |
| 861 |
\exp_after:wN \DeclareMathSizes \l__ctex_font_size_tl |
| 862 |
} |
| 863 |
\cs_new_protected:Npn \__ctex_get_font_sizes:Nn #1#2 |
| 864 |
{ |
| 865 |
\tl_clear:N #1 |
| 866 |
\tl_map_inline:nn {#2} |
| 867 |
{ |
| 868 |
\prop_get:NnNTF \c__ctex_font_size_prop {##1} \l__ctex_tmp_tl |
| 869 |
{ \tl_put_right:Nx #1 { { \tl_head:N \l__ctex_tmp_tl } } } |
| 870 |
{ \tl_put_right:Nx #1 { { \dim_to_decimal:n { ##1 } } } } |
| 871 |
} |
| 872 |
} |
| 873 |
\clist_map_inline:nn |
| 874 |
{ |
| 875 |
{ 8 }{ 8 }{ 5pt }{ 5pt } , |
| 876 |
{ 7 }{ 7 }{ 5pt }{ 5pt } , |
| 877 |
{ -6 }{ -6 }{ 5pt }{ 5pt } , |
| 878 |
{ 6 }{ 6 }{ 5pt }{ 5pt } , |
| 879 |
{ -5 }{ -5 }{ 6pt }{ 5pt } , |
| 880 |
{ 5 }{ 5 }{ 7pt }{ 5pt } , |
| 881 |
{ -4 }{ -4 }{ 8pt }{ 6pt } , |
| 882 |
{ 4 }{ 4 }{ 5 }{ 6 } , |
| 883 |
{ -3 }{ -3 }{ -4 }{ -5 } , |
| 884 |
{ 3 }{ 3 }{ 4 }{ 5 } , |
| 885 |
{ -2 }{ -2 }{ -3 }{ -4 } , |
| 886 |
{ 2 }{ 2 }{ 3 }{ 4 } , |
| 887 |
{ -1 }{ -1 }{ -2 }{ -3 } , |
| 888 |
{ 1 }{ 1 }{ 2 }{ 3 } , |
| 889 |
{ -0 }{ -0 }{ -1 }{ -2 } , |
| 890 |
{ 0 }{ 0 }{ 1 }{ 2 } |
| 891 |
} |
| 892 |
{ \ctex_declare_math_sizes:nnnn #1 } |
| 893 |
\cs_new_protected:Npn \ctex_set_font_size:Nnn #1#2#3 |
| 894 |
{ |
| 895 |
\prop_get:NnNTF \c__ctex_font_size_prop {#2} \l__ctex_font_size_tl |
| 896 |
{ \exp_after:wN \__ctex_set_font_size:nnNn \l__ctex_font_size_tl #1 {#3} } |
| 897 |
{ \msg_error:nnn { ctex } { fontsize } {#2} } |
| 898 |
} |
| 899 |
\cs_new_protected:Npn \__ctex_set_font_size:nnNn #1#2#3#4 |
| 900 |
{ \cs_set_protected:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } } |
| 901 |
\int_case:nn { \g__ctex_font_size_int } |
| 902 |
{ |
| 903 |
{ 0 } { \file_input:n { ctex-c5size.clo } } |
| 904 |
{ 1 } { \file_input:n { ctex-cs4size.clo } } |
| 905 |
} |
| 906 |
\fp_if_nan:nF { \l__ctex_line_spread_fp } |
| 907 |
{ |
| 908 |
\exp_args:Nx \linespread { \fp_use:N \l__ctex_line_spread_fp } |
| 909 |
\group_begin: \footnotesize \exp_args:NNNo \group_end: |
| 910 |
\dim_set:Nn \footnotesep { \dim_use:N \box_ht:N \strutbox } |
| 911 |
} |
| 912 |
\normalsize |
| 913 |
\NewDocumentCommand \CTeX { } |
| 914 |
{ C \TeX } |
| 915 |
\ctex_at_end_package:nn { hyperref } |
| 916 |
{ \pdfstringdefDisableCommands { \tl_set:Nn \CTeX { CTeX } } } |
| 917 |
\ctex_define:n |
| 918 |
{ |
| 919 |
captiondelimiter .code:n = |
| 920 |
{ |
| 921 |
\ctex_deprecated_option:n |
| 922 |
{ You~can~load~the~package~`caption'~to~get~its~functionality. } |
| 923 |
} |
| 924 |
} |
| 925 |
\cs_new_protected:Npn \ctex_fontset_error:n #1 |
| 926 |
{ \msg_critical:nnn { ctex } { fontset-unavailable } {#1} } |
| 927 |
\msg_new:nnn { ctex } { fontset-unavailable } |
| 928 |
{ CTeX~fontset~`#1'~is~unavailable~in~current~mode. } |
| 929 |
\cs_new:Npx \ctex_fontset_case:nnn #1#2#3 |
| 930 |
{ |
| 931 |
\sys_if_engine_pdftex:TF |
| 932 |
{#1} |
| 933 |
{ \sys_if_engine_uptex:TF {#2} {#3} } |
| 934 |
} |
| 935 |
\cs_new:Npx \ctex_fontset_case:nnnn #1#2#3#4 |
| 936 |
{ |
| 937 |
\sys_if_engine_pdftex:TF |
| 938 |
{ \sys_if_output_pdf:TF {#1} {#2} } |
| 939 |
{ \sys_if_engine_uptex:TF {#3} {#4} } |
| 940 |
} |
| 941 |
\cs_new_protected:Npn \ctex_detect_platform: |
| 942 |
{ |
| 943 |
\sys_if_platform_windows:TF |
| 944 |
{ \tl_gset:Nn \g__ctex_fontset_tl { windows } } |
| 945 |
{ |
| 946 |
\ctex_if_platform_macos:TF |
| 947 |
{ \tl_gset:Nn \g__ctex_fontset_tl { mac } } |
| 948 |
{ \tl_gset:Nn \g__ctex_fontset_tl { fandol } } |
| 949 |
} |
| 950 |
} |
| 951 |
\cs_new_protected:Npn \ctex_if_platform_macos:TF |
| 952 |
{ \file_if_exist:nTF { /System/Library/Fonts/Menlo.ttc } } |
| 953 |
\cs_new_protected:Npn \ctex_load_fontset: |
| 954 |
{ |
| 955 |
\tl_if_empty:NTF \g__ctex_fontset_tl |
| 956 |
{ \ctex_detect_platform: } |
| 957 |
{ |
| 958 |
\bool_lazy_or:nnTF |
| 959 |
{ \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsnew } } |
| 960 |
{ \str_if_eq_p:on { \g__ctex_fontset_tl } { windowsold } } |
| 961 |
{ |
| 962 |
\msg_warning:nnxx { ctex } { deprecated-fontset } |
| 963 |
{ \g__ctex_fontset_tl } { windows } |
| 964 |
\tl_gset:Nn \g__ctex_fontset_tl { windows } |
| 965 |
} |
| 966 |
{ |
| 967 |
\file_if_exist:nF { ctex-fontset- \g__ctex_fontset_tl .def } |
| 968 |
{ |
| 969 |
\use:e |
| 970 |
{ |
| 971 |
\ctex_detect_platform: |
| 972 |
\msg_error:nnxx { ctex } { fontset-not-found } |
| 973 |
{ \g__ctex_fontset_tl } { \exp_not:N \g__ctex_fontset_tl } |
| 974 |
} |
| 975 |
} |
| 976 |
} |
| 977 |
} |
| 978 |
\ctex_file_input:n { ctex-fontset- \g__ctex_fontset_tl .def } |
| 979 |
} |
| 980 |
\msg_new:nnn { ctex } { deprecated-fontset } |
| 981 |
{ CTeX~fontset~`#1'~is~deprecated.\\ Fontset~`#2'~will~be~used~instead. } |
| 982 |
\msg_new:nnnn { ctex } { fontset-not-found } |
| 983 |
{ CTeX~fontset~`#1'~could~not~be~found.\\ Fontset~`#2'~will~be~used~instead. } |
| 984 |
{ You~may~run~`mktexlsr'~firstly. } |
| 985 |
\@onlypreamble \ctex_load_fontset: |
| 986 |
\ctex_define:n |
| 987 |
{ |
| 988 |
fontset .code:n = |
| 989 |
{ |
| 990 |
\ctex_if_preamble:TF |
| 991 |
{ |
| 992 |
\str_if_eq:eeTF {#1} { none } |
| 993 |
{ \msg_warning:nnn { ctex } { invalid-value } {#1} } |
| 994 |
{ |
| 995 |
\str_if_eq:onTF { \g__ctex_fontset_tl } { none } |
| 996 |
{ |
| 997 |
\tl_gset:Nx \g__ctex_fontset_tl {#1} |
| 998 |
\ctex_load_fontset: |
| 999 |
} |
| 1000 |
{ |
| 1001 |
\msg_error:nnxx { ctex } { fontset-loaded } |
| 1002 |
{ \g__ctex_fontset_tl } {#1} |
| 1003 |
} |
| 1004 |
} |
| 1005 |
} |
| 1006 |
{ \msg_error:nn { ctex } { fontset-only-preamble } } |
| 1007 |
} |
| 1008 |
} |
| 1009 |
\msg_new:nnnn { ctex } { fontset-loaded } |
| 1010 |
{ |
| 1011 |
CTeX~fontset~`#1'~has~been~loaded. |
| 1012 |
\str_if_eq:nnF {#1} {#2} { \\ Fontset~`#2'~will~be~ignored. } |
| 1013 |
} |
| 1014 |
{ Only~one~fontset~can~be~loaded~in~the~preamble. } |
| 1015 |
\msg_new:nnn { ctex } { fontset-only-preamble } |
| 1016 |
{ The~`fontset'~option~can~be~used~only~in~preamble. } |
| 1017 |
\str_if_eq:onF { \g__ctex_fontset_tl } { none } |
| 1018 |
{ \ctex_load_fontset: } |
| 1019 |
\ctex_at_end:n { \ctex_file_input:n { ctex.cfg } } |
| 1020 |
%% |
| 1021 |
%% This package consists of the files ctex.dtx, |
| 1022 |
%% ctxdoc.cls, |
| 1023 |
%% ctxdocstrip.tex, |
| 1024 |
%% ctex-zhconv.lua, |
| 1025 |
%% ctex-zhconv-make.lua, |
| 1026 |
%% and the derived files ctex.pdf, |
| 1027 |
%% ctex.ins, |
| 1028 |
%% ctex.sty, |
| 1029 |
%% ctexsize.sty, |
| 1030 |
%% ctexheading.sty, |
| 1031 |
%% ctexart.cls, |
| 1032 |
%% ctexbook.cls, |
| 1033 |
%% ctexrep.cls, |
| 1034 |
%% ctexbeamer.cls, |
| 1035 |
%% ctexcap.sty, |
| 1036 |
%% ctexhook.sty, |
| 1037 |
%% ctexpatch.sty, |
| 1038 |
%% ctex-c5size.clo, |
| 1039 |
%% ctex-cs4size.clo, |
| 1040 |
%% ctex-heading-article.def, |
| 1041 |
%% ctex-heading-book.def, |
| 1042 |
%% ctex-heading-report.def, |
| 1043 |
%% ctex-heading-beamer.def, |
| 1044 |
%% ctex-scheme-plain.def, |
| 1045 |
%% ctex-scheme-plain-article.def, |
| 1046 |
%% ctex-scheme-plain-book.def, |
| 1047 |
%% ctex-scheme-plain-report.def, |
| 1048 |
%% ctex-scheme-plain-beamer.def, |
| 1049 |
%% ctex-scheme-chinese.def, |
| 1050 |
%% ctex-scheme-chinese-article.def, |
| 1051 |
%% ctex-scheme-chinese-book.def, |
| 1052 |
%% ctex-scheme-chinese-report.def, |
| 1053 |
%% ctex-scheme-chinese-beamer.def, |
| 1054 |
%% ctex-name-gbk.cfg, |
| 1055 |
%% ctex-name-utf8.cfg, |
| 1056 |
%% ctex.cfg, |
| 1057 |
%% ctexopts.cfg, |
| 1058 |
%% ctexbackend.cfg, |
| 1059 |
%% ctex-engine-pdftex.def, |
| 1060 |
%% ctex-engine-xetex.def, |
| 1061 |
%% ctex-engine-luatex.def, |
| 1062 |
%% ctex-engine-aptex.def, |
| 1063 |
%% ctex-engine-uptex.def, |
| 1064 |
%% c19rm.fd, |
| 1065 |
%% c19sf.fd, |
| 1066 |
%% c19tt.fd, |
| 1067 |
%% c70rm.fd, |
| 1068 |
%% c70sf.fd, |
| 1069 |
%% c70tt.fd, |
| 1070 |
%% jy2zhrm.fd, |
| 1071 |
%% jy2zhsf.fd, |
| 1072 |
%% jy2zhtt.fd, |
| 1073 |
%% jt2zhrm.fd, |
| 1074 |
%% jt2zhsf.fd, |
| 1075 |
%% jt2zhtt.fd, |
| 1076 |
%% ctex-fontset-adobe.def, |
| 1077 |
%% ctex-fontset-fandol.def, |
| 1078 |
%% ctex-fontset-founder.def, |
| 1079 |
%% ctex-fontset-mac.def, |
| 1080 |
%% ctex-fontset-macnew.def, |
| 1081 |
%% ctex-fontset-macold.def, |
| 1082 |
%% ctex-fontset-ubuntu.def, |
| 1083 |
%% ctex-fontset-windows.def, |
| 1084 |
%% ctexspa.def, |
| 1085 |
%% ctexpunct.spa, |
| 1086 |
%% ctex-spa-make.tex, |
| 1087 |
%% ctex-spa-macro.tex, |
| 1088 |
%% ctex-zhmap-adobe.tex, |
| 1089 |
%% ctex-zhmap-fandol.tex, |
| 1090 |
%% ctex-zhmap-founder.tex, |
| 1091 |
%% ctex-zhmap-mac.tex, |
| 1092 |
%% ctex-zhmap-ubuntu.tex, |
| 1093 |
%% ctex-zhmap-windows.tex, |
| 1094 |
%% ctex-zhconv-index.lua, |
| 1095 |
%% translator-theorem-dictionary-ChineseGBK.dict, |
| 1096 |
%% translator-theorem-dictionary-ChineseUTF8.dict, and |
| 1097 |
%% README.md. |
| 1098 |
%% |
| 1099 |
%% End of file `ctexbeamer.cls'. |