diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/unicode-math/unicode-math-pkgopt.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/unicode-math/unicode-math-pkgopt.dtx | 301 |
1 files changed, 301 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/unicode-math/unicode-math-pkgopt.dtx b/Master/texmf-dist/source/latex/unicode-math/unicode-math-pkgopt.dtx new file mode 100644 index 00000000000..9af437d79e5 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math-pkgopt.dtx @@ -0,0 +1,301 @@ + +% \section{\DTXCURR --- setup and package options} +% +% \begin{macrocode} +%<*package&(XE|LU)> +% \end{macrocode} +% +% \begin{macro}{\unimathsetup} +% This macro can be used in lieu of or later to override +% options declared when the package is loaded. +% \begin{macrocode} +\DeclareDocumentCommand \unimathsetup {m} { \keys_set:nn {unicode-math} {#1} } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_keys_choices:nn} +% To simplify the creation of option keys, let's iterate in pairs rather than worry about equals signs and commas. +% \begin{macrocode} +\cs_new:Nn \@@_keys_choices:nn + { + \cs_set:Npn \@@_keys_choices_fn:nn { \@@_keys_choices_aux:nnn {#1} } + \use:x + { + \exp_not:N \keys_define:nn {unicode-math} + { + #1 .choice: , + \@@_tl_map_dbl:nN {#2} \@@_keys_choices_fn:nn + } + } + } +\cs_new:Nn \@@_keys_choices_aux:nnn { #1 / #2 .code:n = { \exp_not:n {#3} } , } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Nn \@@_tl_map_dbl:nN + { + \__@@_tl_map_dbl:Nnn #2 #1 \q_recursion_tail {}{} \q_recursion_stop + } +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Nn \__@@_tl_map_dbl:Nnn + { + \quark_if_recursion_tail_stop:n {#2} + \quark_if_recursion_tail_stop:n {#3} + #1 {#2} {#3} + \__@@_tl_map_dbl:Nnn #1 + } +% \end{macrocode} +% \end{macro} +% +% \paragraph{Compatibility} +% \begin{macrocode} +\@@_keys_choices:nn {mathup} + { + {sym} { \bool_set_false:N \g_@@_mathrm_text_bool } + {text} { \bool_set_true:N \g_@@_mathrm_text_bool } + } +\@@_keys_choices:nn {mathrm} + { + {sym} { \bool_set_false:N \g_@@_mathrm_text_bool } + {text} { \bool_set_true:N \g_@@_mathrm_text_bool } + } +\@@_keys_choices:nn {mathit} + { + {sym} { \bool_set_false:N \g_@@_mathit_text_bool } + {text} { \bool_set_true:N \g_@@_mathit_text_bool } + } +\@@_keys_choices:nn {mathbf} + { + {sym} { \bool_set_false:N \g_@@_mathbf_text_bool } + {text} { \bool_set_true:N \g_@@_mathbf_text_bool } + } +\@@_keys_choices:nn {mathsf} + { + {sym} { \bool_set_false:N \g_@@_mathsf_text_bool } + {text} { \bool_set_true:N \g_@@_mathsf_text_bool } + } +\@@_keys_choices:nn {mathtt} + { + {sym} { \bool_set_false:N \g_@@_mathtt_text_bool } + {text} { \bool_set_true:N \g_@@_mathtt_text_bool } + } +% \end{macrocode} +% +% \paragraph{math-style} +% \begin{macrocode} +\@@_keys_choices:nn {normal-style} + { + {ISO} { + \bool_set_false:N \g_@@_literal_bool + \bool_set_false:N \g_@@_upGreek_bool + \bool_set_false:N \g_@@_upgreek_bool + \bool_set_false:N \g_@@_upLatin_bool + \bool_set_false:N \g_@@_uplatin_bool + } + {TeX} { + \bool_set_false:N \g_@@_literal_bool + \bool_set_true:N \g_@@_upGreek_bool + \bool_set_false:N \g_@@_upgreek_bool + \bool_set_false:N \g_@@_upLatin_bool + \bool_set_false:N \g_@@_uplatin_bool + } + {french} { + \bool_set_false:N \g_@@_literal_bool + \bool_set_true:N \g_@@_upGreek_bool + \bool_set_true:N \g_@@_upgreek_bool + \bool_set_true:N \g_@@_upLatin_bool + \bool_set_false:N \g_@@_uplatin_bool + } + {upright} { + \bool_set_false:N \g_@@_literal_bool + \bool_set_true:N \g_@@_upGreek_bool + \bool_set_true:N \g_@@_upgreek_bool + \bool_set_true:N \g_@@_upLatin_bool + \bool_set_true:N \g_@@_uplatin_bool + } + {literal} { + \bool_set_true:N \g_@@_literal_bool + } + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_keys_choices:nn {math-style} + { + {ISO} { + \unimathsetup { nabla=upright, partial=italic, + normal-style=ISO, bold-style=ISO, sans-style=italic } + } + {TeX} { + \unimathsetup { nabla=upright, partial=italic, + normal-style=TeX, bold-style=TeX, sans-style=upright } + } + {french} { + \unimathsetup { nabla=upright, partial=upright, + normal-style=french, bold-style=upright, sans-style=upright } + } + {upright} { + \unimathsetup { nabla=upright, partial=upright, + normal-style=upright, bold-style=upright, sans-style=upright } + } + {literal} { + \unimathsetup { colon=literal, nabla=literal, partial=literal, + normal-style=literal, bold-style=literal, sans-style=literal } + } + } +% \end{macrocode} +% +% \paragraph{bold-style} +% \begin{macrocode} +\@@_keys_choices:nn {bold-style} + { + {ISO} { + \bool_set_false:N \g_@@_bfliteral_bool + \bool_set_false:N \g_@@_bfupGreek_bool + \bool_set_false:N \g_@@_bfupgreek_bool + \bool_set_false:N \g_@@_bfupLatin_bool + \bool_set_false:N \g_@@_bfuplatin_bool + } + {TeX} { + \bool_set_false:N \g_@@_bfliteral_bool + \bool_set_true:N \g_@@_bfupGreek_bool + \bool_set_false:N \g_@@_bfupgreek_bool + \bool_set_true:N \g_@@_bfupLatin_bool + \bool_set_true:N \g_@@_bfuplatin_bool + } + {upright} { + \bool_set_false:N \g_@@_bfliteral_bool + \bool_set_true:N \g_@@_bfupGreek_bool + \bool_set_true:N \g_@@_bfupgreek_bool + \bool_set_true:N \g_@@_bfupLatin_bool + \bool_set_true:N \g_@@_bfuplatin_bool + } + {literal} { + \bool_set_true:N \g_@@_bfliteral_bool + } + } +% \end{macrocode} +% +% \paragraph{sans-style} +% \begin{macrocode} +\@@_keys_choices:nn {sans-style} + { + {italic} { \bool_set_false:N \g_@@_upsans_bool } + {upright} { \bool_set_true:N \g_@@_upsans_bool } + {literal} { \bool_set_true:N \g_@@_sfliteral_bool } + } +% \end{macrocode} +% +% +% \paragraph{Nabla and partial} +% \begin{macrocode} +\@@_keys_choices:nn {nabla} + { + {upright} { + \bool_set_false:N \g_@@_literal_Nabla_bool + \bool_set_true:N \g_@@_upNabla_bool + } + {italic} { + \bool_set_false:N \g_@@_literal_Nabla_bool + \bool_set_false:N \g_@@_upNabla_bool + } + {literal} { \bool_set_true:N \g_@@_literal_Nabla_bool } + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_keys_choices:nn {partial} + { + {upright} { + \bool_set_false:N \g_@@_literal_partial_bool + \bool_set_true:N \g_@@_uppartial_bool + } + {italic} { + \bool_set_false:N \g_@@_literal_partial_bool + \bool_set_false:N \g_@@_uppartial_bool + } + {literal} { \bool_set_true:N \g_@@_literal_partial_bool } + } +% \end{macrocode} +% +% \paragraph{Colon style} +% \begin{macrocode} +\@@_keys_choices:nn {colon} + { + {literal} { \bool_set_true:N \g_@@_literal_colon_bool } + {TeX} { \bool_set_false:N \g_@@_literal_colon_bool } + } +% \end{macrocode} +% +% \paragraph{Slash delimiter style} +% \begin{macrocode} +\@@_keys_choices:nn {slash-delimiter} + { + {ascii} { \tl_set:Nn \g_@@_slash_delimiter_usv {"002F} } + {frac} { \tl_set:Nn \g_@@_slash_delimiter_usv {"2044} } + {div} { \tl_set:Nn \g_@@_slash_delimiter_usv {"2215} } + } +% \end{macrocode} +% +% +% \paragraph{Active fraction style} +% \begin{macrocode} +\@@_keys_choices:nn {active-frac} + { + {small} + { + \cs_if_exist:NTF \tfrac + { \bool_set_true:N \l_@@_smallfrac_bool } + { + \@@_warning:n {no-tfrac} + \bool_set_false:N \l_@@_smallfrac_bool + } + \use:c {@@_setup_active_frac:} + } + + {normalsize} + { + \bool_set_false:N \l_@@_smallfrac_bool + \use:c {@@_setup_active_frac:} + } + } +% \end{macrocode} +% +% \paragraph{Debug/tracing} +% +% \begin{macrocode} +\keys_define:nn {unicode-math} + { + warnings-off .code:n = + { + \clist_map_inline:nn {#1} + { \msg_redirect_name:nnn { unicode-math } { ##1 } { none } } + } + } +% \end{macrocode} +% +% \begin{macrocode} +\@@_keys_choices:nn {trace} + { + {on} {} % default + {debug} { \msg_redirect_module:nnn { unicode-math } { log } { warning } } + {off} { \msg_redirect_module:nnn { unicode-math } { log } { none } } + } +% \end{macrocode} +% +% \subsection{Defaults} +% +% \begin{macrocode} +\unimathsetup {math-style=TeX} +\unimathsetup {slash-delimiter=ascii} +\unimathsetup {trace=off} +\unimathsetup {mathrm=text,mathit=text,mathbf=text,mathsf=text,mathtt=text} +\cs_if_exist:NT \tfrac { \unimathsetup {active-frac=small} } +\ProcessKeysOptions {unicode-math} +% \end{macrocode} +% +% \begin{macrocode} +%</package&(XE|LU)> +% \end{macrocode} |