| 1 |
%%^^A%% um-code-main.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> |
| 2 |
%%^^A%% Definition of `\setmainfont`. |
| 3 |
|
| 4 |
% \section{The main \cs{setmathfont} macro} |
| 5 |
% |
| 6 |
% \begin{macrocode} |
| 7 |
%<*package> |
| 8 |
% \end{macrocode} |
| 9 |
% |
| 10 |
% \begin{macro}{\@@_setmathfont:nn} |
| 11 |
% \darg{keyval options} |
| 12 |
% \darg{font name/file} |
| 13 |
% \begin{macrocode} |
| 14 |
\@@_cs_new:Nn \@@_setmathfont:nn |
| 15 |
{ |
| 16 |
% \end{macrocode} |
| 17 |
% \begin{itemize} |
| 18 |
% \item Initialise all local variables. |
| 19 |
% \item |
| 20 |
% Erase any conception \LaTeX\ has of previously defined math symbol fonts; |
| 21 |
% this allows \cmd\DeclareSymbolFont\ at any point in the document. |
| 22 |
% \item |
| 23 |
% Grab the current size information: |
| 24 |
% (is this robust enough? Maybe it should be preceded by \cmd\normalsize). |
| 25 |
% The macro \cmd\S@\meta{size} |
| 26 |
% contains the definitions of the sizes used for maths letters, subscripts and subsubscripts in |
| 27 |
% \cmd\tf@size, \cmd\sf@size, and \cmd\ssf@size, respectively. |
| 28 |
% \end{itemize} |
| 29 |
% \begin{macrocode} |
| 30 |
|
| 31 |
\@@_init:n {#2} |
| 32 |
\cs_set_eq:NN \glb@currsize \scan_stop: |
| 33 |
\cs_if_exist:cF { S@ \f@size } { \calculate@math@sizes } |
| 34 |
\use:c { S@ \f@size } |
| 35 |
|
| 36 |
\keys_set_known:nnN {unicode-math} {#1} \l_@@_unknown_keys_clist |
| 37 |
|
| 38 |
\bool_if:NT \g_@@_init_bool \@@_fontspec_trial_font: |
| 39 |
\bool_if:NT \g_@@_init_bool \@@_declare_math_sizes: |
| 40 |
|
| 41 |
\@@_fontspec_select_font: |
| 42 |
\@@_setup_math_fam: |
| 43 |
\bool_if:NT \g_@@_init_bool |
| 44 |
{ |
| 45 |
\@@_setup_legacy_fam_two: |
| 46 |
\@@_setup_legacy_fam_three: |
| 47 |
} |
| 48 |
|
| 49 |
\@@_input_math_symbol_table: |
| 50 |
|
| 51 |
% \end{macrocode} |
| 52 |
% \begin{itemize} |
| 53 |
% \item the `once-off' setup that doesn't need to be per-font |
| 54 |
% \item remap symbols that don't take their natural mathcode; |
| 55 |
% \item activate any symbols that need to be math-active; |
| 56 |
% \item assign delimiter codes for symbols that need to grow; |
| 57 |
% \item setup the maths alphabets (\cs{symbf} etc.) --- |
| 58 |
% this is an extensive part of the code; see Section~\ref{sec:mathmap}; |
| 59 |
% \end{itemize} |
| 60 |
% \begin{macrocode} |
| 61 |
\bool_if:NT \g_@@_init_bool \@@_onceoff_setup: |
| 62 |
\@@_remap_symbols: |
| 63 |
\@@_setup_mathactives: |
| 64 |
\@@_setup_delcodes: |
| 65 |
\@@_setup_alphabets: |
| 66 |
|
| 67 |
%% TODO: what of the above should only be run for the "default"/"main" font? |
| 68 |
|
| 69 |
\bool_if:NTF \g_@@_init_bool |
| 70 |
{ |
| 71 |
\bool_gset_true:N \g_@@_main_font_defined_bool |
| 72 |
%<LU> \@@_mathparam_store: |
| 73 |
\@@_log:n {default-math-font} |
| 74 |
} |
| 75 |
{ |
| 76 |
%<LU> \@@_mathparam_restore: |
| 77 |
} |
| 78 |
} |
| 79 |
% \end{macrocode} |
| 80 |
% \end{macro} |
| 81 |
% |
| 82 |
% \paragraph{Fall-back font} |
| 83 |
% |
| 84 |
% Want to load Latin Modern Math if nothing else. |
| 85 |
% This needs to happen early so that all of the font-loading machinery executes before |
| 86 |
% the other `AtBeginDocument' code. |
| 87 |
% \begin{macrocode} |
| 88 |
\AtBeginDocument { \bool_if:NF \g_@@_main_font_defined_bool \@@_load_lm: } |
| 89 |
\@@_cs_new:Nn \@@_load_lm: |
| 90 |
{ |
| 91 |
\setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}] |
| 92 |
} |
| 93 |
% \end{macrocode} |
| 94 |
% |
| 95 |
% \begin{macro}{\@@_init:n} |
| 96 |
% Reset local variables. |
| 97 |
% Default to defining the font for every math symbol character. |
| 98 |
% \begin{macrocode} |
| 99 |
\@@_cs_new:Nn \@@_init:n |
| 100 |
{ |
| 101 |
\tl_set:Nn \l_@@_fontname_tl {#1} |
| 102 |
\bool_gset_true:N \g_@@_ot_math_bool |
| 103 |
\tl_set:Nn \l_@@_mversion_tl {normal} |
| 104 |
\tl_set:Nn \l_@@_symfont_label_tl {operators} |
| 105 |
|
| 106 |
\tl_set:Nn \l_@@_script_features_tl {Style=MathScript} |
| 107 |
\tl_set:Nn \l_@@_sscript_features_tl {Style=MathScriptScript} |
| 108 |
\tl_set_eq:NN \l_@@_script_font_tl \l_@@_fontname_tl |
| 109 |
\tl_set_eq:NN \l_@@_sscript_font_tl \l_@@_fontname_tl |
| 110 |
|
| 111 |
\bool_gset_true:N \g_@@_init_bool |
| 112 |
\seq_gclear:N \g_@@_char_range_seq |
| 113 |
\clist_clear:N \l_@@_mathmap_charints_clist |
| 114 |
\seq_gclear:N \g_@@_mathalph_seq |
| 115 |
\seq_clear:N \l_@@_missing_alph_seq |
| 116 |
|
| 117 |
\cs_set_eq:NN \_@@_sym:nnn \@@_process_symbol_noparse:nnn |
| 118 |
\cs_set_eq:NN \@@_remap_symbol:nnn \@@_remap_symbol_noparse:nnn |
| 119 |
\cs_set_eq:NN \@@_maybe_init_alphabet:n \@@_init_alphabet:n |
| 120 |
\cs_set_eq:NN \@@_assign_delcode:nn \@@_assign_delcode_noparse:nn |
| 121 |
\cs_set_eq:NN \@@_make_mathactive:nNN \@@_make_mathactive_noparse:nNN |
| 122 |
} |
| 123 |
% \end{macrocode} |
| 124 |
% \end{macro} |
| 125 |
% |
| 126 |
% \begin{macro}{\@@_declare_math_sizes:} |
| 127 |
% Set the math sizes according to the recommended font parameters. |
| 128 |
% \begin{macrocode} |
| 129 |
\tl_new:N \g_@@_main_font_cmd_tl |
| 130 |
\cs_new:Nn \@@_sf_size: { \@@_fontdimen_pc_to_pt:nN {10} \g_@@_trial_font } |
| 131 |
\cs_new:Nn \@@_ssf_size: { \@@_fontdimen_pc_to_pt:nN {11} \g_@@_trial_font } |
| 132 |
\@@_cs_new:Nn \@@_declare_math_sizes: |
| 133 |
{ |
| 134 |
\fp_gset:Nn \g_@@_size_tfsf_fp { (\f@size + \@@_sf_size: )/2 } |
| 135 |
\fp_gset:Nn \g_@@_size_sfssf_fp { (\@@_sf_size: + \@@_ssf_size:)/2 } |
| 136 |
|
| 137 |
\dim_compare:nF { \fontdimen 10 \g_@@_trial_font == 0pt } |
| 138 |
{ |
| 139 |
\DeclareMathSizes { \f@size } { \f@size } { \@@_sf_size: } { \@@_ssf_size: } |
| 140 |
} |
| 141 |
} |
| 142 |
% \end{macrocode} |
| 143 |
% \end{macro} |
| 144 |
% |
| 145 |
% |
| 146 |
% |
| 147 |
% \begin{macro}{\@@_fontspec_trial_font:} |
| 148 |
% \begin{macrocode} |
| 149 |
\@@_cs_new:Nn \@@_fontspec_trial_font: |
| 150 |
{ |
| 151 |
\tl_set:Nx \l_@@_font_keyval_tl |
| 152 |
{ |
| 153 |
%<LU> Renderer = Basic, |
| 154 |
BoldItalicFont = {}, ItalicFont = {}, SmallCapsFont = {}, |
| 155 |
Script = Math, |
| 156 |
%<LU> RawFeature = {mathfontdimen=xetex}, |
| 157 |
\l_@@_unknown_keys_clist |
| 158 |
} |
| 159 |
|
| 160 |
\fontspec_set_family:Nxn \l_@@_trial_family_tl {\l_@@_font_keyval_tl} {\l_@@_fontname_tl} |
| 161 |
|
| 162 |
\group_begin: |
| 163 |
\fontfamily { \l_@@_trial_family_tl } \selectfont |
| 164 |
\exp_last_unbraced:NNo \@@_fontface_gset_eq:NN \g_@@_trial_font \font@name |
| 165 |
\fontspec_if_script:nF {math} |
| 166 |
{ |
| 167 |
\@@_warning:n {not-ot-math} |
| 168 |
\bool_gset_false:N \g_@@_ot_math_bool |
| 169 |
\bool_gset_false:N \g_@@_init_bool |
| 170 |
} |
| 171 |
\group_end: |
| 172 |
|
| 173 |
} |
| 174 |
% \end{macrocode} |
| 175 |
% \end{macro} |
| 176 |
% |
| 177 |
% \begin{macro}{\@@_fontspec_select_font:} |
| 178 |
% \begin{macrocode} |
| 179 |
\@@_cs_new:Nn \@@_fontspec_select_font: |
| 180 |
{ |
| 181 |
\tl_set:Nx \l_@@_font_keyval_tl |
| 182 |
{ |
| 183 |
%<LU> Renderer = Basic, |
| 184 |
BoldItalicFont = {}, ItalicFont = {}, SmallCapsFont = {}, |
| 185 |
Script = Math, |
| 186 |
SizeFeatures = |
| 187 |
{ |
| 188 |
{ |
| 189 |
Size = \fp_use:N \g_@@_size_tfsf_fp - |
| 190 |
} , |
| 191 |
{ |
| 192 |
Size = \fp_use:N \g_@@_size_sfssf_fp - \fp_use:N \g_@@_size_tfsf_fp , |
| 193 |
Font = \l_@@_script_font_tl , |
| 194 |
\l_@@_script_features_tl |
| 195 |
} , |
| 196 |
{ |
| 197 |
Size = - \fp_use:N \g_@@_size_sfssf_fp , |
| 198 |
Font = \l_@@_sscript_font_tl , |
| 199 |
\l_@@_sscript_features_tl |
| 200 |
} |
| 201 |
} , |
| 202 |
%<LU> RawFeature = {mathfontdimen=xetex}, |
| 203 |
\l_@@_unknown_keys_clist |
| 204 |
} |
| 205 |
|
| 206 |
\fontspec_set_family:Nxn \l_@@_family_tl {\l_@@_font_keyval_tl} {\l_@@_fontname_tl} |
| 207 |
|
| 208 |
\int_gincr:N \g_@@_fonts_used_int |
| 209 |
\group_begin: |
| 210 |
\fontfamily { \l_@@_family_tl } \selectfont |
| 211 |
\exp_last_unbraced:Nno \@@_fontface_gset_eq:cN {g_@@_mathfont_ \int_use:N \g_@@_fonts_used_int _font} \font@name |
| 212 |
\tl_gset:Nx \g_@@_curr_font_cmd_tl { \exp_not:c {g_@@_mathfont_ \int_use:N \g_@@_fonts_used_int _font} } |
| 213 |
\bool_if:NT \g_@@_init_bool |
| 214 |
{ |
| 215 |
\exp_last_unbraced:NNo \@@_fontface_gset_eq:NN \l_@@_font \font@name |
| 216 |
} |
| 217 |
\group_end: |
| 218 |
} |
| 219 |
% \end{macrocode} |
| 220 |
% \end{macro} |
| 221 |
% |
| 222 |
% \begin{macrocode} |
| 223 |
\tl_gset:Nn \g_@@_main_font_cmd_tl { \l_@@_font } |
| 224 |
\tl_gset:Nn \g_@@_sqrt_font_cmd_tl { \l_@@_font } |
| 225 |
\tl_gset:Nn \g_@@_prime_font_cmd_tl { \l_@@_font } |
| 226 |
% \end{macrocode} |
| 227 |
% |
| 228 |
% \begin{macro}{\@@_setup_math_fam:} |
| 229 |
% \begin{macrocode} |
| 230 |
\@@_cs_new:Nn \@@_setup_math_fam: |
| 231 |
{ |
| 232 |
\cs_if_exist:cF { sym \l_@@_symfont_label_tl } |
| 233 |
{ |
| 234 |
\DeclareSymbolFont{\l_@@_symfont_label_tl} |
| 235 |
{\encodingdefault}{\l_@@_family_tl}{\mddefault}{\shapedefault} |
| 236 |
} |
| 237 |
\SetSymbolFont{\l_@@_symfont_label_tl}{\l_@@_mversion_tl} |
| 238 |
{\encodingdefault}{\l_@@_family_tl}{\mddefault}{\shapedefault} |
| 239 |
% \end{macrocode} |
| 240 |
% Set the bold math version. |
| 241 |
% \begin{macrocode} |
| 242 |
\str_if_eq:eeT {\l_@@_mversion_tl} {normal} |
| 243 |
{ |
| 244 |
\SetSymbolFont{\l_@@_symfont_label_tl}{bold} |
| 245 |
{\encodingdefault}{\l_@@_family_tl}{\bfdefault}{\shapedefault} |
| 246 |
} |
| 247 |
} |
| 248 |
% \end{macrocode} |
| 249 |
% \end{macro} |
| 250 |
% |
| 251 |
% \begin{macro}{\@@_setup_legacy_fam_two:} |
| 252 |
% \TeX\ won't load the same font twice at the same scale, so we need to magnify this one by an imperceptable amount. |
| 253 |
% Note that for extreme font sizes, this scaling value might need to be adjusted. |
| 254 |
% 1.0001 should be enough for reasonable use cases however. |
| 255 |
% \begin{macrocode} |
| 256 |
\@@_cs_new:Nn \@@_setup_legacy_fam_two: |
| 257 |
{ |
| 258 |
\fontspec_set_family:Nxn \l_@@_fam_two_tl |
| 259 |
{ |
| 260 |
\l_@@_font_keyval_tl, |
| 261 |
%<LU> RawFeature = {mathfontdimen=tex2}, |
| 262 |
%<*XE> |
| 263 |
ScaleAgain = 1.0001, |
| 264 |
FontAdjustment = |
| 265 |
{ |
| 266 |
\@@_copy_fontdimen:nnN { 8} {43} \g_@@_main_font_cmd_tl |
| 267 |
\@@_copy_fontdimen:nnN { 9} {42} \g_@@_main_font_cmd_tl |
| 268 |
\@@_copy_fontdimen:nnN {10} {32} \g_@@_main_font_cmd_tl |
| 269 |
\@@_copy_fontdimen:nnN {11} {45} \g_@@_main_font_cmd_tl |
| 270 |
\@@_copy_fontdimen:nnN {12} {44} \g_@@_main_font_cmd_tl |
| 271 |
\@@_copy_fontdimen:nnN {13} {21} \g_@@_main_font_cmd_tl |
| 272 |
\@@_copy_fontdimen:nnN {14} {21} \g_@@_main_font_cmd_tl |
| 273 |
\@@_copy_fontdimen:nnN {15} {22} \g_@@_main_font_cmd_tl |
| 274 |
\@@_copy_fontdimen:nnN {16} {18} \g_@@_main_font_cmd_tl |
| 275 |
\@@_copy_fontdimen:nnN {17} {18} \g_@@_main_font_cmd_tl |
| 276 |
\@@_copy_fontdimen:nnN {18} {24} \g_@@_main_font_cmd_tl |
| 277 |
\@@_copy_fontdimen:nnN {19} {20} \g_@@_main_font_cmd_tl |
| 278 |
\@@_copy_fontdimen:nnN {22} {15} \g_@@_main_font_cmd_tl |
| 279 |
\@@_zero_fontdimen:n {20} % delim1 = FractionDelimiterDisplaySize |
| 280 |
\@@_zero_fontdimen:n {21} % delim2 = FractionDelimiterSize |
| 281 |
} |
| 282 |
%</XE> |
| 283 |
} {\l_@@_fontname_tl} |
| 284 |
|
| 285 |
\SetSymbolFont{symbols}{\l_@@_mversion_tl} |
| 286 |
{\encodingdefault}{\l_@@_fam_two_tl}{\mddefault}{\shapedefault} |
| 287 |
|
| 288 |
\str_if_eq:eeT {\l_@@_mversion_tl} {normal} |
| 289 |
{ |
| 290 |
\SetSymbolFont{symbols}{bold} |
| 291 |
{\encodingdefault}{\l_@@_fam_two_tl}{\bfdefault}{\shapedefault} |
| 292 |
} |
| 293 |
} |
| 294 |
% \end{macrocode} |
| 295 |
% \end{macro} |
| 296 |
% |
| 297 |
% \begin{macro}{\@@_setup_legacy_fam_three:} |
| 298 |
% Similarly, this font is shrunk by an imperceptable amount for \TeX\ to load it again. |
| 299 |
% \begin{macrocode} |
| 300 |
\@@_cs_new:Nn \@@_setup_legacy_fam_three: |
| 301 |
{ |
| 302 |
\fontspec_set_family:Nxn \l_@@_fam_three_tl |
| 303 |
{ |
| 304 |
\l_@@_font_keyval_tl, |
| 305 |
%<LU> RawFeature = {mathfontdimen=tex3}, |
| 306 |
%<*XE> |
| 307 |
ScaleAgain = 0.9999, |
| 308 |
FontAdjustment = { |
| 309 |
\@@_copy_fontdimen:nnN { 8} {48} \g_@@_main_font_cmd_tl |
| 310 |
\@@_copy_fontdimen:nnN { 9} {28} \g_@@_main_font_cmd_tl |
| 311 |
\@@_copy_fontdimen:nnN {10} {30} \g_@@_main_font_cmd_tl |
| 312 |
\@@_copy_fontdimen:nnN {11} {29} \g_@@_main_font_cmd_tl |
| 313 |
\@@_copy_fontdimen:nnN {12} {31} \g_@@_main_font_cmd_tl |
| 314 |
\@@_zero_fontdimen:n {13} |
| 315 |
} |
| 316 |
%</XE> |
| 317 |
} {\l_@@_fontname_tl} |
| 318 |
|
| 319 |
\SetSymbolFont{largesymbols}{\l_@@_mversion_tl} |
| 320 |
{\encodingdefault}{\l_@@_fam_three_tl}{\mddefault}{\shapedefault} |
| 321 |
|
| 322 |
\str_if_eq:eeT {\l_@@_mversion_tl} {normal} |
| 323 |
{ |
| 324 |
\SetSymbolFont{largesymbols}{bold} |
| 325 |
{\encodingdefault}{\l_@@_fam_three_tl}{\bfdefault}{\shapedefault} |
| 326 |
} |
| 327 |
} |
| 328 |
% \end{macrocode} |
| 329 |
% \end{macro} |
| 330 |
% |
| 331 |
% \begin{macro}{\@@_onceoff_setup:} |
| 332 |
% \begin{macrocode} |
| 333 |
\@@_cs_new:Nn \@@_onceoff_setup: |
| 334 |
{ |
| 335 |
\@@_set_delcode:nnn {operators} {`\.} {0} |
| 336 |
} |
| 337 |
% \end{macrocode} |
| 338 |
% \end{macro} |
| 339 |
% |
| 340 |
% \subsection{Functions for setting up symbols with mathcodes} |
| 341 |
% \seclabel{mathsymbol} |
| 342 |
% |
| 343 |
% \begin{macro}{\@@_process_symbol_noparse:nnn} |
| 344 |
% \begin{macro}{\@@_process_symbol_parse:nnn} |
| 345 |
% If the \feat{range} font feature has been used, then only |
| 346 |
% a subset of the Unicode glyphs are to be defined. |
| 347 |
% See \secref{rangeproc} for the code that enables this. |
| 348 |
% \begin{macrocode} |
| 349 |
\cs_set:Nn \@@_process_symbol_noparse:nnn |
| 350 |
{ |
| 351 |
\@@_set_mathsymbol:nNNn {\l_@@_symfont_label_tl} #2 #3 {#1} |
| 352 |
} |
| 353 |
% \end{macrocode} |
| 354 |
% \begin{macrocode} |
| 355 |
\cs_set:Nn \@@_process_symbol_parse:nnn |
| 356 |
{ |
| 357 |
\@@_if_char_spec:nNT {#1} {#3} |
| 358 |
{ |
| 359 |
\@@_process_symbol_noparse:nnn {#1} {#2} {#3} |
| 360 |
} |
| 361 |
} |
| 362 |
% \end{macrocode} |
| 363 |
% \end{macro} |
| 364 |
% \end{macro} |
| 365 |
% |
| 366 |
% \begin{macro}{\@@_remap_symbols:} |
| 367 |
% This function is used to define the mathcodes for those chars which should |
| 368 |
% be mapped to a different glyph than themselves. |
| 369 |
% \begin{macrocode} |
| 370 |
\@@_cs_new:Nn \@@_remap_symbols: |
| 371 |
{ |
| 372 |
\@@_remap_symbol:nnn {`\-} {\mathbin} {"2212} |
| 373 |
\@@_remap_symbol:nnn {`\*} {\mathbin} {"02217}% text asterisk to "centred asterisk" |
| 374 |
\bool_if:NF \g_@@_literal_colon_bool |
| 375 |
{ |
| 376 |
\@@_remap_symbol:nnn {`\:} {\mathrel} {"02236}% colon to ratio (i.e., punct to rel) |
| 377 |
} |
| 378 |
} |
| 379 |
% \end{macrocode} |
| 380 |
% \end{macro} |
| 381 |
% |
| 382 |
% \begin{macro}{\@@_remap_symbol_noparse:nnn} |
| 383 |
% \begin{macro}{\@@_remap_symbol_parse:nnn} |
| 384 |
% Where |\@@_remap_symbol:nnn| is defined to be one of these two, depending |
| 385 |
% on the range setup: |
| 386 |
% \begin{macrocode} |
| 387 |
\cs_new:Nn \@@_remap_symbol_parse:nnn |
| 388 |
{ |
| 389 |
\@@_if_char_spec:nNT {#3} {#2} |
| 390 |
{ \@@_remap_symbol_noparse:nnn {#1} {#2} {#3} } |
| 391 |
} |
| 392 |
\cs_new:Nn \@@_remap_symbol_noparse:nnn |
| 393 |
{ |
| 394 |
\clist_map_inline:nn {#1} |
| 395 |
{ \@@_set_mathcode:nnnn {##1} {#2} {\l_@@_symfont_label_tl} {#3} } |
| 396 |
} |
| 397 |
% \end{macrocode} |
| 398 |
% \end{macro} |
| 399 |
% \end{macro} |
| 400 |
% |
| 401 |
% \subsection{Active math characters} |
| 402 |
% |
| 403 |
% There are more math active chars later in the subscript/superscript section. |
| 404 |
% But they don't need to be able to be typeset directly. |
| 405 |
% |
| 406 |
% \begin{macro}{\@@_setup_mathactives:} |
| 407 |
% TODO: if not an OpenType math font, we should ignore doing anything with primes. |
| 408 |
% This needs a revamped `range` feature, I think. |
| 409 |
% \begin{macrocode} |
| 410 |
\@@_cs_new:Nn \@@_setup_mathactives: |
| 411 |
{ |
| 412 |
\@@_make_mathactive:nNN {"2032} \@@_prime_single_mchar \mathord |
| 413 |
\@@_make_mathactive:nNN {"2033} \@@_prime_double_mchar \mathord |
| 414 |
\@@_make_mathactive:nNN {"2034} \@@_prime_triple_mchar \mathord |
| 415 |
\@@_make_mathactive:nNN {"2057} \@@_prime_quad_mchar \mathord |
| 416 |
\@@_make_mathactive:nNN {"2035} \@@_backprime_single_mchar \mathord |
| 417 |
\@@_make_mathactive:nNN {"2036} \@@_backprime_double_mchar \mathord |
| 418 |
\@@_make_mathactive:nNN {"2037} \@@_backprime_triple_mchar \mathord |
| 419 |
\@@_make_mathactive:nNN {`\'} \mathstraightquote \mathord |
| 420 |
\@@_make_mathactive:nNN {`\`} \mathbacktick \mathord |
| 421 |
} |
| 422 |
% \end{macrocode} |
| 423 |
% \end{macro} |
| 424 |
% |
| 425 |
% \begin{macro}{\@@_make_mathactive:nNN} |
| 426 |
% Makes |#1| a mathactive char, and gives cs |#2| the meaning of mathchar |#1| |
| 427 |
% with class |#3|. |
| 428 |
% You are responsible for giving active |#1| a particular meaning! |
| 429 |
% \begin{macrocode} |
| 430 |
\cs_new:Nn \@@_make_mathactive_parse:nNN |
| 431 |
{ |
| 432 |
\@@_if_char_spec:nNT {#1} #3 |
| 433 |
{ \@@_make_mathactive_noparse:nNN {#1} #2 #3 } |
| 434 |
} |
| 435 |
% \end{macrocode} |
| 436 |
% |
| 437 |
% \begin{macrocode} |
| 438 |
\cs_new:Nn \@@_make_mathactive_noparse:nNN |
| 439 |
{ |
| 440 |
\@@_set_mathchar:NNnn #2 #3 {\l_@@_symfont_label_tl} {#1} |
| 441 |
\@@_char_gmake_mathactive:n {#1} |
| 442 |
} |
| 443 |
% \end{macrocode} |
| 444 |
% \end{macro} |
| 445 |
% |
| 446 |
% |
| 447 |
% \subsection{Delimiter codes} |
| 448 |
% |
| 449 |
% \begin{macro}{\@@_assign_delcode:nn} |
| 450 |
% \begin{macrocode} |
| 451 |
\cs_new:Nn \@@_assign_delcode_noparse:nn |
| 452 |
{ |
| 453 |
\@@_set_delcode:nnn \l_@@_symfont_label_tl {#1} {#2} |
| 454 |
} |
| 455 |
% \end{macrocode} |
| 456 |
% |
| 457 |
% \begin{macrocode} |
| 458 |
\cs_new:Nn \@@_assign_delcode_parse:nn |
| 459 |
{ |
| 460 |
\@@_if_char_spec:nNT {#2} \@nil |
| 461 |
{ |
| 462 |
\@@_assign_delcode_noparse:nn {#1} {#2} |
| 463 |
} |
| 464 |
} |
| 465 |
% \end{macrocode} |
| 466 |
% \end{macro} |
| 467 |
% |
| 468 |
% \begin{macro}{\@@_assign_delcode:n} |
| 469 |
% Shorthand. |
| 470 |
% \begin{macrocode} |
| 471 |
\cs_new:Nn \@@_assign_delcode:n { \@@_assign_delcode:nn {#1} {#1} } |
| 472 |
% \end{macrocode} |
| 473 |
% \end{macro} |
| 474 |
% |
| 475 |
% \begin{macro}{\@@_setup_delcodes:} |
| 476 |
% Some symbols that aren't mathopen/mathclose still need to have delimiter codes assigned. |
| 477 |
% The list of vertical arrows may be incomplete. |
| 478 |
% On the other hand, many fonts won't support them all being stretchy. |
| 479 |
% And some of them are probably not meant to stretch, either. But adding them here doesn't hurt. |
| 480 |
% \begin{macrocode} |
| 481 |
\@@_cs_new:Nn \@@_setup_delcodes: |
| 482 |
{ |
| 483 |
\@@_assign_delcode:nn {`\/} {\g_@@_slash_delimiter_usv} |
| 484 |
\@@_assign_delcode:nn {"2044} {\g_@@_slash_delimiter_usv} % fracslash |
| 485 |
\@@_assign_delcode:nn {"2215} {\g_@@_slash_delimiter_usv} % divslash |
| 486 |
\@@_assign_delcode:n {"005C} % backslash |
| 487 |
\@@_assign_delcode:nn {`\<} {"27E8} % angle brackets with ascii notation |
| 488 |
\@@_assign_delcode:nn {`\>} {"27E9} % angle brackets with ascii notation |
| 489 |
\@@_assign_delcode:n {"2191} % up arrow |
| 490 |
\@@_assign_delcode:n {"2193} % down arrow |
| 491 |
\@@_assign_delcode:n {"2195} % updown arrow |
| 492 |
\@@_assign_delcode:n {"219F} % up arrow twohead |
| 493 |
\@@_assign_delcode:n {"21A1} % down arrow twohead |
| 494 |
\@@_assign_delcode:n {"21A5} % up arrow from bar |
| 495 |
\@@_assign_delcode:n {"21A7} % down arrow from bar |
| 496 |
\@@_assign_delcode:n {"21A8} % updown arrow from bar |
| 497 |
\@@_assign_delcode:n {"21BE} % up harpoon right |
| 498 |
\@@_assign_delcode:n {"21BF} % up harpoon left |
| 499 |
\@@_assign_delcode:n {"21C2} % down harpoon right |
| 500 |
\@@_assign_delcode:n {"21C3} % down harpoon left |
| 501 |
\@@_assign_delcode:n {"21C5} % arrows up down |
| 502 |
\@@_assign_delcode:n {"21F5} % arrows down up |
| 503 |
\@@_assign_delcode:n {"21C8} % arrows up up |
| 504 |
\@@_assign_delcode:n {"21CA} % arrows down down |
| 505 |
\@@_assign_delcode:n {"21D1} % double up arrow |
| 506 |
\@@_assign_delcode:n {"21D3} % double down arrow |
| 507 |
\@@_assign_delcode:n {"21D5} % double updown arrow |
| 508 |
\@@_assign_delcode:n {"21DE} % up arrow double stroke |
| 509 |
\@@_assign_delcode:n {"21DF} % down arrow double stroke |
| 510 |
\@@_assign_delcode:n {"21E1} % up arrow dashed |
| 511 |
\@@_assign_delcode:n {"21E3} % down arrow dashed |
| 512 |
\@@_assign_delcode:n {"21E7} % up white arrow |
| 513 |
\@@_assign_delcode:n {"21E9} % down white arrow |
| 514 |
\@@_assign_delcode:n {"21EA} % up white arrow from bar |
| 515 |
\@@_assign_delcode:n {"21F3} % updown white arrow |
| 516 |
} |
| 517 |
% \end{macrocode} |
| 518 |
% \end{macro} |
| 519 |
% |
| 520 |
% \subsection{(Big) operators} |
| 521 |
% |
| 522 |
% The engine does what is necessary to deal with big operators for us |
| 523 |
% automatically with \cmd\Umathchardef. |
| 524 |
% However, the limits aren't set automatically; that is, we want to define, |
| 525 |
% a la Plain \TeX\ \etc, |\def\int{\intop\nolimits}|, so there needs to be a |
| 526 |
% transformation from \cmd\int\ to \cmd\intop\ during the expansion of |
| 527 |
% \cmd\_@@_sym:nnn\ in the appropriate contexts. |
| 528 |
% |
| 529 |
% \begin{macro}{\l_@@_nolimits_tl} |
| 530 |
% This macro is a sequence containing those maths operators that require a |
| 531 |
% \cmd\nolimits\ suffix. |
| 532 |
% This list is used when processing |unicode-math-table.tex| to define such |
| 533 |
% commands automatically (see the macro \cs{@@_set_mathsymbol:nNNn}). |
| 534 |
% I've chosen essentially just the operators that look like integrals; |
| 535 |
% hopefully a better mathematician can help me out here. |
| 536 |
% I've a feeling that it's more useful \emph{not} to include the multiple |
| 537 |
% integrals such as $\iiiint$, but that might be a matter of preference. |
| 538 |
% \begin{macrocode} |
| 539 |
\tl_set:Nn \l_@@_nolimits_tl |
| 540 |
{ |
| 541 |
\int\iint\iiint\iiiint\oint\oiint\oiiint |
| 542 |
\intclockwise\varointclockwise\ointctrclockwise\sumint |
| 543 |
\intbar\intBar\fint\cirfnint\awint\rppolint |
| 544 |
\scpolint\npolint\pointint\sqint\intlarhk\intx |
| 545 |
\intcap\intcup\upint\lowint |
| 546 |
} |
| 547 |
% \end{macrocode} |
| 548 |
% \end{macro} |
| 549 |
% |
| 550 |
% \subsection{Radicals} |
| 551 |
% |
| 552 |
% \begin{macro}{\l_@@_radicals_tl} |
| 553 |
% The radicals are organised in \cs{@@_set_mathsymbol:nNNn}. |
| 554 |
% We organise radicals in the same way as nolimits-operators. |
| 555 |
% (\cs{cuberoot} and \cs{fourthroot}, don't seem to behave as proper radicals.) |
| 556 |
% \begin{macrocode} |
| 557 |
\tl_set:Nn \l_@@_radicals_tl {\sqrt \longdivision \cuberoot \fourthroot} |
| 558 |
% \end{macrocode} |
| 559 |
% \end{macro} |
| 560 |
% |
| 561 |
% \subsection{Fontdimens} |
| 562 |
% |
| 563 |
% \begin{macrocode} |
| 564 |
%<*LU> |
| 565 |
% \end{macrocode} |
| 566 |
% |
| 567 |
% \begin{macro}{\@@_mathparam_restore:} |
| 568 |
% \cs{glb@settings} might not be necessary but is included for symmetry. |
| 569 |
% If the maths font were to be loaded later it would clobber our mathparam settings, so |
| 570 |
% this seems like a sensible move. |
| 571 |
% \begin{macrocode} |
| 572 |
\@@_cs_new:Nn \@@_mathparam_restore: |
| 573 |
{ |
| 574 |
\glb@settings |
| 575 |
\tl_use:N \g_@@_mathparam_settings_tl |
| 576 |
} |
| 577 |
% \end{macrocode} |
| 578 |
% \end{macro} |
| 579 |
% |
| 580 |
% \begin{macro}{\@@_mathparam_store:} |
| 581 |
% \cs{glb@settings} is called to force maths fonts loading \emph{now} so the mathparams |
| 582 |
% are up-to-date. |
| 583 |
% \begin{macrocode} |
| 584 |
\@@_cs_new:Nn \@@_mathparam_store: |
| 585 |
{ |
| 586 |
\glb@settings |
| 587 |
\tl_gset:Nx \g_@@_mathparam_settings_tl |
| 588 |
{ |
| 589 |
\@@_mathparam_store_aux:N \displaystyle |
| 590 |
\@@_mathparam_store_aux:N \textstyle |
| 591 |
\@@_mathparam_store_aux:N \scriptstyle |
| 592 |
\@@_mathparam_store_aux:N \scriptscriptstyle |
| 593 |
} |
| 594 |
} |
| 595 |
% \end{macrocode} |
| 596 |
% |
| 597 |
% \begin{macrocode} |
| 598 |
\cs_set:Nn \@@_mathparam_store_aux:N |
| 599 |
{ |
| 600 |
\Umathquad #1 = \the \Umathquad #1 \scan_stop: |
| 601 |
\Umathaxis #1 = \the \Umathaxis #1 \scan_stop: |
| 602 |
\Umathoperatorsize #1 = \the \Umathoperatorsize #1 \scan_stop: |
| 603 |
\Umathoverbarkern #1 = \the \Umathoverbarkern #1 \scan_stop: |
| 604 |
\Umathoverbarrule #1 = \the \Umathoverbarrule #1 \scan_stop: |
| 605 |
\Umathoverbarvgap #1 = \the \Umathoverbarvgap #1 \scan_stop: |
| 606 |
\Umathunderbarkern #1 = \the \Umathunderbarkern #1 \scan_stop: |
| 607 |
\Umathunderbarrule #1 = \the \Umathunderbarrule #1 \scan_stop: |
| 608 |
\Umathunderbarvgap #1 = \the \Umathunderbarvgap #1 \scan_stop: |
| 609 |
\Umathradicalkern #1 = \the \Umathradicalkern #1 \scan_stop: |
| 610 |
\Umathradicalrule #1 = \the \Umathradicalrule #1 \scan_stop: |
| 611 |
\Umathradicalvgap #1 = \the \Umathradicalvgap #1 \scan_stop: |
| 612 |
\Umathradicaldegreebefore #1 = \the \Umathradicaldegreebefore #1 \scan_stop: |
| 613 |
\Umathradicaldegreeafter #1 = \the \Umathradicaldegreeafter #1 \scan_stop: |
| 614 |
\Umathradicaldegreeraise #1 = \the \Umathradicaldegreeraise #1 \scan_stop: |
| 615 |
\Umathstackvgap #1 = \the \Umathstackvgap #1 \scan_stop: |
| 616 |
\Umathstacknumup #1 = \the \Umathstacknumup #1 \scan_stop: |
| 617 |
\Umathstackdenomdown #1 = \the \Umathstackdenomdown #1 \scan_stop: |
| 618 |
\Umathfractionrule #1 = \the \Umathfractionrule #1 \scan_stop: |
| 619 |
\Umathfractionnumvgap #1 = \the \Umathfractionnumvgap #1 \scan_stop: |
| 620 |
\Umathfractionnumup #1 = \the \Umathfractionnumup #1 \scan_stop: |
| 621 |
\Umathfractiondenomvgap #1 = \the \Umathfractiondenomvgap #1 \scan_stop: |
| 622 |
\Umathfractiondenomdown #1 = \the \Umathfractiondenomdown #1 \scan_stop: |
| 623 |
\Umathfractiondelsize #1 = \the \Umathfractiondelsize #1 \scan_stop: |
| 624 |
\Umathlimitabovevgap #1 = \the \Umathlimitabovevgap #1 \scan_stop: |
| 625 |
\Umathlimitabovebgap #1 = \the \Umathlimitabovebgap #1 \scan_stop: |
| 626 |
\Umathlimitabovekern #1 = \the \Umathlimitabovekern #1 \scan_stop: |
| 627 |
\Umathlimitbelowvgap #1 = \the \Umathlimitbelowvgap #1 \scan_stop: |
| 628 |
\Umathlimitbelowbgap #1 = \the \Umathlimitbelowbgap #1 \scan_stop: |
| 629 |
\Umathlimitbelowkern #1 = \the \Umathlimitbelowkern #1 \scan_stop: |
| 630 |
\Umathoverdelimitervgap #1 = \the \Umathoverdelimitervgap #1 \scan_stop: |
| 631 |
\Umathoverdelimiterbgap #1 = \the \Umathoverdelimiterbgap #1 \scan_stop: |
| 632 |
\Umathunderdelimitervgap #1 = \the \Umathunderdelimitervgap #1 \scan_stop: |
| 633 |
\Umathunderdelimiterbgap #1 = \the \Umathunderdelimiterbgap #1 \scan_stop: |
| 634 |
\Umathsubshiftdrop #1 = \the \Umathsubshiftdrop #1 \scan_stop: |
| 635 |
\Umathsubshiftdown #1 = \the \Umathsubshiftdown #1 \scan_stop: |
| 636 |
\Umathsupshiftdrop #1 = \the \Umathsupshiftdrop #1 \scan_stop: |
| 637 |
\Umathsupshiftup #1 = \the \Umathsupshiftup #1 \scan_stop: |
| 638 |
\Umathsubsupshiftdown #1 = \the \Umathsubsupshiftdown #1 \scan_stop: |
| 639 |
\Umathsubtopmax #1 = \the \Umathsubtopmax #1 \scan_stop: |
| 640 |
\Umathsupbottommin #1 = \the \Umathsupbottommin #1 \scan_stop: |
| 641 |
\Umathsupsubbottommax #1 = \the \Umathsupsubbottommax #1 \scan_stop: |
| 642 |
\Umathsubsupvgap #1 = \the \Umathsubsupvgap #1 \scan_stop: |
| 643 |
\Umathspaceafterscript #1 = \the \Umathspaceafterscript #1 \scan_stop: |
| 644 |
\Umathconnectoroverlapmin #1 = \the \Umathconnectoroverlapmin #1 \scan_stop: |
| 645 |
} |
| 646 |
% \end{macrocode} |
| 647 |
% \end{macro} |
| 648 |
% |
| 649 |
% \begin{macrocode} |
| 650 |
%</LU> |
| 651 |
% \end{macrocode} |
| 652 |
% |
| 653 |
% \begin{macrocode} |
| 654 |
%</package> |
| 655 |
% \end{macrocode} |
| 656 |
|
| 657 |
\endinput |
| 658 |
|
| 659 |
% /© |
| 660 |
% |
| 661 |
% ------------------------------------------------ |
| 662 |
% The UNICODE-MATH package <wspr.io/unicode-math> |
| 663 |
% ------------------------------------------------ |
| 664 |
% This package is free software and may be redistributed and/or modified under |
| 665 |
% the conditions of the LaTeX Project Public License, version 1.3c or higher |
| 666 |
% (your choice): <http://www.latex-project.org/lppl/>. |
| 667 |
% ------------------------------------------------ |
| 668 |
% Copyright 2006-2019 Will Robertson, LPPL "maintainer" |
| 669 |
% Copyright 2010-2017 Philipp Stephani |
| 670 |
% Copyright 2011-2017 Joseph Wright |
| 671 |
% Copyright 2012-2015 Khaled Hosny |
| 672 |
% ------------------------------------------------ |
| 673 |
% |
| 674 |
% ©/ |