Debian Codegraph @

texmf-dist/source/latex/unicode-math/um-code-pkgopt.dtx

raw
1 %%^^A%% um-code-pkgopt.dtx -- part of UNICODE-MATH <wspr.io/unicode-math>
2 %%^^A%% Package options.
3
4 % \section{setup and package options}
5 %
6 % \begin{macrocode}
7 %<*package>
8 % \end{macrocode}
9 %
10 % \begin{macro}{\@@_keys_choices:nn}
11 % To simplify the creation of option keys, let's iterate in pairs rather than worry about equals signs and commas.
12 % \begin{macrocode}
13 \cs_new:Nn \@@_keys_choices:nn
14 {
15 \cs_set:Npn \@@_keys_choices_fn:nn { \@@_keys_choices_aux:nnn {#1} }
16 \use:x
17 {
18 \exp_not:N \keys_define:nn {unicode-math}
19 {
20 #1 .choice: ,
21 \@@_tl_map_dbl:nN {#2} \@@_keys_choices_fn:nn
22 }
23 }
24 }
25 % \end{macrocode}
26 % \begin{macrocode}
27 \cs_new:Nn \@@_keys_choices_aux:nnn { #1 / #2 .code:n = { \exp_not:n {#3} } , }
28 % \end{macrocode}
29 %
30 % \begin{macrocode}
31 \cs_new:Nn \@@_tl_map_dbl:nN
32 {
33 \__@@_tl_map_dbl:Nnn #2 #1 \q_recursion_tail {}{} \q_recursion_stop
34 }
35 % \end{macrocode}
36 %
37 % \begin{macrocode}
38 \cs_new:Nn \__@@_tl_map_dbl:Nnn
39 {
40 \quark_if_recursion_tail_stop:n {#2}
41 \quark_if_recursion_tail_stop:n {#3}
42 #1 {#2} {#3}
43 \__@@_tl_map_dbl:Nnn #1
44 }
45 % \end{macrocode}
46 % \end{macro}
47 %
48 % \paragraph{Compatibility}
49 % \begin{macrocode}
50 \@@_keys_choices:nn {mathup}
51 {
52 {sym} { \bool_gset_false:N \g_@@_mathrm_text_bool }
53 {text} { \bool_gset_true:N \g_@@_mathrm_text_bool }
54 }
55 % \end{macrocode}
56 % \begin{macrocode}
57 \@@_keys_choices:nn {mathrm}
58 {
59 {sym} { \bool_gset_false:N \g_@@_mathrm_text_bool }
60 {text} { \bool_gset_true:N \g_@@_mathrm_text_bool }
61 }
62 % \end{macrocode}
63 % \begin{macrocode}
64 \@@_keys_choices:nn {mathit}
65 {
66 {sym} { \bool_gset_false:N \g_@@_mathit_text_bool }
67 {text} { \bool_gset_true:N \g_@@_mathit_text_bool }
68 }
69 % \end{macrocode}
70 % \begin{macrocode}
71 \@@_keys_choices:nn {mathbf}
72 {
73 {sym} { \bool_gset_false:N \g_@@_mathbf_text_bool }
74 {text} { \bool_gset_true:N \g_@@_mathbf_text_bool }
75 }
76 % \end{macrocode}
77 % \begin{macrocode}
78 \@@_keys_choices:nn {mathsf}
79 {
80 {sym} { \bool_gset_false:N \g_@@_mathsf_text_bool }
81 {text} { \bool_gset_true:N \g_@@_mathsf_text_bool }
82 }
83 % \end{macrocode}
84 % \begin{macrocode}
85 \@@_keys_choices:nn {mathtt}
86 {
87 {sym} { \bool_gset_false:N \g_@@_mathtt_text_bool }
88 {text} { \bool_gset_true:N \g_@@_mathtt_text_bool }
89 }
90 % \end{macrocode}
91 %
92 % \paragraph{math-style}
93 % \begin{macrocode}
94 \@@_keys_choices:nn {normal-style}
95 {
96 {ISO} {
97 \bool_gset_false:N \g_@@_literal_bool
98 \bool_gset_false:N \g_@@_upGreek_bool
99 \bool_gset_false:N \g_@@_upgreek_bool
100 \bool_gset_false:N \g_@@_upLatin_bool
101 \bool_gset_false:N \g_@@_uplatin_bool
102 }
103 {TeX} {
104 \bool_gset_false:N \g_@@_literal_bool
105 \bool_gset_true:N \g_@@_upGreek_bool
106 \bool_gset_false:N \g_@@_upgreek_bool
107 \bool_gset_false:N \g_@@_upLatin_bool
108 \bool_gset_false:N \g_@@_uplatin_bool
109 }
110 {french} {
111 \bool_gset_false:N \g_@@_literal_bool
112 \bool_gset_true:N \g_@@_upGreek_bool
113 \bool_gset_true:N \g_@@_upgreek_bool
114 \bool_gset_true:N \g_@@_upLatin_bool
115 \bool_gset_false:N \g_@@_uplatin_bool
116 }
117 {upright} {
118 \bool_gset_false:N \g_@@_literal_bool
119 \bool_gset_true:N \g_@@_upGreek_bool
120 \bool_gset_true:N \g_@@_upgreek_bool
121 \bool_gset_true:N \g_@@_upLatin_bool
122 \bool_gset_true:N \g_@@_uplatin_bool
123 }
124 {literal} {
125 \bool_gset_true:N \g_@@_literal_bool
126 }
127 }
128 % \end{macrocode}
129 %
130 % \begin{macrocode}
131 \@@_keys_choices:nn {math-style}
132 {
133 {ISO} {
134 \unimathsetup { nabla=upright, partial=italic,
135 normal-style=ISO, bold-style=ISO, sans-style=italic }
136 }
137 {TeX} {
138 \unimathsetup { nabla=upright, partial=italic,
139 normal-style=TeX, bold-style=TeX, sans-style=upright }
140 }
141 {french} {
142 \unimathsetup { nabla=upright, partial=upright,
143 normal-style=french, bold-style=upright, sans-style=upright }
144 }
145 {upright} {
146 \unimathsetup { nabla=upright, partial=upright,
147 normal-style=upright, bold-style=upright, sans-style=upright }
148 }
149 {literal} {
150 \unimathsetup { colon=literal, nabla=literal, partial=literal,
151 normal-style=literal, bold-style=literal, sans-style=literal }
152 }
153 }
154 % \end{macrocode}
155 %
156 % \paragraph{bold-style}
157 % \begin{macrocode}
158 \@@_keys_choices:nn {bold-style}
159 {
160 {ISO} {
161 \bool_gset_false:N \g_@@_bfliteral_bool
162 \bool_gset_false:N \g_@@_bfupGreek_bool
163 \bool_gset_false:N \g_@@_bfupgreek_bool
164 \bool_gset_false:N \g_@@_bfupLatin_bool
165 \bool_gset_false:N \g_@@_bfuplatin_bool
166 }
167 {TeX} {
168 \bool_gset_false:N \g_@@_bfliteral_bool
169 \bool_gset_true:N \g_@@_bfupGreek_bool
170 \bool_gset_false:N \g_@@_bfupgreek_bool
171 \bool_gset_true:N \g_@@_bfupLatin_bool
172 \bool_gset_true:N \g_@@_bfuplatin_bool
173 }
174 {upright} {
175 \bool_gset_false:N \g_@@_bfliteral_bool
176 \bool_gset_true:N \g_@@_bfupGreek_bool
177 \bool_gset_true:N \g_@@_bfupgreek_bool
178 \bool_gset_true:N \g_@@_bfupLatin_bool
179 \bool_gset_true:N \g_@@_bfuplatin_bool
180 }
181 {literal} {
182 \bool_gset_true:N \g_@@_bfliteral_bool
183 }
184 }
185 % \end{macrocode}
186 %
187 % \paragraph{sans-style}
188 % \begin{macrocode}
189 \@@_keys_choices:nn {sans-style}
190 {
191 {italic} { \bool_gset_false:N \g_@@_upsans_bool }
192 {upright} { \bool_gset_true:N \g_@@_upsans_bool }
193 {literal} { \bool_gset_true:N \g_@@_sfliteral_bool }
194 }
195 % \end{macrocode}
196 %
197 %
198 % \paragraph{Nabla and partial}
199 % \begin{macrocode}
200 \@@_keys_choices:nn {nabla}
201 {
202 {upright} {
203 \bool_gset_false:N \g_@@_literal_Nabla_bool
204 \bool_gset_true:N \g_@@_upNabla_bool
205 }
206 {italic} {
207 \bool_gset_false:N \g_@@_literal_Nabla_bool
208 \bool_gset_false:N \g_@@_upNabla_bool
209 }
210 {literal} {
211 \bool_gset_true:N \g_@@_literal_Nabla_bool
212 }
213 }
214 % \end{macrocode}
215 %
216 % \begin{macrocode}
217 \@@_keys_choices:nn {partial}
218 {
219 {upright} {
220 \bool_gset_false:N \g_@@_literal_partial_bool
221 \bool_gset_true:N \g_@@_uppartial_bool
222 }
223 {italic} {
224 \bool_gset_false:N \g_@@_literal_partial_bool
225 \bool_gset_false:N \g_@@_uppartial_bool
226 }
227 {literal} {
228 \bool_gset_true:N \g_@@_literal_partial_bool
229 }
230 }
231 % \end{macrocode}
232 %
233 % \paragraph{Colon style}
234 % \begin{macrocode}
235 \@@_keys_choices:nn {colon}
236 {
237 {literal} { \bool_gset_true:N \g_@@_literal_colon_bool }
238 {TeX} { \bool_gset_false:N \g_@@_literal_colon_bool }
239 }
240 % \end{macrocode}
241 %
242 % \paragraph{Slash delimiter style}
243 % \begin{macrocode}
244 \@@_keys_choices:nn {slash-delimiter}
245 {
246 {ascii} { \tl_gset:Nn \g_@@_slash_delimiter_usv {"002F} }
247 {frac} { \tl_gset:Nn \g_@@_slash_delimiter_usv {"2044} }
248 {div} { \tl_gset:Nn \g_@@_slash_delimiter_usv {"2215} }
249 }
250 % \end{macrocode}
251 %
252 % \paragraph{Active fraction style}
253 % \begin{macrocode}
254 \@@_keys_choices:nn {active-frac}
255 {
256 {small}
257 {
258 \bool_set_true:N \l_@@_smallfrac_bool
259 \use:c {@@_setup_active_frac:}
260 }
261
262 {normalsize}
263 {
264 \bool_set_false:N \l_@@_smallfrac_bool
265 \use:c {@@_setup_active_frac:}
266 }
267 }
268 % \end{macrocode}
269 %
270 % \paragraph{Debug/tracing}
271 %
272 % \begin{macrocode}
273 \keys_define:nn {unicode-math}
274 {
275 warnings-off .code:n =
276 {
277 \clist_map_inline:nn {#1}
278 { \msg_redirect_name:nnn { unicode-math } { ##1 } { none } }
279 }
280 }
281 % \end{macrocode}
282 %
283 % \begin{macrocode}
284 \@@_keys_choices:nn {trace}
285 {
286 {on} {} % default
287 {debug} { \msg_redirect_module:nnn { unicode-math } { log } { warning } }
288 {off} { \msg_redirect_module:nnn { unicode-math } { log } { none } }
289 }
290 % \end{macrocode}
291 %
292 % \subsection{Defaults}
293 %
294 % \begin{macrocode}
295 \unimathsetup {math-style=TeX}
296 \unimathsetup {slash-delimiter=ascii}
297 \unimathsetup {trace=off}
298 \unimathsetup {mathrm=text,mathit=text,mathbf=text,mathsf=text,mathtt=text}
299 \cs_if_exist:NT \tfrac { \unimathsetup {active-frac=small} }
300 \ProcessKeysOptions {unicode-math}
301 % \end{macrocode}
302 %
303 % \begin{macrocode}
304 %</package>
305 % \end{macrocode}
306
307 \endinput
308
309 % /©
310 %
311 % ------------------------------------------------
312 % The UNICODE-MATH package <wspr.io/unicode-math>
313 % ------------------------------------------------
314 % This package is free software and may be redistributed and/or modified under
315 % the conditions of the LaTeX Project Public License, version 1.3c or higher
316 % (your choice): <http://www.latex-project.org/lppl/>.
317 % ------------------------------------------------
318 % Copyright 2006-2019 Will Robertson, LPPL "maintainer"
319 % Copyright 2010-2017 Philipp Stephani
320 % Copyright 2011-2017 Joseph Wright
321 % Copyright 2012-2015 Khaled Hosny
322 % ------------------------------------------------
323 %
324 % ©/