Debian Codegraph @

texmf-dist/tex/latex/ctex/ctexsize.sty

raw
1 %%
2 %% This is file `ctexsize.sty',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% ctex.dtx (with options: `style,ctexsize')
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 \RequirePackage{expl3}
29 \GetIdInfo$Id: ctex.dtx 13a2256 2022-07-14 18:54:09 +0800 Qing Lee <[email protected]> $
30 {Chinese font size definition (CTEX)}
31 \ProvidesExplPackage{ctexsize}
32 {\ExplFileDate}{2.5.10}{\ExplFileDescription}
33 \cs_if_exist:NF \NewDocumentCommand
34 { \RequirePackage { xparse } }
35 \prop_gput:Nnn \g_msg_module_name_prop { ctex } { ctexsize }
36 \RequirePackage { fix-cm }
37 \cs_new_protected:Npn \ctex_define_option:n
38 { \keys_define:nn { ctex / option } }
39 \int_new:N \g__ctex_font_size_int
40 \int_gset:Nn \g__ctex_font_size_int { -1 }
41 \ctex_define_option:n
42 {
43 zihao .choice: ,
44 zihao .value_required:n = true ,
45 zihao / 5 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 0 } } ,
46 zihao / -4 .code:n = { \int_gset:Nn \g__ctex_font_size_int { 1 } } ,
47 zihao / false .code:n = { \int_gset:Nn \g__ctex_font_size_int { 2 } } ,
48 }
49 \tl_clear_new:N \l__ctex_tmp_tl
50 \clist_map_inline:nn
51 {
52 10pt , 11pt , 12pt ,
53 8pt , 9pt , 14pt , 17pt , 20pt , 25pt , 30pt , 36pt , 48pt , 60pt
54 }
55 {
56 \tl_put_right:Nn \l__ctex_tmp_tl
57 {
58 #1 .code:n =
59 { \int_gset:Nn \g__ctex_font_size_int { 2 } } ,
60 #1 .value_forbidden:n = true ,
61 }
62 }
63 \exp_args:No \ctex_define_option:n { \l__ctex_tmp_tl }
64 \tl_clear:N \l__ctex_tmp_tl
65 \cs_if_exist:NTF \ProcessKeyOptions
66 { \ProcessKeyOptions [ ctex / option ] }
67 {
68 \RequirePackage { l3keys2e }
69 \ProcessKeysOptions { ctex / option }
70 }
71 \NewDocumentCommand \zihao { m }
72 { \exp_args:Nx \ctex_zihao:n {#1} \tex_ignorespaces:D }
73 \cs_new_protected:Npn \ctex_zihao:n #1
74 {
75 \prop_get:NnNTF \c__ctex_font_size_prop {#1} \l__ctex_font_size_tl
76 { \exp_after:wN \fontsize \l__ctex_font_size_tl \selectfont }
77 { \msg_error:nnn { ctex } { fontsize } {#1} }
78 }
79 \msg_new:nnnn { ctex } { fontsize }
80 { Undefined~Chinese~font~size~`#1'~in~command~\token_to_str:N \zihao.}
81 {
82 The~old~font~size~is~used~if~you~continue.\\
83 The~available~font~sizes~are~listed~as~follow.\\
84 \seq_use:Nnnn \c__ctex_font_size_seq { ~and~ } { ,~ } { ,~and~ }.
85 }
86 \prop_new:N \c__ctex_font_size_prop
87 \seq_new:N \c__ctex_font_size_seq
88 \cs_new_protected:Npn \__ctex_save_font_size:nn #1#2
89 {
90 \use:e
91 {
92 \prop_gput:Nnn \exp_not:N \c__ctex_font_size_prop {#1}
93 {
94 { \dim_to_decimal:n {#2} }
95 { \dim_to_decimal:n { (#2) * 6 / 5 } }
96 }
97 }
98 \seq_gput_right:Nn \c__ctex_font_size_seq {#1}
99 }
100 \clist_map_inline:nn
101 {
102 { 8 } { 5 bp } ,
103 { 7 } { 5.5 bp } ,
104 { -6 } { 6.5 bp } ,
105 { 6 } { 7.5 bp } ,
106 { -5 } { 9 bp } ,
107 { 5 } { 10.5 bp } ,
108 { -4 } { 12 bp } ,
109 { 4 } { 14 bp } ,
110 { -3 } { 15 bp } ,
111 { 3 } { 16 bp } ,
112 { -2 } { 18 bp } ,
113 { 2 } { 22 bp } ,
114 { -1 } { 24 bp } ,
115 { 1 } { 26 bp } ,
116 { -0 } { 36 bp } ,
117 { 0 } { 42 bp }
118 }
119 { \__ctex_save_font_size:nn #1 }
120 \cs_new_protected:Npn \ctex_declare_math_sizes:nnnn #1#2#3#4
121 {
122 \__ctex_get_font_sizes:Nn \l__ctex_font_size_tl { {#1} {#2} {#3} {#4} }
123 \exp_after:wN \DeclareMathSizes \l__ctex_font_size_tl
124 }
125 \cs_new_protected:Npn \__ctex_get_font_sizes:Nn #1#2
126 {
127 \tl_clear:N #1
128 \tl_map_inline:nn {#2}
129 {
130 \prop_get:NnNTF \c__ctex_font_size_prop {##1} \l__ctex_tmp_tl
131 { \tl_put_right:Nx #1 { { \tl_head:N \l__ctex_tmp_tl } } }
132 { \tl_put_right:Nx #1 { { \dim_to_decimal:n { ##1 } } } }
133 }
134 }
135 \clist_map_inline:nn
136 {
137 { 8 }{ 8 }{ 5pt }{ 5pt } ,
138 { 7 }{ 7 }{ 5pt }{ 5pt } ,
139 { -6 }{ -6 }{ 5pt }{ 5pt } ,
140 { 6 }{ 6 }{ 5pt }{ 5pt } ,
141 { -5 }{ -5 }{ 6pt }{ 5pt } ,
142 { 5 }{ 5 }{ 7pt }{ 5pt } ,
143 { -4 }{ -4 }{ 8pt }{ 6pt } ,
144 { 4 }{ 4 }{ 5 }{ 6 } ,
145 { -3 }{ -3 }{ -4 }{ -5 } ,
146 { 3 }{ 3 }{ 4 }{ 5 } ,
147 { -2 }{ -2 }{ -3 }{ -4 } ,
148 { 2 }{ 2 }{ 3 }{ 4 } ,
149 { -1 }{ -1 }{ -2 }{ -3 } ,
150 { 1 }{ 1 }{ 2 }{ 3 } ,
151 { -0 }{ -0 }{ -1 }{ -2 } ,
152 { 0 }{ 0 }{ 1 }{ 2 }
153 }
154 { \ctex_declare_math_sizes:nnnn #1 }
155 \cs_new_protected:Npn \ctex_set_font_size:Nnn #1#2#3
156 {
157 \prop_get:NnNTF \c__ctex_font_size_prop {#2} \l__ctex_font_size_tl
158 { \exp_after:wN \__ctex_set_font_size:nnNn \l__ctex_font_size_tl #1 {#3} }
159 { \msg_error:nnn { ctex } { fontsize } {#2} }
160 }
161 \cs_new_protected:Npn \__ctex_set_font_size:nnNn #1#2#3#4
162 { \cs_set_protected:Npn #3 { \@setfontsize #3 {#1} {#2} #4 } }
163 \int_case:nn { \g__ctex_font_size_int }
164 {
165 { 0 } { \file_input:n { ctex-c5size.clo } }
166 { 1 } { \file_input:n { ctex-cs4size.clo } }
167 }
168 \normalsize
169 %%
170 %% This package consists of the files ctex.dtx,
171 %% ctxdoc.cls,
172 %% ctxdocstrip.tex,
173 %% ctex-zhconv.lua,
174 %% ctex-zhconv-make.lua,
175 %% and the derived files ctex.pdf,
176 %% ctex.ins,
177 %% ctex.sty,
178 %% ctexsize.sty,
179 %% ctexheading.sty,
180 %% ctexart.cls,
181 %% ctexbook.cls,
182 %% ctexrep.cls,
183 %% ctexbeamer.cls,
184 %% ctexcap.sty,
185 %% ctexhook.sty,
186 %% ctexpatch.sty,
187 %% ctex-c5size.clo,
188 %% ctex-cs4size.clo,
189 %% ctex-heading-article.def,
190 %% ctex-heading-book.def,
191 %% ctex-heading-report.def,
192 %% ctex-heading-beamer.def,
193 %% ctex-scheme-plain.def,
194 %% ctex-scheme-plain-article.def,
195 %% ctex-scheme-plain-book.def,
196 %% ctex-scheme-plain-report.def,
197 %% ctex-scheme-plain-beamer.def,
198 %% ctex-scheme-chinese.def,
199 %% ctex-scheme-chinese-article.def,
200 %% ctex-scheme-chinese-book.def,
201 %% ctex-scheme-chinese-report.def,
202 %% ctex-scheme-chinese-beamer.def,
203 %% ctex-name-gbk.cfg,
204 %% ctex-name-utf8.cfg,
205 %% ctex.cfg,
206 %% ctexopts.cfg,
207 %% ctexbackend.cfg,
208 %% ctex-engine-pdftex.def,
209 %% ctex-engine-xetex.def,
210 %% ctex-engine-luatex.def,
211 %% ctex-engine-aptex.def,
212 %% ctex-engine-uptex.def,
213 %% c19rm.fd,
214 %% c19sf.fd,
215 %% c19tt.fd,
216 %% c70rm.fd,
217 %% c70sf.fd,
218 %% c70tt.fd,
219 %% jy2zhrm.fd,
220 %% jy2zhsf.fd,
221 %% jy2zhtt.fd,
222 %% jt2zhrm.fd,
223 %% jt2zhsf.fd,
224 %% jt2zhtt.fd,
225 %% ctex-fontset-adobe.def,
226 %% ctex-fontset-fandol.def,
227 %% ctex-fontset-founder.def,
228 %% ctex-fontset-mac.def,
229 %% ctex-fontset-macnew.def,
230 %% ctex-fontset-macold.def,
231 %% ctex-fontset-ubuntu.def,
232 %% ctex-fontset-windows.def,
233 %% ctexspa.def,
234 %% ctexpunct.spa,
235 %% ctex-spa-make.tex,
236 %% ctex-spa-macro.tex,
237 %% ctex-zhmap-adobe.tex,
238 %% ctex-zhmap-fandol.tex,
239 %% ctex-zhmap-founder.tex,
240 %% ctex-zhmap-mac.tex,
241 %% ctex-zhmap-ubuntu.tex,
242 %% ctex-zhmap-windows.tex,
243 %% ctex-zhconv-index.lua,
244 %% translator-theorem-dictionary-ChineseGBK.dict,
245 %% translator-theorem-dictionary-ChineseUTF8.dict, and
246 %% README.md.
247 %%
248 %% End of file `ctexsize.sty'.