summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty')
-rw-r--r--Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty227
1 files changed, 139 insertions, 88 deletions
diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty
index 06a26505ba4..1f851aaac03 100644
--- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty
+++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty
@@ -5,8 +5,9 @@
%% The original source files were:
%%
%% unicode-math.dtx (with options: `package,LU')
-%% 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,12 +25,10 @@
\um_cs_compat:n {radical}
\um_cs_compat:n {mathaccent}
\um_cs_compat:n {delimiter}
-\bool_const:Nn \c_um_have_fixed_accents_bool
- { \int_compare_p:n { \luatexversion > 64 } }
\RequirePackage { lualatex-math } [ 2011/08/07 ]
\RequirePackage { luatexbase }
\RequirePackage { luaotfload } [ 2010/11/26 ]
-\RequireLuaModule { unicode-math } [ 2011/04/23 ]
+\RequireLuaModule { unicode-math } [ 2012/04/23 ]
\cs_new:Nn \usv_set:nnn {
\tl_set:cn { \um_to_usv:nn {#1}{#2} } {#3}
}
@@ -306,8 +305,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}
@@ -317,15 +314,19 @@
\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_overbrace:nnn {#1} {#4} {##1} } \limits }
+ { \mathop { \um_accent:nnn {} {#1} {#4} {##1} } \limits }
}
\mathunder
{
\cs_set_protected_nopar:Npx #2 ##1
- { \mathop { \um_underbrace:nnn {#1} {#4} {##1} } \limits }
+ { \mathop { \um_accent:nnn {bottom} {#1} {#4} {##1} } \limits }
}
}{
\um_set_mathcode:nnn {#4} {#3} {#1}
@@ -334,6 +335,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}
@@ -367,59 +369,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 \c_um_accent_keyword_tl
- \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop:
- }
- \cs_new_nopar:Npn \um_wide_top_accent:Nnn #1 #2 #3 {
- \Umathaccent \mathchar@type #1 \use:c { sym #2 } #3 \scan_stop:
- }
- \bool_if:NTF \c_um_have_fixed_accents_bool {
- \cs_new_nopar:Npn \um_wide_bottom_accent:Nnn #1 #2 #3 {
- \Umathaccent bottom~ \mathchar@type #1 \use:c { sym #2 } #3 \scan_stop:
- }
- \tl_const:Nn \c_um_accent_keyword_tl { fixed }
- } {
- \tl_const:Nn \c_um_accent_keyword_tl { }
- }
-\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
@@ -454,6 +416,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:
@@ -466,6 +434,7 @@
\um_setup_accents:
\um_setup_delcodes:
\um_setup_alphabets:
+ \um_setup_negations:
\ignorespaces
}
\cs_new:Nn \um_declare_math_sizes:
@@ -503,6 +472,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:
{
@@ -521,17 +497,21 @@
} {\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
{ \directlua{fontspec.mathfontdimen("l_um_font","#2")} }
-\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 {
Renderer = Basic,
- BoldFont = {}, ItalicFont = {},
+ BoldItalicFont = {}, ItalicFont = {},
Script = Math,
SizeFeatures = {
{Size = \tf@size-} ,
@@ -659,7 +639,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
{ \cs_new_eq:Nc #1 { luatex \cs_to_str:N #1 } }
\um_new_cramped_style:N \crampeddisplaystyle
@@ -826,7 +806,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} }
@@ -869,7 +849,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 } }
}
@@ -882,7 +862,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
{
@@ -1787,12 +1767,11 @@
}
}
}
-\cs_new:Npn \um_symbol_setup:
- {
- \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 {
- \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:
@@ -1827,7 +1806,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
}
}
@@ -1845,6 +1825,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
@@ -2267,6 +2256,7 @@
\def\gets{\leftarrow}
\def\mathring{\ocirc}
\def\lnot{\neg}
+\def\longdivision{\longdivisionsign}
\def\backepsilon{\upbackepsilon}
\def\eth{\matheth}
\def\smallint{{\textstyle\int}\limits}
@@ -2441,43 +2431,104 @@
\cs_set:Npn \| {\Vert}
\cs_set:Npn \mathellipsis {\mathinner{\unicodeellipsis}}
\cs_set:Npn \cdots {\mathinner{\unicodecdots}}
-\cs_new_protected_nopar:Nn \um_setup_accents:
- {
+\cs_new_protected_nopar:Nn \um_setup_accents: {
\cs_gset_protected_nopar:Npx \widehat {
- \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "0302 }
+ \um_accent:nnn {} { \um_symfont_tl } { "0302 }
}
\cs_gset_protected_nopar:Npx \widetilde {
- \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "0303 }
+ \um_accent:nnn {} { \um_symfont_tl } { "0303 }
}
\cs_gset_protected_nopar:Npx \overleftarrow {
- \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20D6 }
+ \um_accent:nnn {} { \um_symfont_tl } { "20D6 }
}
\cs_gset_protected_nopar:Npx \overrightarrow {
- \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20D7 }
+ \um_accent:nnn {} { \um_symfont_tl } { "20D7 }
}
\cs_gset_protected_nopar:Npx \overleftrightarrow {
- \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20E1 }
+ \um_accent:nnn {} { \um_symfont_tl } { "20E1 }
}
- \bool_if:NT \c_um_have_fixed_accents_bool {
- \cs_gset_protected_nopar:Npx \underrightharpoondown {
- \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EC }
- }
- \cs_gset_protected_nopar:Npx \underleftharpoondown {
- \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20ED }
- }
- \cs_gset_protected_nopar:Npx \underleftarrow {
- \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EE }
- }
- \cs_gset_protected_nopar:Npx \underrightarrow {
- \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EF }
- }
+ \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 } {
\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 }