diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty | 252 |
1 files changed, 157 insertions, 95 deletions
diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty index a50bdaadcea..863e495ce2c 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty @@ -5,8 +5,9 @@ %% The original source files were: %% %% unicode-math.dtx (with options: `package,XE') -%% Copyright 2006-2011 Will Robertson <will.robertson@latex-project.org> +%% Copyright 2006-2012 Will Robertson <will.robertson@latex-project.org> %% Copyright 2010-2011 Philipp Stephani <st_philipp@yahoo.de> +%% Copyright 2012 Khaled Hosny <khaledhosny@eglug.org> %% %% This package is free software and may be redistributed and/or modified under %% the conditions of the LaTeX Project Public License, version 1.3c or higher @@ -24,7 +25,6 @@ \um_cs_compat:n {radical} \um_cs_compat:n {mathaccent} \um_cs_compat:n {delimiter} -\bool_set_false:N \c_um_have_fixed_accents_bool \cs_new:Nn \usv_set:nnn { \tl_set:cn { \um_to_usv:nn {#1}{#2} } {#3} } @@ -303,8 +303,6 @@ \cs_gset_protected_nopar:Npx #2 { \um_delimiter:Nnn \mathclose {#1} {#4} } } - \mathaccent - { \cs_gset_protected_nopar:Npx #2 { \um_accent:Nnn #3 {#1} {#4} } } \mathfence { \um_set_mathcode:nnn {#4} {#3} {#1} @@ -314,6 +312,20 @@ \cs_gset_protected_nopar:cpx {r \cs_to_str:N #2} { \um_delimiter:Nnn \mathclose {#1} {#4} } } + \mathaccent + { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {fixed} {#1} {#4} } } + \mathbotaccent + { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {bottom~ fixed} {#1} {#4} } } + \mathover + { + \cs_set_protected_nopar:Npx #2 ##1 + { \mathop { \um_accent:nnn {} {#1} {#4} {##1} } \limits } + } + \mathunder + { + \cs_set_protected_nopar:Npx #2 ##1 + { \mathop { \um_accent:nnn {bottom} {#1} {#4} {##1} } \limits } + } }{ \um_set_mathcode:nnn {#4} {#3} {#1} } @@ -321,6 +333,7 @@ \edef\mathfence{\string\mathfence} \edef\mathover{\string\mathover} \edef\mathunder{\string\mathunder} +\edef\mathbotaccent{\string\mathbotaccent} \cs_new:Nn \um_set_big_operator:nnn { \group_begin: \char_set_catcode_active:n {#3} @@ -354,47 +367,19 @@ \cs_new:Nn \um_delimiter:Nnn { \Udelimiter \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: } -\cs_new:Nn \um_accent:Nnn - { - \Umathaccent \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: - } -\cs_generate_variant:Nn \um_set_mathchar:NNnn {c} -\cs_set:Npn \um_overbrace:nnn #1#2#3 { - \luatexUdelimiterover \csname sym#1\endcsname #2 {#3} -} -\cs_set:Npn \um_underbrace:nnn #1#2#3 { - \luatexUdelimiterunder \csname sym#1\endcsname #2 {#3} +\cs_new:Nn \um_accent:nnn { + \Umathaccent #1~ \mathchar@type\mathaccent \use:c { sym #2 } #3 \scan_stop: } +\cs_generate_variant:Nn \um_set_mathchar:NNnn {c} \cs_new:Nn \char_gmake_mathactive:N { \global\mathcode `#1 = "8000 \scan_stop: } \cs_new:Nn \char_gmake_mathactive:n { \global\mathcode #1 = "8000 \scan_stop: } -\cs_new_eq:NN \um_saved_ltxe_glb_settings: \glb@settings -\CheckCommand * \glb@settings { - \expandafter\ifx\csname S@\f@size\endcsname\relax - \calculate@math@sizes - \fi - \csname S@\f@size\endcsname - \ifmath@fonts - \begingroup - \escapechar\m@ne - \csname mv@\math@version \endcsname - \globaldefs\@ne - \math@fonts - \let \glb@currsize \f@size - \endgroup - \the\every@math@size - \fi -} -\cs_set_protected_nopar:Npn \glb@settings { - \msg_error:nn { unicode-math } { no-font-selected } -} \cs_new:Nn \um_init: { \bool_set_true:N \l_um_ot_math_bool - \let\glb@currsize\relax - \cs_set_eq:NN \glb@settings \um_saved_ltxe_glb_settings: + \cs_set_eq:NN \glb@currsize \scan_stop: \bool_set_true:N \l_um_init_bool \seq_clear:N \l_um_char_range_seq \clist_clear:N \l_um_char_num_range_clist @@ -429,6 +414,12 @@ } \SetSymbolFont{\um_symfont_tl}{\l_um_mversion_tl} {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + \tl_set:Nn \l_um_tmpa_tl {normal} + \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + { + \SetSymbolFont{\um_symfont_tl}{bold} + {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + } \bool_if:nT {\l_um_ot_math_bool && !\g_um_mainfont_already_set_bool} { \bool_set_true:N \g_um_mainfont_already_set_bool \um_declare_math_sizes: @@ -441,6 +432,7 @@ \um_setup_accents: \um_setup_delcodes: \um_setup_alphabets: + \um_setup_negations: \ignorespaces } \cs_new:Nn \um_declare_math_sizes: @@ -478,6 +470,13 @@ } {\l_um_fontname_tl} \SetSymbolFont{symbols}{\l_um_mversion_tl} {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + + \tl_set:Nn \l_um_tmpa_tl {normal} + \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + { + \SetSymbolFont{symbols}{bold} + {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + } } \cs_new:Nn \um_setup_legacy_fam_three: { @@ -496,16 +495,20 @@ } {\l_um_fontname_tl} \SetSymbolFont{largesymbols}{\l_um_mversion_tl} {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + + \tl_set:Nn \l_um_tmpa_tl {normal} + \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + { + \SetSymbolFont{largesymbols}{bold} + {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + } } \cs_new:Nn \um_get_fontparam:nn { \the\fontdimen#1\l_um_font\relax } -\DeclareDocumentCommand \resetmathfont { O{} m } { - \bool_set_false:N \g_um_mainfont_already_set_bool - \setmathfont[#1]{#2} -} +\cs_set_eq:NN \resetmathfont \setmathfont \cs_new:Nn \um_fontspec_select_font: { \tl_set:Nx \l_um_font_keyval_tl { - BoldFont = {}, ItalicFont = {}, + BoldItalicFont = {}, ItalicFont = {}, Script = Math, SizeFeatures = { {Size = \tf@size-} , @@ -633,7 +636,7 @@ \tl_remove_all:Nn \l_um_nolimits_tl {#1} } \tl_new:N \l_um_radicals_tl -\tl_set:Nn \l_um_radicals_tl {\sqrt} +\tl_set:Nn \l_um_radicals_tl {\sqrt \longdivision} \cs_new_protected_nopar:Nn \um_new_cramped_style:N { \quark_new:N #1 } \um_new_cramped_style:N \crampeddisplaystyle @@ -831,7 +834,7 @@ { \mathord,\mathalpha,\mathop,\mathbin,\mathrel, \mathopen,\mathclose,\mathpunct,\mathaccent, - \mathfence,\mathover,\mathunder + \mathfence,\mathover,\mathunder,\mathbotaccent } \prg_new_conditional:Nnn \um_if_mathalph_decl:n {TF} { \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {#1} } @@ -874,7 +877,7 @@ % character slot: \seq_map_inline:Nn \l_um_char_range_seq { - \um_int_if_range_matches_slot:nnT {##1} {#1} + \um_int_if_slot_in_range:nnT {#1} {##1} { \seq_map_break:n { \use_none_delimit_by_q_nil:w } } } @@ -887,7 +890,7 @@ #4 } } -\cs_new:Nn \um_int_if_range_matches_slot:nnT +\cs_new:Nn \um_int_if_slot_in_range:nnT { \um_numrange_parse:nwT {#1} #2 - \q_nil - \q_stop {#3} } \cs_set:Npn \um_numrange_parse:nwT #1 #2 - #3 - #4 \q_stop #5 { @@ -1792,15 +1795,11 @@ } } } -\cs_new:Npn \um_symbol_setup: - { - \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { - \prg_case_tl:Nnn ##3 { \mathover {} \mathunder {} } - { - \exp_not:n {\_um_sym:nnn{##1}{##2}{##3}} - } - } +\cs_new:Npn \um_symbol_setup: { + \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { + \exp_not:n {\_um_sym:nnn{##1}{##2}{##3}} } +} \CatchFileEdef \g_um_mathtable_tl {unicode-math-table.tex} {\um_symbol_setup:} \cs_new:Nn \um_input_math_symbol_table: {\g_um_mathtable_tl} \group_begin: @@ -1835,7 +1834,8 @@ \cs_if_eq_p:NN ##3 \mathopen || \cs_if_eq_p:NN ##3 \mathclose || \cs_if_eq_p:NN ##3 \mathover || - \cs_if_eq_p:NN ##3 \mathunder } { + \cs_if_eq_p:NN ##3 \mathunder || + \cs_if_eq_p:NN ##3 \mathbotaccent } { \um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces } } @@ -1853,6 +1853,15 @@ } } |group_end: +\AtBeginDocument { \um_load_lm_if_necessary: } +\cs_new:Nn \um_load_lm_if_necessary: + { + \cs_if_exist:NF \l_um_fontname_tl + { + % XXX: update this when lmmath-bold.otf is released + \setmathfont[BoldFont={lmmath-regular.otf}]{lmmath-regular.otf} + } + } \cs_new:Nn \um_arg_i_before_egroup:n {#1\egroup} \cs_new:Nn \um_superscript:n { ^\bgroup #1 @@ -2275,41 +2284,6 @@ \group_end: } \um_setup_active_frac: -\cs_new:Nn \um_over_bracket:nN - { - \mathop { \vbox { - \setbox\z@\hbox{$\displaystyle#1$} - \dimen@=\dimexpr\wd\z@+3\p@\relax - \setbox\tw@\hbox{$\left #2 \vcenter to\dimen@{\vss} \right. $} - \m@th\ialign - { - ##\crcr\noalign{\kern-\p@}% - \rotatebox[origin=Bl]{-90} - {\box\tw@}\crcr\noalign{\kern0\p@\nointerlineskip}% - \hfil\box\z@\hfil\crcr - } - } } \limits - } -\cs_new:Nn \um_under_bracket:nN - { - \mathop { \vtop { - \setbox\z@\hbox{$\displaystyle#1$} - \dimen@=\dimexpr\wd\z@+3\p@\relax - \setbox\tw@\hbox{$\left #2 \vcenter to\dimen@{\vss} \right. $} - \m@th\ialign - { - ##\crcr\hfil\box\z@\hfil\crcr - \noalign{\kern1\p@\nointerlineskip}% - \rotatebox[origin=Br]{-90}{\box\tw@}\crcr\noalign{\kern0\p@} - } - } } \limits - } -\RenewDocumentCommand \overbrace {m} { \um_over_bracket:nN {#1} \{ } -\DeclareDocumentCommand \overbracket {m} { \um_over_bracket:nN {#1} [ } -\DeclareDocumentCommand \overparen {m} { \um_over_bracket:nN {#1} ( } -\RenewDocumentCommand \underbrace {m} { \um_under_bracket:nN {#1} \} } -\DeclareDocumentCommand \underbracket {m} { \um_under_bracket:nN {#1} ] } -\DeclareDocumentCommand \underparen {m} { \um_under_bracket:nN {#1} ) } \def\to{\rightarrow} \def\le{\leq} \def\ge{\geq} @@ -2329,6 +2303,7 @@ \def\gets{\leftarrow} \def\mathring{\ocirc} \def\lnot{\neg} +\def\longdivision{\longdivisionsign} \def\backepsilon{\upbackepsilon} \def\eth{\matheth} \def\smallint{{\textstyle\int}\limits} @@ -2552,16 +2527,78 @@ \cs_set:Npn \| {\Vert} \cs_set:Npn \mathellipsis {\mathinner{\unicodeellipsis}} \cs_set:Npn \cdots {\mathinner{\unicodecdots}} -\cs_new_protected_nopar:Nn \um_setup_accents: - { - \def\widehat{\hat} - \def\widetilde{\tilde} - \def\overrightarrow{\vec} - } +\cs_new_protected_nopar:Nn \um_setup_accents: { + \cs_gset_protected_nopar:Npx \widehat { + \um_accent:nnn {} { \um_symfont_tl } { "0302 } + } + \cs_gset_protected_nopar:Npx \widetilde { + \um_accent:nnn {} { \um_symfont_tl } { "0303 } + } + \cs_gset_protected_nopar:Npx \overleftarrow { + \um_accent:nnn {} { \um_symfont_tl } { "20D6 } + } + \cs_gset_protected_nopar:Npx \overrightarrow { + \um_accent:nnn {} { \um_symfont_tl } { "20D7 } + } + \cs_gset_protected_nopar:Npx \overleftrightarrow { + \um_accent:nnn {} { \um_symfont_tl } { "20E1 } + } + \cs_gset_protected_nopar:Npx \wideutilde { + \um_accent:nnn {bottom} { \um_symfont_tl } { "0330 } + } + \cs_gset_protected_nopar:Npx \underrightharpoondown { + \um_accent:nnn {bottom} { \um_symfont_tl } { "20EC } + } + \cs_gset_protected_nopar:Npx \underleftharpoondown { + \um_accent:nnn {bottom} { \um_symfont_tl } { "20ED } + } + \cs_gset_protected_nopar:Npx \underleftarrow { + \um_accent:nnn {bottom} { \um_symfont_tl } { "20EE } + } + \cs_gset_protected_nopar:Npx \underrightarrow { + \um_accent:nnn {bottom} { \um_symfont_tl } { "20EF } + } + \cs_gset_protected_nopar:Npx \underleftrightarrow { + \um_accent:nnn {bottom} { \um_symfont_tl } { "034D } + } +} \cs_set_eq:NN \um_text_slash: \slash \cs_set_protected:Npn \slash { \mode_if_math:TF {\mathslash} {\um_text_slash:} } +\tl_new:N \l_not_token_name_tl + +\cs_new:Npn \not_newnot:N #1 { + \tl_set:Nx \l_not_token_name_tl { \token_to_str:N #1 } + \tl_if_empty:xF { \tl_tail:V \l_not_token_name_tl } { + \tl_set:Nx \l_not_token_name_tl { \tl_tail:V \l_not_token_name_tl } + } + \cs_if_exist:cTF { n \l_not_token_name_tl } { + \use:c { n \l_not_token_name_tl } + } { + \cs_if_exist:cTF { not \l_not_token_name_tl } { + \use:c { not \l_not_token_name_tl } + } { + \not_oldnot: #1 %\l_not_token_name_tl + } + } +} + +\cs_new_protected_nopar:Nn \um_setup_negations: { + \cs_set_eq:NN \not_oldnot: \not + \cs_set_eq:NN \not \not_newnot:N + + \cs_gset:cpn { not= } { \neq } + \cs_gset:cpn { not< } { \nless } + \cs_gset:cpn { not> } { \ngtr } + \cs_gset:Npn \ngets { \nleftarrow } + \cs_gset:Npn \nsimeq { \nsime } + \cs_gset:Npn \nequal { \ne } + \cs_gset:Npn \nle { \nleq } + \cs_gset:Npn \nge { \ngeq } + \cs_gset:Npn \ngreater { \ngtr } + \cs_gset:Npn \nforksnot { \forks } +} \AtEndOfPackageFile * { mathtools } { \chk_if_free_cs:N \g_um_empty_fam \newfam \g_um_empty_fam @@ -2613,6 +2650,31 @@ } \box_use_clear:N \l_tmpa_box } +\AtEndOfPackageFile * { mathtools } { + \let\MToverbracket =\overbracket + \let\MTunderbracket=\underbracket + + \AtBeginDocument { + \msg_warning:nn { unicode-math } { mathtools-overbracket } + +\def\downbracketfill#1#2{% + \edef\l_MT_bracketheight_fdim{.27ex}% + \downbracketend{#1}{#2} + \leaders \vrule \@height #1 \@depth \z@ \hfill + \downbracketend{#1}{#2}% + } +\def\upbracketfill#1#2{% + \edef\l_MT_bracketheight_fdim{.27ex}% + \upbracketend{#1}{#2} + \leaders \vrule \@height \z@ \@depth #1 \hfill + \upbracketend{#1}{#2}% + } +\let\Uoverbracket =\overbracket +\let\Uunderbracket=\underbracket + \let\overbracket =\MToverbracket + \let\underbracket =\MTunderbracket + } +} \msg_warning:nn { unicode-math } { mathtools-colon } \NewDocumentCommand \dblcolon { } { \Colon } \NewDocumentCommand \coloneqq { } { \coloneq } |