diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ctex/ctexheading.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/ctex/ctexheading.sty | 278 |
1 files changed, 278 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ctex/ctexheading.sty b/Master/texmf-dist/tex/latex/ctex/ctexheading.sty new file mode 100644 index 00000000000..efff90fbbdd --- /dev/null +++ b/Master/texmf-dist/tex/latex/ctex/ctexheading.sty @@ -0,0 +1,278 @@ +%% +%% This is file `ctexheading.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% ctex.dtx (with options: `style,ctexheading') +%% +%% Copyright (C) 2003--2015 +%% 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. +%% +%% ------------------------------------------------------------------------------ +%% +\NeedsTeXFormat{LaTeX2e} +\RequirePackage{expl3} +\GetIdInfo$Id: ctex.dtx ca75f0e 2015-06-19 17:39:23 +0800 Qing Lee <sobenlee@gmail.com> $ + {Heading style modification (CTEX)} +\ProvidesExplPackage{ctexheading} + {\ExplFileDate}{2.1}{\ExplFileDescription} +\RequirePackage { xparse , l3keys2e } +\RequirePackage { etoolbox } +\tl_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_at_end_package:nn #1#2 + { + \@ifpackageloaded {#1} + {#2} + { \ctex_gadd_hook:cn { g__ctex_at_end_ #1 _hook_tl } {#2} } + } +\cs_new_protected:Npn \ctex_gadd_hook:Nn #1#2 + { + \tl_if_exist:NF #1 { \tl_new:N #1 } + \tl_gput_right:Nn #1 {#2} + } +\cs_generate_variant:Nn \ctex_gadd_hook:Nn { c } +\cs_new_protected_nopar:Npn \ctex_package_end_hook:n #1 + { + \cs_if_exist_use:cT { g__ctex_at_end_ #1 _hook_tl } + { \cs_undefine:c { g__ctex_at_end_ #1 _hook_tl } } + } +\cs_generate_variant:Nn \ctex_package_end_hook:n { o } +\tl_put_left:Nn \@popfilename + { + \cs_if_eq:NNT \@currext \@pkgextension + { \ctex_package_end_hook:o { \@currname } } + } +\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_nopar:Npn \ctex_file_input:n #1 + { \ctex_file_wrapper:nnn { } { \file_input:n {#1} } { } } +\cs_new_protected_nopar:Npn \ctex_scheme_input:n #1 + { + \ctex_file_wrapper:nnn + { } + { + \tl_if_exist:NTF \c__ctex_class_tl + { + \file_if_exist_input:nF { ctex-scheme- #1 - \c__ctex_class_tl .def } + { \file_input:n { ctex-scheme- #1 .def } } + } + { \file_input:n { ctex-scheme- #1 .def } } + } + { } + } +\cs_generate_variant:Nn \ctex_scheme_input:n { o } +\cs_new_protected:Npn \ctex_parse_name:NN #1#2 + { \ctex_parse_name:NNx #1#2 { \cs_to_str:N #2 } } +\group_begin: +\char_set_lccode:nn { `\< } { `\{ } +\char_set_lccode:nn { `\/ } { `\\ } +\char_set_lccode:nn { `\A } { `\t } +\tl_map_function:nN { \A \E \S \O \P } \char_set_catcode_other:N +\tex_lowercase:D + { + \group_end: + \cs_new_protected:Npn \ctex_parse_name:NNn #1#2#3 + { + \bool_if:nTF { \cs_if_exist_p:c { #3 ~ } || \cs_if_exist_p:c { /#3 } } + { + \group_begin: + \use:x + { + \group_end: + \__ctex_parse_name:nNNNnN { \token_get_replacement_spec:N #2 } + \exp_not:N #2 \exp_not:c { #3 ~ } \exp_not:c { /#3 } + } {#3} #1 + } + { #1#2 } + } + \cs_new_protected:Npn \__ctex_parse_name:nNNNnN #1#2#3#4#5#6 + { + \exp_args:Nc #6 + { + \str_case:nnTF {#1} + { + { \protect #3 } { } + { \x@protect #2 \protect #3 } { } + } + { + \str_if_eq_x:nnTF { \exp_not:n { /@protected@ #3 /#3 } } + { + \exp_last_unbraced:Nf \__ctex_parse_name:w + \token_get_replacement_spec:N #3 AESAOPA ~ < \q_stop + } + { /#5 ~ } { #5 ~ } + } + { + \str_case:onTF { \__ctex_parse_name:w #1 AESAOPA ~ < \q_stop } + { + { /@protected@ #2 #4 } { } + { /@ #4 } { } + } + { /#5 } {#5} + } + } + } + \cs_new:Npn \__ctex_parse_name:w #1 AESAOPA ~ #2 < #3 \q_stop { #1#2 } + } +\cs_generate_variant:Nn \ctex_parse_name:NNn { NNx } +\cs_new_protected_nopar:Npn \ctex_patch_cmd:NnnTF { \ctex_parse_name:NN \patchcmd } +\cs_new_protected_nopar:Npn \ctex_preto_cmd:NnTF { \ctex_parse_name:NN \pretocmd } +\cs_new_protected_nopar:Npn \ctex_appto_cmd:NnTF { \ctex_parse_name:NN \apptocmd } +\cs_new_protected:Npn \ctex_patch_cmd:Nnn + { + \group_begin: + \char_set_catcode_other:N \# + \__ctex_patch_cmd:Nnn + } +\cs_new_protected:Npn \__ctex_patch_cmd:Nnn #1#2#3 + { + \group_end: + \group_begin: + \ExplSyntaxOff + \ctex_patch_cmd:NnnTF #1 {#2} {#3} + { + \cs_gset_eq:NN \__ctex_tmp:w #1 + \group_end: + \cs_set_eq:NN #1 \__ctex_tmp:w + \cs_undefine:N \__ctex_tmp:w + } + { \group_end: \ctex_patch_failure:N #1 } + } +\cs_new_protected:Npn \ctex_patch_failure:N #1 + { \msg_warning:nnx { ctex } { patch-failure } { \token_to_str:N #1 } } +\msg_new:nnn { ctex } { patch-failure } + { + Patching~command~`#1'~failed.\\ + ctex~may~not~work~as~expected. + } +\cs_new_eq:NN \g__ctex_section_depth_flag \c_two +\keys_define:nn { ctex / option } + { + sub3section .code:n = + { \cs_gset_eq:NN \g__ctex_section_depth_flag \c_three } , + sub4section .code:n = + { \cs_gset_eq:NN \g__ctex_section_depth_flag \c_four } , + sub3section .value_forbidden: , + sub4section .value_forbidden: , + scheme .tl_set:N = \l__ctex_scheme_tl , + scheme .default:n = { plain } , + scheme .initial:n = { plain } + } +\ProcessKeysOptions { ctex / option } +\NewDocumentCommand \ctexset { } { \keys_set:nn { ctex } } +\clist_map_inline:nn { article , book , report } + { + \@ifclassloaded {#1} + { \clist_map_break:n { \tl_const:Nn \c__ctex_std_class_tl {#1} } } + { } + } +\msg_new:nnn { ctex } { not-standard-class } + { + None~of~the~standard~document~classes~was~loaded.\\ + Heading~`#1'~is~selected.\\ + ctex~may~not~work~as~expected. + } +\use:n + { + \tl_if_exist:NTF \c__ctex_std_class_tl + { \cs_new_eq:NN \c__ctex_class_tl \c__ctex_std_class_tl } + { + \cs_if_exist:NTF \chapter + { + \cs_if_exist:NF \if@mainmatter + { \cs_new_eq:NN \if@mainmatter \tex_iftrue:D } + \tl_const:Nn \c__ctex_class_tl { book } + } + { \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 } + } +%% +%% This package consists of the file ctex.dtx, +%% and the derived files ctex.pdf, +%% ctex.ins, +%% ctex.sty, +%% ctexcap.sty, +%% ctexsize.sty, +%% ctexheading.sty, +%% ctexart.cls, +%% ctexbook.cls, +%% ctexrep.cls, +%% ctex-c5size.clo, +%% ctex-cs4size.clo, +%% ctex-article.def, +%% ctex-book.def, +%% ctex-report.def, +%% ctex-scheme-plain.def, +%% ctex-scheme-plain-article.def, +%% ctex-scheme-plain-book.def, +%% ctex-scheme-plain-report.def, +%% ctex-scheme-chinese.def, +%% ctex-scheme-chinese-article.def, +%% ctex-scheme-chinese-book.def, +%% ctex-scheme-chinese-report.def, +%% ctex-name-gbk.cfg, +%% ctex-name-utf8.cfg, +%% ctex.cfg, +%% ctexopts.cfg, +%% ctex-engine-pdftex.def, +%% ctex-engine-xetex.def, +%% ctex-engine-luatex.def, +%% c19rm.fd, +%% c19sf.fd, +%% c19tt.fd, +%% c70rm.fd, +%% c70sf.fd, +%% c70tt.fd, +%% ctex-fontset-windows.def, +%% ctex-fontset-windowsnew.def, +%% ctex-fontset-windowsold.def, +%% ctex-fontset-adobe.def, +%% ctex-fontset-fandol.def, +%% ctex-fontset-mac.def, +%% ctex-fontset-founder.def, +%% ctex-fontset-ubuntu.def, +%% ctexspa.def, +%% ctexpunct.spa, +%% ctexmakespa.tex, +%% ctexspamacro.tex, +%% zhadobefonts.tex, +%% zhfandolfonts.tex, +%% zhfounderfonts.tex, +%% zhubuntufonts.tex, +%% zhwindowsfonts.tex, and +%% README. +%% +%% End of file `ctexheading.sty'. |