summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ctex/ctexheading.sty
blob: 0ceeeeddc3abe4791afcc256f3dfd7080233f88c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
%%
%% This is file `ctexheading.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% ctex.dtx  (with options: `style,ctexheading')
%% 
%%     Copyright (C) 2003--2017
%%     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 c498d8c 2017-04-01 21:33:50 +0800 Qing Lee <sobenlee@gmail.com> $
  {Heading style modification (CTEX)}
\ProvidesExplPackage{ctexheading}
  {\ExplFileDate}{2.4.9}{\ExplFileDescription}
\RequirePackage { xparse , l3keys2e }
\RequirePackage { ctexhook , ctexpatch }
\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_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_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:n = true ,
    sub4section .value_forbidden:n = true ,
    scheme .tl_set:N  = \l__ctex_scheme_tl ,
    scheme .default:n = { plain } ,
    scheme .initial:n = { plain }
  }
\ProcessKeysOptions { ctex / option }
\clist_map_inline:nn { article , book , report , beamer }
  {
    \@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,
%%                                        ctexsize.sty,
%%                                        ctexheading.sty,
%%                                        ctexart.cls,
%%                                        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-scheme-plain.def,
%%                                        ctex-scheme-plain-article.def,
%%                                        ctex-scheme-plain-book.def,
%%                                        ctex-scheme-plain-report.def,
%%                                        ctex-scheme-plain-beamer.def,
%%                                        ctex-scheme-chinese.def,
%%                                        ctex-scheme-chinese-article.def,
%%                                        ctex-scheme-chinese-book.def,
%%                                        ctex-scheme-chinese-report.def,
%%                                        ctex-scheme-chinese-beamer.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,
%%                                        ctex-engine-aptex.def,
%%                                        ctex-engine-uptex.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,
%%                                        ctxdocstrip.tex,
%%                                        zhadobefonts.tex,
%%                                        zhfandolfonts.tex,
%%                                        zhfounderfonts.tex,
%%                                        zhubuntufonts.tex,
%%                                        zhwindowsfonts.tex,
%%                                        translator-theorem-dictionary-ChineseGBK.dict,
%%                                        translator-theorem-dictionary-ChineseUTF8.dict, and
%%                                        README.md.
%%
%% End of file `ctexheading.sty'.