diff options
Diffstat (limited to 'Master')
24 files changed, 370 insertions, 282 deletions
diff --git a/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md b/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md index 9c48bda9b09..b309a174625 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md +++ b/Master/texmf-dist/doc/latex/unicode-math/CHANGES.md @@ -1,6 +1,14 @@ CHANGE HISTORY ============== +## v0.8l (2018/02/02) + + * Issue an error message if `\setmathfont{...}[range=...]` is used first; a `range` + declaration inherently implies a subset, so a ‘main’ math font needs to be set up first. + * Fix issue when nesting `\mathXX` and `\symZZ` commands. (#356, #435, #438) + * Fix another issue when using `mathXX` or `\symXX` inside `\DeclareMathOperator`. (#449) + * Document incompatibility with the `mathspec` package. (#436) + * Fix bugs for using `range=\partial` and `range=\nabla`. (#441) ## v0.8k (2018/01/13) diff --git a/Master/texmf-dist/doc/latex/unicode-math/MANIFEST.md b/Master/texmf-dist/doc/latex/unicode-math/MANIFEST.md index e0478e1fdef..638be84dabe 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/MANIFEST.md +++ b/Master/texmf-dist/doc/latex/unicode-math/MANIFEST.md @@ -19,7 +19,6 @@ be installed for processing such as testing. | File | Flag | Description | | --- | --- | --- | | unicode-math.dtx | ‡ | Metadata for the package code, including files and versioning | - | um-code-base.dtx | ‡ | Definition of unicode-math.sty, which splits and loads according to engine. | | um-code-opening.dtx | ‡ | Assorted initialisation tasks, including some low-level function definitions. | | um-code-variables.dtx | ‡ | Declaration of all code-level variables used in the package. | | um-code-api.dtx | ‡ | The (underdeveloped) API to interface with the package internals. | @@ -35,11 +34,11 @@ be installed for processing such as testing. | um-code-mathmap.dtx | ‡ | Setup of symbol alphabets. | | um-code-sym-commands.dtx | ‡ | Definition of "math symbol alphabet" commands such as `\symbf` and co. | | um-code-alphabets.dtx | ‡ | Definitions for setting up the "math symbol alphabets". | - | um-code-epilogue.dtx | ‡ | Assorted definitions to close up. | | um-code-primes.dtx | ‡ | The definitions needed for the input of primes. | | um-code-sscript.dtx | ‡ | Setup for active chars needed to process subscript/superscript input chars. | | um-code-compat.dtx | ‡ | Compatibility with 3rd party packages. | | um-code-amsmath.dtx | ‡ | Compatibility with amsmath. | + | um-code-epilogue.dtx | ‡ | Assorted definitions to close up. | | unicode-math.ins | ‡ | Docstrip installer. | | unicode-math-table.tex | ‡ | Source file of the math symbols. | @@ -159,26 +158,25 @@ All files included in the `unicode-math/source` directory. 1. um-code-alphabets.dtx 2. um-code-amsmath.dtx 3. um-code-api.dtx - 4. um-code-base.dtx - 5. um-code-compat.dtx - 6. um-code-epilogue.dtx - 7. um-code-fontopt.dtx - 8. um-code-fontparam.dtx - 9. um-code-main.dtx -10. um-code-mathmap.dtx -11. um-code-mathtext.dtx -12. um-code-msg.dtx -13. um-code-opening.dtx -14. um-code-pkgopt.dtx -15. um-code-primes.dtx -16. um-code-setchar.dtx -17. um-code-sscript.dtx -18. um-code-sym-commands.dtx -19. um-code-ui.dtx -20. um-code-usv.dtx -21. um-code-variables.dtx -22. unicode-math.dtx -23. unicode-math.ins + 4. um-code-compat.dtx + 5. um-code-epilogue.dtx + 6. um-code-fontopt.dtx + 7. um-code-fontparam.dtx + 8. um-code-main.dtx + 9. um-code-mathmap.dtx +10. um-code-mathtext.dtx +11. um-code-msg.dtx +12. um-code-opening.dtx +13. um-code-pkgopt.dtx +14. um-code-primes.dtx +15. um-code-setchar.dtx +16. um-code-sscript.dtx +17. um-code-sym-commands.dtx +18. um-code-ui.dtx +19. um-code-usv.dtx +20. um-code-variables.dtx +21. unicode-math.dtx +22. unicode-math.ins ### TeX files (TDS) @@ -224,38 +222,37 @@ The following group lists the files included in the CTAN package. 4. um-code-alphabets.dtx 5. um-code-amsmath.dtx 6. um-code-api.dtx - 7. um-code-base.dtx - 8. um-code-compat.dtx - 9. um-code-epilogue.dtx -10. um-code-fontopt.dtx -11. um-code-fontparam.dtx -12. um-code-main.dtx -13. um-code-mathmap.dtx -14. um-code-mathtext.dtx -15. um-code-msg.dtx -16. um-code-opening.dtx -17. um-code-pkgopt.dtx -18. um-code-primes.dtx -19. um-code-setchar.dtx -20. um-code-sscript.dtx -21. um-code-sym-commands.dtx -22. um-code-ui.dtx -23. um-code-usv.dtx -24. um-code-variables.dtx -25. um-doc-legacyfontdimen.tex -26. um-doc-main.tex -27. um-doc-mathfontdimen.tex -28. um-doc-nfsssummary.tex -29. um-doc-stixextract.tex -30. um-doc-style.tex -31. unicode-math-code.ltx -32. unicode-math-code.pdf -33. unicode-math-table.tex -34. unicode-math.dtx -35. unicode-math.ins -36. unicode-math.ltx -37. unicode-math.pdf -38. unimath-example.ltx -39. unimath-example.pdf -40. unimath-symbols.ltx -41. unimath-symbols.pdf + 7. um-code-compat.dtx + 8. um-code-epilogue.dtx + 9. um-code-fontopt.dtx +10. um-code-fontparam.dtx +11. um-code-main.dtx +12. um-code-mathmap.dtx +13. um-code-mathtext.dtx +14. um-code-msg.dtx +15. um-code-opening.dtx +16. um-code-pkgopt.dtx +17. um-code-primes.dtx +18. um-code-setchar.dtx +19. um-code-sscript.dtx +20. um-code-sym-commands.dtx +21. um-code-ui.dtx +22. um-code-usv.dtx +23. um-code-variables.dtx +24. um-doc-legacyfontdimen.tex +25. um-doc-main.tex +26. um-doc-mathfontdimen.tex +27. um-doc-nfsssummary.tex +28. um-doc-stixextract.tex +29. um-doc-style.tex +30. unicode-math-code.ltx +31. unicode-math-code.pdf +32. unicode-math-table.tex +33. unicode-math.dtx +34. unicode-math.ins +35. unicode-math.ltx +36. unicode-math.pdf +37. unimath-example.ltx +38. unimath-example.pdf +39. unimath-symbols.ltx +40. unimath-symbols.pdf diff --git a/Master/texmf-dist/doc/latex/unicode-math/RELEASE_CHECKLIST.md b/Master/texmf-dist/doc/latex/unicode-math/RELEASE_CHECKLIST.md new file mode 100644 index 00000000000..445351f8136 --- /dev/null +++ b/Master/texmf-dist/doc/latex/unicode-math/RELEASE_CHECKLIST.md @@ -0,0 +1,18 @@ +# UNICODE-MATH RELEASE CHECKLIST + +- [ ] Finish final changes on `working` branch +- [ ] Ensure `CHANGES.md` is up-to-date with a new version number +- [ ] `build setversion` +- [ ] Update local distro fully with tlmgr +- [ ] Run `build check` locally +- [ ] `git push` +- [ ] Check Travis build status +- [ ] Install prerelease versions of `fontspec` and `latex3` and re-check +- [ ] `git checkout master; git rebase working` +- [ ] `build ctan` +- [ ] Upload to CTAN +- [ ] `texlua tagrelease.lua` to tag release with version number, annotated with changes +- [ ] `git push` — assuming tags are pushed by default (might need a local gitconfig) +- [ ] `git checkout working` +- [ ] `build install` +- [ ] Check `latex3/contrib/testfiles/unicode-math001.lvt` and update if necessary diff --git a/Master/texmf-dist/doc/latex/unicode-math/um-doc-main.tex b/Master/texmf-dist/doc/latex/unicode-math/um-doc-main.tex index c6b8c96a077..ff82a414a96 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/um-doc-main.tex +++ b/Master/texmf-dist/doc/latex/unicode-math/um-doc-main.tex @@ -44,6 +44,7 @@ Users who desire to specify maths alphabets only (Greek and Latin letters, and Arabic numerals) may wish to use Andrew Moschou's \pkg{mathspec} package instead. (\XeTeX-only at time of writing.) +Note that \pkg{unicode-math} and \pkg{mathspec} are not compatible with each other. \section{Acknowledgements} @@ -282,6 +283,9 @@ where \meta{unicode range} is a comma-separated list of Unicode slot numbers and Note that \TeX's syntax for accessing the slot number of a character, such as |`\+|, will also work here. Only numerical slots can be used in ranged declarations. +Note that, for efficiency, the \pkg{unicode-math} package only loads a default maths setup when absolutely necessary. +Before you use the |range| option you must first load a `main' maths font in the standard way. + You may also use the macro for accessing the glyph, such as |range=|\cs{int}, or whole collection of symbols with the same math type, such as |range=\mathopen|, or complete math styles such as |range=\symbb| (or just |range=bb|). \subsubsection{Control over alphabet ranges} @@ -850,7 +854,7 @@ are shown in \figref{superscripts,subscripts}. Please request more if you think it is appropriate. \begin{figure}\centering -\fbox{\fontspec{CharisSILR.ttf}\Large +\fbox{\fontspec{DejaVuSerif.ttf}\Large A ^^^^2070 ^^^^00b9 ^^^^00b2 ^^^^00b3 ^^^^2074 ^^^^2075 ^^^^2076 ^^^^2077 ^^^^2078 ^^^^2079 ^^^^207a ^^^^207b ^^^^207c ^^^^207d ^^^^207e ^^^^2071 @@ -858,7 +862,7 @@ A Z} \caption{ The Unicode superscripts supported as input characters. - These are the literal glyphs from Charis SIL, + These are the literal glyphs from the `DejaVu Serif' font, not the output seen when used for maths input. The `A' and `Z' are to provide context for the size and location of the superscript glyphs. @@ -867,7 +871,7 @@ Z} \end{figure} \begin{figure}\centering -\fbox{\fontspec{CharisSILR.ttf}\Large +\fbox{\fontspec{DejaVuSerif.ttf}\Large A ^^^^2080 ^^^^2081 ^^^^2082 ^^^^2083 ^^^^2084 ^^^^2085 ^^^^2086 ^^^^2087 ^^^^2088 ^^^^2089 ^^^^208a ^^^^208b ^^^^208c ^^^^208d ^^^^208e ^^^^2090 diff --git a/Master/texmf-dist/doc/latex/unicode-math/um-doc-nfsssummary.tex b/Master/texmf-dist/doc/latex/unicode-math/um-doc-nfsssummary.tex index a4666af1930..db751e91c21 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/um-doc-nfsssummary.tex +++ b/Master/texmf-dist/doc/latex/unicode-math/um-doc-nfsssummary.tex @@ -5,12 +5,15 @@ In the following, \meta{NFSS decl.} stands for something like |{T1}{lmr}{m}{n}|. \begin{description} -\item[Maths symbol fonts] Fonts for symbols: $\propto$, $\leq$, $\rightarrow$ +\item[Maths symbol fonts] +Fonts for symbols: $\propto$, $\leq$, $\rightarrow$ \cmd\DeclareSymbolFont\marg{name}\meta{NFSS decl.}\\ Declares a named maths font such as |operators| from which symbols are defined with \cmd\DeclareMathSymbol. -\item[Maths alphabet fonts] Fonts for {\font\1=cmmi10 at 10pt\1 ABC}\,–\,{\font\1=cmmi10 at 10pt\1 xyz}, {\font\1=eufm10 at 10pt\1 ABC}\,–\,{\font\1=cmsy10 at 10pt\1 XYZ}, etc. +\item[Maths alphabet fonts] +Fonts for $\symit{ABC}$\,–\,$\symit{xyz}$, +$\symfrak{ABC}$\,–\,$\symscr{XYZ}$, etc. \cmd\DeclareMathAlphabet\marg{cmd}\meta{NFSS decl.} diff --git a/Master/texmf-dist/doc/latex/unicode-math/um-doc-style.tex b/Master/texmf-dist/doc/latex/unicode-math/um-doc-style.tex index 88c761e512b..46c2a8e1cf8 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/um-doc-style.tex +++ b/Master/texmf-dist/doc/latex/unicode-math/um-doc-style.tex @@ -13,14 +13,18 @@ \usepackage[svgnames]{xcolor} \usepackage[inline]{enumitem} -\usepackage{amsmath,array,booktabs,calc,enumitem,fancyvrb,graphicx,ifthen,longtable,refstyle,subfig,topcapt,url,varioref,underscore} -\setcounter{LTchunksize}{100} +\usepackage{amsmath,array,booktabs,calc,enumitem,fancyvrb,graphicx,ifthen,longtable,refstyle,topcapt,url,varioref,underscore} \usepackage[slash-delimiter=frac,nabla=literal]{unicode-math} \usepackage{metalogo,hologo} -\fvset{fontsize=\small,xleftmargin=2em} \usepackage[it]{titlesec} +% fancyvrb +\fvset{fontsize=\small,xleftmargin=2em} + +% longtable +\setcounter{LTchunksize}{100} + \setmainfont{texgyrepagella}% [ Extension = .otf , @@ -48,6 +52,7 @@ \setmathfont[version=xits]{xits-math.otf} \newfontface\umfont{xits-math.otf} +\expandafter\def\csname ver@thumbpdf.sty\endcsname{} \usepackage{hypdoc} \hypersetup{linktocpage} diff --git a/Master/texmf-dist/doc/latex/unicode-math/unicode-math-code.pdf b/Master/texmf-dist/doc/latex/unicode-math/unicode-math-code.pdf Binary files differindex 08df8f475a1..79b17d3d19d 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/unicode-math-code.pdf +++ b/Master/texmf-dist/doc/latex/unicode-math/unicode-math-code.pdf diff --git a/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf b/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf Binary files differindex 5b4d6b74a40..94d3a034995 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf +++ b/Master/texmf-dist/doc/latex/unicode-math/unicode-math.pdf diff --git a/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf b/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf Binary files differindex e7a09a28cbe..4a5e798a464 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf +++ b/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.pdf diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx index 57927c73bc1..0b67a673f57 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-amsmath.dtx @@ -195,7 +195,7 @@ { \box_use:N \rootbox } \@@_mathstyle_scale:NnnN #1 { \kern } { \fontdimen 64 \g_@@_sqrt_font_cmd_tl } \g_@@_sqrt_font_cmd_tl \mkern \leftroot@ mu - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } %</XE> } diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-compat.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-compat.dtx index 2aca97a2fa9..668acbad2f9 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-compat.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-compat.dtx @@ -124,7 +124,7 @@ { \box_ht:N \l_tmpa_box - \@@_radical_vgap:N #1 } - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } } %</XE> diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-epilogue.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-epilogue.dtx index cb8a701bb45..3cbaefef3ba 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-epilogue.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-epilogue.dtx @@ -74,7 +74,7 @@ } { \box_use:N \rootbox } \@@_mathstyle_scale:NnnN ##1 { \kern } { \fontdimen 64 \g_@@_sqrt_font_cmd_tl } \g_@@_sqrt_font_cmd_tl - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } } %</XE> @@ -383,11 +383,15 @@ \@@_undeclare_symbol:N \bracevert % \end{macrocode} % -% \paragraph{Fin} +% \begin{macrocode} +%</package> +% \end{macrocode} +% +% \section*{Fin} +% % The official end of the package: % \begin{macrocode} %<package>\endinput -%</package> % \end{macrocode} \endinput diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-fontopt.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-fontopt.dtx index 4e142e967bb..77924ee9894 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-fontopt.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-fontopt.dtx @@ -40,6 +40,7 @@ { range .code:n = { + \bool_if:NF \g_@@_main_font_defined_bool { \@@_error:n {no-main-font} } \bool_set_false:N \l_@@_init_bool \@@_range_init: \group_begin: @@ -165,17 +166,19 @@ \cs_new_protected:Nn \@@_range_decl:n { \bool_lazy_and:nnTF { \tl_if_single_p:n {#1} } { \token_if_cs_p:N #1 } + % IF A CSNAME: { \tl_if_in:VnTF #1 { \q_unicode_math } { \seq_if_in:NnTF \g__um_mathclasses_seq {#1} { \seq_gput_right:Nn \g_@@_mclass_range_seq {#1} } - { \seq_gput_right:Nx \g_@@_char_range_seq {#1} } + { \seq_gput_right:Nx \g_@@_char_range_seq { #1 } } } { \@@_error:nx {bad-cs-in-range} { \tl_to_str:n {#1} } } } + % ELSE ASSUME NUMERIC INPUT: { - \seq_gput_right:Nx \g_@@_char_range_seq {#1} + \seq_gput_right:Nx \g_@@_char_range_seq { #1 } } } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx index 0cd47069e3c..e57fbf45d15 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx @@ -70,6 +70,7 @@ \bool_if:NTF \l_@@_init_bool { + \bool_gset_true:N \g_@@_main_font_defined_bool %<LU> \@@_mathparam_store: \@@_log:n {default-math-font} } @@ -89,7 +90,7 @@ \AtBeginDocument { \@@_load_lm_if_necessary: } \cs_new:Nn \@@_load_lm_if_necessary: { - \cs_if_exist:NF \l_@@_fontname_tl + \bool_if:NF \g_@@_main_font_defined_bool { %<debug>\typeout{SETTING~ DEFAULT~ FONT~(latinmodern-math)} \setmathfont{latinmodern-math.otf} @@ -157,7 +158,7 @@ %<LU> Renderer = Basic, BoldItalicFont = {}, ItalicFont = {}, Script = Math, -%<LU> FontAdjustment = { \g_@@_luatex_copy_fontdimens_tl }, +%<LU> FontAdjustment = { \@@_luatex_copy_fontdimens: }, \l_@@_unknown_keys_clist } @@ -205,7 +206,7 @@ \l_@@_sscript_features_tl } } , -%<LU> FontAdjustment = { \g_@@_luatex_copy_fontdimens_tl }, +%<LU> FontAdjustment = { \@@_luatex_copy_fontdimens: }, \l_@@_unknown_keys_clist } @@ -236,10 +237,10 @@ \tl_set:Nn \g_@@_prime_font_cmd_tl { \l_@@_font } % \end{macrocode} % -% \begin{macro}{\g_@@_luatex_copy_fontdimens_tl} +% \begin{macro}{\@@_luatex_copy_fontdimens:} % \begin{macrocode} %<*LU> -\tl_const:Nn \g_@@_luatex_copy_fontdimens_tl +\cs_new_protected:Nn \@@_luatex_copy_fontdimens: { \@@_fontdimen_from_param:nn {10} {ScriptPercentScaleDown} \@@_fontdimen_from_param:nn {11} {ScriptScriptPercentScaleDown} diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-mathmap.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-mathmap.dtx index b3257369c0d..056e03bd715 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-mathmap.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-mathmap.dtx @@ -75,14 +75,17 @@ \clist_map_inline:Nn \l_@@_alphabet_clist { - \clist_map_inline:cn {g_@@_named_slots_ \l_@@_style_tl _ ####1 _clist} + \clist_if_exist:cT {g_@@_named_slots_ \l_@@_style_tl _ ####1 _clist} { - \clist_map_inline:Nn \l_@@_mathmap_charints_clist + \clist_map_inline:cn {g_@@_named_slots_ \l_@@_style_tl _ ####1 _clist} { - \@@_int_if_slot_in_range:nnT {################1} {########1} + \clist_map_inline:Nn \l_@@_mathmap_charints_clist { - \seq_gput_right:Nn \g_@@_mathalph_seq {##1} - \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + \@@_int_if_slot_in_range:nnT {################1} {########1} + { + \seq_gput_right:Nn \g_@@_mathalph_seq {##1} + \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + } } } } diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx index c576d63770b..903cd0407e1 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-mathtext.dtx @@ -10,6 +10,7 @@ % \subsection{\cs{setmathfontface}} % % \begin{macro}{\@@_setmathfontface:Nnn} +% Interface around \cs{SetMathAlphabet}. % \begin{macrocode} \keys_define:nn {@@_mathface} { @@ -47,6 +48,81 @@ % \end{macro} % % +% \subsection{Hooks into \LaTeXe} +% +% Switching to a different style of alphabetic symbols was traditionally performed with +% commands like \cmd\mathbf, which literally changes fonts to access alternate symbols. +% This is not as simple with Unicode fonts. +% +% In traditional \TeX{} maths font setups, you simply switch between different `families' (\cmd\fam), which is analogous to changing from one font to another---a symbol such as `a' will be upright in one font, bold in another, and so on. +% In pkg{unicode-math}, a different mechanism is used to switch between styles. For every letter (start with ascii a-zA-Z and numbers to keep things simple for now), they are assigned a `mathcode' with \cmd\Umathcode\ that maps from input letter to output font glyph slot. This is done with the equivalent of +% \begin{Verbatim} +% \Umathcode`\a = 7 1 "1D44E\relax +% \Umathcode`\b = 7 1 "1D44F\relax +% \Umathcode`\c = 7 1 "1D450\relax +% ... +% \end{Verbatim} +% When switching from regular letters to, say, \cmd\mathrm, we now need to execute a new mapping: +% \begin{Verbatim} +% \Umathcode`\a = 7 1 `\a\relax +% \Umathcode`\b = 7 1 `\b\relax +% \Umathcode`\c = 7 1 `\c\relax +% ... +% \end{Verbatim} +% This is fairly straightforward to perform when we're defining our own commands such as \cmd\symbf\ and so on. However, this means that `classical' \TeX\ font setups will break, because with the original mapping still in place, the engine will be attempting to insert unicode maths glyphs from a standard font. +% +% \begin{macro}{\use@mathgroup} +% To overcome this, we patch \cs{use@mathgroup}, which is only used inside of commands +% such as \cs{mathXYZ}, so this shouldn't have any side-effects. +% Omit the test for math mode because this is only called \emph{inside} \cs{mathrm} or similar, +% which already has a math mode check. +% \begin{macrocode} +\cs_set:Npn \use@mathgroup #1 #2 + { + \@@_group_begin: + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \@@_switchto_literal: + \@@_mathgroup_set:n {#2} + \@@_group_end:n + } +% \end{macrocode} +% \end{macro} +% +% In LaTeX maths, the command |\operator@font| is defined that switches to the |operator| mathgroup. The classic example is the |\sin| in |$\sin{x}$|; essentially we’re using |\mathrm| to typeset the upright symbols, but the syntax is |{\operator@font sin}|. +% I thought that hooking into |\operator@font| would be hard because all other maths font selection in 2e uses |\mathrm{...}| style. +% Then reading source2e a little more I stumbled upon \cs{@fontswitch}. +% Reimplement that here to avoid \cs{bgroup}/\cs{egroup}. +% \begin{macro}{\operator@font} +% \begin{macrocode} +\cs_set:Npn \operator@font + { + \@@_switchto_literal: + \@@_fontswitch:n { \g_@@_operator_mathfont_tl } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_fontswitch:n} +% Omit the check for math mode as \verb|#1| should do that for us. +% \begin{macrocode} +\cs_set:Nn \@@_fontswitch:n + { + \cs_set_eq:NN \math@bgroup \scan_stop: + \cs_set_eq:NN \@@_group_begin: \scan_stop: + \cs_set:Npn \@@_group_end:n % takes no argument in this case + { + \cs_set_eq:NN \@@_group_begin: \@@_group_begin_frozen: + \cs_set_eq:NN \@@_group_end:n \@@_group_end_frozen:n + \cs_set_eq:NN \math@bgroup \@@math@bgroup + \cs_set_eq:NN \math@egroup \@@math@egroup + } + \cs_set_eq:NN \math@egroup \@@_group_end:n + #1 \scan_stop: + } +% \end{macrocode} +% \end{macro} +% +% % \subsection{Hooks into \pkg{fontspec}} % % Historically, \cs{mathrm} and so on were completely overwritten by \pkg{unicode-math}, and \pkg{fontspec}'s methods for setting these fonts in the classical manner were bypassed. @@ -91,6 +167,7 @@ % \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 diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-msg.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-msg.dtx index db561dcebb3..9e51fd6600a 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-msg.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-msg.dtx @@ -114,6 +114,11 @@ since they relate to input commands not output glyphs. Use `bfit` or `bfup` (etc.) to specify which. } +\@@_msg_new:nn {no-main-font} + { + No main maths font has been set up yet.\\If you simply want ‘the default’, use: \\ + \iow_indent:n {\token_to_str:N\setmathfont{latinmodern-math.otf}} + } % \end{macrocode} % % \begin{macrocode} diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx index 4e9493bb65e..76fe65e33e3 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-opening.dtx @@ -42,9 +42,9 @@ % % \begin{macrocode} \cs_set_eq:NN \@@_group_begin: \group_begin: -\cs_set_eq:NN \@@_group_end: \group_end: +\cs_set_protected:Npn \@@_group_end:n #1 { #1 \group_end: } \cs_set_eq:NN \@@_group_begin_frozen: \@@_group_begin: -\cs_set_eq:NN \@@_group_end_frozen: \@@_group_end: +\cs_set_eq:NN \@@_group_end_frozen:n \@@_group_end:n % \end{macrocode} % % @@ -182,6 +182,18 @@ } % \end{macrocode} % +% \subsubsection{NFSS-related interfaces} +% +% \begin{macro}{\@@_mathgroup_set:n} +% Remember that \cs{mathgroup} is just \cs{fam}! +% \begin{macrocode} +\cs_new_protected:Nn \@@_mathgroup_set:n + { + \tex_fam:D #1 \scan_stop: + } +% \end{macrocode} +% \end{macro} +% % \subsubsection{Font parameters} % % \begin{macro}{\@@_copy_fontdimen:nnN} @@ -211,7 +223,9 @@ %<*LU> \cs_new_protected:Nn \@@_fontdimen_from_param:nn { - \fontdimen #1 \font = \directlua{fontspec.mathfontdimen(font.current(),"#2")}\relax + \fontdimen #1 \font = + \lua_now:n { fontspec.mathfontdimen(font.current(),"#2") } + \scan_stop: } %</LU> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-sym-commands.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-sym-commands.dtx index cd7263ecf9e..9b1d67a3061 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-sym-commands.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-sym-commands.dtx @@ -8,83 +8,6 @@ %<*package> % \end{macrocode} % -% Switching to a different style of alphabetic symbols was traditionally performed with -% commands like \cmd\mathbf, which literally changes fonts to access alternate symbols. -% This is not as simple with Unicode fonts. -% -% In traditional \TeX{} maths font setups, you simply switch between different `families' (\cmd\fam), which is analogous to changing from one font to another---a symbol such as `a' will be upright in one font, bold in another, and so on. -% In pkg{unicode-math}, a different mechanism is used to switch between styles. For every letter (start with ascii a-zA-Z and numbers to keep things simple for now), they are assigned a `mathcode' with \cmd\Umathcode\ that maps from input letter to output font glyph slot. This is done with the equivalent of -% \begin{Verbatim} -% \Umathcode`\a = 7 1 "1D44E\relax -% \Umathcode`\b = 7 1 "1D44F\relax -% \Umathcode`\c = 7 1 "1D450\relax -% ... -% \end{Verbatim} -% When switching from regular letters to, say, \cmd\mathrm, we now need to execute a new mapping: -% \begin{Verbatim} -% \Umathcode`\a = 7 1 `\a\relax -% \Umathcode`\b = 7 1 `\b\relax -% \Umathcode`\c = 7 1 `\c\relax -% ... -% \end{Verbatim} -% This is fairly straightforward to perform when we're defining our own commands such as \cmd\symbf\ and so on. However, this means that `classical' \TeX\ font setups will break, because with the original mapping still in place, the engine will be attempting to insert unicode maths glyphs from a standard font. -% -% \subsection{Hooks into \LaTeXe} -% -% To overcome this, we patch \cs{use@mathgroup}. -% (An alternative is to patch \cs{extract@alph@from@version}, which constructs the \cs{mathXYZ} commands, but this method fails if the command has been defined using \cs{DeclareSymbolFontAlphabet}.) -% As far as I can tell, this is only used inside of commands such as \cs{mathXYZ}, so this shouldn't have any major side-effects. -% -% \begin{macrocode} -\cs_set:Npn \use@mathgroup #1 #2 - { - \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! - { - \math@bgroup - \cs_if_eq:cNF {M@\f@encoding} #1 {#1} - \@@_switchto_literal: - \mathgroup #2 \relax - \math@egroup - } - } -% \end{macrocode} -% -% In LaTeX maths, the command |\operator@font| is defined that switches to the |operator| mathgroup. The classic example is the |\sin| in |$\sin{x}$|; essentially we’re using |\mathrm| to typeset the upright symbols, but the syntax is |{\operator@font sin}|. -% I thought that hooking into |\operator@font| would be hard because all other maths font selection in 2e uses |\mathrm{...}| style. -% Then reading source2e a little more I stumbled upon \cs{@fontswitch}. -% Reimplement that here to avoid \cs{bgroup}/\cs{egroup}. -% \begin{macro}{\operator@font} -% \begin{macrocode} -\cs_set:Npn \operator@font - { - \@@_switchto_literal: - \@@_fontswitch:n { \g_@@_operator_mathfont_tl } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\@@_fontswitch:n} -% \begin{macrocode} -\cs_set:Nn \@@_fontswitch:n - { - \mode_if_math:T - { - \cs_set_eq:NN \math@bgroup \scan_stop: - \cs_set_eq:NN \@@_group_begin: \scan_stop: - \cs_set:Npn \@@_group_end: - { - \cs_set_eq:NN \@@_group_begin: \@@_group_begin_frozen: - \cs_set_eq:NN \@@_group_end: \@@_group_end_frozen: - \cs_set_eq:NN \math@bgroup \@@math@bgroup - \cs_set_eq:NN \math@egroup \@@math@egroup - } - \cs_set_eq:NN \math@egroup \@@_group_end: - #1 \scan_stop: - } - } -% \end{macrocode} -% \end{macro} -% % % \subsection{Setting styles} % @@ -134,19 +57,17 @@ { \seq_gput_right:Nn \g_@@_mathstyles_seq {#1} \@@_init_alphabet:n {#1} - \cs_set_protected:cpx {sym#1} ##1 + \cs_set_protected:cpx {sym#1} { \@@_group_begin: \exp_not:n { - \mode_if_math:F - { - \exp_args:Nc \non@alpherr {sym#1} - } + \mode_if_math:F { \exp_args:Nc \non@alpherr {sym#1} } \tl_set:Nn \l_@@_mathstyle_tl {#1} } - \exp_not:c {@@_switchto_#1:} ##1 - \@@_group_end: + \exp_not:c {@@_switchto_#1:} + \@@_mathgroup_set:n {-1} + \@@_group_end:n } } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-variables.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-variables.dtx index 082a38bb3cb..bb5a6ebe3af 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-variables.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-variables.dtx @@ -15,6 +15,11 @@ \bool_new:N \l_@@_ot_math_bool % \end{macrocode} % +% Set when \cs{setmathfont} is run to trap the problem of no main font defined. +% \begin{macrocode} +\bool_new:N \g_@@_main_font_defined_bool +% \end{macrocode} +% % \begin{macrocode} \bool_new:N \l_@@_init_bool \bool_new:N \l_@@_implicit_alph_bool diff --git a/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx b/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx index 83f4012d528..ea0d86dca4d 100644 --- a/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx @@ -60,15 +60,15 @@ %<base>\ProvidesExplPackage{unicode-math} %<package&XE>\ProvidesExplPackage{unicode-math-xetex} %<package&LU>\ProvidesExplPackage{unicode-math-luatex} -%<base|package> {2018/01/13} {v0.8k} {Unicode maths in XeLaTeX and LuaLaTeX} +%<base|package> {2018/02/02} {v0.8l} {Unicode maths in XeLaTeX and LuaLaTeX} % \end{macrocode} % % Here the version and date are setup for typesetting the documentation. % \begin{macrocode} %<*dtx> \date{ - \def\filedate{2018/01/13} - \def\fileversion{v0.8k} + \def\filedate{2018/02/02} + \def\fileversion{v0.8l} \filedate \qquad \fileversion } %</dtx> diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty index 950a76f2a99..0fe53583f55 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty @@ -43,7 +43,7 @@ %%^^A%% Metadata for the package code, including files and versioning \ProvidesExplPackage{unicode-math-luatex} - {2018/01/13} {v0.8k} {Unicode maths in XeLaTeX and LuaLaTeX} + {2018/02/02} {v0.8l} {Unicode maths in XeLaTeX and LuaLaTeX} %%^^A%% um-code-opening.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Assorted initialisation tasks, including some low-level function definitions. @@ -58,9 +58,9 @@ \cs_generate_variant:Nn \prop_get:NnNTF {cx} \cs_generate_variant:Nn \tl_if_eq:nnF {o} \cs_set_eq:NN \__um_group_begin: \group_begin: -\cs_set_eq:NN \__um_group_end: \group_end: +\cs_set_protected:Npn \__um_group_end:n #1 { #1 \group_end: } \cs_set_eq:NN \__um_group_begin_frozen: \__um_group_begin: -\cs_set_eq:NN \__um_group_end_frozen: \__um_group_end: +\cs_set_eq:NN \__um_group_end_frozen:n \__um_group_end:n \prg_new_conditional:Nnn \__um_glyph_if_exist:Nn {p,TF,T,F} { \etex_iffontchar:D #1 #2 \scan_stop: @@ -122,6 +122,10 @@ \char_gset_active_eq:nN {#1} \__um_tmp: \group_end: } +\cs_new_protected:Nn \__um_mathgroup_set:n + { + \tex_fam:D #1 \scan_stop: + } \cs_new:Nn \__um_copy_fontdimen:nnN { \fontdimen #1 \font = \the \fontdimen #2 #3 \relax @@ -132,7 +136,9 @@ } \cs_new_protected:Nn \__um_fontdimen_from_param:nn { - \fontdimen #1 \font = \directlua{fontspec.mathfontdimen(font.current(),"#2")}\relax + \fontdimen #1 \font = + \lua_now:n { fontspec.mathfontdimen(font.current(),"#2") } + \scan_stop: } \cs_new:Nn \usv_set:nnn { \tl_const:cn { c__um_#1_#2_usv } {#3} } \cs_new:Nn \__um_to_usv:nn { \use:c { c__um_#1_#2_usv } } @@ -174,6 +180,7 @@ %%^^A%% Declaration of all code-level variables used in the package. \bool_new:N \l__um_ot_math_bool +\bool_new:N \g__um_main_font_defined_bool \bool_new:N \l__um_init_bool \bool_new:N \l__um_implicit_alph_bool \bool_new:N \g__um_literal_bool @@ -622,6 +629,11 @@ since they relate to input commands not output glyphs. Use `bfit` or `bfup` (etc.) to specify which. } +\__um_msg_new:nn {no-main-font} + { + No main maths font has been set up yet.\\If you simply want ^^e2^^80^^98the default^^e2^^80^^99, use: \\ + \iow_indent:n {\token_to_str:N\setmathfont{latinmodern-math.otf}} + } \char_set_catcode_ignore:n {32} %%^^A%% um-code-usv.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> @@ -1038,6 +1050,33 @@ \mathtt { \cs_set_eq:NN \g__fontspec_mathtt_tl \l__um_tmpa_tl } } } +\cs_set:Npn \use@mathgroup #1 #2 + { + \__um_group_begin: + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \__um_mathgroup_set:n {#2} + \__um_group_end:n + } +\cs_set:Npn \operator@font + { + \__um_switchto_literal: + \__um_fontswitch:n { \g__um_operator_mathfont_tl } + } +\cs_set:Nn \__um_fontswitch:n + { + \cs_set_eq:NN \math@bgroup \scan_stop: + \cs_set_eq:NN \__um_group_begin: \scan_stop: + \cs_set:Npn \__um_group_end:n % takes no argument in this case + { + \cs_set_eq:NN \__um_group_begin: \__um_group_begin_frozen: + \cs_set_eq:NN \__um_group_end:n \__um_group_end_frozen:n + \cs_set_eq:NN \math@bgroup \__ummath@bgroup + \cs_set_eq:NN \math@egroup \__ummath@egroup + } + \cs_set_eq:NN \math@egroup \__um_group_end:n + #1 \scan_stop: + } \cs_generate_variant:Nn \tl_if_eq:nnT {o} \cs_set:Nn \__fontspec_setmainfont_hook:nn { @@ -1133,6 +1172,7 @@ \bool_if:NTF \l__um_init_bool { + \bool_gset_true:N \g__um_main_font_defined_bool \__um_mathparam_store: \__um_log:n {default-math-font} } @@ -1143,7 +1183,7 @@ \AtBeginDocument { \__um_load_lm_if_necessary: } \cs_new:Nn \__um_load_lm_if_necessary: { - \cs_if_exist:NF \l__um_fontname_tl + \bool_if:NF \g__um_main_font_defined_bool { \setmathfont{latinmodern-math.otf} [BoldFont={latinmodern-math.otf}] @@ -1190,7 +1230,7 @@ Renderer = Basic, BoldItalicFont = {}, ItalicFont = {}, Script = Math, - FontAdjustment = { \g__um_luatex_copy_fontdimens_tl }, + FontAdjustment = { \__um_luatex_copy_fontdimens: }, \l__um_unknown_keys_clist } @@ -1233,7 +1273,7 @@ \l__um_sscript_features_tl } } , - FontAdjustment = { \g__um_luatex_copy_fontdimens_tl }, + FontAdjustment = { \__um_luatex_copy_fontdimens: }, \l__um_unknown_keys_clist } @@ -1258,7 +1298,7 @@ \tl_set:Nn \g__um_main_font_cmd_tl { \l__um_font } \tl_set:Nn \g__um_sqrt_font_cmd_tl { \l__um_font } \tl_set:Nn \g__um_prime_font_cmd_tl { \l__um_font } -\tl_const:Nn \g__um_luatex_copy_fontdimens_tl +\cs_new_protected:Nn \__um_luatex_copy_fontdimens: { \__um_fontdimen_from_param:nn {10} {ScriptPercentScaleDown} \__um_fontdimen_from_param:nn {11} {ScriptScriptPercentScaleDown} @@ -1554,6 +1594,7 @@ { range .code:n = { + \bool_if:NF \g__um_main_font_defined_bool { \__um_error:n {no-main-font} } \bool_set_false:N \l__um_init_bool \__um_range_init: \group_begin: @@ -1637,17 +1678,19 @@ \cs_new_protected:Nn \__um_range_decl:n { \bool_lazy_and:nnTF { \tl_if_single_p:n {#1} } { \token_if_cs_p:N #1 } + % IF A CSNAME: { \tl_if_in:VnTF #1 { \q_unicode_math } { \seq_if_in:NnTF \g__um_mathclasses_seq {#1} { \seq_gput_right:Nn \g__um_mclass_range_seq {#1} } - { \seq_gput_right:Nx \g__um_char_range_seq {#1} } + { \seq_gput_right:Nx \g__um_char_range_seq { #1 } } } { \__um_error:nx {bad-cs-in-range} { \tl_to_str:n {#1} } } } + % ELSE ASSUME NUMERIC INPUT: { - \seq_gput_right:Nx \g__um_char_range_seq {#1} + \seq_gput_right:Nx \g__um_char_range_seq { #1 } } } \cs_new:Nn \__um_if_char_spec:nNT @@ -1857,14 +1900,17 @@ \clist_map_inline:Nn \l__um_alphabet_clist { - \clist_map_inline:cn {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} + \clist_if_exist:cT {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} { - \clist_map_inline:Nn \l__um_mathmap_charints_clist + \clist_map_inline:cn {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} { - \__um_int_if_slot_in_range:nnT {################1} {########1} + \clist_map_inline:Nn \l__um_mathmap_charints_clist { - \seq_gput_right:Nn \g__um_mathalph_seq {##1} - \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + \__um_int_if_slot_in_range:nnT {################1} {########1} + { + \seq_gput_right:Nn \g__um_mathalph_seq {##1} + \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + } } } } @@ -2166,56 +2212,21 @@ %%^^A%% um-code-sym-commands.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Definition of "math symbol alphabet" commands such as `\symbf` and co. -\cs_set:Npn \use@mathgroup #1 #2 - { - \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! - { - \math@bgroup - \cs_if_eq:cNF {M@\f@encoding} #1 {#1} - \__um_switchto_literal: - \mathgroup #2 \relax - \math@egroup - } - } -\cs_set:Npn \operator@font - { - \__um_switchto_literal: - \__um_fontswitch:n { \g__um_operator_mathfont_tl } - } -\cs_set:Nn \__um_fontswitch:n - { - \mode_if_math:T - { - \cs_set_eq:NN \math@bgroup \scan_stop: - \cs_set_eq:NN \__um_group_begin: \scan_stop: - \cs_set:Npn \__um_group_end: - { - \cs_set_eq:NN \__um_group_begin: \__um_group_begin_frozen: - \cs_set_eq:NN \__um_group_end: \__um_group_end_frozen: - \cs_set_eq:NN \math@bgroup \__ummath@bgroup - \cs_set_eq:NN \math@egroup \__ummath@egroup - } - \cs_set_eq:NN \math@egroup \__um_group_end: - #1 \scan_stop: - } - } \cs_new:Nn \__um_prepare_mathstyle:n { \seq_gput_right:Nn \g__um_mathstyles_seq {#1} \__um_init_alphabet:n {#1} - \cs_set_protected:cpx {sym#1} ##1 + \cs_set_protected:cpx {sym#1} { \__um_group_begin: \exp_not:n { - \mode_if_math:F - { - \exp_args:Nc \non@alpherr {sym#1} - } + \mode_if_math:F { \exp_args:Nc \non@alpherr {sym#1} } \tl_set:Nn \l__um_mathstyle_tl {#1} } - \exp_not:c {__um_switchto_#1:} ##1 - \__um_group_end: + \exp_not:c {__um_switchto_#1:} + \__um_mathgroup_set:n {-1} + \__um_group_end:n } } \cs_set:Nn \__um_init_alphabet:n diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty index bf50a848004..31c4df21812 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty @@ -43,7 +43,7 @@ %%^^A%% Metadata for the package code, including files and versioning \ProvidesExplPackage{unicode-math-xetex} - {2018/01/13} {v0.8k} {Unicode maths in XeLaTeX and LuaLaTeX} + {2018/02/02} {v0.8l} {Unicode maths in XeLaTeX and LuaLaTeX} %%^^A%% um-code-opening.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Assorted initialisation tasks, including some low-level function definitions. @@ -57,9 +57,9 @@ \cs_generate_variant:Nn \prop_get:NnNTF {cx} \cs_generate_variant:Nn \tl_if_eq:nnF {o} \cs_set_eq:NN \__um_group_begin: \group_begin: -\cs_set_eq:NN \__um_group_end: \group_end: +\cs_set_protected:Npn \__um_group_end:n #1 { #1 \group_end: } \cs_set_eq:NN \__um_group_begin_frozen: \__um_group_begin: -\cs_set_eq:NN \__um_group_end_frozen: \__um_group_end: +\cs_set_eq:NN \__um_group_end_frozen:n \__um_group_end:n \prg_new_conditional:Nnn \__um_glyph_if_exist:Nn {p,TF,T,F} { \etex_iffontchar:D #1 #2 \scan_stop: @@ -121,6 +121,10 @@ \char_gset_active_eq:nN {#1} \__um_tmp: \group_end: } +\cs_new_protected:Nn \__um_mathgroup_set:n + { + \tex_fam:D #1 \scan_stop: + } \cs_new:Nn \__um_copy_fontdimen:nnN { \fontdimen #1 \font = \the \fontdimen #2 #3 \relax @@ -169,6 +173,7 @@ %%^^A%% Declaration of all code-level variables used in the package. \bool_new:N \l__um_ot_math_bool +\bool_new:N \g__um_main_font_defined_bool \bool_new:N \l__um_init_bool \bool_new:N \l__um_implicit_alph_bool \bool_new:N \g__um_literal_bool @@ -616,6 +621,11 @@ since they relate to input commands not output glyphs. Use `bfit` or `bfup` (etc.) to specify which. } +\__um_msg_new:nn {no-main-font} + { + No main maths font has been set up yet.\\If you simply want ^^e2^^80^^98the default^^e2^^80^^99, use: \\ + \iow_indent:n {\token_to_str:N\setmathfont{latinmodern-math.otf}} + } \char_set_catcode_ignore:n {32} %%^^A%% um-code-usv.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> @@ -1032,6 +1042,33 @@ \mathtt { \cs_set_eq:NN \g__fontspec_mathtt_tl \l__um_tmpa_tl } } } +\cs_set:Npn \use@mathgroup #1 #2 + { + \__um_group_begin: + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \__um_mathgroup_set:n {#2} + \__um_group_end:n + } +\cs_set:Npn \operator@font + { + \__um_switchto_literal: + \__um_fontswitch:n { \g__um_operator_mathfont_tl } + } +\cs_set:Nn \__um_fontswitch:n + { + \cs_set_eq:NN \math@bgroup \scan_stop: + \cs_set_eq:NN \__um_group_begin: \scan_stop: + \cs_set:Npn \__um_group_end:n % takes no argument in this case + { + \cs_set_eq:NN \__um_group_begin: \__um_group_begin_frozen: + \cs_set_eq:NN \__um_group_end:n \__um_group_end_frozen:n + \cs_set_eq:NN \math@bgroup \__ummath@bgroup + \cs_set_eq:NN \math@egroup \__ummath@egroup + } + \cs_set_eq:NN \math@egroup \__um_group_end:n + #1 \scan_stop: + } \cs_generate_variant:Nn \tl_if_eq:nnT {o} \cs_set:Nn \__fontspec_setmainfont_hook:nn { @@ -1127,6 +1164,7 @@ \bool_if:NTF \l__um_init_bool { + \bool_gset_true:N \g__um_main_font_defined_bool \__um_log:n {default-math-font} } { @@ -1135,7 +1173,7 @@ \AtBeginDocument { \__um_load_lm_if_necessary: } \cs_new:Nn \__um_load_lm_if_necessary: { - \cs_if_exist:NF \l__um_fontname_tl + \bool_if:NF \g__um_main_font_defined_bool { \setmathfont{latinmodern-math.otf} [BoldFont={latinmodern-math.otf}] @@ -1457,6 +1495,7 @@ { range .code:n = { + \bool_if:NF \g__um_main_font_defined_bool { \__um_error:n {no-main-font} } \bool_set_false:N \l__um_init_bool \__um_range_init: \group_begin: @@ -1540,17 +1579,19 @@ \cs_new_protected:Nn \__um_range_decl:n { \bool_lazy_and:nnTF { \tl_if_single_p:n {#1} } { \token_if_cs_p:N #1 } + % IF A CSNAME: { \tl_if_in:VnTF #1 { \q_unicode_math } { \seq_if_in:NnTF \g__um_mathclasses_seq {#1} { \seq_gput_right:Nn \g__um_mclass_range_seq {#1} } - { \seq_gput_right:Nx \g__um_char_range_seq {#1} } + { \seq_gput_right:Nx \g__um_char_range_seq { #1 } } } { \__um_error:nx {bad-cs-in-range} { \tl_to_str:n {#1} } } } + % ELSE ASSUME NUMERIC INPUT: { - \seq_gput_right:Nx \g__um_char_range_seq {#1} + \seq_gput_right:Nx \g__um_char_range_seq { #1 } } } \cs_new:Nn \__um_if_char_spec:nNT @@ -1788,14 +1829,17 @@ \clist_map_inline:Nn \l__um_alphabet_clist { - \clist_map_inline:cn {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} + \clist_if_exist:cT {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} { - \clist_map_inline:Nn \l__um_mathmap_charints_clist + \clist_map_inline:cn {g__um_named_slots_ \l__um_style_tl _ ####1 _clist} { - \__um_int_if_slot_in_range:nnT {################1} {########1} + \clist_map_inline:Nn \l__um_mathmap_charints_clist { - \seq_gput_right:Nn \g__um_mathalph_seq {##1} - \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + \__um_int_if_slot_in_range:nnT {################1} {########1} + { + \seq_gput_right:Nn \g__um_mathalph_seq {##1} + \clist_map_break:n { \clist_map_break:n { \clist_map_break: } } + } } } } @@ -2097,56 +2141,21 @@ %%^^A%% um-code-sym-commands.dtx -- part of UNICODE-MATH <wspr.io/unicode-math> %%^^A%% Definition of "math symbol alphabet" commands such as `\symbf` and co. -\cs_set:Npn \use@mathgroup #1 #2 - { - \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! - { - \math@bgroup - \cs_if_eq:cNF {M@\f@encoding} #1 {#1} - \__um_switchto_literal: - \mathgroup #2 \relax - \math@egroup - } - } -\cs_set:Npn \operator@font - { - \__um_switchto_literal: - \__um_fontswitch:n { \g__um_operator_mathfont_tl } - } -\cs_set:Nn \__um_fontswitch:n - { - \mode_if_math:T - { - \cs_set_eq:NN \math@bgroup \scan_stop: - \cs_set_eq:NN \__um_group_begin: \scan_stop: - \cs_set:Npn \__um_group_end: - { - \cs_set_eq:NN \__um_group_begin: \__um_group_begin_frozen: - \cs_set_eq:NN \__um_group_end: \__um_group_end_frozen: - \cs_set_eq:NN \math@bgroup \__ummath@bgroup - \cs_set_eq:NN \math@egroup \__ummath@egroup - } - \cs_set_eq:NN \math@egroup \__um_group_end: - #1 \scan_stop: - } - } \cs_new:Nn \__um_prepare_mathstyle:n { \seq_gput_right:Nn \g__um_mathstyles_seq {#1} \__um_init_alphabet:n {#1} - \cs_set_protected:cpx {sym#1} ##1 + \cs_set_protected:cpx {sym#1} { \__um_group_begin: \exp_not:n { - \mode_if_math:F - { - \exp_args:Nc \non@alpherr {sym#1} - } + \mode_if_math:F { \exp_args:Nc \non@alpherr {sym#1} } \tl_set:Nn \l__um_mathstyle_tl {#1} } - \exp_not:c {__um_switchto_#1:} ##1 - \__um_group_end: + \exp_not:c {__um_switchto_#1:} + \__um_mathgroup_set:n {-1} + \__um_group_end:n } } \cs_set:Nn \__um_init_alphabet:n @@ -3525,7 +3534,7 @@ { \box_ht:N \l_tmpa_box - \__um_radical_vgap:N #1 } - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } } \AtEndOfPackageFile * { mathtools } @@ -3679,7 +3688,7 @@ { \box_use:N \rootbox } \__um_mathstyle_scale:NnnN #1 { \kern } { \fontdimen 64 \g__um_sqrt_font_cmd_tl } \g__um_sqrt_font_cmd_tl \mkern \leftroot@ mu - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } } @@ -3721,7 +3730,7 @@ } { \box_use:N \rootbox } \__um_mathstyle_scale:NnnN ##1 { \kern } { \fontdimen 64 \g__um_sqrt_font_cmd_tl } \g__um_sqrt_font_cmd_tl - \box_use_clear:N \l_tmpa_box + \box_use_drop:N \l_tmpa_box } } \cs_new:Nn \__um_which_frac:nn diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty b/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty index 24cc8e1f4b0..1d111d77bd6 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty @@ -24,7 +24,7 @@ \RequirePackage{expl3} \ProvidesExplPackage{unicode-math} - {2018/01/13} {v0.8k} {Unicode maths in XeLaTeX and LuaLaTeX} + {2018/02/02} {v0.8l} {Unicode maths in XeLaTeX and LuaLaTeX} \sys_if_engine_luatex:T { \RequirePackageWithOptions{unicode-math-luatex} } \sys_if_engine_xetex:T { \RequirePackageWithOptions{unicode-math-xetex} } \sys_if_engine_pdftex:T |