texlive[45453] Master/texmf-dist: unicode-math (2oct17)

commits+karl at tug.org commits+karl at tug.org
Mon Oct 2 23:58:47 CEST 2017


Revision: 45453
          http://tug.org/svn/texlive?view=revision&revision=45453
Author:   karl
Date:     2017-10-02 23:58:46 +0200 (Mon, 02 Oct 2017)
Log Message:
-----------
unicode-math (2oct17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/unicode-math/README.md
    trunk/Master/texmf-dist/doc/latex/unicode-math/unicode-math-doc.tex
    trunk/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf
    trunk/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.ltx
    trunk/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf
    trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx
    trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty
    trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty
    trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md
    trunk/Master/texmf-dist/doc/latex/unicode-math/CONTRIBUTING.md
    trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-epilogue.dtx
    trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-preamble.dtx

Added: trunk/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md	2017-10-02 21:58:46 UTC (rev 45453)
@@ -0,0 +1,211 @@
+CHANGE HISTORY
+--------------
+
+- v0.8g (2017/10/02)
+
+  * Better use of scriptstyle sizes in LuaTeX (I think a regression).
+  * Fix regression (`\mathbf` etc. not being set automatically) caused by the renaming of a `fontspec` internal command.
+  * Minor documentation improvements.
+  * (Only relevant for me: I've also disabled the test suite almost entirely to begin a re-write for ‘continuous integration’.)
+
+- v0.8f (2017/08/02)
+
+  * Emergency fix (thanks Bruno) for another bug revealed by `expl3` update.
+
+- v0.8e (2017/07/30)
+
+  * Add `\surd` to access the sqrt symbol.
+  * Fix bug exposed by `expl3` update to booleans.
+  * Add Deja Vu Math TeX Gyre in list of symbols.
+  * Add `\sime` alias for `\simeq` and `\nsimeq` for `\nsime`.
+    (For negations it's helpful when they have consistent naming.)
+
+- v0.8d (2017/01/25)
+
+  * `vargreek-shape=TeX` and `vargreek-shape=unicode` package options dropped; for consistency and compatibility, `\phi` and `\epsilon` should and will now behave the same as in `TeX`.
+  * On that note, when using control sequences such as `\mbfitsansvarphi` (and so on), there were a few faulty definitions. The new behaviour is to consistenyl define the `varphi` and `varepsilon` ones as those with the "curly" designs.
+  * Add `\wideoverbar`, `\widebreve`, `\widecheck`.
+  * Add `\mathsection`, `\mathparagraph`.
+  * Remove `\mupvarbeta`, `upold(Kk)oppa`, `\up(Ss)tigma`, `\up(Kk)oppa`, `\up(Ss)ampi` — none of these are maths symbols.
+  * `!` (`\mathexclam`) changed from `\mathpunct` to `\mathclose` for backwards compatibility with TeX.
+
+- v0.8c (2015/09/24)
+
+  * Add `\over(left/right)harpoon` as "wide" accents.
+  * Add RTL mathematics operators `\arabicmaj` and `\arabichad`, which correspond to `U+1EEF0` and `U+1EEF1`, resp.
+  * Remove `catchfile` package dependency.
+  * Update some internal names to match expl3 standards.
+
+- v0.8b (2015/09/09)
+
+  * Bug fix: Use the "ucharcat" package to simplify some code that caused some headaches with \tl_rescan:nn.
+
+- v0.8a (2015/08/06)
+
+  * Fix bug with \vert, \|, \(l/r)vert, etc., displaying with the wrong characters.
+
+  * Improve documentation to properly reflect changes in v0.8 and fix some broken examples.
+
+  * No longer reset catcodes of : and @ during \setmathfont .
+
+  * Fix remapping of alphabets (needed for Minion Math) in cases such as:
+
+      \setmathfont[range=bfit->it]{MinionMath-Bold.otf}
+
+- v0.8  (2015/07/29)  **Breaking changes in this update!**
+
+  * `\mathrm` (`\mathup`), `\mathit`, `\mathbf`, `\mathsf`, and `\mathtt` revert to their traditional LaTeX meanings; they are set up to match their equivalent text fonts unless specifically set using `\setmathrm` and friends from `fontspec` or the new `\setmathfontface` in `unicode-math`. These commands should be used for *multi*-letter identifiers.
+
+  * New "symbol" commands have been added, `\symrm` (`\symup`), `symit`, ..., to replace the behaviour of the old commands. These should be used for *single*-letter identifiers. See the package documentation for more detail on these and related commands.
+
+  * Package options `mathit=sym`, `mathbf=sym`, etc., reverse the changes above to revert to pre-v0.8 behaviour for `\mathXYZ`. Regardless of package option, `\symXYZ` always maps to symbols and `\mathtextXYZ` is provided for the traditional `\mathXYZ` font switch.
+
+  * New command `\setoperatorfont` to set the font used for commands such as `\sin` and `\cos`. Usage: `\setoperatorfont\mathbf` or any command defined with `\setmathfontface`.
+
+  * Traditional LaTeX `\DeclareMathAlphabet` now works again for legacy font-loading packages.
+
+  * Commands defined to "force" Greek letters with `\upbeta` and `\itbeta`, etc.
+
+  * Assorted bug fixes and minor changes.
+
+- v0.7e (2014/06/30)
+
+  * No longer assume fixltx2e has been loaded.
+  * Some ascii math symbols have been renamed with a \math... prefix, such as \mathquestion.
+  * Assume latest luaotfload is being used; no need for a separate unicode-math.lua script.
+  * Assorted typos and minor bugs.
+
+- v0.7e (2013/05/04)
+
+  * Track luaotfload updates.
+
+- v0.7d (2013/03/16)
+
+  * More expl3 changes missed first time around. (Sorry again.)
+
+- v0.7c (2013/02/25)
+
+  * The Latin Modern math font name changed TWICE. Only caught the first one.
+    Sorry for any inconvenience caused.
+
+- v0.7b (2013/02/22)
+
+  * Keep in sync with Latin Modern Math font name change.
+  * Keep in sync with expl3 changes.
+
+- v0.7a (2012/07/28)
+
+  * Keep in sync with expl3 changes.
+
+- v0.7 (2012/05/30): The TeX Live 2012 release.
+
+  * Most changes (and all significant ones) in this release thanks to Khaled
+    Hosny, who is now credited as an author of the package.
+  * Many improvements for XeTeX support to take advantage of the new engine
+    (v0.9998) in TL2012.
+      * As a result, `\resetmathfont` is no longer required.
+  * Improve `\not` to use pre-combined glyphs where possible.
+  * LM Math is loaded by default.
+  * Support bottom accents.
+      * And add `\wideutilde`.
+  * The ‘symbols’ document is somewhat better organised and contains
+    information on whether a symbol is defined in plain TeX or amssymb.
+  * Various other minor fixes and additions:
+      * `\underleftrightarrow` added for fonts that support it.
+      * Don’t overwrite mathtool’s `\overbracket` and `\underbracket`.
+      * Bug in `[range=...]` parsing fixed.
+      * Add `\longdivision`.
+      * Add `\lgroup` and `\rgroup`.
+      * Fix ‘moustache’ delimiters.
+      * `\openbox` renamed to `\mathvisiblespace`, since it is already defined
+        in amsthm as an empty box.
+
+- v0.6a (2011/09/19)
+
+  * Always a bug that slips through the cracks! Fixes `\left.` and `\right.`
+  * Add experimental package option `warnings-off=...` which allows warnings
+    to be suppressed on an individual basis.
+
+- v0.6 (2011/09/18)
+
+  * Keep in sync with fontspec internals
+    (sorry for the small delay where things were broken)
+  * Keep in sync with expl3 deprecated functions
+  * Math versions (finally) implemented; can now change maths fonts
+    mid-document without reinitialising everything
+    (thanks to Ulrike Fischer and Ulrik Vieth)
+  * Symbols file `unimath-symbols.pdf` now uses maths versions to compare
+    all of the OpenType maths fonts I currently have access to
+  * Over- and under- braces, brackets, and parentheses now work in XeTeX
+    (thanks to Claudio Beccari)
+  * Many internal changes, including a re-write of the `range` feature;
+    it should now be faster and more robust
+  * Tentative programmer's interface for querying the current math style:
+    `\l_um_mathstyle_tl`.
+  * Remove (outdated) interaction with beamer; you must specify
+    `professionalfonts` manually for now
+  * Quieten the console output when loading maths fonts with incomplete maths
+    style coverage
+  * Synonym added: `\lnot` -> `\neg`
+  * Two added Unicode symbols (names tentative): `\blanksymbol` and `\openbox`
+    (thanks to Apostolos Syropoulos)
+  * Fixed literal sub-/super-script input.
+
+- v0.5e (2011/07/31)
+
+  * Fix forward compatibility clash with deprecated expl3 functions (sorry)
+  * Command names are now `\protected`; this makes them safe to use in moving
+    arguments and so on
+  * Similarly to the change in v0.5c, the main math font is now loaded in
+    math family zero (equiv. to LaTeX's `operators` math font)
+  * `\mathring` added
+  * Ensure that a math font has been selected in order to prevent problems
+    in minimal documents (this will be unnecessary when the OpenType LM math
+    font is released)
+  * Documentation for which was which of epsilon/varepsilon was backwards!
+    (thank to Rasmus Villemoes for pointing this out)
+  * Spurious `\upUpsilon` removed (the one at U+03A5 is now the correct one)
+  * Typo when defining `\dprime` fixed
+    (thanks to Ulrik Vieth for these last two)
+  * Fix the math class of `\modtwosum`; it is now a large operator
+    (thanks to Michael Ummels)
+  * Move several LuaTeX-related patches to the `lualatex-math` package
+  * Fixed mathtool's `\cramped` in XeLaTeX usage
+
+- v0.5d (2011/01/30)
+
+  * Assorted improvements to LuaLaTeX support, including non-growing accents
+    available in LuaTeX v0.65 and later
+  * Improved behaviour with reading and using maths font dimensions
+  * Better compatibility with legacy maths packages and environments
+    (always more worked needed, though)
+  * Fix the default setting for "vargreek-shape"
+
+- v0.5c (2010/09/27)
+
+  * Fix a long-standing bug in XeLaTeX in which the "master" math
+    families 2 and 3 weren't being set; hence fraction rules and many other
+    parameters were not being set correctly
+  * Stay in sync with internal fontspec changes
+
+- v0.5b (2010/09/19): Tune-up
+
+  * Added missing symbols/synonyms:
+      \diamond  \smallint  \emptyset  \hbar  \backepsilon  \eth
+  * \overline works for LuaLaTeX
+  * Fix \slash; previously, it overwrote the text definition
+  * \vartriangle now has the correct math class
+
+- v0.5a (2010/07/14): TeX Live 2010 release
+
+  * Numerous documentation improvements
+  * Bug fix against stray catcode changes
+  * Add `\mathcal` and `\mathbfcal` as distinct from the Script style;
+    these are only supported by the XITS fonts at present
+  * Small changes to the range of symbols offered (especially note that `\ac`
+    is now `\invlazys` to avoid acronym package clash)
+  * Superscripts are allowed after primes (as they should be)
+  * Numerous LuaLaTeX improvements, including roots and over/under braces.
+
+- v0.5 (2010/06/03): Initial CTAN release
+


Property changes on: trunk/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/doc/latex/unicode-math/CONTRIBUTING.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/unicode-math/CONTRIBUTING.md	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/unicode-math/CONTRIBUTING.md	2017-10-02 21:58:46 UTC (rev 45453)
@@ -0,0 +1,41 @@
+# Guidelines for issues and pull requests
+
+## Issues
+
+Thanks for taking the time to report an issue!
+Any apologies that I take longer, sometimes *way longer*, than I should to address them.
+
+There are two important key points for submitting an issue:
+
+* When submitting an issue, please include a *complete* minimal example.
+* When loading maths fonts, please do so by *filename* only.
+* If you are using a proprietary/unusual font, please try a maths font in TeX Live to see
+  if it exhibits the same behaviour; it's obviously much harder for me to test with fonts
+  I don't yet have or can't access.
+
+For example, this is a good minimal example:
+
+    \documentclass{article}
+    \usepackage{unicode-math}
+    \setmathfont{texgyrepagella-math.otf}
+    \begin{document}
+    \[
+      x^2 + y^2 = z^2
+    \]
+    \end{document}
+
+This is an example of a *bad* example:
+
+    \usepackage{unicode-math}
+    \setmathfont{TeX Gyre Pagella Math}
+
+    % later:
+    \[
+      x^2 + y^2 = z^2
+    \]
+
+## Pull Requests
+
+I'm usually not fussy! Generally I'll just be impressed you've taken the effort.
+
+If you are changing documentation only (i.e., no code changes), you can add `[ci skip]` to the commit message and the test suite won't be run to check that the changes haven't broken anything.


Property changes on: trunk/Master/texmf-dist/doc/latex/unicode-math/CONTRIBUTING.md
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/doc/latex/unicode-math/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/unicode-math/README.md	2017-10-02 21:58:27 UTC (rev 45452)
+++ trunk/Master/texmf-dist/doc/latex/unicode-math/README.md	2017-10-02 21:58:46 UTC (rev 45453)
@@ -76,213 +76,9 @@
 Please file bug reports with minimal examples:
 > <http://github.com/wspr/unicode-math/issues>
 
+See `CHANGES.md` for the complete listing of change history.
 
 
-CHANGE HISTORY
---------------
-
-- v0.8f (2017/08/02)
-
-  * Emergency fix (thanks Bruno) for another bug revealed by `expl3` update.
-
-- v0.8e (2017/07/30)
-
-  * Add `\surd` to access the sqrt symbol.
-  * Fix bug exposed by `expl3` update to booleans.
-  * Add Deja Vu Math TeX Gyre in list of symbols.
-  * Add `\sime` alias for `\simeq` and `\nsimeq` for `\nsime`.
-    (For negations it's helpful when they have consistent naming.)
-
-- v0.8d (2017/01/25)
-
-  * `vargreek-shape=TeX` and `vargreek-shape=unicode` package options dropped; for consistency and compatibility, `\phi` and `\epsilon` should and will now behave the same as in `TeX`.
-  * On that note, when using control sequences such as `\mbfitsansvarphi` (and so on), there were a few faulty definitions. The new behaviour is to consistenyl define the `varphi` and `varepsilon` ones as those with the "curly" designs.
-  * Add `\wideoverbar`, `\widebreve`, `\widecheck`.
-  * Add `\mathsection`, `\mathparagraph`.
-  * Remove `\mupvarbeta`, `upold(Kk)oppa`, `\up(Ss)tigma`, `\up(Kk)oppa`, `\up(Ss)ampi` — none of these are maths symbols.
-  * `!` (`\mathexclam`) changed from `\mathpunct` to `\mathclose` for backwards compatibility with TeX.
-
-- v0.8c (2015/09/24)
-
-  * Add `\over(left/right)harpoon` as "wide" accents.
-  * Add RTL mathematics operators `\arabicmaj` and `\arabichad`, which correspond to `U+1EEF0` and `U+1EEF1`, resp.
-  * Remove `catchfile` package dependency.
-  * Update some internal names to match expl3 standards.
-
-- v0.8b (2015/09/09)
-
-  * Bug fix: Use the "ucharcat" package to simplify some code that caused some headaches with \tl_rescan:nn.
-
-- v0.8a (2015/08/06)
-
-  * Fix bug with \vert, \|, \(l/r)vert, etc., displaying with the wrong characters.
-
-  * Improve documentation to properly reflect changes in v0.8 and fix some broken examples.
-
-  * No longer reset catcodes of : and @ during \setmathfont .
-
-  * Fix remapping of alphabets (needed for Minion Math) in cases such as:
-
-      \setmathfont[range=bfit->it]{MinionMath-Bold.otf}
-
-- v0.8  (2015/07/29)  **Breaking changes in this update!**
-
-  * `\mathrm` (`\mathup`), `\mathit`, `\mathbf`, `\mathsf`, and `\mathtt` revert to their traditional LaTeX meanings; they are set up to match their equivalent text fonts unless specifically set using `\setmathrm` and friends from `fontspec` or the new `\setmathfontface` in `unicode-math`. These commands should be used for *multi*-letter identifiers.
-
-  * New "symbol" commands have been added, `\symrm` (`\symup`), `symit`, ..., to replace the behaviour of the old commands. These should be used for *single*-letter identifiers. See the package documentation for more detail on these and related commands.
-
-  * Package options `mathit=sym`, `mathbf=sym`, etc., reverse the changes above to revert to pre-v0.8 behaviour for `\mathXYZ`. Regardless of package option, `\symXYZ` always maps to symbols and `\mathtextXYZ` is provided for the traditional `\mathXYZ` font switch.
-
-  * New command `\setoperatorfont` to set the font used for commands such as `\sin` and `\cos`. Usage: `\setoperatorfont\mathbf` or any command defined with `\setmathfontface`.
-
-  * Traditional LaTeX `\DeclareMathAlphabet` now works again for legacy font-loading packages.
-
-  * Commands defined to "force" Greek letters with `\upbeta` and `\itbeta`, etc.
-
-  * Assorted bug fixes and minor changes.
-
-- v0.7e (2014/06/30)
-
-  * No longer assume fixltx2e has been loaded.
-  * Some ascii math symbols have been renamed with a \math... prefix, such as \mathquestion.
-  * Assume latest luaotfload is being used; no need for a separate unicode-math.lua script.
-  * Assorted typos and minor bugs.
-
-- v0.7e (2013/05/04)
-
-  * Track luaotfload updates.
-
-- v0.7d (2013/03/16)
-
-  * More expl3 changes missed first time around. (Sorry again.)
-
-- v0.7c (2013/02/25)
-
-  * The Latin Modern math font name changed TWICE. Only caught the first one.
-    Sorry for any inconvenience caused.
-
-- v0.7b (2013/02/22)
-
-  * Keep in sync with Latin Modern Math font name change.
-  * Keep in sync with expl3 changes.
-
-- v0.7a (2012/07/28)
-
-  * Keep in sync with expl3 changes.
-
-- v0.7 (2012/05/30): The TeX Live 2012 release.
-
-  * Most changes (and all significant ones) in this release thanks to Khaled
-    Hosny, who is now credited as an author of the package.
-  * Many improvements for XeTeX support to take advantage of the new engine
-    (v0.9998) in TL2012.
-      * As a result, `\resetmathfont` is no longer required.
-  * Improve `\not` to use pre-combined glyphs where possible.
-  * LM Math is loaded by default.
-  * Support bottom accents.
-      * And add `\wideutilde`.
-  * The ‘symbols’ document is somewhat better organised and contains
-    information on whether a symbol is defined in plain TeX or amssymb.
-  * Various other minor fixes and additions:
-      * `\underleftrightarrow` added for fonts that support it.
-      * Don’t overwrite mathtool’s `\overbracket` and `\underbracket`.
-      * Bug in `[range=...]` parsing fixed.
-      * Add `\longdivision`.
-      * Add `\lgroup` and `\rgroup`.
-      * Fix ‘moustache’ delimiters.
-      * `\openbox` renamed to `\mathvisiblespace`, since it is already defined
-        in amsthm as an empty box.
-
-- v0.6a (2011/09/19)
-
-  * Always a bug that slips through the cracks! Fixes `\left.` and `\right.`
-  * Add experimental package option `warnings-off=...` which allows warnings
-    to be suppressed on an individual basis.
-
-- v0.6 (2011/09/18)
-
-  * Keep in sync with fontspec internals
-    (sorry for the small delay where things were broken)
-  * Keep in sync with expl3 deprecated functions
-  * Math versions (finally) implemented; can now change maths fonts
-    mid-document without reinitialising everything
-    (thanks to Ulrike Fischer and Ulrik Vieth)
-  * Symbols file `unimath-symbols.pdf` now uses maths versions to compare
-    all of the OpenType maths fonts I currently have access to
-  * Over- and under- braces, brackets, and parentheses now work in XeTeX
-    (thanks to Claudio Beccari)
-  * Many internal changes, including a re-write of the `range` feature;
-    it should now be faster and more robust
-  * Tentative programmer's interface for querying the current math style:
-    `\l_um_mathstyle_tl`.
-  * Remove (outdated) interaction with beamer; you must specify
-    `professionalfonts` manually for now
-  * Quieten the console output when loading maths fonts with incomplete maths
-    style coverage
-  * Synonym added: `\lnot` -> `\neg`
-  * Two added Unicode symbols (names tentative): `\blanksymbol` and `\openbox`
-    (thanks to Apostolos Syropoulos)
-  * Fixed literal sub-/super-script input.
-
-- v0.5e (2011/07/31)
-
-  * Fix forward compatibility clash with deprecated expl3 functions (sorry)
-  * Command names are now `\protected`; this makes them safe to use in moving
-    arguments and so on
-  * Similarly to the change in v0.5c, the main math font is now loaded in
-    math family zero (equiv. to LaTeX's `operators` math font)
-  * `\mathring` added
-  * Ensure that a math font has been selected in order to prevent problems
-    in minimal documents (this will be unnecessary when the OpenType LM math
-    font is released)
-  * Documentation for which was which of epsilon/varepsilon was backwards!
-    (thank to Rasmus Villemoes for pointing this out)
-  * Spurious `\upUpsilon` removed (the one at U+03A5 is now the correct one)
-  * Typo when defining `\dprime` fixed
-    (thanks to Ulrik Vieth for these last two)
-  * Fix the math class of `\modtwosum`; it is now a large operator
-    (thanks to Michael Ummels)
-  * Move several LuaTeX-related patches to the `lualatex-math` package
-  * Fixed mathtool's `\cramped` in XeLaTeX usage
-
-- v0.5d (2011/01/30)
-
-  * Assorted improvements to LuaLaTeX support, including non-growing accents
-    available in LuaTeX v0.65 and later
-  * Improved behaviour with reading and using maths font dimensions
-  * Better compatibility with legacy maths packages and environments
-    (always more worked needed, though)
-  * Fix the default setting for "vargreek-shape"
-
-- v0.5c (2010/09/27)
-
-  * Fix a long-standing bug in XeLaTeX in which the "master" math
-    families 2 and 3 weren't being set; hence fraction rules and many other
-    parameters were not being set correctly
-  * Stay in sync with internal fontspec changes
-
-- v0.5b (2010/09/19): Tune-up
-
-  * Added missing symbols/synonyms:
-      \diamond  \smallint  \emptyset  \hbar  \backepsilon  \eth
-  * \overline works for LuaLaTeX
-  * Fix \slash; previously, it overwrote the text definition
-  * \vartriangle now has the correct math class
-
-- v0.5a (2010/07/14): TeX Live 2010 release
-
-  * Numerous documentation improvements
-  * Bug fix against stray catcode changes
-  * Add `\mathcal` and `\mathbfcal` as distinct from the Script style;
-    these are only supported by the XITS fonts at present
-  * Small changes to the range of symbols offered (especially note that `\ac`
-    is now `\invlazys` to avoid acronym package clash)
-  * Superscripts are allowed after primes (as they should be)
-  * Numerous LuaLaTeX improvements, including roots and over/under braces.
-
-- v0.5 (2010/06/03): Initial CTAN release
-
-
 LICENCE
 -------
 
@@ -294,7 +90,8 @@
 
 This work is author-maintained and consists of the files
 
-- unicode-math*.dtx,
+- unicode-math.dtx,
+- unicode-math-*.dtx,
 - unicode-math-table.tex,
 - unimath-example.ltx,
 - unimath-symbols.ltx,
@@ -303,6 +100,8 @@
 the derived files
 
 - unicode-math.lua,
+- unicode-math-xetex.sty,
+- unicode-math-luatex.sty,
 - unicode-math.sty;
 
 the compiled documentation files

Modified: trunk/Master/texmf-dist/doc/latex/unicode-math/unicode-math-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/unicode-math/unicode-math-doc.tex	2017-10-02 21:58:27 UTC (rev 45452)
+++ trunk/Master/texmf-dist/doc/latex/unicode-math/unicode-math-doc.tex	2017-10-02 21:58:46 UTC (rev 45453)
@@ -212,60 +212,67 @@
 
 Load \pkg{unicode-math} as a regular \LaTeX\ package. It should be loaded
 after any other maths or font-related package in case it needs to overwrite
-their definitions. Here's an example:
+their definitions. Here's an example using the filename syntax to load the \TeX\ Gyre Pagella Math font: (this works for both \XeLaTeX\ and \LuaLaTeX)
 \begin{Verbatim}
 \usepackage{amsmath} % if desired
 \usepackage{unicode-math}
-\setmathfont{Asana-Math.otf}
+\setmathfont{texgyrepagella-math.otf}
 \end{Verbatim}
-Three OpenType maths fonts are included by default in \TeX\ Live 2011:
-Latin Modern Math, Asana Math, and XITS Math.
-These can be loaded directly with their filename
-with both \XeLaTeX\ and \LuaLaTeX; resp.,
-\begin{Verbatim}
-\setmathfont{latinmodern-math.otf}
-\setmathfont{Asana-Math.otf}
-\setmathfont{xits-math.otf}
-\end{Verbatim}
-Other OpenType maths fonts may be loaded in the usual way; please see the
-\pkg{fontspec} documentation for more information.
 
-Once the package is loaded, traditional TFM-based fonts are not supported any more;
-you can only switch to a different OpenType math font using the \cs{setmathfont} command.
+Once the package is loaded, traditional TFM-based maths fonts are no longer supported;
+you can only switch to a different OpenType maths font using the \cs{setmathfont} command.
 If you do not load an OpenType maths font before |\begin{document}|, Latin Modern Math (see above) will be loaded automatically.
 
 \subsection{New commands}
-\textbf{New v0.8:}
-\pkg{unicode-math} provides the following commands to select specific `alphabets' within the unicode maths font: (usage, e.g.: |$\symbfsf{g}$|${}\to\symbfsf{g}$)
-\begin{quote}
-\ExplSyntaxOn
-\clist_map_inline:nn {
-  normal, literal, up, bfup, bfit, sfup, sfit, bfsfup, bfsfit, bfsf,
-  bb, bbit, scr, bfscr, cal, bfcal, frak, bffrak,
-  up, sf, bf, tt, it,
-  }{\cs{sym#1}~}
-\ExplSyntaxOff
-\end{quote}
-Many of these are also defined with `familiar' synonyms:
-\begin{quote}
-\ExplSyntaxOn
-\clist_map_inline:nn {
-   normal, bb, bbit, scr, bfscr, cal, bfcal, frak, bffrak,
-   bfup, bfit, sfup, sfit, bfsfup, bfsfit, bfsf
-  }{\mbox{\cs{math#1}}~}
-\ExplSyntaxOff
-\end{quote}
-So what about \cs{mathup}, \cs{mathit}, \cs{mathbf}, \cs{mathsf}, and \cs{mathtt}?
+\pkg{unicode-math} provides a number of commands (such as |\symbfsf|) to select specific `symbol alphabets' within the unicode maths font, with usage, e.g., |$\symbfsf{g}$|${}\to\symbfsf{g}$.
+The full listing is shown in \Tabref{symvsmath}.
+For backwards compatibility, many of these are also defined with `familiar' synonyms such as |\mathbfsf|.
+However, where possible the `sym' prefix commands should be preferred, as certain synonyms may become deprecated in time.
+
+\begin{table}\centering
+  \topcaption{New \pkg{unicode-math} commands.}
+  \tablabel{symvsmath}
+  \begin{tabular}{lll}
+    \toprule
+    \pkg{unicode-math} command & Synonym \\
+    \midrule
+    |\symup|      &               \\
+    |\symit|      &               \\
+    |\symbf|      &               \\
+    |\symsf|      &               \\
+    |\symtt|      &               \\
+    \midrule
+    |\symnormal|  & |\mathnormal| \\
+    |\symliteral| &               \\
+    |\symbfup|    & |\mathbfup|   \\
+    |\symbfit|    & |\mathbfit|   \\
+    |\symsfup|    & |\mathsfup|   \\
+    |\symsfit|    & |\mathsfit|   \\
+    |\symbfsfup|  & |\mathbfsfup| \\
+    |\symbfsfit|  & |\mathbfsfit| \\
+    |\symbfsf|    & |\mathbfsf|   \\
+    |\symbb|      & |\mathbb|     \\
+    |\symbbit|    & |\mathbbit|   \\
+    |\symscr|     & |\mathscr|    \\
+    |\symbfscr|   & |\mathbfscr|  \\
+    |\symcal|     & |\mathcal|    \\
+    |\symbfcal|   & |\mathbfcal|  \\
+    |\symfrak|    & |\mathfrak|   \\
+    |\symbffrak|  & |\mathbffrak| \\
+    \bottomrule
+  \end{tabular}
+\end{table}
+
+While most alphabet commands are provided with the \cs{math...} prefix synonyms, there are five `legacy' font alphabets that intentionally behave somewhat different.
+These are \cs{mathup}, \cs{mathit}, \cs{mathbf}, \cs{mathsf}, and \cs{mathtt}.
 (N.B.: \cs{mathrm} is defined as a synonym for \cs{mathup}, but the latter is prefered as it is a script-agnostic term.)
-These commands have `overloaded' meanings in \LaTeX, and it's important to consider the subtle differences between, e.g., \cs{symbf} and \cs{mathbf}.
-The former switches to single-letter mathematical symbols, whereas the second switches to a text font that behaves correctly in mathematics but should be used for multi-letter identifiers.
-These four commands (and \cs{mathrm}) are defined in the traditional \LaTeX\ manner.
-Further details are discussed in \secref{mathselect}.
 
-Additional similar commands can be defined using
-\begin{Verbatim}
-\setmathfontface\mathfoo{...}
-\end{Verbatim}
+These commands have `overloaded' meanings in traditional \LaTeX, and it's important to consider the subtle differences between, e.g., the new \cs{symbf} and \cs{mathbf}.
+The \cs{symbf} command switches to single-letter mathematical symbols (generally within the same OpenType font).
+The \cs{mathbf} command switches to a text font that is set up to behave correctly in mathematics, and should be used for multi-letter identifiers.
+These could be denoted `text math alphabets'; further details are discussed in \secref{mathselect}.
+Additional similar `text math alphabet' commands can be defined using the \cs{setmathfontface} command discussed in \secref{mathselect}.
+To control the behaviour of the default text math alphabet commands to behave in a backwards-compatible mode, see the package options described in \secref{textmathlegacy}.
 
 \subsection{Package options}
 Package options may be set when the package as loaded or at any later
@@ -291,7 +298,7 @@
 \setmathfont{Cambria Math}[math-style=TeX]
 \end{Verbatim}
 
-A short list of package options is shown in \tabref{pkgopt}.
+A summary list of package options is shown in \tabref{pkgopt}.
 See following sections for more information.
 
 \begin{table}\centering
@@ -477,7 +484,7 @@
 The five `text math' fonts, discussed above, are: \cs{mathrm}, \cs{mathbf}, \cs{mathit}, \cs{mathsf}, and \cs{mathtt}.
 These commands are also defined with their original definition under synonyms \cs{mathtextrm}, \cs{mathtextbf}, and so on.
 
-When selecting document fonts using \pkg{fontspec} commands such as \cs{setmainfont}, \pkg{unicode-math} inserts some additional that keeps the current default fonts `in sync' with their corresponding \cs{mathrm} commands, etc.
+When selecting document fonts using \pkg{fontspec} commands such as \cs{setmainfont}, \pkg{unicode-math} inserts some additional code into \pkg{fontspec} that keeps the current default fonts `in sync' with their corresponding \cs{mathrm} commands, etc.
 
 For example, in standard \LaTeX, \cs{mathsf} doesn't change even if the main document font is changed using |\renewcommand\sfdefault{...}|. With \pkg{unicode-math} loaded, after writing |\setsansfont{Helvetica}|, \cs{mathsf} will now be set in Helvetica.
 
@@ -485,6 +492,7 @@
 
 
 \subsubsection{Replacing `text math' fonts by symbols}
+\seclabel{textmathlegacy}
 
 For certain types of documents that use legacy input syntax (say you're typesetting a new version of a book written in the 1990s), it would be preferable to use |\symbf| rather than |\mathbf| en masse.
 For example, if bold maths is used only for vectors and matrices, a dedicated symbol font will produce better spacing and will better match the main math font.
@@ -510,9 +518,7 @@
   \end{tabular}
 \end{table}
 
-A `smart' macro is intended for a future version of \pkg{unicode-math} that can automatically distinguish between single- and multi-letter arguments to \cs{mathbf} and use either the maths symbol or the `text math' font as appropriate.
 
-
 \subsubsection{Operator font}
 
 \LaTeX\ defines an internal command \cs{operator at font} for typesetting elements such as |\sin| and |\cos|.

Modified: trunk/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.ltx
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf
===================================================================
(Binary files differ)

Added: trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-epilogue.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-epilogue.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-epilogue.dtx	2017-10-02 21:58:46 UTC (rev 45453)
@@ -0,0 +1,883 @@
+
+% \section{Epilogue}
+%
+%    \begin{macrocode}
+%<*package&(XE|LU)>
+%    \end{macrocode}
+%
+% Lots of little things to tidy up.
+%
+% \subsection{Primes}
+%
+% We need a new `prime' algorithm. Unicode math has four pre-drawn prime glyphs.
+% \begin{quote}\obeylines
+% \unichar{2032} {prime} (\cs{prime}): $x\prime$
+% \unichar{2033} {double prime} (\cs{dprime}): $x\dprime$
+% \unichar{2034} {triple prime} (\cs{trprime}): $x\trprime$
+% \unichar{2057} {quadruple prime} (\cs{qprime}): $x\qprime$
+% \end{quote}
+% As you can see, they're all drawn at the correct height without being superscripted.
+% However, in a correctly behaving OpenType font,
+% we also see different behaviour after the \texttt{ssty} feature is applied:
+% \begin{quote}
+% \font\1="Cambria Math:script=math,+ssty=0"\1
+% \char"1D465\char"2032\quad
+% \char"1D465\char"2033\quad
+% \char"1D465\char"2034\quad
+% \char"1D465\char"2057
+% \end{quote}
+% The glyphs are now `full size' so that when placed inside a superscript,
+% their shape will match the originally sized ones. Many thanks to Ross Mills
+% of Tiro Typeworks for originally pointing out this behaviour.
+%
+% In regular \LaTeX, primes can be entered with the straight quote character
+% |'|, and multiple straight quotes chain together to produce multiple
+% primes. Better results can be achieved in \pkg{unicode-math} by chaining
+% multiple single primes into a pre-drawn multi-prime glyph; consider
+% $x\prime{}\prime{}\prime$ vs.\ $x\trprime$.
+%
+% For Unicode maths, we wish to conserve this behaviour and augment it with
+% the possibility of adding any combination of Unicode prime or any of the
+% $n$-prime characters. E.g., the user might copy-paste a double prime from
+% another source and then later type another single prime after it; the output
+% should be the triple prime.
+%
+% Our algorithm is:
+% \begin{itemize}[nolistsep]
+% \item Prime encountered; pcount=1.
+% \item Scan ahead; if prime: pcount:=pcount+1; repeat.
+% \item If not prime, stop scanning.
+% \item If pcount=1, \cs{prime}, end.
+% \item If pcount=2, check \cs{dprime}; if it exists, use it, end; if not, goto last step.
+% \item Ditto pcount=3 \& \cs{trprime}.
+% \item Ditto pcount=4 \& \cs{qprime}.
+% \item If pcount>4 or the glyph doesn't exist, insert pcount \cs{prime}s with \cs{primekern} between each.
+% \end{itemize}
+%
+% This is a wrapper to insert a superscript; if there is a subsequent
+% trailing superscript, then it is included within the insertion.
+%    \begin{macrocode}
+\cs_new:Nn \@@_arg_i_before_egroup:n {#1\egroup}
+\cs_new:Nn \@@_superscript:n
+ {
+  ^\bgroup #1
+  \peek_meaning_remove:NTF ^ \@@_arg_i_before_egroup:n \egroup
+ }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\cs_new:Nn \@@_nprimes:Nn
+ {
+  \@@_superscript:n
+   {
+    #1
+    \prg_replicate:nn {#2-1} { \mskip \g_@@_primekern_muskip #1 }
+   }
+ }
+
+\cs_new:Nn \@@_nprimes_select:nn
+ {
+  \int_case:nnF {#2}
+   {
+    {1} { \@@_superscript:n {#1} }
+    {2} {
+      \@@_glyph_if_exist:nTF {"2033}
+        { \@@_superscript:n {\@@_prime_double_mchar} }
+        { \@@_nprimes:Nn #1 {#2} }
+    }
+    {3} {
+      \@@_glyph_if_exist:nTF {"2034}
+        { \@@_superscript:n {\@@_prime_triple_mchar} }
+        { \@@_nprimes:Nn #1 {#2} }
+    }
+    {4} {
+      \@@_glyph_if_exist:nTF {"2057}
+        { \@@_superscript:n {\@@_prime_quad_mchar} }
+        { \@@_nprimes:Nn #1 {#2} }
+    }
+   }
+   {
+    \@@_nprimes:Nn #1 {#2}
+   }
+ }
+\cs_new:Nn \@@_nbackprimes_select:nn
+ {
+  \int_case:nnF {#2}
+   {
+    {1} { \@@_superscript:n {#1} }
+    {2} {
+      \@@_glyph_if_exist:nTF {"2036}
+        { \@@_superscript:n {\@@_backprime_double_mchar} }
+        { \@@_nprimes:Nn #1 {#2} }
+    }
+    {3} {
+      \@@_glyph_if_exist:nTF {"2037}
+        { \@@_superscript:n {\@@_backprime_triple_mchar} }
+        { \@@_nprimes:Nn #1 {#2} }
+    }
+   }
+   {
+    \@@_nprimes:Nn #1 {#2}
+   }
+ }
+%    \end{macrocode}
+%
+% Scanning is annoying because I'm too lazy to do it for the general case.
+%
+%    \begin{macrocode}
+\cs_new:Npn \@@_scan_prime:
+ {
+  \cs_set_eq:NN \@@_superscript:n \use:n
+  \int_zero:N \l_@@_primecount_int
+  \@@_scanprime_collect:N \@@_prime_single_mchar
+ }
+\cs_new:Npn \@@_scan_dprime:
+ {
+  \cs_set_eq:NN \@@_superscript:n \use:n
+  \int_set:Nn \l_@@_primecount_int {1}
+  \@@_scanprime_collect:N \@@_prime_single_mchar
+ }
+\cs_new:Npn \@@_scan_trprime:
+ {
+  \cs_set_eq:NN \@@_superscript:n \use:n
+  \int_set:Nn \l_@@_primecount_int {2}
+  \@@_scanprime_collect:N \@@_prime_single_mchar
+ }
+\cs_new:Npn \@@_scan_qprime:
+ {
+  \cs_set_eq:NN \@@_superscript:n \use:n
+  \int_set:Nn \l_@@_primecount_int {3}
+  \@@_scanprime_collect:N \@@_prime_single_mchar
+ }
+\cs_new:Npn \@@_scan_sup_prime:
+ {
+  \int_zero:N \l_@@_primecount_int
+  \@@_scanprime_collect:N \@@_prime_single_mchar
+ }
+\cs_new:Npn \@@_scan_sup_dprime:
+ {
+  \int_set:Nn \l_@@_primecount_int {1}
+  \@@_scanprime_collect:N \@@_prime_single_mchar
+ }
+\cs_new:Npn \@@_scan_sup_trprime:
+ {
+  \int_set:Nn \l_@@_primecount_int {2}
+  \@@_scanprime_collect:N \@@_prime_single_mchar
+ }
+\cs_new:Npn \@@_scan_sup_qprime:
+ {
+  \int_set:Nn \l_@@_primecount_int {3}
+  \@@_scanprime_collect:N \@@_prime_single_mchar
+ }
+\cs_new:Nn \@@_scanprime_collect:N
+ {
+  \int_incr:N \l_@@_primecount_int
+  \peek_meaning_remove:NTF '
+   { \@@_scanprime_collect:N #1 }
+   {
+    \peek_meaning_remove:NTF \@@_scan_prime:
+     { \@@_scanprime_collect:N #1 }
+     {
+      \peek_meaning_remove:NTF ^^^^2032
+       { \@@_scanprime_collect:N #1 }
+       {
+        \peek_meaning_remove:NTF \@@_scan_dprime:
+         {
+          \int_incr:N \l_@@_primecount_int
+          \@@_scanprime_collect:N #1
+         }
+         {
+          \peek_meaning_remove:NTF ^^^^2033
+           {
+            \int_incr:N \l_@@_primecount_int
+            \@@_scanprime_collect:N #1
+           }
+           {
+            \peek_meaning_remove:NTF \@@_scan_trprime:
+             {
+              \int_add:Nn \l_@@_primecount_int {2}
+              \@@_scanprime_collect:N #1
+             }
+             {
+              \peek_meaning_remove:NTF ^^^^2034
+               {
+                \int_add:Nn \l_@@_primecount_int {2}
+                \@@_scanprime_collect:N #1
+               }
+               {
+                \peek_meaning_remove:NTF \@@_scan_qprime:
+                 {
+                  \int_add:Nn \l_@@_primecount_int {3}
+                  \@@_scanprime_collect:N #1
+                 }
+                 {
+                  \peek_meaning_remove:NTF ^^^^2057
+                   {
+                    \int_add:Nn \l_@@_primecount_int {3}
+                    \@@_scanprime_collect:N #1
+                   }
+                   {
+                    \@@_nprimes_select:nn {#1} {\l_@@_primecount_int}
+                   }
+                 }
+               }
+             }
+           }
+         }
+       }
+     }
+   }
+ }
+\cs_new:Npn \@@_scan_backprime:
+ {
+  \cs_set_eq:NN \@@_superscript:n \use:n
+  \int_zero:N \l_@@_primecount_int
+  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
+ }
+\cs_new:Npn \@@_scan_backdprime:
+ {
+  \cs_set_eq:NN \@@_superscript:n \use:n
+  \int_set:Nn \l_@@_primecount_int {1}
+  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
+ }
+\cs_new:Npn \@@_scan_backtrprime:
+ {
+  \cs_set_eq:NN \@@_superscript:n \use:n
+  \int_set:Nn \l_@@_primecount_int {2}
+  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
+ }
+\cs_new:Npn \@@_scan_sup_backprime:
+ {
+  \int_zero:N \l_@@_primecount_int
+  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
+ }
+\cs_new:Npn \@@_scan_sup_backdprime:
+ {
+  \int_set:Nn \l_@@_primecount_int {1}
+  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
+ }
+\cs_new:Npn \@@_scan_sup_backtrprime:
+ {
+  \int_set:Nn \l_@@_primecount_int {2}
+  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
+ }
+\cs_new:Nn \@@_scanbackprime_collect:N
+ {
+  \int_incr:N \l_@@_primecount_int
+  \peek_meaning_remove:NTF `
+   {
+    \@@_scanbackprime_collect:N #1
+   }
+   {
+    \peek_meaning_remove:NTF \@@_scan_backprime:
+     {
+      \@@_scanbackprime_collect:N #1
+     }
+     {
+      \peek_meaning_remove:NTF ^^^^2035
+       {
+        \@@_scanbackprime_collect:N #1
+       }
+       {
+        \peek_meaning_remove:NTF \@@_scan_backdprime:
+         {
+          \int_incr:N \l_@@_primecount_int
+          \@@_scanbackprime_collect:N #1
+         }
+         {
+          \peek_meaning_remove:NTF ^^^^2036
+           {
+            \int_incr:N \l_@@_primecount_int
+            \@@_scanbackprime_collect:N #1
+           }
+           {
+            \peek_meaning_remove:NTF \@@_scan_backtrprime:
+             {
+              \int_add:Nn \l_@@_primecount_int {2}
+              \@@_scanbackprime_collect:N #1
+             }
+             {
+              \peek_meaning_remove:NTF ^^^^2037
+               {
+                \int_add:Nn \l_@@_primecount_int {2}
+                \@@_scanbackprime_collect:N #1
+               }
+               {
+                \@@_nbackprimes_select:nn {#1} {\l_@@_primecount_int}
+               }
+             }
+           }
+         }
+       }
+     }
+   }
+ }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\AtBeginDocument{\@@_define_prime_commands: \@@_define_prime_chars:}
+\cs_new:Nn \@@_define_prime_commands:
+ {
+  \cs_set_eq:NN \prime       \@@_prime_single_mchar
+  \cs_set_eq:NN \dprime      \@@_prime_double_mchar
+  \cs_set_eq:NN \trprime     \@@_prime_triple_mchar
+  \cs_set_eq:NN \qprime      \@@_prime_quad_mchar
+  \cs_set_eq:NN \backprime   \@@_backprime_single_mchar
+  \cs_set_eq:NN \backdprime  \@@_backprime_double_mchar
+  \cs_set_eq:NN \backtrprime \@@_backprime_triple_mchar
+ }
+\group_begin:
+  \char_set_catcode_active:N \'
+  \char_set_catcode_active:N \`
+  \char_set_catcode_active:n {"2032}
+  \char_set_catcode_active:n {"2033}
+  \char_set_catcode_active:n {"2034}
+  \char_set_catcode_active:n {"2057}
+  \char_set_catcode_active:n {"2035}
+  \char_set_catcode_active:n {"2036}
+  \char_set_catcode_active:n {"2037}
+  \cs_gset:Nn \@@_define_prime_chars:
+   {
+    \cs_set_eq:NN '        \@@_scan_sup_prime:
+    \cs_set_eq:NN ^^^^2032 \@@_scan_sup_prime:
+    \cs_set_eq:NN ^^^^2033 \@@_scan_sup_dprime:
+    \cs_set_eq:NN ^^^^2034 \@@_scan_sup_trprime:
+    \cs_set_eq:NN ^^^^2057 \@@_scan_sup_qprime:
+    \cs_set_eq:NN `        \@@_scan_sup_backprime:
+    \cs_set_eq:NN ^^^^2035 \@@_scan_sup_backprime:
+    \cs_set_eq:NN ^^^^2036 \@@_scan_sup_backdprime:
+    \cs_set_eq:NN ^^^^2037 \@@_scan_sup_backtrprime:
+   }
+\group_end:
+%    \end{macrocode}
+%
+% \subsection{Unicode radicals}
+%
+% Make sure \cs{Uroot} is defined in the case where the \LaTeX{}
+% kernel doesn't make it available with its native name.
+%    \begin{macrocode}
+%<*LU>
+\cs_if_exist:NF \Uroot
+  { \cs_new_eq:NN \Uroot \luatexUroot }
+%</LU>
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\AtBeginDocument{\@@_redefine_radical:}
+\cs_new:Nn \@@_redefine_radical:
+%<*XE>
+ {
+  \@ifpackageloaded { amsmath } { }
+   {
+%    \end{macrocode}
+% \begin{macro}{\r@@t}
+% \darg{A mathstyle (for \cmd\mathpalette)}
+% \darg{Leading superscript for the sqrt sign}
+% A re-implementation of \LaTeX's hard-coded n-root sign using the appropriate \cmd\fontdimen s.
+%    \begin{macrocode}
+    \cs_set_nopar:Npn \r@@@@t ##1 ##2
+     {
+      \hbox_set:Nn \l_tmpa_box
+       {
+        \c_math_toggle_token
+        \m at th
+        ##1
+        \sqrtsign { ##2 }
+        \c_math_toggle_token
+       }
+      \@@_mathstyle_scale:Nnn ##1 { \kern }
+       { \fontdimen 63 \l_@@_font }
+      \box_move_up:nn
+       {
+        (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box)
+        * \number \fontdimen 65 \l_@@_font / 100
+       }
+       { \box_use:N \rootbox }
+      \@@_mathstyle_scale:Nnn ##1 { \kern }
+       { \fontdimen 64 \l_@@_font }
+      \box_use_clear:N \l_tmpa_box
+     }
+%    \end{macrocode}
+% \end{macro}
+%    \begin{macrocode}
+   }
+ }
+%</XE>
+%<*LU>
+ {
+  \@ifpackageloaded { amsmath } { }
+   {
+%    \end{macrocode}
+% \begin{macro}{\root}
+% Redefine this macro for \LuaTeX, which provides us a nice primitive to use.
+%    \begin{macrocode}
+    \cs_set:Npn \root ##1 \of ##2
+     {
+       \Uroot \l_@@_radical_sqrt_tl { ##1 } { ##2 }
+     }
+%    \end{macrocode}
+% \end{macro}
+%    \begin{macrocode}
+   }
+ }
+%</LU>
+%    \end{macrocode}
+%
+%
+% \begin{macro}{\@@_fontdimen_to_percent:nn}
+% \begin{macro}{\@@_fontdimen_to_scale:nn}
+% \darg{Font dimen number}
+% \darg{Font `variable'}
+% \cmd\fontdimen s |10|, |11|, and |65| aren't actually dimensions, they're percentage values given in units of |sp|.
+% \cs{@@_fontdimen_to_percent:nn} takes a font dimension number and outputs the decimal value of the associated parameter.
+% \cs{@@_fontdimen_to_scale:nn} returns a dimension correspond to the current
+% font size relative proportion based on that percentage.
+%    \begin{macrocode}
+\cs_new:Nn \@@_fontdimen_to_percent:nn
+ {
+  \fp_eval:n { \dim_to_decimal:n { \fontdimen #1 #2 } * 65536 / 100 }
+ }
+\cs_new:Nn \@@_fontdimen_to_scale:nn
+ {
+  \fp_eval:n {\@@_fontdimen_to_percent:nn {#1} {#2} * \f at size } pt
+ }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \begin{macro}{\@@_mathstyle_scale:Nnn}
+% \darg{A math style (\cs{scriptstyle}, say)}
+% \darg{Macro that takes a non-delimited length argument (like \cmd\kern)}
+% \darg{Length control sequence to be scaled according to the math style}
+% This macro is used to scale the lengths reported by \cmd\fontdimen\ according to the scale factor for script- and scriptscript-size objects.
+%    \begin{macrocode}
+\cs_new:Nn \@@_mathstyle_scale:Nnn
+ {
+  \ifx#1\scriptstyle
+    #2 \@@_fontdimen_to_percent:nn {10} \l_@@_font #3
+  \else
+    \ifx#1\scriptscriptstyle
+      #2 \@@_fontdimen_to_percent:nn {11} \l_@@_font #3
+    \else
+      #2 #3
+    \fi
+  \fi
+ }
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsection{Unicode sub- and super-scripts}
+%
+% The idea here is to enter a scanning state after a superscript or subscript
+% is encountered.
+% If subsequent superscripts or subscripts (resp.) are found,
+% they are lumped together.
+% Each sub/super has a corresponding regular size
+% glyph which is used by \XeTeX\ to typeset the results; this means that the
+% actual subscript/superscript glyphs are never seen in the output
+% document~--- they are only used as input characters.
+%
+% Open question: should the superscript-like `modifiers' (\unichar{1D2C}
+% {modifier capital letter a} and on) be included here?
+%    \begin{macrocode}
+\group_begin:
+%    \end{macrocode}
+% \paragraph{Superscripts}
+% Populate a property list with superscript characters; themselves as their
+% key, and their replacement as each key's value.
+% Then make the superscript active and bind it to the scanning function.
+%
+% \cs{scantokens} makes this process much simpler since we can activate the
+% char and assign its meaning in one step.
+%    \begin{macrocode}
+\cs_new:Nn \@@_setup_active_superscript:nn
+ {
+  \prop_gput:Nnn \g_@@_supers_prop   {#1} {#2}
+  \char_set_catcode_active:N #1
+  \@@_char_gmake_mathactive:N #1
+  \scantokens
+   {
+    \cs_gset:Npn #1
+     {
+      \tl_set:Nn \l_@@_ss_chain_tl {#2}
+      \cs_set_eq:NN \@@_sub_or_super:n \sp
+      \tl_set:Nn \l_@@_tmpa_tl {supers}
+      \@@_scan_sscript:
+     }
+   }
+ }
+%    \end{macrocode}
+% Bam:
+%    \begin{macrocode}
+\@@_setup_active_superscript:nn {^^^^2070} {0}
+\@@_setup_active_superscript:nn {^^^^00b9} {1}
+\@@_setup_active_superscript:nn {^^^^00b2} {2}
+\@@_setup_active_superscript:nn {^^^^00b3} {3}
+\@@_setup_active_superscript:nn {^^^^2074} {4}
+\@@_setup_active_superscript:nn {^^^^2075} {5}
+\@@_setup_active_superscript:nn {^^^^2076} {6}
+\@@_setup_active_superscript:nn {^^^^2077} {7}
+\@@_setup_active_superscript:nn {^^^^2078} {8}
+\@@_setup_active_superscript:nn {^^^^2079} {9}
+\@@_setup_active_superscript:nn {^^^^207a} {+}
+\@@_setup_active_superscript:nn {^^^^207b} {-}
+\@@_setup_active_superscript:nn {^^^^207c} {=}
+\@@_setup_active_superscript:nn {^^^^207d} {(}
+\@@_setup_active_superscript:nn {^^^^207e} {)}
+\@@_setup_active_superscript:nn {^^^^2071} {i}
+\@@_setup_active_superscript:nn {^^^^207f} {n}
+\@@_setup_active_superscript:nn {^^^^02b0} {h}
+\@@_setup_active_superscript:nn {^^^^02b2} {j}
+\@@_setup_active_superscript:nn {^^^^02b3} {r}
+\@@_setup_active_superscript:nn {^^^^02b7} {w}
+\@@_setup_active_superscript:nn {^^^^02b8} {y}
+%    \end{macrocode}
+% \paragraph{Subscripts} Ditto above.
+%    \begin{macrocode}
+\cs_new:Nn \@@_setup_active_subscript:nn
+ {
+  \prop_gput:Nnn \g_@@_subs_prop   {#1} {#2}
+  \char_set_catcode_active:N #1
+  \@@_char_gmake_mathactive:N #1
+  \scantokens
+   {
+    \cs_gset:Npn #1
+     {
+      \tl_set:Nn \l_@@_ss_chain_tl {#2}
+      \cs_set_eq:NN \@@_sub_or_super:n \sb
+      \tl_set:Nn \l_@@_tmpa_tl {subs}
+      \@@_scan_sscript:
+     }
+   }
+ }
+%    \end{macrocode}
+% A few more subscripts than superscripts:
+%    \begin{macrocode}
+\@@_setup_active_subscript:nn {^^^^2080} {0}
+\@@_setup_active_subscript:nn {^^^^2081} {1}
+\@@_setup_active_subscript:nn {^^^^2082} {2}
+\@@_setup_active_subscript:nn {^^^^2083} {3}
+\@@_setup_active_subscript:nn {^^^^2084} {4}
+\@@_setup_active_subscript:nn {^^^^2085} {5}
+\@@_setup_active_subscript:nn {^^^^2086} {6}
+\@@_setup_active_subscript:nn {^^^^2087} {7}
+\@@_setup_active_subscript:nn {^^^^2088} {8}
+\@@_setup_active_subscript:nn {^^^^2089} {9}
+\@@_setup_active_subscript:nn {^^^^208a} {+}
+\@@_setup_active_subscript:nn {^^^^208b} {-}
+\@@_setup_active_subscript:nn {^^^^208c} {=}
+\@@_setup_active_subscript:nn {^^^^208d} {(}
+\@@_setup_active_subscript:nn {^^^^208e} {)}
+\@@_setup_active_subscript:nn {^^^^2090} {a}
+\@@_setup_active_subscript:nn {^^^^2091} {e}
+\@@_setup_active_subscript:nn {^^^^2095} {h}
+\@@_setup_active_subscript:nn {^^^^1d62} {i}
+\@@_setup_active_subscript:nn {^^^^2c7c} {j}
+\@@_setup_active_subscript:nn {^^^^2096} {k}
+\@@_setup_active_subscript:nn {^^^^2097} {l}
+\@@_setup_active_subscript:nn {^^^^2098} {m}
+\@@_setup_active_subscript:nn {^^^^2099} {n}
+\@@_setup_active_subscript:nn {^^^^2092} {o}
+\@@_setup_active_subscript:nn {^^^^209a} {p}
+\@@_setup_active_subscript:nn {^^^^1d63} {r}
+\@@_setup_active_subscript:nn {^^^^209b} {s}
+\@@_setup_active_subscript:nn {^^^^209c} {t}
+\@@_setup_active_subscript:nn {^^^^1d64} {u}
+\@@_setup_active_subscript:nn {^^^^1d65} {v}
+\@@_setup_active_subscript:nn {^^^^2093} {x}
+\@@_setup_active_subscript:nn {^^^^1d66} {\beta}
+\@@_setup_active_subscript:nn {^^^^1d67} {\gamma}
+\@@_setup_active_subscript:nn {^^^^1d68} {\rho}
+\@@_setup_active_subscript:nn {^^^^1d69} {\phi}
+\@@_setup_active_subscript:nn {^^^^1d6a} {\chi}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\group_end:
+%    \end{macrocode}
+% The scanning command, which collects a chain of subscripts or a chain
+% of superscripts and then typesets what it has collected.
+%    \begin{macrocode}
+\cs_new:Npn \@@_scan_sscript:
+ {
+  \@@_scan_sscript:TF
+   {
+    \@@_scan_sscript:
+   }
+   {
+    \@@_sub_or_super:n {\l_@@_ss_chain_tl}
+   }
+ }
+%    \end{macrocode}
+% We do not skip spaces when scanning ahead, and we explicitly wish to
+% bail out on encountering a space or a brace.  These cases are filtered
+% using \cs{peek_N_type:TF}.  Otherwise the token can be taken as an
+% \texttt{N}-type argument.  Then we search for it in the appropriate
+% property list (\cs{l_@@_tmpa_tl} is |subs| or |supers|).
+% If found, add the value to the current chain of sub/superscripts.
+% Remember to put the character back in the input otherwise.
+% The \cs{group_align_safe_begin:} and \cs{group_align_safe_end:} are
+% needed in case |#3| is |&|.
+%    \begin{macrocode}
+\cs_new:Npn \@@_scan_sscript:TF #1#2
+ {
+  \peek_N_type:TF
+   {
+    \group_align_safe_begin:
+    \@@_scan_sscript_aux:nnN {#1} {#2}
+   }
+   {#2}
+ }
+\cs_new:Npn \@@_scan_sscript_aux:nnN #1#2#3
+ {
+  \prop_get:cnNTF {g_@@_\l_@@_tmpa_tl _prop} {#3} \l_@@_tmpb_tl
+   {
+    \tl_put_right:NV \l_@@_ss_chain_tl \l_@@_tmpb_tl
+    \group_align_safe_end:
+    #1
+   }
+   { \group_align_safe_end: #2 #3 }
+ }
+%    \end{macrocode}
+%
+% \subsubsection{Active fractions}
+% Active fractions can be setup independently of any maths font definition;
+% all it requires is a mapping from the Unicode input chars to the relevant
+% \LaTeX\ fraction declaration.
+%
+%    \begin{macrocode}
+\cs_new:Npn \@@_define_active_frac:Nw #1 #2/#3
+ {
+  \char_set_catcode_active:N #1
+  \@@_char_gmake_mathactive:N #1
+  \tl_rescan:nn
+   {
+    \catcode`\_=11\relax
+    \catcode`\:=11\relax
+   }
+   {
+    \cs_gset:Npx #1
+     {
+      \bool_if:NTF \l_@@_smallfrac_bool {\exp_not:N\tfrac} {\exp_not:N\frac}
+          {#2} {#3}
+     }
+   }
+ }
+%    \end{macrocode}
+% These are redefined for each math font selection in case the |active-frac|
+% feature changes.
+%    \begin{macrocode}
+\cs_new:Npn \@@_setup_active_frac:
+ {
+  \group_begin:
+  \@@_define_active_frac:Nw  ^^^^2189  0/3
+  \@@_define_active_frac:Nw  ^^^^2152  1/{10}
+  \@@_define_active_frac:Nw  ^^^^2151  1/9
+  \@@_define_active_frac:Nw  ^^^^215b  1/8
+  \@@_define_active_frac:Nw  ^^^^2150  1/7
+  \@@_define_active_frac:Nw  ^^^^2159  1/6
+  \@@_define_active_frac:Nw  ^^^^2155  1/5
+  \@@_define_active_frac:Nw  ^^^^00bc  1/4
+  \@@_define_active_frac:Nw  ^^^^2153  1/3
+  \@@_define_active_frac:Nw  ^^^^215c  3/8
+  \@@_define_active_frac:Nw  ^^^^2156  2/5
+  \@@_define_active_frac:Nw  ^^^^00bd  1/2
+  \@@_define_active_frac:Nw  ^^^^2157  3/5
+  \@@_define_active_frac:Nw  ^^^^215d  5/8
+  \@@_define_active_frac:Nw  ^^^^2154  2/3
+  \@@_define_active_frac:Nw  ^^^^00be  3/4
+  \@@_define_active_frac:Nw  ^^^^2158  4/5
+  \@@_define_active_frac:Nw  ^^^^215a  5/6
+  \@@_define_active_frac:Nw  ^^^^215e  7/8
+  \group_end:
+ }
+\@@_setup_active_frac:
+%    \end{macrocode}
+%
+% \subsection{Synonyms and all the rest}
+%
+% These are symbols with multiple names. Eventually to be taken care of
+% automatically by the maths characters database.
+%    \begin{macrocode}
+\protected\def\to{\rightarrow}
+\protected\def\le{\leq}
+\protected\def\ge{\geq}
+\protected\def\neq{\ne}
+\protected\def\triangle{\mathord{\bigtriangleup}}
+\protected\def\bigcirc{\mdlgwhtcircle}
+\protected\def\circ{\vysmwhtcircle}
+\protected\def\bullet{\smblkcircle}
+\protected\def\mathyen{\yen}
+\protected\def\mathsterling{\sterling}
+\protected\def\diamond{\smwhtdiamond}
+\protected\def\emptyset{\varnothing}
+\protected\def\hbar{\hslash}
+\protected\def\land{\wedge}
+\protected\def\lor{\vee}
+\protected\def\owns{\ni}
+\protected\def\gets{\leftarrow}
+\protected\def\mathring{\ocirc}
+\protected\def\lnot{\neg}
+\protected\def\longdivision{\longdivisionsign}
+%    \end{macrocode}
+% These are somewhat odd: (and their usual Unicode uprightness does not match their amssymb glyphs)
+%    \begin{macrocode}
+\protected\def\backepsilon{\upbackepsilon}
+\protected\def\eth{\matheth}
+%    \end{macrocode}
+% These are names that are `frozen' in HTML but have dumb names:
+%    \begin{macrocode}
+\protected\def\dbkarow {\dbkarrow}
+\protected\def\drbkarow{\drbkarrow}
+\protected\def\hksearow{\hksearrow}
+\protected\def\hkswarow{\hkswarrow}
+%    \end{macrocode}
+%
+% Due to the magic of OpenType math, big operators are automatically
+% enlarged when necessary. Since there isn't a separate unicode glyph for
+% `small integral', I'm not sure if there is a better way to do this:
+%    \begin{macrocode}
+\protected\def\smallint{\mathop{\textstyle\int}\limits}
+%    \end{macrocode}
+%
+% \begin{macro}{\underbar}
+%    \begin{macrocode}
+\cs_set_eq:NN \latexe_underbar:n \underbar
+\renewcommand\underbar
+ {
+  \mode_if_math:TF \mathunderbar \latexe_underbar:n
+ }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\colon}
+% Define \cs{colon} as a mathpunct `|:|'.
+% This is wrong: it should be \unichar{003A} {colon} instead!
+% We hope no-one will notice.
+%    \begin{macrocode}
+\@ifpackageloaded{amsmath}
+ {
+  % define their own colon, perhaps I should just steal it. (It does look much better.)
+ }
+ {
+  \cs_set_protected:Npn \colon
+   {
+    \bool_if:NTF \g_@@_literal_colon_bool {:} { \mathpunct{:} }
+   }
+ }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\digamma}
+% \begin{macro}{\Digamma}
+% I might end up just changing these in the table.
+%    \begin{macrocode}
+\protected\def\digamma{\updigamma}
+\protected\def\Digamma{\upDigamma}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \paragraph{Symbols}
+%    \begin{macrocode}
+\cs_set_protected:Npn \| {\Vert}
+%    \end{macrocode}
+% \cs{mathinner} items:
+%    \begin{macrocode}
+\cs_set_protected:Npn \mathellipsis {\mathinner{\unicodeellipsis}}
+\cs_set_protected:Npn \cdots {\mathinner{\unicodecdots}}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\cs_set_eq:NN \@@_text_slash: \slash
+\cs_set_protected:Npn \slash
+ {
+  \mode_if_math:TF {\mathslash} {\@@_text_slash:}
+ }
+%    \end{macrocode}
+%
+% \paragraph{\cs{not}}
+% The situation of \cs{not} symbol is currently messy, in Unicode it is defined
+% as a combining mark so naturally it should be treated as a math accent,
+% however neither Lua\TeX\ nor \XeTeX\ correctly place it as it needs special
+% treatment compared to other accents, furthermore a math accent changes the
+% spacing of its nucleus, so \cs{not=} will be spaced as an ordinary not
+% relational symbol, which is undesired.
+%
+% Here modify \cs{not} to a macro that tries to use predefined negated symbols,
+% which would give better results in most cases, until there is more robust
+% solution in the engines.
+%
+% This code is based on an answer to a TeX -- Stack Exchange question by Enrico
+% Gregorio\footnote{\url{http://tex.stackexchange.com/a/47260/729}}.
+%
+%    \begin{macrocode}
+\cs_new:Npn \@@_newnot:N #1
+ {
+   \tl_set:Nx \l_not_token_name_tl { \token_to_str:N #1 }
+   \exp_args:Nx \tl_if_empty:nF { \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 }
+      }
+      {
+       \@@_oldnot: #1
+      }
+    }
+ }
+%    \end{macrocode}
+%    \begin{macrocode}
+\cs_set_eq:NN \@@_oldnot: \not
+\AtBeginDocument{\cs_set_eq:NN \not \@@_newnot:N}
+%    \end{macrocode}
+%    \begin{macrocode}
+\cs_new_protected_nopar:Nn \@@_setup_negations:
+ {
+  \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 }
+ }
+%    \end{macrocode}
+%
+%
+%
+% \section{Fall-back font}
+%
+% Want to load Latin Modern Math if nothing else.
+% Reset the `font already loaded' boolean so that a new font being set will do the right thing.
+% TODO: need a better way to do this for the general case.
+%    \begin{macrocode}
+\AtBeginDocument { \@@_load_lm_if_necessary: }
+\cs_new:Nn \@@_load_lm_if_necessary:
+  {
+    \cs_if_exist:NF \l_@@_fontname_tl
+      {
+        % TODO: update this when lmmath-bold.otf is released
+        \setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}]
+        \bool_set_false:N \g_@@_mainfont_already_set_bool
+      }
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+%</package&(XE|LU)>
+%    \end{macrocode}
+%
+\endinput
+
+


Property changes on: trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-epilogue.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-preamble.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-preamble.dtx	                        (rev 0)
+++ trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-preamble.dtx	2017-10-02 21:58:46 UTC (rev 45453)
@@ -0,0 +1,618 @@
+
+% \section{Preamble}
+%
+% The prefix for \pkg{unicode-math} is \texttt{um}:
+%    \begin{macrocode}
+%<@@=um>
+%    \end{macrocode}
+%
+% The shared part of the code starts here before the split above.
+%    \begin{macrocode}
+%<*preamble&!XE&!LU>
+%    \end{macrocode}
+%
+% Bail early if using pdf\TeX.
+%    \begin{macrocode}
+\ifdefined\XeTeXversion
+  \ifdim\number\XeTeXversion\XeTeXrevision in<0.9998in%
+    \PackageError{unicode-math}{%
+      Cannot run with this version of XeTeX!\MessageBreak
+      You need XeTeX 0.9998 or newer.%
+    }\@ehd
+  \fi
+\else\ifdefined\luatexversion
+  \ifnum\luatexversion<64%
+    \PackageError{unicode-math}{%
+      Cannot run with this version of LuaTeX!\MessageBreak
+      You need LuaTeX 0.64 or newer.%
+    }\@ehd
+  \fi
+\else
+  \PackageError{unicode-math}{%
+    Cannot be run with pdfLaTeX!\MessageBreak
+    Use XeLaTeX or LuaLaTeX instead.%
+  }\@ehd
+\fi\fi
+%    \end{macrocode}
+%
+% \paragraph{Packages}
+%    \begin{macrocode}
+\RequirePackage{expl3}[2015/03/01]
+\RequirePackage{ucharcat}
+\RequirePackage{xparse}
+\RequirePackage{l3keys2e}
+\RequirePackage{fontspec}[2015/03/14]
+\RequirePackage{fix-cm} % avoid some warnings
+\RequirePackage{filehook}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\ExplSyntaxOn
+%    \end{macrocode}
+%
+% Variants needed from \pkg{expl3}:
+%    \begin{macrocode}
+\cs_set_protected_nopar:Npn \exp_last_unbraced:NNx { \::N \::x_unbraced \::: }
+%    \end{macrocode}
+%
+% For \pkg{fontspec}:
+%    \begin{macrocode}
+\cs_generate_variant:Nn \fontspec_set_family:Nnn {Nx}
+\cs_generate_variant:Nn \fontspec_set_fontface:NNnn {NNx}
+%    \end{macrocode}
+%
+% \paragraph{Conditionals}
+%
+%    \begin{macrocode}
+\bool_new:N \l_@@_ot_math_bool
+\bool_new:N \l_@@_init_bool
+\bool_new:N \l_@@_implicit_alph_bool
+\bool_new:N \g_@@_mainfont_already_set_bool
+%    \end{macrocode}
+% For \opt{math-style}:
+%    \begin{macrocode}
+\bool_new:N \g_@@_literal_bool
+\bool_new:N \g_@@_upLatin_bool
+\bool_new:N \g_@@_uplatin_bool
+\bool_new:N \g_@@_upGreek_bool
+\bool_new:N \g_@@_upgreek_bool
+%    \end{macrocode}
+% For \opt{bold-style}:
+%    \begin{macrocode}
+\bool_new:N \g_@@_bfliteral_bool
+\bool_new:N \g_@@_bfupLatin_bool
+\bool_new:N \g_@@_bfuplatin_bool
+\bool_new:N \g_@@_bfupGreek_bool
+\bool_new:N \g_@@_bfupgreek_bool
+%    \end{macrocode}
+% For \opt{sans-style}:
+%    \begin{macrocode}
+\bool_new:N \g_@@_upsans_bool
+\bool_new:N \g_@@_sfliteral_bool
+%    \end{macrocode}
+% For assorted package options:
+%    \begin{macrocode}
+\bool_new:N \g_@@_upNabla_bool
+\bool_new:N \g_@@_uppartial_bool
+\bool_new:N \g_@@_literal_Nabla_bool
+\bool_new:N \g_@@_literal_partial_bool
+\bool_new:N \l_@@_smallfrac_bool
+\bool_new:N \g_@@_literal_colon_bool
+\bool_new:N \g_@@_mathrm_text_bool
+\bool_new:N \g_@@_mathit_text_bool
+\bool_new:N \g_@@_mathbf_text_bool
+\bool_new:N \g_@@_mathsf_text_bool
+\bool_new:N \g_@@_mathtt_text_bool
+%    \end{macrocode}
+%
+% \paragraph{Variables}
+%    \begin{macrocode}
+\int_new:N \g_@@_fam_int
+%    \end{macrocode}
+%
+% For displaying in warning messages, etc.:
+%    \begin{macrocode}
+\tl_const:Nn \c_@@_math_alphabet_name_latin_tl {Latin,~lowercase}
+\tl_const:Nn \c_@@_math_alphabet_name_Latin_tl {Latin,~uppercase}
+\tl_const:Nn \c_@@_math_alphabet_name_greek_tl {Greek,~lowercase}
+\tl_const:Nn \c_@@_math_alphabet_name_Greek_tl {Greek,~uppercase}
+\tl_const:Nn \c_@@_math_alphabet_name_num_tl   {Numerals}
+\tl_const:Nn \c_@@_math_alphabet_name_misc_tl  {Misc.}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\tl_new:N \l_@@_mathstyle_tl
+%    \end{macrocode}
+%
+% Used to store the font switch for the \cs{operator at font}.
+%    \begin{macrocode}
+\tl_new:N \g_@@_operator_mathfont_tl
+%    \end{macrocode}
+%
+% Variables:
+%    \begin{macrocode}
+\seq_new:N \l_@@_missing_alph_seq
+\seq_new:N \l_@@_mathalph_seq
+\seq_new:N \l_@@_char_range_seq
+\seq_new:N \l_@@_mclass_range_seq
+\seq_new:N \l_@@_cmd_range_seq
+%    \end{macrocode}
+%
+% \begin{macro}{\g_@@_mathclasses_seq}
+% Every math class.
+%    \begin{macrocode}
+\seq_new:N \g_@@_mathclasses_seq
+\seq_set_from_clist:Nn \g_@@_mathclasses_seq
+  {
+    \mathord,\mathalpha,\mathbin,\mathrel,\mathpunct,
+     \mathop,
+    \mathopen,\mathclose,
+    \mathfence,\mathover,\mathunder,
+     \mathaccent,\mathbotaccent,\mathaccentwide,\mathbotaccentwide
+  }
+%    \end{macrocode}
+% \end{macro}
+%
+
+% \begin{macro}{\g_@@_default_mathalph_seq}
+% This sequence stores the alphabets in each math style.
+%    \begin{macrocode}
+\seq_new:N \g_@@_default_mathalph_seq
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\g_@@_mathstyles_seq}
+% This is every `named range' and every `math style' known to \pkg{unicode-math}.
+% A named range is such as "bfit" and "sfit", which are also math styles (with \cs{symbfit} and \cs{symsfit}).
+% `Mathstyles' are a superset of named ranges and also include commands such as \cs{symbf} and \cs{symsf}.
+%
+% N.B. for parsing purposes `named ranges' are defined as strings!
+%    \begin{macrocode}
+\seq_new:N \g_@@_named_ranges_seq
+\seq_new:N \g_@@_mathstyles_seq
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+\muskip_new:N \g_@@_primekern_muskip
+\muskip_gset:Nn \g_@@_primekern_muskip { -\thinmuskip/2 }% arbitrary
+\int_new:N \l_@@_primecount_int
+\prop_new:N \g_@@_supers_prop
+\prop_new:N \g_@@_subs_prop
+\tl_new:N \l_not_token_name_tl
+%    \end{macrocode}
+%
+% \subsection{Extras}
+%
+% What might end up being provided by the kernel.
+%
+% \begin{macro}{\@@_glyph_if_exist:nTF}
+%: TODO: Generalise for arbitrary fonts! \cs{l_@@_font} is not always the one used for a specific glyph!!
+%    \begin{macrocode}
+\prg_new_conditional:Nnn \@@_glyph_if_exist:n {p,TF,T,F}
+ {
+  \etex_iffontchar:D \l_@@_font #1 \scan_stop:
+    \prg_return_true:
+  \else:
+    \prg_return_false:
+  \fi:
+ }
+%    \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\@@_set_mathcode:nnnn}
+% \begin{macro}{\@@_set_mathcode:nnn}
+% \begin{macro}{\@@_set_mathchar:NNnn}
+% \begin{macro}{\@@_set_mathchar:cNnn}
+% \begin{macro}{\@@_set_delcode:nnn}
+% \begin{macro}{\@@_radical:nn}
+% \begin{macro}{\@@_delimiter:Nnn}
+% \begin{macro}{\@@_accent:nnn}
+% \begin{macro}{\@@_accent_keyword:}
+% These are all wrappers for the primitive commands that take numerical
+% input only.
+%    \begin{macrocode}
+\cs_set:Npn \@@_set_mathcode:nnnn #1#2#3#4 {
+  \Umathcode \int_eval:n {#1} =
+    \mathchar at type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop:
+}
+\cs_set:Npn \@@_set_mathcode:nnn #1#2#3 {
+  \Umathcode \int_eval:n {#1} =
+    \mathchar at type#2 \csname sym#3\endcsname \int_eval:n {#1} \scan_stop:
+}
+\cs_set:Npn \@@_set_mathchar:NNnn #1#2#3#4 {
+  \Umathchardef #1 =
+    \mathchar at type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop:
+}
+\cs_new:Nn \@@_set_delcode:nnn {
+  \Udelcode#2 = \csname sym#1\endcsname #3 \scan_stop:
+}
+\cs_new:Nn \@@_radical:nn {
+  \Uradical \csname sym#1\endcsname #2 \scan_stop:
+}
+\cs_new:Nn \@@_delimiter:Nnn {
+  \Udelimiter \mathchar at type#1 \csname sym#2\endcsname #3 \scan_stop:
+}
+\cs_new:Nn \@@_accent:nnn {
+  \Umathaccent #1~ \mathchar at type\mathaccent \use:c { sym #2 } #3 \scan_stop:
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\cs_generate_variant:Nn \@@_set_mathchar:NNnn {c}
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macro}{\@@_char_gmake_mathactive:N}
+% \begin{macro}{\@@_char_gmake_mathactive:n}
+%    \begin{macrocode}
+\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:
+ }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% \subsection{Alphabet Unicode positions}
+%
+% Before we begin, let's define the positions of the various Unicode
+% alphabets so that our code is a little more readable.\footnote{`\textsc{u.s.v.}' stands
+% for `Unicode scalar value'.}
+%
+% Rather than `readable', in the end, this makes the code more extensible.
+%    \begin{macrocode}
+\cs_new:Nn \usv_set:nnn
+ { \tl_set:cn { g_@@_#1_#2_usv } {#3} }
+\cs_new:Nn \@@_to_usv:nn
+ { \use:c { g_@@_#1_#2_usv } }
+\prg_new_conditional:Nnn \@@_usv_if_exist:nn {T,F,TF}
+ {
+  \cs_if_exist:cTF { g_@@_#1_#2_usv }
+   \prg_return_true: \prg_return_false:
+ }
+%    \end{macrocode}
+%
+% \subsection{Package options}
+%
+% \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} } , }
+
+\cs_new:Nn \@@_tl_map_dbl:nN
+  {
+    \__@@_tl_map_dbl:Nnn #2 #1 \q_recursion_tail {}{} \q_recursion_stop
+  }
+\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}
+%
+%    \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}
+%
+% \subsection{Programmers' interface}
+%
+% \begin{macro}{\unimath_get_mathstyle:}
+% This command expands to the currently math style.
+%    \begin{macrocode}
+\cs_new:Nn \unimath_get_mathstyle:
+ {
+  \tl_use:N \l_@@_mathstyle_tl
+ }
+%    \end{macrocode}
+% \end{macro}
+%
+% \subsection{Overcoming \texorpdfstring{\cmd\@onlypreamble}{\textbackslash @onlypreamble}}
+%
+% The requirement of only setting up the maths fonts in the preamble is now removed.
+% The following list might be overly ambitious.
+%    \begin{macrocode}
+\tl_map_inline:nn
+ {
+  \new at mathgroup\cdp at list\cdp at elt\DeclareMathSizes
+  \@DeclareMathSizes\newmathalphabet\newmathalphabet@@\newmathalphabet@@@
+  \DeclareMathVersion\define at mathalphabet\define at mathgroup\addtoversion
+  \version at list\version at elt\alpha at list\alpha at elt
+  \restore at mathversion\init at restore@version\dorestore at version\process at table
+  \new at mathversion\DeclareSymbolFont\group at list\group at elt
+  \new at symbolfont\SetSymbolFont\SetSymbolFont@\get at cdp
+  \DeclareMathAlphabet\new at mathalphabet\SetMathAlphabet\SetMathAlphabet@
+  \DeclareMathAccent\set at mathaccent\DeclareMathSymbol\set at mathchar
+  \set at mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter
+  \@DeclareMathDelimiter\@xDeclareMathDelimiter\set at mathdelimiter
+  \set@@mathdelimiter\DeclareMathRadical\mathchar at type
+  \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@
+ }
+ {
+  \tl_remove_once:Nn \@preamblecmds {\do#1}
+ }
+%    \end{macrocode}
+%
+% End of preamble code.
+%    \begin{macrocode}
+%</preamble&!XE&!LU>
+%    \end{macrocode}


Property changes on: trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math-preamble.dtx
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Modified: trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx	2017-10-02 21:58:27 UTC (rev 45452)
+++ trunk/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx	2017-10-02 21:58:46 UTC (rev 45453)
@@ -29,7 +29,7 @@
   \def\UMDEBUG{,debug}%
 \fi
 \generate{\file{unicode-math.sty}{
-  \from{unicode-math.dtx}{preamble\UMDEBUG}
+  \from{unicode-math-preamble.dtx}{preamble\UMDEBUG}
   \from{unicode-math-msg.dtx}{msg\UMDEBUG}
   \from{unicode-math-usv.dtx}{usv\UMDEBUG}
   \from{unicode-math.dtx}{load\UMDEBUG}
@@ -37,10 +37,12 @@
 }}
 \generate{\file{unicode-math-xetex.sty}{
   \from{unicode-math.dtx}{package,XE\UMDEBUG}
+  \from{unicode-math-epilogue.dtx}{package,XE\UMDEBUG}
   \from{unicode-math-compat.dtx}{compat,XE\UMDEBUG}
 }}
 \generate{\file{unicode-math-luatex.sty}{
   \from{unicode-math.dtx}{package,LU\UMDEBUG}
+  \from{unicode-math-epilogue.dtx}{package,XE\UMDEBUG}
   \from{unicode-math-compat.dtx}{compat,LU\UMDEBUG}
 }}
 \def\tempa{plain}
@@ -53,12 +55,13 @@
 %<preamble&XE>\ProvidesPackage{unicode-math-xetex}
 %<preamble&LU>\ProvidesPackage{unicode-math-luatex}
 %<*preamble>
-  [2017/08/02 v0.8f Unicode maths in XeLaTeX and LuaLaTeX]
+  [2017/10/02 v0.8g Unicode maths in XeLaTeX and LuaLaTeX]
 %</preamble>
 %<*internal>
 \def\DOCUMENTEND{F}
 \input{unicode-math-doc}
 \DocInput{unicode-math.dtx}
+\DocInput{unicode-math-preamble.dtx}
 \DocInput{unicode-math-msg.dtx}
 \DocInput{unicode-math-usv.dtx}
 \DocInput{unicode-math-alphabets.dtx}
@@ -76,7 +79,6 @@
 %<@@=um>
 %    \end{macrocode}
 %
-% \section{Header code}
 %
 % We (later on) bifurcate the package based on the engine being used.
 % These separate package files are indicated with the Docstrip flags \textsf{LU} and \textsf{XE}, respectively.
@@ -87,595 +89,7 @@
 \sys_if_engine_xetex:T  { \RequirePackage{unicode-math-xetex}  }
 %</load>
 %    \end{macrocode}
-% The shared part of the code starts here before the split above.
-%    \begin{macrocode}
-%<*preamble&!XE&!LU>
-%    \end{macrocode}
 %
-% Bail early if using pdf\TeX.
-%    \begin{macrocode}
-\usepackage{ifxetex,ifluatex}
-\ifxetex
-  \ifdim\number\XeTeXversion\XeTeXrevision in<0.9998in%
-    \PackageError{unicode-math}{%
-      Cannot run with this version of XeTeX!\MessageBreak
-      You need XeTeX 0.9998 or newer.%
-    }\@ehd
-  \fi
-\else\ifluatex
-  \ifnum\luatexversion<64%
-    \PackageError{unicode-math}{%
-      Cannot run with this version of LuaTeX!\MessageBreak
-      You need LuaTeX 0.64 or newer.%
-    }\@ehd
-  \fi
-\else
-  \PackageError{unicode-math}{%
-    Cannot be run with pdfLaTeX!\MessageBreak
-    Use XeLaTeX or LuaLaTeX instead.%
-  }\@ehd
-\fi\fi
-%    \end{macrocode}
-%
-% \paragraph{Packages}
-%    \begin{macrocode}
-\RequirePackage{expl3}[2015/03/01]
-\RequirePackage{ucharcat}
-\RequirePackage{xparse}
-\RequirePackage{l3keys2e}
-\RequirePackage{fontspec}[2015/03/14]
-\RequirePackage{fix-cm} % avoid some warnings
-\RequirePackage{filehook}
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\ExplSyntaxOn
-%    \end{macrocode}
-%
-% Variants needed from \pkg{expl3}:
-%    \begin{macrocode}
-\cs_set_protected_nopar:Npn \exp_last_unbraced:NNx { \::N \::x_unbraced \::: }
-%    \end{macrocode}
-%
-% For \pkg{fontspec}:
-%    \begin{macrocode}
-\cs_generate_variant:Nn \fontspec_set_family:Nnn {Nx}
-\cs_generate_variant:Nn \fontspec_set_fontface:NNnn {NNx}
-%    \end{macrocode}
-%
-% \paragraph{Conditionals}
-%
-%    \begin{macrocode}
-\bool_new:N \l_@@_ot_math_bool
-\bool_new:N \l_@@_init_bool
-\bool_new:N \l_@@_implicit_alph_bool
-\bool_new:N \g_@@_mainfont_already_set_bool
-%    \end{macrocode}
-% For \opt{math-style}:
-%    \begin{macrocode}
-\bool_new:N \g_@@_literal_bool
-\bool_new:N \g_@@_upLatin_bool
-\bool_new:N \g_@@_uplatin_bool
-\bool_new:N \g_@@_upGreek_bool
-\bool_new:N \g_@@_upgreek_bool
-%    \end{macrocode}
-% For \opt{bold-style}:
-%    \begin{macrocode}
-\bool_new:N \g_@@_bfliteral_bool
-\bool_new:N \g_@@_bfupLatin_bool
-\bool_new:N \g_@@_bfuplatin_bool
-\bool_new:N \g_@@_bfupGreek_bool
-\bool_new:N \g_@@_bfupgreek_bool
-%    \end{macrocode}
-% For \opt{sans-style}:
-%    \begin{macrocode}
-\bool_new:N \g_@@_upsans_bool
-\bool_new:N \g_@@_sfliteral_bool
-%    \end{macrocode}
-% For assorted package options:
-%    \begin{macrocode}
-\bool_new:N \g_@@_upNabla_bool
-\bool_new:N \g_@@_uppartial_bool
-\bool_new:N \g_@@_literal_Nabla_bool
-\bool_new:N \g_@@_literal_partial_bool
-\bool_new:N \l_@@_smallfrac_bool
-\bool_new:N \g_@@_literal_colon_bool
-\bool_new:N \g_@@_mathrm_text_bool
-\bool_new:N \g_@@_mathit_text_bool
-\bool_new:N \g_@@_mathbf_text_bool
-\bool_new:N \g_@@_mathsf_text_bool
-\bool_new:N \g_@@_mathtt_text_bool
-%    \end{macrocode}
-%
-% \paragraph{Variables}
-%    \begin{macrocode}
-\int_new:N \g_@@_fam_int
-%    \end{macrocode}
-%
-% For displaying in warning messages, etc.:
-%    \begin{macrocode}
-\tl_const:Nn \c_@@_math_alphabet_name_latin_tl {Latin,~lowercase}
-\tl_const:Nn \c_@@_math_alphabet_name_Latin_tl {Latin,~uppercase}
-\tl_const:Nn \c_@@_math_alphabet_name_greek_tl {Greek,~lowercase}
-\tl_const:Nn \c_@@_math_alphabet_name_Greek_tl {Greek,~uppercase}
-\tl_const:Nn \c_@@_math_alphabet_name_num_tl   {Numerals}
-\tl_const:Nn \c_@@_math_alphabet_name_misc_tl  {Misc.}
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\tl_new:N \l_@@_mathstyle_tl
-%    \end{macrocode}
-%
-% Used to store the font switch for the \cs{operator at font}.
-%    \begin{macrocode}
-\tl_new:N \g_@@_operator_mathfont_tl
-%    \end{macrocode}
-%
-% Variables:
-%    \begin{macrocode}
-\seq_new:N \l_@@_missing_alph_seq
-\seq_new:N \l_@@_mathalph_seq
-\seq_new:N \l_@@_char_range_seq
-\seq_new:N \l_@@_mclass_range_seq
-\seq_new:N \l_@@_cmd_range_seq
-%    \end{macrocode}
-%
-% \begin{macro}{\g_@@_mathclasses_seq}
-% Every math class.
-%    \begin{macrocode}
-\seq_new:N \g_@@_mathclasses_seq
-\seq_set_from_clist:Nn \g_@@_mathclasses_seq
-  {
-    \mathord,\mathalpha,\mathbin,\mathrel,\mathpunct,
-     \mathop,
-    \mathopen,\mathclose,
-    \mathfence,\mathover,\mathunder,
-     \mathaccent,\mathbotaccent,\mathaccentwide,\mathbotaccentwide
-  }
-%    \end{macrocode}
-% \end{macro}
-%
-
-% \begin{macro}{\g_@@_default_mathalph_seq}
-% This sequence stores the alphabets in each math style.
-%    \begin{macrocode}
-\seq_new:N \g_@@_default_mathalph_seq
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\g_@@_mathstyles_seq}
-% This is every `named range' and every `math style' known to \pkg{unicode-math}.
-% A named range is such as "bfit" and "sfit", which are also math styles (with \cs{symbfit} and \cs{symsfit}).
-% `Mathstyles' are a superset of named ranges and also include commands such as \cs{symbf} and \cs{symsf}.
-%
-% N.B. for parsing purposes `named ranges' are defined as strings!
-%    \begin{macrocode}
-\seq_new:N \g_@@_named_ranges_seq
-\seq_new:N \g_@@_mathstyles_seq
-%    \end{macrocode}
-% \end{macro}
-%
-%    \begin{macrocode}
-\muskip_new:N \g_@@_primekern_muskip
-\muskip_gset:Nn \g_@@_primekern_muskip { -\thinmuskip/2 }% arbitrary
-\int_new:N \l_@@_primecount_int
-\prop_new:N \g_@@_supers_prop
-\prop_new:N \g_@@_subs_prop
-\tl_new:N \l_not_token_name_tl
-%    \end{macrocode}
-%
-% \subsection{Extras}
-%
-% What might end up being provided by the kernel.
-%
-% \begin{macro}{\@@_glyph_if_exist:nTF}
-%: TODO: Generalise for arbitrary fonts! \cs{l_@@_font} is not always the one used for a specific glyph!!
-%    \begin{macrocode}
-\prg_new_conditional:Nnn \@@_glyph_if_exist:n {p,TF,T,F}
- {
-  \etex_iffontchar:D \l_@@_font #1 \scan_stop:
-    \prg_return_true:
-  \else:
-    \prg_return_false:
-  \fi:
- }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\@@_set_mathcode:nnnn}
-% \begin{macro}{\@@_set_mathcode:nnn}
-% \begin{macro}{\@@_set_mathchar:NNnn}
-% \begin{macro}{\@@_set_mathchar:cNnn}
-% \begin{macro}{\@@_set_delcode:nnn}
-% \begin{macro}{\@@_radical:nn}
-% \begin{macro}{\@@_delimiter:Nnn}
-% \begin{macro}{\@@_accent:nnn}
-% \begin{macro}{\@@_accent_keyword:}
-% These are all wrappers for the primitive commands that take numerical
-% input only.
-%    \begin{macrocode}
-\cs_set:Npn \@@_set_mathcode:nnnn #1#2#3#4 {
-  \Umathcode \int_eval:n {#1} =
-    \mathchar at type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop:
-}
-\cs_set:Npn \@@_set_mathcode:nnn #1#2#3 {
-  \Umathcode \int_eval:n {#1} =
-    \mathchar at type#2 \csname sym#3\endcsname \int_eval:n {#1} \scan_stop:
-}
-\cs_set:Npn \@@_set_mathchar:NNnn #1#2#3#4 {
-  \Umathchardef #1 =
-    \mathchar at type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop:
-}
-\cs_new:Nn \@@_set_delcode:nnn {
-  \Udelcode#2 = \csname sym#1\endcsname #3 \scan_stop:
-}
-\cs_new:Nn \@@_radical:nn {
-  \Uradical \csname sym#1\endcsname #2 \scan_stop:
-}
-\cs_new:Nn \@@_delimiter:Nnn {
-  \Udelimiter \mathchar at type#1 \csname sym#2\endcsname #3 \scan_stop:
-}
-\cs_new:Nn \@@_accent:nnn {
-  \Umathaccent #1~ \mathchar at type\mathaccent \use:c { sym #2 } #3 \scan_stop:
-}
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\cs_generate_variant:Nn \@@_set_mathchar:NNnn {c}
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-% \end{macro}
-%
-%
-% \begin{macro}{\@@_char_gmake_mathactive:N}
-% \begin{macro}{\@@_char_gmake_mathactive:n}
-%    \begin{macrocode}
-\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:
- }
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \subsection{Alphabet Unicode positions}
-%
-% Before we begin, let's define the positions of the various Unicode
-% alphabets so that our code is a little more readable.\footnote{`\textsc{u.s.v.}' stands
-% for `Unicode scalar value'.}
-%
-% Rather than `readable', in the end, this makes the code more extensible.
-%    \begin{macrocode}
-\cs_new:Nn \usv_set:nnn
- { \tl_set:cn { g_@@_#1_#2_usv } {#3} }
-\cs_new:Nn \@@_to_usv:nn
- { \use:c { g_@@_#1_#2_usv } }
-\prg_new_conditional:Nnn \@@_usv_if_exist:nn {T,F,TF}
- {
-  \cs_if_exist:cTF { g_@@_#1_#2_usv }
-   \prg_return_true: \prg_return_false:
- }
-%    \end{macrocode}
-%
-% \subsection{Package options}
-%
-% \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} } , }
-
-\cs_new:Nn \@@_tl_map_dbl:nN
-  {
-    \__@@_tl_map_dbl:Nnn #2 #1 \q_recursion_tail {}{} \q_recursion_stop
-  }
-\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}
-%
-%    \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}
-%
-% \subsection{Programmers' interface}
-%
-% \begin{macro}{\unimath_get_mathstyle:}
-% This command expands to the currently math style.
-%    \begin{macrocode}
-\cs_new:Nn \unimath_get_mathstyle:
- {
-  \tl_use:N \l_@@_mathstyle_tl
- }
-%    \end{macrocode}
-% \end{macro}
-%
-% End of preamble code.
-%    \begin{macrocode}
-%</preamble&!XE&!LU>
-%    \end{macrocode}
-%
-% (Error messages and warning definitions go here from the |msg| chunk
-%  defined in \secref[vref]{codemsg}.)
-%
 % \section{Bifurcation}
 %
 % And here the split begins. Most of the code is still shared, but
@@ -701,31 +115,7 @@
 %    \end{macrocode}
 %
 %
-% \subsection{Overcoming \texorpdfstring{\cmd\@onlypreamble}{\textbackslash @onlypreamble}}
 %
-% The requirement of only setting up the maths fonts in the preamble is now removed. The following list might be overly ambitious.
-%    \begin{macrocode}
-\tl_map_inline:nn
- {
-  \new at mathgroup\cdp at list\cdp at elt\DeclareMathSizes
-  \@DeclareMathSizes\newmathalphabet\newmathalphabet@@\newmathalphabet@@@
-  \DeclareMathVersion\define at mathalphabet\define at mathgroup\addtoversion
-  \version at list\version at elt\alpha at list\alpha at elt
-  \restore at mathversion\init at restore@version\dorestore at version\process at table
-  \new at mathversion\DeclareSymbolFont\group at list\group at elt
-  \new at symbolfont\SetSymbolFont\SetSymbolFont@\get at cdp
-  \DeclareMathAlphabet\new at mathalphabet\SetMathAlphabet\SetMathAlphabet@
-  \DeclareMathAccent\set at mathaccent\DeclareMathSymbol\set at mathchar
-  \set at mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter
-  \@DeclareMathDelimiter\@xDeclareMathDelimiter\set at mathdelimiter
-  \set@@mathdelimiter\DeclareMathRadical\mathchar at type
-  \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@
- }
- {
-  \tl_remove_once:Nn \@preamblecmds {\do#1}
- }
-%    \end{macrocode}
-%
 % \section{Fundamentals}
 %
 % \subsection{Setting math chars, math codes, etc.}
@@ -980,86 +370,69 @@
 % \subsubsection{Text font}
 %    \begin{macrocode}
 \cs_generate_variant:Nn \tl_if_eq:nnT {o}
-\cs_set:Nn \__fontspec_setmainfont:nn
- {
-  \fontspec_set_family:Nnn \rmdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathrm_tl} {\rmdefault}
-   {
-%<XE>  \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
-%<LU>  \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
+\cs_set:Nn \__fontspec_setmainfont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathrm_tl} {\rmdefault}
+      {
+%<XE>   \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
+%<LU>   \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
+        \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
+        \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
+        \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
+      }
+  }
+
+\cs_set:Nn \__fontspec_setsansfont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathsf_tl} {\sfdefault}
+      {
+%<XE>   \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
+%<LU>   \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
+        \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
+        \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
+      }
+  }
+
+\cs_set:Nn \__fontspec_setmonofont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathtt_tl} {\ttdefault}
+      {
+%<XE>   \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
+%<LU>   \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
+        \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
+        \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
+      }
+  }
+%    \end{macrocode}
+%
+% \subsubsection{Maths font}
+% If the maths fonts are set explicitly, then the text commands above will not execute their branches to set the maths font alphabets.
+%    \begin{macrocode}
+\cs_set:Nn \__fontspec_setmathrm_hook:nn
+  {
     \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
     \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
     \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
-
-\cs_set:Nn \__fontspec_setsansfont:nn
- {
-  \fontspec_set_family:Nnn \sfdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathsf_tl} {\sfdefault}
-   {
-%<XE>  \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
-%<LU>  \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
+  }
+\cs_set:Nn \__fontspec_setboldmathrm_hook:nn
+  {
+    \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault
+    \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault
+    \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault
+  }
+\cs_set:Nn \__fontspec_setmathsf_hook:nn
+  {
     \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
     \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
-
-\cs_set:Nn \__fontspec_setmonofont:nn
- {
-  \fontspec_set_family:Nnn \ttdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathtt_tl} {\ttdefault}
-   {
-%<XE>  \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
-%<LU>  \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
+  }
+\cs_set:Nn \__fontspec_setmathtt_hook:nn
+  {
     \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
     \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
+  }
 %    \end{macrocode}
 %
-% \subsubsection{Maths font}
-% If the maths fonts are set explicitly, then the text commands above will not execute their branches to set the maths font alphabets.
-%    \begin{macrocode}
-\cs_set:Nn \__fontspec_setmathrm:nn
- {
-%<XE>  \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
-%<LU>  \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
-  \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
-  \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
-  \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
- }
-\cs_set:Nn \__fontspec_setboldmathrm:nn
- {
-%<XE>  \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2}
-%<LU>  \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {Renderer=Basic,#1} {#2}
-  \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault
-  \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault
-  \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault
- }
-\cs_set:Nn \__fontspec_setmathsf:nn
- {
-%<XE>  \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
-%<LU>  \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
-  \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
-  \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
- }
-\cs_set:Nn \__fontspec_setmathtt:nn
- {
-%<XE>  \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
-%<LU>  \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
-  \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
-  \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
- }
-%    \end{macrocode}
 %
-%
 % \subsection{The main \cs{setmathfont} macro}
 %
 % Using a |range| including large character sets such as \cmd\mathrel,
@@ -1072,6 +445,13 @@
 % \doarg{font features}
 %    \begin{macrocode}
 \DeclareDocumentCommand \setmathfont { O{} m O{} }
+  {
+    \@@_setmathfont:nn {#1,#3} {#2}
+  }
+%    \end{macrocode}
+%
+%    \begin{macrocode}
+\cs_set:Nn \@@_setmathfont:nn
  {
   \tl_set:Nn \l_@@_fontname_tl {#2}
   \@@_init:
@@ -1087,7 +467,7 @@
 %    \end{macrocode}
 % Parse options and tell people what's going on:
 %    \begin{macrocode}
-  \keys_set_known:nnN {unicode-math} {#1,#3} \l_@@_unknown_keys_clist
+  \keys_set_known:nnN {unicode-math} {#1} \l_@@_unknown_keys_clist
   \bool_if:NT \l_@@_init_bool { \@@_log:n {default-math-font} }
 %    \end{macrocode}
 % Use \pkg{fontspec} to select a font to use.
@@ -1225,6 +605,15 @@
 %    \begin{macrocode}
 \cs_new:Nn \@@_declare_math_sizes:
   {
+%<*LU>
+    \fp_compare:nF { \@@_script_style_size:n {ScriptPercentScaleDown} == 0 }
+      {
+        \DeclareMathSizes { \f at size } { \f at size }
+          { \@@_script_style_size:n {ScriptPercentScaleDown} }
+          { \@@_script_style_size:n {ScriptScriptPercentScaleDown} }
+      }
+%</LU>
+%<*XE>
     \dim_compare:nF { \fontdimen 10 \l_@@_font == 0pt }
       {
         \DeclareMathSizes { \f at size } { \f at size }
@@ -1231,10 +620,22 @@
           { \@@_fontdimen_to_scale:nn {10} {\l_@@_font} }
           { \@@_fontdimen_to_scale:nn {11} {\l_@@_font} }
       }
+%</XE>
   }
 %    \end{macrocode}
 % \end{macro}
 %
+%<*LU>
+% \begin{macro}{\@@_script_style_size:n}
+% Determine script- and scriptscriptstyle sizes using luaotfload:
+%   \begin{macrocode}
+\cs_new:Nn \@@_script_style_size:n
+  {
+    \fp_eval:n {\directlua{tex.sprint(luaotfload.aux.get_math_dimension("l_@@_font","#1"))} * \f at size / 100 }
+  }
+%   \end{macrocode}
+% \end{macro}
+%</LU>
 %
 %
 % \begin{macro}{\@@_setup_legacy_fam_two:}
@@ -2977,876 +2378,8 @@
  }
 %    \end{macrocode}
 %
-% \section{Fall-back font}
 %
-% Want to load Latin Modern Math if nothing else.
-% Reset the `font already loaded' boolean so that a new font being set will do the right thing.
-% TODO: need a better way to do this for the general case.
 %    \begin{macrocode}
-\AtBeginDocument { \@@_load_lm_if_necessary: }
-\cs_new:Nn \@@_load_lm_if_necessary:
-  {
-    \cs_if_exist:NF \l_@@_fontname_tl
-      {
-        % TODO: update this when lmmath-bold.otf is released
-        \setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}]
-        \bool_set_false:N \g_@@_mainfont_already_set_bool
-      }
-  }
-%    \end{macrocode}
-%
-% \section{Epilogue}
-%
-% Lots of little things to tidy up.
-%
-% \subsection{Primes}
-%
-% We need a new `prime' algorithm. Unicode math has four pre-drawn prime glyphs.
-% \begin{quote}\obeylines
-% \unichar{2032} {prime} (\cs{prime}): $x\prime$
-% \unichar{2033} {double prime} (\cs{dprime}): $x\dprime$
-% \unichar{2034} {triple prime} (\cs{trprime}): $x\trprime$
-% \unichar{2057} {quadruple prime} (\cs{qprime}): $x\qprime$
-% \end{quote}
-% As you can see, they're all drawn at the correct height without being superscripted.
-% However, in a correctly behaving OpenType font,
-% we also see different behaviour after the \texttt{ssty} feature is applied:
-% \begin{quote}
-% \font\1="Cambria Math:script=math,+ssty=0"\1
-% \char"1D465\char"2032\quad
-% \char"1D465\char"2033\quad
-% \char"1D465\char"2034\quad
-% \char"1D465\char"2057
-% \end{quote}
-% The glyphs are now `full size' so that when placed inside a superscript,
-% their shape will match the originally sized ones. Many thanks to Ross Mills
-% of Tiro Typeworks for originally pointing out this behaviour.
-%
-% In regular \LaTeX, primes can be entered with the straight quote character
-% |'|, and multiple straight quotes chain together to produce multiple
-% primes. Better results can be achieved in \pkg{unicode-math} by chaining
-% multiple single primes into a pre-drawn multi-prime glyph; consider
-% $x\prime{}\prime{}\prime$ vs.\ $x\trprime$.
-%
-% For Unicode maths, we wish to conserve this behaviour and augment it with
-% the possibility of adding any combination of Unicode prime or any of the
-% $n$-prime characters. E.g., the user might copy-paste a double prime from
-% another source and then later type another single prime after it; the output
-% should be the triple prime.
-%
-% Our algorithm is:
-% \begin{itemize}[nolistsep]
-% \item Prime encountered; pcount=1.
-% \item Scan ahead; if prime: pcount:=pcount+1; repeat.
-% \item If not prime, stop scanning.
-% \item If pcount=1, \cs{prime}, end.
-% \item If pcount=2, check \cs{dprime}; if it exists, use it, end; if not, goto last step.
-% \item Ditto pcount=3 \& \cs{trprime}.
-% \item Ditto pcount=4 \& \cs{qprime}.
-% \item If pcount>4 or the glyph doesn't exist, insert pcount \cs{prime}s with \cs{primekern} between each.
-% \end{itemize}
-%
-% This is a wrapper to insert a superscript; if there is a subsequent
-% trailing superscript, then it is included within the insertion.
-%    \begin{macrocode}
-\cs_new:Nn \@@_arg_i_before_egroup:n {#1\egroup}
-\cs_new:Nn \@@_superscript:n
- {
-  ^\bgroup #1
-  \peek_meaning_remove:NTF ^ \@@_arg_i_before_egroup:n \egroup
- }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\cs_new:Nn \@@_nprimes:Nn
- {
-  \@@_superscript:n
-   {
-    #1
-    \prg_replicate:nn {#2-1} { \mskip \g_@@_primekern_muskip #1 }
-   }
- }
-
-\cs_new:Nn \@@_nprimes_select:nn
- {
-  \int_case:nnF {#2}
-   {
-    {1} { \@@_superscript:n {#1} }
-    {2} {
-      \@@_glyph_if_exist:nTF {"2033}
-        { \@@_superscript:n {\@@_prime_double_mchar} }
-        { \@@_nprimes:Nn #1 {#2} }
-    }
-    {3} {
-      \@@_glyph_if_exist:nTF {"2034}
-        { \@@_superscript:n {\@@_prime_triple_mchar} }
-        { \@@_nprimes:Nn #1 {#2} }
-    }
-    {4} {
-      \@@_glyph_if_exist:nTF {"2057}
-        { \@@_superscript:n {\@@_prime_quad_mchar} }
-        { \@@_nprimes:Nn #1 {#2} }
-    }
-   }
-   {
-    \@@_nprimes:Nn #1 {#2}
-   }
- }
-\cs_new:Nn \@@_nbackprimes_select:nn
- {
-  \int_case:nnF {#2}
-   {
-    {1} { \@@_superscript:n {#1} }
-    {2} {
-      \@@_glyph_if_exist:nTF {"2036}
-        { \@@_superscript:n {\@@_backprime_double_mchar} }
-        { \@@_nprimes:Nn #1 {#2} }
-    }
-    {3} {
-      \@@_glyph_if_exist:nTF {"2037}
-        { \@@_superscript:n {\@@_backprime_triple_mchar} }
-        { \@@_nprimes:Nn #1 {#2} }
-    }
-   }
-   {
-    \@@_nprimes:Nn #1 {#2}
-   }
- }
-%    \end{macrocode}
-%
-% Scanning is annoying because I'm too lazy to do it for the general case.
-%
-%    \begin{macrocode}
-\cs_new:Npn \@@_scan_prime:
- {
-  \cs_set_eq:NN \@@_superscript:n \use:n
-  \int_zero:N \l_@@_primecount_int
-  \@@_scanprime_collect:N \@@_prime_single_mchar
- }
-\cs_new:Npn \@@_scan_dprime:
- {
-  \cs_set_eq:NN \@@_superscript:n \use:n
-  \int_set:Nn \l_@@_primecount_int {1}
-  \@@_scanprime_collect:N \@@_prime_single_mchar
- }
-\cs_new:Npn \@@_scan_trprime:
- {
-  \cs_set_eq:NN \@@_superscript:n \use:n
-  \int_set:Nn \l_@@_primecount_int {2}
-  \@@_scanprime_collect:N \@@_prime_single_mchar
- }
-\cs_new:Npn \@@_scan_qprime:
- {
-  \cs_set_eq:NN \@@_superscript:n \use:n
-  \int_set:Nn \l_@@_primecount_int {3}
-  \@@_scanprime_collect:N \@@_prime_single_mchar
- }
-\cs_new:Npn \@@_scan_sup_prime:
- {
-  \int_zero:N \l_@@_primecount_int
-  \@@_scanprime_collect:N \@@_prime_single_mchar
- }
-\cs_new:Npn \@@_scan_sup_dprime:
- {
-  \int_set:Nn \l_@@_primecount_int {1}
-  \@@_scanprime_collect:N \@@_prime_single_mchar
- }
-\cs_new:Npn \@@_scan_sup_trprime:
- {
-  \int_set:Nn \l_@@_primecount_int {2}
-  \@@_scanprime_collect:N \@@_prime_single_mchar
- }
-\cs_new:Npn \@@_scan_sup_qprime:
- {
-  \int_set:Nn \l_@@_primecount_int {3}
-  \@@_scanprime_collect:N \@@_prime_single_mchar
- }
-\cs_new:Nn \@@_scanprime_collect:N
- {
-  \int_incr:N \l_@@_primecount_int
-  \peek_meaning_remove:NTF '
-   { \@@_scanprime_collect:N #1 }
-   {
-    \peek_meaning_remove:NTF \@@_scan_prime:
-     { \@@_scanprime_collect:N #1 }
-     {
-      \peek_meaning_remove:NTF ^^^^2032
-       { \@@_scanprime_collect:N #1 }
-       {
-        \peek_meaning_remove:NTF \@@_scan_dprime:
-         {
-          \int_incr:N \l_@@_primecount_int
-          \@@_scanprime_collect:N #1
-         }
-         {
-          \peek_meaning_remove:NTF ^^^^2033
-           {
-            \int_incr:N \l_@@_primecount_int
-            \@@_scanprime_collect:N #1
-           }
-           {
-            \peek_meaning_remove:NTF \@@_scan_trprime:
-             {
-              \int_add:Nn \l_@@_primecount_int {2}
-              \@@_scanprime_collect:N #1
-             }
-             {
-              \peek_meaning_remove:NTF ^^^^2034
-               {
-                \int_add:Nn \l_@@_primecount_int {2}
-                \@@_scanprime_collect:N #1
-               }
-               {
-                \peek_meaning_remove:NTF \@@_scan_qprime:
-                 {
-                  \int_add:Nn \l_@@_primecount_int {3}
-                  \@@_scanprime_collect:N #1
-                 }
-                 {
-                  \peek_meaning_remove:NTF ^^^^2057
-                   {
-                    \int_add:Nn \l_@@_primecount_int {3}
-                    \@@_scanprime_collect:N #1
-                   }
-                   {
-                    \@@_nprimes_select:nn {#1} {\l_@@_primecount_int}
-                   }
-                 }
-               }
-             }
-           }
-         }
-       }
-     }
-   }
- }
-\cs_new:Npn \@@_scan_backprime:
- {
-  \cs_set_eq:NN \@@_superscript:n \use:n
-  \int_zero:N \l_@@_primecount_int
-  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
- }
-\cs_new:Npn \@@_scan_backdprime:
- {
-  \cs_set_eq:NN \@@_superscript:n \use:n
-  \int_set:Nn \l_@@_primecount_int {1}
-  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
- }
-\cs_new:Npn \@@_scan_backtrprime:
- {
-  \cs_set_eq:NN \@@_superscript:n \use:n
-  \int_set:Nn \l_@@_primecount_int {2}
-  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
- }
-\cs_new:Npn \@@_scan_sup_backprime:
- {
-  \int_zero:N \l_@@_primecount_int
-  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
- }
-\cs_new:Npn \@@_scan_sup_backdprime:
- {
-  \int_set:Nn \l_@@_primecount_int {1}
-  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
- }
-\cs_new:Npn \@@_scan_sup_backtrprime:
- {
-  \int_set:Nn \l_@@_primecount_int {2}
-  \@@_scanbackprime_collect:N \@@_backprime_single_mchar
- }
-\cs_new:Nn \@@_scanbackprime_collect:N
- {
-  \int_incr:N \l_@@_primecount_int
-  \peek_meaning_remove:NTF `
-   {
-    \@@_scanbackprime_collect:N #1
-   }
-   {
-    \peek_meaning_remove:NTF \@@_scan_backprime:
-     {
-      \@@_scanbackprime_collect:N #1
-     }
-     {
-      \peek_meaning_remove:NTF ^^^^2035
-       {
-        \@@_scanbackprime_collect:N #1
-       }
-       {
-        \peek_meaning_remove:NTF \@@_scan_backdprime:
-         {
-          \int_incr:N \l_@@_primecount_int
-          \@@_scanbackprime_collect:N #1
-         }
-         {
-          \peek_meaning_remove:NTF ^^^^2036
-           {
-            \int_incr:N \l_@@_primecount_int
-            \@@_scanbackprime_collect:N #1
-           }
-           {
-            \peek_meaning_remove:NTF \@@_scan_backtrprime:
-             {
-              \int_add:Nn \l_@@_primecount_int {2}
-              \@@_scanbackprime_collect:N #1
-             }
-             {
-              \peek_meaning_remove:NTF ^^^^2037
-               {
-                \int_add:Nn \l_@@_primecount_int {2}
-                \@@_scanbackprime_collect:N #1
-               }
-               {
-                \@@_nbackprimes_select:nn {#1} {\l_@@_primecount_int}
-               }
-             }
-           }
-         }
-       }
-     }
-   }
- }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\AtBeginDocument{\@@_define_prime_commands: \@@_define_prime_chars:}
-\cs_new:Nn \@@_define_prime_commands:
- {
-  \cs_set_eq:NN \prime       \@@_prime_single_mchar
-  \cs_set_eq:NN \dprime      \@@_prime_double_mchar
-  \cs_set_eq:NN \trprime     \@@_prime_triple_mchar
-  \cs_set_eq:NN \qprime      \@@_prime_quad_mchar
-  \cs_set_eq:NN \backprime   \@@_backprime_single_mchar
-  \cs_set_eq:NN \backdprime  \@@_backprime_double_mchar
-  \cs_set_eq:NN \backtrprime \@@_backprime_triple_mchar
- }
-\group_begin:
-  \char_set_catcode_active:N \'
-  \char_set_catcode_active:N \`
-  \char_set_catcode_active:n {"2032}
-  \char_set_catcode_active:n {"2033}
-  \char_set_catcode_active:n {"2034}
-  \char_set_catcode_active:n {"2057}
-  \char_set_catcode_active:n {"2035}
-  \char_set_catcode_active:n {"2036}
-  \char_set_catcode_active:n {"2037}
-  \cs_gset:Nn \@@_define_prime_chars:
-   {
-    \cs_set_eq:NN '        \@@_scan_sup_prime:
-    \cs_set_eq:NN ^^^^2032 \@@_scan_sup_prime:
-    \cs_set_eq:NN ^^^^2033 \@@_scan_sup_dprime:
-    \cs_set_eq:NN ^^^^2034 \@@_scan_sup_trprime:
-    \cs_set_eq:NN ^^^^2057 \@@_scan_sup_qprime:
-    \cs_set_eq:NN `        \@@_scan_sup_backprime:
-    \cs_set_eq:NN ^^^^2035 \@@_scan_sup_backprime:
-    \cs_set_eq:NN ^^^^2036 \@@_scan_sup_backdprime:
-    \cs_set_eq:NN ^^^^2037 \@@_scan_sup_backtrprime:
-   }
-\group_end:
-%    \end{macrocode}
-%
-% \subsection{Unicode radicals}
-%
-% Make sure \cs{Uroot} is defined in the case where the \LaTeX{}
-% kernel doesn't make it available with its native name.
-%    \begin{macrocode}
-%<*LU>
-\cs_if_exist:NF \Uroot
-  { \cs_new_eq:NN \Uroot \luatexUroot }
-%</LU>
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\AtBeginDocument{\@@_redefine_radical:}
-\cs_new:Nn \@@_redefine_radical:
-%<*XE>
- {
-  \@ifpackageloaded { amsmath } { }
-   {
-%    \end{macrocode}
-% \begin{macro}{\r@@t}
-% \darg{A mathstyle (for \cmd\mathpalette)}
-% \darg{Leading superscript for the sqrt sign}
-% A re-implementation of \LaTeX's hard-coded n-root sign using the appropriate \cmd\fontdimen s.
-%    \begin{macrocode}
-    \cs_set_nopar:Npn \r@@@@t ##1 ##2
-     {
-      \hbox_set:Nn \l_tmpa_box
-       {
-        \c_math_toggle_token
-        \m at th
-        ##1
-        \sqrtsign { ##2 }
-        \c_math_toggle_token
-       }
-      \@@_mathstyle_scale:Nnn ##1 { \kern }
-       { \fontdimen 63 \l_@@_font }
-      \box_move_up:nn
-       {
-        (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box)
-        * \number \fontdimen 65 \l_@@_font / 100
-       }
-       { \box_use:N \rootbox }
-      \@@_mathstyle_scale:Nnn ##1 { \kern }
-       { \fontdimen 64 \l_@@_font }
-      \box_use_clear:N \l_tmpa_box
-     }
-%    \end{macrocode}
-% \end{macro}
-%    \begin{macrocode}
-   }
- }
-%</XE>
-%<*LU>
- {
-  \@ifpackageloaded { amsmath } { }
-   {
-%    \end{macrocode}
-% \begin{macro}{\root}
-% Redefine this macro for \LuaTeX, which provides us a nice primitive to use.
-%    \begin{macrocode}
-    \cs_set:Npn \root ##1 \of ##2
-     {
-       \Uroot \l_@@_radical_sqrt_tl { ##1 } { ##2 }
-     }
-%    \end{macrocode}
-% \end{macro}
-%    \begin{macrocode}
-   }
- }
-%</LU>
-%    \end{macrocode}
-%
-%
-% \begin{macro}{\@@_fontdimen_to_percent:nn}
-% \begin{macro}{\@@_fontdimen_to_scale:nn}
-% \darg{Font dimen number}
-% \darg{Font `variable'}
-% \cmd\fontdimen s |10|, |11|, and |65| aren't actually dimensions, they're percentage values given in units of |sp|.
-% \cs{@@_fontdimen_to_percent:nn} takes a font dimension number and outputs the decimal value of the associated parameter.
-% \cs{@@_fontdimen_to_scale:nn} returns a dimension correspond to the current
-% font size relative proportion based on that percentage.
-%    \begin{macrocode}
-\cs_new:Nn \@@_fontdimen_to_percent:nn
- {
-  \fp_eval:n { \dim_to_decimal:n { \fontdimen #1 #2 } * 65536 / 100 }
- }
-\cs_new:Nn \@@_fontdimen_to_scale:nn
- {
-  \fp_eval:n {\@@_fontdimen_to_percent:nn {#1} {#2} * \f at size } pt
- }
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\@@_mathstyle_scale:Nnn}
-% \darg{A math style (\cs{scriptstyle}, say)}
-% \darg{Macro that takes a non-delimited length argument (like \cmd\kern)}
-% \darg{Length control sequence to be scaled according to the math style}
-% This macro is used to scale the lengths reported by \cmd\fontdimen\ according to the scale factor for script- and scriptscript-size objects.
-%    \begin{macrocode}
-\cs_new:Nn \@@_mathstyle_scale:Nnn
- {
-  \ifx#1\scriptstyle
-    #2 \@@_fontdimen_to_percent:nn {10} \l_@@_font #3
-  \else
-    \ifx#1\scriptscriptstyle
-      #2 \@@_fontdimen_to_percent:nn {11} \l_@@_font #3
-    \else
-      #2 #3
-    \fi
-  \fi
- }
-%    \end{macrocode}
-% \end{macro}
-%
-% \subsection{Unicode sub- and super-scripts}
-%
-% The idea here is to enter a scanning state after a superscript or subscript
-% is encountered.
-% If subsequent superscripts or subscripts (resp.) are found,
-% they are lumped together.
-% Each sub/super has a corresponding regular size
-% glyph which is used by \XeTeX\ to typeset the results; this means that the
-% actual subscript/superscript glyphs are never seen in the output
-% document~--- they are only used as input characters.
-%
-% Open question: should the superscript-like `modifiers' (\unichar{1D2C}
-% {modifier capital letter a} and on) be included here?
-%    \begin{macrocode}
-\group_begin:
-%    \end{macrocode}
-% \paragraph{Superscripts}
-% Populate a property list with superscript characters; themselves as their
-% key, and their replacement as each key's value.
-% Then make the superscript active and bind it to the scanning function.
-%
-% \cs{scantokens} makes this process much simpler since we can activate the
-% char and assign its meaning in one step.
-%    \begin{macrocode}
-\cs_new:Nn \@@_setup_active_superscript:nn
- {
-  \prop_gput:Nnn \g_@@_supers_prop   {#1} {#2}
-  \char_set_catcode_active:N #1
-  \@@_char_gmake_mathactive:N #1
-  \scantokens
-   {
-    \cs_gset:Npn #1
-     {
-      \tl_set:Nn \l_@@_ss_chain_tl {#2}
-      \cs_set_eq:NN \@@_sub_or_super:n \sp
-      \tl_set:Nn \l_@@_tmpa_tl {supers}
-      \@@_scan_sscript:
-     }
-   }
- }
-%    \end{macrocode}
-% Bam:
-%    \begin{macrocode}
-\@@_setup_active_superscript:nn {^^^^2070} {0}
-\@@_setup_active_superscript:nn {^^^^00b9} {1}
-\@@_setup_active_superscript:nn {^^^^00b2} {2}
-\@@_setup_active_superscript:nn {^^^^00b3} {3}
-\@@_setup_active_superscript:nn {^^^^2074} {4}
-\@@_setup_active_superscript:nn {^^^^2075} {5}
-\@@_setup_active_superscript:nn {^^^^2076} {6}
-\@@_setup_active_superscript:nn {^^^^2077} {7}
-\@@_setup_active_superscript:nn {^^^^2078} {8}
-\@@_setup_active_superscript:nn {^^^^2079} {9}
-\@@_setup_active_superscript:nn {^^^^207a} {+}
-\@@_setup_active_superscript:nn {^^^^207b} {-}
-\@@_setup_active_superscript:nn {^^^^207c} {=}
-\@@_setup_active_superscript:nn {^^^^207d} {(}
-\@@_setup_active_superscript:nn {^^^^207e} {)}
-\@@_setup_active_superscript:nn {^^^^2071} {i}
-\@@_setup_active_superscript:nn {^^^^207f} {n}
-\@@_setup_active_superscript:nn {^^^^02b0} {h}
-\@@_setup_active_superscript:nn {^^^^02b2} {j}
-\@@_setup_active_superscript:nn {^^^^02b3} {r}
-\@@_setup_active_superscript:nn {^^^^02b7} {w}
-\@@_setup_active_superscript:nn {^^^^02b8} {y}
-%    \end{macrocode}
-% \paragraph{Subscripts} Ditto above.
-%    \begin{macrocode}
-\cs_new:Nn \@@_setup_active_subscript:nn
- {
-  \prop_gput:Nnn \g_@@_subs_prop   {#1} {#2}
-  \char_set_catcode_active:N #1
-  \@@_char_gmake_mathactive:N #1
-  \scantokens
-   {
-    \cs_gset:Npn #1
-     {
-      \tl_set:Nn \l_@@_ss_chain_tl {#2}
-      \cs_set_eq:NN \@@_sub_or_super:n \sb
-      \tl_set:Nn \l_@@_tmpa_tl {subs}
-      \@@_scan_sscript:
-     }
-   }
- }
-%    \end{macrocode}
-% A few more subscripts than superscripts:
-%    \begin{macrocode}
-\@@_setup_active_subscript:nn {^^^^2080} {0}
-\@@_setup_active_subscript:nn {^^^^2081} {1}
-\@@_setup_active_subscript:nn {^^^^2082} {2}
-\@@_setup_active_subscript:nn {^^^^2083} {3}
-\@@_setup_active_subscript:nn {^^^^2084} {4}
-\@@_setup_active_subscript:nn {^^^^2085} {5}
-\@@_setup_active_subscript:nn {^^^^2086} {6}
-\@@_setup_active_subscript:nn {^^^^2087} {7}
-\@@_setup_active_subscript:nn {^^^^2088} {8}
-\@@_setup_active_subscript:nn {^^^^2089} {9}
-\@@_setup_active_subscript:nn {^^^^208a} {+}
-\@@_setup_active_subscript:nn {^^^^208b} {-}
-\@@_setup_active_subscript:nn {^^^^208c} {=}
-\@@_setup_active_subscript:nn {^^^^208d} {(}
-\@@_setup_active_subscript:nn {^^^^208e} {)}
-\@@_setup_active_subscript:nn {^^^^2090} {a}
-\@@_setup_active_subscript:nn {^^^^2091} {e}
-\@@_setup_active_subscript:nn {^^^^2095} {h}
-\@@_setup_active_subscript:nn {^^^^1d62} {i}
-\@@_setup_active_subscript:nn {^^^^2c7c} {j}
-\@@_setup_active_subscript:nn {^^^^2096} {k}
-\@@_setup_active_subscript:nn {^^^^2097} {l}
-\@@_setup_active_subscript:nn {^^^^2098} {m}
-\@@_setup_active_subscript:nn {^^^^2099} {n}
-\@@_setup_active_subscript:nn {^^^^2092} {o}
-\@@_setup_active_subscript:nn {^^^^209a} {p}
-\@@_setup_active_subscript:nn {^^^^1d63} {r}
-\@@_setup_active_subscript:nn {^^^^209b} {s}
-\@@_setup_active_subscript:nn {^^^^209c} {t}
-\@@_setup_active_subscript:nn {^^^^1d64} {u}
-\@@_setup_active_subscript:nn {^^^^1d65} {v}
-\@@_setup_active_subscript:nn {^^^^2093} {x}
-\@@_setup_active_subscript:nn {^^^^1d66} {\beta}
-\@@_setup_active_subscript:nn {^^^^1d67} {\gamma}
-\@@_setup_active_subscript:nn {^^^^1d68} {\rho}
-\@@_setup_active_subscript:nn {^^^^1d69} {\phi}
-\@@_setup_active_subscript:nn {^^^^1d6a} {\chi}
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\group_end:
-%    \end{macrocode}
-% The scanning command, which collects a chain of subscripts or a chain
-% of superscripts and then typesets what it has collected.
-%    \begin{macrocode}
-\cs_new:Npn \@@_scan_sscript:
- {
-  \@@_scan_sscript:TF
-   {
-    \@@_scan_sscript:
-   }
-   {
-    \@@_sub_or_super:n {\l_@@_ss_chain_tl}
-   }
- }
-%    \end{macrocode}
-% We do not skip spaces when scanning ahead, and we explicitly wish to
-% bail out on encountering a space or a brace.  These cases are filtered
-% using \cs{peek_N_type:TF}.  Otherwise the token can be taken as an
-% \texttt{N}-type argument.  Then we search for it in the appropriate
-% property list (\cs{l_@@_tmpa_tl} is |subs| or |supers|).
-% If found, add the value to the current chain of sub/superscripts.
-% Remember to put the character back in the input otherwise.
-% The \cs{group_align_safe_begin:} and \cs{group_align_safe_end:} are
-% needed in case |#3| is |&|.
-%    \begin{macrocode}
-\cs_new:Npn \@@_scan_sscript:TF #1#2
- {
-  \peek_N_type:TF
-   {
-    \group_align_safe_begin:
-    \@@_scan_sscript_aux:nnN {#1} {#2}
-   }
-   {#2}
- }
-\cs_new:Npn \@@_scan_sscript_aux:nnN #1#2#3
- {
-  \prop_get:cnNTF {g_@@_\l_@@_tmpa_tl _prop} {#3} \l_@@_tmpb_tl
-   {
-    \tl_put_right:NV \l_@@_ss_chain_tl \l_@@_tmpb_tl
-    \group_align_safe_end:
-    #1
-   }
-   { \group_align_safe_end: #2 #3 }
- }
-%    \end{macrocode}
-%
-% \subsubsection{Active fractions}
-% Active fractions can be setup independently of any maths font definition;
-% all it requires is a mapping from the Unicode input chars to the relevant
-% \LaTeX\ fraction declaration.
-%
-%    \begin{macrocode}
-\cs_new:Npn \@@_define_active_frac:Nw #1 #2/#3
- {
-  \char_set_catcode_active:N #1
-  \@@_char_gmake_mathactive:N #1
-  \tl_rescan:nn
-   {
-    \catcode`\_=11\relax
-    \catcode`\:=11\relax
-   }
-   {
-    \cs_gset:Npx #1
-     {
-      \bool_if:NTF \l_@@_smallfrac_bool {\exp_not:N\tfrac} {\exp_not:N\frac}
-          {#2} {#3}
-     }
-   }
- }
-%    \end{macrocode}
-% These are redefined for each math font selection in case the |active-frac|
-% feature changes.
-%    \begin{macrocode}
-\cs_new:Npn \@@_setup_active_frac:
- {
-  \group_begin:
-  \@@_define_active_frac:Nw  ^^^^2189  0/3
-  \@@_define_active_frac:Nw  ^^^^2152  1/{10}
-  \@@_define_active_frac:Nw  ^^^^2151  1/9
-  \@@_define_active_frac:Nw  ^^^^215b  1/8
-  \@@_define_active_frac:Nw  ^^^^2150  1/7
-  \@@_define_active_frac:Nw  ^^^^2159  1/6
-  \@@_define_active_frac:Nw  ^^^^2155  1/5
-  \@@_define_active_frac:Nw  ^^^^00bc  1/4
-  \@@_define_active_frac:Nw  ^^^^2153  1/3
-  \@@_define_active_frac:Nw  ^^^^215c  3/8
-  \@@_define_active_frac:Nw  ^^^^2156  2/5
-  \@@_define_active_frac:Nw  ^^^^00bd  1/2
-  \@@_define_active_frac:Nw  ^^^^2157  3/5
-  \@@_define_active_frac:Nw  ^^^^215d  5/8
-  \@@_define_active_frac:Nw  ^^^^2154  2/3
-  \@@_define_active_frac:Nw  ^^^^00be  3/4
-  \@@_define_active_frac:Nw  ^^^^2158  4/5
-  \@@_define_active_frac:Nw  ^^^^215a  5/6
-  \@@_define_active_frac:Nw  ^^^^215e  7/8
-  \group_end:
- }
-\@@_setup_active_frac:
-%    \end{macrocode}
-%
-% \subsection{Synonyms and all the rest}
-%
-% These are symbols with multiple names. Eventually to be taken care of
-% automatically by the maths characters database.
-%    \begin{macrocode}
-\protected\def\to{\rightarrow}
-\protected\def\le{\leq}
-\protected\def\ge{\geq}
-\protected\def\neq{\ne}
-\protected\def\triangle{\mathord{\bigtriangleup}}
-\protected\def\bigcirc{\mdlgwhtcircle}
-\protected\def\circ{\vysmwhtcircle}
-\protected\def\bullet{\smblkcircle}
-\protected\def\mathyen{\yen}
-\protected\def\mathsterling{\sterling}
-\protected\def\diamond{\smwhtdiamond}
-\protected\def\emptyset{\varnothing}
-\protected\def\hbar{\hslash}
-\protected\def\land{\wedge}
-\protected\def\lor{\vee}
-\protected\def\owns{\ni}
-\protected\def\gets{\leftarrow}
-\protected\def\mathring{\ocirc}
-\protected\def\lnot{\neg}
-\protected\def\longdivision{\longdivisionsign}
-%    \end{macrocode}
-% These are somewhat odd: (and their usual Unicode uprightness does not match their amssymb glyphs)
-%    \begin{macrocode}
-\protected\def\backepsilon{\upbackepsilon}
-\protected\def\eth{\matheth}
-%    \end{macrocode}
-% These are names that are `frozen' in HTML but have dumb names:
-%    \begin{macrocode}
-\protected\def\dbkarow {\dbkarrow}
-\protected\def\drbkarow{\drbkarrow}
-\protected\def\hksearow{\hksearrow}
-\protected\def\hkswarow{\hkswarrow}
-%    \end{macrocode}
-%
-% Due to the magic of OpenType math, big operators are automatically
-% enlarged when necessary. Since there isn't a separate unicode glyph for
-% `small integral', I'm not sure if there is a better way to do this:
-%    \begin{macrocode}
-\protected\def\smallint{\mathop{\textstyle\int}\limits}
-%    \end{macrocode}
-%
-% \begin{macro}{\underbar}
-%    \begin{macrocode}
-\cs_set_eq:NN \latexe_underbar:n \underbar
-\renewcommand\underbar
- {
-  \mode_if_math:TF \mathunderbar \latexe_underbar:n
- }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\colon}
-% Define \cs{colon} as a mathpunct `|:|'.
-% This is wrong: it should be \unichar{003A} {colon} instead!
-% We hope no-one will notice.
-%    \begin{macrocode}
-\@ifpackageloaded{amsmath}
- {
-  % define their own colon, perhaps I should just steal it. (It does look much better.)
- }
- {
-  \cs_set_protected:Npn \colon
-   {
-    \bool_if:NTF \g_@@_literal_colon_bool {:} { \mathpunct{:} }
-   }
- }
-%    \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\digamma}
-% \begin{macro}{\Digamma}
-% I might end up just changing these in the table.
-%    \begin{macrocode}
-\protected\def\digamma{\updigamma}
-\protected\def\Digamma{\upDigamma}
-%    \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \paragraph{Symbols}
-%    \begin{macrocode}
-\cs_set_protected:Npn \| {\Vert}
-%    \end{macrocode}
-% \cs{mathinner} items:
-%    \begin{macrocode}
-\cs_set_protected:Npn \mathellipsis {\mathinner{\unicodeellipsis}}
-\cs_set_protected:Npn \cdots {\mathinner{\unicodecdots}}
-%    \end{macrocode}
-%
-%    \begin{macrocode}
-\cs_set_eq:NN \@@_text_slash: \slash
-\cs_set_protected:Npn \slash
- {
-  \mode_if_math:TF {\mathslash} {\@@_text_slash:}
- }
-%    \end{macrocode}
-%
-% \paragraph{\cs{not}}
-% The situation of \cs{not} symbol is currently messy, in Unicode it is defined
-% as a combining mark so naturally it should be treated as a math accent,
-% however neither Lua\TeX\ nor \XeTeX\ correctly place it as it needs special
-% treatment compared to other accents, furthermore a math accent changes the
-% spacing of its nucleus, so \cs{not=} will be spaced as an ordinary not
-% relational symbol, which is undesired.
-%
-% Here modify \cs{not} to a macro that tries to use predefined negated symbols,
-% which would give better results in most cases, until there is more robust
-% solution in the engines.
-%
-% This code is based on an answer to a TeX -- Stack Exchange question by Enrico
-% Gregorio\footnote{\url{http://tex.stackexchange.com/a/47260/729}}.
-%
-%    \begin{macrocode}
-\cs_new:Npn \@@_newnot:N #1
- {
-   \tl_set:Nx \l_not_token_name_tl { \token_to_str:N #1 }
-   \exp_args:Nx \tl_if_empty:nF { \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 }
-      }
-      {
-       \@@_oldnot: #1
-      }
-    }
- }
-%    \end{macrocode}
-%    \begin{macrocode}
-\cs_set_eq:NN \@@_oldnot: \not
-\AtBeginDocument{\cs_set_eq:NN \not \@@_newnot:N}
-%    \end{macrocode}
-%    \begin{macrocode}
-\cs_new_protected_nopar:Nn \@@_setup_negations:
- {
-  \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 }
- }
-%    \end{macrocode}
-%
-%    \begin{macrocode}
 %</package&(XE|LU)>
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty	2017-10-02 21:58:27 UTC (rev 45452)
+++ trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty	2017-10-02 21:58:46 UTC (rev 45453)
@@ -5,6 +5,7 @@
 %% The original source files were:
 %%
 %% unicode-math.dtx  (with options: `package,LU')
+%% unicode-math-epilogue.dtx  (with options: `package,XE')
 %% unicode-math-compat.dtx  (with options: `compat,LU')
 %% Copyright 2006-2017   Will Robertson <will.robertson at latex-project.org>
 %% Copyright 2010-2013 Philipp Stephani <st_philipp at yahoo.de>
@@ -18,25 +19,6 @@
 \ExplSyntaxOn
 \RequirePackage{luaotfload}   [2014/05/18]
 \RequirePackage{lualatex-math}[2011/08/07]
-\tl_map_inline:nn
- {
-  \new at mathgroup\cdp at list\cdp at elt\DeclareMathSizes
-  \@DeclareMathSizes\newmathalphabet\newmathalphabet__um\newmathalphabet__um@
-  \DeclareMathVersion\define at mathalphabet\define at mathgroup\addtoversion
-  \version at list\version at elt\alpha at list\alpha at elt
-  \restore at mathversion\init at restore@version\dorestore at version\process at table
-  \new at mathversion\DeclareSymbolFont\group at list\group at elt
-  \new at symbolfont\SetSymbolFont\SetSymbolFont@\get at cdp
-  \DeclareMathAlphabet\new at mathalphabet\SetMathAlphabet\SetMathAlphabet@
-  \DeclareMathAccent\set at mathaccent\DeclareMathSymbol\set at mathchar
-  \set at mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter
-  \@DeclareMathDelimiter\@xDeclareMathDelimiter\set at mathdelimiter
-  \set__ummathdelimiter\DeclareMathRadical\mathchar at type
-  \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@
- }
- {
-  \tl_remove_once:Nn \@preamblecmds {\do#1}
- }
 \cs_set:Nn \__um_set_mathsymbol:nNNn
  {
   \bool_lazy_and:nnT
@@ -173,78 +155,69 @@
  { \tl_set:Nn \g__um_operator_mathfont_tl {#1} }
 \setoperatorfont{\mathrm}
 \cs_generate_variant:Nn \tl_if_eq:nnT {o}
-\cs_set:Nn \__fontspec_setmainfont:nn
- {
-  \fontspec_set_family:Nnn \rmdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathrm_tl} {\rmdefault}
-   {
-  \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
+\cs_set:Nn \__fontspec_setmainfont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathrm_tl} {\rmdefault}
+      {
+   \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
+        \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
+        \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
+        \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
+      }
+  }
+
+\cs_set:Nn \__fontspec_setsansfont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathsf_tl} {\sfdefault}
+      {
+   \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
+        \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
+        \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
+      }
+  }
+
+\cs_set:Nn \__fontspec_setmonofont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathtt_tl} {\ttdefault}
+      {
+   \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
+        \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
+        \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
+      }
+  }
+\cs_set:Nn \__fontspec_setmathrm_hook:nn
+  {
     \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
     \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
     \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
-
-\cs_set:Nn \__fontspec_setsansfont:nn
- {
-  \fontspec_set_family:Nnn \sfdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathsf_tl} {\sfdefault}
-   {
-  \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
+  }
+\cs_set:Nn \__fontspec_setboldmathrm_hook:nn
+  {
+    \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault
+    \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault
+    \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault
+  }
+\cs_set:Nn \__fontspec_setmathsf_hook:nn
+  {
     \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
     \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
-
-\cs_set:Nn \__fontspec_setmonofont:nn
- {
-  \fontspec_set_family:Nnn \ttdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathtt_tl} {\ttdefault}
-   {
-  \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
+  }
+\cs_set:Nn \__fontspec_setmathtt_hook:nn
+  {
     \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
     \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
-\cs_set:Nn \__fontspec_setmathrm:nn
- {
-  \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {Renderer=Basic,#1} {#2}
-  \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
-  \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
-  \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
- }
-\cs_set:Nn \__fontspec_setboldmathrm:nn
- {
-  \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {Renderer=Basic,#1} {#2}
-  \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault
-  \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault
-  \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault
- }
-\cs_set:Nn \__fontspec_setmathsf:nn
- {
-  \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {Renderer=Basic,#1} {#2}
-  \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
-  \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
- }
-\cs_set:Nn \__fontspec_setmathtt:nn
- {
-  \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {Renderer=Basic,#1} {#2}
-  \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
-  \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
- }
+  }
 \DeclareDocumentCommand \setmathfont { O{} m O{} }
+  {
+    \__um_setmathfont:nn {#1,#3} {#2}
+  }
+\cs_set:Nn \__um_setmathfont:nn
  {
   \tl_set:Nn \l__um_fontname_tl {#2}
   \__um_init:
   \cs_if_exist:cF { S@ \f at size } { \calculate at math@sizes }
   \csname S@\f at size\endcsname
-  \keys_set_known:nnN {unicode-math} {#1,#3} \l__um_unknown_keys_clist
+  \keys_set_known:nnN {unicode-math} {#1} \l__um_unknown_keys_clist
   \bool_if:NT \l__um_init_bool { \__um_log:n {default-math-font} }
 
   \__um_fontspec_select_font:
@@ -306,13 +279,17 @@
  }
 \cs_new:Nn \__um_declare_math_sizes:
   {
-    \dim_compare:nF { \fontdimen 10 \l__um_font == 0pt }
+    \fp_compare:nF { \__um_script_style_size:n {ScriptPercentScaleDown} == 0 }
       {
         \DeclareMathSizes { \f at size } { \f at size }
-          { \__um_fontdimen_to_scale:nn {10} {\l__um_font} }
-          { \__um_fontdimen_to_scale:nn {11} {\l__um_font} }
+          { \__um_script_style_size:n {ScriptPercentScaleDown} }
+          { \__um_script_style_size:n {ScriptScriptPercentScaleDown} }
       }
   }
+\cs_new:Nn \__um_script_style_size:n
+  {
+    \fp_eval:n {\directlua{tex.sprint(luaotfload.aux.get_math_dimension("l__um_font","#1"))} * \f at size / 100 }
+  }
 \cs_new:Nn \__um_setup_legacy_fam_two:
   {
     \fontspec_set_family:Nxn \l__um_family_tl
@@ -1170,16 +1147,7 @@
     \__um_input_math_symbol_table:
   \group_end:
  }
-\AtBeginDocument { \__um_load_lm_if_necessary: }
-\cs_new:Nn \__um_load_lm_if_necessary:
-  {
-    \cs_if_exist:NF \l__um_fontname_tl
-      {
-        % TODO: update this when lmmath-bold.otf is released
-        \setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}]
-        \bool_set_false:N \g__um_mainfont_already_set_bool
-      }
-  }
+
 \cs_new:Nn \__um_arg_i_before_egroup:n {#1\egroup}
 \cs_new:Nn \__um_superscript:n
  {
@@ -1461,16 +1429,32 @@
     \cs_set_eq:NN ^^^^2037 \__um_scan_sup_backtrprime:
    }
 \group_end:
-\cs_if_exist:NF \Uroot
-  { \cs_new_eq:NN \Uroot \luatexUroot }
 \AtBeginDocument{\__um_redefine_radical:}
 \cs_new:Nn \__um_redefine_radical:
  {
   \@ifpackageloaded { amsmath } { }
    {
-    \cs_set:Npn \root ##1 \of ##2
+    \cs_set_nopar:Npn \r@@t ##1 ##2
      {
-       \Uroot \l__um_radical_sqrt_tl { ##1 } { ##2 }
+      \hbox_set:Nn \l_tmpa_box
+       {
+        \c_math_toggle_token
+        \m at th
+        ##1
+        \sqrtsign { ##2 }
+        \c_math_toggle_token
+       }
+      \__um_mathstyle_scale:Nnn ##1 { \kern }
+       { \fontdimen 63 \l__um_font }
+      \box_move_up:nn
+       {
+        (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box)
+        * \number \fontdimen 65 \l__um_font / 100
+       }
+       { \box_use:N \rootbox }
+      \__um_mathstyle_scale:Nnn ##1 { \kern }
+       { \fontdimen 64 \l__um_font }
+      \box_use_clear:N \l_tmpa_box
      }
    }
  }
@@ -1746,6 +1730,16 @@
   \cs_gset:Npn  \ngreater  { \ngtr }
   \cs_gset:Npn  \nforksnot { \forks }
  }
+\AtBeginDocument { \__um_load_lm_if_necessary: }
+\cs_new:Nn \__um_load_lm_if_necessary:
+  {
+    \cs_if_exist:NF \l__um_fontname_tl
+      {
+        % TODO: update this when lmmath-bold.otf is released
+        \setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}]
+        \bool_set_false:N \g__um_mainfont_already_set_bool
+      }
+  }
 \cs_new_protected_nopar:Nn \__um_check_and_fix:NNnnnn
  {
   \cs_if_exist:NT #1

Modified: trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty	2017-10-02 21:58:27 UTC (rev 45452)
+++ trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty	2017-10-02 21:58:46 UTC (rev 45453)
@@ -5,6 +5,7 @@
 %% The original source files were:
 %%
 %% unicode-math.dtx  (with options: `package,XE')
+%% unicode-math-epilogue.dtx  (with options: `package,XE')
 %% unicode-math-compat.dtx  (with options: `compat,XE')
 %% Copyright 2006-2017   Will Robertson <will.robertson at latex-project.org>
 %% Copyright 2010-2013 Philipp Stephani <st_philipp at yahoo.de>
@@ -16,25 +17,6 @@
 %% 
 %% This work is "maintained" by Will Robertson.
 \ExplSyntaxOn
-\tl_map_inline:nn
- {
-  \new at mathgroup\cdp at list\cdp at elt\DeclareMathSizes
-  \@DeclareMathSizes\newmathalphabet\newmathalphabet__um\newmathalphabet__um@
-  \DeclareMathVersion\define at mathalphabet\define at mathgroup\addtoversion
-  \version at list\version at elt\alpha at list\alpha at elt
-  \restore at mathversion\init at restore@version\dorestore at version\process at table
-  \new at mathversion\DeclareSymbolFont\group at list\group at elt
-  \new at symbolfont\SetSymbolFont\SetSymbolFont@\get at cdp
-  \DeclareMathAlphabet\new at mathalphabet\SetMathAlphabet\SetMathAlphabet@
-  \DeclareMathAccent\set at mathaccent\DeclareMathSymbol\set at mathchar
-  \set at mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter
-  \@DeclareMathDelimiter\@xDeclareMathDelimiter\set at mathdelimiter
-  \set__ummathdelimiter\DeclareMathRadical\mathchar at type
-  \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@
- }
- {
-  \tl_remove_once:Nn \@preamblecmds {\do#1}
- }
 \cs_set:Nn \__um_set_mathsymbol:nNNn
  {
   \bool_lazy_and:nnT
@@ -171,78 +153,69 @@
  { \tl_set:Nn \g__um_operator_mathfont_tl {#1} }
 \setoperatorfont{\mathrm}
 \cs_generate_variant:Nn \tl_if_eq:nnT {o}
-\cs_set:Nn \__fontspec_setmainfont:nn
- {
-  \fontspec_set_family:Nnn \rmdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathrm_tl} {\rmdefault}
-   {
-  \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
+\cs_set:Nn \__fontspec_setmainfont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathrm_tl} {\rmdefault}
+      {
+   \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
+        \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
+        \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
+        \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
+      }
+  }
+
+\cs_set:Nn \__fontspec_setsansfont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathsf_tl} {\sfdefault}
+      {
+   \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
+        \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
+        \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
+      }
+  }
+
+\cs_set:Nn \__fontspec_setmonofont_hook:nn
+  {
+    \tl_if_eq:onT {\g__fontspec_mathtt_tl} {\ttdefault}
+      {
+   \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
+        \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
+        \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
+      }
+  }
+\cs_set:Nn \__fontspec_setmathrm_hook:nn
+  {
     \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
     \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
     \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
-
-\cs_set:Nn \__fontspec_setsansfont:nn
- {
-  \fontspec_set_family:Nnn \sfdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathsf_tl} {\sfdefault}
-   {
-  \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
+  }
+\cs_set:Nn \__fontspec_setboldmathrm_hook:nn
+  {
+    \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault
+    \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault
+    \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault
+  }
+\cs_set:Nn \__fontspec_setmathsf_hook:nn
+  {
     \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
     \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
-
-\cs_set:Nn \__fontspec_setmonofont:nn
- {
-  \fontspec_set_family:Nnn \ttdefault {#1}{#2}
-  \tl_if_eq:onT {\g__fontspec_mathtt_tl} {\ttdefault}
-   {
-  \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
+  }
+\cs_set:Nn \__fontspec_setmathtt_hook:nn
+  {
     \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
     \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
-   }
-  \normalfont
-  \ignorespaces
- }
-\cs_set:Nn \__fontspec_setmathrm:nn
- {
-  \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
-  \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\updefault
-  \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\mddefault\itdefault
-  \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g__fontspec_mathrm_tl\bfdefault\updefault
- }
-\cs_set:Nn \__fontspec_setboldmathrm:nn
- {
-  \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2}
-  \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\updefault
-  \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\bfdefault\updefault
-  \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g__fontspec_bfmathrm_tl\mddefault\itdefault
- }
-\cs_set:Nn \__fontspec_setmathsf:nn
- {
-  \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
-  \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g__fontspec_mathsf_tl\mddefault\updefault
-  \SetMathAlphabet\mathsf{bold}  \g_fontspec_encoding_tl\g__fontspec_mathsf_tl\bfdefault\updefault
- }
-\cs_set:Nn \__fontspec_setmathtt:nn
- {
-  \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
-  \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g__fontspec_mathtt_tl\mddefault\updefault
-  \SetMathAlphabet\mathtt{bold}  \g_fontspec_encoding_tl\g__fontspec_mathtt_tl\bfdefault\updefault
- }
+  }
 \DeclareDocumentCommand \setmathfont { O{} m O{} }
+  {
+    \__um_setmathfont:nn {#1,#3} {#2}
+  }
+\cs_set:Nn \__um_setmathfont:nn
  {
   \tl_set:Nn \l__um_fontname_tl {#2}
   \__um_init:
   \cs_if_exist:cF { S@ \f at size } { \calculate at math@sizes }
   \csname S@\f at size\endcsname
-  \keys_set_known:nnN {unicode-math} {#1,#3} \l__um_unknown_keys_clist
+  \keys_set_known:nnN {unicode-math} {#1} \l__um_unknown_keys_clist
   \bool_if:NT \l__um_init_bool { \__um_log:n {default-math-font} }
 
   \__um_fontspec_select_font:
@@ -1195,16 +1168,7 @@
     \__um_input_math_symbol_table:
   \group_end:
  }
-\AtBeginDocument { \__um_load_lm_if_necessary: }
-\cs_new:Nn \__um_load_lm_if_necessary:
-  {
-    \cs_if_exist:NF \l__um_fontname_tl
-      {
-        % TODO: update this when lmmath-bold.otf is released
-        \setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}]
-        \bool_set_false:N \g__um_mainfont_already_set_bool
-      }
-  }
+
 \cs_new:Nn \__um_arg_i_before_egroup:n {#1\egroup}
 \cs_new:Nn \__um_superscript:n
  {
@@ -1787,6 +1751,16 @@
   \cs_gset:Npn  \ngreater  { \ngtr }
   \cs_gset:Npn  \nforksnot { \forks }
  }
+\AtBeginDocument { \__um_load_lm_if_necessary: }
+\cs_new:Nn \__um_load_lm_if_necessary:
+  {
+    \cs_if_exist:NF \l__um_fontname_tl
+      {
+        % TODO: update this when lmmath-bold.otf is released
+        \setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}]
+        \bool_set_false:N \g__um_mainfont_already_set_bool
+      }
+  }
 \cs_new_protected_nopar:Nn \__um_check_and_fix:NNnnnn
  {
   \cs_if_exist:NT #1

Modified: trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty	2017-10-02 21:58:27 UTC (rev 45452)
+++ trunk/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty	2017-10-02 21:58:46 UTC (rev 45453)
@@ -4,7 +4,7 @@
 %%
 %% The original source files were:
 %%
-%% unicode-math.dtx  (with options: `preamble')
+%% unicode-math-preamble.dtx  (with options: `preamble')
 %% unicode-math-msg.dtx  (with options: `msg')
 %% unicode-math-usv.dtx  (with options: `usv')
 %% unicode-math.dtx  (with options: `load')
@@ -18,10 +18,8 @@
 %% (your choice): <http://www.latex-project.org/lppl/>.
 %% 
 %% This work is "maintained" by Will Robertson.
-\ProvidesPackage{unicode-math}
-  [2017/08/02 v0.8f Unicode maths in XeLaTeX and LuaLaTeX]
-\usepackage{ifxetex,ifluatex}
-\ifxetex
+
+\ifdefined\XeTeXversion
   \ifdim\number\XeTeXversion\XeTeXrevision in<0.9998in%
     \PackageError{unicode-math}{%
       Cannot run with this version of XeTeX!\MessageBreak
@@ -28,7 +26,7 @@
       You need XeTeX 0.9998 or newer.%
     }\@ehd
   \fi
-\else\ifluatex
+\else\ifdefined\luatexversion
   \ifnum\luatexversion<64%
     \PackageError{unicode-math}{%
       Cannot run with this version of LuaTeX!\MessageBreak
@@ -387,6 +385,25 @@
  {
   \tl_use:N \l__um_mathstyle_tl
  }
+\tl_map_inline:nn
+ {
+  \new at mathgroup\cdp at list\cdp at elt\DeclareMathSizes
+  \@DeclareMathSizes\newmathalphabet\newmathalphabet__um\newmathalphabet__um@
+  \DeclareMathVersion\define at mathalphabet\define at mathgroup\addtoversion
+  \version at list\version at elt\alpha at list\alpha at elt
+  \restore at mathversion\init at restore@version\dorestore at version\process at table
+  \new at mathversion\DeclareSymbolFont\group at list\group at elt
+  \new at symbolfont\SetSymbolFont\SetSymbolFont@\get at cdp
+  \DeclareMathAlphabet\new at mathalphabet\SetMathAlphabet\SetMathAlphabet@
+  \DeclareMathAccent\set at mathaccent\DeclareMathSymbol\set at mathchar
+  \set at mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter
+  \@DeclareMathDelimiter\@xDeclareMathDelimiter\set at mathdelimiter
+  \set__ummathdelimiter\DeclareMathRadical\mathchar at type
+  \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@
+ }
+ {
+  \tl_remove_once:Nn \@preamblecmds {\do#1}
+ }
 
 \cs_new:Npn \__um_error:n   { \msg_error:nn   {unicode-math} }
 \cs_new:Npn \__um_warning:n { \msg_warning:nn {unicode-math} }



More information about the tex-live-commits mailing list