diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-30 22:03:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-30 22:03:56 +0000 |
commit | 76b970f64a7bdeaab9327dc4a94f6d28bbc37a2e (patch) | |
tree | f88929f3a1ed7b00dbc34a2db4dc8c4b783479a2 /Master/texmf-dist | |
parent | 60fede9bb7e0593a59a686c5249d424be598ff6c (diff) |
unicode-math (30jul15)
git-svn-id: svn://tug.org/texlive/trunk@38008 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
14 files changed, 9098 insertions, 9319 deletions
diff --git a/Master/texmf-dist/doc/latex/unicode-math/README b/Master/texmf-dist/doc/latex/unicode-math/README index b0b1df18a7d..2029a7940c5 100644 --- a/Master/texmf-dist/doc/latex/unicode-math/README +++ b/Master/texmf-dist/doc/latex/unicode-math/README @@ -57,9 +57,6 @@ Furthermore, it will be in a different font. REQUIREMENTS ------------ -If you're using an up-to-date TeX Live 2011/2012 or MiKTeX 2.9 then there'll -be no problems. Otherwise, read on. - As well as running XeTeX or LuaTeX, this package requires recent versions of the `fontspec`, `expl3`, `xpackages`, `catchfile`, `trimspaces`, `filehook`, and `lualatex-math` packages. @@ -79,79 +76,25 @@ Please file bug reports with minimal examples: > <http://github.com/wspr/unicode-math/issues> -INSTALLATION ------------- - -If you are using the currently supported version of TeX Live (about to be 2012 -at time of writing), you may install the latest release version of the package -with - - sudo tlmgr update unicode-math - -The steps below assume that you have obtained unicode-math either from CTAN or -Github and you wish to install the package yourself. - -Installation and compilation are automated by the Makefile; see below for the -manual procedure. To re-compile the documentation (requiring XeLaTeX and a -variety of installed fonts): - - make doc - -To install unicode-math in your home texmf tree: - - make install - -To install it for all users in your system-wide local texmf tree: - - make install-sys - -See `make help` for further information. - - -### Manual procedure - -Run TeX on unicode-math.dtx to generate the package file `unicode-math.sty`: - - tex unicode-math.dtx - -If you have the necessary fonts, you may compile the documentation -with XeLaTeX: - - xelatex unicode-math.dtx - -To install the package, place unicode-math.sty and unicode-math-table.tex in a -location searched by XeLaTeX, inside the directory structure -`<texmf>/tex/latex/unicode-math/`. The appropriate `<texmf>` location for a -single-user installation can be found with - - kpsewhich --var-value TEXMFHOME - -For a system-wide (multi-user) installation, use the location returned by - - kpsewhich --var-value TEXMFLOCAL +CHANGE HISTORY +-------------- -TEST SUITE ----------- +- v0.8 (2015/07/29) **Breaking changes in this update!** -After installation you can initialise the testsuite with + * `\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. - make initest + * 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. -Subsequently, the test suite may be executed with + * 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. - make check + * New command `\setoperatorfont` to set the font used for commands such as `\sin` and `\cos`. Usage: `\setoperatorfont\mathbf` or any command defined with `\setmathfontface`. -Both of these operations will take quite some time and require ImageMagick's -`convert` tool to be installed. -They are only necessary if you wish to make changes to unicode-math yourself -(be sure to initialise the test suite *before* any changes are made to the -package) and you wish to ensure that your changes have not affected the -standard behaviour. + * Traditional LaTeX `\DeclareMathAlphabet` now works again for legacy font-loading packages. + * Commands defined to "force" Greek letters with `\upbeta` and `\itbeta`, etc. -CHANGE HISTORY --------------- + * Assorted bug fixes and minor changes. - v0.7e (2014/06/30) diff --git a/Master/texmf-dist/doc/latex/unicode-math/unicode-math-doc.tex b/Master/texmf-dist/doc/latex/unicode-math/unicode-math-doc.tex new file mode 100644 index 00000000000..87c1518fdcb --- /dev/null +++ b/Master/texmf-dist/doc/latex/unicode-math/unicode-math-doc.tex @@ -0,0 +1,1492 @@ +% !TEX TS-program = XeLaTeX + +\providecommand\DOCUMENTEND{T} +\documentclass[a4paper]{ltxdoc} + +\if \DOCUMENTEND T \OnlyDescription \fi + +\makeatletter +\GetFileInfo{unicode-math.dtx} +\let\umfiledate\filedate +\let\umfileversion\fileversion + +\CheckSum{0} +\EnableCrossrefs +\CodelineIndex + +\errorcontextlines=999 + +\def\@dotsep{1000} +\setcounter{tocdepth}{2} +\setlength\columnseprule{0.4pt} +\renewcommand\tableofcontents{\relax + \begin{multicols}{2}[\section*{\contentsname}]\relax + \@starttoc{toc}\relax + \end{multicols}} + +\setcounter{IndexColumns}{2} +\renewenvironment{theglossary} + {\small\list{}{} + \item\relax + \glossary@prologue\GlossaryParms + \let\item\@idxitem \ignorespaces + \def\pfill{\hspace*{\fill}}} + {\endlist} + +\usepackage[svgnames]{xcolor} +\usepackage{array,booktabs,calc,enumitem,fancyvrb,graphicx,ifthen,longtable,refstyle,subfig,topcapt,url,varioref,underscore} +\setcounter{LTchunksize}{100} +\usepackage[slash-delimiter=frac,nabla=literal]{unicode-math} +\usepackage{metalogo,hologo} + +\fvset{fontsize=\small,xleftmargin=2em} +\usepackage[it]{titlesec} + +\setmainfont{texgyrepagella}% + [ + Extension = .otf , + UprightFont = *-regular , + ItalicFont = *-italic , + BoldFont = *-bold , + BoldItalicFont = *-bolditalic , + ] +\setsansfont{Iwona}% + [ + Scale=MatchLowercase, + Extension = .otf, + UprightFont = *-Regular, + ItalicFont = *-Italic, + BoldFont = *-Bold, + BoldItalicFont = *-BoldItalic, + ] +\setmonofont{Inconsolatazi4-Regular.otf}% + [ + Scale=MatchLowercase, + BoldFont=Inconsolatazi4-Bold.otf + ] + +\setmathfont{texgyrepagella-math.otf} +\setmathfont[version=xits]{xits-math.otf} +\newfontface\umfont{xits-math.otf} + +\usepackage{hypdoc} +\hypersetup{linktocpage} + +% work around some issue turning | into "j" inside mathsf in the definition of \Module: +% (also prettify) +\def\Module#1{{\footnotesize\color{red}$\langle$\texttt{#1}$\rangle$}} + +\usepackage{minitoc} + +\linespread{1.1} +\frenchspacing + +\definecolor{niceblue}{rgb}{0.2,0.4,0.8} + +\def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}} + +\newcommand*\name[1]{{#1}} +\newcommand*\pkg[1]{\textsf{#1}} +\newcommand*\feat[1]{\texttt{#1}} +\newcommand*\opt[1]{\texttt{#1}} + +\newcommand*\note[1]{\unskip\footnote{#1}} + +\let\latin\textit +\def\eg{\latin{e.g.}} +\def\Eg{\latin{E.g.}} +\def\ie{\latin{i.e.}} +\def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}} + +\def\STIX{\textsc{stix}} +\def\MacOSX{Mac~OS~X} +\def\ascii{\textsc{ascii}} +\def\OMEGA{Omega} + +\newcounter{argument} + +\makeatletter +\g@addto@macro\endmacro{\setcounter{argument}{0}} +\makeatother + +\newcommand*\darg[1]{% + \stepcounter{argument}% + {\ttfamily\char`\#\theargument~:~}#1\par\noindent\ignorespaces +} +\newcommand*\doarg[1]{% + \stepcounter{argument}% + {\ttfamily\makebox[0pt][r]{[}\char`\#\theargument]:~}#1\par\noindent\ignorespaces +} + +\newcommand\codeline[1]{\par{\centering#1\par\noindent}\ignorespaces} + +\newcommand\unichar[1]{\textsc{u}+\texttt{\small#1}} + +\setlength\parindent{2em} + +\def \MakePrivateLetters {% + \catcode`\@=11\relax + \catcode`\_=11\relax + \catcode`\:=11\relax +} + +\def\partname{Part} + +\makeatother + +\begin{document} + +\title{Experimental Unicode mathematical typesetting: The \pkg{unicode-math} package} +\author{Will Robertson, Philipp Stephani and Khaled Hosny\\ + \texttt{will.robertson@latex-project.org}} +\date{\umfiledate \qquad \umfileversion} + +\maketitle + +\begin{abstract} +\noindent +This document describes the \pkg{unicode-math} package, which is +intended as an implementation of Unicode +maths for \LaTeX\ using the \XeTeX\ and Lua\TeX\ typesetting engines. +With this package, changing maths fonts is as easy as changing +text fonts --- and there are more and more maths fonts appearing now. +Maths input can also be simplified with Unicode since literal glyphs may be +entered instead of control sequences in your document source. + +The package provides support for both \XeTeX\ and Lua\TeX. The different +engines provide differing levels of support for Unicode maths. +Please let us know of any troubles. + +Alongside this documentation file, you should be able to find a minimal +example demonstrating the use of the package, +`\texttt{unimath-example.ltx}'. It also comes with a separate document, +`\texttt{unimath-symbols.pdf}', +containing a complete listing of mathematical symbols defined by +\pkg{unicode-math}, including comparisons between different fonts. + +Finally, while the STIX fonts may be used with this package, accessing +their alphabets in their `private user area' is not yet supported. +(Of these additional alphabets there is a separate caligraphic design +distinct to the script design already included.) +Better support for the STIX fonts is planned for an upcoming revision of the +package after any problems have been ironed out with the initial version. + +\end{abstract} + +\doparttoc\faketableofcontents + +\newpage +\part{User documentation} +\parttoc + +\clearpage +\section{Introduction} + +This document describes the \pkg{unicode-math} package, which is an +\emph{experimental} implementation of a macro to Unicode glyph encoding for +mathematical characters. + +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.) + +\section{Acknowledgements} + +Many thanks to: +Microsoft for developing the mathematics extension to OpenType as part of +Microsoft Office~2007; +Jonathan Kew for implementing Unicode math support in \XeTeX; +Taco Hoekwater for implementing Unicode math support in \LuaTeX; +Barbara Beeton for her prodigious effort compiling the definitive list of Unicode math +glyphs and their \LaTeX\ names (inventing them where necessary), and also +for her thoughtful replies to my sometimes incessant questions; +Philipp Stephani for extending the package to support \LuaTeX. +Ross Moore and Chris Rowley have provided moral and technical support +from the very early days with great insight into the issues we face trying +to extend and use \TeX\ in the future. +Apostolos Syropoulos, Joel Salomon, Khaled Hosny, and Mariusz Wodzicki +have been fantastic beta testers. + +\section{Getting started} + +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: +\begin{Verbatim} +\usepackage{amsmath} % if desired +\usepackage{unicode-math} +\setmathfont{Asana-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. +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 (usage: |$\symbfsf{g}$|${}\to\symbfsf{g}$) to select specific `alphabets' within the unicode maths font: +\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}? +(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} + +\subsection{Package options} +Package options may be set when the package as loaded or at any later +stage with the \cs{unimathsetup} command. Therefore, the following two +examples are equivalent: +\begin{Verbatim} +\usepackage[math-style=TeX]{unicode-math} +% OR +\usepackage{unicode-math} +\unimathsetup{math-style=TeX} +\end{Verbatim} +Note, however, that some package options affects how maths is initialised +and changing an option such as |math-style| will not take effect until a +new maths font is set up. + +Package options may \emph{also} be used when declaring new maths fonts, +passed via options to the \cs{setmathfont} command. +Therefore, the following two examples are equivalent: +\begin{Verbatim} +\unimathsetup{math-style=TeX} +\setmathfont{Cambria Math} +% OR +\setmathfont{Cambria Math}[math-style=TeX] +\end{Verbatim} + +A short list of package options is shown in \tabref{pkgopt}. +See following sections for more information. + +\begin{table}\centering + \topcaption{Package options.} + \tablabel{pkgopt} + \begin{tabular}{lll} + \toprule + Option & Description & See\dots \\ + \midrule + |math-style| & Style of letters & \secref{math-style} \\ + |bold-style| & Style of bold letters & \secref{bold-style} \\ + |sans-style| & Style of sans serif letters & \secref{sans-style} \\ + |nabla| & Style of the nabla symbol & \secref{nabla} \\ + |partial| & Style of the partial symbol & \secref{partial} \\ + |vargreek-shape| & Style of phi and epsilon & \secref{vargreek-shape} \\ + |colon| & Behaviour of \cs{colon} & \secref{colon} \\ + |slash-delimiter| & Glyph to use for `stretchy' slash & \secref{slash-delimiter} \\ + \bottomrule + \end{tabular} +\end{table} + + +\section{Unicode maths font setup} + +In the ideal case, a single Unicode font will contain all maths glyphs we +need. The file |unicode-math-table.tex| (based on Barbara Beeton's \STIX\ table) +provides the mapping between Unicode +maths glyphs and macro names (all 3298 — or however many — of them!). A +single command +\codeline{\cmd\setmathfont\marg{font name}\oarg{font features}} +implements this for every every symbol and alphabetic variant. +That means |x| to $x$, |\xi| to $\xi$, |\leq| to $\leq$, etc., |\mathscr{H}| +to $\mathscr{H}$ and so on, all for Unicode glyphs within a single font. + +This package deals well with Unicode characters for maths +input. This includes using literal Greek letters in formulae, +resolving to upright or italic depending on preference. + +Font features specific to \pkg{unicode-math} are shown in \tabref{mathfontfeatures}. +Package options (see \tabref{pkgopt}) may also be used. +Other \pkg{fontspec} features are also valid. + +\begin{table}\centering + \topcaption{Maths font options.} + \tablabel{mathfontfeatures} + \begin{tabular}{lll} + \toprule + Option & Description & See\dots \\ + \midrule + |range| & Style of letters & \secref{range} \\ + |script-font| & Font to use for sub- and super-scripts & \secref{sscript} \\ + |script-features| & Font features for sub- and super-scripts & \secref{sscript} \\ + |sscript-font| & Font to use for nested sub- and super-scripts & \secref{sscript} \\ + |sscript-features| & Font features for nested sub- and super-scripts & \secref{sscript} \\ + \bottomrule + \end{tabular} +\end{table} + +\subsection{Using multiple fonts} +\seclabel{range} + +There will probably be few cases where a single Unicode maths font suffices +(simply due to glyph coverage). The \STIX\ font comes to mind as a +possible exception. It will therefore be necessary to delegate specific +Unicode ranges of glyphs to separate fonts: + \codeline{\cmd\setmathfont\marg{font name}|[range=|\meta{unicode range}|,|\meta{font features}|]|} +where \meta{unicode range} is a comma-separated list of Unicode slot numbers and ranges such as |{"27D0-"27EB,"27FF,"295B-"297F}|. +Note that \TeX's syntax for accessing the slot number of a character, such as |`\+|, will also work here. + +You may also use the macro for accessing the glyph, such as \cs{int}, or whole collection of symbols with the same math type, such as \cs{mathopen}, or complete math styles such as \cs{symbb}. +(Only numerical slots, however, can be used in ranged declarations.) + +\subsubsection{Control over alphabet ranges} + +As discussed earlier, Unicode mathematics consists of a number of `alphabet styles' within a single font. In \pkg{unicode-math}, these ranges are indicated with the following (hopefully self-explanatory) labels: +\begin{quote}\ttfamily +\ExplSyntaxOn +\clist_use:Nn \g__um_named_ranges_clist {\,,\,~} +\ExplSyntaxOff +\end{quote} + +Fonts can be selected for specified ranges only; use the following syntax: +\begin{itemize} +\item |[range=bb]| to use the font for `bb' letters only. +\item |[range=bfsfit/{greek,Greek}]| for Greek lowercase and uppercase only (also with |latin|, |Latin|, |num| as possible options for Latin lower-/upper-case and numbers, resp.). +\item |[range=up->sfup]| to map to different output styles. +\end{itemize} + +Note that `meta-styles' such as `|bf|' and `|sf|' are not included here since they are context dependent. Use |[range=bfup]| and |[range=bfit]| to effect changes to the particular ranges selected by `|bf|' (and similarly for `|sf|'). + +If a particular math style is not defined in the font, we fall back onto the lower-base plane (i.e., `upright') glyphs. +Therefore, to use an \ascii-encoded fractur font, for example, write +\par{\centering|\setmathfont{SomeFracturFont}[range=frak]|\par}\noindent +and because the math plane fractur glyphs will be missing, \pkg{unicode-math} will know to use the \ascii\ ones instead. +If necessary this behaviour can be forced with |[range=frak->up]|, since the `|up|' range corresponds to \ascii\ letters. + +If you wanted to swap the maths symbols with sans serif forms, it would be possible to write |[range={up->sfup,it->sfit}]|. +Note, however, that at present Unicode does not encode glyphs for sans serif Greek (\tabref{mathalphabets}). + +\textbf{v0.8:} Note that in previous versions of \pkg{unicode-math}, these features were labelled |[range=\mathbb]| and so on. This old syntax is still supported for backwards compatibility, but is now discouraged. + + +\subsection{Script and scriptscript fonts/features} +\seclabel{sscript} + +Cambria Math uses OpenType font features to activate smaller optical sizes +for scriptsize and scriptscriptsize symbols (the $B$ and $C$, respectively, +in $A_{B_C}$). Other fonts will possibly use entirely separate fonts. + +The features |script-font| and |sscript-font| allow alternate fonts to be +selected for the script and scriptscript sizes, and |script-features| and +|sscript-features| to apply different OpenType features to them. + +By default |script-features| is defined as |Style=MathScript| and |sscript-features| is |Style=MathScriptScript|. +These correspond to the two levels of OpenType's |ssty| feature tag. +If the |(s)script-features| options are specified manually, you must +additionally specify the |Style| options as above. + + +\subsection{Maths `versions'} + +\LaTeX\ uses a concept known as `maths versions' to switch math fonts +mid-document. +This is useful because it is more efficient than loading a complete maths +font from scratch every time---especially with thousands of glyphs in the case of Unicode maths! +The canonical example for maths versions is to select a `bold' maths font +which might be suitable for section headings, say. +(Not everyone agrees with this typesetting choice, though; be careful.) + +To select a new maths font in a particular version, use the syntax + \codeline{\cmd\setmathfont\marg{font name}|[version=|\meta{version name}|,|\meta{font features}|]|} +and to switch between maths versions mid-document use the standard \LaTeX\ command +\cmd\mathversion\marg{version name}. + + +\subsection{Legacy maths `alphabet' commands} +\seclabel{mathselect} + +\LaTeX\ traditionally uses \cs{DeclareMathAlphabet} and \cs{SetMathAlphabet} to define document commands such as \cs{mathit}, \cs{mathbf}, and so on. +While these commands can still be used, \pkg{unicode-math} defines a wrapper command to assist with the creation of new such maths alphabet commands. +This command is known as \cs{setmathface} in symmetry with \pkg{fontspec}'s \cs{newfontface} command; it takes syntax: +\begin{quote} + \cmd\setmathfontface\meta{command}\marg{font name}|[|\meta{font features}|]| + + \makebox[0pt][l]{\cmd\setmathfontface\meta{command}\marg{font name}|[||version=|\meta{version name}|,|\meta{font features}|]|} +\end{quote} +For example, if you want to define a new legacy maths alphabet font \cs{mathittt}: +\begin{verbatim} + \setmathfontface\mathittt{texgyrecursor-italic.otf} + ... + $\mathittt{foo} = \mathittt{a} + \mathittt{b}$ +\end{verbatim} + + +\subsubsection{Default `text math' fonts} + +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. + +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. + +If the \cs{mathsf} font is set explicitly at any time in the preamble, this `auto-following' does not occur. The legacy math font switches can be defined either with commands defined by \pkg{fontspec} (|\setmathrm|, |\setmathsf|, etc.) or using the more general |\setmathfontface\mathsf| interface defined by \pkg{unicode-math}. + + +\subsubsection{Replacing `text math' fonts by symbols} + +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. + +Alternatively, you may have used an old version of \pkg{unicode-math} (pre-v0.8), when the \cs{symXYZ} commands were not defined and \cs{mathbf} behaved like \cs{symbf} does now. +A series of package options (\tabref{legacyfontswitch}) are provided to facilitate switching the definition of \cs{mathXYZ} for the five legacy text math font definitions. + +\begin{table} + \centering + \topcaption{Maths text font configuration options. Note that \cs{mathup} and \cs{mathrm} are aliases of each other and cannot be configured separately.} + \tablabel{legacyfontswitch} + \begin{tabular}{lll} + \toprule + Defaults (from `text' font) & From `maths symbols' \\ + \midrule + |mathrm=text| & |mathrm=sym | \\ + |mathup=text|\llap{$^\ast$} & |mathup=sym |\llap{$^\ast$} \\ + |mathit=text| & |mathit=sym | \\ + |mathsf=text| & |mathsf=sym | \\ + |mathbf=text| & |mathbf=sym | \\ + |mathtt=text| & |mathtt=sym | \\ + \bottomrule + \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@font} for typesetting elements such as |\sin| and |\cos|. +This font is selected from the legacy |operators| NFSS `MathAlphabet', which is no longer relevant in the context of \pkg{unicode-math}. +By default, the \cs{operator@font} command is defined to switch to the \cs{mathrm} font. +You may now change these using the command: +\begin{Verbatim} +\setoperatorfont\mathit +\end{Verbatim} +Or, to select a \pkg{unicode-math} range: +\begin{Verbatim} +\setoperatorfont\symbf +\end{Verbatim} +\setoperatorfont\symbf +For example, after the latter above, |$\sin x$| will produce `$\sin x$'. + +\mathversion{normal} +\setoperatorfont\mathrm + + +\section{Maths input} + +\XeTeX's Unicode support allows maths input through two methods. Like +classical \TeX, macros such as \cmd\alpha, \cmd\sum, \cmd\pm, \cmd\leq, and +so on, provide verbose access to the entire repertoire of characters defined +by Unicode. The literal characters themselves may be used instead, for more +readable input files. + +\subsection{Math `style'} +\seclabel{math-style} + +Classically, \TeX\ uses italic lowercase Greek letters and \emph{upright} +uppercase Greek letters for variables in mathematics. This is contrary to +the \textsc{iso} standards of using italic forms for both upper- and lowercase. +Furthermore, the French have been +known to use upright uppercase \emph{Latin} letters as well as upright +upper- and lowercase Greek. Finally, it is not unknown to use upright letters +for all characters, as seen in the Euler fonts. + +The \pkg{unicode-math} package accommodates these possibilities with an +interface heavily inspired by Walter Schmidt's \pkg{lucimatx} package: a +package option \opt{math-style} that takes one of four arguments: +\opt{TeX}, \opt{ISO}, \opt{french}, or \opt{upright} (case sensitive). + +The philosophy behind the interface to the mathematical symbols +lies in \LaTeX's attempt of separating content and formatting. Because input +source text may come from a variety of places, the upright and +`mathematical' italic Latin and Greek alphabets are \emph{unified} from the +point of view of having a specified meaning in the source text. That is, to +get a mathematical ‘$x$’, either the \ascii\ (`keyboard') letter |x| may +be typed, or the actual Unicode character may be used. Similarly for Greek +letters. The upright or italic forms are then chosen based on the +|math-style| package option. + +If glyphs are desired that do not map as per the package option (for +example, an upright `g' is desired but typing |$g$| yields `$g$'), +\emph{markup} is required to specify this; to follow from the example: +|\mathup{g}|. Maths style commands such as \cmd\mathup\ are detailed +later. + +\paragraph{`Literal' interface} +However, some users may not like this convention of normalising their input. +For them, an upright |x| is an upright `x' and that's that. +(This will be the case when obtaining source text from copy/pasting PDF or +Microsoft Word documents, for example.) +For these users, the |literal| option to |math-style| will effect this behaviour. +The \cs{symliteral}\marg{syms} command can also be used, regardless of package setting, to force the style to match the literal input characters. +This is a `mirror' to \cs{symnormal}\marg{syms} (also alias \cs{mathnormal}) which `resets' the character mapping in its argument to whatever originally set up through package options. + +The \opt{math-style} options' effects are shown in brief in \tabref{math-style}. + +\begin{table} + \centering + \topcaption{Effects of the \opt{math-style} package option.} + \tablabel{math-style} + \begin{tabular}{@{}>{\ttfamily}lcc@{}} + \toprule + & \multicolumn{2}{c}{Example} \\ + \cmidrule(l){2-3} + \rmfamily Package option & Latin & Greek \\ + \midrule + math-style=ISO & $(a,z,B,X)$ & $\mathit{(\alpha,\beta,\Gamma,\Xi)}$ \\ + math-style=TeX & $(a,z,B,X)$ & $(\mathit\alpha,\mathit\beta,\mathup\Gamma,\mathup\Xi)$ \\ + math-style=french & $(a,z,\mathup B,\mathup X)$ & $(\mathup\alpha,\mathup\beta,\mathup\Gamma,\mathup\Xi)$ \\ + math-style=upright & $(\mathup a,\mathup z,\mathup B,\mathup X)$ & $(\mathup\alpha,\mathup\beta,\mathup\Gamma,\mathup\Xi)$ \\ + \bottomrule + \end{tabular} +\end{table} + + +\subsection{Bold style} +\seclabel{bold-style} + +Similar as in the previous section, ISO standards differ somewhat to \TeX's +conventions (and classical typesetting) for `boldness' in mathematics. In +the past, it has been customary to use bold \emph{upright} letters to denote +things like vectors and matrices. For example, \( \mathbfup{M} = +(\mitM_x,\mitM_y,\mitM_z) \). Presumably, this was due to the relatively +scarcity of bold italic fonts in the pre-digital typesetting era. It has +been suggested that \emph{italic} bold symbols are used nowadays instead. + +Bold Greek letters have simply been bold variant glyphs of their regular +weight, as in \( \mbfitxi = (\mitxi_\mitr,\mitxi_\mitphi,\mitxi_\mittheta) +\). Confusingly, the syntax in \LaTeX\ has been different for these two +examples: \cmd\mathbf\ in the former (`$\mathbfup{M}$'), and \cmd\bm\ (or +\cmd\boldsymbol, deprecated) in the latter (`$\mbfitxi$'). + +In \pkg{unicode-math}, the \cmd\mathbf\ command works directly with both +Greek and Latin maths characters and depending on package option +either switches to upright for Latin letters (|bold-style=TeX|) as well or +keeps them italic (|bold-style=ISO|). + +To match the package options for non-bold characters, with option +|bold-style=upright| all bold characters are upright, and +|bold-style=literal| does not change the upright/italic shape of the letter. + +Upright and italic bold mathematical letters input as direct Unicode +characters are normalised with the same rules. For example, with +|bold-style=TeX|, a literal bold italic latin character will be typeset +upright. + +Note that \opt{bold-style} is independent of \opt{math-style}, although if +the former is not specified then sensible defaults are chosen based on the +latter. + +The \opt{bold-style} options' effects are shown in brief in +\tabref{bold-style}. + +\begin{table} + \centering + \topcaption{Effects of the \opt{bold-style} package option.} + \tablabel{bold-style} + \begin{tabular}{@{}>{\ttfamily}lcc@{}} + \toprule + & \multicolumn{2}{c}{Example} \\ + \cmidrule(l){2-3} + \rmfamily Package option & Latin & Greek \\ + \midrule + bold-style=ISO & $(\mathbfit a, \mathbfit z, \mathbfit B, \mathbfit X)$ & $(\mathbfit\alpha, \mathbfit\beta, \mathbfit\Gamma, \mathbfit\Xi)$ \\ + bold-style=TeX & $(\mathbfup a,\mathbfup z,\mathbfup B,\mathbfup X)$ & $(\mathbfit\alpha, \mathbfit\beta,\mathbfup \Gamma,\mathbfup \Xi)$ \\ + bold-style=upright & $(\mathbfup a,\mathbfup z,\mathbfup B,\mathbfup X)$ & $(\mathbfup \alpha,\mathbfup \beta,\mathbfup \Gamma,\mathbfup \Xi)$ \\ + \bottomrule + \end{tabular} +\end{table} + + +\subsection{Sans serif style} +\seclabel{sans-style} + +Unicode contains upright and italic, medium and bold mathematical style characters. +These may be explicitly selected with the \cs{mathsfup}, \cs{mathsfit}, \cs{mathbfsfup}, and \cs{mathbfsfit} +commands discussed in \secref{all-math-alphabets}. + +How should the generic \cs{mathsf} behave? Unlike bold, sans serif is used much more sparingly +in mathematics. I've seen recommendations to typeset tensors in sans serif italic +or sans serif italic bold (e.g., examples in the \pkg{isomath} and \pkg{mattens} packages). +But \LaTeX's \cs{mathsf} is \textsl{upright} sans serif. + +Therefore I reluctantly add the package options |[sans-style=upright]| and |[sans-style=italic]| to control the behaviour of \cs{mathsf}. +The |upright| style sets up the command to use upright sans serif, including Greek; +the |italic| style switches to using italic in both Latin and Greek. +In other words, this option simply changes the meaning of \cs{mathsf} to either \cs{mathsfup} or \cs{mathsfit}, respectively. +Please let me know if more granular control is necessary here. + +There is also a |[sans-style=literal]| setting, set automatically with |[math-style=literal]|, which retains the uprightness of the input characters used when selecting the sans serif output. + +\subsubsection{What about bold sans serif?} + +While you might want your bold upright and your sans serif italic, I don't believe you'd also want +your bold sans serif upright (or all vice versa, if that's even conceivable). Therefore, bold sans +serif follows from the setting for sans serif; it is completely independent of the setting for bold. + +In other words, \cs{mathbfsf} is either \cs{mathbfsfup} or \cs{mathbfsfit} based on |[sans-style=upright]| or |[sans-style=italic]|, respectively. And |[sans-style=literal]| causes \cs{mathbfsf} to retain the same italic or upright shape as the input, and turns it bold sans serif. + +Note well! There is no medium-weight sans serif Greek range in Unicode; therefore, |\mathsf{\alpha}| does not make sense (simply produces `$\mathsf{\alpha}$') while |\mathbfsf{\alpha}| gives `$\mathsf{\alpha}$'. + +\subsection{All (the rest) of the mathematical styles} +\seclabel{all-math-alphabets} + +Unicode contains separate codepoints for most if not all variations of style +shape one may wish to use in mathematical notation. The complete list is shown +in \tabref{mathalphabets}. Some of these have been covered in the previous sections. + +The math font switching commands do not nest; therefore if you want +sans serif bold, you must write |\mathbfsf{...}| rather than |\mathbf{\mathsf{...}}|. +This may change in the future. + +\begin{table} +\caption{Mathematical styles defined in Unicode. Black dots indicate an style exists in the font specified; blue dots indicate shapes that should always be taken from the upright font even in the italic style. See main text for description of \cs{mathbbit}.} +\tablabel{mathalphabets} +\centering +\def\Y{\textbullet} +\def\M{\textcolor{blue}{\textbullet}} +\begin{tabular}{@{} lll l ccc @{}} +\toprule +\multicolumn{3}{c}{Font} & & \multicolumn{3}{c}{Alphabet} \\ +\cmidrule(r){1-3} +\cmidrule(l){5-7} +Style & Shape & Series & Switch & Latin & Greek & Numerals \\ +\midrule +Serif & Upright & Normal & \cs{mathup} & \Y & \Y & \Y \\ + & & Bold & \cs{mathbfup} & \Y & \Y & \Y \\ + & Italic & Normal & \cs{mathit} & \Y & \Y & \M \\ + & & Bold & \cs{mathbfit} & \Y & \Y & \M \\ +Sans serif & Upright & Normal & \cs{mathsfup} & \Y & & \Y \\ + & Italic & Normal & \cs{mathsfit} & \Y & & \M \\ + & Upright & Bold & \cs{mathbfsfup} & \Y & \Y & \Y \\ + & Italic & Bold & \cs{mathbfsfit} & \Y & \Y & \M \\ +Typewriter & Upright & Normal & \cs{mathtt} & \Y & & \Y \\ +Double-struck & Upright & Normal & \cs{mathbb} & \Y & & \Y \\ + & Italic & Normal & \cs{mathbbit} & \Y & & \\ +Script & Upright & Normal & \cs{mathscr} & \Y & & \\ + & & Bold & \cs{matbfscr} & \Y & & \\ +Fraktur & Upright & Normal & \cs{mathfrak} & \Y & & \\ + & & Bold & \cs{mathbffrac} & \Y & & \\ +\bottomrule +\end{tabular} +\end{table} + +\subsubsection{Double-struck} + +The double-struck style (also known as `blackboard bold') consists of +upright Latin letters $\{\mathbb{a}$--$\mathbb{z}$,$\mathbb{A}$$\mathbb{Z}\}$, +numerals $\mathbb{0}$--$\mathbb{9}$, summation symbol $\mathbb\sum$, and four +Greek letters only: $\{\mathbb{\gamma\pi\Gamma\Pi}\}$. + +While |\mathbb{\sum}| does produce a double-struck summation symbol, +its limits aren't properly aligned. Therefore, +either the literal character or the control sequence \cs{Bbbsum} are +recommended instead. + +There are also five Latin \emph{italic} double-struck letters: $\mathbbit{Ddeij}$. +These can be accessed (if not with their literal characters or control sequences) +with the \cs{mathbbit} style switch, but note that only those five letters +will give the expected output. + +\subsubsection{Caligraphic vs.\ Script variants} + +The Unicode maths encoding contains a style for `Script' letters, +and while by default \cs{mathcal} and \cs{mathscr} +are synonyms, there are some situations when a +separate `Caligraphic' style is needed as well. + +If a font contains alternate glyphs for a separat caligraphic style, +they can be selected explicitly as shown below. +This feature is currently only supported by the XITS~Math font, where +the caligraphic letters are accessed with the same glyph slots as the +script letters but with the first stylistic set feature (|ss01|) applied. +\begin{verbatim} + \setmathfont{xits-math.otf}[range={\mathcal,\mathbfcal},StylisticSet=1] +\end{verbatim} +An example is shown below. +\begin{quote} +\setmathfont{xits-math.otf}[range=\mathscr] +\setmathfont{xits-math.otf}[range=\mathcal,StylisticSet=1] +The Script style (\cs{mathscr}) in XITS Math is: $\mathscr{ABCXYZ}$\par +The Caligraphic style (\cs{mathcal}) in XITS Math is: $\mathcal{ABCXYZ}$ +\end{quote} + + +\subsection{Miscellanea} + +\subsubsection{Nabla} +\seclabel{nabla} + + The symbol $\nabla$ comes in the six forms shown in \tabref{nabla}. + We want an individual option to specify whether we want upright or italic + nabla by default (when either upright or italic nabla is used in the + source). \TeX\ classically uses an upright nabla, and \textsc{iso} + standards agree with this convention. + The package options |nabla=upright| and + |nabla=italic| switch between the two choices, and |nabla=literal| respects + the shape of the input character. This is then inherited + through \cmd\mathbf; \cmd\mathit\ and \cmd\mathup\ can be used to force one + way or the other. + +|nabla=italic| is the default. |nabla=literal| is +activated automatically after |math-style=literal|. + +\begin{table} + \centering + \topcaption{The various forms of nabla.} + \tablabel{nabla} + \let \tmpshow\empty + \begin{tabular}{@{}llc@{}} + \toprule + \multicolumn{2}{@{}l}{Description} & Glyph + \\ \cmidrule(r){1-2}\cmidrule(l){3-3} + Upright & Serif & $\mathup\nabla$ \\ + & Bold serif & $\mathbfup\nabla$ \\ + & Bold sans & $\mathbfsfup\nabla$ \\ + \cmidrule(lr){1-2}\cmidrule(lr){3-3} + Italic & Serif & $\mathit\nabla$ \\ + & Bold serif & $\mathbfit\nabla$ \\ + & Bold sans & $\mathbfsfit\nabla$ \\ + \bottomrule + \end{tabular} +\end{table} + +\subsubsection{Partial} +\seclabel{partial} + +The same applies to the symbols \unichar{2202} partial differential and +\unichar{1D715} math italic partial differential. + +At time of writing, both the Cambria Math and STIX fonts display these +two glyphs in the same italic style, but this is hopefully a bug that will +be corrected in the future~--- the `plain' partial differential should +really have an upright shape. + +Use the |partial=upright| or |partial=italic| package options to specify +which one you would like, or |partial=literal| to have the same character +used in the output as was used for the input. +The default is (always, unless someone requests and +argues otherwise) |partial=italic|.\footnote{A good argument would revolve +around some international standards body recommending upright over italic. +I just don't have the time right now to look it up.} |partial=literal| +is activated following |math-style=literal|. + +See \tabref{partial} for the variations on the partial differential symbol. + +\begin{table} + \centering + \topcaption{The various forms of the partial differential. Note that in +the fonts used to display these glyphs, the first upright partial is +incorrectly shown in an italic style.} + \tablabel{partial} + \begin{tabular}{@{}llc@{}} + \toprule + \multicolumn{2}{@{}l}{Description} & Glyph + \\ \cmidrule(r){1-2}\cmidrule(l){3-3} + Regular & Upright & $\mathup\partial$ \\ + & Italic & $\mathit\partial$ \\ + Bold & Upright & $\mathbfup\partial$ \\ + & Italic & $\mathbfit\partial$ \\ + Sans bold & Upright & $\mathbfsfup\partial$ \\ + & Italic & $\mathbfsfit\partial$ \\ + \bottomrule + \end{tabular} +\end{table} + +\subsubsection{Epsilon and phi: $\epsilon$ vs.\ $\varepsilon$ and $\phi$ vs.\ $\varphi$} +\seclabel{vargreek-shape} + +\TeX\ defines \cs{epsilon} to look like $\epsilon$ and \cs{varepsilon} to +look like $\varepsilon$. By constrast, the Unicode glyph directly after delta and before zeta +is `epsilon' and looks like $\varepsilon$; there is a subsequent variant of +epsilon that looks like $\epsilon$. This creates a problem. People who +use Unicode input won't want their glyphs transforming; \TeX\ users will be +confused that what they think as `normal epsilon' is actual the `variant +epsilon'. And the same problem exists for `phi'. + +We have an option to control this behaviour. +With |vargreek-shape=TeX|, +\cs{phi} and \cs{epsilon} produce $\phi$ and $\epsilon$ and +\cs{varphi} and \cs{varepsilon} produce $\varphi$ and $\varepsilon$. +With |vargreek-shape=unicode|, these symbols are swapped. +Note, however, that Unicode characters are not affected by this option. +That is, no remapping occurs of the characters/glyphs, only the control sequences. + +The package default is to use |vargreek-shape=TeX|. + +\subsubsection{Primes} + +Primes ($x'$) may be input in several ways. You may use any combination +the \ascii\ straight quote (\texttt{\char`\'}) or the Unicode prime \unichar{2032} +($'$); when multiple primes occur next to each other, they chain +together to form double, triple, or quadruple primes if the font contains +pre-drawn glyphs. The individual prime glyphs are accessed, as usual, +with the \cs{prime} command, and the double-, triple-, and quadruple-prime +glyphs are available with \cs{dprime}, \cs{trprime}, and \cs{qprime}, +respectively. + +If the font does not contain the pre-drawn glyphs or more than four primes +are used, the single prime glyph is used multiple times with a negative +kern to get the spacing right. There is no user interface to adjust this +negative kern yet (because I haven't decided what it should look like); +if you need to, write something like this: +\begin{Verbatim} +\ExplSyntaxOn +\muskip_gset:Nn \g_@@_primekern_muskip { -\thinmuskip/2 } +\ExplySyntaxOff +\end{Verbatim} +Backwards or reverse primes behave in exactly the same way; use the \ascii\ +back tick (\texttt{\char`\`}) or the Unicode reverse prime \unichar{2035} +({\umfont\char"2035}). +The command to access the backprime is \cs{backprime}, and +multiple backwards primes can accessed with \cs{backdprime}, +\cs{backtrprime}, and \cs{backqprime}. + +In all cases above, no error checking is performed if you attempt to +access a multi-prime glyph in a font that doesn't contain one. For this +reason, it may be safer to write |x''''| instead of |x\qprime| +in general. + +If you ever need to enter the straight quote |'| or the backtick |`| in +maths mode, these glyphs can be accessed with \cs{mathstraightquote} and +\cs{mathbacktick}. + +\subsubsection{Unicode subscripts and superscripts} + +You may, if you wish, use Unicode subscripts and superscripts in your +source document. For basic expressions, the use of these characters +can make the input more readable. +Adjacent sub- or super-scripts will be concatenated into a single +expression. + +The range of subscripts and superscripts supported by this package +are shown in \figref{superscripts,subscripts}. Please request more if +you think it is appropriate. + +\begin{figure}\centering +\fbox{\fontspec{Charis SIL}\Large +A +^^^^2070 ^^^^00b9 ^^^^00b2 ^^^^00b3 ^^^^2074 ^^^^2075 ^^^^2076 ^^^^2077 +^^^^2078 ^^^^2079 ^^^^207a ^^^^207b ^^^^207c ^^^^207d ^^^^207e ^^^^2071 +^^^^207f ^^^^207f ^^^^02b0 ^^^^02b2 ^^^^02b3 ^^^^02b7 ^^^^02b8 +Z} +\caption{ + The Unicode superscripts supported as input characters. + These are the literal glyphs from Charis SIL, + 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. +} +\figlabel{superscripts} +\end{figure} + +\begin{figure}\centering +\fbox{\fontspec{Charis SIL}\Large +A +^^^^2080 ^^^^2081 ^^^^2082 ^^^^2083 ^^^^2084 ^^^^2085 ^^^^2086 ^^^^2087 +^^^^2088 ^^^^2089 ^^^^208a ^^^^208b ^^^^208c ^^^^208d ^^^^208e ^^^^2090 +^^^^2091 ^^^^1d62 ^^^^2092 ^^^^1d63 ^^^^1d64 ^^^^1d65 ^^^^2093 ^^^^1d66 +^^^^1d67 ^^^^1d68 ^^^^1d69 ^^^^1d6a +Z} +\caption{ + The Unicode subscripts supported as input characters. + See note from \figref{superscripts}. +} +\figlabel{subscripts} +\end{figure} + +\subsubsection{Colon} +\seclabel{colon} + +The colon is one of the few confusing characters of Unicode maths. +In \TeX, \texttt{:} is defined as a colon with relation spacing: `$a:b$'. +While \cs{colon} is defined as a colon with punctuation spacing: `$a\colon b$'. + +In Unicode, \unichar{003A} {colon} is defined as a punctuation symbol, +while \unichar{2236} {ratio} is the colon-like symbol used in mathematics to denote +ratios and other things. + +This breaks the usual straightforward mapping from control sequence to Unicode input character +to (the same) Unicode glyph. + +To preserve input compatibility, we remap the \ascii\ input character `\texttt{:}' to \unichar{2236}. +Typing a literal \unichar{2236} char will result in the same output. +If \pkg{amsmath} is loaded, then the definition of \cs{colon} is inherited from there +(it looks like a punctuation colon with additional space around it). +Otherwise, \cs{colon} is made to output a colon with \cs{mathpunct} spacing. + +The package option |colon=literal| forces \ascii\ input `|:|' to be printed as \cs{mathcolon} instead. + + +\subsubsection{Slashes and backslashes} +\seclabel{slash-delimiter} + +There are several slash-like symbols defined in Unicode. The complete list is shown in \tabref{slashes}. + +\begin{table}\centering +\caption{Slashes and backslashes.} +\tablabel{slashes} +\begin{tabular}{@{}cl@{}cl@{}} +\toprule +Slot & Name & Glyph & Command \\ +\midrule +\unichar{002F} & \textsc{solidus} & \umfont \char"002F & \cs{slash} \\ +\unichar{2044} & \textsc{fraction slash} & \umfont \char"2044 & \cs{fracslash} \\ +\unichar{2215} & \textsc{division slash} & \umfont \char"2215 & \cs{divslash} \\ +\unichar{29F8} & \textsc{big solidus} & \umfont \char"29F8 & \cs{xsol} \\ +\midrule +\unichar{005C} & \textsc{reverse solidus} & \umfont \char"005C & \cs{backslash} \\ +\unichar{2216} & \textsc{set minus} & \umfont \char"2216 & \cs{smallsetminus} \\ +\unichar{29F5} & \textsc{reverse solidus operator}& \umfont \char"29F5 & \cs{setminus} \\ +\unichar{29F9} & \textsc{big reverse solidus} & \umfont \char"29F9 & \cs{xbsol} \\ +\bottomrule +\end{tabular} +\end{table} + +In regular \LaTeX\ we can write \cs{left}\cs{slash}\dots\cs{right}\cs{backslash} +and so on and obtain extensible delimiter-like symbols. Not all of the Unicode slashes +are suitable for this (and do not have the font support to do it). + +\paragraph{Slash} + +Of \unichar{2044} {fraction slash}, TR25 says that it is: +\begin{quote} +\dots used to build up simple fractions in running text\dots +however parsers of mathematical texts should be prepared to handle fraction slash +when it is received from other sources. +\end{quote} + +\unichar{2215} {division slash} should be used when division is represented +without a built-up fraction; $\pi\approx22/7$, for example. + +\unichar{29F8} {big solidus} is a `big operator' (like $\sum$). + +\paragraph{Backslash} + +The \unichar{005C} {reverse solidus} character \cs{backslash} is used for denoting +double cosets: $A\backslash B$. (So I'm led to believe.) +It may be used as a `stretchy' delimiter if supported by the font. + +MathML uses \unichar{2216} {set minus} like this: $A\smallsetminus B$.\footnote{\S4.4.5.11 \url{http://www.w3.org/TR/MathML3/}} +The \LaTeX\ command name \cs{smallsetminus} is used for backwards compatibility. + +Presumably, \unichar{29F5} {reverse solidus operator} is intended to +be used in a similar way, but it could also (perhaps?) be used to +represent `inverse division': $\pi\approx7\mathbin{\backslash}22$.^^A +\footnote{This is valid syntax in the Octave and Matlab programming languages, +in which it means matrix inverse pre-multiplication. I.e., $A\mathbin{\backslash} B\equiv A^{-1}B$.} +The \LaTeX\ name for this character is \cs{setminus}. + +Finally, \unichar{29F9} {big reverse solidus} is a `big operator' (like $\sum$). + +\paragraph{How to use all of these things} + +Unfortunately, font support for the above characters/glyphs is rather inconsistent. +In Cambria Math, the only slash that grows (say when writing +\[ +\left.\left[\begin{array}{cc} a & b \\ c & d\end{array}\right]\middle\slash + \left[\begin{array}{cc} 1 & 1 \\ 1 & 0\end{array}\right] \right.\quad ) +\] +is the \textsc{fraction slash}, which we just established above is +sort of only supposed to be used in text. + +Of the above characters, the following are allowed to be used after +\cs{left}, \cs{middle}, and \cs{right}: +\begin{itemize} +\item \cs{fracslash}; +\item \cs{slash}; and, +\item \cs{backslash} (the only reverse slash). +\end{itemize} + +However, we assume that there is only \emph{one} stretchy slash +in the font; this is assumed by default to be \unichar{002F} {solidus}. +Writing \cs{left/} or \cs{left}\cs{slash} or \cs{left}{fracslash} +will all result in the same stretchy delimiter being used. + +The delimiter used can be changed with the |slash-delimiter| package option. +Allowed values are |ascii|, |frac|, and |div|, corresponding to the respective +Unicode slots. + +For example: as mentioned above, Cambria Math's stretchy slash is +\unichar{2044} {fraction slash}. When using Cambria Math, then +\pkg{unicode-math} should be loaded with the |slash-delimiter=frac| option. +(This should be a font option rather than a package option, but +it will change soon.) + + +\subsubsection{Growing and non-growing accents} +\seclabel{growing-accents} + +There are a few accents for which \TeX\ has both non-growing and growing +versions. Among these are \cs{hat} and \cs{tilde}; the corresponding growing +versions are called \cs{widehat} and \cs{widetilde}, respectively. + +Older versions of \XeTeX\ and \LuaTeX\ did not support this distinction, +however, and \emph{all} accents there were growing automatically. (I.e., +\cs{hat} and \cs{widehat} are equivalent.) As of \LuaTeX\ v0.65 and \XeTeX\ +v0.9998, these wide/non-wide commands will again behave in their expected +manner. + + +\subsubsection{Pre-drawn fraction characters} + +Pre-drawn fractions \unichar{00BC}--\unichar{00BE}, \unichar{2150}--\unichar{215E} +are not suitable for use in mathematics output. However, they can be useful +as input characters to abbreviate common fractions. +\begin{center} +\fontspec{DejaVuSerif.ttf} ^^A available in TeX Live 2012 if not earlier +¼ ½ ¾ ↉ ⅐ ⅑ ⅒ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ +\end{center} +For example, instead of writing `|\tfrac12 x|', you may consider it more readable to have +`|½x|' in the source instead. + +If the \cs{tfrac} command exists (i.e., if \pkg{amsmath} is loaded or +you have specially defined \cs{tfrac} for this purpose), it will be used +to typeset the fractions. If not, regular \cs{frac} will be used. The command +to use (\cs{tfrac} or \cs{frac}) can be forced either way with the package +option |active-frac=small| or |active-frac=normalsize|, respectively. + +\subsubsection{Circles} + +Unicode defines a large number of different types of circles for a variety +of mathematical purposes. There are thirteen alone just considering the +all white and all black ones, shown in \tabref{circles}. + +\LaTeX\ defines considerably fewer: \cs{circ} and cs{bigcirc} for white; +\cs{bullet} for black. This package maps those commands to \cs{vysmwhtcircle}, +\cs{mdlgwhtcircle}, and \cs{smblkcircle}, respectively. + +\begin{table}\centering +\def\showchar#1#2#3{ \textsc{u}+{\small\ttfamily #1} & \texttt{\string#3} & \umfont \char"#1 \\} +\begin{tabular}{@{}llc@{}} +\toprule +Slot & Command & Glyph \\ +\midrule +\showchar{00B7}{centerdot}{\cdotp} +\showchar{22C5}{small middle dot}{\cdot} +\showchar{2219}{bullet operator}{\vysmblkcircle} +\showchar{2022}{round bullet, filled}{\smblkcircle} +\showchar{2981}{z notation spot}{\mdsmblkcircle} +\showchar{26AB}{medium black circle}{\mdblkcircle} +\showchar{25CF}{circle, filled}{\mdlgblkcircle} +\showchar{2B24}{black large circle}{\lgblkcircle} +\bottomrule +\end{tabular} +\def\showchar#1#2#3{ \umfont \char"#1 & \texttt{\string#3} & \textsc{u}+{\small\ttfamily #1} \\} +\begin{tabular}{@{}cll@{}} +\toprule +Glyph & Command & Slot \\ +\midrule +\\ +\\ +\showchar{2218}{composite function (small circle)}{\vysmwhtcircle} +\showchar{25E6}{white bullet}{\smwhtcircle} +\showchar{26AC}{medium small white circle}{\mdsmwhtcircle} +\showchar{26AA}{medium white circle}{\mdwhtcircle} +\showchar{25CB}{large circle}{\mdlgwhtcircle} +\showchar{25EF}{large circle}{\lgwhtcircle} +\bottomrule +\end{tabular} +\caption{Filled and hollow Unicode circles.} +\tablabel{circles} +\end{table} + +\subsubsection{Triangles} + +While there aren't as many different sizes of triangle as there are circle, +there's some important distinctions to make between a few similar characters. See \tabref{uptriangles} for the full summary. + +These triangles all have different intended meanings. Note for backwards +compatibility with \TeX, \unichar{25B3} has \emph{two} different mappings +in \pkg{unicode-math}. \cs{bigtriangleup} is intended as a binary operator +whereas \cs{triangle} is intended to be used as a letter-like symbol. + +But you're better off if you're using the latter form to indicate an +increment to use the glyph intended for this purpose, \unichar{2206}: $\increment x$. + +Finally, given that $\triangle$ and $\increment$ are provided for you +already, it is better off to only use upright Greek Delta $\Delta$ if you're +actually using it as a symbolic entity such as a variable on its own. + +\begin{table}\centering +\begin{tabular}{@{}llcl@{}} +\toprule +Slot & Command & Glyph & Class \\ +\midrule +\unichar{25B5} & \cs{vartriangle} & \umfont \char"25B5 & binary \\ +\unichar{25B3} & \cs{bigtriangleup} & \umfont \char"25B3 & binary \\ +\unichar{25B3} & \cs{triangle} & \umfont \char"25B3 & ordinary \\ +\unichar{2206} & \cs{increment} & \umfont \char"2206 & ordinary \\ +\unichar{0394} & \cs{mathup}\cs{Delta} & \umfont \char"0394 & ordinary \\ +\bottomrule +\end{tabular} +\caption{Different upwards pointing triangles.} +\tablabel{uptriangles} +\end{table} + +\iffalse +\subsubsection{Normalising some input characters} + +I believe +all variant forms should be used as legal input that is normalised to +a consistent output glyph, because we want to be fault-tolerant in the input. +Here are the duplicates: +\begin{quote}\obeylines +\unichar {251} {latin small letter alpha} +\unichar {25B} {latin small letter epsilon} +\unichar {263} {latin small letter gamma} +\unichar {269} {latin small letter iota} +\unichar {278} {latin small letter phi} +\unichar {28A} {latin small letter upsilon} +\unichar {190} {latin capital letter epsilon} +\unichar {194} {latin capital letter gamma} +\unichar {196} {latin capital letter iota} +\unichar {1B1} {latin capital letter upsilon} +\end{quote} + +(Not yet implemented.) +\fi + +\section{Advanced} + +\subsection{Warning messages} + +This package can produce a number of informational messages to try and inform the user when something might be going wrong due to package conflicts or something else. +As an experimental feature, these can be turn off on an individual basis with the package option |warnings-off| which takes a comma-separated list of warnings to suppress. +A warning will give you its name when printed on the console output; e.g., +\begin{Verbatim} + * unicode-math warning: "mathtools-colon" + * + * ... <warning message> ... +\end{Verbatim} +This warning could be suppressed by loading the package as follows: +\begin{Verbatim} + \usepackage[warnings-off={mathtools-colon}]{unicode-math} +\end{Verbatim} + +\subsection{Programmer's interface} + +(Tentative and under construction.) +If you are writing some code that needs to know the current +maths style (\cs{mathbf}, \cs{mathit}, etc.), you can query the +variable \cs{l_@@_mathstyle_tl}. It will contain the maths style +without the leading `math' string; for example, +|\mathbf { \show \l_@@_mathstyle_tl }| +will produce `bf'. + +\StopEventually{\end{document}} + +\clearpage +\appendix + +\section{\STIX\ table data extraction}\label{part:awk} + +The source for the \TeX\ names for the very large number of mathematical +glyphs are provided via Barbara Beeton's table file for the \STIX\ project +(|ams.org/STIX|). A version is located at +|http://www.ams.org/STIX/bnb/stix-tbl.asc| +but check |http://www.ams.org/STIX/| for more up-to-date info. + +This table is converted into a form suitable for reading by \TeX. +A single file is produced containing all (more than 3298) symbols. +Future optimisations might include generating various (possibly overlapping) subsets +so not all definitions must be read just to redefine a small range of symbols. +Performance for now seems to be acceptable without such measures. + +This file is currently developed outside this DTX file. It will be +incorporated when the final version is ready. (I know this is not how +things are supposed to work!) + + +\section{Documenting maths support in the NFSS} + +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$ + +\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. + +\cmd\DeclareMathAlphabet\marg{cmd}\meta{NFSS decl.} + +For commands such as \cmd\mathbf, accessed +through maths mode that are unaffected by the current text font, and which are used for +alphabetic symbols in the \ascii\ range. + +\cmd\DeclareSymbolFontAlphabet\marg{cmd}\marg{name} + +Alternative (and optimisation) for \cmd\DeclareMathAlphabet\ if a single font is being used +for both alphabetic characters (as above) and symbols. + +\item[Maths `versions'] Different maths weights can be defined with the following, switched +in text with the \cmd\mathversion\marg{maths version} command. + +\cmd\SetSymbolFont\marg{name}\marg{maths version}\meta{NFSS decl.}\\ +\cmd\SetMathAlphabet\marg{cmd}\marg{maths version}\meta{NFSS decl.} + +\item[Maths symbols] Symbol definitions in maths for both characters (=) and macros (\cmd\eqdef): +\cmd\DeclareMathSymbol\marg{symbol}\marg{type}\marg{named font}\marg{slot} +This is the macro that actually defines which font each symbol comes from and how they behave. +\end{description} +Delimiters and radicals use wrappers around \TeX's \cmd\delimiter/\cmd\radical\ primitives, +which are re-designed in \XeTeX. The syntax used in \LaTeX's NFSS is therefore not so relevant here. +\begin{description} +\item[Delimiters] A special class of maths symbol which enlarge themselves in certain contexts. + +\cmd\DeclareMathDelimiter\marg{symbol}\marg{type}\marg{sym.\ font}\marg{slot}\marg{sym.\ font}\marg{slot} + +\item[Radicals] Similar to delimiters (\cmd\DeclareMathRadical\ takes the same syntax) but +behave `weirdly'. +\end{description} +In those cases, glyph slots in \emph{two} symbol fonts are required; one for the small (`regular') case, +the other for situations when the glyph is larger. This is not the case in \XeTeX. + +Accents are not included yet. + +\paragraph{Summary} + +For symbols, something like: +\begin{Verbatim} +\def\DeclareMathSymbol#1#2#3#4{ + \global\mathchardef#1"\mathchar@type#2 + \expandafter\hexnumber@\csname sym#2\endcsname + {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}} +\end{Verbatim} +For characters, something like: +\begin{Verbatim} +\def\DeclareMathSymbol#1#2#3#4{ + \global\mathcode`#1"\mathchar@type#2 + \expandafter\hexnumber@\csname sym#2\endcsname + {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}} +\end{Verbatim} + +\section{Legacy \TeX\ font dimensions} + +\centerline{% +\begin{tabular}[t]{@{}lp{4cm}@{}} +\toprule +\multicolumn{2}{@{}c@{}}{Text fonts} \\ +\midrule +$\phi_1$ & slant per pt \\ +$\phi_2$ & interword space \\ +$\phi_3$ & interword stretch \\ +$\phi_4$ & interword shrink \\ +$\phi_5$ & x-height \\ +$\phi_6$ & quad width \\ +$\phi_7$ & extra space \\ +$\phi_8$ & cap height (\XeTeX\ only) \\ +\bottomrule +\end{tabular} +\quad +\begin{tabular}[t]{@{}lp{4cm}@{}} +\toprule +\multicolumn{2}{@{}c@{}}{Maths font, \cs{fam}2} \\ +\midrule +$\sigma_5$ & x height \\ +$\sigma_6$ & quad \\ +$\sigma_8$ & num1 \\ +$\sigma_9$ & num2 \\ +$\sigma_{10}$ & num3 \\ +$\sigma_{11}$ & denom1 \\ +$\sigma_{12}$ & denom2 \\ +$\sigma_{13}$ & sup1 \\ +$\sigma_{14}$ & sup2 \\ +$\sigma_{15}$ & sup3 \\ +$\sigma_{16}$ & sub1 \\ +$\sigma_{17}$ & sub2 \\ +$\sigma_{18}$ & sup drop \\ +$\sigma_{19}$ & sub drop \\ +$\sigma_{20}$ & delim1 \\ +$\sigma_{21}$ & delim2 \\ +$\sigma_{22}$ & axis height \\ +\bottomrule +\end{tabular} +\quad +\begin{tabular}[t]{@{}lp{4cm}@{}} +\toprule +\multicolumn{2}{@{}c@{}}{Maths font, \cs{fam}3} \\ +\midrule +$\xi_8$ & default rule thickness \\ +$\xi_9$ & big op spacing1 \\ +$\xi_{10}$ & big op spacing2 \\ +$\xi_{11}$ & big op spacing3 \\ +$\xi_{12}$ & big op spacing4 \\ +$\xi_{13}$ & big op spacing5 \\ +\bottomrule +\end{tabular} +} + + +\section{\Hologo{XeTeX} math font dimensions} + +These are the extended \cmd\fontdimen s available for suitable fonts +in \XeTeX. Note that Lua\TeX\ takes an alternative route, and this package +will eventually provide a wrapper interface to the two (I hope). + +\newcounter{mfdimen} +\setcounter{mfdimen}{9} +\newcommand\mathfontdimen[2]{^^A + \stepcounter{mfdimen}^^A + \themfdimen & {\scshape\small #1} & #2\vspace{0.5ex} \tabularnewline} + +\begin{longtable}{ + @{}c>{\raggedright\parfillskip=0pt}p{4cm}>{\raggedright}p{7cm}@{}} +\toprule \cmd\fontdimen & Dimension name & Description\tabularnewline\midrule \endhead +\bottomrule\endfoot +\mathfontdimen{Script\-Percent\-Scale\-Down} +{Percentage of scaling down for script level 1. Suggested value: 80\%.} +\mathfontdimen{Script\-Script\-Percent\-Scale\-Down} +{Percentage of scaling down for script level 2 (Script\-Script). Suggested value: 60\%.} +\mathfontdimen{Delimited\-Sub\-Formula\-Min\-Height} +{Minimum height required for a delimited expression to be treated as a subformula. Suggested value: normal line height\,×\,1.5.} +\mathfontdimen{Display\-Operator\-Min\-Height} +{Minimum height of n-ary operators (such as integral and summation) for formulas in display mode.} +\mathfontdimen{Math\-Leading} +{White space to be left between math formulas to ensure proper line spacing. For example, for applications that treat line gap as a part of line ascender, formulas with ink going above (os2.sTypoAscender + os2.sTypoLineGap – MathLeading) or with ink going below os2.sTypoDescender will result in increasing line height.} +\mathfontdimen{Axis\-Height} +{Axis height of the font. } +\mathfontdimen{Accent\-Base\-Height} +{Maximum (ink) height of accent base that does not require raising the accents. Suggested: x-height of the font (os2.sxHeight) plus any possible overshots. } +\mathfontdimen{Flattened\-Accent\-Base\-Height} +{Maximum (ink) height of accent base that does not require flattening the accents. Suggested: cap height of the font (os2.sCapHeight).} +\mathfontdimen{Subscript\-Shift\-Down} +{The standard shift down applied to subscript elements. Positive for moving in the downward direction. Suggested: os2.ySubscriptYOffset.} +\mathfontdimen{Subscript\-Top\-Max} +{Maximum allowed height of the (ink) top of subscripts that does not require moving subscripts further down. Suggested: /5 x-height.} +\mathfontdimen{Subscript\-Baseline\-Drop\-Min} +{Minimum allowed drop of the baseline of subscripts relative to the (ink) bottom of the base. Checked for bases that are treated as a box or extended shape. Positive for subscript baseline dropped below the base bottom.} +\mathfontdimen{Superscript\-Shift\-Up} +{Standard shift up applied to superscript elements. Suggested: os2.ySuperscriptYOffset.} +\mathfontdimen{Superscript\-Shift\-Up\-Cramped} +{Standard shift of superscripts relative to the base, in cramped style.} +\mathfontdimen{Superscript\-Bottom\-Min} +{Minimum allowed height of the (ink) bottom of superscripts that does not require moving subscripts further up. Suggested: ¼ x-height.} +\mathfontdimen{Superscript\-Baseline\-Drop\-Max} +{Maximum allowed drop of the baseline of superscripts relative to the (ink) top of the base. Checked for bases that are treated as a box or extended shape. Positive for superscript baseline below the base top.} +\mathfontdimen{Sub\-Superscript\-Gap\-Min} +{Minimum gap between the superscript and subscript ink. Suggested: 4×default rule thickness.} +\mathfontdimen{Superscript\-Bottom\-Max\-With\-Subscript} +{The maximum level to which the (ink) bottom of superscript can be pushed to increase the gap between superscript and subscript, before subscript starts being moved down. +Suggested: /5 x-height.} +\mathfontdimen{Space\-After\-Script} +{Extra white space to be added after each subscript and superscript. Suggested: 0.5pt for a 12 pt font.} +\mathfontdimen{Upper\-Limit\-Gap\-Min} +{Minimum gap between the (ink) bottom of the upper limit, and the (ink) top of the base operator. } +\mathfontdimen{Upper\-Limit\-Baseline\-Rise\-Min} +{Minimum distance between baseline of upper limit and (ink) top of the base operator.} +\mathfontdimen{Lower\-Limit\-Gap\-Min} +{Minimum gap between (ink) top of the lower limit, and (ink) bottom of the base operator.} +\mathfontdimen{Lower\-Limit\-Baseline\-Drop\-Min} +{Minimum distance between baseline of the lower limit and (ink) bottom of the base operator.} +\mathfontdimen{Stack\-Top\-Shift\-Up} +{Standard shift up applied to the top element of a stack.} +\mathfontdimen{Stack\-Top\-Display\-Style\-Shift\-Up} +{Standard shift up applied to the top element of a stack in display style.} +\mathfontdimen{Stack\-Bottom\-Shift\-Down} +{Standard shift down applied to the bottom element of a stack. Positive for moving in the downward direction.} +\mathfontdimen{Stack\-Bottom\-Display\-Style\-Shift\-Down} +{Standard shift down applied to the bottom element of a stack in display style. Positive for moving in the downward direction.} +\mathfontdimen{Stack\-Gap\-Min} +{Minimum gap between (ink) bottom of the top element of a stack, and the (ink) top of the bottom element. Suggested: 3×default rule thickness.} +\mathfontdimen{Stack\-Display\-Style\-Gap\-Min} +{Minimum gap between (ink) bottom of the top element of a stack, and the (ink) top of the bottom element in display style. Suggested: 7×default rule thickness.} +\mathfontdimen{Stretch\-Stack\-Top\-Shift\-Up} +{Standard shift up applied to the top element of the stretch stack.} +\mathfontdimen{Stretch\-Stack\-Bottom\-Shift\-Down} +{Standard shift down applied to the bottom element of the stretch stack. Positive for moving in the downward direction.} +\mathfontdimen{Stretch\-Stack\-Gap\-Above\-Min} +{Minimum gap between the ink of the stretched element, and the (ink) bottom of the element above. Suggested: Upper\-Limit\-Gap\-Min} +\mathfontdimen{Stretch\-Stack\-Gap\-Below\-Min} +{Minimum gap between the ink of the stretched element, and the (ink) top of the element below. Suggested: Lower\-Limit\-Gap\-Min.} +\mathfontdimen{Fraction\-Numerator\-Shift\-Up} +{Standard shift up applied to the numerator. } +\mathfontdimen{Fraction\-Numerator\-Display\-Style\-Shift\-Up} +{Standard shift up applied to the numerator in display style. Suggested: Stack\-Top\-Display\-Style\-Shift\-Up.} +\mathfontdimen{Fraction\-Denominator\-Shift\-Down} +{Standard shift down applied to the denominator. Positive for moving in the downward direction.} +\mathfontdimen{Fraction\-Denominator\-Display\-Style\-Shift\-Down} +{Standard shift down applied to the denominator in display style. Positive for moving in the downward direction. Suggested: Stack\-Bottom\-Display\-Style\-Shift\-Down.} +\mathfontdimen{Fraction\-Numerator\-Gap\-Min} +{Minimum tolerated gap between the (ink) bottom of the numerator and the ink of the fraction bar. Suggested: default rule thickness} +\mathfontdimen{Fraction\-Num\-Display\-Style\-Gap\-Min} +{Minimum tolerated gap between the (ink) bottom of the numerator and the ink of the fraction bar in display style. Suggested: 3×default rule thickness.} +\mathfontdimen{Fraction\-Rule\-Thickness} +{Thickness of the fraction bar. Suggested: default rule thickness.} +\mathfontdimen{Fraction\-Denominator\-Gap\-Min} +{Minimum tolerated gap between the (ink) top of the denominator and the ink of the fraction bar. Suggested: default rule thickness} +\mathfontdimen{Fraction\-Denom\-Display\-Style\-Gap\-Min} +{Minimum tolerated gap between the (ink) top of the denominator and the ink of the fraction bar in display style. Suggested: 3×default rule thickness.} +\mathfontdimen{Skewed\-Fraction\-Horizontal\-Gap} +{Horizontal distance between the top and bottom elements of a skewed fraction.} +\mathfontdimen{Skewed\-Fraction\-Vertical\-Gap} +{Vertical distance between the ink of the top and bottom elements of a skewed fraction.} +\mathfontdimen{Overbar\-Vertical\-Gap} +{Distance between the overbar and the (ink) top of he base. Suggested: 3×default rule thickness.} +\mathfontdimen{Overbar\-Rule\-Thickness} +{Thickness of overbar. Suggested: default rule thickness.} +\mathfontdimen{Overbar\-Extra\-Ascender} +{Extra white space reserved above the overbar. Suggested: default rule thickness.} +\mathfontdimen{Underbar\-Vertical\-Gap} +{Distance between underbar and (ink) bottom of the base. Suggested: 3×default rule thickness.} +\mathfontdimen{Underbar\-Rule\-Thickness} +{Thickness of underbar. Suggested: default rule thickness.} +\mathfontdimen{Underbar\-Extra\-Descender} +{Extra white space reserved below the underbar. Always positive. Suggested: default rule thickness.} +\mathfontdimen{Radical\-Vertical\-Gap} +{Space between the (ink) top of the expression and the bar over it. Suggested: 1¼ default rule thickness.} +\mathfontdimen{Radical\-Display\-Style\-Vertical\-Gap} +{Space between the (ink) top of the expression and the bar over it. Suggested: default rule thickness + ¼ x-height. } +\mathfontdimen{Radical\-Rule\-Thickness} +{Thickness of the radical rule. This is the thickness of the rule in designed or constructed radical signs. Suggested: default rule thickness.} +\mathfontdimen{Radical\-Extra\-Ascender} +{Extra white space reserved above the radical. Suggested: Radical\-Rule\-Thickness.} +\mathfontdimen{Radical\-Kern\-Before\-Degree} +{Extra horizontal kern before the degree of a radical, if such is present. Suggested: 5/18 of em.} +\mathfontdimen{Radical\-Kern\-After\-Degree} +{Negative kern after the degree of a radical, if such is present. Suggested: −10/18 of em.} +\mathfontdimen{Radical\-Degree\-Bottom\-Raise\-Percent} +{Height of the bottom of the radical degree, if such is present, in proportion to the ascender of the radical sign. Suggested: 60\%.} +\end{longtable} + +\if \DOCUMENTEND T \end{document} \fi + + + 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 1f1c06346e8..d0f6639082d 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/source/latex/unicode-math/unimath-symbols.ltx b/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.ltx index e1998c08069..16d38e94d44 100644 --- a/Master/texmf-dist/source/latex/unicode-math/unimath-symbols.ltx +++ b/Master/texmf-dist/doc/latex/unicode-math/unimath-symbols.ltx @@ -15,7 +15,16 @@ \def\cmd#1{\texttt{\textbackslash\expandafter\@gobble\string#1}} \usepackage{fontspec} -\setmainfont[Ligatures=TeX,Numbers={Lowercase,Monospaced}]{TeX Gyre Pagella} +\setmainfont{texgyrepagella}% + [ + Extension = .otf , + UprightFont = *-regular, + ItalicFont = *-italic, + BoldFont = *-bold, + BoldItalicFont = *-bolditalic, + Ligatures=TeX, + Numbers={Lowercase,Monospaced}, + ] \usepackage[math-style=literal,bold-style=literal]{unicode-math} \ExplSyntaxOn @@ -33,6 +42,7 @@ \defmathfont{lm}{latinmodern-math.otf}{CC6666} \defmathfont{xits}{xits-math.otf}{CCCC66} +\defmathfont{stix}{STIXMath-Regular.otf}{AA66CC} \defmathfont{cambria}{Cambria Math}{66CCCC} \defmathfont{asana}{Asana-Math.otf}{6666CC} \defmathfont{pagella}{texgyrepagella-math.otf}{AA6666} @@ -41,15 +51,17 @@ \def\INPUT{\input{unicode-math-table.tex}} \def\TABLE{% \par\noindent -\begin{longtable}[l]{@{}lccccccll@{}} +\begin{longtable}[l]{@{}lcccccccll@{}} \toprule - \textsc{usv} & M & X & C & A & P & E & Macro & Description \\ + \textsc{usv} & M & X & S & C & A & P & E & Macro & Description \\ \midrule \endhead \INPUT\\ \bottomrule \end{longtable} } -\def\USV#1{\footnotesize\scshape\MakeLowercase{\@gobble#1}} +\makeatletter +\def\USV#1{\footnotesize\scshape\MakeLowercase{u+\@gobble#1}} +\makeatother \def\CMD#1{\footnotesize\cmd#1} \def\DESC#1{% \begin{varwidth}[t]{6cm} @@ -70,6 +82,7 @@ \USV{#1} & \SYMB{#2}{lm}{#1} & \SYMB{#2}{xits}{#1} & + \SYMB{#2}{stix}{#1} & \SYMB{#2}{cambria}{#1} & \SYMB{#2}{asana}{#1} & \SYMB{#2}{pagella}{#1} & @@ -144,6 +157,7 @@ Eight fonts are shown: (with approximate symbol counts) \begin{itemize} \item[M] \mathversion{lm} $\mathup{Latin\ Modern\ Math}$ (\ref{count:lm}) \item[X] \mathversion{xits} $\mathup{XITS\ Math}$ (\ref{count:xits}) +\item[S] \mathversion{stix} $\mathup{STIX\ Math}$ (\ref{count:stix}) \item[C] \mathversion{cambria} $\mathup{Cambria\ Math}$ (\ref{count:cambria}) \item[A] \mathversion{asana} $\mathup{Asana\ Math}$ (\ref{count:asana}) \item[P] \mathversion{pagella} $\mathup{TeX\ Gyre\ Pagella\ Math}$ (\ref{count:pagella}) @@ -421,6 +435,7 @@ The limits behaviour as specified by \textsf{unicode-math} are shown with grey s \refstepcounter{lm}\label{count:lm} \refstepcounter{xits}\label{count:xits} +\refstepcounter{stix}\label{count:stix} \refstepcounter{cambria}\label{count:cambria} \refstepcounter{asana}\label{count:asana} \refstepcounter{pagella}\label{count:pagella} 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 6a97c7b9ca2..6c206c8b919 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/unicode-math-alphabets.dtx b/Master/texmf-dist/source/latex/unicode-math/unicode-math-alphabets.dtx new file mode 100644 index 00000000000..5a586a7a07c --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math-alphabets.dtx @@ -0,0 +1,903 @@ +% \subsection{Alphabets} +% +% \begin{macrocode} +%<*alphabets> +% \end{macrocode} +% +% +% \subsubsection{Upright: up} +% +% \begin{macrocode} +\@@_new_alphabet_config:nnn {up} {num} + { + \@@_set_normal_numbers:nn {up} {#1} + \@@_set_mathalphabet_numbers:nnn {up} {up} {#1} + } + +\@@_new_alphabet_config:nnn {up} {Latin} + { + \bool_if:NTF \g_@@_literal_bool { \@@_set_normal_Latin:nn {up} {#1} } + { + \bool_if:NT \g_@@_upLatin_bool { \@@_set_normal_Latin:nn {up,it} {#1} } + } + \@@_set_mathalphabet_Latin:nnn {up} {up,it} {#1} + \@@_set_mathalphabet_Latin:nnn {literal} {up} {up} + \@@_set_mathalphabet_Latin:nnn {literal} {it} {it} + } + +\@@_new_alphabet_config:nnn {up} {latin} + { + \bool_if:NTF \g_@@_literal_bool { \@@_set_normal_latin:nn {up} {#1} } + { + \bool_if:NT \g_@@_uplatin_bool + { + \@@_set_normal_latin:nn {up,it} {#1} + \@@_set_normal_char:nnn {h} {up,it} {#1} + \@@_set_normal_char:nnn {dotlessi} {up,it} {#1} + \@@_set_normal_char:nnn {dotlessj} {up,it} {#1} + } + } + \@@_set_mathalphabet_latin:nnn {up} {up,it}{#1} + \@@_set_mathalphabet_latin:nnn {literal} {up} {up} + \@@_set_mathalphabet_latin:nnn {literal} {it} {it} + } + +\@@_new_alphabet_config:nnn {up} {Greek} + { + \bool_if:NTF \g_@@_literal_bool { \@@_set_normal_Greek:nn {up}{#1} } + { + \bool_if:NT \g_@@_upGreek_bool { \@@_set_normal_Greek:nn {up,it}{#1} } + } + \@@_set_mathalphabet_Greek:nnn {up} {up,it}{#1} + \@@_set_mathalphabet_Greek:nnn {literal} {up} {up} + \@@_set_mathalphabet_Greek:nnn {literal} {it} {it} + } + +\@@_new_alphabet_config:nnn {up} {greek} + { + \bool_if:NTF \g_@@_literal_bool { \@@_set_normal_greek:nn {up} {#1} } + { + \bool_if:NT \g_@@_upgreek_bool + { + \@@_set_normal_greek:nn {up,it} {#1} + } + } + \@@_set_mathalphabet_greek:nnn {up} {up,it} {#1} + \@@_set_mathalphabet_greek:nnn {literal} {up} {up} + \@@_set_mathalphabet_greek:nnn {literal} {it} {it} + } + +\@@_new_alphabet_config:nnn {up} {misc} + { + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_normal_char:nnn {Nabla}{up}{up} + } + { + \bool_if:NT \g_@@_upNabla_bool + { + \@@_set_normal_char:nnn {Nabla}{up,it}{up} + } + } + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_normal_char:nnn {partial}{up}{up} + } + { + \bool_if:NT \g_@@_uppartial_bool + { + \@@_set_normal_char:nnn {partial}{up,it}{up} + } + } + \@@_set_mathalphabet_pos:nnnn {up} {partial} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {up} {Nabla} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {up} {dotlessi} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {up} {dotlessj} {up,it} {#1} + } +% \end{macrocode} +% +% \subsubsection{Italic: it} +% +% \begin{macrocode} +\@@_new_alphabet_config:nnn {it} {Latin} + { + \bool_if:NTF \g_@@_literal_bool { \@@_set_normal_Latin:nn {it} {#1} } + { + \bool_if:NF \g_@@_upLatin_bool { \@@_set_normal_Latin:nn {up,it} {#1} } + } + \@@_set_mathalphabet_Latin:nnn {it}{up,it}{#1} + } + +\@@_new_alphabet_config:nnn {it} {latin} + { + \bool_if:NTF \g_@@_literal_bool + { + \@@_set_normal_latin:nn {it} {#1} + \@@_set_normal_char:nnn {h}{it}{#1} + } + { + \bool_if:NF \g_@@_uplatin_bool + { + \@@_set_normal_latin:nn {up,it} {#1} + \@@_set_normal_char:nnn {h}{up,it}{#1} + \@@_set_normal_char:nnn {dotlessi}{up,it}{#1} + \@@_set_normal_char:nnn {dotlessj}{up,it}{#1} + } + } + \@@_set_mathalphabet_latin:nnn {it} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {it} {dotlessi} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {it} {dotlessj} {up,it} {#1} + } + +\@@_new_alphabet_config:nnn {it} {Greek} + { + \bool_if:NTF \g_@@_literal_bool + { + \@@_set_normal_Greek:nn {it}{#1} + } + { + \bool_if:NF \g_@@_upGreek_bool { \@@_set_normal_Greek:nn {up,it}{#1} } + } + \@@_set_mathalphabet_Greek:nnn {it} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {it} {greek} + { + \bool_if:NTF \g_@@_literal_bool + { + \@@_set_normal_greek:nn {it} {#1} + } + { + \bool_if:NF \g_@@_upgreek_bool { \@@_set_normal_greek:nn {it,up} {#1} } + } + \@@_set_mathalphabet_greek:nnn {it} {up,it} {#1} + } + +\@@_new_alphabet_config:nnn {it} {misc} + { + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_normal_char:nnn {Nabla}{it}{it} + } + { + \bool_if:NF \g_@@_upNabla_bool + { + \@@_set_normal_char:nnn {Nabla}{up,it}{it} + } + } + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_normal_char:nnn {partial}{it}{it} + } + { + \bool_if:NF \g_@@_uppartial_bool + { + \@@_set_normal_char:nnn {partial}{up,it}{it} + } + } + \@@_set_mathalphabet_pos:nnnn {it} {partial} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {it} {Nabla} {up,it}{#1} + } +% \end{macrocode} +% +% \subsubsection{Blackboard or double-struck: bb and bbit} +% +% \begin{macrocode} +\@@_new_alphabet_config:nnn {bb} {latin} + { + \@@_set_mathalphabet_latin:nnn {bb} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {bb} {Latin} + { + \@@_set_mathalphabet_Latin:nnn {bb} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {bb} {C} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {H} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {N} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {P} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {Q} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {R} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {Z} {up,it} {#1} + } + +\@@_new_alphabet_config:nnn {bb} {num} + { + \@@_set_mathalphabet_numbers:nnn {bb} {up}{#1} + } + +\@@_new_alphabet_config:nnn {bb} {misc} + { + \@@_set_mathalphabet_pos:nnnn {bb} {Pi} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {pi} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {Gamma} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {gamma} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bb} {summation} {up} {#1} + } + +\@@_new_alphabet_config:nnn {bbit} {misc} + { + \@@_set_mathalphabet_pos:nnnn {bbit} {D} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bbit} {d} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bbit} {e} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bbit} {i} {up,it} {#1} + \@@_set_mathalphabet_pos:nnnn {bbit} {j} {up,it} {#1} + } +% \end{macrocode} +% +% \subsubsection{Script and caligraphic: scr and cal} +% +% \begin{macrocode} +\@@_new_alphabet_config:nnn {scr} {Latin} + { + \@@_set_mathalphabet_Latin:nnn {scr} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {B}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {E}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {F}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {H}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {I}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {L}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {M}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {R}{up,it}{#1} + } + +\@@_new_alphabet_config:nnn {scr} {latin} + { + \@@_set_mathalphabet_latin:nnn {scr} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {e}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {g}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {scr} {o}{up,it}{#1} + } +% \end{macrocode} +% These are by default synonyms for the above, but with the STIX +% fonts we want to use the alternate alphabet. +% \begin{macrocode} +\@@_new_alphabet_config:nnn {cal} {Latin} + { + \@@_set_mathalphabet_Latin:nnn {cal} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {cal} {B}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {cal} {E}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {cal} {F}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {cal} {H}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {cal} {I}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {cal} {L}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {cal} {M}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {cal} {R}{up,it}{#1} + } +% \end{macrocode} +% +% \subsubsection{Fractur or fraktur or blackletter: frak} +% +% \begin{macrocode} +\@@_new_alphabet_config:nnn {frak} {Latin} + { + \@@_set_mathalphabet_Latin:nnn {frak} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {frak} {C}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {frak} {H}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {frak} {I}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {frak} {R}{up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {frak} {Z}{up,it}{#1} + } +\@@_new_alphabet_config:nnn {frak} {latin} + { + \@@_set_mathalphabet_latin:nnn {frak} {up,it}{#1} + } +% \end{macrocode} +% +% \subsubsection{Sans serif upright: sfup} +% \begin{macrocode} +\@@_new_alphabet_config:nnn {sfup} {num} + { + \@@_set_mathalphabet_numbers:nnn {sf} {up}{#1} + \@@_set_mathalphabet_numbers:nnn {sfup} {up}{#1} + } +\@@_new_alphabet_config:nnn {sfup} {Latin} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_Latin:nn {sfup} {#1} + \@@_set_mathalphabet_Latin:nnn {sf} {up}{#1} + } + { + \bool_if:NT \g_@@_upsans_bool + { + \@@_set_normal_Latin:nn {sfup,sfit} {#1} + \@@_set_mathalphabet_Latin:nnn {sf} {up,it}{#1} + } + } + \@@_set_mathalphabet_Latin:nnn {sfup} {up,it}{#1} + } +\@@_new_alphabet_config:nnn {sfup} {latin} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_latin:nn {sfup} {#1} + \@@_set_mathalphabet_latin:nnn {sf} {up}{#1} + } + { + \bool_if:NT \g_@@_upsans_bool + { + \@@_set_normal_latin:nn {sfup,sfit} {#1} + \@@_set_mathalphabet_latin:nnn {sf} {up,it}{#1} + } + } + \@@_set_mathalphabet_latin:nnn {sfup} {up,it}{#1} + } +% \end{macrocode} +% +% \subsubsection{Sans serif italic: sfit} +% +% \begin{macrocode} +\@@_new_alphabet_config:nnn {sfit} {Latin} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_Latin:nn {sfit} {#1} + \@@_set_mathalphabet_Latin:nnn {sf} {it}{#1} + } + { + \bool_if:NF \g_@@_upsans_bool + { + \@@_set_normal_Latin:nn {sfup,sfit} {#1} + \@@_set_mathalphabet_Latin:nnn {sf} {up,it}{#1} + } + } + \@@_set_mathalphabet_Latin:nnn {sfit} {up,it}{#1} + } +\@@_new_alphabet_config:nnn {sfit} {latin} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_latin:nn {sfit} {#1} + \@@_set_mathalphabet_latin:nnn {sf} {it}{#1} + } + { + \bool_if:NF \g_@@_upsans_bool + { + \@@_set_normal_latin:nn {sfup,sfit} {#1} + \@@_set_mathalphabet_latin:nnn {sf} {up,it}{#1} + } + } + \@@_set_mathalphabet_latin:nnn {sfit} {up,it}{#1} + } +% \end{macrocode} +% +% \subsubsection{Typewriter or monospaced: tt} +% \begin{macrocode} +\@@_new_alphabet_config:nnn {tt} {num} + { + \@@_set_mathalphabet_numbers:nnn {tt} {up}{#1} + } +\@@_new_alphabet_config:nnn {tt} {Latin} + { + \@@_set_mathalphabet_Latin:nnn {tt} {up,it}{#1} + } +\@@_new_alphabet_config:nnn {tt} {latin} + { + \@@_set_mathalphabet_latin:nnn {tt} {up,it}{#1} + } +% \end{macrocode} +% +% +% \subsubsection{Bold Italic: bfit} +% \begin{macrocode} +\@@_new_alphabet_config:nnn {bfit} {Latin} + { + \bool_if:NF \g_@@_bfupLatin_bool + { + \@@_set_normal_Latin:nn {bfup,bfit} {#1} + } + \@@_set_mathalphabet_Latin:nnn {bfit} {up,it}{#1} + \bool_if:NTF \g_@@_bfliteral_bool + { + \@@_set_normal_Latin:nn {bfit} {#1} + \@@_set_mathalphabet_Latin:nnn {bf} {it}{#1} + } + { + \bool_if:NF \g_@@_bfupLatin_bool + { + \@@_set_normal_Latin:nn {bfup,bfit} {#1} + \@@_set_mathalphabet_Latin:nnn {bf} {up,it}{#1} + } + } + } + +\@@_new_alphabet_config:nnn {bfit} {latin} + { + \bool_if:NF \g_@@_bfuplatin_bool + { + \@@_set_normal_latin:nn {bfup,bfit} {#1} + } + \@@_set_mathalphabet_latin:nnn {bfit} {up,it}{#1} + \bool_if:NTF \g_@@_bfliteral_bool + { + \@@_set_normal_latin:nn {bfit} {#1} + \@@_set_mathalphabet_latin:nnn {bf} {it}{#1} + } + { + \bool_if:NF \g_@@_bfuplatin_bool + { + \@@_set_normal_latin:nn {bfup,bfit} {#1} + \@@_set_mathalphabet_latin:nnn {bf} {up,it}{#1} + } + } + } + +\@@_new_alphabet_config:nnn {bfit} {Greek} + { + \@@_set_mathalphabet_Greek:nnn {bfit} {up,it}{#1} + \bool_if:NTF \g_@@_bfliteral_bool + { + \@@_set_normal_Greek:nn {bfit}{#1} + \@@_set_mathalphabet_Greek:nnn {bf} {it}{#1} + } + { + \bool_if:NF \g_@@_bfupGreek_bool + { + \@@_set_normal_Greek:nn {bfup,bfit}{#1} + \@@_set_mathalphabet_Greek:nnn {bf} {up,it}{#1} + } + } + } + +\@@_new_alphabet_config:nnn {bfit} {greek} + { + \@@_set_mathalphabet_greek:nnn {bfit} {up,it} {#1} + \bool_if:NTF \g_@@_bfliteral_bool + { + \@@_set_normal_greek:nn {bfit} {#1} + \@@_set_mathalphabet_greek:nnn {bf} {it} {#1} + } + { + \bool_if:NF \g_@@_bfupgreek_bool + { + \@@_set_normal_greek:nn {bfit,bfup} {#1} + \@@_set_mathalphabet_greek:nnn {bf} {up,it} {#1} + } + } + } + +\@@_new_alphabet_config:nnn {bfit} {misc} + { + \bool_if:NTF \g_@@_literal_Nabla_bool + { \@@_set_normal_char:nnn {Nabla}{bfit}{#1} } + { + \bool_if:NF \g_@@_upNabla_bool + { \@@_set_normal_char:nnn {Nabla}{bfup,bfit}{#1} } + } + \bool_if:NTF \g_@@_literal_partial_bool + { \@@_set_normal_char:nnn {partial}{bfit}{#1} } + { + \bool_if:NF \g_@@_uppartial_bool + { \@@_set_normal_char:nnn {partial}{bfup,bfit}{#1} } + } + \@@_set_mathalphabet_pos:nnnn {bfit} {partial} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {bfit} {Nabla} {up,it}{#1} + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_mathalphabet_pos:nnnn {bf} {partial} {it}{#1} + } + { + \bool_if:NF \g_@@_uppartial_bool + { + \@@_set_mathalphabet_pos:nnnn {bf} {partial} {up,it}{#1} + } + } + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_mathalphabet_pos:nnnn {bf} {Nabla} {it}{#1} + } + { + \bool_if:NF \g_@@_upNabla_bool + { + \@@_set_mathalphabet_pos:nnnn {bf} {Nabla} {up,it}{#1} + } + } + } +% \end{macrocode} +% +% +% \subsubsection{Bold Upright: bfup} +% \begin{macrocode} +\@@_new_alphabet_config:nnn {bfup} {num} + { + \@@_set_mathalphabet_numbers:nnn {bf} {up}{#1} + \@@_set_mathalphabet_numbers:nnn {bfup} {up}{#1} + } + +\@@_new_alphabet_config:nnn {bfup} {Latin} + { + \bool_if:NT \g_@@_bfupLatin_bool + { + \@@_set_normal_Latin:nn {bfup,bfit} {#1} + } + \@@_set_mathalphabet_Latin:nnn {bfup} {up,it}{#1} + \bool_if:NTF \g_@@_bfliteral_bool + { + \@@_set_normal_Latin:nn {bfup} {#1} + \@@_set_mathalphabet_Latin:nnn {bf} {up}{#1} + } + { + \bool_if:NT \g_@@_bfupLatin_bool + { + \@@_set_normal_Latin:nn {bfup,bfit} {#1} + \@@_set_mathalphabet_Latin:nnn {bf} {up,it}{#1} + } + } + } + +\@@_new_alphabet_config:nnn {bfup} {latin} + { + \bool_if:NT \g_@@_bfuplatin_bool + { + \@@_set_normal_latin:nn {bfup,bfit} {#1} + } + \@@_set_mathalphabet_latin:nnn {bfup} {up,it}{#1} + \bool_if:NTF \g_@@_bfliteral_bool + { + \@@_set_normal_latin:nn {bfup} {#1} + \@@_set_mathalphabet_latin:nnn {bf} {up}{#1} + } + { + \bool_if:NT \g_@@_bfuplatin_bool + { + \@@_set_normal_latin:nn {bfup,bfit} {#1} + \@@_set_mathalphabet_latin:nnn {bf} {up,it}{#1} + } + } + } +\@@_new_alphabet_config:nnn {bfup} {Greek} + { + \@@_set_mathalphabet_Greek:nnn {bfup} {up,it}{#1} + \bool_if:NTF \g_@@_bfliteral_bool + { + \@@_set_normal_Greek:nn {bfup}{#1} + \@@_set_mathalphabet_Greek:nnn {bf} {up}{#1} + } + { + \bool_if:NT \g_@@_bfupGreek_bool + { + \@@_set_normal_Greek:nn {bfup,bfit}{#1} + \@@_set_mathalphabet_Greek:nnn {bf} {up,it}{#1} + } + } + } + +\@@_new_alphabet_config:nnn {bfup} {greek} + { + \@@_set_mathalphabet_greek:nnn {bfup} {up,it} {#1} + \bool_if:NTF \g_@@_bfliteral_bool + { + \@@_set_normal_greek:nn {bfup} {#1} + \@@_set_mathalphabet_greek:nnn {bf} {up} {#1} + } + { + \bool_if:NT \g_@@_bfupgreek_bool + { + \@@_set_normal_greek:nn {bfup,bfit} {#1} + \@@_set_mathalphabet_greek:nnn {bf} {up,it} {#1} + } + } + } + +\@@_new_alphabet_config:nnn {bfup} {misc} + { + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_normal_char:nnn {Nabla}{bfup}{#1} + } + { + \bool_if:NT \g_@@_upNabla_bool + { + \@@_set_normal_char:nnn {Nabla}{bfup,bfit}{#1} + } + } + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_normal_char:nnn {partial}{bfup}{#1} + } + { + \bool_if:NT \g_@@_uppartial_bool + { + \@@_set_normal_char:nnn {partial}{bfup,bfit}{#1} + } + } + \@@_set_mathalphabet_pos:nnnn {bfup} {partial} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {bfup} {Nabla} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {bfup} {digamma} {up}{#1} + \@@_set_mathalphabet_pos:nnnn {bfup} {Digamma} {up}{#1} + \@@_set_mathalphabet_pos:nnnn {bf} {digamma} {up}{#1} + \@@_set_mathalphabet_pos:nnnn {bf} {Digamma} {up}{#1} + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_mathalphabet_pos:nnnn {bf} {partial} {up}{#1} + } + { + \bool_if:NT \g_@@_uppartial_bool + { + \@@_set_mathalphabet_pos:nnnn {bf} {partial} {up,it}{#1} + } + } + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_mathalphabet_pos:nnnn {bf} {Nabla} {up}{#1} + } + { + \bool_if:NT \g_@@_upNabla_bool + { + \@@_set_mathalphabet_pos:nnnn {bf} {Nabla} {up,it}{#1} + } + } + } +% \end{macrocode} +% +% \subsubsection{Bold fractur or fraktur or blackletter: bffrak} +% \begin{macrocode} +\@@_new_alphabet_config:nnn {bffrak} {Latin} + { + \@@_set_mathalphabet_Latin:nnn {bffrak} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {bffrak} {latin} + { + \@@_set_mathalphabet_latin:nnn {bffrak} {up,it}{#1} + } +% \end{macrocode} +% +% \subsubsection{Bold script or calligraphic: bfscr} +% \begin{macrocode} +\@@_new_alphabet_config:nnn {bfscr} {Latin} + { + \@@_set_mathalphabet_Latin:nnn {bfscr} {up,it}{#1} + } +\@@_new_alphabet_config:nnn {bfscr} {latin} + { + \@@_set_mathalphabet_latin:nnn {bfscr} {up,it}{#1} + } +\@@_new_alphabet_config:nnn {bfcal} {Latin} + { + \@@_set_mathalphabet_Latin:nnn {bfcal} {up,it}{#1} + } +% \end{macrocode} +% +% \subsubsection{Bold upright sans serif: bfsfup} +% \begin{macrocode} +\@@_new_alphabet_config:nnn {bfsfup} {num} + { + \@@_set_mathalphabet_numbers:nnn {bfsf} {up}{#1} + \@@_set_mathalphabet_numbers:nnn {bfsfup} {up}{#1} + } +\@@_new_alphabet_config:nnn {bfsfup} {Latin} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_Latin:nn {bfsfup} {#1} + \@@_set_mathalphabet_Latin:nnn {bfsf} {up}{#1} + } + { + \bool_if:NT \g_@@_upsans_bool + { + \@@_set_normal_Latin:nn {bfsfup,bfsfit} {#1} + \@@_set_mathalphabet_Latin:nnn {bfsf} {up,it}{#1} + } + } + \@@_set_mathalphabet_Latin:nnn {bfsfup} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {bfsfup} {latin} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_latin:nn {bfsfup} {#1} + \@@_set_mathalphabet_latin:nnn {bfsf} {up}{#1} + } + { + \bool_if:NT \g_@@_upsans_bool + { + \@@_set_normal_latin:nn {bfsfup,bfsfit} {#1} + \@@_set_mathalphabet_latin:nnn {bfsf} {up,it}{#1} + } + } + \@@_set_mathalphabet_latin:nnn {bfsfup} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {bfsfup} {Greek} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_Greek:nn {bfsfup}{#1} + \@@_set_mathalphabet_Greek:nnn {bfsf} {up}{#1} + } + { + \bool_if:NT \g_@@_upsans_bool + { + \@@_set_normal_Greek:nn {bfsfup,bfsfit}{#1} + \@@_set_mathalphabet_Greek:nnn {bfsf} {up,it}{#1} + } + } + \@@_set_mathalphabet_Greek:nnn {bfsfup} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {bfsfup} {greek} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_greek:nn {bfsfup} {#1} + \@@_set_mathalphabet_greek:nnn {bfsf} {up} {#1} + } + { + \bool_if:NT \g_@@_upsans_bool + { + \@@_set_normal_greek:nn {bfsfup,bfsfit} {#1} + \@@_set_mathalphabet_greek:nnn {bfsf} {up,it} {#1} + } + } + \@@_set_mathalphabet_greek:nnn {bfsfup} {up,it} {#1} + } +\@@_new_alphabet_config:nnn {bfsfup} {misc} + { + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_normal_char:nnn {Nabla}{bfsfup}{#1} + } + { + \bool_if:NT \g_@@_upNabla_bool + { + \@@_set_normal_char:nnn {Nabla}{bfsfup,bfsfit}{#1} + } + } + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_normal_char:nnn {partial}{bfsfup}{#1} + } + { + \bool_if:NT \g_@@_uppartial_bool + { + \@@_set_normal_char:nnn {partial}{bfsfup,bfsfit}{#1} + } + } + \@@_set_mathalphabet_pos:nnnn {bfsfup} {partial} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {bfsfup} {Nabla} {up,it}{#1} + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_mathalphabet_pos:nnnn {bfsf} {partial} {up}{#1} + } + { + \bool_if:NT \g_@@_uppartial_bool + { + \@@_set_mathalphabet_pos:nnnn {bfsf} {partial} {up,it}{#1} + } + } + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_mathalphabet_pos:nnnn {bfsf} {Nabla} {up}{#1} + } + { + \bool_if:NT \g_@@_upNabla_bool + { + \@@_set_mathalphabet_pos:nnnn {bfsf} {Nabla} {up,it}{#1} + } + } + } +% \end{macrocode} +% +% +% \subsubsection{Bold italic sans serif: bfsfit} +% \begin{macrocode} +\@@_new_alphabet_config:nnn {bfsfit} {Latin} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_Latin:nn {bfsfit} {#1} + \@@_set_mathalphabet_Latin:nnn {bfsf} {it}{#1} + } + { + \bool_if:NF \g_@@_upsans_bool + { + \@@_set_normal_Latin:nn {bfsfup,bfsfit} {#1} + \@@_set_mathalphabet_Latin:nnn {bfsf} {up,it}{#1} + } + } + \@@_set_mathalphabet_Latin:nnn {bfsfit} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {bfsfit} {latin} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_latin:nn {bfsfit} {#1} + \@@_set_mathalphabet_latin:nnn {bfsf} {it}{#1} + } + { + \bool_if:NF \g_@@_upsans_bool + { + \@@_set_normal_latin:nn {bfsfup,bfsfit} {#1} + \@@_set_mathalphabet_latin:nnn {bfsf} {up,it}{#1} + } + } + \@@_set_mathalphabet_latin:nnn {bfsfit} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {bfsfit} {Greek} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_Greek:nn {bfsfit}{#1} + \@@_set_mathalphabet_Greek:nnn {bfsf} {it}{#1} + } + { + \bool_if:NF \g_@@_upsans_bool + { + \@@_set_normal_Greek:nn {bfsfup,bfsfit}{#1} + \@@_set_mathalphabet_Greek:nnn {bfsf} {up,it}{#1} + } + } + \@@_set_mathalphabet_Greek:nnn {bfsfit} {up,it}{#1} + } + +\@@_new_alphabet_config:nnn {bfsfit} {greek} + { + \bool_if:NTF \g_@@_sfliteral_bool + { + \@@_set_normal_greek:nn {bfsfit} {#1} + \@@_set_mathalphabet_greek:nnn {bfsf} {it} {#1} + } + { + \bool_if:NF \g_@@_upsans_bool + { + \@@_set_normal_greek:nn {bfsfup,bfsfit} {#1} + \@@_set_mathalphabet_greek:nnn {bfsf} {up,it} {#1} + } + } + \@@_set_mathalphabet_greek:nnn {bfsfit} {up,it} {#1} + } + +\@@_new_alphabet_config:nnn {bfsfit} {misc} + { + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_normal_char:nnn {Nabla}{bfsfit}{#1} + } + { + \bool_if:NF \g_@@_upNabla_bool + { + \@@_set_normal_char:nnn {Nabla}{bfsfup,bfsfit}{#1} + } + } + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_normal_char:nnn {partial}{bfsfit}{#1} + } + { + \bool_if:NF \g_@@_uppartial_bool + { + \@@_set_normal_char:nnn {partial}{bfsfup,bfsfit}{#1} + } + } + \@@_set_mathalphabet_pos:nnnn {bfsfit} {partial} {up,it}{#1} + \@@_set_mathalphabet_pos:nnnn {bfsfit} {Nabla} {up,it}{#1} + \bool_if:NTF \g_@@_literal_partial_bool + { + \@@_set_mathalphabet_pos:nnnn {bfsf} {partial} {it}{#1} + } + { + \bool_if:NF \g_@@_uppartial_bool + { + \@@_set_mathalphabet_pos:nnnn {bfsf} {partial} {up,it}{#1} + } + } + \bool_if:NTF \g_@@_literal_Nabla_bool + { + \@@_set_mathalphabet_pos:nnnn {bfsf} {Nabla} {it}{#1} + } + { + \bool_if:NF \g_@@_upNabla_bool + { + \@@_set_mathalphabet_pos:nnnn {bfsf} {Nabla} {up,it}{#1} + } + } + } +% \end{macrocode} +% +% \begin{macrocode} +%</alphabets> +% \end{macrocode} diff --git a/Master/texmf-dist/source/latex/unicode-math/unicode-math-compat.dtx b/Master/texmf-dist/source/latex/unicode-math/unicode-math-compat.dtx new file mode 100644 index 00000000000..6ab6f351241 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math-compat.dtx @@ -0,0 +1,508 @@ +% \subsection{Compatibility} +% +% \begin{macrocode} +%<*compat> +% \end{macrocode} +% +% \begin{macro}{\@@_check_and_fix:NNnnnn} +% \darg{command} +% \darg{factory command} +% \darg{parameter text} +% \darg{expected replacement text} +% \darg{new replacement text for \LuaTeX} +% \darg{new replacement text for \XeTeX} +% Tries to patch \meta{command}. +% If \meta{command} is undefined, do nothing. +% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. +% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text for \LuaTeX} or the \meta{new replacement text for \XeTeX}, depending on the engine. +% Otherwise issue a warning and don’t overwrite. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_check_and_fix:NNnnnn + { + \cs_if_exist:NT #1 + { + \token_if_macro:NTF #1 + { + \group_begin: + #2 \@@_tmpa:w #3 { #4 } + \cs_if_eq:NNTF #1 \@@_tmpa:w + { + \msg_info:nnx { unicode-math } { patch-macro } + { \token_to_str:N #1 } + \group_end: + #2 #1 #3 +%<XE> { #6 } +%<LU> { #5 } + } + { + \msg_warning:nnxxx { unicode-math } { wrong-meaning } + { \token_to_str:N #1 } { \token_to_meaning:N #1 } + { \token_to_meaning:N \@@_tmpa:w } + \group_end: + } + } + { + \msg_warning:nnx { unicode-math } { macro-expected } + { \token_to_str:N #1 } + } + } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_check_and_fix:NNnnn} +% \darg{command} +% \darg{factory command} +% \darg{parameter text} +% \darg{expected replacement text} +% \darg{new replacement text} +% Tries to patch \meta{command}. +% If \meta{command} is undefined, do nothing. +% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. +% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text}. +% Otherwise issue a warning and don’t overwrite. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_check_and_fix:NNnnn + { + \@@_check_and_fix:NNnnnn #1 #2 { #3 } { #4 } { #5 } { #5 } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_check_and_fix_luatex:NNnnn} +% \begin{macro}{\@@_check_and_fix_luatex:cNnnn} +% \darg{command} +% \darg{factory command} +% \darg{parameter text} +% \darg{expected replacement text} +% \darg{new replacement text} +% Tries to patch \meta{command}. +% If \XeTeX\ is the current engine or \meta{command} is undefined, do nothing. +% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. +% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text}. +% Otherwise issue a warning and don’t overwrite. +% \begin{macrocode} +\cs_new_protected_nopar:Nn \@@_check_and_fix_luatex:NNnnn + { +%<LU> \@@_check_and_fix:NNnnn #1 #2 { #3 } { #4 } { #5 } + } +\cs_generate_variant:Nn \@@_check_and_fix_luatex:NNnnn { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \paragraph{\pkg{url}} +% Simply need to get \pkg{url} in a state such that +% when it switches to math mode and enters \ascii\ characters, the maths +% setup (i.e., \pkg{unicode-math}) doesn't remap the symbols into Plane 1. +% Which is, of course, what \cs{mathup} is doing. +% +% This is the same as writing, e.g., |\def\UrlFont{\ttfamily\@@_switchto_up:}| +% but activates automatically so old documents that might change the \cs{url} +% font still work correctly. +% \begin{macrocode} +\AtEndOfPackageFile * {url} + { + \tl_put_left:Nn \Url@FormatString { \@@_switchto_up: } + \tl_put_right:Nn \UrlSpecials + { + \do\`{\mathchar`\`} + \do\'{\mathchar`\'} + \do\${\mathchar`\$} + \do\&{\mathchar`\&} + } + } +% \end{macrocode} +% +% \paragraph{\pkg{amsmath}} +% Since the mathcode of |`\-| is greater than eight bits, this piece of |\AtBeginDocument| code from \pkg{amsmath} dies if we try and set the maths font in the preamble: +% \begin{macrocode} +\AtEndOfPackageFile * {amsmath} + { +%<*XE> + \tl_remove_once:Nn \@begindocumenthook + { + \mathchardef\std@minus\mathcode`\-\relax + \mathchardef\std@equal\mathcode`\=\relax + } + \def\std@minus{\Umathcharnum\Umathcodenum`\-\relax} + \def\std@equal{\Umathcharnum\Umathcodenum`\=\relax} +%</XE> +% \end{macrocode} +% +% \begin{macrocode} + \cs_set:Npn \@cdots {\mathinner{\cdots}} + \cs_set_eq:NN \dotsb@ \cdots +% \end{macrocode} +% This isn't as clever as the \pkg{amsmath} definition but I think it works: +% \begin{macrocode} +%<*XE> + \def \resetMathstrut@ + {% + \setbox\z@\hbox{$($}%) + \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ + } +% \end{macrocode} +% The |subarray| environment uses inappropriate font dimensions. +% \begin{macrocode} + \@@_check_and_fix:NNnnn \subarray \cs_set:Npn { #1 } + { + \vcenter + \bgroup + \Let@ + \restore@math@cr + \default@tag + \baselineskip \fontdimen 10~ \scriptfont \tw@ + \advance \baselineskip \fontdimen 12~ \scriptfont \tw@ + \lineskip \thr@@@@ \fontdimen 8~ \scriptfont \thr@@@@ + \lineskiplimit \lineskip + \ialign + \bgroup + \ifx c #1 \hfil \fi + $ \m@th \scriptstyle ## $ + \hfil + \crcr + } + { + \vcenter + \c_group_begin_token + \Let@ + \restore@math@cr + \default@tag + \skip_set:Nn \baselineskip + { +% \end{macrocode} +% Here we use stack top shift + stack bottom shift, which sounds reasonable. +% \begin{macrocode} + \@@_stack_num_up:N \scriptstyle + + \@@_stack_denom_down:N \scriptstyle + } +% \end{macrocode} +% Here we use the minimum stack gap. +% \begin{macrocode} + \lineskip \@@_stack_vgap:N \scriptstyle + \lineskiplimit \lineskip + \ialign + \c_group_begin_token + \token_if_eq_meaning:NNT c #1 { \hfil } + \c_math_toggle_token + \m@th + \scriptstyle + \c_parameter_token \c_parameter_token + \c_math_toggle_token + \hfil + \crcr + } +%</XE> +% \end{macrocode} +% The roots need a complete rework. +% \begin{macrocode} + \@@_check_and_fix_luatex:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } + { + \setbox \rootbox \hbox + { + $ \m@th \scriptscriptstyle { #1 } $ + } + \mathchoice + { \r@@@@t \displaystyle { #2 } } + { \r@@@@t \textstyle { #2 } }~ + { \r@@@@t \scriptstyle { #2 } } + { \r@@@@t \scriptscriptstyle { #2 } } + \egroup + } + { + \bool_if:nTF + { + \int_compare_p:nNn { \uproot@ } = { \c_zero } + && \int_compare_p:nNn { \leftroot@ } = { \c_zero } + } + { + \luatexUroot \l_@@_radical_sqrt_tl { #1 } { #2 } + } + { + \hbox_set:Nn \rootbox + { + \c_math_toggle_token + \m@th + \scriptscriptstyle { #1 } + \c_math_toggle_token + } + \mathchoice + { \r@@@@t \displaystyle { #2 } } + { \r@@@@t \textstyle { #2 } } + { \r@@@@t \scriptstyle { #2 } } + { \r@@@@t \scriptscriptstyle { #2 } } + } + \c_group_end_token + } + \@@_check_and_fix:NNnnnn \r@@@@t \cs_set_nopar:Npn { #1 #2 } + { + \setboxz@h { $ \m@th #1 \sqrtsign { #2 } $ } + \dimen@ \ht\z@ + \advance \dimen@ -\dp\z@ + \setbox\@ne \hbox { $ \m@th #1 \mskip \uproot@ mu $ } + \advance \dimen@ by 1.667 \wd\@ne + \mkern -\leftroot@ mu + \mkern 5mu + \raise .6\dimen@ \copy\rootbox + \mkern -10mu + \mkern \leftroot@ mu + \boxz@ + } + { + \hbox_set:Nn \l_tmpa_box + { + \c_math_toggle_token + \m@th + #1 + \mskip \uproot@ mu + \c_math_toggle_token + } + \luatexUroot \l_@@_radical_sqrt_tl + { + \box_move_up:nn { \box_wd:N \l_tmpa_box } + { + \hbox:n + { + \c_math_toggle_token + \m@th + \mkern -\leftroot@ mu + \box_use:N \rootbox + \mkern \leftroot@ mu + \c_math_toggle_token + } + } + } + { #2 } + } + { + \hbox_set:Nn \l_tmpa_box + { + \c_math_toggle_token + \m@th + #1 + \sqrtsign { #2 } + \c_math_toggle_token + } + \hbox_set:Nn \l_tmpb_box + { + \c_math_toggle_token + \m@th + #1 + \mskip \uproot@ mu + \c_math_toggle_token + } + \mkern -\leftroot@ mu + \@@_mathstyle_scale:Nnn #1 { \kern } + { + \fontdimen 63 \l_@@_font + } + \box_move_up:nn + { + \box_wd:N \l_tmpb_box + + (\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 + } + \mkern \leftroot@ mu + \box_use_clear:N \l_tmpa_box + } + } +% \end{macrocode} +% +% \paragraph{\pkg{amsopn}} +% This code is to improve the output of analphabetic symbols in text of operator names (\cs{sin}, \cs{cos}, etc.). Just comment out the offending lines for now: +% \begin{macrocode} +%<*XE> +\AtEndOfPackageFile * {amsopn} + { + \cs_set:Npn \newmcodes@ + { + \mathcode`\'39\scan_stop: + \mathcode`\*42\scan_stop: + \mathcode`\."613A\scan_stop: +%% \ifnum\mathcode`\-=45 \else +%% \mathchardef\std@minus\mathcode`\-\relax +%% \fi + \mathcode`\-45\scan_stop: + \mathcode`\/47\scan_stop: + \mathcode`\:"603A\scan_stop: + } + } +%</XE> +% \end{macrocode} +% +% \paragraph{\pkg{mathtools}} +% \pkg{mathtools}’s |\cramped| command and others that make use of its internal version use an incorrect font dimension. +% +% \begin{macrocode} +\AtEndOfPackageFile * { mathtools } + { +%<*XE> + \newfam \g_@@_empty_fam + \@@_check_and_fix:NNnnn + \MT_cramped_internal:Nn \cs_set_nopar:Npn { #1 #2 } + { + \sbox \z@ + { + $ + \m@th + #1 + \nulldelimiterspace = \z@ + \radical \z@ { #2 } + $ + } + \ifx #1 \displaystyle + \dimen@ = \fontdimen 8 \textfont 3 + \advance \dimen@ .25 \fontdimen 5 \textfont 2 + \else + \dimen@ = 1.25 \fontdimen 8 + \ifx #1 \textstyle + \textfont + \else + \ifx #1 \scriptstyle + \scriptfont + \else + \scriptscriptfont + \fi + \fi + 3 + \fi + \advance \dimen@ -\ht\z@ + \ht\z@ = -\dimen@ + \box\z@ + } +% \end{macrocode} +% The \XeTeX\ version is pretty similar to the legacy version, only using the correct font dimensions. +% Note we used `\verb|\XeTeXradical|' with a newly-allocated empty family to make sure that the radical rule width is not set. +% \begin{macrocode} + { + \hbox_set:Nn \l_tmpa_box + { + \color@setgroup + \c_math_toggle_token + \m@th + #1 + \dim_zero:N \nulldelimiterspace + \XeTeXradical \g_@@_empty_fam \c_zero { #2 } + \c_math_toggle_token + \color@endgroup + } + \box_set_ht:Nn \l_tmpa_box + { + \box_ht:N \l_tmpa_box +% \end{macrocode} +% Here we use the radical vertical gap. +% \begin{macrocode} + - \@@_radical_vgap:N #1 + } + \box_use_clear:N \l_tmpa_box + } +%</XE> +% \end{macrocode} +% +% \begin{macro}{\overbracket} +% \begin{macro}{\underbracket} +% \pkg{mathtools}’s |\overbracket| and |\underbracket| take optional +% arguments and are defined in terms of rules, so we keep them, and rename +% ours to |\Uoverbracket| and |\Uunderbracket|. +% \begin{macrocode} +\AtEndOfPackageFile * { mathtools } + { + \cs_set_eq:NN \MToverbracket \overbracket + \cs_set_eq:NN \MTunderbracket \underbracket + + \AtBeginDocument + { + \msg_warning:nn { unicode-math } { mathtools-overbracket } + + \def\downbracketfill#1#2 + {% +% \end{macrocode} +% Original definition used the height of |\braceld| which is not available +% with Unicode fonts, so we are hard coding the $5/18$ex suggested by +% \pkg{mathtools}’s documentation. +% \begin{macrocode} + \edef\l_MT_bracketheight_fdim{.27ex}% + \downbracketend{#1}{#2} + \leaders \vrule \@height #1 \@depth \z@ \hfill + \downbracketend{#1}{#2}% + } + \def\upbracketfill#1#2 + {% + \edef\l_MT_bracketheight_fdim{.27ex}% + \upbracketend{#1}{#2} + \leaders \vrule \@height \z@ \@depth #1 \hfill + \upbracketend{#1}{#2}% + } + \let\Uoverbracket =\overbracket + \let\Uunderbracket=\underbracket + \let\overbracket =\MToverbracket + \let\underbracket =\MTunderbracket + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\dblcolon} +% \begin{macro}{\coloneqq} +% \begin{macro}{\Coloneqq} +% \begin{macro}{\eqqcolon} +% \pkg{mathtools} defines several commands as combinations of colons and +% other characters, but with meanings incompatible to \pkg{unicode-math}. +% Thus we issue a warning. Because \pkg{mathtools} uses +% \cmd{\providecommand} \cmd{\AtBeginDocument}, we can just define the +% offending commands here. +% \begin{macrocode} + \msg_warning:nn { unicode-math } { mathtools-colon } + \NewDocumentCommand \dblcolon { } { \Colon } + \NewDocumentCommand \coloneqq { } { \coloneq } + \NewDocumentCommand \Coloneqq { } { \Coloneq } + \NewDocumentCommand \eqqcolon { } { \eqcolon } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \paragraph{\pkg{colonequals}} +% +% \begin{macro}{\ratio} +% \begin{macro}{\coloncolon} +% \begin{macro}{\minuscolon} +% \begin{macro}{\colonequals} +% \begin{macro}{\equalscolon} +% \begin{macro}{\coloncolonequals} +% Similarly to \pkg{mathtools}, the \pkg{colonequals} defines several colon +% combinations. Fortunately there are no name clashes, so we can just +% overwrite their definitions. +% \begin{macrocode} +\AtEndOfPackageFile * { colonequals } + { + \msg_warning:nn { unicode-math } { colonequals } + \RenewDocumentCommand \ratio { } { \mathratio } + \RenewDocumentCommand \coloncolon { } { \Colon } + \RenewDocumentCommand \minuscolon { } { \dashcolon } + \RenewDocumentCommand \colonequals { } { \coloneq } + \RenewDocumentCommand \equalscolon { } { \eqcolon } + \RenewDocumentCommand \coloncolonequals { } { \Coloneq } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macrocode} +%</compat> +% \end{macrocode}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/unicode-math-msg.dtx b/Master/texmf-dist/source/latex/unicode-math/unicode-math-msg.dtx new file mode 100644 index 00000000000..9dc26b4a80d --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math-msg.dtx @@ -0,0 +1,112 @@ + +% \section{Error messages} +% \seclabel{codemsg} +% +% These are defined at the beginning of the package, but we leave their +% definition until now in the source to keep them out of the way. +% +% \begin{macrocode} +%<*msg> +% \end{macrocode} +% +% Wrapper functions: +% \begin{macrocode} +\cs_new:Npn \@@_error:n { \msg_error:nn {unicode-math} } +\cs_new:Npn \@@_warning:n { \msg_warning:nn {unicode-math} } +\cs_new:Npn \@@_warning:nnn { \msg_warning:nnxx {unicode-math} } +\cs_new:Npn \@@_log:n { \msg_log:nn {unicode-math} } +\cs_new:Npn \@@_log:nx { \msg_log:nnx {unicode-math} } +% \end{macrocode} +% +% \begin{macrocode} +\msg_new:nnn {unicode-math} {no-tfrac} +{ + Small~ fraction~ command~ \protect\tfrac\ not~ defined.\\ + Load~ amsmath~ or~ define~ it~ manually~ before~ loading~ unicode-math. +} +\msg_new:nnn {unicode-math} {default-math-font} +{ + Defining~ the~ default~ maths~ font~ as~ '\l_@@_fontname_tl'. +} +\msg_new:nnn {unicode-math} {setup-implicit} +{ + Setup~ alphabets:~ implicit~ mode. +} +\msg_new:nnn {unicode-math} {setup-explicit} +{ + Setup~ alphabets:~ explicit~ mode. +} +\msg_new:nnn {unicode-math} {alph-initialise} +{ + Initialising~ \@backslashchar math#1. +} +\msg_new:nnn {unicode-math} {setup-alph} +{ + Setup~ alphabet:~ #1. +} +\msg_new:nnn {unicode-math} {no-alphabet} +{ + I~ am~ trying~ to~ set~ up~ alphabet~"#1"~ but~ there~ are~ no~ configuration~ settings~ for~ it. + See~ file~ "unicode-math-alphabets.dtx". +} +\msg_new:nnn { unicode-math } { no-named-range } + { + I~ am~ trying~ to~ define~ new~ alphabet~ "#2"~ in~ range~ "#1",~ but~ range~ "#1"~ hasn't~ been~ defined~ yet. + } +\msg_new:nnn { unicode-math } { missing-alphabets } + { + Missing~math~alphabets~in~font~ "\fontname\l_@@_font" \\ \\ + \seq_map_function:NN \l_@@_missing_alph_seq \@@_print_indent:n + } +\cs_new:Nn \@@_print_indent:n { \space\space\space\space #1 \\ } +\msg_new:nnn {unicode-math} {macro-expected} +{ + I've~ expected~ that~ #1~ is~ a~ macro,~ but~ it~ isn't. +} +\msg_new:nnn {unicode-math} {wrong-meaning} +{ + I've~ expected~ #1~ to~ have~ the~ meaning~ #3,~ but~ it~ has~ the~ meaning~ #2. +} +\msg_new:nnn {unicode-math} {patch-macro} +{ + I'm~ going~ to~ patch~ macro~ #1. +} +\msg_new:nnn { unicode-math } { mathtools-overbracket } { + Using~ \token_to_str:N \overbracket\ and~ + \token_to_str:N \underbracket\ from~ + `mathtools'~ package.\\ + \\ + Use~ \token_to_str:N \Uoverbracket\ and~ + \token_to_str:N \Uunderbracket\ for~ + original~ `unicode-math'~ definition. +} +\msg_new:nnn { unicode-math } { mathtools-colon } { + I'm~ going~ to~ overwrite~ the~ following~ commands~ from~ + the~ `mathtools'~ package: \\ \\ + \ \ \ \ \token_to_str:N \dblcolon,~ + \token_to_str:N \coloneqq,~ + \token_to_str:N \Coloneqq,~ + \token_to_str:N \eqqcolon. \\ \\ + Note~ that~ since~ I~ won't~ overwrite~ the~ other~ colon-like~ + commands,~ using~ them~ will~ lead~ to~ inconsistencies. +} +\msg_new:nnn { unicode-math } { colonequals } { + I'm~ going~ to~ overwrite~ the~ following~ commands~ from~ + the~ `colonequals'~ package: \\ \\ + \ \ \ \ \token_to_str:N \ratio,~ + \token_to_str:N \coloncolon,~ + \token_to_str:N \minuscolon, \\ + \ \ \ \ \token_to_str:N \colonequals,~ + \token_to_str:N \equalscolon,~ + \token_to_str:N \coloncolonequals. \\ \\ + Note~ that~ since~ I~ won't~ overwrite~ the~ other~ colon-like~ + commands,~ using~ them~ will~ lead~ to~ inconsistencies.~ + Furthermore,~ changing~ \token_to_str:N \colonsep \c_space_tl + or~ \token_to_str:N \doublecolonsep \c_space_tl won't~ have~ + any~ effect~ on~ the~ re-defined~ commands. +} +% \end{macrocode} +% +% \begin{macrocode} +%</msg> +% \end{macrocode}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/unicode-math/unicode-math-usv.dtx b/Master/texmf-dist/source/latex/unicode-math/unicode-math-usv.dtx new file mode 100644 index 00000000000..35e7f17a563 --- /dev/null +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math-usv.dtx @@ -0,0 +1,568 @@ + + +% \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'.} +% +% \begin{macrocode} +%<*usv> +% \end{macrocode} +% +% \paragraph{Alphabets} +% \begin{macrocode} +\usv_set:nnn {normal} {num} {48} +\usv_set:nnn {normal} {Latin}{"1D434} +\usv_set:nnn {normal} {latin}{"1D44E} +\usv_set:nnn {normal} {Greek}{"1D6E2} +\usv_set:nnn {normal} {greek}{"1D6FC} +\usv_set:nnn {normal}{varTheta} {"1D6F3} +\usv_set:nnn {normal}{varepsilon}{"1D716} +\usv_set:nnn {normal}{vartheta} {"1D717} +\usv_set:nnn {normal}{varkappa} {"1D718} +\usv_set:nnn {normal}{varphi} {"1D719} +\usv_set:nnn {normal}{varrho} {"1D71A} +\usv_set:nnn {normal}{varpi} {"1D71B} +\usv_set:nnn {normal} {Nabla}{"1D6FB} +\usv_set:nnn {normal} {partial}{"1D715} + +\usv_set:nnn {up} {num} {48} +\usv_set:nnn {up} {Latin}{65} +\usv_set:nnn {up} {latin}{97} +\usv_set:nnn {up} {Greek}{"391} +\usv_set:nnn {up} {greek}{"3B1} +\usv_set:nnn {it} {Latin}{"1D434} +\usv_set:nnn {it} {latin}{"1D44E} +\usv_set:nnn {it} {Greek}{"1D6E2} +\usv_set:nnn {it} {greek}{"1D6FC} +\usv_set:nnn {bb} {num} {"1D7D8} +\usv_set:nnn {bb} {Latin}{"1D538} +\usv_set:nnn {bb} {latin}{"1D552} +\usv_set:nnn {scr} {Latin}{"1D49C} +\usv_set:nnn {cal} {Latin}{"1D49C} +\usv_set:nnn {scr} {latin}{"1D4B6} +\usv_set:nnn {frak}{Latin}{"1D504} +\usv_set:nnn {frak}{latin}{"1D51E} +\usv_set:nnn {sf} {num} {"1D7E2} +\usv_set:nnn {sfup}{num} {"1D7E2} +\usv_set:nnn {sfit}{num} {"1D7E2} +\usv_set:nnn {sfup}{Latin}{"1D5A0} +\usv_set:nnn {sf} {Latin}{"1D5A0} +\usv_set:nnn {sfup}{latin}{"1D5BA} +\usv_set:nnn {sf} {latin}{"1D5BA} +\usv_set:nnn {sfit}{Latin}{"1D608} +\usv_set:nnn {sfit}{latin}{"1D622} +\usv_set:nnn {tt} {num} {"1D7F6} +\usv_set:nnn {tt} {Latin}{"1D670} +\usv_set:nnn {tt} {latin}{"1D68A} +% \end{macrocode} +% Bold: +% \begin{macrocode} +\usv_set:nnn {bf} {num} {"1D7CE} +\usv_set:nnn {bfup} {num} {"1D7CE} +\usv_set:nnn {bfit} {num} {"1D7CE} +\usv_set:nnn {bfup} {Latin}{"1D400} +\usv_set:nnn {bfup} {latin}{"1D41A} +\usv_set:nnn {bfup} {Greek}{"1D6A8} +\usv_set:nnn {bfup} {greek}{"1D6C2} +\usv_set:nnn {bfit} {Latin}{"1D468} +\usv_set:nnn {bfit} {latin}{"1D482} +\usv_set:nnn {bfit} {Greek}{"1D71C} +\usv_set:nnn {bfit} {greek}{"1D736} +\usv_set:nnn {bffrak}{Latin}{"1D56C} +\usv_set:nnn {bffrak}{latin}{"1D586} +\usv_set:nnn {bfscr} {Latin}{"1D4D0} +\usv_set:nnn {bfcal} {Latin}{"1D4D0} +\usv_set:nnn {bfscr} {latin}{"1D4EA} +\usv_set:nnn {bfsf} {num} {"1D7EC} +\usv_set:nnn {bfsfup}{num} {"1D7EC} +\usv_set:nnn {bfsfit}{num} {"1D7EC} +\usv_set:nnn {bfsfup}{Latin}{"1D5D4} +\usv_set:nnn {bfsfup}{latin}{"1D5EE} +\usv_set:nnn {bfsfup}{Greek}{"1D756} +\usv_set:nnn {bfsfup}{greek}{"1D770} +\usv_set:nnn {bfsfit}{Latin}{"1D63C} +\usv_set:nnn {bfsfit}{latin}{"1D656} +\usv_set:nnn {bfsfit}{Greek}{"1D790} +\usv_set:nnn {bfsfit}{greek}{"1D7AA} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {bfsf}{Latin}{ \bool_if:NTF \g_@@_upLatin_bool \g_@@_bfsfup_Latin_usv \g_@@_bfsfit_Latin_usv } +\usv_set:nnn {bfsf}{latin}{ \bool_if:NTF \g_@@_uplatin_bool \g_@@_bfsfup_latin_usv \g_@@_bfsfit_latin_usv } +\usv_set:nnn {bfsf}{Greek}{ \bool_if:NTF \g_@@_upGreek_bool \g_@@_bfsfup_Greek_usv \g_@@_bfsfit_Greek_usv } +\usv_set:nnn {bfsf}{greek}{ \bool_if:NTF \g_@@_upgreek_bool \g_@@_bfsfup_greek_usv \g_@@_bfsfit_greek_usv } +\usv_set:nnn {bf} {Latin}{ \bool_if:NTF \g_@@_bfupLatin_bool \g_@@_bfup_Latin_usv \g_@@_bfit_Latin_usv } +\usv_set:nnn {bf} {latin}{ \bool_if:NTF \g_@@_bfuplatin_bool \g_@@_bfup_latin_usv \g_@@_bfit_latin_usv } +\usv_set:nnn {bf} {Greek}{ \bool_if:NTF \g_@@_bfupGreek_bool \g_@@_bfup_Greek_usv \g_@@_bfit_Greek_usv } +\usv_set:nnn {bf} {greek}{ \bool_if:NTF \g_@@_bfupgreek_bool \g_@@_bfup_greek_usv \g_@@_bfit_greek_usv } +% \end{macrocode} +% Greek variants: +% \begin{macrocode} +\usv_set:nnn {up}{varTheta} {"3F4} +\usv_set:nnn {up}{Digamma} {"3DC} +\usv_set:nnn {up}{varepsilon}{"3F5} +\usv_set:nnn {up}{vartheta} {"3D1} +\usv_set:nnn {up}{varkappa} {"3F0} +\usv_set:nnn {up}{varphi} {"3D5} +\usv_set:nnn {up}{varrho} {"3F1} +\usv_set:nnn {up}{varpi} {"3D6} +\usv_set:nnn {up}{digamma} {"3DD} +% \end{macrocode} +% Bold: +% \begin{macrocode} +\usv_set:nnn {bfup}{varTheta} {"1D6B9} +\usv_set:nnn {bfup}{Digamma} {"1D7CA} +\usv_set:nnn {bfup}{varepsilon}{"1D6DC} +\usv_set:nnn {bfup}{vartheta} {"1D6DD} +\usv_set:nnn {bfup}{varkappa} {"1D6DE} +\usv_set:nnn {bfup}{varphi} {"1D6DF} +\usv_set:nnn {bfup}{varrho} {"1D6E0} +\usv_set:nnn {bfup}{varpi} {"1D6E1} +\usv_set:nnn {bfup}{digamma} {"1D7CB} +% \end{macrocode} +% Italic Greek variants: +% \begin{macrocode} +\usv_set:nnn {it}{varTheta} {"1D6F3} +\usv_set:nnn {it}{varepsilon}{"1D716} +\usv_set:nnn {it}{vartheta} {"1D717} +\usv_set:nnn {it}{varkappa} {"1D718} +\usv_set:nnn {it}{varphi} {"1D719} +\usv_set:nnn {it}{varrho} {"1D71A} +\usv_set:nnn {it}{varpi} {"1D71B} +% \end{macrocode} +% Bold italic: +% \begin{macrocode} +\usv_set:nnn {bfit}{varTheta} {"1D72D} +\usv_set:nnn {bfit}{varepsilon}{"1D750} +\usv_set:nnn {bfit}{vartheta} {"1D751} +\usv_set:nnn {bfit}{varkappa} {"1D752} +\usv_set:nnn {bfit}{varphi} {"1D753} +\usv_set:nnn {bfit}{varrho} {"1D754} +\usv_set:nnn {bfit}{varpi} {"1D755} +% \end{macrocode} +% Bold sans: +% \begin{macrocode} +\usv_set:nnn {bfsfup}{varTheta} {"1D767} +\usv_set:nnn {bfsfup}{varepsilon}{"1D78A} +\usv_set:nnn {bfsfup}{vartheta} {"1D78B} +\usv_set:nnn {bfsfup}{varkappa} {"1D78C} +\usv_set:nnn {bfsfup}{varphi} {"1D78D} +\usv_set:nnn {bfsfup}{varrho} {"1D78E} +\usv_set:nnn {bfsfup}{varpi} {"1D78F} +% \end{macrocode} +% Bold sans italic: +% \begin{macrocode} +\usv_set:nnn {bfsfit}{varTheta} {"1D7A1} +\usv_set:nnn {bfsfit}{varepsilon}{"1D7C4} +\usv_set:nnn {bfsfit}{vartheta} {"1D7C5} +\usv_set:nnn {bfsfit}{varkappa} {"1D7C6} +\usv_set:nnn {bfsfit}{varphi} {"1D7C7} +\usv_set:nnn {bfsfit}{varrho} {"1D7C8} +\usv_set:nnn {bfsfit}{varpi} {"1D7C9} +% \end{macrocode} +% Nabla: +% \begin{macrocode} +\usv_set:nnn {up} {Nabla}{"02207} +\usv_set:nnn {it} {Nabla}{"1D6FB} +\usv_set:nnn {bfup} {Nabla}{"1D6C1} +\usv_set:nnn {bfit} {Nabla}{"1D735} +\usv_set:nnn {bfsfup}{Nabla}{"1D76F} +\usv_set:nnn {bfsfit}{Nabla}{"1D7A9} +% \end{macrocode} +% Partial: +% \begin{macrocode} +\usv_set:nnn {up} {partial}{"02202} +\usv_set:nnn {it} {partial}{"1D715} +\usv_set:nnn {bfup} {partial}{"1D6DB} +\usv_set:nnn {bfit} {partial}{"1D74F} +\usv_set:nnn {bfsfup}{partial}{"1D789} +\usv_set:nnn {bfsfit}{partial}{"1D7C3} +% \end{macrocode} +% \paragraph{Exceptions} +% These are need for mapping with the exceptions in other alphabets: +% (coming up) +% \begin{macrocode} +\usv_set:nnn {up}{B}{`\B} +\usv_set:nnn {up}{C}{`\C} +\usv_set:nnn {up}{D}{`\D} +\usv_set:nnn {up}{E}{`\E} +\usv_set:nnn {up}{F}{`\F} +\usv_set:nnn {up}{H}{`\H} +\usv_set:nnn {up}{I}{`\I} +\usv_set:nnn {up}{L}{`\L} +\usv_set:nnn {up}{M}{`\M} +\usv_set:nnn {up}{N}{`\N} +\usv_set:nnn {up}{P}{`\P} +\usv_set:nnn {up}{Q}{`\Q} +\usv_set:nnn {up}{R}{`\R} +\usv_set:nnn {up}{Z}{`\Z} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {it}{B}{"1D435} +\usv_set:nnn {it}{C}{"1D436} +\usv_set:nnn {it}{D}{"1D437} +\usv_set:nnn {it}{E}{"1D438} +\usv_set:nnn {it}{F}{"1D439} +\usv_set:nnn {it}{H}{"1D43B} +\usv_set:nnn {it}{I}{"1D43C} +\usv_set:nnn {it}{L}{"1D43F} +\usv_set:nnn {it}{M}{"1D440} +\usv_set:nnn {it}{N}{"1D441} +\usv_set:nnn {it}{P}{"1D443} +\usv_set:nnn {it}{Q}{"1D444} +\usv_set:nnn {it}{R}{"1D445} +\usv_set:nnn {it}{Z}{"1D44D} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {up}{d}{`\d} +\usv_set:nnn {up}{e}{`\e} +\usv_set:nnn {up}{g}{`\g} +\usv_set:nnn {up}{h}{`\h} +\usv_set:nnn {up}{i}{`\i} +\usv_set:nnn {up}{j}{`\j} +\usv_set:nnn {up}{o}{`\o} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {it}{d}{"1D451} +\usv_set:nnn {it}{e}{"1D452} +\usv_set:nnn {it}{g}{"1D454} +\usv_set:nnn {it}{h}{"0210E} +\usv_set:nnn {it}{i}{"1D456} +\usv_set:nnn {it}{j}{"1D457} +\usv_set:nnn {it}{o}{"1D45C} +% \end{macrocode} +% Latin `h': +% \begin{macrocode} +\usv_set:nnn {bb} {h}{"1D559} +\usv_set:nnn {tt} {h}{"1D691} +\usv_set:nnn {scr} {h}{"1D4BD} +\usv_set:nnn {frak} {h}{"1D525} +\usv_set:nnn {bfup} {h}{"1D421} +\usv_set:nnn {bfit} {h}{"1D489} +\usv_set:nnn {sfup} {h}{"1D5C1} +\usv_set:nnn {sfit} {h}{"1D629} +\usv_set:nnn {bffrak}{h}{"1D58D} +\usv_set:nnn {bfscr} {h}{"1D4F1} +\usv_set:nnn {bfsfup}{h}{"1D5F5} +\usv_set:nnn {bfsfit}{h}{"1D65D} +% \end{macrocode} +% Dotless `i' and `j: +% \begin{macrocode} +\usv_set:nnn {up}{dotlessi}{"00131} +\usv_set:nnn {up}{dotlessj}{"00237} +\usv_set:nnn {it}{dotlessi}{"1D6A4} +\usv_set:nnn {it}{dotlessj}{"1D6A5} +% \end{macrocode} +% Blackboard: +% \begin{macrocode} +\usv_set:nnn {bb}{C}{"2102} +\usv_set:nnn {bb}{H}{"210D} +\usv_set:nnn {bb}{N}{"2115} +\usv_set:nnn {bb}{P}{"2119} +\usv_set:nnn {bb}{Q}{"211A} +\usv_set:nnn {bb}{R}{"211D} +\usv_set:nnn {bb}{Z}{"2124} +\usv_set:nnn {up}{Pi} {"003A0} +\usv_set:nnn {up}{pi} {"003C0} +\usv_set:nnn {up}{Gamma} {"00393} +\usv_set:nnn {up}{gamma} {"003B3} +\usv_set:nnn {up}{summation}{"02211} +\usv_set:nnn {it}{Pi} {"1D6F1} +\usv_set:nnn {it}{pi} {"1D70B} +\usv_set:nnn {it}{Gamma} {"1D6E4} +\usv_set:nnn {it}{gamma} {"1D6FE} +\usv_set:nnn {bb}{Pi} {"0213F} +\usv_set:nnn {bb}{pi} {"0213C} +\usv_set:nnn {bb}{Gamma} {"0213E} +\usv_set:nnn {bb}{gamma} {"0213D} +\usv_set:nnn {bb}{summation}{"02140} +% \end{macrocode} +% Italic blackboard: +% \begin{macrocode} +\usv_set:nnn {bbit}{D}{"2145} +\usv_set:nnn {bbit}{d}{"2146} +\usv_set:nnn {bbit}{e}{"2147} +\usv_set:nnn {bbit}{i}{"2148} +\usv_set:nnn {bbit}{j}{"2149} +% \end{macrocode} +% Script exceptions: +% \begin{macrocode} +\usv_set:nnn {scr}{B}{"212C} +\usv_set:nnn {scr}{E}{"2130} +\usv_set:nnn {scr}{F}{"2131} +\usv_set:nnn {scr}{H}{"210B} +\usv_set:nnn {scr}{I}{"2110} +\usv_set:nnn {scr}{L}{"2112} +\usv_set:nnn {scr}{M}{"2133} +\usv_set:nnn {scr}{R}{"211B} +\usv_set:nnn {scr}{e}{"212F} +\usv_set:nnn {scr}{g}{"210A} +\usv_set:nnn {scr}{o}{"2134} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {cal}{B}{"212C} +\usv_set:nnn {cal}{E}{"2130} +\usv_set:nnn {cal}{F}{"2131} +\usv_set:nnn {cal}{H}{"210B} +\usv_set:nnn {cal}{I}{"2110} +\usv_set:nnn {cal}{L}{"2112} +\usv_set:nnn {cal}{M}{"2133} +\usv_set:nnn {cal}{R}{"211B} +% \end{macrocode} +% Fractur exceptions: +% \begin{macrocode} +\usv_set:nnn {frak}{C}{"212D} +\usv_set:nnn {frak}{H}{"210C} +\usv_set:nnn {frak}{I}{"2111} +\usv_set:nnn {frak}{R}{"211C} +\usv_set:nnn {frak}{Z}{"2128} +% \end{macrocode} +% +% \begin{macrocode} +%<*usv> +% \end{macrocode} +% +% \subsection{STIX fonts} +% +% Version 1.0.0 of the STIX fonts contains a number of +% alphabets in the private use area of Unicode; i.e., +% it contains many math glyphs that have not (yet or if ever) +% been accepted into the Unicode standard. +% +% But we still want to be able to use them if possible. +% +% \begin{macrocode} +%<*stix> +% \end{macrocode} +% +% \paragraph{Upright} +% \begin{macrocode} +\usv_set:nnn {stixsfup}{partial}{"E17C} +\usv_set:nnn {stixsfup}{Greek}{"E17D} +\usv_set:nnn {stixsfup}{greek}{"E196} +\usv_set:nnn {stixsfup}{varTheta}{"E18E} +\usv_set:nnn {stixsfup}{varepsilon}{"E1AF} +\usv_set:nnn {stixsfup}{vartheta}{"E1B0} +\usv_set:nnn {stixsfup}{varkappa}{0000} % ??? +\usv_set:nnn {stixsfup}{varphi}{"E1B1} +\usv_set:nnn {stixsfup}{varrho}{"E1B2} +\usv_set:nnn {stixsfup}{varpi}{"E1B3} +\usv_set:nnn {stixupslash}{Greek}{"E2FC} +% \end{macrocode} +% +% \paragraph{Italic} +% \begin{macrocode} +\usv_set:nnn {stixbbit}{A}{"E154} +\usv_set:nnn {stixbbit}{B}{"E155} +\usv_set:nnn {stixbbit}{E}{"E156} +\usv_set:nnn {stixbbit}{F}{"E157} +\usv_set:nnn {stixbbit}{G}{"E158} +\usv_set:nnn {stixbbit}{I}{"E159} +\usv_set:nnn {stixbbit}{J}{"E15A} +\usv_set:nnn {stixbbit}{K}{"E15B} +\usv_set:nnn {stixbbit}{L}{"E15C} +\usv_set:nnn {stixbbit}{M}{"E15D} +\usv_set:nnn {stixbbit}{O}{"E15E} +\usv_set:nnn {stixbbit}{S}{"E15F} +\usv_set:nnn {stixbbit}{T}{"E160} +\usv_set:nnn {stixbbit}{U}{"E161} +\usv_set:nnn {stixbbit}{V}{"E162} +\usv_set:nnn {stixbbit}{W}{"E163} +\usv_set:nnn {stixbbit}{X}{"E164} +\usv_set:nnn {stixbbit}{Y}{"E165} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixbbit}{a}{"E166} +\usv_set:nnn {stixbbit}{b}{"E167} +\usv_set:nnn {stixbbit}{c}{"E168} +\usv_set:nnn {stixbbit}{f}{"E169} +\usv_set:nnn {stixbbit}{g}{"E16A} +\usv_set:nnn {stixbbit}{h}{"E16B} +\usv_set:nnn {stixbbit}{k}{"E16C} +\usv_set:nnn {stixbbit}{l}{"E16D} +\usv_set:nnn {stixbbit}{m}{"E16E} +\usv_set:nnn {stixbbit}{n}{"E16F} +\usv_set:nnn {stixbbit}{o}{"E170} +\usv_set:nnn {stixbbit}{p}{"E171} +\usv_set:nnn {stixbbit}{q}{"E172} +\usv_set:nnn {stixbbit}{r}{"E173} +\usv_set:nnn {stixbbit}{s}{"E174} +\usv_set:nnn {stixbbit}{t}{"E175} +\usv_set:nnn {stixbbit}{u}{"E176} +\usv_set:nnn {stixbbit}{v}{"E177} +\usv_set:nnn {stixbbit}{w}{"E178} +\usv_set:nnn {stixbbit}{x}{"E179} +\usv_set:nnn {stixbbit}{y}{"E17A} +\usv_set:nnn {stixbbit}{z}{"E17B} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixsfit}{Numerals}{"E1B4} +\usv_set:nnn {stixsfit}{partial}{"E1BE} +\usv_set:nnn {stixsfit}{Greek}{"E1BF} +\usv_set:nnn {stixsfit}{greek}{"E1D8} +\usv_set:nnn {stixsfit}{varTheta}{"E1D0} +\usv_set:nnn {stixsfit}{varepsilon}{"E1F1} +\usv_set:nnn {stixsfit}{vartheta}{"E1F2} +\usv_set:nnn {stixsfit}{varkappa}{0000} % ??? +\usv_set:nnn {stixsfit}{varphi}{"E1F3} +\usv_set:nnn {stixsfit}{varrho}{"E1F4} +\usv_set:nnn {stixsfit}{varpi}{"E1F5} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixcal}{Latin}{"E22D} +\usv_set:nnn {stixcal}{num}{"E262} +\usv_set:nnn {scr}{num}{48} +\usv_set:nnn {it}{num}{48} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixsfitslash}{Latin}{"E294} +\usv_set:nnn {stixsfitslash}{latin}{"E2C8} +\usv_set:nnn {stixsfitslash}{greek}{"E32C} +\usv_set:nnn {stixsfitslash}{varepsilon}{"E37A} +\usv_set:nnn {stixsfitslash}{vartheta}{"E35E} +\usv_set:nnn {stixsfitslash}{varkappa}{"E374} +\usv_set:nnn {stixsfitslash}{varphi}{"E360} +\usv_set:nnn {stixsfitslash}{varrho}{"E376} +\usv_set:nnn {stixsfitslash}{varpi}{"E362} +\usv_set:nnn {stixsfitslash}{digamma}{"E36A} +% \end{macrocode} +% +% \paragraph{Bold} +% +% \begin{macrocode} +\usv_set:nnn {stixbfupslash}{Greek}{"E2FD} +\usv_set:nnn {stixbfupslash}{Digamma}{"E369} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixbfbb}{A}{"E38A} +\usv_set:nnn {stixbfbb}{B}{"E38B} +\usv_set:nnn {stixbfbb}{E}{"E38D} +\usv_set:nnn {stixbfbb}{F}{"E38E} +\usv_set:nnn {stixbfbb}{G}{"E38F} +\usv_set:nnn {stixbfbb}{I}{"E390} +\usv_set:nnn {stixbfbb}{J}{"E391} +\usv_set:nnn {stixbfbb}{K}{"E392} +\usv_set:nnn {stixbfbb}{L}{"E393} +\usv_set:nnn {stixbfbb}{M}{"E394} +\usv_set:nnn {stixbfbb}{O}{"E395} +\usv_set:nnn {stixbfbb}{S}{"E396} +\usv_set:nnn {stixbfbb}{T}{"E397} +\usv_set:nnn {stixbfbb}{U}{"E398} +\usv_set:nnn {stixbfbb}{V}{"E399} +\usv_set:nnn {stixbfbb}{W}{"E39A} +\usv_set:nnn {stixbfbb}{X}{"E39B} +\usv_set:nnn {stixbfbb}{Y}{"E39C} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixbfbb}{a}{"E39D} +\usv_set:nnn {stixbfbb}{b}{"E39E} +\usv_set:nnn {stixbfbb}{c}{"E39F} +\usv_set:nnn {stixbfbb}{f}{"E3A2} +\usv_set:nnn {stixbfbb}{g}{"E3A3} +\usv_set:nnn {stixbfbb}{h}{"E3A4} +\usv_set:nnn {stixbfbb}{k}{"E3A7} +\usv_set:nnn {stixbfbb}{l}{"E3A8} +\usv_set:nnn {stixbfbb}{m}{"E3A9} +\usv_set:nnn {stixbfbb}{n}{"E3AA} +\usv_set:nnn {stixbfbb}{o}{"E3AB} +\usv_set:nnn {stixbfbb}{p}{"E3AC} +\usv_set:nnn {stixbfbb}{q}{"E3AD} +\usv_set:nnn {stixbfbb}{r}{"E3AE} +\usv_set:nnn {stixbfbb}{s}{"E3AF} +\usv_set:nnn {stixbfbb}{t}{"E3B0} +\usv_set:nnn {stixbfbb}{u}{"E3B1} +\usv_set:nnn {stixbfbb}{v}{"E3B2} +\usv_set:nnn {stixbfbb}{w}{"E3B3} +\usv_set:nnn {stixbfbb}{x}{"E3B4} +\usv_set:nnn {stixbfbb}{y}{"E3B5} +\usv_set:nnn {stixbfbb}{z}{"E3B6} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixbfsfup}{Numerals}{"E3B7} +% \end{macrocode} +% +% \paragraph{Bold Italic} +% \begin{macrocode} +\usv_set:nnn {stixbfsfit}{Numerals}{"E1F6} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixbfbbit}{A}{"E200} +\usv_set:nnn {stixbfbbit}{B}{"E201} +\usv_set:nnn {stixbfbbit}{E}{"E203} +\usv_set:nnn {stixbfbbit}{F}{"E204} +\usv_set:nnn {stixbfbbit}{G}{"E205} +\usv_set:nnn {stixbfbbit}{I}{"E206} +\usv_set:nnn {stixbfbbit}{J}{"E207} +\usv_set:nnn {stixbfbbit}{K}{"E208} +\usv_set:nnn {stixbfbbit}{L}{"E209} +\usv_set:nnn {stixbfbbit}{M}{"E20A} +\usv_set:nnn {stixbfbbit}{O}{"E20B} +\usv_set:nnn {stixbfbbit}{S}{"E20C} +\usv_set:nnn {stixbfbbit}{T}{"E20D} +\usv_set:nnn {stixbfbbit}{U}{"E20E} +\usv_set:nnn {stixbfbbit}{V}{"E20F} +\usv_set:nnn {stixbfbbit}{W}{"E210} +\usv_set:nnn {stixbfbbit}{X}{"E211} +\usv_set:nnn {stixbfbbit}{Y}{"E212} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixbfbbit}{a}{"E213} +\usv_set:nnn {stixbfbbit}{b}{"E214} +\usv_set:nnn {stixbfbbit}{c}{"E215} +\usv_set:nnn {stixbfbbit}{e}{"E217} +\usv_set:nnn {stixbfbbit}{f}{"E218} +\usv_set:nnn {stixbfbbit}{g}{"E219} +\usv_set:nnn {stixbfbbit}{h}{"E21A} +\usv_set:nnn {stixbfbbit}{k}{"E21D} +\usv_set:nnn {stixbfbbit}{l}{"E21E} +\usv_set:nnn {stixbfbbit}{m}{"E21F} +\usv_set:nnn {stixbfbbit}{n}{"E220} +\usv_set:nnn {stixbfbbit}{o}{"E221} +\usv_set:nnn {stixbfbbit}{p}{"E222} +\usv_set:nnn {stixbfbbit}{q}{"E223} +\usv_set:nnn {stixbfbbit}{r}{"E224} +\usv_set:nnn {stixbfbbit}{s}{"E225} +\usv_set:nnn {stixbfbbit}{t}{"E226} +\usv_set:nnn {stixbfbbit}{u}{"E227} +\usv_set:nnn {stixbfbbit}{v}{"E228} +\usv_set:nnn {stixbfbbit}{w}{"E229} +\usv_set:nnn {stixbfbbit}{x}{"E22A} +\usv_set:nnn {stixbfbbit}{y}{"E22B} +\usv_set:nnn {stixbfbbit}{z}{"E22C} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixbfcal}{Latin}{"E247} +% \end{macrocode} +% +% \begin{macrocode} +\usv_set:nnn {stixbfitslash}{Latin}{"E295} +\usv_set:nnn {stixbfitslash}{latin}{"E2C9} +\usv_set:nnn {stixbfitslash}{greek}{"E32D} +\usv_set:nnn {stixsfitslash}{varepsilon}{"E37B} +\usv_set:nnn {stixsfitslash}{vartheta}{"E35F} +\usv_set:nnn {stixsfitslash}{varkappa}{"E375} +\usv_set:nnn {stixsfitslash}{varphi}{"E361} +\usv_set:nnn {stixsfitslash}{varrho}{"E377} +\usv_set:nnn {stixsfitslash}{varpi}{"E363} +\usv_set:nnn {stixsfitslash}{digamma}{"E36B} +% \end{macrocode} +% +% \begin{macrocode} +%</stix> +% \end{macrocode}
\ No newline at end of file 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 c255e1b3050..b656390278f 100644 --- a/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx @@ -1,16 +1,33 @@ % \iffalse +% !TEX TS-program = XeLaTeX % ^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % ^^A SELF-EXTRACTION BEGINS HERE % ^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %<*internal> \begingroup -\input docstrip.tex +\input l3docstrip.tex +\begingroup + \catcode`\_ = 12 % + \long\gdef\prepareActiveModule#1{% + \if\relax#1\relax + \let\replaceModuleInLine\empty + \else + \def\replaceModuleInLine{% + \replaceAllIn\inLine{@@@@}{!!!!!FOURAT!!!!!}% + \replaceAllIn\inLine{__@@}{__#1}% + \replaceAllIn\inLine{_@@}{__#1}% + \replaceAllIn\inLine{@@}{__#1}% + \replaceAllIn\inLine{!!!!!FOURAT!!!!!}{@@}% i.e., use @@@@ when you need literal @@ in code + }% + \fi + } +\endgroup \keepsilent \let\MetaPrefix\DoubleperCent \declarepreamble\texpreamble -Copyright 2006-2013 Will Robertson <will.robertson@latex-project.org> +Copyright 2006-2015 Will Robertson <will.robertson@latex-project.org> Copyright 2010-2013 Philipp Stephani <st_philipp@yahoo.de> -Copyright 2012-2013 Khaled Hosny <khaledhosny@eglug.org> +Copyright 2012-2015 Khaled Hosny <khaledhosny@eglug.org> This package is free software and may be redistributed and/or modified under the conditions of the LaTeX Project Public License, version 1.3c or higher @@ -24,14 +41,18 @@ This work is "maintained" by Will Robertson. \usepreamble\texpreamble \generate{\file{unicode-math.sty}{ \from{unicode-math.dtx}{preamble} - \from{unicode-math.dtx}{msg} + \from{unicode-math-msg.dtx}{msg} + \from{unicode-math-usv.dtx}{usv} \from{unicode-math.dtx}{load} + \from{unicode-math-alphabets.dtx}{alphabets} }} \generate{\file{unicode-math-xetex.sty}{ \from{unicode-math.dtx}{package,XE} + \from{unicode-math-compat.dtx}{compat,XE} }} \generate{\file{unicode-math-luatex.sty}{ \from{unicode-math.dtx}{package,LU} + \from{unicode-math-compat.dtx}{compat,LU} }} \def\tempa{plain} \ifx\tempa\fmtname\endgroup\expandafter\bye\fi @@ -43,983 +64,29 @@ This work is "maintained" by Will Robertson. %<preamble&XE>\ProvidesPackage{unicode-math-xetex} %<preamble&LU>\ProvidesPackage{unicode-math-luatex} %<*preamble> - [2014/06/30 v0.7f Unicode maths in XeLaTeX and LuaLaTeX] + [2014/07/30 v0.8 Unicode maths in XeLaTeX and LuaLaTeX] %</preamble> %<*internal> -\documentclass[a4paper]{ltxdoc} -\usepackage{dtx-style} -\begin{document} - \DocInput{\jobname.dtx} +\def\DOCUMENTEND{F} +\input{unicode-math-doc} +\DocInput{unicode-math.dtx} +\DocInput{unicode-math-msg.dtx} +\DocInput{unicode-math-usv.dtx} +\DocInput{unicode-math-alphabets.dtx} +\DocInput{unicode-math-compat.dtx} \end{document} %</internal> % \fi % -% ^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% ^^A DOCUMENTATION BEGINS HERE -% ^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% \title{Experimental Unicode mathematical typesetting: The \pkg{unicode-math} package} -% \author{Will Robertson, Philipp Stephani and Khaled Hosny\\ -% \texttt{will.robertson@latex-project.org}} -% \date{\umfiledate \qquad \umfileversion} -% -% \maketitle -% -% \begin{abstract} -% \noindent -% This document describes the \pkg{unicode-math} package, which is -% intended as an implementation of Unicode -% maths for \LaTeX\ using the \XeTeX\ and Lua\TeX\ typesetting engines. -% With this package, changing maths fonts is as easy as changing -% text fonts --- and there are more and more maths fonts appearing now. -% Maths input can also be simplified with Unicode since literal glyphs may be -% entered instead of control sequences in your document source. -% -% The package provides support for both \XeTeX\ and Lua\TeX. The different -% engines provide differing levels of support for Unicode maths. -% Please let us know of any troubles. -% -% Alongside this documentation file, you should be able to find a minimal -% example demonstrating the use of the package, -% `\texttt{unimath-example.ltx}'. It also comes with a separate document, -% `\texttt{unimath-symbols.pdf}', -% containing a complete listing of mathematical symbols defined by -% \pkg{unicode-math}, including comparisons between different fonts. -% -% Finally, while the STIX fonts may be used with this package, accessing -% their alphabets in their `private user area' is not yet supported. -% (Of these additional alphabets there is a separate caligraphic design -% distinct to the script design already included.) -% Better support for the STIX fonts is planned for an upcoming revision of the -% package after any problems have been ironed out with the initial version. -% -% \end{abstract} -% -% \doparttoc\faketableofcontents -% -% \newpage -% \part{User documentation} -% \parttoc -% \section{Introduction} -% -% This document describes the \pkg{unicode-math} package, which is an -% \emph{experimental} implementation of a macro to Unicode glyph encoding for -% mathematical characters. -% -% 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.) -% -% \section{Acknowledgements} -% -% Many thanks to: -% Microsoft for developing the mathematics extension to OpenType as part of -% Microsoft Office~2007; -% Jonathan Kew for implementing Unicode math support in \XeTeX; -% Taco Hoekwater for implementing Unicode math support in \LuaTeX; -% Barbara Beeton for her prodigious effort compiling the definitive list of Unicode math -% glyphs and their \LaTeX\ names (inventing them where necessary), and also -% for her thoughtful replies to my sometimes incessant questions; -% Philipp Stephani for extending the package to support \LuaTeX. -% Ross Moore and Chris Rowley have provided moral and technical support -% from the very early days with great insight into the issues we face trying -% to extend and use \TeX\ in the future. -% Apostolos Syropoulos, Joel Salomon, Khaled Hosny, and Mariusz Wodzicki -% have been fantastic beta testers. -% -% \section{Getting started} -% -% 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: -% \begin{Verbatim} -% \usepackage{amsmath} % if desired -% \usepackage{unicode-math} -% \setmathfont{Asana-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. -% If you do not load an OpenType maths font before |\begin{document}|, Latin Modern Math (see above) will be loaded automatically. -% -% -% \subsection{Package options} -% Package options may be set when the package as loaded or at any later -% stage with the \cs{unimathsetup} command. Therefore, the following two -% examples are equivalent: -% \begin{Verbatim} -% \usepackage[math-style=TeX]{unicode-math} -% % OR -% \usepackage{unicode-math} -% \unimathsetup{math-style=TeX} -% \end{Verbatim} -% Note, however, that some package options affects how maths is initialised -% and changing an option such as |math-style| will not take effect until a -% new maths font is set up. -% -% Package options may \emph{also} be used when declaring new maths fonts, -% passed via options to the \cs{setmathfont} command. -% Therefore, the following two examples are equivalent: -% \begin{Verbatim} -% \unimathsetup{math-style=TeX} -% \setmathfont{Cambria Math} -% % OR -% \setmathfont[math-style=TeX]{Cambria Math} -% \end{Verbatim} -% -% A short list of package options is shown in \tabref{pkgopt}. -% See following sections for more information. -% -% \begin{table}\centering -% \topcaption{Package options.} -% \tablabel{pkgopt} -% \begin{tabular}{lll} -% \toprule -% Option & Description & See\dots \\ -% \midrule -% |math-style| & Style of letters & \secref{math-style} \\ -% |bold-style| & Style of bold letters & \secref{bold-style} \\ -% |sans-style| & Style of sans serif letters & \secref{sans-style} \\ -% |nabla| & Style of the nabla symbol & \secref{nabla} \\ -% |partial| & Style of the partial symbol & \secref{partial} \\ -% |vargreek-shape| & Style of phi and epsilon & \secref{vargreek-shape} \\ -% |colon| & Behaviour of \cs{colon} & \secref{colon} \\ -% |slash-delimiter| & Glyph to use for `stretchy' slash & \secref{slash-delimiter} \\ -% \bottomrule -% \end{tabular} -% \end{table} -% -% \subsection{Known issues} -% -% In some cases, \XeTeX's math support is either missing or I have not -% discovered how to access features for various types of maths construct. -% An example of this are horizontal extensible symbols, such as arrows that can -% grow longer if necessary. Behaviour with such symbols is not necessarily -% going to be consistent; please report problem areas to me. -% -% Symbols for maths characters have been inherited from the STIX project and -% may change slightly in the long term. We have tried to preserve backwards -% compatibility with \LaTeX\ conventions as best as possible; again, please -% report areas of concern. -% -% \section{Unicode maths font setup} -% -% In the ideal case, a single Unicode font will contain all maths glyphs we -% need. The file |unicode-math-table.tex| (based on Barbara Beeton's \STIX\ table) -% provides the mapping between Unicode -% maths glyphs and macro names (all 3298 — or however many — of them!). A -% single command -% \codeline{\cmd\setmathfont\oarg{font features}\marg{font name}} -% implements this for every every symbol and alphabetic variant. -% That means |x| to $x$, |\xi| to $\xi$, |\leq| to $\leq$, etc., |\mathscr{H}| -% to $\mathscr{H}$ and so on, all for Unicode glyphs within a single font. -% -% This package deals well with Unicode characters for maths -% input. This includes using literal Greek letters in formulae, -% resolving to upright or italic depending on preference. -% -% Font features specific to \pkg{unicode-math} are shown in \tabref{mathfontfeatures}. -% Package options (see \tabref{pkgopt}) may also be used. -% Other \pkg{fontspec} features are also valid. -% -% \begin{table}\centering -% \topcaption{Maths font options.} -% \tablabel{mathfontfeatures} -% \begin{tabular}{lll} -% \toprule -% Option & Description & See\dots \\ -% \midrule -% |range| & Style of letters & \secref{range} \\ -% |script-font| & Font to use for sub- and super-scripts & \secref{sscript} \\ -% |script-features| & Font features for sub- and super-scripts & \secref{sscript} \\ -% |sscript-font| & Font to use for nested sub- and super-scripts & \secref{sscript} \\ -% |sscript-features| & Font features for nested sub- and super-scripts & \secref{sscript} \\ -% \bottomrule -% \end{tabular} -% \end{table} -% -% \subsection{Using multiple fonts} -% \seclabel{range} -% -% There will probably be few cases where a single Unicode maths font suffices -% (simply due to glyph coverage). The \STIX\ font comes to mind as a -% possible exception. It will therefore be necessary to delegate specific -% Unicode ranges of glyphs to separate fonts: -% \codeline{\cmd\setmathfont|[range=|\meta{unicode range}|,|\meta{font features}|]|\marg{font name}} -% where \meta{unicode range} is a comma-separated list of Unicode slots and -% ranges such as |{"27D0-"27EB,"27FF,"295B-"297F}|. You may also use the macro -% for accessing the glyph, such as \cs{int}, or whole collection of symbols with -% the same math type, such as \cs{mathopen}, or complete math styles such as \cs{mathbb}. -% (Only numerical slots, however, can be used in ranged declarations.) -% -% \subsubsection{Control over maths alphabets} -% -% Exact control over maths alphabets can be somewhat involved. -% Here is the current plan. -% \begin{itemize} -% \item |[range=\mathbb]| to use the font for `bb' letters only. -% \item |[range=\mathbfsfit/{greek,Greek}]| for Greek lowercase and uppercase only (also with |latin|, |Latin|, |num| as possible options for Latin lower-/upper-case and numbers, resp.). -% \item |[range=\mathsfit->\mathbfsfit]| to map to different output alphabet(s) (which is rather useless right now but will become less useless in the future). -% \end{itemize} -% -% And now the trick. -% If a particular math alphabet is not defined in the font, fall back onto the lower-base plane (i.e., upright) glyphs. -% Therefore, to use an \ascii-encoded fractur font, for example, write -% \par{\centering|\setmathfont[range=\mathfrak]{SomeFracturFont}|\par}\noindent -% and because the math plane fractur glyphs will be missing, \pkg{unicode-math} will know to use the \ascii\ ones instead. -% If necessary this behaviour can be forced with |[range=\mathfrac->\mathup]|. -% -% -% \subsection{Script and scriptscript fonts/features} -% \seclabel{sscript} -% -% Cambria Math uses OpenType font features to activate smaller optical sizes -% for scriptsize and scriptscriptsize symbols (the $B$ and $C$, respectively, -% in $A_{B_C}$). Other fonts will possibly use entirely separate fonts. -% -% The features |script-font| and |sscript-font| allow alternate fonts to be -% selected for the script and scriptscript sizes, and |script-features| and -% |sscript-features| to apply different OpenType features to them. -% -% By default |script-features| is defined as |Style=MathScript| and |sscript-features| is |Style=MathScriptScript|. -% These correspond to the two levels of OpenType's |ssty| feature tag. -% If the |(s)script-features| options are specified manually, you must -% additionally specify the |Style| options as above. -% -% -% \subsection{Maths `versions'} -% -% \LaTeX\ uses a concept known as `maths versions' to switch math fonts -% mid-document. -% This is useful because it is more efficient than loading a complete maths -% font from scratch every time---especially with thousands of glyphs in the case of Unicode maths! -% The canonical example for maths versions is to select a `bold' maths font -% which might be suitable for section headings, say. -% (Not everyone agrees with this typesetting choice, though; be careful.) -% -% To select a new maths font in a particular version, use the syntax -% \codeline{\cmd\setmathfont|[version=|\meta{version name}|,|\meta{font features}|]|\marg{font name}} -% and to switch between maths versions mid-document use the standard \LaTeX\ command -% \cmd\mathversion\marg{version name}. -% -% \section{Maths input} -% -% \XeTeX's Unicode support allows maths input through two methods. Like -% classical \TeX, macros such as \cmd\alpha, \cmd\sum, \cmd\pm, \cmd\leq, and -% so on, provide verbose access to the entire repertoire of characters defined -% by Unicode. The literal characters themselves may be used instead, for more -% readable input files. -% -% \subsection{Math `style'} -% \seclabel{math-style} -% -% Classically, \TeX\ uses italic lowercase Greek letters and \emph{upright} -% uppercase Greek letters for variables in mathematics. This is contrary to -% the \textsc{iso} standards of using italic forms for both upper- and lowercase. -% Furthermore, the French have been -% known to use upright uppercase \emph{Latin} letters as well as upright -% upper- and lowercase Greek. Finally, it is not unknown to use upright letters -% for all characters, as seen in the Euler fonts. -% -% The \pkg{unicode-math} package accommodates these possibilities with an -% interface heavily inspired by Walter Schmidt's \pkg{lucimatx} package: a -% package option \opt{math-style} that takes one of four arguments: -% \opt{TeX}, \opt{ISO}, \opt{french}, or \opt{upright} (case sensitive). -% -% The philosophy behind the interface to the mathematical alphabet symbols -% lies in \LaTeX's attempt of separating content and formatting. Because input -% source text may come from a variety of places, the upright and -% `mathematical' italic Latin and Greek alphabets are \emph{unified} from the -% point of view of having a specified meaning in the source text. That is, to -% get a mathematical ‘$x$’, either the ascii (`keyboard') letter |x| may -% be typed, or the actual Unicode character may be used. Similarly for Greek -% letters. The upright or italic forms are then chosen based on the -% |math-style| package option. -% -% If glyphs are desired that do not map as per the package option (for -% example, an upright `g' is desired but typing |$g$| yields `$g$'), -% \emph{markup} is required to specify this; to follow from the example: -% |\mathup{g}|. Maths alphabets commands such as \cmd\mathup\ are detailed -% later. -% -% \paragraph{Alternative interface} -% However, some users may not like this convention of normalising their input. -% For them, an upright |x| is an upright `x' and that's that. -% (This will be the case when obtaining source text from copy/pasting PDF or -% Microsoft Word documents, for example.) -% For these users, the |literal| option to |math-style| will effect this behaviour. -% -% The \opt{math-style} options' effects are shown in brief in \tabref{math-style}. -% -% \begin{table} -% \centering -% \topcaption{Effects of the \opt{math-style} package option.} -% \tablabel{math-style} -% \begin{tabular}{@{}>{\ttfamily}lcc@{}} -% \toprule -% & \multicolumn{2}{c}{Example} \\ -% \cmidrule(l){2-3} -% \rmfamily Package option & Latin & Greek \\ -% \midrule -% math-style=ISO & $(a,z,B,X)$ & $\mathit{(\alpha,\beta,\Gamma,\Xi)}$ \\ -% math-style=TeX & $(a,z,B,X)$ & $(\mathit\alpha,\mathit\beta,\mathup\Gamma,\mathup\Xi)$ \\ -% math-style=french & $(a,z,\mathup B,\mathup X)$ & $(\mathup\alpha,\mathup\beta,\mathup\Gamma,\mathup\Xi)$ \\ -% math-style=upright & $(\mathup a,\mathup z,\mathup B,\mathup X)$ & $(\mathup\alpha,\mathup\beta,\mathup\Gamma,\mathup\Xi)$ \\ -% \bottomrule -% \end{tabular} -% \end{table} -% -% -% \subsection{Bold style} -% \seclabel{bold-style} -% -% Similar as in the previous section, ISO standards differ somewhat to \TeX's -% conventions (and classical typesetting) for `boldness' in mathematics. In -% the past, it has been customary to use bold \emph{upright} letters to denote -% things like vectors and matrices. For example, \( \mathbfup{M} = -% (\mitM_x,\mitM_y,\mitM_z) \). Presumably, this was due to the relatively -% scarcity of bold italic fonts in the pre-digital typesetting era. It has -% been suggested that \emph{italic} bold symbols are used nowadays instead. -% -% Bold Greek letters have simply been bold variant glyphs of their regular -% weight, as in \( \mbfitxi = (\mitxi_\mitr,\mitxi_\mitphi,\mitxi_\mittheta) -% \). Confusingly, the syntax in \LaTeX\ has been different for these two -% examples: \cmd\mathbf\ in the former (`$\mathbfup{M}$'), and \cmd\bm\ (or -% \cmd\boldsymbol, deprecated) in the latter (`$\mbfitxi$'). -% -% In \pkg{unicode-math}, the \cmd\mathbf\ command works directly with both -% Greek and Latin maths alphabet characters and depending on package option -% either switches to upright for Latin letters (|bold-style=TeX|) as well or -% keeps them italic (|bold-style=ISO|). -% -% To match the package options for non-bold characters, with option -% |bold-style=upright| all bold characters are upright, and -% |bold-style=literal| does not change the upright/italic shape of the letter. -% -% Upright and italic bold mathematical letters input as direct Unicode -% characters are normalised with the same rules. For example, with -% |bold-style=TeX|, a literal bold italic latin character will be typeset -% upright. -% -% Note that \opt{bold-style} is independent of \opt{math-style}, although if -% the former is not specified then sensible defaults are chosen based on the -% latter. -% -% The \opt{bold-style} options' effects are shown in brief in -% \tabref{bold-style}. -% -% \begin{table} -% \centering -% \topcaption{Effects of the \opt{bold-style} package option.} -% \tablabel{bold-style} -% \begin{tabular}{@{}>{\ttfamily}lcc@{}} -% \toprule -% & \multicolumn{2}{c}{Example} \\ -% \cmidrule(l){2-3} -% \rmfamily Package option & Latin & Greek \\ -% \midrule -% bold-style=ISO & $(\mathbfit a, \mathbfit z, \mathbfit B, \mathbfit X)$ & $(\mathbfit\alpha, \mathbfit\beta, \mathbfit\Gamma, \mathbfit\Xi)$ \\ -% bold-style=TeX & $(\mathbfup a,\mathbfup z,\mathbfup B,\mathbfup X)$ & $(\mathbfit\alpha, \mathbfit\beta,\mathbfup \Gamma,\mathbfup \Xi)$ \\ -% bold-style=upright & $(\mathbfup a,\mathbfup z,\mathbfup B,\mathbfup X)$ & $(\mathbfup \alpha,\mathbfup \beta,\mathbfup \Gamma,\mathbfup \Xi)$ \\ -% \bottomrule -% \end{tabular} -% \end{table} -% -% -% \subsection{Sans serif style} -% \seclabel{sans-style} -% -% Unicode contains upright and italic, medium and bold mathematical alphabet characters. -% These may be explicitly selected with the \cs{mathsfup}, \cs{mathsfit}, \cs{mathbfsfup}, and \cs{mathbfsfit} -% commands discussed in \secref{all-math-alphabets}. -% -% How should the generic \cs{mathsf} behave? Unlike bold, sans serif is used much more sparingly -% in mathematics. I've seen recommendations to typeset tensors in sans serif italic -% or sans serif italic bold (e.g., examples in the \pkg{isomath} and \pkg{mattens} packages). -% But \LaTeX's \cs{mathsf} is \textsl{upright} sans serif. -% -% Therefore I reluctantly add the package options |[sans-style=upright]| and |[sans-style=italic]| to control the behaviour of \cs{mathsf}. -% The |upright| style sets up the command to use upright sans serif, including Greek; -% the |italic| style switches to using italic in both Latin and Greek alphabets. -% In other words, this option simply changes the meaning of \cs{mathsf} to either \cs{mathsfup} or \cs{mathsfit}, respectively. -% Please let me know if more granular control is necessary here. -% -% There is also a |[sans-style=literal]| setting, set automatically with |[math-style=literal]|, which retains the uprightness of the input characters used when selecting the sans serif output. -% -% \subsubsection{What about bold sans serif?} -% -% While you might want your bold upright and your sans serif italic, I don't believe you'd also want -% your bold sans serif upright (or all vice versa, if that's even conceivable). Therefore, bold sans -% serif follows from the setting for sans serif; it is completely independent of the setting for bold. -% -% In other words, \cs{mathbfsf} is either \cs{mathbfsfup} or \cs{mathbfsfit} based on |[sans-style=upright]| or |[sans-style=italic]|, respectively. And |[sans-style=literal]| causes \cs{mathbfsf} to retain the same italic or upright shape as the input, and turns it bold sans serif. -% -% Note well! There is no medium-weight sans serif Greek alphabet in Unicode; therefore, |\mathsf{\alpha}| does not make sense (simply produces `$\mathsf{\alpha}$') while |\mathbfsf{\alpha}| gives `$\mathsf{\alpha}$'. -% -% \subsection{All (the rest) of the mathematical alphabets} -% \seclabel{all-math-alphabets} -% -% Unicode contains separate codepoints for most if not all variations of alphabet -% shape one may wish to use in mathematical notation. The complete list is shown -% in \tabref{mathalphabets}. Some of these have been covered in the previous sections. -% -% The math font switching commands do not nest; therefore if you want -% sans serif bold, you must write |\mathbfsf{...}| rather than |\mathbf{\mathsf{...}}|. -% This may change in the future. -% -% \begin{table} -% \caption{Mathematical alphabets defined in Unicode. Black dots indicate an alphabet exists in the font specified; blue dots indicate shapes that should always be taken from the upright font even in the italic style. See main text for description of \cs{mathbbit}.} -% \tablabel{mathalphabets} -% \centering -% \def\Y{\textbullet} -% \def\M{\textcolor{blue}{\textbullet}} -% \begin{tabular}{@{} lll l ccc @{}} -% \toprule -% \multicolumn{3}{c}{Font} & & \multicolumn{3}{c}{Alphabet} \\ -% \cmidrule(r){1-3} -% \cmidrule(l){5-7} -% Style & Shape & Series & Switch & Latin & Greek & Numerals \\ -% \midrule -% Serif & Upright & Normal & \cs{mathup} & \Y & \Y & \Y \\ -% & & Bold & \cs{mathbfup} & \Y & \Y & \Y \\ -% & Italic & Normal & \cs{mathit} & \Y & \Y & \M \\ -% & & Bold & \cs{mathbfit} & \Y & \Y & \M \\ -% Sans serif & Upright & Normal & \cs{mathsfup} & \Y & & \Y \\ -% & Italic & Normal & \cs{mathsfit} & \Y & & \M \\ -% & Upright & Bold & \cs{mathbfsfup} & \Y & \Y & \Y \\ -% & Italic & Bold & \cs{mathbfsfit} & \Y & \Y & \M \\ -% Typewriter & Upright & Normal & \cs{mathtt} & \Y & & \Y \\ -% Double-struck & Upright & Normal & \cs{mathbb} & \Y & & \Y \\ -% & Italic & Normal & \cs{mathbbit} & \Y & & \\ -% Script & Upright & Normal & \cs{mathscr} & \Y & & \\ -% & & Bold & \cs{matbfscr} & \Y & & \\ -% Fraktur & Upright & Normal & \cs{mathfrak} & \Y & & \\ -% & & Bold & \cs{mathbffrac} & \Y & & \\ -% \bottomrule -% \end{tabular} -% \end{table} -% -% \subsubsection{Double-struck} -% -% The double-struck alphabet (also known as `blackboard bold') consists of -% upright Latin letters $\{\mathbb{a}$--$\mathbb{z}$,$\mathbb{A}$$\mathbb{Z}\}$, -% numerals $\mathbb{0}$--$\mathbb{9}$, summation symbol $\mathbb\sum$, and four -% Greek letters only: $\{\mathbb{\gamma\pi\Gamma\Pi}\}$. -% -% While |\mathbb{\sum}| does produce a double-struck summation symbol, -% its limits aren't properly aligned. Therefore, -% either the literal character or the control sequence \cs{Bbbsum} are -% recommended instead. -% -% There are also five Latin \emph{italic} double-struck letters: $\mathbbit{Ddeij}$. -% These can be accessed (if not with their literal characters or control sequences) -% with the \cs{mathbbit} alphabet switch, but note that only those five letters -% will give the expected output. -% -% \subsubsection{Caligraphic vs.\ Script variants} -% -% The Unicode maths encoding contains an alphabet style for `Script' letters, -% and while by default \cs{mathcal} and \cs{mathscr} -% are synonyms, there are some situations when a -% separate `Caligraphic' style is needed as well. -% -% If a font contains alternate glyphs for a separat caligraphic style, -% they can be selected explicitly as shown below. -% This feature is currently only supported by the XITS~Math font, where -% the caligraphic letters are accessed with the same glyph slots as the -% script letters but with the first stylistic set feature (|ss01|) applied. -% \begin{verbatim} -% \setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{xits-math.otf} -% \end{verbatim} -% An example is shown below. -% \begin{quote} -% \setmathfont[range=\mathscr]{xits-math.otf} -% \setmathfont[range=\mathcal,StylisticSet=1]{xits-math.otf} -% The Script style (\cs{mathscr}) in XITS Math is: $\mathscr{ABCXYZ}$\par -% The Caligraphic style (\cs{mathcal}) in XITS Math is: $\mathcal{ABCXYZ}$ -% \end{quote} -% -% -% \subsection{Miscellanea} -% -% \subsubsection{Nabla} -% \seclabel{nabla} -% -% The symbol $\nabla$ comes in the six forms shown in \tabref{nabla}. -% We want an individual option to specify whether we want upright or italic -% nabla by default (when either upright or italic nabla is used in the -% source). \TeX\ classically uses an upright nabla, and \textsc{iso} -% standards agree with this convention. -% The package options |nabla=upright| and -% |nabla=italic| switch between the two choices, and |nabla=literal| respects -% the shape of the input character. This is then inherited -% through \cmd\mathbf; \cmd\mathit\ and \cmd\mathup\ can be used to force one -% way or the other. -% -% |nabla=italic| is the default. |nabla=literal| is -% activated automatically after |math-style=literal|. -% -% \begin{table} -% \centering -% \topcaption{The various forms of nabla.} -% \tablabel{nabla} -% \let \tmpshow\empty -% \begin{tabular}{@{}llc@{}} -% \toprule -% \multicolumn{2}{@{}l}{Description} & Glyph -% \\ \cmidrule(r){1-2}\cmidrule(l){3-3} -% Upright & Serif & $\mathup\nabla$ \\ -% & Bold serif & $\mathbfup\nabla$ \\ -% & Bold sans & $\mathbfsfup\nabla$ \\ -% \cmidrule(lr){1-2}\cmidrule(lr){3-3} -% Italic & Serif & $\mathit\nabla$ \\ -% & Bold serif & $\mathbfit\nabla$ \\ -% & Bold sans & $\mathbfsfit\nabla$ \\ -% \bottomrule -% \end{tabular} -% \end{table} -% -% \subsubsection{Partial} -% \seclabel{partial} -% -% The same applies to the symbols \unichar{2202} partial differential and -% \unichar{1D715} math italic partial differential. -% -% At time of writing, both the Cambria Math and STIX fonts display these -% two glyphs in the same italic style, but this is hopefully a bug that will -% be corrected in the future~--- the `plain' partial differential should -% really have an upright shape. -% -% Use the |partial=upright| or |partial=italic| package options to specify -% which one you would like, or |partial=literal| to have the same character -% used in the output as was used for the input. -% The default is (always, unless someone requests and -% argues otherwise) |partial=italic|.\footnote{A good argument would revolve -% around some international standards body recommending upright over italic. -% I just don't have the time right now to look it up.} |partial=literal| -% is activated following |math-style=literal|. -% -% See \tabref{partial} for the variations on the partial differential symbol. -% -% \begin{table} -% \centering -% \topcaption{The various forms of the partial differential. Note that in -% the fonts used to display these glyphs, the first upright partial is -% incorrectly shown in an italic style.} -% \tablabel{partial} -% \begin{tabular}{@{}llc@{}} -% \toprule -% \multicolumn{2}{@{}l}{Description} & Glyph -% \\ \cmidrule(r){1-2}\cmidrule(l){3-3} -% Regular & Upright & $\mathup\partial$ \\ -% & Italic & $\mathit\partial$ \\ -% Bold & Upright & $\mathbfup\partial$ \\ -% & Italic & $\mathbfit\partial$ \\ -% Sans bold & Upright & $\mathbfsfup\partial$ \\ -% & Italic & $\mathbfsfit\partial$ \\ -% \bottomrule -% \end{tabular} -% \end{table} -% -% \subsubsection{Epsilon and phi: $\epsilon$ vs.\ $\varepsilon$ and $\phi$ vs.\ $\varphi$} -% \seclabel{vargreek-shape} -% -% \TeX\ defines \cs{epsilon} to look like $\epsilon$ and \cs{varepsilon} to -% look like $\varepsilon$. By constrast, the Unicode glyph directly after delta and before zeta -% is `epsilon' and looks like $\varepsilon$; there is a subsequent variant of -% epsilon that looks like $\epsilon$. This creates a problem. People who -% use Unicode input won't want their glyphs transforming; \TeX\ users will be -% confused that what they think as `normal epsilon' is actual the `variant -% epsilon'. And the same problem exists for `phi'. -% -% We have an option to control this behaviour. -% With |vargreek-shape=TeX|, -% \cs{phi} and \cs{epsilon} produce $\phi$ and $\epsilon$ and -% \cs{varphi} and \cs{varepsilon} produce $\varphi$ and $\varepsilon$. -% With |vargreek-shape=unicode|, these symbols are swapped. -% Note, however, that Unicode characters are not affected by this option. -% That is, no remapping occurs of the characters/glyphs, only the control sequences. -% -% The package default is to use |vargreek-shape=TeX|. -% -% \subsubsection{Primes} -% -% Primes ($x'$) may be input in several ways. You may use any combination -% the \ascii\ straight quote (\texttt{\char`\'}) or the Unicode prime \unichar{2032} -% ($'$); when multiple primes occur next to each other, they chain -% together to form double, triple, or quadruple primes if the font contains -% pre-drawn glyphs. The individual prime glyphs are accessed, as usual, -% with the \cs{prime} command, and the double-, triple-, and quadruple-prime -% glyphs are available with \cs{dprime}, \cs{trprime}, and \cs{qprime}, -% respectively. -% -% If the font does not contain the pre-drawn glyphs or more than four primes -% are used, the single prime glyph is used multiple times with a negative -% kern to get the spacing right. There is no user interface to adjust this -% negative kern yet (because I haven't decided what it should look like); -% if you need to, write something like this: -% \begin{Verbatim} -% \ExplSyntaxOn -% \muskip_gset:Nn \g_um_primekern_muskip { -\thinmuskip/2 } -% \ExplySyntaxOff -% \end{Verbatim} -% Backwards or reverse primes behave in exactly the same way; use the \ascii\ -% back tick (\texttt{\char`\`}) or the Unicode reverse prime \unichar{2035} -% ({\umfont\char"2035}). -% The command to access the backprime is \cs{backprime}, and -% multiple backwards primes can accessed with \cs{backdprime}, -% \cs{backtrprime}, and \cs{backqprime}. -% -% In all cases above, no error checking is performed if you attempt to -% access a multi-prime glyph in a font that doesn't contain one. For this -% reason, it may be safer to write \verb|x''''| instead of \verb|x\qprime| -% in general. -% -% If you ever need to enter the straight quote |'| or the backtick |`| in -% maths mode, these glyphs can be accessed with \cs{mathstraightquote} and -% \cs{mathbacktick}. -% -% \subsubsection{Unicode subscripts and superscripts} -% -% You may, if you wish, use Unicode subscripts and superscripts in your -% source document. For basic expressions, the use of these characters -% can make the input more readable. -% Adjacent sub- or super-scripts will be concatenated into a single -% expression. -% -% The range of subscripts and superscripts supported by this package -% are shown in \figref{superscripts,subscripts}. Please request more if -% you think it is appropriate. -% -% \begin{figure}\centering -% \fbox{\fontspec{Charis SIL}\Large -% A -% ^^^^2070 ^^^^00b9 ^^^^00b2 ^^^^00b3 ^^^^2074 ^^^^2075 ^^^^2076 ^^^^2077 -% ^^^^2078 ^^^^2079 ^^^^207a ^^^^207b ^^^^207c ^^^^207d ^^^^207e ^^^^2071 -% ^^^^207f -% Z} -% \caption{ -% The Unicode superscripts supported as input characters. -% These are the literal glyphs from Charis SIL, -% 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. -% } -% \figlabel{superscripts} -% \end{figure} -% -% \begin{figure}\centering -% \fbox{\fontspec{Charis SIL}\Large -% A -% ^^^^2080 ^^^^2081 ^^^^2082 ^^^^2083 ^^^^2084 ^^^^2085 ^^^^2086 ^^^^2087 -% ^^^^2088 ^^^^2089 ^^^^208a ^^^^208b ^^^^208c ^^^^208d ^^^^208e ^^^^2090 -% ^^^^2091 ^^^^1d62 ^^^^2092 ^^^^1d63 ^^^^1d64 ^^^^1d65 ^^^^2093 ^^^^1d66 -% ^^^^1d67 ^^^^1d68 ^^^^1d69 ^^^^1d6a -% Z} -% \caption{ -% The Unicode subscripts supported as input characters. -% See note from \figref{superscripts}. -% } -% \figlabel{subscripts} -% \end{figure} -% -% \subsubsection{Colon} -% \seclabel{colon} -% -% The colon is one of the few confusing characters of Unicode maths. -% In \TeX, \texttt{:} is defined as a colon with relation spacing: `$a:b$'. -% While \cs{colon} is defined as a colon with punctuation spacing: `$a\colon b$'. -% -% In Unicode, \unichar{003A} {colon} is defined as a punctuation symbol, -% while \unichar{2236} {ratio} is the colon-like symbol used in mathematics to denote -% ratios and other things. -% -% This breaks the usual straightforward mapping from control sequence to Unicode input character -% to (the same) Unicode glyph. -% -% To preserve input compatibility, we remap the \ascii\ input character `\texttt{:}' to \unichar{2236}. -% Typing a literal \unichar{2236} char will result in the same output. -% If \pkg{amsmath} is loaded, then the definition of \cs{colon} is inherited from there -% (it looks like a punctuation colon with additional space around it). -% Otherwise, \cs{colon} is made to output a colon with \cs{mathpunct} spacing. -% -% The package option |colon=literal| forces \ascii\ input `|:|' to be printed as \cs{mathcolon} instead. -% -% -% \subsubsection{Slashes and backslashes} -% \seclabel{slash-delimiter} -% -% There are several slash-like symbols defined in Unicode. The complete list is shown in \tabref{slashes}. -% -% \begin{table}\centering -% \caption{Slashes and backslashes.} -% \tablabel{slashes} -% \begin{tabular}{@{}cl@{}cl@{}} -% \toprule -% Slot & Name & Glyph & Command \\ -% \midrule -% \unichar{002F} & \textsc{solidus} & \umfont \char"002F & \cs{slash} \\ -% \unichar{2044} & \textsc{fraction slash} & \umfont \char"2044 & \cs{fracslash} \\ -% \unichar{2215} & \textsc{division slash} & \umfont \char"2215 & \cs{divslash} \\ -% \unichar{29F8} & \textsc{big solidus} & \umfont \char"29F8 & \cs{xsol} \\ -% \midrule -% \unichar{005C} & \textsc{reverse solidus} & \umfont \char"005C & \cs{backslash} \\ -% \unichar{2216} & \textsc{set minus} & \umfont \char"2216 & \cs{smallsetminus} \\ -% \unichar{29F5} & \textsc{reverse solidus operator}& \umfont \char"29F5 & \cs{setminus} \\ -% \unichar{29F9} & \textsc{big reverse solidus} & \umfont \char"29F9 & \cs{xbsol} \\ -% \bottomrule -% \end{tabular} -% \end{table} -% -% In regular \LaTeX\ we can write \cs{left}\cs{slash}\dots\cs{right}\cs{backslash} -% and so on and obtain extensible delimiter-like symbols. Not all of the Unicode slashes -% are suitable for this (and do not have the font support to do it). -% -% \paragraph{Slash} -% -% Of \unichar{2044} {fraction slash}, TR25 says that it is: -% \begin{quote} -% \dots used to build up simple fractions in running text\dots -% however parsers of mathematical texts should be prepared to handle fraction slash -% when it is received from other sources. -% \end{quote} -% -% \unichar{2215} {division slash} should be used when division is represented -% without a built-up fraction; $\pi\approx22/7$, for example. -% -% \unichar{29F8} {big solidus} is a `big operator' (like $\sum$). -% -% \paragraph{Backslash} -% -% The \unichar{005C} {reverse solidus} character \cs{backslash} is used for denoting -% double cosets: $A\backslash B$. (So I'm led to believe.) -% It may be used as a `stretchy' delimiter if supported by the font. -% -% MathML uses \unichar{2216} {set minus} like this: $A\smallsetminus B$.\footnote{\S4.4.5.11 \url{http://www.w3.org/TR/MathML3/}} -% The \LaTeX\ command name \cs{smallsetminus} is used for backwards compatibility. -% -% Presumably, \unichar{29F5} {reverse solidus operator} is intended to -% be used in a similar way, but it could also (perhaps?) be used to -% represent `inverse division': $\pi\approx7\mathbin{\backslash}22$.^^A -% \footnote{This is valid syntax in the Octave and Matlab programming languages, -% in which it means matrix inverse pre-multiplication. I.e., $A\mathbin{\backslash} B\equiv A^{-1}B$.} -% The \LaTeX\ name for this character is \cs{setminus}. -% -% Finally, \unichar{29F9} {big reverse solidus} is a `big operator' (like $\sum$). -% -% \paragraph{How to use all of these things} -% -% Unfortunately, font support for the above characters/glyphs is rather inconsistent. -% In Cambria Math, the only slash that grows (say when writing -% \[ -% \left.\left[\begin{array}{cc} a & b \\ c & d\end{array}\right]\middle\slash -% \left[\begin{array}{cc} 1 & 1 \\ 1 & 0\end{array}\right] \right.\quad ) -% \] -% is the \textsc{fraction slash}, which we just established above is -% sort of only supposed to be used in text. -% -% Of the above characters, the following are allowed to be used after -% \cs{left}, \cs{middle}, and \cs{right}: -% \begin{itemize} -% \item \cs{fracslash}; -% \item \cs{slash}; and, -% \item \cs{backslash} (the only reverse slash). -% \end{itemize} -% -% However, we assume that there is only \emph{one} stretchy slash -% in the font; this is assumed by default to be \unichar{002F} {solidus}. -% Writing \cs{left/} or \cs{left}\cs{slash} or \cs{left}{fracslash} -% will all result in the same stretchy delimiter being used. -% -% The delimiter used can be changed with the |slash-delimiter| package option. -% Allowed values are |ascii|, |frac|, and |div|, corresponding to the respective -% Unicode slots. -% -% For example: as mentioned above, Cambria Math's stretchy slash is -% \unichar{2044} {fraction slash}. When using Cambria Math, then -% \pkg{unicode-math} should be loaded with the |slash-delimiter=frac| option. -% (This should be a font option rather than a package option, but -% it will change soon.) -% -% -% \subsubsection{Growing and non-growing accents} -% \seclabel{growing-accents} -% -% There are a few accents for which \TeX\ has both non-growing and growing -% versions. Among these are \cs{hat} and \cs{tilde}; the corresponding growing -% versions are called \cs{widehat} and \cs{widetilde}, respectively. -% -% Older versions of \XeTeX\ and \LuaTeX\ did not support this distinction, -% however, and \emph{all} accents there were growing automatically. (I.e., -% \cs{hat} and \cs{widehat} are equivalent.) As of \LuaTeX\ v0.65 and \XeTeX\ -% v0.9998, these wide/non-wide commands will again behave in their expected -% manner. -% -% -% \subsubsection{Pre-drawn fraction characters} -% -% Pre-drawn fractions \unichar{00BC}--\unichar{00BE}, \unichar{2150}--\unichar{215E} -% are not suitable for use in mathematics output. However, they can be useful -% as input characters to abbreviate common fractions. -% \begin{center} -% \fontspec{DejaVuSerif.ttf} ^^A available in TeX Live 2012 if not earlier -% ¼ ½ ¾ ↉ ⅐ ⅑ ⅒ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞ -% \end{center} -% For example, instead of writing `|\tfrac12 x|', you may consider it more readable to have -% `|½x|' in the source instead. -% -% If the \cs{tfrac} command exists (i.e., if \pkg{amsmath} is loaded or -% you have specially defined \cs{tfrac} for this purpose), it will be used -% to typeset the fractions. If not, regular \cs{frac} will be used. The command -% to use (\cs{tfrac} or \cs{frac}) can be forced either way with the package -% option |active-frac=small| or |active-frac=normalsize|, respectively. -% -% \subsubsection{Circles} -% -% Unicode defines a large number of different types of circles for a variety -% of mathematical purposes. There are thirteen alone just considering the -% all white and all black ones, shown in \tabref{circles}. -% -% \LaTeX\ defines considerably fewer: \cs{circ} and cs{bigcirc} for white; -% \cs{bullet} for black. This package maps those commands to \cs{vysmwhtcircle}, -% \cs{mdlgwhtcircle}, and \cs{smblkcircle}, respectively. -% -% \begin{table}\centering -% \def\showchar#1#2#3{ \textsc{u}+{\small\ttfamily #1} & \texttt{\string#3} & \umfont \char"#1 \\} -% \begin{tabular}{@{}llc@{}} -% \toprule -% Slot & Command & Glyph \\ -% \midrule -% \showchar{00B7}{centerdot}{\cdotp} -% \showchar{22C5}{small middle dot}{\cdot} -% \showchar{2219}{bullet operator}{\vysmblkcircle} -% \showchar{2022}{round bullet, filled}{\smblkcircle} -% \showchar{2981}{z notation spot}{\mdsmblkcircle} -% \showchar{26AB}{medium black circle}{\mdblkcircle} -% \showchar{25CF}{circle, filled}{\mdlgblkcircle} -% \showchar{2B24}{black large circle}{\lgblkcircle} -% \bottomrule -% \end{tabular} -% \def\showchar#1#2#3{ \umfont \char"#1 & \texttt{\string#3} & \textsc{u}+{\small\ttfamily #1} \\} -% \begin{tabular}{@{}cll@{}} -% \toprule -% Glyph & Command & Slot \\ -% \midrule -% \\ -% \\ -% \showchar{2218}{composite function (small circle)}{\vysmwhtcircle} -% \showchar{25E6}{white bullet}{\smwhtcircle} -% \showchar{26AC}{medium small white circle}{\mdsmwhtcircle} -% \showchar{26AA}{medium white circle}{\mdwhtcircle} -% \showchar{25CB}{large circle}{\mdlgwhtcircle} -% \showchar{25EF}{large circle}{\lgwhtcircle} -% \bottomrule -% \end{tabular} -% \caption{Filled and hollow Unicode circles.} -% \tablabel{circles} -% \end{table} -% -% \subsubsection{Triangles} -% -% While there aren't as many different sizes of triangle as there are circle, -% there's some important distinctions to make between a few similar characters. See \tabref{uptriangles} for the full summary. -% -% These triangles all have different intended meanings. Note for backwards -% compatibility with \TeX, \unichar{25B3} has \emph{two} different mappings -% in \pkg{unicode-math}. \cs{bigtriangleup} is intended as a binary operator -% whereas \cs{triangle} is intended to be used as a letter-like symbol. -% -% But you're better off if you're using the latter form to indicate an -% increment to use the glyph intended for this purpose, \unichar{2206}: $\increment x$. -% -% Finally, given that $\triangle$ and $\increment$ are provided for you -% already, it is better off to only use upright Greek Delta $\Delta$ if you're -% actually using it as a symbolic entity such as a variable on its own. -% -% \begin{table}\centering -% \begin{tabular}{@{}llcl@{}} -% \toprule -% Slot & Command & Glyph & Class \\ -% \midrule -% \unichar{25B5} & \cs{vartriangle} & \umfont \char"25B5 & binary \\ -% \unichar{25B3} & \cs{bigtriangleup} & \umfont \char"25B3 & binary \\ -% \unichar{25B3} & \cs{triangle} & \umfont \char"25B3 & ordinary \\ -% \unichar{2206} & \cs{increment} & \umfont \char"2206 & ordinary \\ -% \unichar{0394} & \cs{mathup}\cs{Delta} & \umfont \char"0394 & ordinary \\ -% \bottomrule -% \end{tabular} -% \caption{Different upwards pointing triangles.} -% \tablabel{uptriangles} -% \end{table} -% -% \iffalse -% \subsubsection{Normalising some input characters} -% -% I believe -% all variant forms should be used as legal input that is normalised to -% a consistent output glyph, because we want to be fault-tolerant in the input. -% Here are the duplicates: -% \begin{quote}\obeylines -% \unichar {251} {latin small letter alpha} -% \unichar {25B} {latin small letter epsilon} -% \unichar {263} {latin small letter gamma} -% \unichar {269} {latin small letter iota} -% \unichar {278} {latin small letter phi} -% \unichar {28A} {latin small letter upsilon} -% \unichar {190} {latin capital letter epsilon} -% \unichar {194} {latin capital letter gamma} -% \unichar {196} {latin capital letter iota} -% \unichar {1B1} {latin capital letter upsilon} -% \end{quote} -% -% (Not yet implemented.) -% \fi -% -% \section{Advanced} -% -% \subsection{Warning messages} -% -% This package can produce a number of informational messages to try and inform the user when something might be going wrong due to package conflicts or something else. -% As an experimental feature, these can be turn off on an individual basis with the package option |warnings-off| which takes a comma-separated list of warnings to suppress. -% A warning will give you its name when printed on the console output; e.g., -% \begin{Verbatim} -% * unicode-math warning: "mathtools-colon" -% * -% * ... <warning message> ... -% \end{Verbatim} -% This warning could be suppressed by loading the package as follows: -% \begin{Verbatim} -% \usepackage[warnings-off={mathtools-colon}]{unicode-math} -% \end{Verbatim} -% -% \subsection{Programmer's interface} -% -% (Tentative and under construction.) -% If you are writing some code that needs to know the current -% maths style (\cs{mathbf}, \cs{mathit}, etc.), you can query the -% variable \cs{l_um_mathstyle_tl}. It will contain the maths style -% without the leading `math' string; for example, -% |\mathbf { \show \l_um_mathstyle_tl }| -% will produce `bf'. -% -% \StopEventually{} -% % \clearpage % \part{Package implementation} % \parttoc % +% The prefix for \pkg{unicode-math} is \texttt{um}: +% \begin{macrocode} +%<@@=um> +% \end{macrocode} +% % \section{Header code} % % We (later on) bifurcate the package based on the engine being used. @@ -1027,8 +94,8 @@ This work is "maintained" by Will Robertson. % Shared code executed before loading the engine-specific code is indicated with the flag \textsf{preamble}. % \begin{macrocode} %<*load> -\luatex_if_engine:T { \RequirePackage{unicode-math-luatex} \endinput } -\xetex_if_engine:T { \RequirePackage{unicode-math-xetex} \endinput } +\luatex_if_engine:T { \RequirePackage{unicode-math-luatex} } +\xetex_if_engine:T { \RequirePackage{unicode-math-xetex} } %</load> % \end{macrocode} % The shared part of the code starts here before the split above. @@ -1063,58 +130,19 @@ This work is "maintained" by Will Robertson. % % \paragraph{Packages} % \begin{macrocode} -\RequirePackage{expl3}[2011/07/01] -\RequirePackage{xparse}[2009/08/31] +\RequirePackage{expl3}[2015/03/01] +\RequirePackage{xparse} \RequirePackage{l3keys2e} -\RequirePackage{fontspec}[2010/10/25] +\RequirePackage{fontspec}[2015/03/14] \RequirePackage{catchfile} \RequirePackage{fix-cm} % avoid some warnings -\RequirePackage{filehook}[2011/01/03] -% \end{macrocode} -% Need this part from \pkg{fixltx2e}: -% \begin{macrocode} -\def\@DeclareMathSizes #1#2#3#4#5{% - \@defaultunits\dimen@ #2pt\relax\@nnil - \if $#3$% - \expandafter\let\csname S@\strip@pt\dimen@\endcsname\math@fontsfalse - \else - \@defaultunits\dimen@ii #3pt\relax\@nnil - \@defaultunits\@tempdima #4pt\relax\@nnil - \@defaultunits\@tempdimb #5pt\relax\@nnil - \toks@{#1}% - \expandafter\xdef\csname S@\strip@pt\dimen@\endcsname{% - \gdef\noexpand\tf@size{\strip@pt\dimen@ii}% - \gdef\noexpand\sf@size{\strip@pt\@tempdima}% - \gdef\noexpand\ssf@size{\strip@pt\@tempdimb}% - \the\toks@ - }% - \fi -} +\RequirePackage{filehook} % \end{macrocode} % -% Start using \LaTeX3 --- finally! % \begin{macrocode} \ExplSyntaxOn % \end{macrocode} % -% \paragraph{Extra \pkg{expl3} variants} -% \begin{macrocode} -\cs_generate_variant:Nn \tl_put_right:Nn {cx} -\cs_generate_variant:Nn \seq_if_in:NnTF {NV} -\cs_generate_variant:Nn \prop_gput:Nnn {Nxn} -\cs_generate_variant:Nn \prop_get:NnN {cxN} -\cs_generate_variant:Nn \prop_if_in:NnTF {cx} -% \end{macrocode} -% -% An extra expansion command: -% \begin{macrocode} -\cs_set:Npn \exp_args:NNcc #1#2#3#4 { - \exp_after:wN #1 \exp_after:wN #2 - \cs:w #3 \exp_after:wN \cs_end: - \cs:w #4 \cs_end: -} -% \end{macrocode} -% % For \pkg{fontspec}: % \begin{macrocode} \cs_generate_variant:Nn \fontspec_set_family:Nnn {Nx} @@ -1124,121 +152,184 @@ This work is "maintained" by Will Robertson. % \paragraph{Conditionals} % % \begin{macrocode} -\bool_new:N \l_um_ot_math_bool -\bool_new:N \l_um_init_bool -\bool_new:N \l_um_implicit_alph_bool -\bool_new:N \g_um_mainfont_already_set_bool +\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_um_literal_bool -\bool_new:N \g_um_upLatin_bool -\bool_new:N \g_um_uplatin_bool -\bool_new:N \g_um_upGreek_bool -\bool_new:N \g_um_upgreek_bool +\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_um_bfliteral_bool -\bool_new:N \g_um_bfupLatin_bool -\bool_new:N \g_um_bfuplatin_bool -\bool_new:N \g_um_bfupGreek_bool -\bool_new:N \g_um_bfupgreek_bool +\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_um_upsans_bool -\bool_new:N \g_um_sfliteral_bool +\bool_new:N \g_@@_upsans_bool +\bool_new:N \g_@@_sfliteral_bool % \end{macrocode} % For assorted package options: % \begin{macrocode} -\bool_new:N \g_um_upNabla_bool -\bool_new:N \g_um_uppartial_bool -\bool_new:N \g_um_literal_Nabla_bool -\bool_new:N \g_um_literal_partial_bool -\bool_new:N \g_um_texgreek_bool -\bool_set_true:N \g_um_texgreek_bool -\bool_new:N \l_um_smallfrac_bool -\bool_new:N \g_um_literal_colon_bool +\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 \g_@@_texgreek_bool +\bool_set_true:N \g_@@_texgreek_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_um_fam_int +\int_new:N \g_@@_fam_int % \end{macrocode} % % For displaying in warning messages, etc.: % \begin{macrocode} -\tl_const:Nn \c_um_math_alphabet_name_latin_tl {Latin,~lowercase} -\tl_const:Nn \c_um_math_alphabet_name_Latin_tl {Latin,~uppercase} -\tl_const:Nn \c_um_math_alphabet_name_greek_tl {Greek,~lowercase} -\tl_const:Nn \c_um_math_alphabet_name_Greek_tl {Greek,~uppercase} -\tl_const:Nn \c_um_math_alphabet_name_num_tl {Numerals} -\tl_const:Nn \c_um_math_alphabet_name_misc_tl {Misc.} +\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@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}{\um_glyph_if_exist:nTF} -%: TODO: Generalise for arbitrary fonts! \cs{l_um_font} is not always the one used for a specific glyph!! +% \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 \um_glyph_if_exist:n {p,TF,T,F} +\prg_new_conditional:Nnn \@@_glyph_if_exist:n {p,TF,T,F} { - \etex_iffontchar:D \l_um_font #1 \scan_stop: + \etex_iffontchar:D \l_@@_font #1 \scan_stop: \prg_return_true: \else: \prg_return_false: \fi: } -\cs_generate_variant:Nn \um_glyph_if_exist_p:n {c} -\cs_generate_variant:Nn \um_glyph_if_exist:nTF {c} -\cs_generate_variant:Nn \um_glyph_if_exist:nT {c} -\cs_generate_variant:Nn \um_glyph_if_exist:nF {c} % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_set_mathcode:nnnn} -% \begin{macro}{\um_set_mathcode:nnn} -% \begin{macro}{\um_set_mathchar:NNnn} -% \begin{macro}{\um_set_mathchar:cNnn} -% \begin{macro}{\um_set_delcode:nnn} -% \begin{macro}{\um_radical:nn} -% \begin{macro}{\um_delimiter:Nnn} -% \begin{macro}{\um_accent:nnn} -% \begin{macro}{\um_accent_keyword:} +% \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 \um_set_mathcode:nnnn #1#2#3#4 { +\cs_set:Npn \@@_set_mathcode:nnnn #1#2#3#4 { \Umathcode \int_eval:n {#1} = \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop: } -\cs_set:Npn \um_set_mathcode:nnn #1#2#3 { +\cs_set:Npn \@@_set_mathcode:nnn #1#2#3 { \Umathcode \int_eval:n {#1} = \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#1} \scan_stop: } -\cs_set:Npn \um_set_mathchar:NNnn #1#2#3#4 { +\cs_set:Npn \@@_set_mathchar:NNnn #1#2#3#4 { \Umathchardef #1 = \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop: } -\cs_new:Nn \um_set_delcode:nnn { +\cs_new:Nn \@@_set_delcode:nnn { \Udelcode#2 = \csname sym#1\endcsname #3 \scan_stop: } -\cs_new:Nn \um_radical:nn { +\cs_new:Nn \@@_radical:nn { \Uradical \csname sym#1\endcsname #2 \scan_stop: } -\cs_new:Nn \um_delimiter:Nnn { +\cs_new:Nn \@@_delimiter:Nnn { \Udelimiter \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: } -\cs_new:Nn \um_accent:nnn { +\cs_new:Nn \@@_accent:nnn { \Umathaccent #1~ \mathchar@type\mathaccent \use:c { sym #2 } #3 \scan_stop: } % \end{macrocode} % % \begin{macrocode} -\cs_generate_variant:Nn \um_set_mathchar:NNnn {c} +\cs_generate_variant:Nn \@@_set_mathchar:NNnn {c} % \end{macrocode} % \end{macro} % \end{macro} @@ -1251,19 +342,40 @@ This work is "maintained" by Will Robertson. % \end{macro} % % -% \begin{macro}{\char_gmake_mathactive:N} -% \begin{macro}{\char_gmake_mathactive:n} +% \begin{macro}{\@@_char_gmake_mathactive:N} +% \begin{macro}{\@@_char_gmake_mathactive:n} % \begin{macrocode} -\cs_new:Nn \char_gmake_mathactive:N { +\cs_new:Nn \@@_char_gmake_mathactive:N + { \global\mathcode `#1 = "8000 \scan_stop: -} -\cs_new:Nn \char_gmake_mathactive:n { + } +\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} @@ -1271,203 +383,260 @@ This work is "maintained" by Will Robertson. % options declared when the package is loaded. % \begin{macrocode} \DeclareDocumentCommand \unimathsetup {m} - { - \keys_set:nn {unicode-math} {#1} - } + { \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 \um_tl_map_dbl:nN - { - \__um_tl_map_dbl:Nnn #2 #1 \q_recursion_tail {}{} \q_recursion_stop - } -\cs_new:Nn \__um_tl_map_dbl:Nnn - { - \quark_if_recursion_tail_stop:n {#2} - \quark_if_recursion_tail_stop:n {#3} - #1 {#2} {#3} - \__um_tl_map_dbl:Nnn #1 - } -\cs_new:Nn \um_keys_choices:nn +\cs_new:Nn \@@_keys_choices:nn { - \cs_set:Npn \um_keys_choices_fn:nn { \um_keys_choices_aux:nnn {#1} } + \cs_set:Npn \@@_keys_choices_fn:nn { \@@_keys_choices_aux:nnn {#1} } \use:x { \exp_not:N \keys_define:nn {unicode-math} { #1 .choice: , - \um_tl_map_dbl:nN {#2} \um_keys_choices_fn:nn + \@@_tl_map_dbl:nN {#2} \@@_keys_choices_fn:nn } } } -\cs_new:Nn \um_keys_choices_aux:nnn { #1 / #2 .code:n = { \exp_not:n {#3} } , } +\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} -\um_keys_choices:nn {normal-style} - { - {ISO} { - \bool_set_false:N \g_um_literal_bool - \bool_set_false:N \g_um_upGreek_bool - \bool_set_false:N \g_um_upgreek_bool - \bool_set_false:N \g_um_upLatin_bool - \bool_set_false:N \g_um_uplatin_bool } - {TeX} { - \bool_set_false:N \g_um_literal_bool - \bool_set_true:N \g_um_upGreek_bool - \bool_set_false:N \g_um_upgreek_bool - \bool_set_false:N \g_um_upLatin_bool - \bool_set_false:N \g_um_uplatin_bool } - {french} { - \bool_set_false:N \g_um_literal_bool - \bool_set_true:N \g_um_upGreek_bool - \bool_set_true:N \g_um_upgreek_bool - \bool_set_true:N \g_um_upLatin_bool - \bool_set_false:N \g_um_uplatin_bool } +\@@_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_um_literal_bool - \bool_set_true:N \g_um_upGreek_bool - \bool_set_true:N \g_um_upgreek_bool - \bool_set_true:N \g_um_upLatin_bool - \bool_set_true:N \g_um_uplatin_bool } + \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_um_literal_bool } + \bool_set_true:N \g_@@_literal_bool + } } % \end{macrocode} % % \begin{macrocode} -\um_keys_choices:nn {math-style} +\@@_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 } } + {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 } } + \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 } } + \unimathsetup { colon=literal, nabla=literal, partial=literal, + normal-style=literal, bold-style=literal, sans-style=literal } + } } % \end{macrocode} % % \paragraph{bold-style} % \begin{macrocode} -\um_keys_choices:nn {bold-style} - { - {ISO} { - \bool_set_false:N \g_um_bfliteral_bool - \bool_set_false:N \g_um_bfupGreek_bool - \bool_set_false:N \g_um_bfupgreek_bool - \bool_set_false:N \g_um_bfupLatin_bool - \bool_set_false:N \g_um_bfuplatin_bool } - {TeX} { - \bool_set_false:N \g_um_bfliteral_bool - \bool_set_true:N \g_um_bfupGreek_bool - \bool_set_false:N \g_um_bfupgreek_bool - \bool_set_true:N \g_um_bfupLatin_bool - \bool_set_true:N \g_um_bfuplatin_bool } +\@@_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_um_bfliteral_bool - \bool_set_true:N \g_um_bfupGreek_bool - \bool_set_true:N \g_um_bfupgreek_bool - \bool_set_true:N \g_um_bfupLatin_bool - \bool_set_true:N \g_um_bfuplatin_bool } + \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_um_bfliteral_bool } + \bool_set_true:N \g_@@_bfliteral_bool + } } % \end{macrocode} % % \paragraph{sans-style} % \begin{macrocode} -\um_keys_choices:nn {sans-style} +\@@_keys_choices:nn {sans-style} { - {italic} { \bool_set_false:N \g_um_upsans_bool } - {upright} { \bool_set_true:N \g_um_upsans_bool } - {literal} { \bool_set_true:N \g_um_sfliteral_bool } + {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} -\um_keys_choices:nn {nabla} +\@@_keys_choices:nn {nabla} { - {upright} { \bool_set_false:N \g_um_literal_Nabla_bool - \bool_set_true:N \g_um_upNabla_bool } - {italic} { \bool_set_false:N \g_um_literal_Nabla_bool - \bool_set_false:N \g_um_upNabla_bool } - {literal} { \bool_set_true:N \g_um_literal_Nabla_bool } + {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} -\um_keys_choices:nn {partial} +\@@_keys_choices:nn {partial} { - {upright} { \bool_set_false:N \g_um_literal_partial_bool - \bool_set_true:N \g_um_uppartial_bool } - {italic} { \bool_set_false:N \g_um_literal_partial_bool - \bool_set_false:N \g_um_uppartial_bool } - {literal} { \bool_set_true:N \g_um_literal_partial_bool } + {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{Epsilon and phi shapes} % \begin{macrocode} -\um_keys_choices:nn {vargreek-shape} +\@@_keys_choices:nn {vargreek-shape} { - {unicode} {\bool_set_false:N \g_um_texgreek_bool} - {TeX} {\bool_set_true:N \g_um_texgreek_bool} + {unicode} { \bool_set_false:N \g_@@_texgreek_bool } + {TeX} { \bool_set_true:N \g_@@_texgreek_bool } } % \end{macrocode} % % \paragraph{Colon style} % \begin{macrocode} -\um_keys_choices:nn {colon} +\@@_keys_choices:nn {colon} { - {literal} {\bool_set_true:N \g_um_literal_colon_bool} - {TeX} {\bool_set_false:N \g_um_literal_colon_bool} + {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} -\um_keys_choices:nn {slash-delimiter} +\@@_keys_choices:nn {slash-delimiter} { - {ascii} {\tl_set:Nn \g_um_slash_delimiter_usv {"002F}} - {frac} {\tl_set:Nn \g_um_slash_delimiter_usv {"2044}} - {div} {\tl_set:Nn \g_um_slash_delimiter_usv {"2215}} + {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} -\um_keys_choices:nn {active-frac} +\@@_keys_choices:nn {active-frac} { {small} { \cs_if_exist:NTF \tfrac + { \bool_set_true:N \l_@@_smallfrac_bool } { - \bool_set_true:N \l_um_smallfrac_bool - }{ - \um_warning:n {no-tfrac} - \bool_set_false:N \l_um_smallfrac_bool + \@@_warning:n {no-tfrac} + \bool_set_false:N \l_@@_smallfrac_bool } - \use:c {um_setup_active_frac:} + \use:c {@@_setup_active_frac:} } {normalsize} { - \bool_set_false:N \l_um_smallfrac_bool - \use:c {um_setup_active_frac:} + \bool_set_false:N \l_@@_smallfrac_bool + \use:c {@@_setup_active_frac:} } } % \end{macrocode} @@ -1487,7 +656,7 @@ This work is "maintained" by Will Robertson. % \end{macrocode} % % \begin{macrocode} -\um_keys_choices:nn {trace} +\@@_keys_choices:nn {trace} { {on} {} % default {debug} { \msg_redirect_module:nnn { unicode-math } { log } { warning } } @@ -1499,10 +668,22 @@ This work is "maintained" by Will Robertson. \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} @@ -1536,565 +717,6 @@ This work is "maintained" by Will Robertson. %</LU> % \end{macrocode} % -% \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 { \um_to_usv:nn {#1}{#2} } {#3} - } -\cs_new:Nn \um_to_usv:nn { g_um_#1_#2_usv } -% \end{macrocode} -% \paragraph{Alphabets} -% \begin{macrocode} -\usv_set:nnn {up} {num} {48} -\usv_set:nnn {up} {Latin}{65} -\usv_set:nnn {up} {latin}{97} -\usv_set:nnn {up} {Greek}{"391} -\usv_set:nnn {up} {greek}{"3B1} -\usv_set:nnn {it} {Latin}{"1D434} -\usv_set:nnn {it} {latin}{"1D44E} -\usv_set:nnn {it} {Greek}{"1D6E2} -\usv_set:nnn {it} {greek}{"1D6FC} -\usv_set:nnn {bb} {num} {"1D7D8} -\usv_set:nnn {bb} {Latin}{"1D538} -\usv_set:nnn {bb} {latin}{"1D552} -\usv_set:nnn {scr} {Latin}{"1D49C} -\usv_set:nnn {cal} {Latin}{"1D49C} -\usv_set:nnn {scr} {latin}{"1D4B6} -\usv_set:nnn {frak}{Latin}{"1D504} -\usv_set:nnn {frak}{latin}{"1D51E} -\usv_set:nnn {sf} {num} {"1D7E2} -\usv_set:nnn {sfup}{num} {"1D7E2} -\usv_set:nnn {sfit}{num} {"1D7E2} -\usv_set:nnn {sfup}{Latin}{"1D5A0} -\usv_set:nnn {sf} {Latin}{"1D5A0} -\usv_set:nnn {sfup}{latin}{"1D5BA} -\usv_set:nnn {sf} {latin}{"1D5BA} -\usv_set:nnn {sfit}{Latin}{"1D608} -\usv_set:nnn {sfit}{latin}{"1D622} -\usv_set:nnn {tt} {num} {"1D7F6} -\usv_set:nnn {tt} {Latin}{"1D670} -\usv_set:nnn {tt} {latin}{"1D68A} -% \end{macrocode} -% Bold: -% \begin{macrocode} -\usv_set:nnn {bf} {num} {"1D7CE} -\usv_set:nnn {bfup} {num} {"1D7CE} -\usv_set:nnn {bfit} {num} {"1D7CE} -\usv_set:nnn {bfup} {Latin}{"1D400} -\usv_set:nnn {bfup} {latin}{"1D41A} -\usv_set:nnn {bfup} {Greek}{"1D6A8} -\usv_set:nnn {bfup} {greek}{"1D6C2} -\usv_set:nnn {bfit} {Latin}{"1D468} -\usv_set:nnn {bfit} {latin}{"1D482} -\usv_set:nnn {bfit} {Greek}{"1D71C} -\usv_set:nnn {bfit} {greek}{"1D736} -\usv_set:nnn {bffrak}{Latin}{"1D56C} -\usv_set:nnn {bffrak}{latin}{"1D586} -\usv_set:nnn {bfscr} {Latin}{"1D4D0} -\usv_set:nnn {bfcal} {Latin}{"1D4D0} -\usv_set:nnn {bfscr} {latin}{"1D4EA} -\usv_set:nnn {bfsf} {num} {"1D7EC} -\usv_set:nnn {bfsfup}{num} {"1D7EC} -\usv_set:nnn {bfsfit}{num} {"1D7EC} -\usv_set:nnn {bfsfup}{Latin}{"1D5D4} -\usv_set:nnn {bfsfup}{latin}{"1D5EE} -\usv_set:nnn {bfsfup}{Greek}{"1D756} -\usv_set:nnn {bfsfup}{greek}{"1D770} -\usv_set:nnn {bfsfit}{Latin}{"1D63C} -\usv_set:nnn {bfsfit}{latin}{"1D656} -\usv_set:nnn {bfsfit}{Greek}{"1D790} -\usv_set:nnn {bfsfit}{greek}{"1D7AA} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {bfsf}{Latin}{ \bool_if:NTF \g_um_upLatin_bool \g_um_bfsfup_Latin_usv \g_um_bfsfit_Latin_usv } -\usv_set:nnn {bfsf}{latin}{ \bool_if:NTF \g_um_uplatin_bool \g_um_bfsfup_latin_usv \g_um_bfsfit_latin_usv } -\usv_set:nnn {bfsf}{Greek}{ \bool_if:NTF \g_um_upGreek_bool \g_um_bfsfup_Greek_usv \g_um_bfsfit_Greek_usv } -\usv_set:nnn {bfsf}{greek}{ \bool_if:NTF \g_um_upgreek_bool \g_um_bfsfup_greek_usv \g_um_bfsfit_greek_usv } -\usv_set:nnn {bf} {Latin}{ \bool_if:NTF \g_um_bfupLatin_bool \g_um_bfup_Latin_usv \g_um_bfit_Latin_usv } -\usv_set:nnn {bf} {latin}{ \bool_if:NTF \g_um_bfuplatin_bool \g_um_bfup_latin_usv \g_um_bfit_latin_usv } -\usv_set:nnn {bf} {Greek}{ \bool_if:NTF \g_um_bfupGreek_bool \g_um_bfup_Greek_usv \g_um_bfit_Greek_usv } -\usv_set:nnn {bf} {greek}{ \bool_if:NTF \g_um_bfupgreek_bool \g_um_bfup_greek_usv \g_um_bfit_greek_usv } -% \end{macrocode} -% Greek variants: -% \begin{macrocode} -\usv_set:nnn {up}{varTheta} {"3F4} -\usv_set:nnn {up}{Digamma} {"3DC} -\usv_set:nnn {up}{varepsilon}{"3F5} -\usv_set:nnn {up}{vartheta} {"3D1} -\usv_set:nnn {up}{varkappa} {"3F0} -\usv_set:nnn {up}{varphi} {"3D5} -\usv_set:nnn {up}{varrho} {"3F1} -\usv_set:nnn {up}{varpi} {"3D6} -\usv_set:nnn {up}{digamma} {"3DD} -% \end{macrocode} -% Bold: -% \begin{macrocode} -\usv_set:nnn {bfup}{varTheta} {"1D6B9} -\usv_set:nnn {bfup}{Digamma} {"1D7CA} -\usv_set:nnn {bfup}{varepsilon}{"1D6DC} -\usv_set:nnn {bfup}{vartheta} {"1D6DD} -\usv_set:nnn {bfup}{varkappa} {"1D6DE} -\usv_set:nnn {bfup}{varphi} {"1D6DF} -\usv_set:nnn {bfup}{varrho} {"1D6E0} -\usv_set:nnn {bfup}{varpi} {"1D6E1} -\usv_set:nnn {bfup}{digamma} {"1D7CB} -% \end{macrocode} -% Italic Greek variants: -% \begin{macrocode} -\usv_set:nnn {it}{varTheta} {"1D6F3} -\usv_set:nnn {it}{varepsilon}{"1D716} -\usv_set:nnn {it}{vartheta} {"1D717} -\usv_set:nnn {it}{varkappa} {"1D718} -\usv_set:nnn {it}{varphi} {"1D719} -\usv_set:nnn {it}{varrho} {"1D71A} -\usv_set:nnn {it}{varpi} {"1D71B} -% \end{macrocode} -% Bold italic: -% \begin{macrocode} -\usv_set:nnn {bfit}{varTheta} {"1D72D} -\usv_set:nnn {bfit}{varepsilon}{"1D750} -\usv_set:nnn {bfit}{vartheta} {"1D751} -\usv_set:nnn {bfit}{varkappa} {"1D752} -\usv_set:nnn {bfit}{varphi} {"1D753} -\usv_set:nnn {bfit}{varrho} {"1D754} -\usv_set:nnn {bfit}{varpi} {"1D755} -% \end{macrocode} -% Bold sans: -% \begin{macrocode} -\usv_set:nnn {bfsfup}{varTheta} {"1D767} -\usv_set:nnn {bfsfup}{varepsilon}{"1D78A} -\usv_set:nnn {bfsfup}{vartheta} {"1D78B} -\usv_set:nnn {bfsfup}{varkappa} {"1D78C} -\usv_set:nnn {bfsfup}{varphi} {"1D78D} -\usv_set:nnn {bfsfup}{varrho} {"1D78E} -\usv_set:nnn {bfsfup}{varpi} {"1D78F} -% \end{macrocode} -% Bold sans italic: -% \begin{macrocode} -\usv_set:nnn {bfsfit}{varTheta} {"1D7A1} -\usv_set:nnn {bfsfit}{varepsilon}{"1D7C4} -\usv_set:nnn {bfsfit}{vartheta} {"1D7C5} -\usv_set:nnn {bfsfit}{varkappa} {"1D7C6} -\usv_set:nnn {bfsfit}{varphi} {"1D7C7} -\usv_set:nnn {bfsfit}{varrho} {"1D7C8} -\usv_set:nnn {bfsfit}{varpi} {"1D7C9} -% \end{macrocode} -% Nabla: -% \begin{macrocode} -\usv_set:nnn {up} {Nabla}{"02207} -\usv_set:nnn {it} {Nabla}{"1D6FB} -\usv_set:nnn {bfup} {Nabla}{"1D6C1} -\usv_set:nnn {bfit} {Nabla}{"1D735} -\usv_set:nnn {bfsfup}{Nabla}{"1D76F} -\usv_set:nnn {bfsfit}{Nabla}{"1D7A9} -% \end{macrocode} -% Partial: -% \begin{macrocode} -\usv_set:nnn {up} {partial}{"02202} -\usv_set:nnn {it} {partial}{"1D715} -\usv_set:nnn {bfup} {partial}{"1D6DB} -\usv_set:nnn {bfit} {partial}{"1D74F} -\usv_set:nnn {bfsfup}{partial}{"1D789} -\usv_set:nnn {bfsfit}{partial}{"1D7C3} -% \end{macrocode} -% \paragraph{Exceptions} -% These are need for mapping with the exceptions in other alphabets: -% (coming up) -% \begin{macrocode} -\usv_set:nnn {up}{B}{`\B} -\usv_set:nnn {up}{C}{`\C} -\usv_set:nnn {up}{D}{`\D} -\usv_set:nnn {up}{E}{`\E} -\usv_set:nnn {up}{F}{`\F} -\usv_set:nnn {up}{H}{`\H} -\usv_set:nnn {up}{I}{`\I} -\usv_set:nnn {up}{L}{`\L} -\usv_set:nnn {up}{M}{`\M} -\usv_set:nnn {up}{N}{`\N} -\usv_set:nnn {up}{P}{`\P} -\usv_set:nnn {up}{Q}{`\Q} -\usv_set:nnn {up}{R}{`\R} -\usv_set:nnn {up}{Z}{`\Z} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {it}{B}{"1D435} -\usv_set:nnn {it}{C}{"1D436} -\usv_set:nnn {it}{D}{"1D437} -\usv_set:nnn {it}{E}{"1D438} -\usv_set:nnn {it}{F}{"1D439} -\usv_set:nnn {it}{H}{"1D43B} -\usv_set:nnn {it}{I}{"1D43C} -\usv_set:nnn {it}{L}{"1D43F} -\usv_set:nnn {it}{M}{"1D440} -\usv_set:nnn {it}{N}{"1D441} -\usv_set:nnn {it}{P}{"1D443} -\usv_set:nnn {it}{Q}{"1D444} -\usv_set:nnn {it}{R}{"1D445} -\usv_set:nnn {it}{Z}{"1D44D} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {up}{d}{`\d} -\usv_set:nnn {up}{e}{`\e} -\usv_set:nnn {up}{g}{`\g} -\usv_set:nnn {up}{h}{`\h} -\usv_set:nnn {up}{i}{`\i} -\usv_set:nnn {up}{j}{`\j} -\usv_set:nnn {up}{o}{`\o} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {it}{d}{"1D451} -\usv_set:nnn {it}{e}{"1D452} -\usv_set:nnn {it}{g}{"1D454} -\usv_set:nnn {it}{h}{"0210E} -\usv_set:nnn {it}{i}{"1D456} -\usv_set:nnn {it}{j}{"1D457} -\usv_set:nnn {it}{o}{"1D45C} -% \end{macrocode} -% Latin `h': -% \begin{macrocode} -\usv_set:nnn {bb} {h}{"1D559} -\usv_set:nnn {tt} {h}{"1D691} -\usv_set:nnn {scr} {h}{"1D4BD} -\usv_set:nnn {frak} {h}{"1D525} -\usv_set:nnn {bfup} {h}{"1D421} -\usv_set:nnn {bfit} {h}{"1D489} -\usv_set:nnn {sfup} {h}{"1D5C1} -\usv_set:nnn {sfit} {h}{"1D629} -\usv_set:nnn {bffrak}{h}{"1D58D} -\usv_set:nnn {bfscr} {h}{"1D4F1} -\usv_set:nnn {bfsfup}{h}{"1D5F5} -\usv_set:nnn {bfsfit}{h}{"1D65D} -% \end{macrocode} -% Dotless `i' and `j: -% \begin{macrocode} -\usv_set:nnn {up}{dotlessi}{"00131} -\usv_set:nnn {up}{dotlessj}{"00237} -\usv_set:nnn {it}{dotlessi}{"1D6A4} -\usv_set:nnn {it}{dotlessj}{"1D6A5} -% \end{macrocode} -% Blackboard: -% \begin{macrocode} -\usv_set:nnn {bb}{C}{"2102} -\usv_set:nnn {bb}{H}{"210D} -\usv_set:nnn {bb}{N}{"2115} -\usv_set:nnn {bb}{P}{"2119} -\usv_set:nnn {bb}{Q}{"211A} -\usv_set:nnn {bb}{R}{"211D} -\usv_set:nnn {bb}{Z}{"2124} -\usv_set:nnn {up}{Pi} {"003A0} -\usv_set:nnn {up}{pi} {"003C0} -\usv_set:nnn {up}{Gamma} {"00393} -\usv_set:nnn {up}{gamma} {"003B3} -\usv_set:nnn {up}{summation}{"02211} -\usv_set:nnn {it}{Pi} {"1D6F1} -\usv_set:nnn {it}{pi} {"1D70B} -\usv_set:nnn {it}{Gamma} {"1D6E4} -\usv_set:nnn {it}{gamma} {"1D6FE} -\usv_set:nnn {bb}{Pi} {"0213F} -\usv_set:nnn {bb}{pi} {"0213C} -\usv_set:nnn {bb}{Gamma} {"0213E} -\usv_set:nnn {bb}{gamma} {"0213D} -\usv_set:nnn {bb}{summation}{"02140} -% \end{macrocode} -% Italic blackboard: -% \begin{macrocode} -\usv_set:nnn {bbit}{D}{"2145} -\usv_set:nnn {bbit}{d}{"2146} -\usv_set:nnn {bbit}{e}{"2147} -\usv_set:nnn {bbit}{i}{"2148} -\usv_set:nnn {bbit}{j}{"2149} -% \end{macrocode} -% Script exceptions: -% \begin{macrocode} -\usv_set:nnn {scr}{B}{"212C} -\usv_set:nnn {scr}{E}{"2130} -\usv_set:nnn {scr}{F}{"2131} -\usv_set:nnn {scr}{H}{"210B} -\usv_set:nnn {scr}{I}{"2110} -\usv_set:nnn {scr}{L}{"2112} -\usv_set:nnn {scr}{M}{"2133} -\usv_set:nnn {scr}{R}{"211B} -\usv_set:nnn {scr}{e}{"212F} -\usv_set:nnn {scr}{g}{"210A} -\usv_set:nnn {scr}{o}{"2134} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {cal}{B}{"212C} -\usv_set:nnn {cal}{E}{"2130} -\usv_set:nnn {cal}{F}{"2131} -\usv_set:nnn {cal}{H}{"210B} -\usv_set:nnn {cal}{I}{"2110} -\usv_set:nnn {cal}{L}{"2112} -\usv_set:nnn {cal}{M}{"2133} -\usv_set:nnn {cal}{R}{"211B} -% \end{macrocode} -% Fractur exceptions: -% \begin{macrocode} -\usv_set:nnn {frak}{C}{"212D} -\usv_set:nnn {frak}{H}{"210C} -\usv_set:nnn {frak}{I}{"2111} -\usv_set:nnn {frak}{R}{"211C} -\usv_set:nnn {frak}{Z}{"2128} -% \end{macrocode} -% -% \begin{macrocode} -%</package&(XE|LU)> -% \end{macrocode} -% -% \subsection{STIX fonts} -% -% Version 1.0.0 of the STIX fonts contains a number of -% alphabets in the private use area of Unicode; i.e., -% it contains many math glyphs that have not (yet or if ever) -% been accepted into the Unicode standard. -% -% But we still want to be able to use them if possible. -% -% \begin{macrocode} -%<*stix> -% \end{macrocode} -% -% \paragraph{Upright} -% \begin{macrocode} -\usv_set:nnn {stixsfup}{partial}{"E17C} -\usv_set:nnn {stixsfup}{Greek}{"E17D} -\usv_set:nnn {stixsfup}{greek}{"E196} -\usv_set:nnn {stixsfup}{varTheta}{"E18E} -\usv_set:nnn {stixsfup}{varepsilon}{"E1AF} -\usv_set:nnn {stixsfup}{vartheta}{"E1B0} -\usv_set:nnn {stixsfup}{varkappa}{0000} % ??? -\usv_set:nnn {stixsfup}{varphi}{"E1B1} -\usv_set:nnn {stixsfup}{varrho}{"E1B2} -\usv_set:nnn {stixsfup}{varpi}{"E1B3} -\usv_set:nnn {stixupslash}{Greek}{"E2FC} -% \end{macrocode} -% -% \paragraph{Italic} -% \begin{macrocode} -\usv_set:nnn {stixbbit}{A}{"E154} -\usv_set:nnn {stixbbit}{B}{"E155} -\usv_set:nnn {stixbbit}{E}{"E156} -\usv_set:nnn {stixbbit}{F}{"E157} -\usv_set:nnn {stixbbit}{G}{"E158} -\usv_set:nnn {stixbbit}{I}{"E159} -\usv_set:nnn {stixbbit}{J}{"E15A} -\usv_set:nnn {stixbbit}{K}{"E15B} -\usv_set:nnn {stixbbit}{L}{"E15C} -\usv_set:nnn {stixbbit}{M}{"E15D} -\usv_set:nnn {stixbbit}{O}{"E15E} -\usv_set:nnn {stixbbit}{S}{"E15F} -\usv_set:nnn {stixbbit}{T}{"E160} -\usv_set:nnn {stixbbit}{U}{"E161} -\usv_set:nnn {stixbbit}{V}{"E162} -\usv_set:nnn {stixbbit}{W}{"E163} -\usv_set:nnn {stixbbit}{X}{"E164} -\usv_set:nnn {stixbbit}{Y}{"E165} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixbbit}{a}{"E166} -\usv_set:nnn {stixbbit}{b}{"E167} -\usv_set:nnn {stixbbit}{c}{"E168} -\usv_set:nnn {stixbbit}{f}{"E169} -\usv_set:nnn {stixbbit}{g}{"E16A} -\usv_set:nnn {stixbbit}{h}{"E16B} -\usv_set:nnn {stixbbit}{k}{"E16C} -\usv_set:nnn {stixbbit}{l}{"E16D} -\usv_set:nnn {stixbbit}{m}{"E16E} -\usv_set:nnn {stixbbit}{n}{"E16F} -\usv_set:nnn {stixbbit}{o}{"E170} -\usv_set:nnn {stixbbit}{p}{"E171} -\usv_set:nnn {stixbbit}{q}{"E172} -\usv_set:nnn {stixbbit}{r}{"E173} -\usv_set:nnn {stixbbit}{s}{"E174} -\usv_set:nnn {stixbbit}{t}{"E175} -\usv_set:nnn {stixbbit}{u}{"E176} -\usv_set:nnn {stixbbit}{v}{"E177} -\usv_set:nnn {stixbbit}{w}{"E178} -\usv_set:nnn {stixbbit}{x}{"E179} -\usv_set:nnn {stixbbit}{y}{"E17A} -\usv_set:nnn {stixbbit}{z}{"E17B} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixsfit}{Numerals}{"E1B4} -\usv_set:nnn {stixsfit}{partial}{"E1BE} -\usv_set:nnn {stixsfit}{Greek}{"E1BF} -\usv_set:nnn {stixsfit}{greek}{"E1D8} -\usv_set:nnn {stixsfit}{varTheta}{"E1D0} -\usv_set:nnn {stixsfit}{varepsilon}{"E1F1} -\usv_set:nnn {stixsfit}{vartheta}{"E1F2} -\usv_set:nnn {stixsfit}{varkappa}{0000} % ??? -\usv_set:nnn {stixsfit}{varphi}{"E1F3} -\usv_set:nnn {stixsfit}{varrho}{"E1F4} -\usv_set:nnn {stixsfit}{varpi}{"E1F5} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixcal}{Latin}{"E22D} -\usv_set:nnn {stixcal}{num}{"E262} -\usv_set:nnn {scr}{num}{48} -\usv_set:nnn {it}{num}{48} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixsfitslash}{Latin}{"E294} -\usv_set:nnn {stixsfitslash}{latin}{"E2C8} -\usv_set:nnn {stixsfitslash}{greek}{"E32C} -\usv_set:nnn {stixsfitslash}{varepsilon}{"E37A} -\usv_set:nnn {stixsfitslash}{vartheta}{"E35E} -\usv_set:nnn {stixsfitslash}{varkappa}{"E374} -\usv_set:nnn {stixsfitslash}{varphi}{"E360} -\usv_set:nnn {stixsfitslash}{varrho}{"E376} -\usv_set:nnn {stixsfitslash}{varpi}{"E362} -\usv_set:nnn {stixsfitslash}{digamma}{"E36A} -% \end{macrocode} -% -% \paragraph{Bold} -% -% \begin{macrocode} -\usv_set:nnn {stixbfupslash}{Greek}{"E2FD} -\usv_set:nnn {stixbfupslash}{Digamma}{"E369} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixbfbb}{A}{"E38A} -\usv_set:nnn {stixbfbb}{B}{"E38B} -\usv_set:nnn {stixbfbb}{E}{"E38D} -\usv_set:nnn {stixbfbb}{F}{"E38E} -\usv_set:nnn {stixbfbb}{G}{"E38F} -\usv_set:nnn {stixbfbb}{I}{"E390} -\usv_set:nnn {stixbfbb}{J}{"E391} -\usv_set:nnn {stixbfbb}{K}{"E392} -\usv_set:nnn {stixbfbb}{L}{"E393} -\usv_set:nnn {stixbfbb}{M}{"E394} -\usv_set:nnn {stixbfbb}{O}{"E395} -\usv_set:nnn {stixbfbb}{S}{"E396} -\usv_set:nnn {stixbfbb}{T}{"E397} -\usv_set:nnn {stixbfbb}{U}{"E398} -\usv_set:nnn {stixbfbb}{V}{"E399} -\usv_set:nnn {stixbfbb}{W}{"E39A} -\usv_set:nnn {stixbfbb}{X}{"E39B} -\usv_set:nnn {stixbfbb}{Y}{"E39C} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixbfbb}{a}{"E39D} -\usv_set:nnn {stixbfbb}{b}{"E39E} -\usv_set:nnn {stixbfbb}{c}{"E39F} -\usv_set:nnn {stixbfbb}{f}{"E3A2} -\usv_set:nnn {stixbfbb}{g}{"E3A3} -\usv_set:nnn {stixbfbb}{h}{"E3A4} -\usv_set:nnn {stixbfbb}{k}{"E3A7} -\usv_set:nnn {stixbfbb}{l}{"E3A8} -\usv_set:nnn {stixbfbb}{m}{"E3A9} -\usv_set:nnn {stixbfbb}{n}{"E3AA} -\usv_set:nnn {stixbfbb}{o}{"E3AB} -\usv_set:nnn {stixbfbb}{p}{"E3AC} -\usv_set:nnn {stixbfbb}{q}{"E3AD} -\usv_set:nnn {stixbfbb}{r}{"E3AE} -\usv_set:nnn {stixbfbb}{s}{"E3AF} -\usv_set:nnn {stixbfbb}{t}{"E3B0} -\usv_set:nnn {stixbfbb}{u}{"E3B1} -\usv_set:nnn {stixbfbb}{v}{"E3B2} -\usv_set:nnn {stixbfbb}{w}{"E3B3} -\usv_set:nnn {stixbfbb}{x}{"E3B4} -\usv_set:nnn {stixbfbb}{y}{"E3B5} -\usv_set:nnn {stixbfbb}{z}{"E3B6} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixbfsfup}{Numerals}{"E3B7} -% \end{macrocode} -% -% \paragraph{Bold Italic} -% \begin{macrocode} -\usv_set:nnn {stixbfsfit}{Numerals}{"E1F6} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixbfbbit}{A}{"E200} -\usv_set:nnn {stixbfbbit}{B}{"E201} -\usv_set:nnn {stixbfbbit}{E}{"E203} -\usv_set:nnn {stixbfbbit}{F}{"E204} -\usv_set:nnn {stixbfbbit}{G}{"E205} -\usv_set:nnn {stixbfbbit}{I}{"E206} -\usv_set:nnn {stixbfbbit}{J}{"E207} -\usv_set:nnn {stixbfbbit}{K}{"E208} -\usv_set:nnn {stixbfbbit}{L}{"E209} -\usv_set:nnn {stixbfbbit}{M}{"E20A} -\usv_set:nnn {stixbfbbit}{O}{"E20B} -\usv_set:nnn {stixbfbbit}{S}{"E20C} -\usv_set:nnn {stixbfbbit}{T}{"E20D} -\usv_set:nnn {stixbfbbit}{U}{"E20E} -\usv_set:nnn {stixbfbbit}{V}{"E20F} -\usv_set:nnn {stixbfbbit}{W}{"E210} -\usv_set:nnn {stixbfbbit}{X}{"E211} -\usv_set:nnn {stixbfbbit}{Y}{"E212} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixbfbbit}{a}{"E213} -\usv_set:nnn {stixbfbbit}{b}{"E214} -\usv_set:nnn {stixbfbbit}{c}{"E215} -\usv_set:nnn {stixbfbbit}{e}{"E217} -\usv_set:nnn {stixbfbbit}{f}{"E218} -\usv_set:nnn {stixbfbbit}{g}{"E219} -\usv_set:nnn {stixbfbbit}{h}{"E21A} -\usv_set:nnn {stixbfbbit}{k}{"E21D} -\usv_set:nnn {stixbfbbit}{l}{"E21E} -\usv_set:nnn {stixbfbbit}{m}{"E21F} -\usv_set:nnn {stixbfbbit}{n}{"E220} -\usv_set:nnn {stixbfbbit}{o}{"E221} -\usv_set:nnn {stixbfbbit}{p}{"E222} -\usv_set:nnn {stixbfbbit}{q}{"E223} -\usv_set:nnn {stixbfbbit}{r}{"E224} -\usv_set:nnn {stixbfbbit}{s}{"E225} -\usv_set:nnn {stixbfbbit}{t}{"E226} -\usv_set:nnn {stixbfbbit}{u}{"E227} -\usv_set:nnn {stixbfbbit}{v}{"E228} -\usv_set:nnn {stixbfbbit}{w}{"E229} -\usv_set:nnn {stixbfbbit}{x}{"E22A} -\usv_set:nnn {stixbfbbit}{y}{"E22B} -\usv_set:nnn {stixbfbbit}{z}{"E22C} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixbfcal}{Latin}{"E247} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stixbfitslash}{Latin}{"E295} -\usv_set:nnn {stixbfitslash}{latin}{"E2C9} -\usv_set:nnn {stixbfitslash}{greek}{"E32D} -\usv_set:nnn {stixsfitslash}{varepsilon}{"E37B} -\usv_set:nnn {stixsfitslash}{vartheta}{"E35F} -\usv_set:nnn {stixsfitslash}{varkappa}{"E375} -\usv_set:nnn {stixsfitslash}{varphi}{"E361} -\usv_set:nnn {stixsfitslash}{varrho}{"E377} -\usv_set:nnn {stixsfitslash}{varpi}{"E363} -\usv_set:nnn {stixsfitslash}{digamma}{"E36B} -% \end{macrocode} -% -% \begin{macrocode} -%</stix> -% \end{macrocode} -% -% \begin{macrocode} -%<*package&(XE|LU)> -% \end{macrocode} % % \subsection{Overcoming \texorpdfstring{\cmd\@onlypreamble}{\textbackslash @onlypreamble}} % @@ -2123,53 +745,47 @@ This work is "maintained" by Will Robertson. % % \section{Fundamentals} % -% \subsection{Enlarging the number of maths families} -% -% To start with, we've got a power of two as many \cmd\fam s as before. So (from |ltfssbas.dtx|) we want to redefine -% \begin{macrocode} -%<*XE> -\def\new@mathgroup{\alloc@8\mathgroup\chardef\@cclvi} -\let\newfam\new@mathgroup -%</XE> -% \end{macrocode} -% This is sufficient for \LaTeX's \cmd\DeclareSymbolFont-type commands to be able -% to define 256 named maths fonts. -% For \hologo{LuaLaTeX}, this is handled by the \pkg{lualatex-math} package. -% % \subsection{Setting math chars, math codes, etc.} % -% \begin{macro}{\um_set_mathsymbol:nNNn} +% \begin{macro}{\@@_set_mathsymbol:nNNn} % \darg{A \LaTeX\ symbol font, e.g., \texttt{operators}} % \darg{Symbol macro, \eg, \cmd\alpha} % \darg{Type, \eg, \cmd\mathalpha} % \darg{Slot, \eg, \texttt{"221E}} % There are a bunch of tests to perform to process the various characters. % The following assignments should all be fairly straightforward. +% +% The catcode setting is to work around (strange?) behaviour in LuaTeX in which catcode 11 characters don't have italic correction for maths. % \begin{macrocode} -\cs_set:Nn \um_set_mathsymbol:nNNn +\cs_set:Nn \@@_set_mathsymbol:nNNn { - \tl_case:Nnn #3 { - \mathop { \um_set_big_operator:nnn {#1} {#2} {#4} } - \mathopen { \um_set_math_open:nnn {#1} {#2} {#4} } - \mathclose { \um_set_math_close:nnn {#1} {#2} {#4} } - \mathfence { \um_set_math_fence:nnnn {#1} {#2} {#3} {#4} } + \int_compare:nT { \char_value_catcode:n {#4} == 11 } + { \char_set_catcode_other:n {#4} } + + \tl_case:Nn #3 + { + \mathord { \@@_set_mathcode:nnn {#4} {#3} {#1} } + \mathalpha { \@@_set_mathcode:nnn {#4} {#3} {#1} } + \mathbin { \@@_set_mathcode:nnn {#4} {#3} {#1} } + \mathrel { \@@_set_mathcode:nnn {#4} {#3} {#1} } + \mathpunct { \@@_set_mathcode:nnn {#4} {#3} {#1} } + \mathop { \@@_set_big_operator:nnn {#1} {#2} {#4} } + \mathopen { \@@_set_math_open:nnn {#1} {#2} {#4} } + \mathclose { \@@_set_math_close:nnn {#1} {#2} {#4} } + \mathfence { \@@_set_math_fence:nnnn {#1} {#2} {#3} {#4} } \mathaccent - { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {fixed} {#1} {#4} } } + { \@@_set_math_accent:Nnnn #2 {fixed} {#1} {#4} } \mathbotaccent - { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {bottom~ fixed} {#1} {#4} } } + { \@@_set_math_accent:Nnnn #2 {bottom~ fixed} {#1} {#4} } + \mathaccentwide + { \@@_set_math_accent:Nnnn #2 {} {#1} {#4} } + \mathbotaccentwide + { \@@_set_math_accent:Nnnn #2 {bottom} {#1} {#4} } \mathover - { - \cs_set_protected_nopar:Npx #2 ##1 - { \mathop { \um_accent:nnn {} {#1} {#4} {##1} } \limits } - } + { \@@_set_math_overunder:Nnnn #2 {} {#1} {#4} } \mathunder - { - \cs_set_protected_nopar:Npx #2 ##1 - { \mathop { \um_accent:nnn {bottom} {#1} {#4} {##1} } \limits } - } - }{ - \um_set_mathcode:nnn {#4} {#3} {#1} - } + { \@@_set_math_overunder:Nnnn #2 {bottom} {#1} {#4} } + } } % \end{macrocode} % \end{macro} @@ -2179,10 +795,12 @@ This work is "maintained" by Will Robertson. \edef\mathover{\string\mathover} \edef\mathunder{\string\mathunder} \edef\mathbotaccent{\string\mathbotaccent} +\edef\mathaccentwide{\string\mathaccentwide} +\edef\mathbotaccentwide{\string\mathbotaccentwide} % \end{macrocode} % % -% \begin{macro}{\um_set_big_operator:nnn} +% \begin{macro}{\@@_set_big_operator:nnn} % \darg{Symbol font name} % \darg{Macro to assign} % \darg{Glyph slot} @@ -2201,7 +819,7 @@ This work is "maintained" by Will Robertson. % Define \cs{sum_sym} as \cmd\sumop, followed by \cmd\nolimits\ if necessary. % \end{itemize} % Whether the \cmd\nolimits\ suffix is inserted is controlled by the -% token list \cs{l_um_nolimits_tl}, which contains a list of such characters. +% token list \cs{l_@@_nolimits_tl}, which contains a list of such characters. % This list is checked dynamically to allow it to be updated mid-document. % % Examples of expansion, by default, for two big operators: @@ -2210,79 +828,248 @@ This work is "maintained" by Will Robertson. % (~\cs{int} $\to$~) $\int$ $\to$ \cs{int_sym} $\to$ \cs{intop} % \end{quote} % \begin{macrocode} -\cs_new:Nn \um_set_big_operator:nnn +\cs_new:Nn \@@_set_big_operator:nnn { \group_begin: \char_set_catcode_active:n {#3} - \char_gmake_mathactive:n {#3} - \um_active_char_set:wc #3 \q_nil { \cs_to_str:N #2 _sym } + \@@_char_gmake_mathactive:n {#3} + \@@_active_char_set:wc #3 \q_nil { \cs_to_str:N #2 _sym } \group_end: - \um_set_mathchar:cNnn {\cs_to_str:N #2 op} \mathop {#1} {#3} + + \@@_set_mathchar:cNnn {\cs_to_str:N #2 op} \mathop {#1} {#3} + \cs_gset:cpx { \cs_to_str:N #2 _sym } { \exp_not:c { \cs_to_str:N #2 op } - \exp_not:n { \tl_if_in:NnT \l_um_nolimits_tl {#2} \nolimits } + \exp_not:n { \tl_if_in:NnT \l_@@_nolimits_tl {#2} \nolimits } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_set_math_open:nnn} +% \begin{macro}{\@@_set_math_open:nnn} % \darg{Symbol font name} % \darg{Macro to assign} % \darg{Glyph slot} % \begin{macrocode} -\cs_new:Nn \um_set_math_open:nnn +\cs_new:Nn \@@_set_math_open:nnn { - \tl_if_in:NnTF \l_um_radicals_tl {#2} + \tl_if_in:NnTF \l_@@_radicals_tl {#2} { \cs_gset_protected_nopar:cpx {\cs_to_str:N #2 sign} - { \um_radical:nn {#1} {#3} } - \tl_set:cn {l_um_radical_\cs_to_str:N #2_tl} {\use:c{sym #1}~ #3} + { \@@_radical:nn {#1} {#3} } + \tl_set:cn {l_@@_radical_\cs_to_str:N #2_tl} {\use:c{sym #1}~ #3} } { - \um_set_delcode:nnn {#1} {#3} {#3} - \um_set_mathcode:nnn {#3} \mathopen {#1} + \@@_set_delcode:nnn {#1} {#3} {#3} + \@@_set_mathcode:nnn {#3} \mathopen {#1} \cs_gset_protected_nopar:Npx #2 - { \um_delimiter:Nnn \mathopen {#1} {#3} } + { \@@_delimiter:Nnn \mathopen {#1} {#3} } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_set_math_close:nnn} +% \begin{macro}{\@@_set_math_close:nnn} % \darg{Symbol font name} % \darg{Macro to assign} % \darg{Glyph slot} % \begin{macrocode} -\cs_new:Nn \um_set_math_close:nnn +\cs_new:Nn \@@_set_math_close:nnn { - \um_set_delcode:nnn {#1} {#3} {#3} - \um_set_mathcode:nnn {#3} \mathclose {#1} + \@@_set_delcode:nnn {#1} {#3} {#3} + \@@_set_mathcode:nnn {#3} \mathclose {#1} \cs_gset_protected_nopar:Npx #2 - { \um_delimiter:Nnn \mathclose {#1} {#3} } + { \@@_delimiter:Nnn \mathclose {#1} {#3} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_set_math_fence:nnnn} +% \begin{macro}{\@@_set_math_fence:nnnn} % \darg{Symbol font name} % \darg{Macro to assign} % \darg{Type, \eg, \cmd\mathalpha} % \darg{Glyph slot} % \begin{macrocode} -\cs_new:Nn \um_set_math_fence:nnnn +\cs_new:Nn \@@_set_math_fence:nnnn { - \um_set_mathcode:nnn {#4} {#3} {#1} - \um_set_delcode:nnn {#1} {#4} {#4} + \@@_set_mathcode:nnn {#4} {#3} {#1} + \@@_set_delcode:nnn {#1} {#4} {#4} \cs_gset_protected_nopar:cpx {l \cs_to_str:N #2} - { \um_delimiter:Nnn \mathopen {#1} {#4} } + { \@@_delimiter:Nnn \mathopen {#1} {#4} } \cs_gset_protected_nopar:cpx {r \cs_to_str:N #2} - { \um_delimiter:Nnn \mathclose {#1} {#4} } + { \@@_delimiter:Nnn \mathclose {#1} {#4} } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_math_accent:Nnnn} +% \darg{Accend command} +% \darg{Accent type (string)} +% \darg{Symbol font name} +% \darg{Glyph slot} +% \begin{macrocode} +\cs_new:Nn \@@_set_math_accent:Nnnn + { + \cs_gset_protected_nopar:Npx #1 + { \@@_accent:nnn {#2} {#3} {#4} } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_set_math_overunder:Nnnn} +% \darg{Accend command} +% \darg{Accent type (string)} +% \darg{Symbol font name} +% \darg{Glyph slot} +% \begin{macrocode} +\cs_new:Nn \@@_set_math_overunder:Nnnn + { + \cs_gset_protected_nopar:Npx #1 ##1 + { + \mathop + { \@@_accent:nnn {#2} {#3} {#4} {##1} } + \limits + } } % \end{macrocode} % \end{macro} % +% \subsection{\cs{setmathalphabet}} +% +% \begin{macro}{\setmathalphabet} +% \begin{macrocode} +\keys_define:nn {@@_mathface} + { + version .code:n = + { \tl_set:Nn \l_@@_mversion_tl {#1} } + } + +\DeclareDocumentCommand \setmathfontface { m O{} m O{} } + { + \tl_clear:N \l_@@_mversion_tl + + \keys_set_known:nnN {@@_mathface} {#2,#4} \l_@@_keyval_clist + \exp_args:Nnx \fontspec_set_family:Nxn \l_@@_tmpa_tl + { ItalicFont={}, BoldFont={}, \exp_not:V \l_@@_keyval_clist } {#3} + + \tl_if_empty:NT \l_@@_mversion_tl + { + \tl_set:Nn \l_@@_mversion_tl {normal} + \DeclareMathAlphabet #1 {\g_fontspec_encoding_tl} {\l_@@_tmpa_tl} {\mddefault} {\updefault} + } + \SetMathAlphabet #1 {\l_@@_mversion_tl} {\g_fontspec_encoding_tl} {\l_@@_tmpa_tl} {\mddefault} {\updefault} + + % integrate with fontspec's \setmathrm etc: + \tl_case:Nn #1 + { + \mathrm { \cs_set_eq:NN \g__fontspec_mathrm_tl \l_@@_tmpa_tl } + \mathsf { \cs_set_eq:NN \g__fontspec_mathsf_tl \l_@@_tmpa_tl } + \mathtt { \cs_set_eq:NN \g__fontspec_mathtt_tl \l_@@_tmpa_tl } + } + } + +\@onlypreamble \setmathfontface +% \end{macrocode} +% Note that \LaTeX's SetMathAlphabet simply doesn't work to "reset" a maths alphabet font after \verb"\begin{document}", so unlike most of the other maths commands around we still restrict this one to the preamble. +% \end{macro} +% +% \begin{macro}{\setoperatorfont} +% TODO: add check? +% \begin{macrocode} +\DeclareDocumentCommand \setoperatorfont {m} + { \tl_set:Nn \g_@@_operator_mathfont_tl {#1} } +\setoperatorfont{\mathrm} +% \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. +% +% While we could now re-activate the way that \pkg{fontspec} does the following, because we can now change maths fonts whenever it's better to define new commands in \pkg{unicode-math} to define the \cs{mathXYZ} fonts. +% +% \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} + \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} + \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} + \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} @@ -2292,12 +1079,14 @@ This work is "maintained" by Will Robertson. % I hope to improve the performance somehow. % % \begin{macro}{\setmathfont} -% \doarg{font features} +% \doarg{font features (first optional argument retained for backwards compatibility)} % \darg{font name} +% \doarg{font features} % \begin{macrocode} -\DeclareDocumentCommand \setmathfont { O{} m } { - \tl_set:Nn \l_um_fontname_tl {#2} - \um_init: +\DeclareDocumentCommand \setmathfont { O{} m O{} } + { + \tl_set:Nn \l_@@_fontname_tl {#2} + \@@_init: % \end{macrocode} % Grab the current size information: % (is this robust enough? Maybe it should be preceded by \cmd\normalsize). @@ -2310,47 +1099,57 @@ This work is "maintained" by Will Robertson. % \end{macrocode} % Parse options and tell people what's going on: % \begin{macrocode} - \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} } + \keys_set_known:nnN {unicode-math} {#1,#3} \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. +% After loading the font, we detect what sizes it recommends for scriptsize and scriptscriptsize, so after setting those values appropriately, we reload the font to take these into account. % \begin{macrocode} - \um_fontspec_select_font: + + \csname TIC\endcsname + \@@_fontspec_select_font: + \csname TOC\endcsname + \bool_if:nT { \l_@@_ot_math_bool && !\g_@@_mainfont_already_set_bool } + { + \@@_declare_math_sizes: + \@@_fontspec_select_font: + } % \end{macrocode} -% Now define |\um_symfont_tl| as the \LaTeX\ math font to access everything: +% Now define |\@@_symfont_tl| as the \LaTeX\ math font to access everything: % \begin{macrocode} - \cs_if_exist:cF { sym \um_symfont_tl } + \cs_if_exist:cF { sym \@@_symfont_tl } { - \DeclareSymbolFont{\um_symfont_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + \DeclareSymbolFont{\@@_symfont_tl} + {\encodingdefault}{\l_@@_family_tl}{\mddefault}{\updefault} } - \SetSymbolFont{\um_symfont_tl}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + \SetSymbolFont{\@@_symfont_tl}{\l_@@_mversion_tl} + {\encodingdefault}{\l_@@_family_tl}{\mddefault}{\updefault} % \end{macrocode} % Set the bold math version. % \begin{macrocode} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \tl_set:Nn \l_@@_tmpa_tl {normal} + \tl_if_eq:NNT \l_@@_mversion_tl \l_@@_tmpa_tl { - \SetSymbolFont{\um_symfont_tl}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + \SetSymbolFont{\@@_symfont_tl}{bold} + {\encodingdefault}{\l_@@_family_tl}{\bfdefault}{\updefault} } % \end{macrocode} % Declare the math sizes (i.e., scaling of superscripts) for the specific % values for this font, % and set defaults for math fams two and three for legacy compatibility: % \begin{macrocode} - \bool_if:nT { \l_um_ot_math_bool && !\g_um_mainfont_already_set_bool } + \bool_if:nT { \l_@@_ot_math_bool && !\g_@@_mainfont_already_set_bool } { - \bool_set_true:N \g_um_mainfont_already_set_bool - \um_declare_math_sizes: - \um_setup_legacy_fam_two: - \um_setup_legacy_fam_three: + \bool_set_true:N \g_@@_mainfont_already_set_bool + \@@_setup_legacy_fam_two: + \@@_setup_legacy_fam_three: } % \end{macrocode} % And now we input every single maths char. % \begin{macrocode} - \um_input_math_symbol_table: + \csname TIC\endcsname + \@@_input_math_symbol_table: + \csname TOC\endcsname % \end{macrocode} % Finally, % \begin{itemize} @@ -2361,17 +1160,18 @@ This work is "maintained" by Will Robertson. % \item Setup the maths alphabets (\cs{mathbf} etc.) % \end{itemize} % \begin{macrocode} - \um_remap_symbols: - \um_setup_mathactives: - \um_setup_accents: - \um_setup_delcodes: - \um_setup_alphabets: - \um_setup_negations: + \@@_remap_symbols: + \@@_setup_mathactives: + \@@_setup_delcodes: + \csname TIC\endcsname + \@@_setup_alphabets: + \csname TOC\endcsname + \@@_setup_negations: % \end{macrocode} % Prevent spaces, and that's it: % \begin{macrocode} \ignorespaces -} + } % \end{macrocode} % \end{macro} % @@ -2380,15 +1180,15 @@ This work is "maintained" by Will Robertson. \cs_set_eq:NN \resetmathfont \setmathfont % \end{macrocode} % -% \begin{macro}{\um_init:} +% \begin{macro}{\@@_init:} % \begin{macrocode} -\cs_new:Nn \um_init: +\cs_new:Nn \@@_init: { % \end{macrocode} % \begin{itemize} % \item Initially assume we're using a proper OpenType font with unicode maths. % \begin{macrocode} - \bool_set_true:N \l_um_ot_math_bool + \bool_set_true:N \l_@@_ot_math_bool % \end{macrocode} % \item Erase any conception \LaTeX\ has of previously defined math symbol fonts; % this allows \cmd\DeclareSymbolFont\ at any point in the document. @@ -2397,33 +1197,33 @@ This work is "maintained" by Will Robertson. % \end{macrocode} % \item To start with, assume we're defining the font for every math symbol character. % \begin{macrocode} - \bool_set_true:N \l_um_init_bool - \seq_clear:N \l_um_char_range_seq - \clist_clear:N \l_um_char_num_range_clist - \seq_clear:N \l_um_mathalph_seq - \seq_clear:N \l_um_missing_alph_seq + \bool_set_true:N \l_@@_init_bool + \seq_clear:N \l_@@_char_range_seq + \clist_clear:N \l_@@_char_nrange_clist + \seq_clear:N \l_@@_mathalph_seq + \seq_clear:N \l_@@_missing_alph_seq % \end{macrocode} % \item By default use the `normal' math version. % \begin{macrocode} - \tl_set:Nn \l_um_mversion_tl {normal} + \tl_set:Nn \l_@@_mversion_tl {normal} % \end{macrocode} % \item Other range initialisations. % \begin{macrocode} - \tl_set:Nn \um_symfont_tl {operators} - \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_noparse:nnn - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_noparse:Nnn - \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_noparse:nnn - \cs_set_eq:NN \um_maybe_init_alphabet:n \um_init_alphabet:n - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_noparse:nn - \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_noparse:nn - \cs_set_eq:NN \um_make_mathactive:nNN \um_make_mathactive_noparse:nNN + \tl_set:Nn \@@_symfont_tl {operators} + \cs_set_eq:NN \_@@_sym:nnn \@@_process_symbol_noparse:nnn + \cs_set_eq:NN \@@_set_mathalphabet_char:nnn \@@_mathmap_noparse:nnn + \cs_set_eq:NN \@@_remap_symbol:nnn \@@_remap_symbol_noparse:nnn + \cs_set_eq:NN \@@_maybe_init_alphabet:n \@@_init_alphabet:n + \cs_set_eq:NN \@@_map_char_single:nn \@@_map_char_noparse:nn + \cs_set_eq:NN \@@_assign_delcode:nn \@@_assign_delcode_noparse:nn + \cs_set_eq:NN \@@_make_mathactive:nNN \@@_make_mathactive_noparse:nNN % \end{macrocode} % \item Define default font features for the script and scriptscript font. % \begin{macrocode} - \tl_set:Nn \l_um_script_features_tl {Style=MathScript} - \tl_set:Nn \l_um_sscript_features_tl {Style=MathScriptScript} - \tl_set_eq:NN \l_um_script_font_tl \l_um_fontname_tl - \tl_set_eq:NN \l_um_sscript_font_tl \l_um_fontname_tl + \tl_set:Nn \l_@@_script_features_tl {Style=MathScript} + \tl_set:Nn \l_@@_sscript_features_tl {Style=MathScriptScript} + \tl_set_eq:NN \l_@@_script_font_tl \l_@@_fontname_tl + \tl_set_eq:NN \l_@@_sscript_font_tl \l_@@_fontname_tl % \end{macrocode} % \end{itemize} % \begin{macrocode} @@ -2432,16 +1232,16 @@ This work is "maintained" by Will Robertson. % \end{macro} % % -% \begin{macro}{\um_declare_math_sizes:} +% \begin{macro}{\@@_declare_math_sizes:} % Set the math sizes according to the recommended font parameters: % \begin{macrocode} -\cs_new:Nn \um_declare_math_sizes: +\cs_new:Nn \@@_declare_math_sizes: { - \dim_compare:nF { \fontdimen 10 \l_um_font == 0pt } + \dim_compare:nF { \fontdimen 10 \l_@@_font == 0pt } { \DeclareMathSizes { \f@size } { \f@size } - { \um_fontdimen_to_scale:nn {10} {\l_um_font} } - { \um_fontdimen_to_scale:nn {11} {\l_um_font} } + { \@@_fontdimen_to_scale:nn {10} {\l_@@_font} } + { \@@_fontdimen_to_scale:nn {11} {\l_@@_font} } } } % \end{macrocode} @@ -2449,73 +1249,73 @@ This work is "maintained" by Will Robertson. % % % -% \begin{macro}{\um_setup_legacy_fam_two:} +% \begin{macro}{\@@_setup_legacy_fam_two:} % \TeX\ won't load the same font twice at the same scale, so we need to magnify this one by an imperceptable amount. % \begin{macrocode} -\cs_new:Nn \um_setup_legacy_fam_two: +\cs_new:Nn \@@_setup_legacy_fam_two: { - \fontspec_set_family:Nxn \l_um_family_tl + \fontspec_set_family:Nxn \l_@@_family_tl { - \l_um_font_keyval_tl, + \l_@@_font_keyval_tl, Scale=1.00001, FontAdjustment = { - \fontdimen8\font= \um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax - \fontdimen9\font= \um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax - \fontdimen10\font=\um_get_fontparam:nn {32} {StackTopShiftUp}\relax - \fontdimen11\font=\um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax - \fontdimen12\font=\um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax - \fontdimen13\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax - \fontdimen14\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax - \fontdimen15\font=\um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax - \fontdimen16\font=\um_get_fontparam:nn {18} {SubscriptShiftDown}\relax - \fontdimen17\font=\um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax - \fontdimen18\font=\um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax - \fontdimen19\font=\um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax + \fontdimen8\font= \@@_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax + \fontdimen9\font= \@@_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax + \fontdimen10\font=\@@_get_fontparam:nn {32} {StackTopShiftUp}\relax + \fontdimen11\font=\@@_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax + \fontdimen12\font=\@@_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax + \fontdimen13\font=\@@_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen14\font=\@@_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen15\font=\@@_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax + \fontdimen16\font=\@@_get_fontparam:nn {18} {SubscriptShiftDown}\relax + \fontdimen17\font=\@@_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax + \fontdimen18\font=\@@_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax + \fontdimen19\font=\@@_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax \fontdimen20\font=0pt\relax % delim1 = FractionDelimiterDisplaySize \fontdimen21\font=0pt\relax % delim2 = FractionDelimiterSize - \fontdimen22\font=\um_get_fontparam:nn {15} {AxisHeight}\relax + \fontdimen22\font=\@@_get_fontparam:nn {15} {AxisHeight}\relax } - } {\l_um_fontname_tl} - \SetSymbolFont{symbols}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + } {\l_@@_fontname_tl} + \SetSymbolFont{symbols}{\l_@@_mversion_tl} + {\encodingdefault}{\l_@@_family_tl}{\mddefault}{\updefault} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \tl_set:Nn \l_@@_tmpa_tl {normal} + \tl_if_eq:NNT \l_@@_mversion_tl \l_@@_tmpa_tl { \SetSymbolFont{symbols}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + {\encodingdefault}{\l_@@_family_tl}{\bfdefault}{\updefault} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_setup_legacy_fam_three:} +% \begin{macro}{\@@_setup_legacy_fam_three:} % Similarly, this font is shrunk by an imperceptable amount for \TeX\ to load it again. % \begin{macrocode} -\cs_new:Nn \um_setup_legacy_fam_three: +\cs_new:Nn \@@_setup_legacy_fam_three: { - \fontspec_set_family:Nxn \l_um_family_tl + \fontspec_set_family:Nxn \l_@@_family_tl { - \l_um_font_keyval_tl, + \l_@@_font_keyval_tl, Scale=0.99999, FontAdjustment={ - \fontdimen8\font= \um_get_fontparam:nn {48} {FractionRuleThickness}\relax - \fontdimen9\font= \um_get_fontparam:nn {28} {UpperLimitGapMin}\relax - \fontdimen10\font=\um_get_fontparam:nn {30} {LowerLimitGapMin}\relax - \fontdimen11\font=\um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax - \fontdimen12\font=\um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax + \fontdimen8\font= \@@_get_fontparam:nn {48} {FractionRuleThickness}\relax + \fontdimen9\font= \@@_get_fontparam:nn {28} {UpperLimitGapMin}\relax + \fontdimen10\font=\@@_get_fontparam:nn {30} {LowerLimitGapMin}\relax + \fontdimen11\font=\@@_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax + \fontdimen12\font=\@@_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax \fontdimen13\font=0pt\relax } - } {\l_um_fontname_tl} - \SetSymbolFont{largesymbols}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + } {\l_@@_fontname_tl} + \SetSymbolFont{largesymbols}{\l_@@_mversion_tl} + {\encodingdefault}{\l_@@_family_tl}{\mddefault}{\updefault} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \tl_set:Nn \l_@@_tmpa_tl {normal} + \tl_if_eq:NNT \l_@@_mversion_tl \l_@@_tmpa_tl { \SetSymbolFont{largesymbols}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + {\encodingdefault}{\l_@@_family_tl}{\bfdefault}{\updefault} } } % \end{macrocode} @@ -2523,19 +1323,19 @@ This work is "maintained" by Will Robertson. % % % \begin{macrocode} -\cs_new:Nn \um_get_fontparam:nn -%<XE> { \the\fontdimen#1\l_um_font\relax } -%<LU> { \directlua{fontspec.mathfontdimen("l_um_font","#2")} } +\cs_new:Nn \@@_get_fontparam:nn +%<XE> { \the\fontdimen#1\l_@@_font\relax } +%<LU> { \directlua{fontspec.mathfontdimen("l_@@_font","#2")} } % \end{macrocode} % % % -% \begin{macro}{\um_fontspec_select_font:} -% Select the font with \cs{fontspec} and define \cs{l_um_font} from it. +% \begin{macro}{\@@_fontspec_select_font:} +% Select the font with \cs{fontspec} and define \cs{l_@@_font} from it. % \begin{macrocode} -\cs_new:Nn \um_fontspec_select_font: +\cs_new:Nn \@@_fontspec_select_font: { - \tl_set:Nx \l_um_font_keyval_tl { + \tl_set:Nx \l_@@_font_keyval_tl { %<LU> Renderer = Basic, BoldItalicFont = {}, ItalicFont = {}, Script = Math, @@ -2546,25 +1346,25 @@ This work is "maintained" by Will Robertson. } , { Size = \sf@size-\tf@size , - Font = \l_um_script_font_tl , - \l_um_script_features_tl + Font = \l_@@_script_font_tl , + \l_@@_script_features_tl } , { Size = -\sf@size , - Font = \l_um_sscript_font_tl , - \l_um_sscript_features_tl + Font = \l_@@_sscript_font_tl , + \l_@@_sscript_features_tl } } , - \l_um_unknown_keys_clist + \l_@@_unknown_keys_clist } - \fontspec_set_fontface:NNxn \l_um_font \l_um_family_tl - {\l_um_font_keyval_tl} {\l_um_fontname_tl} + \fontspec_set_fontface:NNxn \l_@@_font \l_@@_family_tl + {\l_@@_font_keyval_tl} {\l_@@_fontname_tl} % \end{macrocode} % Check whether we're using a real maths font: % \begin{macrocode} \group_begin: - \fontfamily{\l_um_family_tl}\selectfont - \fontspec_if_script:nF {math} {\bool_gset_false:N \l_um_ot_math_bool} + \fontfamily{\l_@@_family_tl}\selectfont + \fontspec_if_script:nF {math} {\bool_gset_false:N \l_@@_ot_math_bool} \group_end: } % \end{macrocode} @@ -2574,23 +1374,23 @@ This work is "maintained" by Will Robertson. % \subsubsection{Functions for setting up symbols with mathcodes} % \seclabel{mathsymbol} % -% \begin{macro}{\um_process_symbol_noparse:nnn} -% \begin{macro}{\um_process_symbol_parse:nnn} +% \begin{macro}{\@@_process_symbol_noparse:nnn} +% \begin{macro}{\@@_process_symbol_parse:nnn} % If the \feat{range} font feature has been used, then only % a subset of the Unicode glyphs are to be defined. % See \secref{rangeproc} for the code that enables this. % \begin{macrocode} -\cs_set:Nn \um_process_symbol_noparse:nnn +\cs_set:Nn \@@_process_symbol_noparse:nnn { - \um_set_mathsymbol:nNNn {\um_symfont_tl} #2#3{#1} + \@@_set_mathsymbol:nNNn {\@@_symfont_tl} #2 #3 {#1} } % \end{macrocode} % \begin{macrocode} -\cs_set:Nn \um_process_symbol_parse:nnn +\cs_set:Nn \@@_process_symbol_parse:nnn { - \um_if_char_spec:nNNT{#1}{#2}{#3} + \@@_if_char_spec:nNNT {#1} {#2} {#3} { - \um_process_symbol_noparse:nnn {#1}{#2}{#3} + \@@_process_symbol_noparse:nnn {#1} {#2} {#3} } } % \end{macrocode} @@ -2598,39 +1398,35 @@ This work is "maintained" by Will Robertson. % \end{macro} % % -% \begin{macro}{\um_remap_symbols:} -% \begin{macro}{\um_remap_symbol_noparse:nnn} -% \begin{macro}{\um_remap_symbol_parse:nnn} +% \begin{macro}{\@@_remap_symbols:} +% \begin{macro}{\@@_remap_symbol_noparse:nnn} +% \begin{macro}{\@@_remap_symbol_parse:nnn} % This function is used to define the mathcodes for those chars which should % be mapped to a different glyph than themselves. % \begin{macrocode} -\cs_new:Npn \um_remap_symbols: +\cs_new:Npn \@@_remap_symbols: { - \um_remap_symbol:nnn{`\-}{\mathbin}{"02212}% hyphen to minus - \um_remap_symbol:nnn{`\*}{\mathbin}{"02217}% text asterisk to "centred asterisk" - \bool_if:NF \g_um_literal_colon_bool + \@@_remap_symbol:nnn{`\-}{\mathbin}{"02212}% hyphen to minus + \@@_remap_symbol:nnn{`\*}{\mathbin}{"02217}% text asterisk to "centred asterisk" + \bool_if:NF \g_@@_literal_colon_bool { - \um_remap_symbol:nnn{`\:}{\mathrel}{"02236}% colon to ratio (i.e., punct to rel) + \@@_remap_symbol:nnn{`\:}{\mathrel}{"02236}% colon to ratio (i.e., punct to rel) } } % \end{macrocode} % \end{macro} -% Where |\um_remap_symbol:nnn| is defined to be one of these two, depending +% Where |\@@_remap_symbol:nnn| is defined to be one of these two, depending % on the range setup: % \begin{macrocode} -\cs_new:Nn \um_remap_symbol_parse:nnn +\cs_new:Nn \@@_remap_symbol_parse:nnn { - \um_if_char_spec:nNNT {#3} {\@nil} {#2} - { - \um_remap_symbol_noparse:nnn {#1} {#2} {#3} - } + \@@_if_char_spec:nNNT {#3} {\@nil} {#2} + { \@@_remap_symbol_noparse:nnn {#1} {#2} {#3} } } -\cs_new:Nn \um_remap_symbol_noparse:nnn +\cs_new:Nn \@@_remap_symbol_noparse:nnn { \clist_map_inline:nn {#1} - { - \um_set_mathcode:nnnn {##1} {#2} {\um_symfont_tl} {#3} - } + { \@@_set_mathcode:nnnn {##1} {#2} {\@@_symfont_tl} {#3} } } % \end{macrocode} % \end{macro} @@ -2642,37 +1438,37 @@ This work is "maintained" by Will Robertson. % There are more math active chars later in the subscript/superscript section. % But they don't need to be able to be typeset directly. % -% \begin{macro}{\um_setup_mathactives:} +% \begin{macro}{\@@_setup_mathactives:} % \begin{macrocode} -\cs_new:Npn \um_setup_mathactives: +\cs_new:Npn \@@_setup_mathactives: { - \um_make_mathactive:nNN {"2032} \um_prime_single_mchar \mathord - \um_make_mathactive:nNN {"2033} \um_prime_double_mchar \mathord - \um_make_mathactive:nNN {"2034} \um_prime_triple_mchar \mathord - \um_make_mathactive:nNN {"2057} \um_prime_quad_mchar \mathord - \um_make_mathactive:nNN {"2035} \um_backprime_single_mchar \mathord - \um_make_mathactive:nNN {"2036} \um_backprime_double_mchar \mathord - \um_make_mathactive:nNN {"2037} \um_backprime_triple_mchar \mathord - \um_make_mathactive:nNN {`\'} \mathstraightquote \mathord - \um_make_mathactive:nNN {`\`} \mathbacktick \mathord + \@@_make_mathactive:nNN {"2032} \@@_prime_single_mchar \mathord + \@@_make_mathactive:nNN {"2033} \@@_prime_double_mchar \mathord + \@@_make_mathactive:nNN {"2034} \@@_prime_triple_mchar \mathord + \@@_make_mathactive:nNN {"2057} \@@_prime_quad_mchar \mathord + \@@_make_mathactive:nNN {"2035} \@@_backprime_single_mchar \mathord + \@@_make_mathactive:nNN {"2036} \@@_backprime_double_mchar \mathord + \@@_make_mathactive:nNN {"2037} \@@_backprime_triple_mchar \mathord + \@@_make_mathactive:nNN {`\'} \mathstraightquote \mathord + \@@_make_mathactive:nNN {`\`} \mathbacktick \mathord } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_make_mathactive:nNN} +% \begin{macro}{\@@_make_mathactive:nNN} % Makes |#1| a mathactive char, and gives cs |#2| the meaning of mathchar |#1| % with class |#3|. % You are responsible for giving active |#1| a particular meaning! % \begin{macrocode} -\cs_new:Nn \um_make_mathactive_parse:nNN +\cs_new:Nn \@@_make_mathactive_parse:nNN { - \um_if_char_spec:nNNT {#1} #2 #3 - { \um_make_mathactive_noparse:nNN {#1} #2 #3 } + \@@_if_char_spec:nNNT {#1} #2 #3 + { \@@_make_mathactive_noparse:nNN {#1} #2 #3 } } -\cs_new:Nn \um_make_mathactive_noparse:nNN +\cs_new:Nn \@@_make_mathactive_noparse:nNN { - \um_set_mathchar:NNnn #2 #3 {\um_symfont_tl} {#1} - \char_gmake_mathactive:n {#1} + \@@_set_mathchar:NNnn #2 #3 {\@@_symfont_tl} {#1} + \@@_char_gmake_mathactive:n {#1} } % \end{macrocode} % \end{macro} @@ -2680,74 +1476,77 @@ This work is "maintained" by Will Robertson. % \subsubsection{Delimiter codes} % % -% \begin{macro}{\um_assign_delcode:nn} +% \begin{macro}{\@@_assign_delcode:nn} % \begin{macrocode} -\cs_new:Nn \um_assign_delcode_noparse:nn +\cs_new:Nn \@@_assign_delcode_noparse:nn { - \um_set_delcode:nnn \um_symfont_tl {#1} {#2} + \@@_set_delcode:nnn \@@_symfont_tl {#1} {#2} } -\cs_new:Nn \um_assign_delcode_parse:nn +\cs_new:Nn \@@_assign_delcode_parse:nn { - \um_if_char_spec:nNNT {#2} {\@nil} {\@nil} + \@@_if_char_spec:nNNT {#2} {\@nil} {\@nil} { - \um_assign_delcode_noparse:nn {#1} {#2} + \@@_assign_delcode_noparse:nn {#1} {#2} } } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\um_assign_delcode:n} +% \begin{macro}{\@@_assign_delcode:n} % Shorthand. % \begin{macrocode} -\cs_new:Nn \um_assign_delcode:n { \um_assign_delcode:nn {#1} {#1} } +\cs_new:Nn \@@_assign_delcode:n { \@@_assign_delcode:nn {#1} {#1} } % \end{macrocode} % \end{macro} % % % -% \begin{macro}{\um_setup_delcodes:} +% \begin{macro}{\@@_setup_delcodes:} % Some symbols that aren't mathopen/mathclose still need to have delimiter codes assigned. % The list of vertical arrows may be incomplete. % On the other hand, many fonts won't support them all being stretchy. % And some of them are probably not meant to stretch, either. But adding them here doesn't hurt. % \begin{macrocode} -\cs_new:Npn \um_setup_delcodes: - { - \um_assign_delcode:nn {`\.} {\c_zero} % ensure \left. and \right. work - \um_assign_delcode:nn {`\/} {\g_um_slash_delimiter_usv} - \um_assign_delcode:nn {"2044} {\g_um_slash_delimiter_usv} % fracslash - \um_assign_delcode:nn {"2215} {\g_um_slash_delimiter_usv} % divslash - \um_assign_delcode:n {"005C} % backslash - \um_assign_delcode:nn {`\<} {"27E8} % angle brackets with ascii notation - \um_assign_delcode:nn {`\>} {"27E9} % angle brackets with ascii notation - \um_assign_delcode:n {"2191} % up arrow - \um_assign_delcode:n {"2193} % down arrow - \um_assign_delcode:n {"2195} % updown arrow - \um_assign_delcode:n {"219F} % up arrow twohead - \um_assign_delcode:n {"21A1} % down arrow twohead - \um_assign_delcode:n {"21A5} % up arrow from bar - \um_assign_delcode:n {"21A7} % down arrow from bar - \um_assign_delcode:n {"21A8} % updown arrow from bar - \um_assign_delcode:n {"21BE} % up harpoon right - \um_assign_delcode:n {"21BF} % up harpoon left - \um_assign_delcode:n {"21C2} % down harpoon right - \um_assign_delcode:n {"21C3} % down harpoon left - \um_assign_delcode:n {"21C5} % arrows up down - \um_assign_delcode:n {"21F5} % arrows down up - \um_assign_delcode:n {"21C8} % arrows up up - \um_assign_delcode:n {"21CA} % arrows down down - \um_assign_delcode:n {"21D1} % double up arrow - \um_assign_delcode:n {"21D3} % double down arrow - \um_assign_delcode:n {"21D5} % double updown arrow - \um_assign_delcode:n {"21DE} % up arrow double stroke - \um_assign_delcode:n {"21DF} % down arrow double stroke - \um_assign_delcode:n {"21E1} % up arrow dashed - \um_assign_delcode:n {"21E3} % down arrow dashed - \um_assign_delcode:n {"21E7} % up white arrow - \um_assign_delcode:n {"21E9} % down white arrow - \um_assign_delcode:n {"21EA} % up white arrow from bar - \um_assign_delcode:n {"21F3} % updown white arrow +\cs_new:Npn \@@_setup_delcodes: + { + % ensure \left. and \right. work: + \@@_set_delcode:nnn \@@_symfont_tl {`\.} {\c_zero} + % this is forcefully done to fix a bug -- indicates a larger problem! + + \@@_assign_delcode:nn {`\/} {\g_@@_slash_delimiter_usv} + \@@_assign_delcode:nn {"2044} {\g_@@_slash_delimiter_usv} % fracslash + \@@_assign_delcode:nn {"2215} {\g_@@_slash_delimiter_usv} % divslash + \@@_assign_delcode:n {"005C} % backslash + \@@_assign_delcode:nn {`\<} {"27E8} % angle brackets with ascii notation + \@@_assign_delcode:nn {`\>} {"27E9} % angle brackets with ascii notation + \@@_assign_delcode:n {"2191} % up arrow + \@@_assign_delcode:n {"2193} % down arrow + \@@_assign_delcode:n {"2195} % updown arrow + \@@_assign_delcode:n {"219F} % up arrow twohead + \@@_assign_delcode:n {"21A1} % down arrow twohead + \@@_assign_delcode:n {"21A5} % up arrow from bar + \@@_assign_delcode:n {"21A7} % down arrow from bar + \@@_assign_delcode:n {"21A8} % updown arrow from bar + \@@_assign_delcode:n {"21BE} % up harpoon right + \@@_assign_delcode:n {"21BF} % up harpoon left + \@@_assign_delcode:n {"21C2} % down harpoon right + \@@_assign_delcode:n {"21C3} % down harpoon left + \@@_assign_delcode:n {"21C5} % arrows up down + \@@_assign_delcode:n {"21F5} % arrows down up + \@@_assign_delcode:n {"21C8} % arrows up up + \@@_assign_delcode:n {"21CA} % arrows down down + \@@_assign_delcode:n {"21D1} % double up arrow + \@@_assign_delcode:n {"21D3} % double down arrow + \@@_assign_delcode:n {"21D5} % double updown arrow + \@@_assign_delcode:n {"21DE} % up arrow double stroke + \@@_assign_delcode:n {"21DF} % down arrow double stroke + \@@_assign_delcode:n {"21E1} % up arrow dashed + \@@_assign_delcode:n {"21E3} % down arrow dashed + \@@_assign_delcode:n {"21E7} % up white arrow + \@@_assign_delcode:n {"21E9} % down white arrow + \@@_assign_delcode:n {"21EA} % up white arrow from bar + \@@_assign_delcode:n {"21F3} % updown white arrow } % \end{macrocode} % \end{macro} @@ -2763,20 +1562,20 @@ This work is "maintained" by Will Robertson. % However, the limits aren't set automatically; that is, we want to define, % a la Plain \TeX\ \etc, |\def\int{\intop\nolimits}|, so there needs to be a % transformation from \cmd\int\ to \cmd\intop\ during the expansion of -% \cmd\_um_sym:nnn\ in the appropriate contexts. +% \cmd\_@@_sym:nnn\ in the appropriate contexts. % -% \begin{macro}{\l_um_nolimits_tl} +% \begin{macro}{\l_@@_nolimits_tl} % This macro is a sequence containing those maths operators that require a % \cmd\nolimits\ suffix. % This list is used when processing |unicode-math-table.tex| to define such -% commands automatically (see the macro \cs{um_set_mathsymbol:nNNn}). +% commands automatically (see the macro \cs{@@_set_mathsymbol:nNNn}). % I've chosen essentially just the operators that look like integrals; % hopefully a better mathematician can help me out here. % I've a feeling that it's more useful \emph{not} to include the multiple % integrals such as $\iiiint$, but that might be a matter of preference. % \begin{macrocode} -\tl_new:N \l_um_nolimits_tl -\tl_set:Nn \l_um_nolimits_tl +\tl_new:N \l_@@_nolimits_tl +\tl_set:Nn \l_@@_nolimits_tl { \int\iint\iiint\iiiint\oint\oiint\oiiint \intclockwise\varointclockwise\ointctrclockwise\sumint @@ -2793,7 +1592,7 @@ This work is "maintained" by Will Robertson. % \begin{macrocode} \DeclareDocumentCommand \addnolimits {m} { - \tl_put_right:Nn \l_um_nolimits_tl {#1} + \tl_put_right:Nn \l_@@_nolimits_tl {#1} } % \end{macrocode} % \end{macro} @@ -2804,25 +1603,25 @@ This work is "maintained" by Will Robertson. % \begin{macrocode} \DeclareDocumentCommand \removenolimits {m} { - \tl_remove_all:Nn \l_um_nolimits_tl {#1} + \tl_remove_all:Nn \l_@@_nolimits_tl {#1} } % \end{macrocode} % \end{macro} % % \subsection{Radicals} % -% The radical for square root is organised in \cs{um_set_mathsymbol:nNNn}. +% The radical for square root is organised in \cs{@@_set_mathsymbol:nNNn}. % I think it's the only radical ever. % (Actually, there is also \cs{cuberoot} and \cs{fourthroot}, but they don't % seem to behave as proper radicals.) % % Also, what about right-to-left square roots? % -% \begin{macro}{\l_um_radicals_tl} +% \begin{macro}{\l_@@_radicals_tl} % We organise radicals in the same way as nolimits-operators. % \begin{macrocode} -\tl_new:N \l_um_radicals_tl -\tl_set:Nn \l_um_radicals_tl {\sqrt \longdivision} +\tl_new:N \l_@@_radicals_tl +\tl_set:Nn \l_@@_radicals_tl {\sqrt \longdivision} % \end{macrocode} % \end{macro} % @@ -2836,7 +1635,7 @@ This work is "maintained" by Will Robertson. % We use \LuaTeX’s interface because it’s much better, but rename the primitives to be more \LaTeX3-like. % There are getter and setter commands for each font parameter. % The names of the parameters is derived from the \LuaTeX\ names, with underscores inserted between words. -% For every parameter \cs{Umath\meta{\LuaTeX\ name}}, we define an expandable getter command \cs{um_\meta{\LaTeX3 name}:N} and a protected setter command \cs{um_set_\meta{\LaTeX3 name}:Nn}. +% For every parameter \cs{Umath\meta{\LuaTeX\ name}}, we define an expandable getter command \cs{@@_\meta{\LaTeX3 name}:N} and a protected setter command \cs{@@_set_\meta{\LaTeX3 name}:Nn}. % The getter command takes one of the style primitives (\cs{displaystyle} etc.)\ and expands to the font parameter, which is a \meta{dimension}. % The setter command takes a style primitive and a dimension expression, which is parsed with \cs{dim_eval:n}. % @@ -2853,13 +1652,13 @@ This work is "maintained" by Will Robertson. % Nevertheless, we define these commands as quarks, so they can be used as arguments to the font parameter commands (but nowhere else). % Making these commands available is necessary because we need to make a distinction between cramped and non-cramped styles for one font parameter. % -% \begin{macro}{\um_new_cramped_style:N} +% \begin{macro}{\@@_new_cramped_style:N} % \darg{command} % Define \meta{command} as a new cramped style switch. % For \LuaTeX, simply rename the correspronding primitive. % For \XeTeX, define \meta{command} as a new quark. % \begin{macrocode} -\cs_new_protected_nopar:Nn \um_new_cramped_style:N +\cs_new_protected_nopar:Nn \@@_new_cramped_style:N %<XE> { \quark_new:N #1 } %<LU> { \cs_new_eq:Nc #1 { luatex \cs_to_str:N #1 } } % \end{macrocode} @@ -2871,10 +1670,10 @@ This work is "maintained" by Will Robertson. % \begin{macro}{\crampedscriptscriptstyle} % The cramped style commands. % \begin{macrocode} -\um_new_cramped_style:N \crampeddisplaystyle -\um_new_cramped_style:N \crampedtextstyle -\um_new_cramped_style:N \crampedscriptstyle -\um_new_cramped_style:N \crampedscriptscriptstyle +\@@_new_cramped_style:N \crampeddisplaystyle +\@@_new_cramped_style:N \crampedtextstyle +\@@_new_cramped_style:N \crampedscriptstyle +\@@_new_cramped_style:N \crampedscriptscriptstyle % \end{macrocode} % \end{macro} % \end{macro} @@ -2886,7 +1685,7 @@ This work is "maintained" by Will Robertson. % \LuaTeX\ accounts for this by having the parameter primitives take a style token argument. % To replicate this behavior in \XeTeX, we have to map style tokens to specific combinations of font dimension numbers and math fonts (\cs{textfont} etc.). % -% \begin{macro}{\um_font_dimen:Nnnnn} +% \begin{macro}{\@@_font_dimen:Nnnnn} % \darg{style token} % \darg{font dimen for display style} % \darg{font dimen for cramped display style} @@ -2898,7 +1697,7 @@ This work is "maintained" by Will Robertson. % The macro expands to a dimension which contains the appropriate font dimension. % \begin{macrocode} %<*XE> - \cs_new_nopar:Npn \um_font_dimen:Nnnnn #1 #2 #3 #4 #5 { + \cs_new_nopar:Npn \@@_font_dimen:Nnnnn #1 #2 #3 #4 #5 { \fontdimen \cs_if_eq:NNTF #1 \displaystyle { #2 \textfont @@ -2944,7 +1743,7 @@ This work is "maintained" by Will Robertson. % \paragraph{Font parameters} % This paragraph contains macros for defining the font parameter interface, as well as the definition for all font parameters known to \LuaTeX. % -% \begin{macro}{\um_font_param:nnnnn} +% \begin{macro}{\@@_font_param:nnnnn} % \darg{name} % \darg{font dimension for non-cramped display style} % \darg{font dimension for cramped display style} @@ -2954,25 +1753,25 @@ This work is "maintained" by Will Robertson. % The \LuaTeX\ font parameter name is produced by removing all underscores and prefixing the result with |luatexUmath|. % The \XeTeX\ font dimension numbers must be integer constants. % \begin{macrocode} -\cs_new_protected_nopar:Nn \um_font_param:nnnnn +\cs_new_protected_nopar:Nn \@@_font_param:nnnnn %<*XE> { - \um_font_param_aux:ccnnnn { um_ #1 :N } { um_set_ #1 :N } + \@@_font_param_aux:ccnnnn { @@_ #1 :N } { @@_set_ #1 :Nn } { #2 } { #3 } { #4 } { #5 } } %</XE> %<*LU> { - \tl_set:Nn \l_um_tmpa_tl { #1 } - \tl_remove_all:Nn \l_um_tmpa_tl { _ } - \um_font_param_aux:ccc { um_ #1 :N } { um_set_ #1 :N } - { luatexUmath \l_um_tmpa_tl } + \tl_set:Nn \l_@@_tmpa_tl { #1 } + \tl_remove_all:Nn \l_@@_tmpa_tl { _ } + \@@_font_param_aux:ccc { @@_ #1 :N } { @@_set_ #1 :Nn } + { luatexUmath \l_@@_tmpa_tl } } %</LU> % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_font_param:nnn} +% \begin{macro}{\@@_font_param:nnn} % \darg{name} % \darg{font dimension for display style} % \darg{font dimension for non-display styles} @@ -2980,58 +1779,58 @@ This work is "maintained" by Will Robertson. % The \LuaTeX\ font parameter name is produced by removing all underscores and prefixing the result with |luatexUmath|. % The \XeTeX\ font dimension numbers must be integer constants. % \begin{macrocode} -\cs_new_protected_nopar:Nn \um_font_param:nnn +\cs_new_protected_nopar:Nn \@@_font_param:nnn { - \um_font_param:nnnnn { #1 } { #2 } { #2 } { #3 } { #3 } + \@@_font_param:nnnnn { #1 } { #2 } { #2 } { #3 } { #3 } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_font_param:nn} +% \begin{macro}{\@@_font_param:nn} % \darg{name} % \darg{font dimension} % This macro defines getter and setter functions for the font parameter \meta{name}. % The \LuaTeX\ font parameter name is produced by removing all underscores and prefixing the result with |luatexUmath|. % The \XeTeX\ font dimension number must be an integer constant. % \begin{macrocode} -\cs_new_protected_nopar:Nn \um_font_param:nn +\cs_new_protected_nopar:Nn \@@_font_param:nn { - \um_font_param:nnnnn { #1 } { #2 } { #2 } { #2 } { #2 } + \@@_font_param:nnnnn { #1 } { #2 } { #2 } { #2 } { #2 } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_font_param:n} +% \begin{macro}{\@@_font_param:n} % \darg{name} % This macro defines getter and setter functions for the font parameter \meta{name}, which is considered unavailable in \XeTeX\@. % The \LuaTeX\ font parameter name is produced by removing all underscores and prefixing the result with |luatexUmath|. % \begin{macrocode} -\cs_new_protected_nopar:Nn \um_font_param:n +\cs_new_protected_nopar:Nn \@@_font_param:n %<XE> { } -%<LU> { \um_font_param:nnnnn { #1 } { 0 } { 0 } { 0 } { 0 } } +%<LU> { \@@_font_param:nnnnn { #1 } { 0 } { 0 } { 0 } { 0 } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_font_param_aux:NNnnnn} -% \begin{macro}{\um_font_param_aux:NNN} +% \begin{macro}{\@@_font_param_aux:NNnnnn} +% \begin{macro}{\@@_font_param_aux:NNN} % Auxiliary macros for generating font parameter accessor macros. % \begin{macrocode} %<*XE> -\cs_new_protected_nopar:Nn \um_font_param_aux:NNnnnn +\cs_new_protected_nopar:Nn \@@_font_param_aux:NNnnnn { \cs_new_nopar:Npn #1 ##1 { - \um_font_dimen:Nnnnn ##1 { #3 } { #4 } { #5 } { #6 } + \@@_font_dimen:Nnnnn ##1 { #3 } { #4 } { #5 } { #6 } } \cs_new_protected_nopar:Npn #2 ##1 ##2 { #1 ##1 \dim_eval:n { ##2 } } } -\cs_generate_variant:Nn \um_font_param_aux:NNnnnn { cc } +\cs_generate_variant:Nn \@@_font_param_aux:NNnnnn { cc } %</XE> %<*LU> -\cs_new_protected_nopar:Nn \um_font_param_aux:NNN +\cs_new_protected_nopar:Nn \@@_font_param_aux:NNN { \cs_new_nopar:Npn #1 ##1 { @@ -3042,7 +1841,7 @@ This work is "maintained" by Will Robertson. #3 ##1 \dim_eval:n { ##2 } } } -\cs_generate_variant:Nn \um_font_param_aux:NNN { ccc } +\cs_generate_variant:Nn \@@_font_param_aux:NNN { ccc } %</LU> % \end{macrocode} % \end{macro} @@ -3050,101 +1849,63 @@ This work is "maintained" by Will Robertson. % % Now all font parameters that are listed in the \LuaTeX\ reference follow. % \begin{macrocode} -\um_font_param:nn { axis } { 15 } -\um_font_param:nn { operator_size } { 13 } -\um_font_param:n { fraction_del_size } -\um_font_param:nnn { fraction_denom_down } { 45 } { 44 } -\um_font_param:nnn { fraction_denom_vgap } { 50 } { 49 } -\um_font_param:nnn { fraction_num_up } { 43 } { 42 } -\um_font_param:nnn { fraction_num_vgap } { 47 } { 46 } -\um_font_param:nn { fraction_rule } { 48 } -\um_font_param:nn { limit_above_bgap } { 29 } -\um_font_param:n { limit_above_kern } -\um_font_param:nn { limit_above_vgap } { 28 } -\um_font_param:nn { limit_below_bgap } { 31 } -\um_font_param:n { limit_below_kern } -\um_font_param:nn { limit_below_vgap } { 30 } -\um_font_param:nn { over_delimiter_vgap } { 41 } -\um_font_param:nn { over_delimiter_bgap } { 38 } -\um_font_param:nn { under_delimiter_vgap } { 40 } -\um_font_param:nn { under_delimiter_bgap } { 39 } -\um_font_param:nn { overbar_kern } { 55 } -\um_font_param:nn { overbar_rule } { 54 } -\um_font_param:nn { overbar_vgap } { 53 } -\um_font_param:n { quad } -\um_font_param:nn { radical_kern } { 62 } -\um_font_param:nn { radical_rule } { 61 } -\um_font_param:nnn { radical_vgap } { 60 } { 59 } -\um_font_param:nn { radical_degree_before } { 63 } -\um_font_param:nn { radical_degree_after } { 64 } -\um_font_param:nn { radical_degree_raise } { 65 } -\um_font_param:nn { space_after_script } { 27 } -\um_font_param:nnn { stack_denom_down } { 35 } { 34 } -\um_font_param:nnn { stack_num_up } { 33 } { 32 } -\um_font_param:nnn { stack_vgap } { 37 } { 36 } -\um_font_param:nn { sub_shift_down } { 18 } -\um_font_param:nn { sub_shift_drop } { 20 } -\um_font_param:n { subsup_shift_down } -\um_font_param:nn { sub_top_max } { 19 } -\um_font_param:nn { subsup_vgap } { 25 } -\um_font_param:nn { sup_bottom_min } { 23 } -\um_font_param:nn { sup_shift_drop } { 24 } -\um_font_param:nnnnn { sup_shift_up } { 21 } { 22 } { 21 } { 22 } -\um_font_param:nn { supsub_bottom_max } { 26 } -\um_font_param:nn { underbar_kern } { 58 } -\um_font_param:nn { underbar_rule } { 57 } -\um_font_param:nn { underbar_vgap } { 56 } -\um_font_param:n { connector_overlap_min } +\@@_font_param:nn { axis } { 15 } +\@@_font_param:nn { operator_size } { 13 } +\@@_font_param:n { fraction_del_size } +\@@_font_param:nnn { fraction_denom_down } { 45 } { 44 } +\@@_font_param:nnn { fraction_denom_vgap } { 50 } { 49 } +\@@_font_param:nnn { fraction_num_up } { 43 } { 42 } +\@@_font_param:nnn { fraction_num_vgap } { 47 } { 46 } +\@@_font_param:nn { fraction_rule } { 48 } +\@@_font_param:nn { limit_above_bgap } { 29 } +\@@_font_param:n { limit_above_kern } +\@@_font_param:nn { limit_above_vgap } { 28 } +\@@_font_param:nn { limit_below_bgap } { 31 } +\@@_font_param:n { limit_below_kern } +\@@_font_param:nn { limit_below_vgap } { 30 } +\@@_font_param:nn { over_delimiter_vgap } { 41 } +\@@_font_param:nn { over_delimiter_bgap } { 38 } +\@@_font_param:nn { under_delimiter_vgap } { 40 } +\@@_font_param:nn { under_delimiter_bgap } { 39 } +\@@_font_param:nn { overbar_kern } { 55 } +\@@_font_param:nn { overbar_rule } { 54 } +\@@_font_param:nn { overbar_vgap } { 53 } +\@@_font_param:n { quad } +\@@_font_param:nn { radical_kern } { 62 } +\@@_font_param:nn { radical_rule } { 61 } +\@@_font_param:nnn { radical_vgap } { 60 } { 59 } +\@@_font_param:nn { radical_degree_before } { 63 } +\@@_font_param:nn { radical_degree_after } { 64 } +\@@_font_param:nn { radical_degree_raise } { 65 } +\@@_font_param:nn { space_after_script } { 27 } +\@@_font_param:nnn { stack_denom_down } { 35 } { 34 } +\@@_font_param:nnn { stack_num_up } { 33 } { 32 } +\@@_font_param:nnn { stack_vgap } { 37 } { 36 } +\@@_font_param:nn { sub_shift_down } { 18 } +\@@_font_param:nn { sub_shift_drop } { 20 } +\@@_font_param:n { subsup_shift_down } +\@@_font_param:nn { sub_top_max } { 19 } +\@@_font_param:nn { subsup_vgap } { 25 } +\@@_font_param:nn { sup_bottom_min } { 23 } +\@@_font_param:nn { sup_shift_drop } { 24 } +\@@_font_param:nnnnn { sup_shift_up } { 21 } { 22 } { 21 } { 22 } +\@@_font_param:nn { supsub_bottom_max } { 26 } +\@@_font_param:nn { underbar_kern } { 58 } +\@@_font_param:nn { underbar_rule } { 57 } +\@@_font_param:nn { underbar_vgap } { 56 } +\@@_font_param:n { connector_overlap_min } % \end{macrocode} % % \section{Font features} % -% \begin{macro}{\new@mathversion} -% Fix bug in the \LaTeX\ version. -% (Fixed upstream, too, but unsure when that will propagate.) -% \begin{macrocode} -\def\new@mathversion#1{% - \expandafter\in@\expandafter#1\expandafter{\version@list}% - \ifin@ - \@font@info{Redeclaring math version - `\expandafter\@gobblefour\string#1'}% - \else - \expandafter\newcount\csname c@\expandafter - \@gobble\string#1\endcsname - \def\version@elt{\noexpand\version@elt\noexpand}% - \edef\version@list{\version@list\version@elt#1}% - \fi - \toks@{}% - \count@\z@ - \def\group@elt##1##2{% - \advance\count@\@ne - \addto@hook\toks@{\getanddefine@fonts##1##2}% - }% - \group@list - \global\csname c@\expandafter\@gobble\string#1\endcsname\count@ - \def\alpha@elt##1##2##3{% - \ifx##2\no@alphabet@error - \toks@\expandafter{\the\toks@\install@mathalphabet##1% - {\no@alphabet@error##1}}% - \else - \toks@\expandafter{\the\toks@\install@mathalphabet##1% - {\select@group##1##2##3}}% - \fi - }% - \alpha@list - \xdef#1{\the\toks@}% -} -% \end{macrocode} -% \end{macro} -% % \subsection{Math version} % \begin{macrocode} \keys_define:nn {unicode-math} { version .code:n = { - \tl_set:Nn \l_um_mversion_tl {#1} - \DeclareMathVersion{\l_um_mversion_tl} + \tl_set:Nn \l_@@_mversion_tl {#1} + \DeclareMathVersion {\l_@@_mversion_tl} } } % \end{macrocode} @@ -3153,10 +1914,10 @@ This work is "maintained" by Will Robertson. % \begin{macrocode} \keys_define:nn {unicode-math} { - script-features .tl_set:N = \l_um_script_features_tl , - sscript-features .tl_set:N = \l_um_sscript_features_tl , - script-font .tl_set:N = \l_um_script_font_tl , - sscript-font .tl_set:N = \l_um_sscript_font_tl , + script-features .tl_set:N = \l_@@_script_features_tl , + sscript-features .tl_set:N = \l_@@_sscript_features_tl , + script-font .tl_set:N = \l_@@_script_font_tl , + sscript-font .tl_set:N = \l_@@_sscript_font_tl , } % \end{macrocode} % @@ -3164,43 +1925,45 @@ This work is "maintained" by Will Robertson. % \seclabel{rangeproc} % % \begin{macrocode} -\seq_new:N \l_um_mathalph_seq -\seq_new:N \l_um_char_range_seq -\seq_new:N \l_um_mclass_range_seq -\seq_new:N \l_um_cmd_range_seq \keys_define:nn {unicode-math} { - range .code:n = { - \bool_set_false:N \l_um_init_bool + range .code:n = + { + \bool_set_false:N \l_@@_init_bool % \end{macrocode} % Set processing functions if we're not defining the full Unicode math repetoire. -% Math symbols are defined with \cmd\_um_sym:nnn; see \secref{mathsymbol} +% Math symbols are defined with \cmd\_@@_sym:nnn; see \secref{mathsymbol} % for the individual definitions % \begin{macrocode} - \int_incr:N \g_um_fam_int - \tl_set:Nx \um_symfont_tl {um_fam\int_use:N\g_um_fam_int} - \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_parse:nnn - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_parse:Nnn - \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_parse:nnn - \cs_set_eq:NN \um_maybe_init_alphabet:n \use_none:n - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_parse:nn - \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_parse:nn - \cs_set_eq:NN \um_make_mathactive:nNN \um_make_mathactive_parse:nNN + \int_incr:N \g_@@_fam_int + \tl_set:Nx \@@_symfont_tl {@@_fam\int_use:N\g_@@_fam_int} + \cs_set_eq:NN \_@@_sym:nnn \@@_process_symbol_parse:nnn + \cs_set_eq:NN \@@_set_mathalphabet_char:Nnn \@@_mathmap_parse:Nnn + \cs_set_eq:NN \@@_remap_symbol:nnn \@@_remap_symbol_parse:nnn + \cs_set_eq:NN \@@_maybe_init_alphabet:n \use_none:n + \cs_set_eq:NN \@@_map_char_single:nn \@@_map_char_parse:nn + \cs_set_eq:NN \@@_assign_delcode:nn \@@_assign_delcode_parse:nn + \cs_set_eq:NN \@@_make_mathactive:nNN \@@_make_mathactive_parse:nNN % \end{macrocode} % Proceed by filling up the various `range' seqs according to the user options. % \begin{macrocode} - \seq_clear:N \l_um_char_range_seq - \seq_clear:N \l_um_mclass_range_seq - \seq_clear:N \l_um_cmd_range_seq - \seq_clear:N \l_um_mathalph_seq - \clist_map_inline:nn {#1} { - \um_if_mathalph_decl:nTF {##1} { - \seq_put_right:Nx \l_um_mathalph_seq { - { \exp_not:V \l_um_tmpa_tl } - { \exp_not:V \l_um_tmpb_tl } - { \exp_not:V \l_um_tmpc_tl } - } - }{ + \seq_clear:N \l_@@_char_range_seq + \seq_clear:N \l_@@_mclass_range_seq + \seq_clear:N \l_@@_cmd_range_seq + \seq_clear:N \l_@@_mathalph_seq + + \clist_map_inline:nn {#1} + { + \@@_if_mathalph_decl:nTF {##1} + { + \seq_put_right:Nx \l_@@_mathalph_seq + { + { \exp_not:V \l_@@_tmpa_tl } + { \exp_not:V \l_@@_tmpb_tl } + { \exp_not:V \l_@@_tmpc_tl } + } + } + { % \end{macrocode} % Four cases: % math class matching the known list; @@ -3208,33 +1971,21 @@ This work is "maintained" by Will Robertson. % single item that isn't---edge case, must be 0--9; % none of the above---char range. % \begin{macrocode} - \seq_if_in:NnTF \g_um_mathclasses_seq {##1} - { \seq_put_right:Nn \l_um_mclass_range_seq {##1} } + \seq_if_in:NnTF \g_@@_mathclasses_seq {##1} + { \seq_put_right:Nn \l_@@_mclass_range_seq {##1} } { \bool_if:nTF { \tl_if_single_p:n {##1} && \token_if_cs_p:N ##1 } - { \seq_put_right:Nn \l_um_cmd_range_seq {##1} } - { \seq_put_right:Nn \l_um_char_range_seq {##1} } + { \seq_put_right:Nn \l_@@_cmd_range_seq {##1} } + { \seq_put_right:Nn \l_@@_char_range_seq {##1} } } - } - } - } + } + } + } } % \end{macrocode} % -% \begin{macro}{\g_um_mathclasses_seq} -% Every math class. -% \begin{macrocode} -\seq_new:N \g_um_mathclasses_seq -\seq_set_from_clist:Nn \g_um_mathclasses_seq - { - \mathord,\mathalpha,\mathop,\mathbin,\mathrel, - \mathopen,\mathclose,\mathpunct,\mathaccent, - \mathfence,\mathover,\mathunder,\mathbotaccent - } -% \end{macrocode} -% \end{macro} % -% \begin{macro}{\um_if_mathalph_decl:nTF} +% \begin{macro}{\@@_if_mathalph_decl:nTF} % Possible forms of input:\\ % |\mathscr|\\ % |\mathscr->\mathup|\\ @@ -3248,55 +1999,65 @@ This work is "maintained" by Will Robertson. % The remap style can also be |\mathcal->stixcal|, which I marginally prefer % in the general case. % \begin{macrocode} -\prg_new_conditional:Nnn \um_if_mathalph_decl:n {TF} { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {#1} } - \tl_clear:N \l_um_tmpb_tl - \tl_clear:N \l_um_tmpc_tl - \tl_if_in:NnT \l_um_tmpa_tl {->} { - \exp_after:wN \um_split_arrow:w \l_um_tmpa_tl \q_nil - } - \tl_if_in:NnT \l_um_tmpa_tl {/} { - \exp_after:wN \um_split_slash:w \l_um_tmpa_tl \q_nil - } - \tl_if_empty:NT \l_um_tmpc_tl { \tl_set_eq:NN \l_um_tmpc_tl \l_um_tmpa_tl } - \seq_if_in:NVTF \g_um_mathstyles_seq \l_um_tmpa_tl { - \prg_return_true: - }{ - \prg_return_false: - } -} -\cs_set:Npn \um_split_arrow:w #1->#2 \q_nil { - \tl_set:Nn \l_um_tmpa_tl {#1} - \tl_if_single:nTF {#2} - { \tl_set:Nn \l_um_tmpc_tl {#2} } - { \exp_args:NNc \tl_set:Nn \l_um_tmpc_tl {math#2} } -} -\cs_set:Npn \um_split_slash:w #1/#2 \q_nil { - \tl_set:Nn \l_um_tmpa_tl {#1} - \tl_set:Nn \l_um_tmpb_tl {#2} -} +\prg_new_conditional:Nnn \@@_if_mathalph_decl:n {TF} + { + \tl_set:Nn \l_@@_tmpa_tl {#1} + \tl_clear:N \l_@@_tmpb_tl + \tl_clear:N \l_@@_tmpc_tl + + \tl_if_in:NnT \l_@@_tmpa_tl {->} + { \exp_after:wN \@@_split_arrow:w \l_@@_tmpa_tl \q_nil } + + \tl_if_in:NnT \l_@@_tmpa_tl {/} + { \exp_after:wN \@@_split_slash:w \l_@@_tmpa_tl \q_nil } + + \tl_set:Nx \l_@@_tmpa_tl { \tl_to_str:N \l_@@_tmpa_tl } + \exp_args:NNx \tl_remove_all:Nn \l_@@_tmpa_tl { \token_to_str:N \math } + \exp_args:NNx \tl_remove_all:Nn \l_@@_tmpa_tl { \token_to_str:N \sym } + \tl_trim_spaces:N \l_@@_tmpa_tl + + \tl_if_empty:NT \l_@@_tmpc_tl + { \tl_set_eq:NN \l_@@_tmpc_tl \l_@@_tmpa_tl } + + \seq_if_in:NVTF \g_@@_named_ranges_seq \l_@@_tmpa_tl + { \prg_return_true: } { \prg_return_false: } + } +% \end{macrocode} +% \begin{macrocode} +\cs_set:Npn \@@_split_arrow:w #1->#2 \q_nil + { + \tl_set:Nx \l_@@_tmpa_tl { \tl_trim_spaces:n {#1} } + \tl_set:Nx \l_@@_tmpc_tl { \tl_trim_spaces:n {#2} } + } +% \end{macrocode} +% \begin{macrocode} +\cs_set:Npn \@@_split_slash:w #1/#2 \q_nil + { + \tl_set:Nx \l_@@_tmpa_tl { \tl_trim_spaces:n {#1} } + \tl_set:Nx \l_@@_tmpb_tl { \tl_trim_spaces:n {#2} } + } % \end{macrocode} % \end{macro} % % Pretty basic comma separated range processing. % Donald Arseneau's \pkg{selectp} package has a cleverer technique. % -% \begin{macro}{\um_if_char_spec:nNNT} +% \begin{macro}{\@@_if_char_spec:nNNT} % \darg{Unicode character slot} % \darg{control sequence (character macro)} % \darg{control sequence (math class)} % \darg{code to execute} % This macro expands to |#4| -% if any of its arguments are contained in \cmd\l_um_char_range_seq. +% if any of its arguments are contained in \cmd\l_@@_char_range_seq. % This list can contain either character ranges (for checking with |#1|) or control sequences. % These latter can either be the command name of a specific character, \emph{or} the math % type of one (\eg, \cmd\mathbin). % -% Character ranges are passed to \cmd\um@parse@range, which accepts input in the form shown in \tabref{ranges}. +% Character ranges are passed to \cs{@@_if_char_spec:nNNT}, which accepts input in the form shown in \tabref{ranges}. % % \begin{table}[htbp] % \centering -% \topcaption{Ranges accepted by \cmd\um@parse@range.} +% \topcaption{Ranges accepted by \cs{@@_if_char_spec:nNNT}.} % \label{tab:ranges} % \begin{tabular}{>{\ttfamily}cc} % \textrm{Input} & Range \\ @@ -3311,37 +2072,36 @@ This work is "maintained" by Will Robertson. % We have three tests, performed sequentially in order of execution time. % Any test finding a match jumps directly to the end. % \begin{macrocode} -\cs_new:Nn \um_if_char_spec:nNNT +\cs_new:Nn \@@_if_char_spec:nNNT { - % math class: - \seq_if_in:NnT \l_um_mclass_range_seq {#3} + \seq_if_in:NnT \l_@@_mclass_range_seq {#3} { \use_none_delimit_by_q_nil:w } % command name: - \seq_if_in:NnT \l_um_cmd_range_seq {#2} + \seq_if_in:NnT \l_@@_cmd_range_seq {#2} { \use_none_delimit_by_q_nil:w } % character slot: - \seq_map_inline:Nn \l_um_char_range_seq + \seq_map_inline:Nn \l_@@_char_range_seq { - \um_int_if_slot_in_range:nnT {#1} {##1} + \@@_int_if_slot_in_range:nnT {#1} {##1} { \seq_map_break:n { \use_none_delimit_by_q_nil:w } } } - % this executes if no match was found: + % the following expands to nil if no match was found: \use_none:nnn \q_nil \use:n { - \clist_put_right:Nx \l_um_char_num_range_clist { \int_eval:n {#1} } + \clist_put_right:Nx \l_@@_char_nrange_clist { \int_eval:n {#1} } #4 } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_int_if_slot_in_range:nnT} +% \begin{macro}{\@@_int_if_slot_in_range:nnT} % A `numrange' is like |-2,5-8,12,17-| (can be unsorted). % % Four cases, four argument types: @@ -3354,12 +2114,12 @@ This work is "maintained" by Will Robertson. % \end{Verbatim} % % \begin{macrocode} -\cs_new:Nn \um_int_if_slot_in_range:nnT - { \um_numrange_parse:nwT {#1} #2 - \q_nil - \q_stop {#3} } +\cs_new:Nn \@@_int_if_slot_in_range:nnT + { \@@_numrange_parse:nwT {#1} #2 - \q_nil - \q_stop {#3} } % \end{macrocode} % % \begin{macrocode} -\cs_set:Npn \um_numrange_parse:nwT #1 #2 - #3 - #4 \q_stop #5 +\cs_set:Npn \@@_numrange_parse:nwT #1 #2 - #3 - #4 \q_stop #5 { \tl_if_empty:nTF {#4} { \int_compare:nT {#1=#2} {#5} } { @@ -3376,44 +2136,93 @@ This work is "maintained" by Will Robertson. % % \subsection{Resolving Greek symbol name control sequences} % -% \begin{macro}{\um_resolve_greek:} +% \begin{macro}{\@@_resolve_greek:} % This macro defines \cmd\Alpha\dots\cmd\omega\ as their corresponding % Unicode (mathematical italic) character. Remember that the mapping % to upright or italic happens with the mathcode definitions, whereas these macros % just stand for the literal Unicode characters. % \begin{macrocode} -\AtBeginDocument{\um_resolve_greek:} -\cs_new:Npn \um_resolve_greek: { - \clist_map_inline:nn { +\AtBeginDocument{\@@_resolve_greek:} +\cs_new:Npn \@@_resolve_greek: + { + \clist_map_inline:nn + { Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda, alpha,beta,gamma,delta, zeta,eta,theta,iota,kappa,lambda, Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega, mu,nu,xi,omicron,pi,rho,sigma,tau,upsilon, chi,psi,omega, varTheta, varsigma,vartheta,varkappa,varrho,varpi - }{ + } + { \tl_set:cx {##1} { \exp_not:c { mit ##1 } } - } - \tl_set:Nn \epsilon { - \bool_if:NTF \g_um_texgreek_bool \mitvarepsilon \mitepsilon - } - \tl_set:Nn \phi { - \bool_if:NTF \g_um_texgreek_bool \mitvarphi \mitphi - } - \tl_set:Nn \varepsilon { - \bool_if:NTF \g_um_texgreek_bool \mitepsilon \mitvarepsilon - } - \tl_set:Nn \varphi { - \bool_if:NTF \g_um_texgreek_bool \mitphi \mitvarphi - } -} + \tl_set:cx {up ##1} { \exp_not:N \symup \exp_not:c { ##1 } } + \tl_set:cx {it ##1} { \exp_not:N \symit \exp_not:c { ##1 } } + } + \tl_set:Nn \epsilon + { \bool_if:NTF \g_@@_texgreek_bool \mitvarepsilon \mitepsilon } + \tl_set:Nn \phi + { \bool_if:NTF \g_@@_texgreek_bool \mitvarphi \mitphi } + \tl_set:Nn \varepsilon + { \bool_if:NTF \g_@@_texgreek_bool \mitepsilon \mitvarepsilon } + \tl_set:Nn \varphi + { \bool_if:NTF \g_@@_texgreek_bool \mitphi \mitvarphi } + } % \end{macrocode} % \end{macro} % % -% \section{Maths alphabets mapping definitions} +% +% +% +% +% +% \section{Maths alphabets} % \label{part:mathmap} % +% Defining commands like \cmd\mathrm\ 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} +% +% +% +% \subsection{Setting styles} +% % Algorithm for setting alphabet fonts. % By default, when |range| is empty, we are in \emph{implicit} mode. % If |range| contains the name of the math alphabet, we are in \emph{explicit} @@ -3435,73 +2244,9 @@ This work is "maintained" by Will Robertson. % \item Check for the first glyph of the alphabet to detect if the font contains % the alphabet shape in the Unicode math plane. % \item For Unicode math alphabets, overwrite whatever's already there. -% \item Otherwise, use the \ascii\ letters instead. +% \item Otherwise, use the \ascii\ glyph slots instead. % \end{itemize} % -% \subsection{Initialising math styles} -% -% \begin{macro}{\um_new_mathstyle:N} -% This function defines a new command like \cs{mathfrak}. -% \begin{macrocode} -\cs_new:Nn \um_new_mathstyle:N - { - \um_prepare_mathstyle:f {\exp_after:wN \use_none:nnnnn \token_to_str:N #1} - \seq_put_right:Nn \g_um_mathstyles_seq {#1} - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\g_um_default_mathalph_seq} -% This sequence stores the alphabets in each math style. -% \begin{macrocode} -\seq_new:N \g_um_default_mathalph_seq -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\g_um_mathstyles_seq} -% This is every math style known to \pkg{unicode-math}. -% \begin{macrocode} -\seq_new:N \g_um_mathstyles_seq -% \end{macrocode} -% \end{macro} -% -% \begin{macrocode} -\AtEndOfPackage - { -\clist_map_inline:nn - { - {\mathup } {latin,Latin,greek,Greek,num,misc} {\mathup } , - {\mathit } {latin,Latin,greek,Greek,misc} {\mathit } , - {\mathbb } {latin,Latin,num,misc} {\mathbb } , - {\mathbbit } {misc} {\mathbbit } , - {\mathscr } {latin,Latin} {\mathscr } , - {\mathcal } {Latin} {\mathscr } , - {\mathbfcal } {Latin} {\mathbfscr } , - {\mathfrak } {latin,Latin} {\mathfrak } , - {\mathtt } {latin,Latin,num} {\mathtt } , - {\mathsfup } {latin,Latin,num} {\mathsfup } , - {\mathsfit } {latin,Latin} {\mathsfit } , - {\mathbfup } {latin,Latin,greek,Greek,num,misc} {\mathbfup } , - {\mathbfit } {latin,Latin,greek,Greek,misc} {\mathbfit } , - {\mathbfscr } {latin,Latin} {\mathbfscr } , - {\mathbffrak} {latin,Latin} {\mathbffrak} , - {\mathbfsfup} {latin,Latin,greek,Greek,num,misc} {\mathbfsfup} , - {\mathbfsfit} {latin,Latin,greek,Greek,misc} {\mathbfsfit} - } - { - \seq_put_right:Nn \g_um_default_mathalph_seq {#1} - \exp_after:wN \um_new_mathstyle:N \use_i:nnn #1 - } -% \end{macrocode} -% These are `false' mathstyles that inherit other definitions: -% \begin{macrocode} - \um_new_mathstyle:N \mathsf - \um_new_mathstyle:N \mathbf - \um_new_mathstyle:N \mathbfsf -% \end{macrocode} -% \begin{macrocode} - } -% \end{macrocode} % % % \subsection{Defining the math style macros} @@ -3511,340 +2256,528 @@ This work is "maintained" by Will Robertson. % we call `bold' the math style |bf| and within it there are upper and lower % case Greek and Roman alphabets and Arabic numerals. % -% \begin{macro}{\um_prepare_mathstyle:n} +% \begin{macro}{\@@_prepare_mathstyle:n} % \darg{math style name (e.g., \texttt{it} or \texttt{bb})} % Define the high level math alphabet macros (\cs{mathit}, etc.) in terms of % unicode-math definitions. Use \cs{bgroup}/\cs{egroup} so s'scripts scan the % whole thing. % -% The flag \cs{l_um_mathstyle_tl} is for other applications to query the +% The flag \cs{l_@@_mathstyle_tl} is for other applications to query the % current math style. % \begin{macrocode} -\cs_new:Nn \um_prepare_mathstyle:n +\cs_new:Nn \@@_prepare_mathstyle:n { - \um_init_alphabet:x {#1} - \cs_set:cpn {_um_math#1_aux:n} ##1 - { - \use:c {um_switchto_math#1:} ##1 \egroup - } - \cs_set_protected:cpx {math#1} + \seq_put_right:Nn \g_@@_mathstyles_seq {#1} + \@@_init_alphabet:n {#1} + \cs_set:cpn {_@@_sym_#1_aux:n} + { \use:c {@@_switchto_#1:} \math@egroup } + \cs_set_protected:cpx {sym#1} { \exp_not:n { - \bgroup + \math@bgroup \mode_if_math:F { \egroup\expandafter - \non@alpherr\expandafter{\csname math#1\endcsname\space} + \non@alpherr\expandafter{\csname sym#1\endcsname\space} } - \tl_set:Nn \l_um_mathstyle_tl {#1} + \tl_set:Nn \l_@@_mathstyle_tl {#1} } - \exp_not:c {_um_math#1_aux:n} + \exp_not:c {_@@_sym_#1_aux:n} } } -\tl_new:N \l_um_mathstyle_tl -\cs_generate_variant:Nn \um_prepare_mathstyle:n {f} % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_init_alphabet:n} +% +% \begin{macro}{\@@_init_alphabet:n} % \darg{math alphabet name (e.g., \texttt{it} or \texttt{bb})} % This macro initialises the macros used to set up a math alphabet. -% First used with the math alphabet macro is first defined, but then used +% First used when the math alphabet macro is first defined, but then used % later when redefining a particular maths alphabet. % \begin{macrocode} -\cs_set:Nn \um_init_alphabet:n +\cs_set:Nn \@@_init_alphabet:n + { + \@@_log:nx {alph-initialise} {#1} + \cs_set_eq:cN {@@_switchto_#1:} \prg_do_nothing: + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Definition of alphabets and styles} +% +% First of all, we break up unicode into `named ranges', such as |up|, |bb|, |sfup|, and so on, which refer to specific blocks of unicode that contain various symbols (usually alphabetical symbols). +% +% \begin{macrocode} +\cs_new:Nn \@@_new_named_range:n + { + \prop_new:c {g_@@_named_range_#1_prop} + } +\clist_set:Nn \g_@@_named_ranges_clist + { + up, it, tt, bfup, bfit, bb , bbit, scr, bfscr, cal, bfcal, + frak, bffrak, sfup, sfit, bfsfup, bfsfit, bfsf + } +\clist_map_inline:Nn \g_@@_named_ranges_clist + { \@@_new_named_range:n {#1} } +% \end{macrocode} +% +% Each of these styles usually contains one or more `alphabets', which are currently |latin|, |Latin|, |greek|, |Greek|, |num|, and |misc|, although there's an implicit potential for more. +% |misc| is not included in the official list to avoid checking code. +% \begin{macrocode} +\clist_new:N \g_@@_alphabets_seq +\clist_set:Nn \g_@@_alphabets_seq { latin, Latin, greek, Greek, num } +% \end{macrocode} +% +% Each alphabet style needs to be configured. +% This happens in the |unicode-math-alphabets.dtx| file. +% \begin{macrocode} +\cs_new:Nn \@@_new_alphabet_config:nnn { - \um_log:nx {alph-initialise} {#1} - \cs_set_eq:cN {um_switchto_math#1:} \prg_do_nothing: + \prop_if_exist:cF {g_@@_named_range_#1_prop} + { \@@_warning:nnn {no-named-range} {#1} {#2} } + + \prop_gput:cnn {g_@@_named_range_#1_prop} { alpha_tl } + { + \prop_item:cn {g_@@_named_range_#1_prop} { alpha_tl } + {#2} + } + % Q: do I need to bother removing duplicates? + + \cs_new:cn { @@_config_#1_#2:n } {#3} } -\cs_generate_variant:Nn \um_init_alphabet:n {x} % \end{macrocode} -% Variants (cannot use |\cs_generate_variant:Nn| because the base function is -% defined dynamically.) % \begin{macrocode} -\cs_new:Npn \um_maybe_init_alphabet:V +\cs_new:Nn \@@_alphabet_config:nnn { \use:c {@@_config_#1_#2:n} {#3} } +% \end{macrocode} +% \begin{macrocode} +\prg_new_conditional:Nnn \@@_if_alphabet_exists:nn {T,TF} { - \exp_args:NV \um_maybe_init_alphabet:n + \cs_if_exist:cTF {@@_config_#1_#2:n} + \prg_return_true: \prg_return_false: } % \end{macrocode} -% \end{macro} % -% \subsection{Defining the math alphabets per style} +% The linking between named ranges and symbol style commands happens here. +% It's currently not using all of the machinery we're in the process of setting up above. +% Baby steps. +% \begin{macrocode} +\cs_new:Nn \@@_default_mathalph:nnn + { + \seq_put_right:Nx \g_@@_named_ranges_seq { \tl_to_str:n {#1} } + \seq_put_right:Nn \g_@@_default_mathalph_seq {{#1}{#2}{#3}} + } +\@@_default_mathalph:nnn {up } {latin,Latin,greek,Greek,num,misc} {up } +\@@_default_mathalph:nnn {it } {latin,Latin,greek,Greek,misc} {it } +\@@_default_mathalph:nnn {bb } {latin,Latin,num,misc} {bb } +\@@_default_mathalph:nnn {bbit } {misc} {bbit } +\@@_default_mathalph:nnn {scr } {latin,Latin} {scr } +\@@_default_mathalph:nnn {cal } {Latin} {scr } +\@@_default_mathalph:nnn {bfcal } {Latin} {bfscr } +\@@_default_mathalph:nnn {frak } {latin,Latin} {frak } +\@@_default_mathalph:nnn {tt } {latin,Latin,num} {tt } +\@@_default_mathalph:nnn {sfup } {latin,Latin,num} {sfup } +\@@_default_mathalph:nnn {sfit } {latin,Latin} {sfit } +\@@_default_mathalph:nnn {bfup } {latin,Latin,greek,Greek,num,misc} {bfup } +\@@_default_mathalph:nnn {bfit } {latin,Latin,greek,Greek,misc} {bfit } +\@@_default_mathalph:nnn {bfscr } {latin,Latin} {bfscr } +\@@_default_mathalph:nnn {bffrak} {latin,Latin} {bffrak} +\@@_default_mathalph:nnn {bfsfup} {latin,Latin,greek,Greek,num,misc} {bfsfup} +\@@_default_mathalph:nnn {bfsfit} {latin,Latin,greek,Greek,misc} {bfsfit} +% \end{macrocode} % +% \subsubsection{Define symbol style commands} +% Finally, all of the `symbol styles' commands are set up, which are the commands to access each of the named alphabet styles. There is not a one-to-one mapping between symbol style commands and named style ranges! +% \begin{macrocode} +\clist_map_inline:nn + { + up, it, bfup, bfit, sfup, sfit, bfsfup, bfsfit, bfsf, + tt, bb, bbit, scr, bfscr, cal, bfcal, frak, bffrak, + normal, literal, sf, bf, + } + { \@@_prepare_mathstyle:n {#1} } +% \end{macrocode} % -% Variables: +% +% \subsubsection{New names for legacy textmath alphabet selection} +% In case a package option overwrites, say, \cs{mathbf} with \cs{symbf}. % \begin{macrocode} -\seq_new:N \l_um_missing_alph_seq +\clist_map_inline:nn + { rm, it, bf, sf, tt } + { \cs_set_eq:cc { mathtext #1 } { math #1 } } % \end{macrocode} +% Perhaps these should actually be defined using a hypothetical unicode-math interface to creating new such styles. To come. +% +% +% \subsubsection{Replacing legacy pure-maths alphabets} +% The following are alphabets which do not have a math/text ambiguity. +% \begin{macrocode} +\clist_map_inline:nn + { + normal, bb , bbit, scr, bfscr, cal, bfcal, frak, bffrak, tt, + bfup, bfit, sfup, sfit, bfsfup, bfsfit, bfsf + } + { + \cs_set:cpx { math #1 } { \exp_not:c { sym #1 } } + } +% \end{macrocode} +% % -% \begin{macro}{\um_setup_alphabets:} +% \subsubsection{New commands for ambiguous alphabets} +% \begin{macrocode} +\AtBeginDocument{ +\clist_map_inline:nn + { rm, it, bf, sf, tt } + { + \cs_set_protected:cpx { math #1 } + { + \exp_not:n { \bool_if:NTF } \exp_not:c { g_@@_ math #1 _text_bool} + { \exp_not:c { mathtext #1 } } + { \exp_not:c { sym #1 } } + } + }} +% \end{macrocode} +% +% \paragraph{Alias \cs{mathrm} as legacy name for \cs{mathup}} +% \begin{macrocode} +\cs_set_protected:Npn \mathup { \mathrm } +\cs_set_protected:Npn \symrm { \symup } +% \end{macrocode} +% +% +% \subsubsection{Fixing up \cs{operator@font}} +% +%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}|. +% +%It turns out that hooking into |\operator@font| is hard because all other maths font selection in 2e uses |\mathrm{...}| style. +% +%Then reading source2e a little more I stumbled upon: (in the definition of |\select@group|) +%\begin{quote} +% We surround |\select@group| with braces so that functions using it can be used directly after |_| or |^|. However, if we use oldstyle syntax where the math alphabet doesn’t have arguments (ie if |\math@bgroup| is not |\bgroup|) we need to get rid of the extra group. +%\end{quote} +%So there's a trick we can use. +%Because it's late and I'm tired, I went for the first thing that jumped out at me: +%\begin{Verbatim} +% \documentclass{article} +% \DeclareMathAlphabet\mathfoo{OT1}{lmdh}{m}{n} +% \begin{document} +% \makeatletter +% ${\operator@font Mod}\, x$ +% +% \def\operator@font{% +% \let \math@bgroup \relax +% \def \math@egroup {\let \math@bgroup \@@math@bgroup +% \let \math@egroup \@@math@egroup}% +% \mathfoo} +% ${\operator@font Mod}\, x$ +% \end{document} +%\end{Verbatim} +% We define a new math alphabet |\mathfoo| to select the Latin Modern Dunhill font, and then locally redefine |\math@bgroup| to allow |\mathfoo| to be used without an argument temporarily. +% +% Now that I've written this whole thing out, another solution pops to mind: +%\begin{Verbatim} +% \documentclass{article} +% \DeclareSymbolFont{foo}{OT1}{lmdh}{m}{n} +% \DeclareSymbolFontAlphabet\mathfoo{foo} +% \begin{document} +% \makeatletter +% ${\operator@font Mod}\, x$ +% +% \def\operator@font{\mathgroup\symfoo} +% ${\operator@font Mod}\, x$ +% \end{document} +%\end{Verbatim} +%I guess that's the better approach!! +% +% Or perhaps I should just use |\@fontswitch| to do the first solution with a nicer wrapper. I really should read things more carefully: +% \begin{macro}{\operator@font} +% \begin{macrocode} +\cs_set:Npn \operator@font + { + \@@_switchto_literal: + \@fontswitch {} { \g_@@_operator_mathfont_tl } + } +% \end{macrocode} +% \end{macro} +% +% +% \subsection{Defining the math alphabets per style} +% +% \begin{macro}{\@@_setup_alphabets:} % This function is called within \cs{setmathfont} to configure the % mapping between characters inside math styles. % \begin{macrocode} -\cs_new:Npn \um_setup_alphabets: +\cs_new:Npn \@@_setup_alphabets: { % \end{macrocode} % If |range=| has been used to configure styles, those choices will be in -% |\l_um_mathalph_seq|. If not, set up the styles implicitly: -% \begin{macrocode} - \seq_if_empty:NTF \l_um_mathalph_seq { - \um_log:n {setup-implicit} - \seq_set_eq:NN \l_um_mathalph_seq \g_um_default_mathalph_seq - \bool_set_true:N \l_um_implicit_alph_bool - \um_maybe_init_alphabet:n {sf} - \um_maybe_init_alphabet:n {bf} - \um_maybe_init_alphabet:n {bfsf} - } +% |\l_@@_mathalph_seq|. If not, set up the styles implicitly: +% \begin{macrocode} + \seq_if_empty:NTF \l_@@_mathalph_seq + { + \@@_log:n {setup-implicit} + \seq_set_eq:NN \l_@@_mathalph_seq \g_@@_default_mathalph_seq + \bool_set_true:N \l_@@_implicit_alph_bool + \@@_maybe_init_alphabet:n {sf} + \@@_maybe_init_alphabet:n {bf} + \@@_maybe_init_alphabet:n {bfsf} + } % \end{macrocode} % If |range=| has been used then we're in explicit mode: % \begin{macrocode} - { - \um_log:n {setup-explicit} - \bool_set_false:N \l_um_implicit_alph_bool - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_noparse:Nnn - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_noparse:nn - } + { + \@@_log:n {setup-explicit} + \bool_set_false:N \l_@@_implicit_alph_bool + \cs_set_eq:NN \@@_set_mathalphabet_char:nnn \@@_mathmap_noparse:nnn + \cs_set_eq:NN \@@_map_char_single:nn \@@_map_char_noparse:nn + } % \end{macrocode} % Now perform the mapping: % \begin{macrocode} - \seq_map_inline:Nn \l_um_mathalph_seq { - \tl_set:No \l_um_tmpa_tl { \use_i:nnn ##1 } - \tl_set:No \l_um_tmpb_tl { \use_ii:nnn ##1 } - \tl_set:No \l_um_remap_style_tl { \use_iii:nnn ##1 } - \tl_set:Nx \l_um_remap_style_tl { - \exp_after:wN \exp_after:wN \exp_after:wN \use_none:nnnnn - \exp_after:wN \token_to_str:N \l_um_remap_style_tl - } - \tl_if_empty:NT \l_um_tmpb_tl { - \cs_set_eq:NN \um_maybe_init_alphabet:n \um_init_alphabet:n - \tl_set:Nn \l_um_tmpb_tl { latin,Latin,greek,Greek,num,misc } - } - \um_setup_math_alphabet:VVV - \l_um_tmpa_tl \l_um_tmpb_tl \l_um_remap_style_tl - } - \seq_if_empty:NF \l_um_missing_alph_seq { \um_log:n { missing-alphabets } } + \seq_map_inline:Nn \l_@@_mathalph_seq + { + \tl_set:No \l_@@_style_tl { \use_i:nnn ##1 } + \clist_set:No \l_@@_alphabet_clist { \use_ii:nnn ##1 } + \tl_set:No \l_@@_remap_style_tl { \use_iii:nnn ##1 } + + \clist_if_empty:NT \l_@@_alphabet_clist + { + \cs_set_eq:NN \@@_maybe_init_alphabet:n \@@_init_alphabet:n + \clist_set:Nn \l_@@_alphabet_clist { latin, Latin, greek, Greek, num, misc } + } + + \@@_setup_math_alphabet:NNN + \l_@@_style_tl \l_@@_alphabet_clist \l_@@_remap_style_tl + } + \seq_if_empty:NF \l_@@_missing_alph_seq { \@@_log:n { missing-alphabets } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_setup_math_alphabet:Nnn} -% \darg{Math font style command (e.g., \cs{mathbb})} +% \begin{macro}{\@@_setup_math_alphabet:NNN} +% \darg{Math font style (e.g., \cs{bb})} % \darg{Math alphabets, comma separated of \{latin,Latin,greek,Greek,num\}} -% \darg{Name of the output math style (usually same as input \texttt{bb})} +% \darg{Name of the output math style (usually same as the name of the style \texttt{bb})} % \begin{macrocode} -\cs_new:Nn \um_setup_math_alphabet:Nnn +\cs_new:Nn \@@_setup_math_alphabet:NNN { - \tl_set:Nx \l_um_style_tl - { - \exp_after:wN \use_none:nnnnn \token_to_str:N #1 - } + \tl_set_eq:NN \l_@@_style_tl #1% actually a no-op but makes the code clearer! % \end{macrocode} -% First check that at least one of the alphabets for the font shape is defined\dots +% First check that at least one of the alphabets for the font shape is defined +% (this process is fast) \dots % \begin{macrocode} - \clist_map_inline:nn {#2} + \clist_map_inline:Nn #2 { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {##1} } - \cs_if_exist:cT {um_config_ \l_um_style_tl _\l_um_tmpa_tl :n} + \tl_set:Nn \l_@@_alphabet_tl {##1} + \@@_if_alphabet_exists:nnTF \l_@@_style_tl \l_@@_alphabet_tl { - \str_if_eq_x:nnTF {\l_um_tmpa_tl}{misc} + \str_if_eq_x:nnTF {\l_@@_alphabet_tl} {misc} { - \um_maybe_init_alphabet:V \l_um_style_tl + \@@_maybe_init_alphabet:n \l_@@_style_tl \clist_map_break: } { - \um_glyph_if_exist:cT { \um_to_usv:nn {#3}{\l_um_tmpa_tl} } + \@@_glyph_if_exist:nT { \@@_to_usv:nn {\l_@@_style_tl} {\l_@@_alphabet_tl} } { - \um_maybe_init_alphabet:V \l_um_style_tl + \@@_maybe_init_alphabet:n \l_@@_style_tl \clist_map_break: } } } + { \msg_warning:nnx {unicode-math} {no-alphabet} { \l_@@_style_tl / \l_@@_alphabet_tl } } } % \end{macrocode} % \dots and then loop through them defining the individual ranges: +% (currently this process is slow) % \begin{macrocode} - \clist_map_inline:nn {#2} + \csname TIC\endcsname + \clist_map_inline:Nn #2 { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {##1} } - \cs_if_exist:cT {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} + \tl_set:Nx \l_@@_alphabet_tl { \tl_trim_spaces:n {##1} } + \cs_if_exist:cT {@@_config_ \l_@@_style_tl _ \l_@@_alphabet_tl :n} { - \str_if_eq_x:nnTF {\l_um_tmpa_tl}{misc} + \exp_args:No \tl_if_eq:nnTF \l_@@_alphabet_tl {misc} { - \um_log:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} + \@@_log:nx {setup-alph} {math \l_@@_style_tl~(\l_@@_alphabet_tl)} + \@@_alphabet_config:nnn {\l_@@_style_tl} {\l_@@_alphabet_tl} {#3} } { - \um_glyph_if_exist:cTF { \um_to_usv:nn {#3}{\l_um_tmpa_tl} } + \@@_glyph_if_exist:nTF { \@@_to_usv:nn {\l_@@_style_tl} {\l_@@_alphabet_tl} } { - \um_log:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} + \@@_log:nx {setup-alph} {math \l_@@_style_tl~(\l_@@_alphabet_tl)} + \@@_alphabet_config:nnn {\l_@@_style_tl} {\l_@@_alphabet_tl} {#3} } { - \bool_if:NTF \l_um_implicit_alph_bool + \bool_if:NTF \l_@@_implicit_alph_bool { - \seq_put_right:Nx \l_um_missing_alph_seq + \seq_put_right:Nx \l_@@_missing_alph_seq { - \@backslashchar math \l_um_style_tl \space - (\tl_use:c{c_um_math_alphabet_name_ \l_um_tmpa_tl _tl}) + \@backslashchar sym \l_@@_style_tl \space + (\tl_use:c{c_@@_math_alphabet_name_ \l_@@_alphabet_tl _tl}) } } { - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {up} + \@@_alphabet_config:nnn {\l_@@_style_tl} {\l_@@_alphabet_tl} {up} } } } } } + \csname TOC\endcsname } -\cs_generate_variant:Nn \um_setup_math_alphabet:Nnn {VVV} % \end{macrocode} % \end{macro} % % -% % \subsection{Mapping `naked' math characters} % % Before we show the definitions of the alphabet mappings using the functions -% |\um_config_\l_um_style_tl_##1:n|, we first want to define some functions +% |\@@_alphabet_config:nnn \l_@@_style_tl {##1} {...}|, we first want to define some functions % to be used inside them to actually perform the character mapping. % % \subsubsection{Functions} % -% \begin{macro}{\um_map_char_single:nn} -% Wrapper for |\um_map_char_noparse:nn| or |\um_map_char_parse:nn| +% \begin{macro}{\@@_map_char_single:nn} +% Wrapper for |\@@_map_char_noparse:nn| or |\@@_map_char_parse:nn| % depending on the context. -% Cannot use |\cs_generate_variant:Nn| because the base function is -% defined dynamically. -% \begin{macrocode} -\cs_new:Npn \um_map_char_single:cc { \exp_args:Ncc \um_map_char_single:nn } -% \end{macrocode} -% \end{macro} -% % -% \begin{macro}{\um_map_char_noparse:nn} -% \begin{macro}{\um_map_char_parse:nn} +% \begin{macro}{\@@_map_char_noparse:nn} +% \begin{macro}{\@@_map_char_parse:nn} % \begin{macrocode} -\cs_new:Nn \um_map_char_noparse:nn - { - \um_set_mathcode:nnnn {#1}{\mathalpha}{\um_symfont_tl}{#2} - } +\cs_new:Nn \@@_map_char_noparse:nn + { \@@_set_mathcode:nnnn {#1}{\mathalpha}{\@@_symfont_tl}{#2} } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_map_char_parse:nn +\cs_new:Nn \@@_map_char_parse:nn { - \um_if_char_spec:nNNT {#1} {\@nil} {\mathalpha} - { - \um_map_char_noparse:nn {#1}{#2} - } + \@@_if_char_spec:nNNT {#1} {\@nil} {\mathalpha} + { \@@_map_char_noparse:nn {#1}{#2} } } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % -% \begin{macro}{\um_map_single:nnn} +% \begin{macro}{\@@_map_char_single:nnn} % \darg{char name (`dotlessi')} % \darg{from alphabet(s)} % \darg{to alphabet} +% Logical interface to \cs{@@_map_char_single:nn}. % \begin{macrocode} -\cs_new:Nn \um_map_char_single:nnn +\cs_new:Nn \@@_map_char_single:nnn { - \um_map_char_single:cc { \um_to_usv:nn {#1}{#3} } - { \um_to_usv:nn {#2}{#3} } - } -\cs_set:Nn \um_map_single:nnn - { - \cs_if_exist:cT { \um_to_usv:nn {#3} {#1} } - { - \clist_map_inline:nn {#2} - { - \um_map_char_single:nnn {##1} {#3} {#1} - } - } + \@@_map_char_single:nn { \@@_to_usv:nn {#1}{#3} } + { \@@_to_usv:nn {#2}{#3} } } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\um_map_chars_range:nnnn} +% \begin{macro}{\@@_map_chars_range:nnnn} % \darg{Number of chars (26)} % \darg{From style, one or more (it)} % \darg{To style (up)} % \darg{Alphabet name (Latin)} % First the function with numbers: % \begin{macrocode} -\cs_set:Nn \um_map_chars_range:nnn +\cs_set:Nn \@@_map_chars_range:nnn { - \int_step_inline:nnnn {0}{1}{#1-1} { - \um_map_char_single:nn {#2+##1}{#3+##1} - } + \int_step_inline:nnnn {0}{1}{#1-1} + { \@@_map_char_single:nn {#2+##1}{#3+##1} } } -\cs_generate_variant:Nn \um_map_chars_range:nnn {ncc} % \end{macrocode} % And the wrapper with names: % \begin{macrocode} -\cs_new:Nn \um_map_chars_range:nnnn +\cs_new:Nn \@@_map_chars_range:nnnn { - \um_map_chars_range:ncc {#1} { \um_to_usv:nn {#2}{#4} } - { \um_to_usv:nn {#3}{#4} } + \@@_map_chars_range:nnn {#1} { \@@_to_usv:nn {#2}{#4} } + { \@@_to_usv:nn {#3}{#4} } } % \end{macrocode} % \end{macro} % -% \subsubsection{Functions for alphabets} +% \subsubsection{Functions for `normal' alphabet symbols} +% +% \begin{macro}{\@@_set_normal_char:nnn} +% \begin{macrocode} +\cs_set:Nn \@@_set_normal_char:nnn + { + \@@_usv_if_exist:nnT {#3} {#1} + { + \clist_map_inline:nn {#2} + { + \@@_set_mathalphabet_pos:nnnn {normal} {#1} {##1} {#3} + \@@_map_char_single:nnn {##1} {#3} {#1} + } + } + } +% \end{macrocode} +% \end{macro} % % \begin{macrocode} -\cs_new:Nn \um_map_chars_Latin:nn +\cs_new:Nn \@@_set_normal_Latin:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {26} {##1} {#2} {Latin} + \@@_set_mathalphabet_Latin:nnn {normal} {##1} {#2} + \@@_map_chars_range:nnnn {26} {##1} {#2} {Latin} } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_map_chars_latin:nn +\cs_new:Nn \@@_set_normal_latin:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {26} {##1} {#2} {latin} + \@@_set_mathalphabet_latin:nnn {normal} {##1} {#2} + \@@_map_chars_range:nnnn {26} {##1} {#2} {latin} } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_map_chars_greek:nn +\cs_new:Nn \@@_set_normal_greek:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {25} {##1} {#2} {greek} - \um_map_char_single:nnn {##1} {#2} {varepsilon} - \um_map_char_single:nnn {##1} {#2} {vartheta} - \um_map_char_single:nnn {##1} {#2} {varkappa} - \um_map_char_single:nnn {##1} {#2} {varphi} - \um_map_char_single:nnn {##1} {#2} {varrho} - \um_map_char_single:nnn {##1} {#2} {varpi} + \@@_set_mathalphabet_greek:nnn {normal} {##1} {#2} + \@@_map_chars_range:nnnn {25} {##1} {#2} {greek} + \@@_map_char_single:nnn {##1} {#2} {varepsilon} + \@@_map_char_single:nnn {##1} {#2} {vartheta} + \@@_map_char_single:nnn {##1} {#2} {varkappa} + \@@_map_char_single:nnn {##1} {#2} {varphi} + \@@_map_char_single:nnn {##1} {#2} {varrho} + \@@_map_char_single:nnn {##1} {#2} {varpi} + \@@_set_mathalphabet_pos:nnnn {normal} {varepsilon} {##1} {#2} + \@@_set_mathalphabet_pos:nnnn {normal} {vartheta} {##1} {#2} + \@@_set_mathalphabet_pos:nnnn {normal} {varkappa} {##1} {#2} + \@@_set_mathalphabet_pos:nnnn {normal} {varphi} {##1} {#2} + \@@_set_mathalphabet_pos:nnnn {normal} {varrho} {##1} {#2} + \@@_set_mathalphabet_pos:nnnn {normal} {varpi} {##1} {#2} } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_map_chars_Greek:nn +\cs_new:Nn \@@_set_normal_Greek:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {25} {##1} {#2} {Greek} - \um_map_char_single:nnn {##1} {#2} {varTheta} + \@@_set_mathalphabet_Greek:nnn {normal} {##1} {#2} + \@@_map_chars_range:nnnn {25} {##1} {#2} {Greek} + \@@_map_char_single:nnn {##1} {#2} {varTheta} + \@@_set_mathalphabet_pos:nnnn {normal} {varTheta} {##1} {#2} } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_map_chars_numbers:nn +\cs_new:Nn \@@_set_normal_numbers:nn { - \um_map_chars_range:nnnn {10} {#1} {#2} {num} + \@@_set_mathalphabet_numbers:nnn {normal} {#1} {#2} + \@@_map_chars_range:nnnn {10} {#1} {#2} {num} } % \end{macrocode} % @@ -3853,71 +2786,63 @@ This work is "maintained" by Will Robertson. % % \subsubsection{Functions for setting up the maths alphabets} % -% \begin{macro}{\um_set_mathalphabet_char:Nnn} -% This is a wrapper for either |\um_mathmap_noparse:Nnn| or -% |\um_mathmap_parse:Nnn|, depending on the context. -% Cannot use |\cs_generate_variant:Nn| because the base function is -% defined dynamically. -% \begin{macrocode} -\cs_new:Npn \um_set_mathalphabet_char:Ncc - { - \exp_args:NNcc \um_set_mathalphabet_char:Nnn - } -% \end{macrocode} +% \begin{macro}{\@@_set_mathalphabet_char:Nnn} +% This is a wrapper for either |\@@_mathmap_noparse:nnn| or +% |\@@_mathmap_parse:Nnn|, depending on the context. % \end{macro} % -% \begin{macro}{\um_mathmap_noparse:Nnn} -% \darg{Maths alphabet, \eg, \cmd\mathbb} +% \begin{macro}{\@@_mathmap_noparse:nnn} +% \darg{Maths alphabet, \eg, `bb'} % \darg{Input slot(s), \eg, the slot for `A' (comma separated)} % \darg{Output slot, \eg, the slot for `$\mathbb{A}$'} -% Adds \cs{um_set_mathcode:nnnn} declarations to the specified maths alphabet's definition. +% Adds \cs{@@_set_mathcode:nnnn} declarations to the specified maths alphabet's definition. % \begin{macrocode} -\cs_new:Nn \um_mathmap_noparse:Nnn +\cs_new:Nn \@@_mathmap_noparse:nnn { \clist_map_inline:nn {#2} { - \tl_put_right:cx {um_switchto_\cs_to_str:N #1:} + \tl_put_right:cx {@@_switchto_#1:} { - \um_set_mathcode:nnnn{##1}{\mathalpha}{\um_symfont_tl}{#3} + \@@_set_mathcode:nnnn {##1} {\mathalpha} {\@@_symfont_tl} {#3} } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_mathmap_parse:Nnn} -% \darg{Maths alphabet, \eg, \cmd\mathbb} +% \begin{macro}{\@@_mathmap_parse:nnn} +% \darg{Maths alphabet, \eg, `bb'} % \darg{Input slot(s), \eg, the slot for `A' (comma separated)} % \darg{Output slot, \eg, the slot for `$\mathbb{A}$'} -% When \cmd\um_if_char_spec:nNNT\ is executed, it populates the \cmd\l_um_char_num_range_clist\ +% When \cmd\@@_if_char_spec:nNNT\ is executed, it populates the \cmd\l_@@_char_nrange_clist\ % macro with slot numbers corresponding to the specified range. This range is used to -% conditionally add \cs{um_set_mathcode:nnnn} declaractions to the maths alphabet definition. +% conditionally add \cs{@@_set_mathcode:nnnn} declaractions to the maths alphabet definition. % \begin{macrocode} -\cs_new:Nn \um_mathmap_parse:Nnn +\cs_new:Nn \@@_mathmap_parse:nnn { - \clist_if_in:NnT \l_um_char_num_range_clist {#3} + \clist_if_in:NnT \l_@@_char_nrange_clist {#3} { - \um_mathmap_noparse:Nnn {#1}{#2}{#3} + \@@_mathmap_noparse:nnn {#1}{#2}{#3} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_set_mathalphabet_char:Nnnn} +% \begin{macro}{\@@_set_mathalphabet_char:nnnn} % \darg{math style command} % \darg{input math alphabet name} % \darg{output math alphabet name} % \darg{char name to map} % \begin{macrocode} -\cs_new:Nn \um_set_mathalphabet_char:Nnnn +\cs_new:Nn \@@_set_mathalphabet_char:nnnn { - \um_set_mathalphabet_char:Ncc #1 { \um_to_usv:nn {#2} {#4} } - { \um_to_usv:nn {#3} {#4} } + \@@_set_mathalphabet_char:nnn {#1} { \@@_to_usv:nn {#2} {#4} } + { \@@_to_usv:nn {#3} {#4} } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_set_mathalph_range:nNnn} +% \begin{macro}{\@@_set_mathalph_range:nnnn} % \darg{Number of iterations} % \darg{Maths alphabet} % \darg{Starting input char (single)} @@ -3925,19 +2850,18 @@ This work is "maintained" by Will Robertson. % Loops through character ranges setting \cmd\mathcode. % First the version that uses numbers: % \begin{macrocode} -\cs_new:Nn \um_set_mathalph_range:nNnn +\cs_new:Nn \@@_set_mathalph_range:nnnn { - \int_step_inline:nnnn {0}{1}{#1-1} - { \um_set_mathalphabet_char:Nnn {#2} { ##1 + #3 } { ##1 + #4 } } + \int_step_inline:nnnn {0} {1} {#1-1} + { \@@_set_mathalphabet_char:nnn {#2} { ##1 + #3 } { ##1 + #4 } } } -\cs_generate_variant:Nn \um_set_mathalph_range:nNnn {nNcc} % \end{macrocode} % Then the wrapper version that uses names: % \begin{macrocode} -\cs_new:Nn \um_set_mathalph_range:nNnnn +\cs_new:Nn \@@_set_mathalph_range:nnnnn { - \um_set_mathalph_range:nNcc {#1} #2 { \um_to_usv:nn {#3} {#5} } - { \um_to_usv:nn {#4} {#5} } + \@@_set_mathalph_range:nnnn {#1} {#2} { \@@_to_usv:nn {#3} {#5} } + { \@@_to_usv:nn {#4} {#5} } } % \end{macrocode} % \end{macro} @@ -3945,955 +2869,71 @@ This work is "maintained" by Will Robertson. % \subsubsection{Individual mapping functions for different alphabets} % % \begin{macrocode} -\cs_new:Nn \um_set_mathalphabet_pos:Nnnn +\cs_new:Nn \@@_set_mathalphabet_pos:nnnn { - \cs_if_exist:cT { \um_to_usv:nn {#4}{#2} } + \@@_usv_if_exist:nnT {#4} {#2} { \clist_map_inline:nn {#3} - { \um_set_mathalphabet_char:Nnnn #1 {##1} {#4} {#2} } + { \@@_set_mathalphabet_char:nnnn {#1} {##1} {#4} {#2} } } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_set_mathalphabet_numbers:Nnn +\cs_new:Nn \@@_set_mathalphabet_numbers:nnn { \clist_map_inline:nn {#2} - { \um_set_mathalph_range:nNnnn {10} #1 {##1} {#3} {num} } + { \@@_set_mathalph_range:nnnnn {10} {#1} {##1} {#3} {num} } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_set_mathalphabet_Latin:Nnn +\cs_new:Nn \@@_set_mathalphabet_Latin:nnn { \clist_map_inline:nn {#2} - { \um_set_mathalph_range:nNnnn {26} #1 {##1} {#3} {Latin} } + { \@@_set_mathalph_range:nnnnn {26} {#1} {##1} {#3} {Latin} } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_set_mathalphabet_latin:Nnn +\cs_new:Nn \@@_set_mathalphabet_latin:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {26} #1 {##1} {#3} {latin} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {h} + \@@_set_mathalph_range:nnnnn {26} {#1} {##1} {#3} {latin} + \@@_set_mathalphabet_char:nnnn {#1} {##1} {#3} {h} } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_set_mathalphabet_Greek:Nnn +\cs_new:Nn \@@_set_mathalphabet_Greek:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {25} #1 {##1} {#3} {Greek} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varTheta} + \@@_set_mathalph_range:nnnnn {25} {#1} {##1} {#3} {Greek} + \@@_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varTheta} } } % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \um_set_mathalphabet_greek:Nnn +\cs_new:Nn \@@_set_mathalphabet_greek:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {25} #1 {##1} {#3} {greek} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varepsilon} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {vartheta} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varkappa} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varphi} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varrho} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varpi} - } - } -% \end{macrocode} -% -% \subsection{Alphabets} -% -% \subsubsection{Upright: \cmd\mathup} -% \begin{macrocode} -\cs_new:Nn \um_config_up_num:n - { - \um_map_chars_numbers:nn {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathup {up}{#1} - } - -\cs_new:Nn \um_config_up_Latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Latin:nn {up} {#1} } - { - \bool_if:NT \g_um_upLatin_bool { \um_map_chars_Latin:nn {up,it} {#1} } - } - \um_set_mathalphabet_Latin:Nnn \mathup {up,it} {#1} - } - -\cs_new:Nn \um_config_up_latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_latin:nn {up} {#1} } - { - \bool_if:NT \g_um_uplatin_bool - { - \um_map_chars_latin:nn {up,it} {#1} - \um_map_single:nnn {h} {up,it} {#1} - \um_map_single:nnn {dotlessi} {up,it} {#1} - \um_map_single:nnn {dotlessj} {up,it} {#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathup {up,it}{#1} - } - -\cs_new:Nn \um_config_up_Greek:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Greek:nn {up}{#1} } - { - \bool_if:NT \g_um_upGreek_bool { \um_map_chars_Greek:nn {up,it}{#1} } - } - \um_set_mathalphabet_Greek:Nnn \mathup {up,it}{#1} - } - -\cs_new:Nn \um_config_up_greek:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_greek:nn {up} {#1} } - { - \bool_if:NT \g_um_upgreek_bool - { - \um_map_chars_greek:nn {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathup {up,it} {#1} - } - -\cs_new:Nn \um_config_up_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{up}{up} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{up,it}{up} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{up}{up} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{up,it}{up} - } - } - \um_set_mathalphabet_pos:Nnnn \mathup {partial} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {Nabla} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {dotlessi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {dotlessj} {up,it} {#1} - } -% \end{macrocode} -% -% \subsubsection{Italic: \cmd\mathit} -% -% \begin{macrocode} -\cs_new:Nn \um_config_it_Latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Latin:nn {it} {#1} } - { - \bool_if:NF \g_um_upLatin_bool { \um_map_chars_Latin:nn {up,it} {#1} } - } - \um_set_mathalphabet_Latin:Nnn \mathit {up,it}{#1} - } - -\cs_new:Nn \um_config_it_latin:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_latin:nn {it} {#1} - \um_map_single:nnn {h}{it}{#1} - } - { - \bool_if:NF \g_um_uplatin_bool - { - \um_map_chars_latin:nn {up,it} {#1} - \um_map_single:nnn {h}{up,it}{#1} - \um_map_single:nnn {dotlessi}{up,it}{#1} - \um_map_single:nnn {dotlessj}{up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathit {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathit {dotlessi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathit {dotlessj} {up,it} {#1} - } - -\cs_new:Nn \um_config_it_Greek:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_Greek:nn {it}{#1} - } - { - \bool_if:NF \g_um_upGreek_bool { \um_map_chars_Greek:nn {up,it}{#1} } - } - \um_set_mathalphabet_Greek:Nnn \mathit {up,it}{#1} - } - -\cs_new:Nn \um_config_it_greek:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_greek:nn {it} {#1} - } - { - \bool_if:NF \g_um_upgreek_bool { \um_map_chars_greek:nn {it,up} {#1} } - } - \um_set_mathalphabet_greek:Nnn \mathit {up,it} {#1} - } - -\cs_new:Nn \um_config_it_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{it}{it} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{up,it}{it} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{it}{it} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{up,it}{it} - } - } - \um_set_mathalphabet_pos:Nnnn \mathit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathit {Nabla} {up,it}{#1} - } -% \end{macrocode} -% -% \subsubsection{Blackboard or double-struck: \cmd\mathbb\ and \cmd\mathbbit} -% -% \begin{macrocode} -\cs_new:Nn \um_config_bb_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbb {up,it}{#1} - } - -\cs_new:Nn \um_config_bb_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbb {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {C} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {H} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {N} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {P} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Q} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {R} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Z} {up,it} {#1} - } - -\cs_new:Nn \um_config_bb_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbb {up}{#1} - } - -\cs_new:Nn \um_config_bb_misc:n - { - \um_set_mathalphabet_pos:Nnnn \mathbb {Pi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {pi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Gamma} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {gamma} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {summation} {up} {#1} - } - -\cs_new:Nn \um_config_bbit_misc:n - { - \um_set_mathalphabet_pos:Nnnn \mathbbit {D} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {d} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {e} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {i} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {j} {up,it} {#1} - } -% \end{macrocode} -% -% \subsubsection{Script and caligraphic: \cmd\mathscr\ and \cmd\mathcal} -% -% \begin{macrocode} -\cs_new:Nn \um_config_scr_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathscr {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {B}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {E}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {F}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {L}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {M}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {R}{up,it}{#1} - } - -\cs_new:Nn \um_config_scr_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathscr {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {e}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {g}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {o}{up,it}{#1} - } -% \end{macrocode} -% These are by default synonyms for the above, but with the STIX -% fonts we want to use the alternate alphabet. -% \begin{macrocode} -\cs_new:Nn \um_config_cal_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathcal {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {B}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {E}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {F}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {L}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {M}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {R}{up,it}{#1} - } -% \end{macrocode} -% -% \subsubsection{Fractur or fraktur or blackletter: \cmd\mathfrak} -% -% \begin{macrocode} -\cs_new:Nn \um_config_frak_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathfrak {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {C}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {R}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {Z}{up,it}{#1} - } -\cs_new:Nn \um_config_frak_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathfrak {up,it}{#1} - } -% \end{macrocode} -% -% \subsubsection{Sans serif upright: \cmd\mathsfup} -% \begin{macrocode} -\cs_new:Nn \um_config_sfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathsf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathsfup {up}{#1} - } -\cs_new:Nn \um_config_sfup_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {sfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathsfup {up,it}{#1} - } -\cs_new:Nn \um_config_sfup_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {sfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathsfup {up,it}{#1} - } -% \end{macrocode} -% -% \subsubsection{Sans serif italic: \cmd\mathsfit} -% -% \begin{macrocode} -\cs_new:Nn \um_config_sfit_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathsfit {up,it}{#1} - } -\cs_new:Nn \um_config_sfit_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathsfit {up,it}{#1} - } -% \end{macrocode} -% -% \subsubsection{Typewriter or monospaced: \cmd\mathtt} -% \begin{macrocode} -\cs_new:Nn \um_config_tt_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathtt {up}{#1} - } -\cs_new:Nn \um_config_tt_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathtt {up,it}{#1} - } -\cs_new:Nn \um_config_tt_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathtt {up,it}{#1} - } -% \end{macrocode} -% -% -% \subsubsection{Bold Italic: \cmd\mathbfit} -% \begin{macrocode} -\cs_new:Nn \um_config_bfit_Latin:n - { - \bool_if:NF \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_Latin:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Latin:nn {bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_latin:n - { - \bool_if:NF \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_latin:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_latin:nn {bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_Greek:n - { - \um_set_mathalphabet_Greek:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Greek:nn {bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfupGreek_bool - { - \um_map_chars_Greek:nn {bfup,bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_greek:n - { - \um_set_mathalphabet_greek:Nnn \mathbfit {up,it} {#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_greek:nn {bfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {it} {#1} - } - { - \bool_if:NF \g_um_bfupgreek_bool - { - \um_map_chars_greek:nn {bfit,bfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up,it} {#1} - } - } - } - -\cs_new:Nn \um_config_bfit_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { \um_map_single:nnn {Nabla}{bfit}{#1} } - { - \bool_if:NF \g_um_upNabla_bool - { \um_map_single:nnn {Nabla}{bfup,bfit}{#1} } - } - \bool_if:NTF \g_um_literal_partial_bool - { \um_map_single:nnn {partial}{bfit}{#1} } - { - \bool_if:NF \g_um_uppartial_bool - { \um_map_single:nnn {partial}{bfup,bfit}{#1} } - } - \um_set_mathalphabet_pos:Nnnn \mathbfit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfit {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {it}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {it}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up,it}{#1} - } + \@@_set_mathalph_range:nnnnn {25} {#1} {##1} {#3} {greek} + \@@_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varepsilon} + \@@_set_mathalphabet_char:nnnn {#1} {##1} {#3} {vartheta} + \@@_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varkappa} + \@@_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varphi} + \@@_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varrho} + \@@_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varpi} } } % \end{macrocode} % % -% \subsubsection{Bold Upright: \cmd\mathbfup} -% \begin{macrocode} -\cs_new:Nn \um_config_bfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathbfup {up}{#1} - } - -\cs_new:Nn \um_config_bfup_Latin:n - { - \bool_if:NT \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_Latin:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Latin:nn {bfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfup_latin:n - { - \bool_if:NT \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_latin:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_latin:nn {bfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up,it}{#1} - } - } - } -\cs_new:Nn \um_config_bfup_Greek:n - { - \um_set_mathalphabet_Greek:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Greek:nn {bfup}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfupGreek_bool - { - \um_map_chars_Greek:nn {bfup,bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfup_greek:n - { - \um_set_mathalphabet_greek:Nnn \mathbfup {up,it} {#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_greek:nn {bfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up} {#1} - } - { - \bool_if:NT \g_um_bfupgreek_bool - { - \um_map_chars_greek:nn {bfup,bfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up,it} {#1} - } - } - } - -\cs_new:Nn \um_config_bfup_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfup}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfup,bfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfup}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfup,bfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfup {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {Nabla} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {Digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbf {digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbf {Digamma} {up}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up,it}{#1} - } - } - } -% \end{macrocode} -% -% \subsubsection{Bold fractur or fraktur or blackletter: \cmd\mathbffrak} -% \begin{macrocode} -\cs_new:Nn \um_config_bffrak_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbffrak {up,it}{#1} - } - -\cs_new:Nn \um_config_bffrak_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbffrak {up,it}{#1} - } -% \end{macrocode} -% -% \subsubsection{Bold script or calligraphic: \cmd\mathbfscr} -% \begin{macrocode} -\cs_new:Nn \um_config_bfscr_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbfscr {up,it}{#1} - } -\cs_new:Nn \um_config_bfscr_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbfscr {up,it}{#1} - } -\cs_new:Nn \um_config_bfcal_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbfcal {up,it}{#1} - } -% \end{macrocode} -% -% \subsubsection{Bold upright sans serif: \cmd\mathbfsfup} -% \begin{macrocode} -\cs_new:Nn \um_config_bfsfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbfsf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathbfsfup {up}{#1} - } -\cs_new:Nn \um_config_bfsfup_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {bfsfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {bfsfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_Greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Greek:nn {bfsfup}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Greek:nn {bfsfup,bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Greek:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_greek:nn {bfsfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up} {#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_greek:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathbfsfup {up,it} {#1} - } -\cs_new:Nn \um_config_bfsfup_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup,bfsfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfsfup}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfsfup,bfsfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfsfup {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfsfup {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up,it}{#1} - } - } - } -% \end{macrocode} -% -% -% \subsubsection{Bold italic sans serif: \cmd\mathbfsfit} -% \begin{macrocode} -\cs_new:Nn \um_config_bfsfit_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_Greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Greek:nn {bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Greek:nn {bfsfup,bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Greek:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_greek:nn {bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {it} {#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_greek:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathbfsfit {up,it} {#1} - } - -\cs_new:Nn \um_config_bfsfit_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfsfit}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup,bfsfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfsfit}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfsfup,bfsfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfsfit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfsfit {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {it}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {it}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up,it}{#1} - } - } - } -% \end{macrocode} % % \section{A token list to contain the data of the math table} % @@ -4906,24 +2946,24 @@ This work is "maintained" by Will Robertson. % In time, the case statement inside |set_mathsymbol| will be moved in here % to avoid re-running it every time. % \begin{macrocode} -\cs_new:Npn \um_symbol_setup: +\cs_new:Npn \@@_symbol_setup: { \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { - \exp_not:n { \_um_sym:nnn {##1} {##2} {##3} } + \exp_not:n { \_@@_sym:nnn {##1} {##2} {##3} } } } % \end{macrocode} % % \begin{macrocode} -\CatchFileEdef \g_um_mathtable_tl {unicode-math-table.tex} {\um_symbol_setup:} +\CatchFileEdef \g_@@_mathtable_tl {unicode-math-table.tex} {\@@_symbol_setup:} % \end{macrocode} % % -% \begin{macro}{\um_input_math_symbol_table:} +% \begin{macro}{\@@_input_math_symbol_table:} % This function simply expands to the token list containing all the data. % \begin{macrocode} -\cs_new:Nn \um_input_math_symbol_table: {\g_um_mathtable_tl} +\cs_new:Nn \@@_input_math_symbol_table: {\g_@@_mathtable_tl} % \end{macrocode} % \end{macro} % @@ -4933,9 +2973,9 @@ This work is "maintained" by Will Robertson. % Here we define every Unicode math codepoint an equivalent macro name. % The two are equivalent, in a |\let\xyz=^^^^1234| kind of way. % -% \begin{macro}{\um_cs_set_eq_active_char:Nw} -% \begin{macro}{\um_active_char_set:wc} -% We need to do some trickery to transform the |\_um_sym:nnn| argument +% \begin{macro}{\@@_cs_set_eq_active_char:Nw} +% \begin{macro}{\@@_active_char_set:wc} +% We need to do some trickery to transform the |\_@@_sym:nnn| argument % |"ABCDEF| into the \XeTeX\ `caret input' form |^^^^^abcdef|. It is \emph{very important} % that the argument has five characters. Otherwise we need to change the number of |^| chars. % @@ -4945,7 +2985,7 @@ This work is "maintained" by Will Robertson. % \begin{macrocode} \group_begin: \char_set_catcode_other:N \^ - \cs_gset:Npn \um_cs_set_eq_active_char:Nw #1 = "#2 \q_nil + \cs_gset:Npn \@@_cs_set_eq_active_char:Nw #1 = "#2 \q_nil { \tex_lowercase:D { @@ -4969,7 +3009,7 @@ This work is "maintained" by Will Robertson. % Because we're inside a |\tl_rescan:nn|, use plain old \TeX\ syntax to avoid % any catcode problems. % \begin{macrocode} - \cs_new:Npn \um_active_char_set:wc "#1 \q_nil #2 + \cs_new:Npn \@@_active_char_set:wc "#1 \q_nil #2 { \tex_lowercase:D { @@ -4982,31 +3022,28 @@ This work is "maintained" by Will Robertson. % \end{macro} % \end{macro} % -% Now give \cmd\_um_sym:nnn\ a definition in terms of \cmd\um_cs_set_eq_active_char:Nw\ +% Now give \cmd\_@@_sym:nnn\ a definition in terms of \cmd\@@_cs_set_eq_active_char:Nw\ % and we're good to go. % % Ensure catcodes are appropriate; % make sure |#| is an `other' so that we don't get confused with \cs{mathoctothorpe}. % \begin{macrocode} -\AtBeginDocument{\um_define_math_chars:} -\cs_new:Nn \um_define_math_chars: +\AtBeginDocument{\@@_define_math_chars:} +\cs_new:Nn \@@_define_math_chars: { \group_begin: \char_set_catcode_math_superscript:N \^ - \cs_set:Npn \_um_sym:nnn ##1##2##3 + \cs_set:Npn \_@@_sym:nnn ##1##2##3 { - \bool_if:nF { \cs_if_eq_p:NN ##3 \mathaccent || - \cs_if_eq_p:NN ##3 \mathopen || - \cs_if_eq_p:NN ##3 \mathclose || - \cs_if_eq_p:NN ##3 \mathover || - \cs_if_eq_p:NN ##3 \mathunder || - \cs_if_eq_p:NN ##3 \mathbotaccent } + \tl_if_in:nnT + { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence } + {##3} { - \um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces + \@@_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces } } \char_set_catcode_other:N \# - \um_input_math_symbol_table: + \@@_input_math_symbol_table: \group_end: } % \end{macrocode} @@ -5030,14 +3067,17 @@ This work is "maintained" by Will Robertson. % \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 { \um_load_lm_if_necessary: } -\cs_new:Nn \um_load_lm_if_necessary: +\AtBeginDocument { \@@_load_lm_if_necessary: } +\cs_new:Nn \@@_load_lm_if_necessary: { - \cs_if_exist:NF \l_um_fontname_tl + \cs_if_exist:NF \l_@@_fontname_tl { - % XXX: update this when lmmath-bold.otf is released - \setmathfont[BoldFont={latinmodern-math.otf}]{latinmodern-math.otf} + % 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} @@ -5096,73 +3136,67 @@ This work is "maintained" by Will Robertson. % 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 \um_arg_i_before_egroup:n {#1\egroup} -\cs_new:Nn \um_superscript:n +\cs_new:Nn \@@_arg_i_before_egroup:n {#1\egroup} +\cs_new:Nn \@@_superscript:n { ^\bgroup #1 - \peek_meaning_remove:NTF ^ \um_arg_i_before_egroup:n \egroup + \peek_meaning_remove:NTF ^ \@@_arg_i_before_egroup:n \egroup } % \end{macrocode} % % \begin{macrocode} -\muskip_new:N \g_um_primekern_muskip -\muskip_gset:Nn \g_um_primekern_muskip { -\thinmuskip/2 }% arbitrary -\int_new:N \l_um_primecount_int -% \end{macrocode} -% -% \begin{macrocode} -\cs_new:Nn \um_nprimes:Nn +\cs_new:Nn \@@_nprimes:Nn { - \um_superscript:n + \@@_superscript:n { #1 - \prg_replicate:nn {#2-1} { \mskip \g_um_primekern_muskip #1 } + \prg_replicate:nn {#2-1} { \mskip \g_@@_primekern_muskip #1 } } } -\cs_new:Nn \um_nprimes_select:nn +\cs_new:Nn \@@_nprimes_select:nn { - \int_case:nnn {#2} + \int_case:nnF {#2} { - {1} { \um_superscript:n {#1} } + {1} { \@@_superscript:n {#1} } {2} { - \um_glyph_if_exist:nTF {"2033} - { \um_superscript:n {\um_prime_double_mchar} } - { \um_nprimes:Nn #1 {#2} } + \@@_glyph_if_exist:nTF {"2033} + { \@@_superscript:n {\@@_prime_double_mchar} } + { \@@_nprimes:Nn #1 {#2} } } {3} { - \um_glyph_if_exist:nTF {"2034} - { \um_superscript:n {\um_prime_triple_mchar} } - { \um_nprimes:Nn #1 {#2} } + \@@_glyph_if_exist:nTF {"2034} + { \@@_superscript:n {\@@_prime_triple_mchar} } + { \@@_nprimes:Nn #1 {#2} } } {4} { - \um_glyph_if_exist:nTF {"2057} - { \um_superscript:n {\um_prime_quad_mchar} } - { \um_nprimes:Nn #1 {#2} } + \@@_glyph_if_exist:nTF {"2057} + { \@@_superscript:n {\@@_prime_quad_mchar} } + { \@@_nprimes:Nn #1 {#2} } } } { - \um_nprimes:Nn #1 {#2} + \@@_nprimes:Nn #1 {#2} } } -\cs_new:Nn \um_nbackprimes_select:nn +\cs_new:Nn \@@_nbackprimes_select:nn { - \int_case:nnn {#2} + \int_case:nnF {#2} { - {1} { \um_superscript:n {#1} } + {1} { \@@_superscript:n {#1} } {2} { - \um_glyph_if_exist:nTF {"2036} - { \um_superscript:n {\um_backprime_double_mchar} } - { \um_nprimes:Nn #1 {#2} } + \@@_glyph_if_exist:nTF {"2036} + { \@@_superscript:n {\@@_backprime_double_mchar} } + { \@@_nprimes:Nn #1 {#2} } } {3} { - \um_glyph_if_exist:nTF {"2037} - { \um_superscript:n {\um_backprime_triple_mchar} } - { \um_nprimes:Nn #1 {#2} } + \@@_glyph_if_exist:nTF {"2037} + { \@@_superscript:n {\@@_backprime_triple_mchar} } + { \@@_nprimes:Nn #1 {#2} } } } { - \um_nprimes:Nn #1 {#2} + \@@_nprimes:Nn #1 {#2} } } % \end{macrocode} @@ -5170,99 +3204,99 @@ This work is "maintained" by Will Robertson. % Scanning is annoying because I'm too lazy to do it for the general case. % % \begin{macrocode} -\cs_new:Npn \um_scan_prime: +\cs_new:Npn \@@_scan_prime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_zero:N \l_um_primecount_int - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \@@_superscript:n \use:n + \int_zero:N \l_@@_primecount_int + \@@_scanprime_collect:N \@@_prime_single_mchar } -\cs_new:Npn \um_scan_dprime: +\cs_new:Npn \@@_scan_dprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {1} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \@@_superscript:n \use:n + \int_set:Nn \l_@@_primecount_int {1} + \@@_scanprime_collect:N \@@_prime_single_mchar } -\cs_new:Npn \um_scan_trprime: +\cs_new:Npn \@@_scan_trprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \@@_superscript:n \use:n + \int_set:Nn \l_@@_primecount_int {2} + \@@_scanprime_collect:N \@@_prime_single_mchar } -\cs_new:Npn \um_scan_qprime: +\cs_new:Npn \@@_scan_qprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \@@_superscript:n \use:n + \int_set:Nn \l_@@_primecount_int {3} + \@@_scanprime_collect:N \@@_prime_single_mchar } -\cs_new:Npn \um_scan_sup_prime: +\cs_new:Npn \@@_scan_sup_prime: { - \int_zero:N \l_um_primecount_int - \um_scanprime_collect:N \um_prime_single_mchar + \int_zero:N \l_@@_primecount_int + \@@_scanprime_collect:N \@@_prime_single_mchar } -\cs_new:Npn \um_scan_sup_dprime: +\cs_new:Npn \@@_scan_sup_dprime: { - \int_set:Nn \l_um_primecount_int {1} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l_@@_primecount_int {1} + \@@_scanprime_collect:N \@@_prime_single_mchar } -\cs_new:Npn \um_scan_sup_trprime: +\cs_new:Npn \@@_scan_sup_trprime: { - \int_set:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l_@@_primecount_int {2} + \@@_scanprime_collect:N \@@_prime_single_mchar } -\cs_new:Npn \um_scan_sup_qprime: +\cs_new:Npn \@@_scan_sup_qprime: { - \int_set:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l_@@_primecount_int {3} + \@@_scanprime_collect:N \@@_prime_single_mchar } -\cs_new:Nn \um_scanprime_collect:N +\cs_new:Nn \@@_scanprime_collect:N { - \int_incr:N \l_um_primecount_int + \int_incr:N \l_@@_primecount_int \peek_meaning_remove:NTF ' - { \um_scanprime_collect:N #1 } + { \@@_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_prime: - { \um_scanprime_collect:N #1 } + \peek_meaning_remove:NTF \@@_scan_prime: + { \@@_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2032 - { \um_scanprime_collect:N #1 } + { \@@_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_dprime: + \peek_meaning_remove:NTF \@@_scan_dprime: { - \int_incr:N \l_um_primecount_int - \um_scanprime_collect:N #1 + \int_incr:N \l_@@_primecount_int + \@@_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2033 { - \int_incr:N \l_um_primecount_int - \um_scanprime_collect:N #1 + \int_incr:N \l_@@_primecount_int + \@@_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_trprime: + \peek_meaning_remove:NTF \@@_scan_trprime: { - \int_add:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N #1 + \int_add:Nn \l_@@_primecount_int {2} + \@@_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2034 { - \int_add:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N #1 + \int_add:Nn \l_@@_primecount_int {2} + \@@_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_qprime: + \peek_meaning_remove:NTF \@@_scan_qprime: { - \int_add:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N #1 + \int_add:Nn \l_@@_primecount_int {3} + \@@_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2057 { - \int_add:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N #1 + \int_add:Nn \l_@@_primecount_int {3} + \@@_scanprime_collect:N #1 } { - \um_nprimes_select:nn {#1} {\l_um_primecount_int} + \@@_nprimes_select:nn {#1} {\l_@@_primecount_int} } } } @@ -5273,82 +3307,82 @@ This work is "maintained" by Will Robertson. } } } -\cs_new:Npn \um_scan_backprime: +\cs_new:Npn \@@_scan_backprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_zero:N \l_um_primecount_int - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \@@_superscript:n \use:n + \int_zero:N \l_@@_primecount_int + \@@_scanbackprime_collect:N \@@_backprime_single_mchar } -\cs_new:Npn \um_scan_backdprime: +\cs_new:Npn \@@_scan_backdprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {1} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \@@_superscript:n \use:n + \int_set:Nn \l_@@_primecount_int {1} + \@@_scanbackprime_collect:N \@@_backprime_single_mchar } -\cs_new:Npn \um_scan_backtrprime: +\cs_new:Npn \@@_scan_backtrprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \@@_superscript:n \use:n + \int_set:Nn \l_@@_primecount_int {2} + \@@_scanbackprime_collect:N \@@_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backprime: +\cs_new:Npn \@@_scan_sup_backprime: { - \int_zero:N \l_um_primecount_int - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_zero:N \l_@@_primecount_int + \@@_scanbackprime_collect:N \@@_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backdprime: +\cs_new:Npn \@@_scan_sup_backdprime: { - \int_set:Nn \l_um_primecount_int {1} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_set:Nn \l_@@_primecount_int {1} + \@@_scanbackprime_collect:N \@@_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backtrprime: +\cs_new:Npn \@@_scan_sup_backtrprime: { - \int_set:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_set:Nn \l_@@_primecount_int {2} + \@@_scanbackprime_collect:N \@@_backprime_single_mchar } -\cs_new:Nn \um_scanbackprime_collect:N +\cs_new:Nn \@@_scanbackprime_collect:N { - \int_incr:N \l_um_primecount_int + \int_incr:N \l_@@_primecount_int \peek_meaning_remove:NTF ` { - \um_scanbackprime_collect:N #1 + \@@_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backprime: + \peek_meaning_remove:NTF \@@_scan_backprime: { - \um_scanbackprime_collect:N #1 + \@@_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2035 { - \um_scanbackprime_collect:N #1 + \@@_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backdprime: + \peek_meaning_remove:NTF \@@_scan_backdprime: { - \int_incr:N \l_um_primecount_int - \um_scanbackprime_collect:N #1 + \int_incr:N \l_@@_primecount_int + \@@_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2036 { - \int_incr:N \l_um_primecount_int - \um_scanbackprime_collect:N #1 + \int_incr:N \l_@@_primecount_int + \@@_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backtrprime: + \peek_meaning_remove:NTF \@@_scan_backtrprime: { - \int_add:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N #1 + \int_add:Nn \l_@@_primecount_int {2} + \@@_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2037 { - \int_add:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N #1 + \int_add:Nn \l_@@_primecount_int {2} + \@@_scanbackprime_collect:N #1 } { - \um_nbackprimes_select:nn {#1} {\l_um_primecount_int} + \@@_nbackprimes_select:nn {#1} {\l_@@_primecount_int} } } } @@ -5360,16 +3394,16 @@ This work is "maintained" by Will Robertson. % \end{macrocode} % % \begin{macrocode} -\AtBeginDocument{\um_define_prime_commands: \um_define_prime_chars:} -\cs_new:Nn \um_define_prime_commands: +\AtBeginDocument{\@@_define_prime_commands: \@@_define_prime_chars:} +\cs_new:Nn \@@_define_prime_commands: { - \cs_set_eq:NN \prime \um_prime_single_mchar - \cs_set_eq:NN \dprime \um_prime_double_mchar - \cs_set_eq:NN \trprime \um_prime_triple_mchar - \cs_set_eq:NN \qprime \um_prime_quad_mchar - \cs_set_eq:NN \backprime \um_backprime_single_mchar - \cs_set_eq:NN \backdprime \um_backprime_double_mchar - \cs_set_eq:NN \backtrprime \um_backprime_triple_mchar + \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 \' @@ -5381,17 +3415,17 @@ This work is "maintained" by Will Robertson. \char_set_catcode_active:n {"2035} \char_set_catcode_active:n {"2036} \char_set_catcode_active:n {"2037} - \cs_gset:Nn \um_define_prime_chars: - { - \cs_set_eq:NN ' \um_scan_sup_prime: - \cs_set_eq:NN ^^^^2032 \um_scan_sup_prime: - \cs_set_eq:NN ^^^^2033 \um_scan_sup_dprime: - \cs_set_eq:NN ^^^^2034 \um_scan_sup_trprime: - \cs_set_eq:NN ^^^^2057 \um_scan_sup_qprime: - \cs_set_eq:NN ` \um_scan_sup_backprime: - \cs_set_eq:NN ^^^^2035 \um_scan_sup_backprime: - \cs_set_eq:NN ^^^^2036 \um_scan_sup_backdprime: - \cs_set_eq:NN ^^^^2037 \um_scan_sup_backtrprime: + \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} @@ -5399,8 +3433,8 @@ This work is "maintained" by Will Robertson. % \subsection{Unicode radicals} % % \begin{macrocode} -\AtBeginDocument{\um_redefine_radical:} -\cs_new:Nn \um_redefine_radical: +\AtBeginDocument{\@@_redefine_radical:} +\cs_new:Nn \@@_redefine_radical: %<*XE> { \@ifpackageloaded { amsmath } { } @@ -5411,7 +3445,7 @@ This work is "maintained" by Will Robertson. % \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 + \cs_set_nopar:Npn \r@@@@t ##1 ##2 { \hbox_set:Nn \l_tmpa_box { @@ -5421,16 +3455,16 @@ This work is "maintained" by Will Robertson. \sqrtsign { ##2 } \c_math_toggle_token } - \um_mathstyle_scale:Nnn ##1 { \kern } - { \fontdimen 63 \l_um_font } + \@@_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_um_font / 100 + * \number \fontdimen 65 \l_@@_font / 100 } { \box_use:N \rootbox } - \um_mathstyle_scale:Nnn ##1 { \kern } - { \fontdimen 64 \l_um_font } + \@@_mathstyle_scale:Nnn ##1 { \kern } + { \fontdimen 64 \l_@@_font } \box_use_clear:N \l_tmpa_box } % \end{macrocode} @@ -5449,7 +3483,7 @@ This work is "maintained" by Will Robertson. % \begin{macrocode} \cs_set:Npn \root ##1 \of ##2 { - \luatexUroot \l_um_radical_sqrt_tl { ##1 } { ##2 } + \luatexUroot \l_@@_radical_sqrt_tl { ##1 } { ##2 } } % \end{macrocode} % \end{macro} @@ -5460,40 +3494,40 @@ This work is "maintained" by Will Robertson. % \end{macrocode} % % -% \begin{macro}{\um_fontdimen_to_percent:nn} -% \begin{macro}{\um_fontdimen_to_scale:nn} +% \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{um_fontdimen_to_percent:nn} takes a font dimension number and outputs the decimal value of the associated parameter. -% \cs{um_fontdimen_to_scale:nn} returns a dimension correspond to the current +% \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 \um_fontdimen_to_percent:nn +\cs_new:Nn \@@_fontdimen_to_percent:nn { - \strip@pt\dimexpr\fontdimen#1#2*65536/100\relax + \fp_eval:n { \dim_to_decimal:n { \fontdimen #1 #2 } * 65536 / 100 } } -\cs_new:Nn \um_fontdimen_to_scale:nn +\cs_new:Nn \@@_fontdimen_to_scale:nn { - \um_fontdimen_to_percent:nn {#1} {#2} \dimexpr \f@size pt\relax + \fp_eval:n {\@@_fontdimen_to_percent:nn {#1} {#2} * \f@size } pt } % \end{macrocode} % \end{macro} % \end{macro} % -% \begin{macro}{\um_mathstyle_scale:Nnn} +% \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 \um_mathstyle_scale:Nnn +\cs_new:Nn \@@_mathstyle_scale:Nnn { \ifx#1\scriptstyle - #2 \um_fontdimen_to_percent:nn {10} \l_um_font #3 + #2 \@@_fontdimen_to_percent:nn {10} \l_@@_font #3 \else \ifx#1\scriptscriptstyle - #2 \um_fontdimen_to_percent:nn {11} \l_um_font #3 + #2 \@@_fontdimen_to_percent:nn {11} \l_@@_font #3 \else #2 #3 \fi @@ -5516,8 +3550,6 @@ This work is "maintained" by Will Robertson. % Open question: should the superscript-like `modifiers' (\unichar{1D2C} % {modifier capital letter a} and on) be included here? % \begin{macrocode} -\prop_new:N \g_um_supers_prop -\prop_new:N \g_um_subs_prop \group_begin: % \end{macrocode} % \paragraph{Superscripts} @@ -5529,92 +3561,97 @@ This work is "maintained" by Will Robertson. % \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 \um_setup_active_superscript:nn +\cs_new:Nn \@@_setup_active_superscript:nn { - \prop_gput:Nxn \g_um_supers_prop {\meaning #1} {#2} + \prop_gput:Non \g_@@_supers_prop {\meaning #1} {#2} \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \@@_char_gmake_mathactive:N #1 \scantokens { \cs_gset:Npn #1 { - \tl_set:Nn \l_um_ss_chain_tl {#2} - \cs_set_eq:NN \um_sub_or_super:n \sp - \tl_set:Nn \l_um_tmpa_tl {supers} - \um_scan_sscript: + \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} -\um_setup_active_superscript:nn {^^^^2070} {0} -\um_setup_active_superscript:nn {^^^^00b9} {1} -\um_setup_active_superscript:nn {^^^^00b2} {2} -\um_setup_active_superscript:nn {^^^^00b3} {3} -\um_setup_active_superscript:nn {^^^^2074} {4} -\um_setup_active_superscript:nn {^^^^2075} {5} -\um_setup_active_superscript:nn {^^^^2076} {6} -\um_setup_active_superscript:nn {^^^^2077} {7} -\um_setup_active_superscript:nn {^^^^2078} {8} -\um_setup_active_superscript:nn {^^^^2079} {9} -\um_setup_active_superscript:nn {^^^^207a} {+} -\um_setup_active_superscript:nn {^^^^207b} {-} -\um_setup_active_superscript:nn {^^^^207c} {=} -\um_setup_active_superscript:nn {^^^^207d} {(} -\um_setup_active_superscript:nn {^^^^207e} {)} -\um_setup_active_superscript:nn {^^^^2071} {i} -\um_setup_active_superscript:nn {^^^^207f} {n} +\@@_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 \um_setup_active_subscript:nn +\cs_new:Nn \@@_setup_active_subscript:nn { - \prop_gput:Nxn \g_um_subs_prop {\meaning #1} {#2} + \prop_gput:Non \g_@@_subs_prop {\meaning #1} {#2} \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \@@_char_gmake_mathactive:N #1 \scantokens { \cs_gset:Npn #1 { - \tl_set:Nn \l_um_ss_chain_tl {#2} - \cs_set_eq:NN \um_sub_or_super:n \sb - \tl_set:Nn \l_um_tmpa_tl {subs} - \um_scan_sscript: + \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} -\um_setup_active_subscript:nn {^^^^2080} {0} -\um_setup_active_subscript:nn {^^^^2081} {1} -\um_setup_active_subscript:nn {^^^^2082} {2} -\um_setup_active_subscript:nn {^^^^2083} {3} -\um_setup_active_subscript:nn {^^^^2084} {4} -\um_setup_active_subscript:nn {^^^^2085} {5} -\um_setup_active_subscript:nn {^^^^2086} {6} -\um_setup_active_subscript:nn {^^^^2087} {7} -\um_setup_active_subscript:nn {^^^^2088} {8} -\um_setup_active_subscript:nn {^^^^2089} {9} -\um_setup_active_subscript:nn {^^^^208a} {+} -\um_setup_active_subscript:nn {^^^^208b} {-} -\um_setup_active_subscript:nn {^^^^208c} {=} -\um_setup_active_subscript:nn {^^^^208d} {(} -\um_setup_active_subscript:nn {^^^^208e} {)} -\um_setup_active_subscript:nn {^^^^2090} {a} -\um_setup_active_subscript:nn {^^^^2091} {e} -\um_setup_active_subscript:nn {^^^^1d62} {i} -\um_setup_active_subscript:nn {^^^^2092} {o} -\um_setup_active_subscript:nn {^^^^1d63} {r} -\um_setup_active_subscript:nn {^^^^1d64} {u} -\um_setup_active_subscript:nn {^^^^1d65} {v} -\um_setup_active_subscript:nn {^^^^2093} {x} -\um_setup_active_subscript:nn {^^^^1d66} {\beta} -\um_setup_active_subscript:nn {^^^^1d67} {\gamma} -\um_setup_active_subscript:nn {^^^^1d68} {\rho} -\um_setup_active_subscript:nn {^^^^1d69} {\phi} -\um_setup_active_subscript:nn {^^^^1d6a} {\chi} +\@@_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 {^^^^1d62} {i} +\@@_setup_active_subscript:nn {^^^^2092} {o} +\@@_setup_active_subscript:nn {^^^^1d63} {r} +\@@_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} @@ -5622,14 +3659,14 @@ This work is "maintained" by Will Robertson. % \end{macrocode} % The scanning command, evident in its purpose: % \begin{macrocode} -\cs_new:Npn \um_scan_sscript: +\cs_new:Npn \@@_scan_sscript: { - \um_scan_sscript:TF + \@@_scan_sscript:TF { - \um_scan_sscript: + \@@_scan_sscript: } { - \um_sub_or_super:n {\l_um_ss_chain_tl} + \@@_sub_or_super:n {\l_@@_ss_chain_tl} } } % \end{macrocode} @@ -5637,19 +3674,19 @@ This work is "maintained" by Will Robertson. % Consider this function as simply boilerplate: % TODO: move all this to expl3, and don't use internal expl3 macros. % \begin{macrocode} -\cs_new:Npn \um_scan_sscript:TF #1#2 +\cs_new:Npn \@@_scan_sscript:TF #1#2 { \tl_set:Nx \__peek_true_aux:w { \exp_not:n{ #1 } } \tl_set_eq:NN \__peek_true:w \__peek_true_remove:w \tl_set:Nx \__peek_false:w { \exp_not:n { \group_align_safe_end: #2 } } \group_align_safe_begin: - \peek_after:Nw \um_peek_execute_branches_ss: + \peek_after:Nw \@@_peek_execute_branches_ss: } % \end{macrocode} % We do not skip spaces when scanning ahead, and we explicitly wish to % bail out on encountering a space or a brace. % \begin{macrocode} -\cs_new:Npn \um_peek_execute_branches_ss: +\cs_new:Npn \@@_peek_execute_branches_ss: { \bool_if:nTF { @@ -5658,7 +3695,7 @@ This work is "maintained" by Will Robertson. \token_if_eq_meaning_p:NN \l_peek_token \c_space_token } { \__peek_false:w } - { \um_peek_execute_branches_ss_aux: } + { \@@_peek_execute_branches_ss_aux: } } % \end{macrocode} % This is the actual comparison code. @@ -5672,14 +3709,14 @@ This work is "maintained" by Will Robertson. % build up a chain of sub-/superscripts and iterate. (If not, exit and % typeset what we've already collected.) % \begin{macrocode} -\cs_new:Npn \um_peek_execute_branches_ss_aux: +\cs_new:Npn \@@_peek_execute_branches_ss_aux: { - \prop_if_in:cxTF - {g_um_\l_um_tmpa_tl _prop} {\meaning\l_peek_token} + \prop_if_in:coTF + {g_@@_\l_@@_tmpa_tl _prop} {\meaning\l_peek_token} { - \prop_get:cxN - {g_um_\l_um_tmpa_tl _prop} {\meaning\l_peek_token} \l_um_tmpb_tl - \tl_put_right:NV \l_um_ss_chain_tl \l_um_tmpb_tl + \prop_get:coN + {g_@@_\l_@@_tmpa_tl _prop} {\meaning\l_peek_token} \l_@@_tmpb_tl + \tl_put_right:NV \l_@@_ss_chain_tl \l_@@_tmpb_tl \__peek_true:w } { \__peek_false:w } @@ -5692,10 +3729,10 @@ This work is "maintained" by Will Robertson. % \LaTeX\ fraction declaration. % % \begin{macrocode} -\cs_new:Npn \um_define_active_frac:Nw #1 #2/#3 +\cs_new:Npn \@@_define_active_frac:Nw #1 #2/#3 { \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \@@_char_gmake_mathactive:N #1 \tl_rescan:nn { \catcode`\_=11\relax @@ -5704,7 +3741,7 @@ This work is "maintained" by Will Robertson. { \cs_gset:Npx #1 { - \bool_if:NTF \l_um_smallfrac_bool {\exp_not:N\tfrac} {\exp_not:N\frac} + \bool_if:NTF \l_@@_smallfrac_bool {\exp_not:N\tfrac} {\exp_not:N\frac} {#2} {#3} } } @@ -5713,31 +3750,31 @@ This work is "maintained" by Will Robertson. % These are redefined for each math font selection in case the |active-frac| % feature changes. % \begin{macrocode} -\cs_new:Npn \um_setup_active_frac: +\cs_new:Npn \@@_setup_active_frac: { \group_begin: - \um_define_active_frac:Nw ^^^^2189 0/3 - \um_define_active_frac:Nw ^^^^2152 1/{10} - \um_define_active_frac:Nw ^^^^2151 1/9 - \um_define_active_frac:Nw ^^^^215b 1/8 - \um_define_active_frac:Nw ^^^^2150 1/7 - \um_define_active_frac:Nw ^^^^2159 1/6 - \um_define_active_frac:Nw ^^^^2155 1/5 - \um_define_active_frac:Nw ^^^^00bc 1/4 - \um_define_active_frac:Nw ^^^^2153 1/3 - \um_define_active_frac:Nw ^^^^215c 3/8 - \um_define_active_frac:Nw ^^^^2156 2/5 - \um_define_active_frac:Nw ^^^^00bd 1/2 - \um_define_active_frac:Nw ^^^^2157 3/5 - \um_define_active_frac:Nw ^^^^215d 5/8 - \um_define_active_frac:Nw ^^^^2154 2/3 - \um_define_active_frac:Nw ^^^^00be 3/4 - \um_define_active_frac:Nw ^^^^2158 4/5 - \um_define_active_frac:Nw ^^^^215a 5/6 - \um_define_active_frac:Nw ^^^^215e 7/8 + \@@_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: } -\um_setup_active_frac: +\@@_setup_active_frac: % \end{macrocode} % % \subsection{Synonyms and all the rest} @@ -5771,13 +3808,30 @@ This work is "maintained" by Will Robertson. \def\backepsilon{\upbackepsilon} \def\eth{\matheth} % \end{macrocode} +% These are names that are `frozen' in HTML but have dumb names: +% \begin{macrocode} +\def\dbkarow {\dbkarrow} +\def\drbkarow{\drbkarrow} +\def\hksearow{\hksearrow} +\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} -\def\smallint{{\textstyle\int}\limits} +\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 `|:|'. @@ -5791,7 +3845,7 @@ This work is "maintained" by Will Robertson. { \cs_set_protected:Npn \colon { - \bool_if:NTF \g_um_literal_colon_bool {:} { \mathpunct{:} } + \bool_if:NTF \g_@@_literal_colon_bool {:} { \mathpunct{:} } } } % \end{macrocode} @@ -5799,7 +3853,6 @@ This work is "maintained" by Will Robertson. % % \begin{macro}{\mathrm} % \begin{macrocode} -\def\mathrm{\mathup} \let\mathfence\mathord % \end{macrocode} % \end{macro} @@ -5814,351 +3867,6 @@ This work is "maintained" by Will Robertson. % \end{macro} % \end{macro} % -% -% \subsection{Compatibility} -% -% We need to change \LaTeX's idea of the font used to typeset -% things like \cmd\sin\ and \cmd\cos: -% \begin{macrocode} -\def\operator@font{\um_switchto_mathup:} -% \end{macrocode} -% -% \begin{macro}{\um_check_and_fix:NNnnnn} -% \darg{command} -% \darg{factory command} -% \darg{parameter text} -% \darg{expected replacement text} -% \darg{new replacement text for \LuaTeX} -% \darg{new replacement text for \XeTeX} -% Tries to patch \meta{command}. -% If \meta{command} is undefined, do nothing. -% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. -% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text for \LuaTeX} or the \meta{new replacement text for \XeTeX}, depending on the engine. -% Otherwise issue a warning and don’t overwrite. -% \begin{macrocode} -\cs_new_protected_nopar:Nn \um_check_and_fix:NNnnnn - { - \cs_if_exist:NT #1 - { - \token_if_macro:NTF #1 - { - \group_begin: - #2 \um_tmpa:w #3 { #4 } - \cs_if_eq:NNTF #1 \um_tmpa:w - { - \msg_info:nnx { unicode-math } { patch-macro } - { \token_to_str:N #1 } - \group_end: - #2 #1 #3 -%<XE> { #6 } -%<LU> { #5 } - } - { - \msg_warning:nnxxx { unicode-math } { wrong-meaning } - { \token_to_str:N #1 } { \token_to_meaning:N #1 } - { \token_to_meaning:N \um_tmpa:w } - \group_end: - } - } - { - \msg_warning:nnx { unicode-math } { macro-expected } - { \token_to_str:N #1 } - } - } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\um_check_and_fix:NNnnn} -% \darg{command} -% \darg{factory command} -% \darg{parameter text} -% \darg{expected replacement text} -% \darg{new replacement text} -% Tries to patch \meta{command}. -% If \meta{command} is undefined, do nothing. -% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. -% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text}. -% Otherwise issue a warning and don’t overwrite. -% \begin{macrocode} -\cs_new_protected_nopar:Nn \um_check_and_fix:NNnnn - { - \um_check_and_fix:NNnnnn #1 #2 { #3 } { #4 } { #5 } { #5 } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\um_check_and_fix_luatex:NNnnn} -% \begin{macro}{\um_check_and_fix_luatex:cNnnn} -% \darg{command} -% \darg{factory command} -% \darg{parameter text} -% \darg{expected replacement text} -% \darg{new replacement text} -% Tries to patch \meta{command}. -% If \XeTeX\ is the current engine or \meta{command} is undefined, do nothing. -% Otherwise it must be a macro with the given \meta{parameter text} and \meta{expected replacement text}, created by the given \meta{factory command} or equivalent. -% In this case it will be overwritten using the \meta{parameter text} and the \meta{new replacement text}. -% Otherwise issue a warning and don’t overwrite. -% \begin{macrocode} -\cs_new_protected_nopar:Nn \um_check_and_fix_luatex:NNnnn - { - \luatex_if_engine:T - { - \um_check_and_fix:NNnnn #1 #2 { #3 } { #4 } { #5 } - } - } -\cs_generate_variant:Nn \um_check_and_fix_luatex:NNnnn { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \paragraph{\pkg{url}} -% Simply need to get \pkg{url} in a state such that -% when it switches to math mode and enters \ascii\ characters, the maths -% setup (i.e., \pkg{unicode-math}) doesn't remap the symbols into Plane 1. -% Which is, of course, what \cs{mathup} is doing. -% -% This is the same as writing, e.g., |\def\UrlFont{\ttfamily\um_switchto_mathup:}| -% but activates automatically so old documents that might change the \cs{url} -% font still work correctly. -% \begin{macrocode} -\AtEndOfPackageFile * {url} - { - \tl_put_left:Nn \Url@FormatString { \um_switchto_mathup: } - \tl_put_right:Nn \UrlSpecials - { - \do\`{\mathchar`\`} - \do\'{\mathchar`\'} - \do\${\mathchar`\$} - \do\&{\mathchar`\&} - } - } -% \end{macrocode} -% -% \paragraph{\pkg{amsmath}} -% Since the mathcode of |`\-| is greater than eight bits, this piece of |\AtBeginDocument| code from \pkg{amsmath} dies if we try and set the maths font in the preamble: -% \begin{macrocode} -\AtEndOfPackageFile * {amsmath} - { -%<*XE> - \tl_remove_once:Nn \@begindocumenthook - { - \mathchardef\std@minus\mathcode`\-\relax - \mathchardef\std@equal\mathcode`\=\relax - } - \def\std@minus{\Umathcharnum\Umathcodenum`\-\relax} - \def\std@equal{\Umathcharnum\Umathcodenum`\=\relax} -%</XE> -% \end{macrocode} -% -% \begin{macrocode} - \cs_set:Npn \@cdots {\mathinner{\cdots}} - \cs_set_eq:NN \dotsb@ \cdots -% \end{macrocode} -% This isn't as clever as the \pkg{amsmath} definition but I think it works: -% \begin{macrocode} -%<*XE> - \def \resetMathstrut@ - {% - \setbox\z@\hbox{$($}%) - \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ - } -% \end{macrocode} -% The |subarray| environment uses inappropriate font dimensions. -% \begin{macrocode} - \um_check_and_fix:NNnnn \subarray \cs_set:Npn { #1 } - { - \vcenter - \bgroup - \Let@ - \restore@math@cr - \default@tag - \baselineskip \fontdimen 10~ \scriptfont \tw@ - \advance \baselineskip \fontdimen 12~ \scriptfont \tw@ - \lineskip \thr@@ \fontdimen 8~ \scriptfont \thr@@ - \lineskiplimit \lineskip - \ialign - \bgroup - \ifx c #1 \hfil \fi - $ \m@th \scriptstyle ## $ - \hfil - \crcr - } - { - \vcenter - \c_group_begin_token - \Let@ - \restore@math@cr - \default@tag - \skip_set:Nn \baselineskip - { -% \end{macrocode} -% Here we use stack top shift + stack bottom shift, which sounds reasonable. -% \begin{macrocode} - \um_stack_num_up:N \scriptstyle - + \um_stack_denom_down:N \scriptstyle - } -% \end{macrocode} -% Here we use the minimum stack gap. -% \begin{macrocode} - \lineskip \um_stack_vgap:N \scriptstyle - \lineskiplimit \lineskip - \ialign - \c_group_begin_token - \token_if_eq_meaning:NNT c #1 { \hfil } - \c_math_toggle_token - \m@th - \scriptstyle - \c_parameter_token \c_parameter_token - \c_math_toggle_token - \hfil - \crcr - } -%</XE> -% \end{macrocode} -% The roots need a complete rework. -% \begin{macrocode} - \um_check_and_fix_luatex:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } - { - \setbox \rootbox \hbox - { - $ \m@th \scriptscriptstyle { #1 } $ - } - \mathchoice - { \r@@t \displaystyle { #2 } } - { \r@@t \textstyle { #2 } }~ - { \r@@t \scriptstyle { #2 } } - { \r@@t \scriptscriptstyle { #2 } } - \egroup - } - { - \bool_if:nTF - { - \int_compare_p:nNn { \uproot@ } = { \c_zero } - && \int_compare_p:nNn { \leftroot@ } = { \c_zero } - } - { - \luatexUroot \l_um_radical_sqrt_tl { #1 } { #2 } - } - { - \hbox_set:Nn \rootbox - { - \c_math_toggle_token - \m@th - \scriptscriptstyle { #1 } - \c_math_toggle_token - } - \mathchoice - { \r@@t \displaystyle { #2 } } - { \r@@t \textstyle { #2 } } - { \r@@t \scriptstyle { #2 } } - { \r@@t \scriptscriptstyle { #2 } } - } - \c_group_end_token - } - \um_check_and_fix:NNnnnn \r@@t \cs_set_nopar:Npn { #1 #2 } - { - \setboxz@h { $ \m@th #1 \sqrtsign { #2 } $ } - \dimen@ \ht\z@ - \advance \dimen@ -\dp\z@ - \setbox\@ne \hbox { $ \m@th #1 \mskip \uproot@ mu $ } - \advance \dimen@ by 1.667 \wd\@ne - \mkern -\leftroot@ mu - \mkern 5mu - \raise .6\dimen@ \copy\rootbox - \mkern -10mu - \mkern \leftroot@ mu - \boxz@ - } - { - \hbox_set:Nn \l_tmpa_box - { - \c_math_toggle_token - \m@th - #1 - \mskip \uproot@ mu - \c_math_toggle_token - } - \luatexUroot \l_um_radical_sqrt_tl - { - \box_move_up:nn { \box_wd:N \l_tmpa_box } - { - \hbox:n - { - \c_math_toggle_token - \m@th - \mkern -\leftroot@ mu - \box_use:N \rootbox - \mkern \leftroot@ mu - \c_math_toggle_token - } - } - } - { #2 } - } - { - \hbox_set:Nn \l_tmpa_box - { - \c_math_toggle_token - \m@th - #1 - \sqrtsign { #2 } - \c_math_toggle_token - } - \hbox_set:Nn \l_tmpb_box - { - \c_math_toggle_token - \m@th - #1 - \mskip \uproot@ mu - \c_math_toggle_token - } - \mkern -\leftroot@ mu - \um_mathstyle_scale:Nnn #1 { \kern } - { - \fontdimen 63 \l_um_font - } - \box_move_up:nn - { - \box_wd:N \l_tmpb_box - + (\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 - } - \mkern \leftroot@ mu - \box_use_clear:N \l_tmpa_box - } - } -% \end{macrocode} -% -% \paragraph{\pkg{amsopn}} -% This code is to improve the output of analphabetic symbols in text of operator names (\cs{sin}, \cs{cos}, etc.). Just comment out the offending lines for now: -% \begin{macrocode} -%<*XE> -\AtEndOfPackageFile * {amsopn} - { - \cs_set:Npn \newmcodes@ - { - \mathcode`\'39\scan_stop: - \mathcode`\*42\scan_stop: - \mathcode`\."613A\scan_stop: -%% \ifnum\mathcode`\-=45 \else -%% \mathchardef\std@minus\mathcode`\-\relax -%% \fi - \mathcode`\-45\scan_stop: - \mathcode`\/47\scan_stop: - \mathcode`\:"603A\scan_stop: - } - } -%</XE> -% \end{macrocode} % \paragraph{Symbols} % \begin{macrocode} \cs_set:Npn \| {\Vert} @@ -6168,62 +3876,12 @@ This work is "maintained" by Will Robertson. \cs_set:Npn \mathellipsis {\mathinner{\unicodeellipsis}} \cs_set:Npn \cdots {\mathinner{\unicodecdots}} % \end{macrocode} -% \paragraph{Accents} -% \begin{macrocode} -\cs_new_protected_nopar:Nn \um_setup_accents: - { - \cs_gset_protected_nopar:Npx \widehat - { - \um_accent:nnn {} { \um_symfont_tl } { "0302 } - } - \cs_gset_protected_nopar:Npx \widetilde - { - \um_accent:nnn {} { \um_symfont_tl } { "0303 } - } - \cs_gset_protected_nopar:Npx \overleftarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20D6 } - } - \cs_gset_protected_nopar:Npx \overrightarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20D7 } - } - \cs_gset_protected_nopar:Npx \overleftrightarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20E1 } - } - \cs_gset_protected_nopar:Npx \wideutilde - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "0330 } - } - \cs_gset_protected_nopar:Npx \underrightharpoondown - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EC } - } - \cs_gset_protected_nopar:Npx \underleftharpoondown - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20ED } - } - \cs_gset_protected_nopar:Npx \underleftarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EE } - } - \cs_gset_protected_nopar:Npx \underrightarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EF } - } - \cs_gset_protected_nopar:Npx \underleftrightarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "034D } - } - } -% \end{macrocode} % % \begin{macrocode} -\cs_set_eq:NN \um_text_slash: \slash +\cs_set_eq:NN \@@_text_slash: \slash \cs_set_protected:Npn \slash { - \mode_if_math:TF {\mathslash} {\um_text_slash:} + \mode_if_math:TF {\mathslash} {\@@_text_slash:} } % \end{macrocode} % @@ -6243,9 +3901,7 @@ This work is "maintained" by Will Robertson. % Gregorio\footnote{\url{http://tex.stackexchange.com/a/47260/729}}. % % \begin{macrocode} -\tl_new:N \l_not_token_name_tl - -\cs_new:Npn \not_newnot:N #1 +\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 } @@ -6262,15 +3918,17 @@ This work is "maintained" by Will Robertson. \use:c { not \l_not_token_name_tl } } { - \not_oldnot: #1 %\l_not_token_name_tl + \@@_oldnot: #1 } } } - -\cs_set_eq:NN \not_oldnot: \not -\cs_set_eq:NN \not \not_newnot:N - -\cs_new_protected_nopar:Nn \um_setup_negations: +% \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 } @@ -6285,697 +3943,10 @@ This work is "maintained" by Will Robertson. } % \end{macrocode} % -% \paragraph{\pkg{mathtools}} -% \pkg{mathtools}’s |\cramped| command and others that make use of its internal version use an incorrect font dimension. -% -% \begin{macrocode} -\AtEndOfPackageFile * { mathtools } - { -%<*XE> - \newfam \g_um_empty_fam - \um_check_and_fix:NNnnn - \MT_cramped_internal:Nn \cs_set_nopar:Npn { #1 #2 } - { - \sbox \z@ - { - $ - \m@th - #1 - \nulldelimiterspace = \z@ - \radical \z@ { #2 } - $ - } - \ifx #1 \displaystyle - \dimen@ = \fontdimen 8 \textfont 3 - \advance \dimen@ .25 \fontdimen 5 \textfont 2 - \else - \dimen@ = 1.25 \fontdimen 8 - \ifx #1 \textstyle - \textfont - \else - \ifx #1 \scriptstyle - \scriptfont - \else - \scriptscriptfont - \fi - \fi - 3 - \fi - \advance \dimen@ -\ht\z@ - \ht\z@ = -\dimen@ - \box\z@ - } -% \end{macrocode} -% The \XeTeX\ version is pretty similar to the legacy version, only using the correct font dimensions. -% Note we used `\verb|\XeTeXradical|' with a newly-allocated empty family to make sure that the radical rule width is not set. -% \begin{macrocode} - { - \hbox_set:Nn \l_tmpa_box - { - \color@setgroup - \c_math_toggle_token - \m@th - #1 - \dim_zero:N \nulldelimiterspace - \XeTeXradical \g_um_empty_fam \c_zero { #2 } - \c_math_toggle_token - \color@endgroup - } - \box_set_ht:Nn \l_tmpa_box - { - \box_ht:N \l_tmpa_box -% \end{macrocode} -% Here we use the radical vertical gap. -% \begin{macrocode} - - \um_radical_vgap:N #1 - } - \box_use_clear:N \l_tmpa_box - } -%</XE> -% \end{macrocode} -% -% \begin{macro}{\overbracket} -% \begin{macro}{\underbracket} -% \pkg{mathtools}’s |\overbracket| and |\underbracket| take optional -% arguments and are defined in terms of rules, so we keep them, and rename -% ours to |\Uoverbracket| and |\Uunderbracket|. -% \begin{macrocode} -\AtEndOfPackageFile * { mathtools } - { - \cs_set_eq:NN \MToverbracket \overbracket - \cs_set_eq:NN \MTunderbracket \underbracket - - \AtBeginDocument - { - \msg_warning:nn { unicode-math } { mathtools-overbracket } - - \def\downbracketfill#1#2 - {% -% \end{macrocode} -% Original definition used the height of |\braceld| which is not available -% with Unicode fonts, so we are hard coding the $5/18$ex suggested by -% \pkg{mathtools}’s documentation. -% \begin{macrocode} - \edef\l_MT_bracketheight_fdim{.27ex}% - \downbracketend{#1}{#2} - \leaders \vrule \@height #1 \@depth \z@ \hfill - \downbracketend{#1}{#2}% - } - \def\upbracketfill#1#2 - {% - \edef\l_MT_bracketheight_fdim{.27ex}% - \upbracketend{#1}{#2} - \leaders \vrule \@height \z@ \@depth #1 \hfill - \upbracketend{#1}{#2}% - } - \let\Uoverbracket =\overbracket - \let\Uunderbracket=\underbracket - \let\overbracket =\MToverbracket - \let\underbracket =\MTunderbracket - } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% -% \begin{macro}{\dblcolon} -% \begin{macro}{\coloneqq} -% \begin{macro}{\Coloneqq} -% \begin{macro}{\eqqcolon} -% \pkg{mathtools} defines several commands as combinations of colons and -% other characters, but with meanings incompatible to \pkg{unicode-math}. -% Thus we issue a warning. Because \pkg{mathtools} uses -% \cmd{\providecommand} \cmd{\AtBeginDocument}, we can just define the -% offending commands here. -% \begin{macrocode} - \msg_warning:nn { unicode-math } { mathtools-colon } - \NewDocumentCommand \dblcolon { } { \Colon } - \NewDocumentCommand \coloneqq { } { \coloneq } - \NewDocumentCommand \Coloneqq { } { \Coloneq } - \NewDocumentCommand \eqqcolon { } { \eqcolon } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% -% \paragraph{\pkg{colonequals}} -% -% \begin{macro}{\ratio} -% \begin{macro}{\coloncolon} -% \begin{macro}{\minuscolon} -% \begin{macro}{\colonequals} -% \begin{macro}{\equalscolon} -% \begin{macro}{\coloncolonequals} -% Similarly to \pkg{mathtools}, the \pkg{colonequals} defines several colon -% combinations. Fortunately there are no name clashes, so we can just -% overwrite their definitions. -% \begin{macrocode} -\AtEndOfPackageFile * { colonequals } - { - \msg_warning:nn { unicode-math } { colonequals } - \RenewDocumentCommand \ratio { } { \mathratio } - \RenewDocumentCommand \coloncolon { } { \Colon } - \RenewDocumentCommand \minuscolon { } { \dashcolon } - \RenewDocumentCommand \colonequals { } { \coloneq } - \RenewDocumentCommand \equalscolon { } { \eqcolon } - \RenewDocumentCommand \coloncolonequals { } { \Coloneq } - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macrocode} -\ExplSyntaxOff %</package&(XE|LU)> % \end{macrocode} % -% \section{Error messages} -% \seclabel{codemsg} -% -% These are defined at the beginning of the package, but we leave their -% definition until now in the source to keep them out of the way. -% -% \begin{macrocode} -%<*msg> -% \end{macrocode} -% -% Wrapper functions: -% \begin{macrocode} -\cs_new:Npn \um_warning:n { \msg_warning:nn {unicode-math} } -\cs_new:Npn \um_log:n { \msg_log:nn {unicode-math} } -\cs_new:Npn \um_log:nx { \msg_log:nnx {unicode-math} } -% \end{macrocode} -% -% \begin{macrocode} -\msg_new:nnn {unicode-math} {no-tfrac} -{ - Small~ fraction~ command~ \protect\tfrac\ not~ defined.\\ - Load~ amsmath~ or~ define~ it~ manually~ before~ loading~ unicode-math. -} -\msg_new:nnn {unicode-math} {default-math-font} -{ - Defining~ the~ default~ maths~ font~ as~ '\l_um_fontname_tl'. -} -\msg_new:nnn {unicode-math} {setup-implicit} -{ - Setup~ alphabets:~ implicit~ mode. -} -\msg_new:nnn {unicode-math} {setup-explicit} -{ - Setup~ alphabets:~ explicit~ mode. -} -\msg_new:nnn {unicode-math} {alph-initialise} -{ - Initialising~ \@backslashchar math#1. -} -\msg_new:nnn {unicode-math} {setup-alph} -{ - Setup~ alphabet:~ #1. -} -\msg_new:nnn { unicode-math } { missing-alphabets } - { - Missing~math~alphabets~in~font~ "\fontname\l_um_font" \\ \\ - \seq_map_function:NN \l_um_missing_alph_seq \um_print_indent:n - } -\cs_new:Nn \um_print_indent:n { \space\space\space\space #1 \\ } -\msg_new:nnn {unicode-math} {macro-expected} -{ - I've~ expected~ that~ #1~ is~ a~ macro,~ but~ it~ isn't. -} -\msg_new:nnn {unicode-math} {wrong-meaning} -{ - I've~ expected~ #1~ to~ have~ the~ meaning~ #3,~ but~ it~ has~ the~ meaning~ #2. -} -\msg_new:nnn {unicode-math} {patch-macro} -{ - I'm~ going~ to~ patch~ macro~ #1. -} -\msg_new:nnn { unicode-math } { mathtools-overbracket } { - Using~ \token_to_str:N \overbracket\ and~ - \token_to_str:N \underbracket\ from~ - `mathtools'~ package.\\ - \\ - Use~ \token_to_str:N \Uoverbracket\ and~ - \token_to_str:N \Uunderbracket\ for~ - original~ `unicode-math'~ definition. -} -\msg_new:nnn { unicode-math } { mathtools-colon } { - I'm~ going~ to~ overwrite~ the~ following~ commands~ from~ - the~ `mathtools'~ package: \\ \\ - \ \ \ \ \token_to_str:N \dblcolon,~ - \token_to_str:N \coloneqq,~ - \token_to_str:N \Coloneqq,~ - \token_to_str:N \eqqcolon. \\ \\ - Note~ that~ since~ I~ won't~ overwrite~ the~ other~ colon-like~ - commands,~ using~ them~ will~ lead~ to~ inconsistencies. -} -\msg_new:nnn { unicode-math } { colonequals } { - I'm~ going~ to~ overwrite~ the~ following~ commands~ from~ - the~ `colonequals'~ package: \\ \\ - \ \ \ \ \token_to_str:N \ratio,~ - \token_to_str:N \coloncolon,~ - \token_to_str:N \minuscolon, \\ - \ \ \ \ \token_to_str:N \colonequals,~ - \token_to_str:N \equalscolon,~ - \token_to_str:N \coloncolonequals. \\ \\ - Note~ that~ since~ I~ won't~ overwrite~ the~ other~ colon-like~ - commands,~ using~ them~ will~ lead~ to~ inconsistencies.~ - Furthermore,~ changing~ \token_to_str:N \colonsep \c_space_tl - or~ \token_to_str:N \doublecolonsep \c_space_tl won't~ have~ - any~ effect~ on~ the~ re-defined~ commands. -} -% \end{macrocode} -% -% \begin{macrocode} -%</msg> -% \end{macrocode} -% -% The end. -% -% -% \section{\STIX\ table data extraction}\label{part:awk} -%\iffalse -%<*awk> -%\fi -% -% The source for the \TeX\ names for the very large number of mathematical -% glyphs are provided via Barbara Beeton's table file for the \STIX\ project -% (|ams.org/STIX|). A version is located at -% |http://www.ams.org/STIX/bnb/stix-tbl.asc| -% but check |http://www.ams.org/STIX/| for more up-to-date info. -% -% This table is converted into a form suitable for reading by \XeTeX. -% A single file is produced containing all (more than 3298) symbols. -% Future optimisations might include generating various (possibly overlapping) subsets -% so not all definitions must be read just to redefine a small range of symbols. -% Performance for now seems to be acceptable without such measures. -% -% This file is currently developed outside this DTX file. It will be -% incorporated when the final version is ready. (I know this is not how -% things are supposed to work!) -% -% \begin{macrocode} -< See stix-extract.sh for now. > -% \end{macrocode} -%\iffalse -%</awk> -%\fi -% -% \appendix -% -% \section{Documenting maths support in the NFSS} -% -% 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$ -% -% \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. -% -% \cmd\DeclareMathAlphabet\marg{cmd}\meta{NFSS decl.} -% -% For commands such as \cmd\mathbf, accessed -% through maths mode that are unaffected by the current text font, and which are used for -% alphabetic symbols in the \ascii\ range. -% -% \cmd\DeclareSymbolFontAlphabet\marg{cmd}\marg{name} -% -% Alternative (and optimisation) for \cmd\DeclareMathAlphabet\ if a single font is being used -% for both alphabetic characters (as above) and symbols. -% -% \item[Maths `versions'] Different maths weights can be defined with the following, switched -% in text with the \cmd\mathversion\marg{maths version} command. -% -% \cmd\SetSymbolFont\marg{name}\marg{maths version}\meta{NFSS decl.}\\ -% \cmd\SetMathAlphabet\marg{cmd}\marg{maths version}\meta{NFSS decl.} -% -% \item[Maths symbols] Symbol definitions in maths for both characters (=) and macros (\cmd\eqdef): -% \cmd\DeclareMathSymbol\marg{symbol}\marg{type}\marg{named font}\marg{slot} -% This is the macro that actually defines which font each symbol comes from and how they behave. -% \end{description} -% Delimiters and radicals use wrappers around \TeX's \cmd\delimiter/\cmd\radical\ primitives, -% which are re-designed in \XeTeX. The syntax used in \LaTeX's NFSS is therefore not so relevant here. -% \begin{description} -% \item[Delimiters] A special class of maths symbol which enlarge themselves in certain contexts. -% -% \cmd\DeclareMathDelimiter\marg{symbol}\marg{type}\marg{sym.\ font}\marg{slot}\marg{sym.\ font}\marg{slot} -% -% \item[Radicals] Similar to delimiters (\cmd\DeclareMathRadical\ takes the same syntax) but -% behave `weirdly'. -% \end{description} -% In those cases, glyph slots in \emph{two} symbol fonts are required; one for the small (`regular') case, -% the other for situations when the glyph is larger. This is not the case in \XeTeX. -% -% Accents are not included yet. -% -% \paragraph{Summary} -% -% For symbols, something like: -% \begin{Verbatim} -% \def\DeclareMathSymbol#1#2#3#4{ -% \global\mathchardef#1"\mathchar@type#2 -% \expandafter\hexnumber@\csname sym#2\endcsname -% {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}} -% \end{Verbatim} -% For characters, something like: -% \begin{Verbatim} -% \def\DeclareMathSymbol#1#2#3#4{ -% \global\mathcode`#1"\mathchar@type#2 -% \expandafter\hexnumber@\csname sym#2\endcsname -% {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}} -% \end{Verbatim} -% -% \section{Legacy \TeX\ font dimensions} -% -% \centerline{% -% \begin{tabular}[t]{@{}lp{4cm}@{}} -% \toprule -% \multicolumn{2}{@{}c@{}}{Text fonts} \\ -% \midrule -% $\phi_1$ & slant per pt \\ -% $\phi_2$ & interword space \\ -% $\phi_3$ & interword stretch \\ -% $\phi_4$ & interword shrink \\ -% $\phi_5$ & x-height \\ -% $\phi_6$ & quad width \\ -% $\phi_7$ & extra space \\ -% $\phi_8$ & cap height (\XeTeX\ only) \\ -% \bottomrule -% \end{tabular} -% \quad -% \begin{tabular}[t]{@{}lp{4cm}@{}} -% \toprule -% \multicolumn{2}{@{}c@{}}{Maths font, \cs{fam}2} \\ -% \midrule -% $\sigma_5$ & x height \\ -% $\sigma_6$ & quad \\ -% $\sigma_8$ & num1 \\ -% $\sigma_9$ & num2 \\ -% $\sigma_{10}$ & num3 \\ -% $\sigma_{11}$ & denom1 \\ -% $\sigma_{12}$ & denom2 \\ -% $\sigma_{13}$ & sup1 \\ -% $\sigma_{14}$ & sup2 \\ -% $\sigma_{15}$ & sup3 \\ -% $\sigma_{16}$ & sub1 \\ -% $\sigma_{17}$ & sub2 \\ -% $\sigma_{18}$ & sup drop \\ -% $\sigma_{19}$ & sub drop \\ -% $\sigma_{20}$ & delim1 \\ -% $\sigma_{21}$ & delim2 \\ -% $\sigma_{22}$ & axis height \\ -% \bottomrule -% \end{tabular} -% \quad -% \begin{tabular}[t]{@{}lp{4cm}@{}} -% \toprule -% \multicolumn{2}{@{}c@{}}{Maths font, \cs{fam}3} \\ -% \midrule -% $\xi_8$ & default rule thickness \\ -% $\xi_9$ & big op spacing1 \\ -% $\xi_{10}$ & big op spacing2 \\ -% $\xi_{11}$ & big op spacing3 \\ -% $\xi_{12}$ & big op spacing4 \\ -% $\xi_{13}$ & big op spacing5 \\ -% \bottomrule -% \end{tabular} -% } -% -% -% \section{\Hologo{XeTeX} math font dimensions} -% -% These are the extended \cmd\fontdimen s available for suitable fonts -% in \XeTeX. Note that Lua\TeX\ takes an alternative route, and this package -% will eventually provide a wrapper interface to the two (I hope). -% -% \newcounter{mfdimen} -% \setcounter{mfdimen}{9} -% \newcommand\mathfontdimen[2]{^^A -% \stepcounter{mfdimen}^^A -% \themfdimen & {\scshape\small #1} & #2\vspace{0.5ex} \tabularnewline} -% -% \begin{longtable}{ -% @{}c>{\raggedright\parfillskip=0pt}p{4cm}>{\raggedright}p{7cm}@{}} -% \toprule \cmd\fontdimen & Dimension name & Description\tabularnewline\midrule \endhead -% \bottomrule\endfoot -% \mathfontdimen{Script\-Percent\-Scale\-Down} -% {Percentage of scaling down for script level 1. Suggested value: 80\%.} -% \mathfontdimen{Script\-Script\-Percent\-Scale\-Down} -% {Percentage of scaling down for script level 2 (Script\-Script). Suggested value: 60\%.} -% \mathfontdimen{Delimited\-Sub\-Formula\-Min\-Height} -% {Minimum height required for a delimited expression to be treated as a subformula. Suggested value: normal line height\,×\,1.5.} -% \mathfontdimen{Display\-Operator\-Min\-Height} -% {Minimum height of n-ary operators (such as integral and summation) for formulas in display mode.} -% \mathfontdimen{Math\-Leading} -% {White space to be left between math formulas to ensure proper line spacing. For example, for applications that treat line gap as a part of line ascender, formulas with ink going above (os2.sTypoAscender + os2.sTypoLineGap – MathLeading) or with ink going below os2.sTypoDescender will result in increasing line height.} -% \mathfontdimen{Axis\-Height} -% {Axis height of the font. } -% \mathfontdimen{Accent\-Base\-Height} -% {Maximum (ink) height of accent base that does not require raising the accents. Suggested: x-height of the font (os2.sxHeight) plus any possible overshots. } -% \mathfontdimen{Flattened\-Accent\-Base\-Height} -% {Maximum (ink) height of accent base that does not require flattening the accents. Suggested: cap height of the font (os2.sCapHeight).} -% \mathfontdimen{Subscript\-Shift\-Down} -% {The standard shift down applied to subscript elements. Positive for moving in the downward direction. Suggested: os2.ySubscriptYOffset.} -% \mathfontdimen{Subscript\-Top\-Max} -% {Maximum allowed height of the (ink) top of subscripts that does not require moving subscripts further down. Suggested: /5 x-height.} -% \mathfontdimen{Subscript\-Baseline\-Drop\-Min} -% {Minimum allowed drop of the baseline of subscripts relative to the (ink) bottom of the base. Checked for bases that are treated as a box or extended shape. Positive for subscript baseline dropped below the base bottom.} -% \mathfontdimen{Superscript\-Shift\-Up} -% {Standard shift up applied to superscript elements. Suggested: os2.ySuperscriptYOffset.} -% \mathfontdimen{Superscript\-Shift\-Up\-Cramped} -% {Standard shift of superscripts relative to the base, in cramped style.} -% \mathfontdimen{Superscript\-Bottom\-Min} -% {Minimum allowed height of the (ink) bottom of superscripts that does not require moving subscripts further up. Suggested: ¼ x-height.} -% \mathfontdimen{Superscript\-Baseline\-Drop\-Max} -% {Maximum allowed drop of the baseline of superscripts relative to the (ink) top of the base. Checked for bases that are treated as a box or extended shape. Positive for superscript baseline below the base top.} -% \mathfontdimen{Sub\-Superscript\-Gap\-Min} -% {Minimum gap between the superscript and subscript ink. Suggested: 4×default rule thickness.} -% \mathfontdimen{Superscript\-Bottom\-Max\-With\-Subscript} -% {The maximum level to which the (ink) bottom of superscript can be pushed to increase the gap between superscript and subscript, before subscript starts being moved down. -% Suggested: /5 x-height.} -% \mathfontdimen{Space\-After\-Script} -% {Extra white space to be added after each subscript and superscript. Suggested: 0.5pt for a 12 pt font.} -% \mathfontdimen{Upper\-Limit\-Gap\-Min} -% {Minimum gap between the (ink) bottom of the upper limit, and the (ink) top of the base operator. } -% \mathfontdimen{Upper\-Limit\-Baseline\-Rise\-Min} -% {Minimum distance between baseline of upper limit and (ink) top of the base operator.} -% \mathfontdimen{Lower\-Limit\-Gap\-Min} -% {Minimum gap between (ink) top of the lower limit, and (ink) bottom of the base operator.} -% \mathfontdimen{Lower\-Limit\-Baseline\-Drop\-Min} -% {Minimum distance between baseline of the lower limit and (ink) bottom of the base operator.} -% \mathfontdimen{Stack\-Top\-Shift\-Up} -% {Standard shift up applied to the top element of a stack.} -% \mathfontdimen{Stack\-Top\-Display\-Style\-Shift\-Up} -% {Standard shift up applied to the top element of a stack in display style.} -% \mathfontdimen{Stack\-Bottom\-Shift\-Down} -% {Standard shift down applied to the bottom element of a stack. Positive for moving in the downward direction.} -% \mathfontdimen{Stack\-Bottom\-Display\-Style\-Shift\-Down} -% {Standard shift down applied to the bottom element of a stack in display style. Positive for moving in the downward direction.} -% \mathfontdimen{Stack\-Gap\-Min} -% {Minimum gap between (ink) bottom of the top element of a stack, and the (ink) top of the bottom element. Suggested: 3×default rule thickness.} -% \mathfontdimen{Stack\-Display\-Style\-Gap\-Min} -% {Minimum gap between (ink) bottom of the top element of a stack, and the (ink) top of the bottom element in display style. Suggested: 7×default rule thickness.} -% \mathfontdimen{Stretch\-Stack\-Top\-Shift\-Up} -% {Standard shift up applied to the top element of the stretch stack.} -% \mathfontdimen{Stretch\-Stack\-Bottom\-Shift\-Down} -% {Standard shift down applied to the bottom element of the stretch stack. Positive for moving in the downward direction.} -% \mathfontdimen{Stretch\-Stack\-Gap\-Above\-Min} -% {Minimum gap between the ink of the stretched element, and the (ink) bottom of the element above. Suggested: Upper\-Limit\-Gap\-Min} -% \mathfontdimen{Stretch\-Stack\-Gap\-Below\-Min} -% {Minimum gap between the ink of the stretched element, and the (ink) top of the element below. Suggested: Lower\-Limit\-Gap\-Min.} -% \mathfontdimen{Fraction\-Numerator\-Shift\-Up} -% {Standard shift up applied to the numerator. } -% \mathfontdimen{Fraction\-Numerator\-Display\-Style\-Shift\-Up} -% {Standard shift up applied to the numerator in display style. Suggested: Stack\-Top\-Display\-Style\-Shift\-Up.} -% \mathfontdimen{Fraction\-Denominator\-Shift\-Down} -% {Standard shift down applied to the denominator. Positive for moving in the downward direction.} -% \mathfontdimen{Fraction\-Denominator\-Display\-Style\-Shift\-Down} -% {Standard shift down applied to the denominator in display style. Positive for moving in the downward direction. Suggested: Stack\-Bottom\-Display\-Style\-Shift\-Down.} -% \mathfontdimen{Fraction\-Numerator\-Gap\-Min} -% {Minimum tolerated gap between the (ink) bottom of the numerator and the ink of the fraction bar. Suggested: default rule thickness} -% \mathfontdimen{Fraction\-Num\-Display\-Style\-Gap\-Min} -% {Minimum tolerated gap between the (ink) bottom of the numerator and the ink of the fraction bar in display style. Suggested: 3×default rule thickness.} -% \mathfontdimen{Fraction\-Rule\-Thickness} -% {Thickness of the fraction bar. Suggested: default rule thickness.} -% \mathfontdimen{Fraction\-Denominator\-Gap\-Min} -% {Minimum tolerated gap between the (ink) top of the denominator and the ink of the fraction bar. Suggested: default rule thickness} -% \mathfontdimen{Fraction\-Denom\-Display\-Style\-Gap\-Min} -% {Minimum tolerated gap between the (ink) top of the denominator and the ink of the fraction bar in display style. Suggested: 3×default rule thickness.} -% \mathfontdimen{Skewed\-Fraction\-Horizontal\-Gap} -% {Horizontal distance between the top and bottom elements of a skewed fraction.} -% \mathfontdimen{Skewed\-Fraction\-Vertical\-Gap} -% {Vertical distance between the ink of the top and bottom elements of a skewed fraction.} -% \mathfontdimen{Overbar\-Vertical\-Gap} -% {Distance between the overbar and the (ink) top of he base. Suggested: 3×default rule thickness.} -% \mathfontdimen{Overbar\-Rule\-Thickness} -% {Thickness of overbar. Suggested: default rule thickness.} -% \mathfontdimen{Overbar\-Extra\-Ascender} -% {Extra white space reserved above the overbar. Suggested: default rule thickness.} -% \mathfontdimen{Underbar\-Vertical\-Gap} -% {Distance between underbar and (ink) bottom of the base. Suggested: 3×default rule thickness.} -% \mathfontdimen{Underbar\-Rule\-Thickness} -% {Thickness of underbar. Suggested: default rule thickness.} -% \mathfontdimen{Underbar\-Extra\-Descender} -% {Extra white space reserved below the underbar. Always positive. Suggested: default rule thickness.} -% \mathfontdimen{Radical\-Vertical\-Gap} -% {Space between the (ink) top of the expression and the bar over it. Suggested: 1¼ default rule thickness.} -% \mathfontdimen{Radical\-Display\-Style\-Vertical\-Gap} -% {Space between the (ink) top of the expression and the bar over it. Suggested: default rule thickness + ¼ x-height. } -% \mathfontdimen{Radical\-Rule\-Thickness} -% {Thickness of the radical rule. This is the thickness of the rule in designed or constructed radical signs. Suggested: default rule thickness.} -% \mathfontdimen{Radical\-Extra\-Ascender} -% {Extra white space reserved above the radical. Suggested: Radical\-Rule\-Thickness.} -% \mathfontdimen{Radical\-Kern\-Before\-Degree} -% {Extra horizontal kern before the degree of a radical, if such is present. Suggested: 5/18 of em.} -% \mathfontdimen{Radical\-Kern\-After\-Degree} -% {Negative kern after the degree of a radical, if such is present. Suggested: −10/18 of em.} -% \mathfontdimen{Radical\-Degree\-Bottom\-Raise\-Percent} -% {Height of the bottom of the radical degree, if such is present, in proportion to the ascender of the radical sign. Suggested: 60\%.} -% \end{longtable} -% -% \Finale -% -% \iffalse -% -%<*dtx-style> -% \begin{macrocode} -\ProvidesPackage{dtx-style} - -\GetFileInfo{\jobname.dtx} -\let\umfiledate\filedate -\let\umfileversion\fileversion - -\CheckSum{0} -\EnableCrossrefs -\CodelineIndex - -\errorcontextlines=999 - -\def\@dotsep{1000} -\setcounter{tocdepth}{2} -\setlength\columnseprule{0.4pt} -\renewcommand\tableofcontents{\relax - \begin{multicols}{2}[\section*{\contentsname}]\relax - \@starttoc{toc}\relax - \end{multicols}} - -\setcounter{IndexColumns}{2} -\renewenvironment{theglossary} - {\small\list{}{} - \item\relax - \glossary@prologue\GlossaryParms - \let\item\@idxitem \ignorespaces - \def\pfill{\hspace*{\fill}}} - {\endlist} - -\usepackage[svgnames]{xcolor} -\usepackage{array,booktabs,calc,enumitem,fancyvrb,graphicx,ifthen,longtable,refstyle,subfig,topcapt,url,varioref,underscore} -\setcounter{LTchunksize}{100} -\usepackage[slash-delimiter=frac,nabla=literal]{unicode-math} -\usepackage{metalogo,hologo} - -\fvset{gobble=2,fontsize=\small,xleftmargin=2em} -%\usepackage[rm,small]{titlesec} - -\setmainfont{TeX Gyre Pagella} -\setsansfont{Iwona}% - [ - Scale=MatchLowercase, - Extension = .otf, - UprightFont = *-Regular, - ItalicFont = *-Italic, - BoldFont = *-Bold, - BoldItalicFont = *-BoldItalic, - ] -\setmonofont{Inconsolatazi4-Regular.otf}% - [ - Scale=MatchLowercase, - BoldFont=Inconsolatazi4-Bold.otf - ] -\setmathfont{texgyrepagella-math.otf} -\newfontface\umfont{xits-math.otf} - -\usepackage{hypdoc} -\hypersetup{linktocpage} - -% work around some issue turning | into "j" inside mathsf in the definition of \Module: -% (also prettify) -\def\Module#1{{\footnotesize\color{red}$\langle$\texttt{#1}$\rangle$}} - -\usepackage{minitoc} - -\linespread{1.069} % A bit more space between lines -\frenchspacing % Remove ugly extra space after punctuation - -\definecolor{niceblue}{rgb}{0.2,0.4,0.8} - -\def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}} - -\newcommand*\name[1]{{#1}} -\newcommand*\pkg[1]{\textsf{#1}} -\newcommand*\feat[1]{\texttt{#1}} -\newcommand*\opt[1]{\texttt{#1}} - -\newcommand*\note[1]{\unskip\footnote{#1}} - -\let\latin\textit -\def\eg{\latin{e.g.}} -\def\Eg{\latin{E.g.}} -\def\ie{\latin{i.e.}} -\def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}} - -\def\STIX{\textsc{stix}} -\def\MacOSX{Mac~OS~X} -\def\ascii{\textsc{ascii}} -\def\OMEGA{Omega} - -\newcounter{argument} -\g@addto@macro\endmacro{\setcounter{argument}{0}} -\newcommand*\darg[1]{% - \stepcounter{argument}% - {\ttfamily\char`\#\theargument~:~}#1\par\noindent\ignorespaces -} -\newcommand*\doarg[1]{% - \stepcounter{argument}% - {\ttfamily\makebox[0pt][r]{[}\char`\#\theargument]:~}#1\par\noindent\ignorespaces -} - -\newcommand\codeline[1]{\par{\centering#1\par\noindent}\ignorespaces} - -\newcommand\unichar[1]{\textsc{u}+\texttt{\small#1}} - -\setlength\parindent{2em} - -\def \MakePrivateLetters {% - \catcode`\@=11\relax - \catcode`\_=11\relax - \catcode`\:=11\relax -} - -\def\partname{Part} - -% \end{macrocode} -%</dtx-style> -%\fi -% -% \typeout{*************************************************************} -% \typeout{*} -% \typeout{* To finish the installation you have to move the following} -% \typeout{* file into a directory searched by XeTeX:} -% \typeout{*} -% \typeout{* \space\space\space unicode-math.sty} -% \typeout{*} -% \typeout{*************************************************************} -% \endinput 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 e0588b9875c..8755025b92f 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-luatex.sty @@ -5,9 +5,10 @@ %% The original source files were: %% %% unicode-math.dtx (with options: `package,LU') -%% Copyright 2006-2013 Will Robertson <will.robertson@latex-project.org> +%% unicode-math-compat.dtx (with options: `compat,LU') +%% Copyright 2006-2015 Will Robertson <will.robertson@latex-project.org> %% Copyright 2010-2013 Philipp Stephani <st_philipp@yahoo.de> -%% Copyright 2012-2013 Khaled Hosny <khaledhosny@eglug.org> +%% Copyright 2012-2015 Khaled Hosny <khaledhosny@eglug.org> %% %% This package is free software and may be redistributed and/or modified under %% the conditions of the LaTeX Project Public License, version 1.3c or higher @@ -17,245 +18,10 @@ \ExplSyntaxOn \RequirePackage{luaotfload} [2014/05/18] \RequirePackage{lualatex-math}[2011/08/07] -\cs_new:Nn \usv_set:nnn - { - \tl_set:cn { \um_to_usv:nn {#1}{#2} } {#3} - } -\cs_new:Nn \um_to_usv:nn { g_um_#1_#2_usv } -\usv_set:nnn {up} {num} {48} -\usv_set:nnn {up} {Latin}{65} -\usv_set:nnn {up} {latin}{97} -\usv_set:nnn {up} {Greek}{"391} -\usv_set:nnn {up} {greek}{"3B1} -\usv_set:nnn {it} {Latin}{"1D434} -\usv_set:nnn {it} {latin}{"1D44E} -\usv_set:nnn {it} {Greek}{"1D6E2} -\usv_set:nnn {it} {greek}{"1D6FC} -\usv_set:nnn {bb} {num} {"1D7D8} -\usv_set:nnn {bb} {Latin}{"1D538} -\usv_set:nnn {bb} {latin}{"1D552} -\usv_set:nnn {scr} {Latin}{"1D49C} -\usv_set:nnn {cal} {Latin}{"1D49C} -\usv_set:nnn {scr} {latin}{"1D4B6} -\usv_set:nnn {frak}{Latin}{"1D504} -\usv_set:nnn {frak}{latin}{"1D51E} -\usv_set:nnn {sf} {num} {"1D7E2} -\usv_set:nnn {sfup}{num} {"1D7E2} -\usv_set:nnn {sfit}{num} {"1D7E2} -\usv_set:nnn {sfup}{Latin}{"1D5A0} -\usv_set:nnn {sf} {Latin}{"1D5A0} -\usv_set:nnn {sfup}{latin}{"1D5BA} -\usv_set:nnn {sf} {latin}{"1D5BA} -\usv_set:nnn {sfit}{Latin}{"1D608} -\usv_set:nnn {sfit}{latin}{"1D622} -\usv_set:nnn {tt} {num} {"1D7F6} -\usv_set:nnn {tt} {Latin}{"1D670} -\usv_set:nnn {tt} {latin}{"1D68A} -\usv_set:nnn {bf} {num} {"1D7CE} -\usv_set:nnn {bfup} {num} {"1D7CE} -\usv_set:nnn {bfit} {num} {"1D7CE} -\usv_set:nnn {bfup} {Latin}{"1D400} -\usv_set:nnn {bfup} {latin}{"1D41A} -\usv_set:nnn {bfup} {Greek}{"1D6A8} -\usv_set:nnn {bfup} {greek}{"1D6C2} -\usv_set:nnn {bfit} {Latin}{"1D468} -\usv_set:nnn {bfit} {latin}{"1D482} -\usv_set:nnn {bfit} {Greek}{"1D71C} -\usv_set:nnn {bfit} {greek}{"1D736} -\usv_set:nnn {bffrak}{Latin}{"1D56C} -\usv_set:nnn {bffrak}{latin}{"1D586} -\usv_set:nnn {bfscr} {Latin}{"1D4D0} -\usv_set:nnn {bfcal} {Latin}{"1D4D0} -\usv_set:nnn {bfscr} {latin}{"1D4EA} -\usv_set:nnn {bfsf} {num} {"1D7EC} -\usv_set:nnn {bfsfup}{num} {"1D7EC} -\usv_set:nnn {bfsfit}{num} {"1D7EC} -\usv_set:nnn {bfsfup}{Latin}{"1D5D4} -\usv_set:nnn {bfsfup}{latin}{"1D5EE} -\usv_set:nnn {bfsfup}{Greek}{"1D756} -\usv_set:nnn {bfsfup}{greek}{"1D770} -\usv_set:nnn {bfsfit}{Latin}{"1D63C} -\usv_set:nnn {bfsfit}{latin}{"1D656} -\usv_set:nnn {bfsfit}{Greek}{"1D790} -\usv_set:nnn {bfsfit}{greek}{"1D7AA} -\usv_set:nnn {bfsf}{Latin}{ \bool_if:NTF \g_um_upLatin_bool \g_um_bfsfup_Latin_usv \g_um_bfsfit_Latin_usv } -\usv_set:nnn {bfsf}{latin}{ \bool_if:NTF \g_um_uplatin_bool \g_um_bfsfup_latin_usv \g_um_bfsfit_latin_usv } -\usv_set:nnn {bfsf}{Greek}{ \bool_if:NTF \g_um_upGreek_bool \g_um_bfsfup_Greek_usv \g_um_bfsfit_Greek_usv } -\usv_set:nnn {bfsf}{greek}{ \bool_if:NTF \g_um_upgreek_bool \g_um_bfsfup_greek_usv \g_um_bfsfit_greek_usv } -\usv_set:nnn {bf} {Latin}{ \bool_if:NTF \g_um_bfupLatin_bool \g_um_bfup_Latin_usv \g_um_bfit_Latin_usv } -\usv_set:nnn {bf} {latin}{ \bool_if:NTF \g_um_bfuplatin_bool \g_um_bfup_latin_usv \g_um_bfit_latin_usv } -\usv_set:nnn {bf} {Greek}{ \bool_if:NTF \g_um_bfupGreek_bool \g_um_bfup_Greek_usv \g_um_bfit_Greek_usv } -\usv_set:nnn {bf} {greek}{ \bool_if:NTF \g_um_bfupgreek_bool \g_um_bfup_greek_usv \g_um_bfit_greek_usv } -\usv_set:nnn {up}{varTheta} {"3F4} -\usv_set:nnn {up}{Digamma} {"3DC} -\usv_set:nnn {up}{varepsilon}{"3F5} -\usv_set:nnn {up}{vartheta} {"3D1} -\usv_set:nnn {up}{varkappa} {"3F0} -\usv_set:nnn {up}{varphi} {"3D5} -\usv_set:nnn {up}{varrho} {"3F1} -\usv_set:nnn {up}{varpi} {"3D6} -\usv_set:nnn {up}{digamma} {"3DD} -\usv_set:nnn {bfup}{varTheta} {"1D6B9} -\usv_set:nnn {bfup}{Digamma} {"1D7CA} -\usv_set:nnn {bfup}{varepsilon}{"1D6DC} -\usv_set:nnn {bfup}{vartheta} {"1D6DD} -\usv_set:nnn {bfup}{varkappa} {"1D6DE} -\usv_set:nnn {bfup}{varphi} {"1D6DF} -\usv_set:nnn {bfup}{varrho} {"1D6E0} -\usv_set:nnn {bfup}{varpi} {"1D6E1} -\usv_set:nnn {bfup}{digamma} {"1D7CB} -\usv_set:nnn {it}{varTheta} {"1D6F3} -\usv_set:nnn {it}{varepsilon}{"1D716} -\usv_set:nnn {it}{vartheta} {"1D717} -\usv_set:nnn {it}{varkappa} {"1D718} -\usv_set:nnn {it}{varphi} {"1D719} -\usv_set:nnn {it}{varrho} {"1D71A} -\usv_set:nnn {it}{varpi} {"1D71B} -\usv_set:nnn {bfit}{varTheta} {"1D72D} -\usv_set:nnn {bfit}{varepsilon}{"1D750} -\usv_set:nnn {bfit}{vartheta} {"1D751} -\usv_set:nnn {bfit}{varkappa} {"1D752} -\usv_set:nnn {bfit}{varphi} {"1D753} -\usv_set:nnn {bfit}{varrho} {"1D754} -\usv_set:nnn {bfit}{varpi} {"1D755} -\usv_set:nnn {bfsfup}{varTheta} {"1D767} -\usv_set:nnn {bfsfup}{varepsilon}{"1D78A} -\usv_set:nnn {bfsfup}{vartheta} {"1D78B} -\usv_set:nnn {bfsfup}{varkappa} {"1D78C} -\usv_set:nnn {bfsfup}{varphi} {"1D78D} -\usv_set:nnn {bfsfup}{varrho} {"1D78E} -\usv_set:nnn {bfsfup}{varpi} {"1D78F} -\usv_set:nnn {bfsfit}{varTheta} {"1D7A1} -\usv_set:nnn {bfsfit}{varepsilon}{"1D7C4} -\usv_set:nnn {bfsfit}{vartheta} {"1D7C5} -\usv_set:nnn {bfsfit}{varkappa} {"1D7C6} -\usv_set:nnn {bfsfit}{varphi} {"1D7C7} -\usv_set:nnn {bfsfit}{varrho} {"1D7C8} -\usv_set:nnn {bfsfit}{varpi} {"1D7C9} -\usv_set:nnn {up} {Nabla}{"02207} -\usv_set:nnn {it} {Nabla}{"1D6FB} -\usv_set:nnn {bfup} {Nabla}{"1D6C1} -\usv_set:nnn {bfit} {Nabla}{"1D735} -\usv_set:nnn {bfsfup}{Nabla}{"1D76F} -\usv_set:nnn {bfsfit}{Nabla}{"1D7A9} -\usv_set:nnn {up} {partial}{"02202} -\usv_set:nnn {it} {partial}{"1D715} -\usv_set:nnn {bfup} {partial}{"1D6DB} -\usv_set:nnn {bfit} {partial}{"1D74F} -\usv_set:nnn {bfsfup}{partial}{"1D789} -\usv_set:nnn {bfsfit}{partial}{"1D7C3} -\usv_set:nnn {up}{B}{`\B} -\usv_set:nnn {up}{C}{`\C} -\usv_set:nnn {up}{D}{`\D} -\usv_set:nnn {up}{E}{`\E} -\usv_set:nnn {up}{F}{`\F} -\usv_set:nnn {up}{H}{`\H} -\usv_set:nnn {up}{I}{`\I} -\usv_set:nnn {up}{L}{`\L} -\usv_set:nnn {up}{M}{`\M} -\usv_set:nnn {up}{N}{`\N} -\usv_set:nnn {up}{P}{`\P} -\usv_set:nnn {up}{Q}{`\Q} -\usv_set:nnn {up}{R}{`\R} -\usv_set:nnn {up}{Z}{`\Z} -\usv_set:nnn {it}{B}{"1D435} -\usv_set:nnn {it}{C}{"1D436} -\usv_set:nnn {it}{D}{"1D437} -\usv_set:nnn {it}{E}{"1D438} -\usv_set:nnn {it}{F}{"1D439} -\usv_set:nnn {it}{H}{"1D43B} -\usv_set:nnn {it}{I}{"1D43C} -\usv_set:nnn {it}{L}{"1D43F} -\usv_set:nnn {it}{M}{"1D440} -\usv_set:nnn {it}{N}{"1D441} -\usv_set:nnn {it}{P}{"1D443} -\usv_set:nnn {it}{Q}{"1D444} -\usv_set:nnn {it}{R}{"1D445} -\usv_set:nnn {it}{Z}{"1D44D} -\usv_set:nnn {up}{d}{`\d} -\usv_set:nnn {up}{e}{`\e} -\usv_set:nnn {up}{g}{`\g} -\usv_set:nnn {up}{h}{`\h} -\usv_set:nnn {up}{i}{`\i} -\usv_set:nnn {up}{j}{`\j} -\usv_set:nnn {up}{o}{`\o} -\usv_set:nnn {it}{d}{"1D451} -\usv_set:nnn {it}{e}{"1D452} -\usv_set:nnn {it}{g}{"1D454} -\usv_set:nnn {it}{h}{"0210E} -\usv_set:nnn {it}{i}{"1D456} -\usv_set:nnn {it}{j}{"1D457} -\usv_set:nnn {it}{o}{"1D45C} -\usv_set:nnn {bb} {h}{"1D559} -\usv_set:nnn {tt} {h}{"1D691} -\usv_set:nnn {scr} {h}{"1D4BD} -\usv_set:nnn {frak} {h}{"1D525} -\usv_set:nnn {bfup} {h}{"1D421} -\usv_set:nnn {bfit} {h}{"1D489} -\usv_set:nnn {sfup} {h}{"1D5C1} -\usv_set:nnn {sfit} {h}{"1D629} -\usv_set:nnn {bffrak}{h}{"1D58D} -\usv_set:nnn {bfscr} {h}{"1D4F1} -\usv_set:nnn {bfsfup}{h}{"1D5F5} -\usv_set:nnn {bfsfit}{h}{"1D65D} -\usv_set:nnn {up}{dotlessi}{"00131} -\usv_set:nnn {up}{dotlessj}{"00237} -\usv_set:nnn {it}{dotlessi}{"1D6A4} -\usv_set:nnn {it}{dotlessj}{"1D6A5} -\usv_set:nnn {bb}{C}{"2102} -\usv_set:nnn {bb}{H}{"210D} -\usv_set:nnn {bb}{N}{"2115} -\usv_set:nnn {bb}{P}{"2119} -\usv_set:nnn {bb}{Q}{"211A} -\usv_set:nnn {bb}{R}{"211D} -\usv_set:nnn {bb}{Z}{"2124} -\usv_set:nnn {up}{Pi} {"003A0} -\usv_set:nnn {up}{pi} {"003C0} -\usv_set:nnn {up}{Gamma} {"00393} -\usv_set:nnn {up}{gamma} {"003B3} -\usv_set:nnn {up}{summation}{"02211} -\usv_set:nnn {it}{Pi} {"1D6F1} -\usv_set:nnn {it}{pi} {"1D70B} -\usv_set:nnn {it}{Gamma} {"1D6E4} -\usv_set:nnn {it}{gamma} {"1D6FE} -\usv_set:nnn {bb}{Pi} {"0213F} -\usv_set:nnn {bb}{pi} {"0213C} -\usv_set:nnn {bb}{Gamma} {"0213E} -\usv_set:nnn {bb}{gamma} {"0213D} -\usv_set:nnn {bb}{summation}{"02140} -\usv_set:nnn {bbit}{D}{"2145} -\usv_set:nnn {bbit}{d}{"2146} -\usv_set:nnn {bbit}{e}{"2147} -\usv_set:nnn {bbit}{i}{"2148} -\usv_set:nnn {bbit}{j}{"2149} -\usv_set:nnn {scr}{B}{"212C} -\usv_set:nnn {scr}{E}{"2130} -\usv_set:nnn {scr}{F}{"2131} -\usv_set:nnn {scr}{H}{"210B} -\usv_set:nnn {scr}{I}{"2110} -\usv_set:nnn {scr}{L}{"2112} -\usv_set:nnn {scr}{M}{"2133} -\usv_set:nnn {scr}{R}{"211B} -\usv_set:nnn {scr}{e}{"212F} -\usv_set:nnn {scr}{g}{"210A} -\usv_set:nnn {scr}{o}{"2134} -\usv_set:nnn {cal}{B}{"212C} -\usv_set:nnn {cal}{E}{"2130} -\usv_set:nnn {cal}{F}{"2131} -\usv_set:nnn {cal}{H}{"210B} -\usv_set:nnn {cal}{I}{"2110} -\usv_set:nnn {cal}{L}{"2112} -\usv_set:nnn {cal}{M}{"2133} -\usv_set:nnn {cal}{R}{"211B} -\usv_set:nnn {frak}{C}{"212D} -\usv_set:nnn {frak}{H}{"210C} -\usv_set:nnn {frak}{I}{"2111} -\usv_set:nnn {frak}{R}{"211C} -\usv_set:nnn {frak}{Z}{"2128} \tl_map_inline:nn { \new@mathgroup\cdp@list\cdp@elt\DeclareMathSizes - \@DeclareMathSizes\newmathalphabet\newmathalphabet@@\newmathalphabet@@@ + \@DeclareMathSizes\newmathalphabet\newmathalphabet__um\newmathalphabet__um@ \DeclareMathVersion\define@mathalphabet\define@mathgroup\addtoversion \version@list\version@elt\alpha@list\alpha@elt \restore@mathversion\init@restore@version\dorestore@version\process@table @@ -265,221 +31,355 @@ \DeclareMathAccent\set@mathaccent\DeclareMathSymbol\set@mathchar \set@mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter \@DeclareMathDelimiter\@xDeclareMathDelimiter\set@mathdelimiter - \set@@mathdelimiter\DeclareMathRadical\mathchar@type + \set__ummathdelimiter\DeclareMathRadical\mathchar@type \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@ } { \tl_remove_once:Nn \@preamblecmds {\do#1} } -\cs_set:Nn \um_set_mathsymbol:nNNn +\cs_set:Nn \__um_set_mathsymbol:nNNn { - \tl_case:Nnn #3 { - \mathop { \um_set_big_operator:nnn {#1} {#2} {#4} } - \mathopen { \um_set_math_open:nnn {#1} {#2} {#4} } - \mathclose { \um_set_math_close:nnn {#1} {#2} {#4} } - \mathfence { \um_set_math_fence:nnnn {#1} {#2} {#3} {#4} } + \int_compare:nT { \char_value_catcode:n {#4} == 11 } + { \char_set_catcode_other:n {#4} } + + \tl_case:Nn #3 + { + \mathord { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathalpha { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathbin { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathrel { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathpunct { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathop { \__um_set_big_operator:nnn {#1} {#2} {#4} } + \mathopen { \__um_set_math_open:nnn {#1} {#2} {#4} } + \mathclose { \__um_set_math_close:nnn {#1} {#2} {#4} } + \mathfence { \__um_set_math_fence:nnnn {#1} {#2} {#3} {#4} } \mathaccent - { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {fixed} {#1} {#4} } } + { \__um_set_math_accent:Nnnn #2 {fixed} {#1} {#4} } \mathbotaccent - { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {bottom~ fixed} {#1} {#4} } } + { \__um_set_math_accent:Nnnn #2 {bottom~ fixed} {#1} {#4} } + \mathaccentwide + { \__um_set_math_accent:Nnnn #2 {} {#1} {#4} } + \mathbotaccentwide + { \__um_set_math_accent:Nnnn #2 {bottom} {#1} {#4} } \mathover - { - \cs_set_protected_nopar:Npx #2 ##1 - { \mathop { \um_accent:nnn {} {#1} {#4} {##1} } \limits } - } + { \__um_set_math_overunder:Nnnn #2 {} {#1} {#4} } \mathunder - { - \cs_set_protected_nopar:Npx #2 ##1 - { \mathop { \um_accent:nnn {bottom} {#1} {#4} {##1} } \limits } - } - }{ - \um_set_mathcode:nnn {#4} {#3} {#1} - } + { \__um_set_math_overunder:Nnnn #2 {bottom} {#1} {#4} } + } } \edef\mathfence{\string\mathfence} \edef\mathover{\string\mathover} \edef\mathunder{\string\mathunder} \edef\mathbotaccent{\string\mathbotaccent} -\cs_new:Nn \um_set_big_operator:nnn +\edef\mathaccentwide{\string\mathaccentwide} +\edef\mathbotaccentwide{\string\mathbotaccentwide} +\cs_new:Nn \__um_set_big_operator:nnn { \group_begin: \char_set_catcode_active:n {#3} - \char_gmake_mathactive:n {#3} - \um_active_char_set:wc #3 \q_nil { \cs_to_str:N #2 _sym } + \__um_char_gmake_mathactive:n {#3} + \__um_active_char_set:wc #3 \q_nil { \cs_to_str:N #2 _sym } \group_end: - \um_set_mathchar:cNnn {\cs_to_str:N #2 op} \mathop {#1} {#3} + + \__um_set_mathchar:cNnn {\cs_to_str:N #2 op} \mathop {#1} {#3} + \cs_gset:cpx { \cs_to_str:N #2 _sym } { \exp_not:c { \cs_to_str:N #2 op } - \exp_not:n { \tl_if_in:NnT \l_um_nolimits_tl {#2} \nolimits } + \exp_not:n { \tl_if_in:NnT \l__um_nolimits_tl {#2} \nolimits } } } -\cs_new:Nn \um_set_math_open:nnn +\cs_new:Nn \__um_set_math_open:nnn { - \tl_if_in:NnTF \l_um_radicals_tl {#2} + \tl_if_in:NnTF \l__um_radicals_tl {#2} { \cs_gset_protected_nopar:cpx {\cs_to_str:N #2 sign} - { \um_radical:nn {#1} {#3} } - \tl_set:cn {l_um_radical_\cs_to_str:N #2_tl} {\use:c{sym #1}~ #3} + { \__um_radical:nn {#1} {#3} } + \tl_set:cn {l__um_radical_\cs_to_str:N #2_tl} {\use:c{sym #1}~ #3} } { - \um_set_delcode:nnn {#1} {#3} {#3} - \um_set_mathcode:nnn {#3} \mathopen {#1} + \__um_set_delcode:nnn {#1} {#3} {#3} + \__um_set_mathcode:nnn {#3} \mathopen {#1} \cs_gset_protected_nopar:Npx #2 - { \um_delimiter:Nnn \mathopen {#1} {#3} } + { \__um_delimiter:Nnn \mathopen {#1} {#3} } } } -\cs_new:Nn \um_set_math_close:nnn +\cs_new:Nn \__um_set_math_close:nnn { - \um_set_delcode:nnn {#1} {#3} {#3} - \um_set_mathcode:nnn {#3} \mathclose {#1} + \__um_set_delcode:nnn {#1} {#3} {#3} + \__um_set_mathcode:nnn {#3} \mathclose {#1} \cs_gset_protected_nopar:Npx #2 - { \um_delimiter:Nnn \mathclose {#1} {#3} } + { \__um_delimiter:Nnn \mathclose {#1} {#3} } } -\cs_new:Nn \um_set_math_fence:nnnn +\cs_new:Nn \__um_set_math_fence:nnnn { - \um_set_mathcode:nnn {#4} {#3} {#1} - \um_set_delcode:nnn {#1} {#4} {#4} + \__um_set_mathcode:nnn {#4} {#3} {#1} + \__um_set_delcode:nnn {#1} {#4} {#4} \cs_gset_protected_nopar:cpx {l \cs_to_str:N #2} - { \um_delimiter:Nnn \mathopen {#1} {#4} } + { \__um_delimiter:Nnn \mathopen {#1} {#4} } \cs_gset_protected_nopar:cpx {r \cs_to_str:N #2} - { \um_delimiter:Nnn \mathclose {#1} {#4} } + { \__um_delimiter:Nnn \mathclose {#1} {#4} } + } +\cs_new:Nn \__um_set_math_accent:Nnnn + { + \cs_gset_protected_nopar:Npx #1 + { \__um_accent:nnn {#2} {#3} {#4} } + } +\cs_new:Nn \__um_set_math_overunder:Nnnn + { + \cs_gset_protected_nopar:Npx #1 ##1 + { + \mathop + { \__um_accent:nnn {#2} {#3} {#4} {##1} } + \limits + } + } +\keys_define:nn {__um_mathface} + { + version .code:n = + { \tl_set:Nn \l__um_mversion_tl {#1} } + } + +\DeclareDocumentCommand \setmathfontface { m O{} m O{} } + { + \tl_clear:N \l__um_mversion_tl + + \keys_set_known:nnN {__um_mathface} {#2,#4} \l__um_keyval_clist + \exp_args:Nnx \fontspec_set_family:Nxn \l__um_tmpa_tl + { ItalicFont={}, BoldFont={}, \exp_not:V \l__um_keyval_clist } {#3} + + \tl_if_empty:NT \l__um_mversion_tl + { + \tl_set:Nn \l__um_mversion_tl {normal} + \DeclareMathAlphabet #1 {\g_fontspec_encoding_tl} {\l__um_tmpa_tl} {\mddefault} {\updefault} + } + \SetMathAlphabet #1 {\l__um_mversion_tl} {\g_fontspec_encoding_tl} {\l__um_tmpa_tl} {\mddefault} {\updefault} + + % integrate with fontspec's \setmathrm etc: + \tl_case:Nn #1 + { + \mathrm { \cs_set_eq:NN \g__fontspec_mathrm_tl \l__um_tmpa_tl } + \mathsf { \cs_set_eq:NN \g__fontspec_mathsf_tl \l__um_tmpa_tl } + \mathtt { \cs_set_eq:NN \g__fontspec_mathtt_tl \l__um_tmpa_tl } + } + } + +\@onlypreamble \setmathfontface +\DeclareDocumentCommand \setoperatorfont {m} + { \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} + \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} + \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} + \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 } -\DeclareDocumentCommand \setmathfont { O{} m } { - \tl_set:Nn \l_um_fontname_tl {#2} - \um_init: +\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{} } + { + \tl_set:Nn \l__um_fontname_tl {#2} + \__um_init: \cs_if_exist:cF { S@ \f@size } { \calculate@math@sizes } \csname S@\f@size\endcsname - \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: - \cs_if_exist:cF { sym \um_symfont_tl } + \keys_set_known:nnN {unicode-math} {#1,#3} \l__um_unknown_keys_clist + \bool_if:NT \l__um_init_bool { \__um_log:n {default-math-font} } + + \csname TIC\endcsname + \__um_fontspec_select_font: + \csname TOC\endcsname + \bool_if:nT { \l__um_ot_math_bool && !\g__um_mainfont_already_set_bool } + { + \__um_declare_math_sizes: + \__um_fontspec_select_font: + } + \cs_if_exist:cF { sym \__um_symfont_tl } { - \DeclareSymbolFont{\um_symfont_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + \DeclareSymbolFont{\__um_symfont_tl} + {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} } - \SetSymbolFont{\um_symfont_tl}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \SetSymbolFont{\__um_symfont_tl}{\l__um_mversion_tl} + {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} + \tl_set:Nn \l__um_tmpa_tl {normal} + \tl_if_eq:NNT \l__um_mversion_tl \l__um_tmpa_tl { - \SetSymbolFont{\um_symfont_tl}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + \SetSymbolFont{\__um_symfont_tl}{bold} + {\encodingdefault}{\l__um_family_tl}{\bfdefault}{\updefault} } - \bool_if:nT { \l_um_ot_math_bool && !\g_um_mainfont_already_set_bool } - { - \bool_set_true:N \g_um_mainfont_already_set_bool - \um_declare_math_sizes: - \um_setup_legacy_fam_two: - \um_setup_legacy_fam_three: - } - \um_input_math_symbol_table: - \um_remap_symbols: - \um_setup_mathactives: - \um_setup_accents: - \um_setup_delcodes: - \um_setup_alphabets: - \um_setup_negations: + \bool_if:nT { \l__um_ot_math_bool && !\g__um_mainfont_already_set_bool } + { + \bool_set_true:N \g__um_mainfont_already_set_bool + \__um_setup_legacy_fam_two: + \__um_setup_legacy_fam_three: + } + \csname TIC\endcsname + \__um_input_math_symbol_table: + \csname TOC\endcsname + \__um_remap_symbols: + \__um_setup_mathactives: + \__um_setup_delcodes: + \csname TIC\endcsname + \__um_setup_alphabets: + \csname TOC\endcsname + \__um_setup_negations: \ignorespaces -} + } \cs_set_eq:NN \resetmathfont \setmathfont -\cs_new:Nn \um_init: +\cs_new:Nn \__um_init: { - \bool_set_true:N \l_um_ot_math_bool + \bool_set_true:N \l__um_ot_math_bool \cs_set_eq:NN \glb@currsize \scan_stop: - \bool_set_true:N \l_um_init_bool - \seq_clear:N \l_um_char_range_seq - \clist_clear:N \l_um_char_num_range_clist - \seq_clear:N \l_um_mathalph_seq - \seq_clear:N \l_um_missing_alph_seq - \tl_set:Nn \l_um_mversion_tl {normal} - \tl_set:Nn \um_symfont_tl {operators} - \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_noparse:nnn - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_noparse:Nnn - \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_noparse:nnn - \cs_set_eq:NN \um_maybe_init_alphabet:n \um_init_alphabet:n - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_noparse:nn - \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_noparse:nn - \cs_set_eq:NN \um_make_mathactive:nNN \um_make_mathactive_noparse:nNN - \tl_set:Nn \l_um_script_features_tl {Style=MathScript} - \tl_set:Nn \l_um_sscript_features_tl {Style=MathScriptScript} - \tl_set_eq:NN \l_um_script_font_tl \l_um_fontname_tl - \tl_set_eq:NN \l_um_sscript_font_tl \l_um_fontname_tl - } -\cs_new:Nn \um_declare_math_sizes: + \bool_set_true:N \l__um_init_bool + \seq_clear:N \l__um_char_range_seq + \clist_clear:N \l__um_char_nrange_clist + \seq_clear:N \l__um_mathalph_seq + \seq_clear:N \l__um_missing_alph_seq + \tl_set:Nn \l__um_mversion_tl {normal} + \tl_set:Nn \__um_symfont_tl {operators} + \cs_set_eq:NN \__um_sym:nnn \__um_process_symbol_noparse:nnn + \cs_set_eq:NN \__um_set_mathalphabet_char:nnn \__um_mathmap_noparse:nnn + \cs_set_eq:NN \__um_remap_symbol:nnn \__um_remap_symbol_noparse:nnn + \cs_set_eq:NN \__um_maybe_init_alphabet:n \__um_init_alphabet:n + \cs_set_eq:NN \__um_map_char_single:nn \__um_map_char_noparse:nn + \cs_set_eq:NN \__um_assign_delcode:nn \__um_assign_delcode_noparse:nn + \cs_set_eq:NN \__um_make_mathactive:nNN \__um_make_mathactive_noparse:nNN + \tl_set:Nn \l__um_script_features_tl {Style=MathScript} + \tl_set:Nn \l__um_sscript_features_tl {Style=MathScriptScript} + \tl_set_eq:NN \l__um_script_font_tl \l__um_fontname_tl + \tl_set_eq:NN \l__um_sscript_font_tl \l__um_fontname_tl + } +\cs_new:Nn \__um_declare_math_sizes: { - \dim_compare:nF { \fontdimen 10 \l_um_font == 0pt } + \dim_compare:nF { \fontdimen 10 \l__um_font == 0pt } { \DeclareMathSizes { \f@size } { \f@size } - { \um_fontdimen_to_scale:nn {10} {\l_um_font} } - { \um_fontdimen_to_scale:nn {11} {\l_um_font} } + { \__um_fontdimen_to_scale:nn {10} {\l__um_font} } + { \__um_fontdimen_to_scale:nn {11} {\l__um_font} } } } -\cs_new:Nn \um_setup_legacy_fam_two: +\cs_new:Nn \__um_setup_legacy_fam_two: { - \fontspec_set_family:Nxn \l_um_family_tl + \fontspec_set_family:Nxn \l__um_family_tl { - \l_um_font_keyval_tl, + \l__um_font_keyval_tl, Scale=1.00001, FontAdjustment = { - \fontdimen8\font= \um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax - \fontdimen9\font= \um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax - \fontdimen10\font=\um_get_fontparam:nn {32} {StackTopShiftUp}\relax - \fontdimen11\font=\um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax - \fontdimen12\font=\um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax - \fontdimen13\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax - \fontdimen14\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax - \fontdimen15\font=\um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax - \fontdimen16\font=\um_get_fontparam:nn {18} {SubscriptShiftDown}\relax - \fontdimen17\font=\um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax - \fontdimen18\font=\um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax - \fontdimen19\font=\um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax + \fontdimen8\font= \__um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax + \fontdimen9\font= \__um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax + \fontdimen10\font=\__um_get_fontparam:nn {32} {StackTopShiftUp}\relax + \fontdimen11\font=\__um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax + \fontdimen12\font=\__um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax + \fontdimen13\font=\__um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen14\font=\__um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen15\font=\__um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax + \fontdimen16\font=\__um_get_fontparam:nn {18} {SubscriptShiftDown}\relax + \fontdimen17\font=\__um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax + \fontdimen18\font=\__um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax + \fontdimen19\font=\__um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax \fontdimen20\font=0pt\relax % delim1 = FractionDelimiterDisplaySize \fontdimen21\font=0pt\relax % delim2 = FractionDelimiterSize - \fontdimen22\font=\um_get_fontparam:nn {15} {AxisHeight}\relax + \fontdimen22\font=\__um_get_fontparam:nn {15} {AxisHeight}\relax } - } {\l_um_fontname_tl} - \SetSymbolFont{symbols}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + } {\l__um_fontname_tl} + \SetSymbolFont{symbols}{\l__um_mversion_tl} + {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \tl_set:Nn \l__um_tmpa_tl {normal} + \tl_if_eq:NNT \l__um_mversion_tl \l__um_tmpa_tl { \SetSymbolFont{symbols}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + {\encodingdefault}{\l__um_family_tl}{\bfdefault}{\updefault} } } -\cs_new:Nn \um_setup_legacy_fam_three: +\cs_new:Nn \__um_setup_legacy_fam_three: { - \fontspec_set_family:Nxn \l_um_family_tl + \fontspec_set_family:Nxn \l__um_family_tl { - \l_um_font_keyval_tl, + \l__um_font_keyval_tl, Scale=0.99999, FontAdjustment={ - \fontdimen8\font= \um_get_fontparam:nn {48} {FractionRuleThickness}\relax - \fontdimen9\font= \um_get_fontparam:nn {28} {UpperLimitGapMin}\relax - \fontdimen10\font=\um_get_fontparam:nn {30} {LowerLimitGapMin}\relax - \fontdimen11\font=\um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax - \fontdimen12\font=\um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax + \fontdimen8\font= \__um_get_fontparam:nn {48} {FractionRuleThickness}\relax + \fontdimen9\font= \__um_get_fontparam:nn {28} {UpperLimitGapMin}\relax + \fontdimen10\font=\__um_get_fontparam:nn {30} {LowerLimitGapMin}\relax + \fontdimen11\font=\__um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax + \fontdimen12\font=\__um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax \fontdimen13\font=0pt\relax } - } {\l_um_fontname_tl} - \SetSymbolFont{largesymbols}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + } {\l__um_fontname_tl} + \SetSymbolFont{largesymbols}{\l__um_mversion_tl} + {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \tl_set:Nn \l__um_tmpa_tl {normal} + \tl_if_eq:NNT \l__um_mversion_tl \l__um_tmpa_tl { \SetSymbolFont{largesymbols}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + {\encodingdefault}{\l__um_family_tl}{\bfdefault}{\updefault} } } -\cs_new:Nn \um_get_fontparam:nn - { \directlua{fontspec.mathfontdimen("l_um_font","#2")} } -\cs_new:Nn \um_fontspec_select_font: +\cs_new:Nn \__um_get_fontparam:nn + { \directlua{fontspec.mathfontdimen("l__um_font","#2")} } +\cs_new:Nn \__um_fontspec_select_font: { - \tl_set:Nx \l_um_font_keyval_tl { + \tl_set:Nx \l__um_font_keyval_tl { Renderer = Basic, BoldItalicFont = {}, ItalicFont = {}, Script = Math, @@ -490,131 +390,130 @@ } , { Size = \sf@size-\tf@size , - Font = \l_um_script_font_tl , - \l_um_script_features_tl + Font = \l__um_script_font_tl , + \l__um_script_features_tl } , { Size = -\sf@size , - Font = \l_um_sscript_font_tl , - \l_um_sscript_features_tl + Font = \l__um_sscript_font_tl , + \l__um_sscript_features_tl } } , - \l_um_unknown_keys_clist + \l__um_unknown_keys_clist } - \fontspec_set_fontface:NNxn \l_um_font \l_um_family_tl - {\l_um_font_keyval_tl} {\l_um_fontname_tl} + \fontspec_set_fontface:NNxn \l__um_font \l__um_family_tl + {\l__um_font_keyval_tl} {\l__um_fontname_tl} \group_begin: - \fontfamily{\l_um_family_tl}\selectfont - \fontspec_if_script:nF {math} {\bool_gset_false:N \l_um_ot_math_bool} + \fontfamily{\l__um_family_tl}\selectfont + \fontspec_if_script:nF {math} {\bool_gset_false:N \l__um_ot_math_bool} \group_end: } -\cs_set:Nn \um_process_symbol_noparse:nnn +\cs_set:Nn \__um_process_symbol_noparse:nnn { - \um_set_mathsymbol:nNNn {\um_symfont_tl} #2#3{#1} + \__um_set_mathsymbol:nNNn {\__um_symfont_tl} #2 #3 {#1} } -\cs_set:Nn \um_process_symbol_parse:nnn +\cs_set:Nn \__um_process_symbol_parse:nnn { - \um_if_char_spec:nNNT{#1}{#2}{#3} + \__um_if_char_spec:nNNT {#1} {#2} {#3} { - \um_process_symbol_noparse:nnn {#1}{#2}{#3} + \__um_process_symbol_noparse:nnn {#1} {#2} {#3} } } -\cs_new:Npn \um_remap_symbols: +\cs_new:Npn \__um_remap_symbols: { - \um_remap_symbol:nnn{`\-}{\mathbin}{"02212}% hyphen to minus - \um_remap_symbol:nnn{`\*}{\mathbin}{"02217}% text asterisk to "centred asterisk" - \bool_if:NF \g_um_literal_colon_bool + \__um_remap_symbol:nnn{`\-}{\mathbin}{"02212}% hyphen to minus + \__um_remap_symbol:nnn{`\*}{\mathbin}{"02217}% text asterisk to "centred asterisk" + \bool_if:NF \g__um_literal_colon_bool { - \um_remap_symbol:nnn{`\:}{\mathrel}{"02236}% colon to ratio (i.e., punct to rel) + \__um_remap_symbol:nnn{`\:}{\mathrel}{"02236}% colon to ratio (i.e., punct to rel) } } -\cs_new:Nn \um_remap_symbol_parse:nnn +\cs_new:Nn \__um_remap_symbol_parse:nnn { - \um_if_char_spec:nNNT {#3} {\@nil} {#2} - { - \um_remap_symbol_noparse:nnn {#1} {#2} {#3} - } + \__um_if_char_spec:nNNT {#3} {\@nil} {#2} + { \__um_remap_symbol_noparse:nnn {#1} {#2} {#3} } } -\cs_new:Nn \um_remap_symbol_noparse:nnn +\cs_new:Nn \__um_remap_symbol_noparse:nnn { \clist_map_inline:nn {#1} - { - \um_set_mathcode:nnnn {##1} {#2} {\um_symfont_tl} {#3} - } + { \__um_set_mathcode:nnnn {##1} {#2} {\__um_symfont_tl} {#3} } } -\cs_new:Npn \um_setup_mathactives: +\cs_new:Npn \__um_setup_mathactives: { - \um_make_mathactive:nNN {"2032} \um_prime_single_mchar \mathord - \um_make_mathactive:nNN {"2033} \um_prime_double_mchar \mathord - \um_make_mathactive:nNN {"2034} \um_prime_triple_mchar \mathord - \um_make_mathactive:nNN {"2057} \um_prime_quad_mchar \mathord - \um_make_mathactive:nNN {"2035} \um_backprime_single_mchar \mathord - \um_make_mathactive:nNN {"2036} \um_backprime_double_mchar \mathord - \um_make_mathactive:nNN {"2037} \um_backprime_triple_mchar \mathord - \um_make_mathactive:nNN {`\'} \mathstraightquote \mathord - \um_make_mathactive:nNN {`\`} \mathbacktick \mathord + \__um_make_mathactive:nNN {"2032} \__um_prime_single_mchar \mathord + \__um_make_mathactive:nNN {"2033} \__um_prime_double_mchar \mathord + \__um_make_mathactive:nNN {"2034} \__um_prime_triple_mchar \mathord + \__um_make_mathactive:nNN {"2057} \__um_prime_quad_mchar \mathord + \__um_make_mathactive:nNN {"2035} \__um_backprime_single_mchar \mathord + \__um_make_mathactive:nNN {"2036} \__um_backprime_double_mchar \mathord + \__um_make_mathactive:nNN {"2037} \__um_backprime_triple_mchar \mathord + \__um_make_mathactive:nNN {`\'} \mathstraightquote \mathord + \__um_make_mathactive:nNN {`\`} \mathbacktick \mathord } -\cs_new:Nn \um_make_mathactive_parse:nNN +\cs_new:Nn \__um_make_mathactive_parse:nNN { - \um_if_char_spec:nNNT {#1} #2 #3 - { \um_make_mathactive_noparse:nNN {#1} #2 #3 } + \__um_if_char_spec:nNNT {#1} #2 #3 + { \__um_make_mathactive_noparse:nNN {#1} #2 #3 } } -\cs_new:Nn \um_make_mathactive_noparse:nNN +\cs_new:Nn \__um_make_mathactive_noparse:nNN { - \um_set_mathchar:NNnn #2 #3 {\um_symfont_tl} {#1} - \char_gmake_mathactive:n {#1} + \__um_set_mathchar:NNnn #2 #3 {\__um_symfont_tl} {#1} + \__um_char_gmake_mathactive:n {#1} } -\cs_new:Nn \um_assign_delcode_noparse:nn - { - \um_set_delcode:nnn \um_symfont_tl {#1} {#2} - } -\cs_new:Nn \um_assign_delcode_parse:nn - { - \um_if_char_spec:nNNT {#2} {\@nil} {\@nil} - { - \um_assign_delcode_noparse:nn {#1} {#2} - } - } -\cs_new:Nn \um_assign_delcode:n { \um_assign_delcode:nn {#1} {#1} } -\cs_new:Npn \um_setup_delcodes: - { - \um_assign_delcode:nn {`\.} {\c_zero} % ensure \left. and \right. work - \um_assign_delcode:nn {`\/} {\g_um_slash_delimiter_usv} - \um_assign_delcode:nn {"2044} {\g_um_slash_delimiter_usv} % fracslash - \um_assign_delcode:nn {"2215} {\g_um_slash_delimiter_usv} % divslash - \um_assign_delcode:n {"005C} % backslash - \um_assign_delcode:nn {`\<} {"27E8} % angle brackets with ascii notation - \um_assign_delcode:nn {`\>} {"27E9} % angle brackets with ascii notation - \um_assign_delcode:n {"2191} % up arrow - \um_assign_delcode:n {"2193} % down arrow - \um_assign_delcode:n {"2195} % updown arrow - \um_assign_delcode:n {"219F} % up arrow twohead - \um_assign_delcode:n {"21A1} % down arrow twohead - \um_assign_delcode:n {"21A5} % up arrow from bar - \um_assign_delcode:n {"21A7} % down arrow from bar - \um_assign_delcode:n {"21A8} % updown arrow from bar - \um_assign_delcode:n {"21BE} % up harpoon right - \um_assign_delcode:n {"21BF} % up harpoon left - \um_assign_delcode:n {"21C2} % down harpoon right - \um_assign_delcode:n {"21C3} % down harpoon left - \um_assign_delcode:n {"21C5} % arrows up down - \um_assign_delcode:n {"21F5} % arrows down up - \um_assign_delcode:n {"21C8} % arrows up up - \um_assign_delcode:n {"21CA} % arrows down down - \um_assign_delcode:n {"21D1} % double up arrow - \um_assign_delcode:n {"21D3} % double down arrow - \um_assign_delcode:n {"21D5} % double updown arrow - \um_assign_delcode:n {"21DE} % up arrow double stroke - \um_assign_delcode:n {"21DF} % down arrow double stroke - \um_assign_delcode:n {"21E1} % up arrow dashed - \um_assign_delcode:n {"21E3} % down arrow dashed - \um_assign_delcode:n {"21E7} % up white arrow - \um_assign_delcode:n {"21E9} % down white arrow - \um_assign_delcode:n {"21EA} % up white arrow from bar - \um_assign_delcode:n {"21F3} % updown white arrow - } -\tl_new:N \l_um_nolimits_tl -\tl_set:Nn \l_um_nolimits_tl +\cs_new:Nn \__um_assign_delcode_noparse:nn + { + \__um_set_delcode:nnn \__um_symfont_tl {#1} {#2} + } +\cs_new:Nn \__um_assign_delcode_parse:nn + { + \__um_if_char_spec:nNNT {#2} {\@nil} {\@nil} + { + \__um_assign_delcode_noparse:nn {#1} {#2} + } + } +\cs_new:Nn \__um_assign_delcode:n { \__um_assign_delcode:nn {#1} {#1} } +\cs_new:Npn \__um_setup_delcodes: + { + % ensure \left. and \right. work: + \__um_set_delcode:nnn \__um_symfont_tl {`\.} {\c_zero} + % this is forcefully done to fix a bug -- indicates a larger problem! + + \__um_assign_delcode:nn {`\/} {\g__um_slash_delimiter_usv} + \__um_assign_delcode:nn {"2044} {\g__um_slash_delimiter_usv} % fracslash + \__um_assign_delcode:nn {"2215} {\g__um_slash_delimiter_usv} % divslash + \__um_assign_delcode:n {"005C} % backslash + \__um_assign_delcode:nn {`\<} {"27E8} % angle brackets with ascii notation + \__um_assign_delcode:nn {`\>} {"27E9} % angle brackets with ascii notation + \__um_assign_delcode:n {"2191} % up arrow + \__um_assign_delcode:n {"2193} % down arrow + \__um_assign_delcode:n {"2195} % updown arrow + \__um_assign_delcode:n {"219F} % up arrow twohead + \__um_assign_delcode:n {"21A1} % down arrow twohead + \__um_assign_delcode:n {"21A5} % up arrow from bar + \__um_assign_delcode:n {"21A7} % down arrow from bar + \__um_assign_delcode:n {"21A8} % updown arrow from bar + \__um_assign_delcode:n {"21BE} % up harpoon right + \__um_assign_delcode:n {"21BF} % up harpoon left + \__um_assign_delcode:n {"21C2} % down harpoon right + \__um_assign_delcode:n {"21C3} % down harpoon left + \__um_assign_delcode:n {"21C5} % arrows up down + \__um_assign_delcode:n {"21F5} % arrows down up + \__um_assign_delcode:n {"21C8} % arrows up up + \__um_assign_delcode:n {"21CA} % arrows down down + \__um_assign_delcode:n {"21D1} % double up arrow + \__um_assign_delcode:n {"21D3} % double down arrow + \__um_assign_delcode:n {"21D5} % double updown arrow + \__um_assign_delcode:n {"21DE} % up arrow double stroke + \__um_assign_delcode:n {"21DF} % down arrow double stroke + \__um_assign_delcode:n {"21E1} % up arrow dashed + \__um_assign_delcode:n {"21E3} % down arrow dashed + \__um_assign_delcode:n {"21E7} % up white arrow + \__um_assign_delcode:n {"21E9} % down white arrow + \__um_assign_delcode:n {"21EA} % up white arrow from bar + \__um_assign_delcode:n {"21F3} % updown white arrow + } +\tl_new:N \l__um_nolimits_tl +\tl_set:Nn \l__um_nolimits_tl { \int\iint\iiint\iiiint\oint\oiint\oiiint \intclockwise\varointclockwise\ointctrclockwise\sumint @@ -624,38 +523,38 @@ } \DeclareDocumentCommand \addnolimits {m} { - \tl_put_right:Nn \l_um_nolimits_tl {#1} + \tl_put_right:Nn \l__um_nolimits_tl {#1} } \DeclareDocumentCommand \removenolimits {m} { - \tl_remove_all:Nn \l_um_nolimits_tl {#1} + \tl_remove_all:Nn \l__um_nolimits_tl {#1} } -\tl_new:N \l_um_radicals_tl -\tl_set:Nn \l_um_radicals_tl {\sqrt \longdivision} -\cs_new_protected_nopar:Nn \um_new_cramped_style:N +\tl_new:N \l__um_radicals_tl +\tl_set:Nn \l__um_radicals_tl {\sqrt \longdivision} +\cs_new_protected_nopar:Nn \__um_new_cramped_style:N { \cs_new_eq:Nc #1 { luatex \cs_to_str:N #1 } } -\um_new_cramped_style:N \crampeddisplaystyle -\um_new_cramped_style:N \crampedtextstyle -\um_new_cramped_style:N \crampedscriptstyle -\um_new_cramped_style:N \crampedscriptscriptstyle -\cs_new_protected_nopar:Nn \um_font_param:nnnnn +\__um_new_cramped_style:N \crampeddisplaystyle +\__um_new_cramped_style:N \crampedtextstyle +\__um_new_cramped_style:N \crampedscriptstyle +\__um_new_cramped_style:N \crampedscriptscriptstyle +\cs_new_protected_nopar:Nn \__um_font_param:nnnnn { - \tl_set:Nn \l_um_tmpa_tl { #1 } - \tl_remove_all:Nn \l_um_tmpa_tl { _ } - \um_font_param_aux:ccc { um_ #1 :N } { um_set_ #1 :N } - { luatexUmath \l_um_tmpa_tl } + \tl_set:Nn \l__um_tmpa_tl { #1 } + \tl_remove_all:Nn \l__um_tmpa_tl { _ } + \__um_font_param_aux:ccc { __um_ #1 :N } { __um_set_ #1 :Nn } + { luatexUmath \l__um_tmpa_tl } } -\cs_new_protected_nopar:Nn \um_font_param:nnn +\cs_new_protected_nopar:Nn \__um_font_param:nnn { - \um_font_param:nnnnn { #1 } { #2 } { #2 } { #3 } { #3 } + \__um_font_param:nnnnn { #1 } { #2 } { #2 } { #3 } { #3 } } -\cs_new_protected_nopar:Nn \um_font_param:nn +\cs_new_protected_nopar:Nn \__um_font_param:nn { - \um_font_param:nnnnn { #1 } { #2 } { #2 } { #2 } { #2 } + \__um_font_param:nnnnn { #1 } { #2 } { #2 } { #2 } { #2 } } -\cs_new_protected_nopar:Nn \um_font_param:n - { \um_font_param:nnnnn { #1 } { 0 } { 0 } { 0 } { 0 } } -\cs_new_protected_nopar:Nn \um_font_param_aux:NNN +\cs_new_protected_nopar:Nn \__um_font_param:n + { \__um_font_param:nnnnn { #1 } { 0 } { 0 } { 0 } { 0 } } +\cs_new_protected_nopar:Nn \__um_font_param_aux:NNN { \cs_new_nopar:Npn #1 ##1 { @@ -666,202 +565,171 @@ #3 ##1 \dim_eval:n { ##2 } } } -\cs_generate_variant:Nn \um_font_param_aux:NNN { ccc } -\um_font_param:nn { axis } { 15 } -\um_font_param:nn { operator_size } { 13 } -\um_font_param:n { fraction_del_size } -\um_font_param:nnn { fraction_denom_down } { 45 } { 44 } -\um_font_param:nnn { fraction_denom_vgap } { 50 } { 49 } -\um_font_param:nnn { fraction_num_up } { 43 } { 42 } -\um_font_param:nnn { fraction_num_vgap } { 47 } { 46 } -\um_font_param:nn { fraction_rule } { 48 } -\um_font_param:nn { limit_above_bgap } { 29 } -\um_font_param:n { limit_above_kern } -\um_font_param:nn { limit_above_vgap } { 28 } -\um_font_param:nn { limit_below_bgap } { 31 } -\um_font_param:n { limit_below_kern } -\um_font_param:nn { limit_below_vgap } { 30 } -\um_font_param:nn { over_delimiter_vgap } { 41 } -\um_font_param:nn { over_delimiter_bgap } { 38 } -\um_font_param:nn { under_delimiter_vgap } { 40 } -\um_font_param:nn { under_delimiter_bgap } { 39 } -\um_font_param:nn { overbar_kern } { 55 } -\um_font_param:nn { overbar_rule } { 54 } -\um_font_param:nn { overbar_vgap } { 53 } -\um_font_param:n { quad } -\um_font_param:nn { radical_kern } { 62 } -\um_font_param:nn { radical_rule } { 61 } -\um_font_param:nnn { radical_vgap } { 60 } { 59 } -\um_font_param:nn { radical_degree_before } { 63 } -\um_font_param:nn { radical_degree_after } { 64 } -\um_font_param:nn { radical_degree_raise } { 65 } -\um_font_param:nn { space_after_script } { 27 } -\um_font_param:nnn { stack_denom_down } { 35 } { 34 } -\um_font_param:nnn { stack_num_up } { 33 } { 32 } -\um_font_param:nnn { stack_vgap } { 37 } { 36 } -\um_font_param:nn { sub_shift_down } { 18 } -\um_font_param:nn { sub_shift_drop } { 20 } -\um_font_param:n { subsup_shift_down } -\um_font_param:nn { sub_top_max } { 19 } -\um_font_param:nn { subsup_vgap } { 25 } -\um_font_param:nn { sup_bottom_min } { 23 } -\um_font_param:nn { sup_shift_drop } { 24 } -\um_font_param:nnnnn { sup_shift_up } { 21 } { 22 } { 21 } { 22 } -\um_font_param:nn { supsub_bottom_max } { 26 } -\um_font_param:nn { underbar_kern } { 58 } -\um_font_param:nn { underbar_rule } { 57 } -\um_font_param:nn { underbar_vgap } { 56 } -\um_font_param:n { connector_overlap_min } -\def\new@mathversion#1{% - \expandafter\in@\expandafter#1\expandafter{\version@list}% - \ifin@ - \@font@info{Redeclaring math version - `\expandafter\@gobblefour\string#1'}% - \else - \expandafter\newcount\csname c@\expandafter - \@gobble\string#1\endcsname - \def\version@elt{\noexpand\version@elt\noexpand}% - \edef\version@list{\version@list\version@elt#1}% - \fi - \toks@{}% - \count@\z@ - \def\group@elt##1##2{% - \advance\count@\@ne - \addto@hook\toks@{\getanddefine@fonts##1##2}% - }% - \group@list - \global\csname c@\expandafter\@gobble\string#1\endcsname\count@ - \def\alpha@elt##1##2##3{% - \ifx##2\no@alphabet@error - \toks@\expandafter{\the\toks@\install@mathalphabet##1% - {\no@alphabet@error##1}}% - \else - \toks@\expandafter{\the\toks@\install@mathalphabet##1% - {\select@group##1##2##3}}% - \fi - }% - \alpha@list - \xdef#1{\the\toks@}% -} +\cs_generate_variant:Nn \__um_font_param_aux:NNN { ccc } +\__um_font_param:nn { axis } { 15 } +\__um_font_param:nn { operator_size } { 13 } +\__um_font_param:n { fraction_del_size } +\__um_font_param:nnn { fraction_denom_down } { 45 } { 44 } +\__um_font_param:nnn { fraction_denom_vgap } { 50 } { 49 } +\__um_font_param:nnn { fraction_num_up } { 43 } { 42 } +\__um_font_param:nnn { fraction_num_vgap } { 47 } { 46 } +\__um_font_param:nn { fraction_rule } { 48 } +\__um_font_param:nn { limit_above_bgap } { 29 } +\__um_font_param:n { limit_above_kern } +\__um_font_param:nn { limit_above_vgap } { 28 } +\__um_font_param:nn { limit_below_bgap } { 31 } +\__um_font_param:n { limit_below_kern } +\__um_font_param:nn { limit_below_vgap } { 30 } +\__um_font_param:nn { over_delimiter_vgap } { 41 } +\__um_font_param:nn { over_delimiter_bgap } { 38 } +\__um_font_param:nn { under_delimiter_vgap } { 40 } +\__um_font_param:nn { under_delimiter_bgap } { 39 } +\__um_font_param:nn { overbar_kern } { 55 } +\__um_font_param:nn { overbar_rule } { 54 } +\__um_font_param:nn { overbar_vgap } { 53 } +\__um_font_param:n { quad } +\__um_font_param:nn { radical_kern } { 62 } +\__um_font_param:nn { radical_rule } { 61 } +\__um_font_param:nnn { radical_vgap } { 60 } { 59 } +\__um_font_param:nn { radical_degree_before } { 63 } +\__um_font_param:nn { radical_degree_after } { 64 } +\__um_font_param:nn { radical_degree_raise } { 65 } +\__um_font_param:nn { space_after_script } { 27 } +\__um_font_param:nnn { stack_denom_down } { 35 } { 34 } +\__um_font_param:nnn { stack_num_up } { 33 } { 32 } +\__um_font_param:nnn { stack_vgap } { 37 } { 36 } +\__um_font_param:nn { sub_shift_down } { 18 } +\__um_font_param:nn { sub_shift_drop } { 20 } +\__um_font_param:n { subsup_shift_down } +\__um_font_param:nn { sub_top_max } { 19 } +\__um_font_param:nn { subsup_vgap } { 25 } +\__um_font_param:nn { sup_bottom_min } { 23 } +\__um_font_param:nn { sup_shift_drop } { 24 } +\__um_font_param:nnnnn { sup_shift_up } { 21 } { 22 } { 21 } { 22 } +\__um_font_param:nn { supsub_bottom_max } { 26 } +\__um_font_param:nn { underbar_kern } { 58 } +\__um_font_param:nn { underbar_rule } { 57 } +\__um_font_param:nn { underbar_vgap } { 56 } +\__um_font_param:n { connector_overlap_min } \keys_define:nn {unicode-math} { version .code:n = { - \tl_set:Nn \l_um_mversion_tl {#1} - \DeclareMathVersion{\l_um_mversion_tl} + \tl_set:Nn \l__um_mversion_tl {#1} + \DeclareMathVersion {\l__um_mversion_tl} } } \keys_define:nn {unicode-math} { - script-features .tl_set:N = \l_um_script_features_tl , - sscript-features .tl_set:N = \l_um_sscript_features_tl , - script-font .tl_set:N = \l_um_script_font_tl , - sscript-font .tl_set:N = \l_um_sscript_font_tl , + script-features .tl_set:N = \l__um_script_features_tl , + sscript-features .tl_set:N = \l__um_sscript_features_tl , + script-font .tl_set:N = \l__um_script_font_tl , + sscript-font .tl_set:N = \l__um_sscript_font_tl , } -\seq_new:N \l_um_mathalph_seq -\seq_new:N \l_um_char_range_seq -\seq_new:N \l_um_mclass_range_seq -\seq_new:N \l_um_cmd_range_seq \keys_define:nn {unicode-math} { - range .code:n = { - \bool_set_false:N \l_um_init_bool - \int_incr:N \g_um_fam_int - \tl_set:Nx \um_symfont_tl {um_fam\int_use:N\g_um_fam_int} - \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_parse:nnn - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_parse:Nnn - \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_parse:nnn - \cs_set_eq:NN \um_maybe_init_alphabet:n \use_none:n - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_parse:nn - \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_parse:nn - \cs_set_eq:NN \um_make_mathactive:nNN \um_make_mathactive_parse:nNN - \seq_clear:N \l_um_char_range_seq - \seq_clear:N \l_um_mclass_range_seq - \seq_clear:N \l_um_cmd_range_seq - \seq_clear:N \l_um_mathalph_seq - \clist_map_inline:nn {#1} { - \um_if_mathalph_decl:nTF {##1} { - \seq_put_right:Nx \l_um_mathalph_seq { - { \exp_not:V \l_um_tmpa_tl } - { \exp_not:V \l_um_tmpb_tl } - { \exp_not:V \l_um_tmpc_tl } - } - }{ - \seq_if_in:NnTF \g_um_mathclasses_seq {##1} - { \seq_put_right:Nn \l_um_mclass_range_seq {##1} } + range .code:n = + { + \bool_set_false:N \l__um_init_bool + \int_incr:N \g__um_fam_int + \tl_set:Nx \__um_symfont_tl {__um_fam\int_use:N\g__um_fam_int} + \cs_set_eq:NN \__um_sym:nnn \__um_process_symbol_parse:nnn + \cs_set_eq:NN \__um_set_mathalphabet_char:Nnn \__um_mathmap_parse:Nnn + \cs_set_eq:NN \__um_remap_symbol:nnn \__um_remap_symbol_parse:nnn + \cs_set_eq:NN \__um_maybe_init_alphabet:n \use_none:n + \cs_set_eq:NN \__um_map_char_single:nn \__um_map_char_parse:nn + \cs_set_eq:NN \__um_assign_delcode:nn \__um_assign_delcode_parse:nn + \cs_set_eq:NN \__um_make_mathactive:nNN \__um_make_mathactive_parse:nNN + \seq_clear:N \l__um_char_range_seq + \seq_clear:N \l__um_mclass_range_seq + \seq_clear:N \l__um_cmd_range_seq + \seq_clear:N \l__um_mathalph_seq + + \clist_map_inline:nn {#1} + { + \__um_if_mathalph_decl:nTF {##1} + { + \seq_put_right:Nx \l__um_mathalph_seq + { + { \exp_not:V \l__um_tmpa_tl } + { \exp_not:V \l__um_tmpb_tl } + { \exp_not:V \l__um_tmpc_tl } + } + } + { + \seq_if_in:NnTF \g__um_mathclasses_seq {##1} + { \seq_put_right:Nn \l__um_mclass_range_seq {##1} } { \bool_if:nTF { \tl_if_single_p:n {##1} && \token_if_cs_p:N ##1 } - { \seq_put_right:Nn \l_um_cmd_range_seq {##1} } - { \seq_put_right:Nn \l_um_char_range_seq {##1} } + { \seq_put_right:Nn \l__um_cmd_range_seq {##1} } + { \seq_put_right:Nn \l__um_char_range_seq {##1} } } - } - } - } + } + } + } } -\seq_new:N \g_um_mathclasses_seq -\seq_set_from_clist:Nn \g_um_mathclasses_seq - { - \mathord,\mathalpha,\mathop,\mathbin,\mathrel, - \mathopen,\mathclose,\mathpunct,\mathaccent, - \mathfence,\mathover,\mathunder,\mathbotaccent - } -\prg_new_conditional:Nnn \um_if_mathalph_decl:n {TF} { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {#1} } - \tl_clear:N \l_um_tmpb_tl - \tl_clear:N \l_um_tmpc_tl - \tl_if_in:NnT \l_um_tmpa_tl {->} { - \exp_after:wN \um_split_arrow:w \l_um_tmpa_tl \q_nil - } - \tl_if_in:NnT \l_um_tmpa_tl {/} { - \exp_after:wN \um_split_slash:w \l_um_tmpa_tl \q_nil - } - \tl_if_empty:NT \l_um_tmpc_tl { \tl_set_eq:NN \l_um_tmpc_tl \l_um_tmpa_tl } - \seq_if_in:NVTF \g_um_mathstyles_seq \l_um_tmpa_tl { - \prg_return_true: - }{ - \prg_return_false: - } -} -\cs_set:Npn \um_split_arrow:w #1->#2 \q_nil { - \tl_set:Nn \l_um_tmpa_tl {#1} - \tl_if_single:nTF {#2} - { \tl_set:Nn \l_um_tmpc_tl {#2} } - { \exp_args:NNc \tl_set:Nn \l_um_tmpc_tl {math#2} } -} -\cs_set:Npn \um_split_slash:w #1/#2 \q_nil { - \tl_set:Nn \l_um_tmpa_tl {#1} - \tl_set:Nn \l_um_tmpb_tl {#2} -} -\cs_new:Nn \um_if_char_spec:nNNT - { +\prg_new_conditional:Nnn \__um_if_mathalph_decl:n {TF} + { + \tl_set:Nn \l__um_tmpa_tl {#1} + \tl_clear:N \l__um_tmpb_tl + \tl_clear:N \l__um_tmpc_tl + + \tl_if_in:NnT \l__um_tmpa_tl {->} + { \exp_after:wN \__um_split_arrow:w \l__um_tmpa_tl \q_nil } + + \tl_if_in:NnT \l__um_tmpa_tl {/} + { \exp_after:wN \__um_split_slash:w \l__um_tmpa_tl \q_nil } + + \tl_set:Nx \l__um_tmpa_tl { \tl_to_str:N \l__um_tmpa_tl } + \exp_args:NNx \tl_remove_all:Nn \l__um_tmpa_tl { \token_to_str:N \math } + \exp_args:NNx \tl_remove_all:Nn \l__um_tmpa_tl { \token_to_str:N \sym } + \tl_trim_spaces:N \l__um_tmpa_tl + \tl_if_empty:NT \l__um_tmpc_tl + { \tl_set_eq:NN \l__um_tmpc_tl \l__um_tmpa_tl } + + \seq_if_in:NVTF \g__um_named_ranges_seq \l__um_tmpa_tl + { \prg_return_true: } { \prg_return_false: } + } +\cs_set:Npn \__um_split_arrow:w #1->#2 \q_nil + { + \tl_set:Nx \l__um_tmpa_tl { \tl_trim_spaces:n {#1} } + \tl_set:Nx \l__um_tmpc_tl { \tl_trim_spaces:n {#2} } + } +\cs_set:Npn \__um_split_slash:w #1/#2 \q_nil + { + \tl_set:Nx \l__um_tmpa_tl { \tl_trim_spaces:n {#1} } + \tl_set:Nx \l__um_tmpb_tl { \tl_trim_spaces:n {#2} } + } +\cs_new:Nn \__um_if_char_spec:nNNT + { % math class: - \seq_if_in:NnT \l_um_mclass_range_seq {#3} + \seq_if_in:NnT \l__um_mclass_range_seq {#3} { \use_none_delimit_by_q_nil:w } % command name: - \seq_if_in:NnT \l_um_cmd_range_seq {#2} + \seq_if_in:NnT \l__um_cmd_range_seq {#2} { \use_none_delimit_by_q_nil:w } % character slot: - \seq_map_inline:Nn \l_um_char_range_seq + \seq_map_inline:Nn \l__um_char_range_seq { - \um_int_if_slot_in_range:nnT {#1} {##1} + \__um_int_if_slot_in_range:nnT {#1} {##1} { \seq_map_break:n { \use_none_delimit_by_q_nil:w } } } - % this executes if no match was found: + % the following expands to nil if no match was found: \use_none:nnn \q_nil \use:n { - \clist_put_right:Nx \l_um_char_num_range_clist { \int_eval:n {#1} } + \clist_put_right:Nx \l__um_char_nrange_clist { \int_eval:n {#1} } #4 } } -\cs_new:Nn \um_int_if_slot_in_range:nnT - { \um_numrange_parse:nwT {#1} #2 - \q_nil - \q_stop {#3} } -\cs_set:Npn \um_numrange_parse:nwT #1 #2 - #3 - #4 \q_stop #5 +\cs_new:Nn \__um_int_if_slot_in_range:nnT + { \__um_numrange_parse:nwT {#1} #2 - \q_nil - \q_stop {#3} } +\cs_set:Npn \__um_numrange_parse:nwT #1 #2 - #3 - #4 \q_stop #5 { \tl_if_empty:nTF {#4} { \int_compare:nT {#1=#2} {#5} } { @@ -872,1185 +740,427 @@ \int_compare:nT {#1>=#2} { \int_compare:nT {#1<=#3} {#5} } } } } } -\AtBeginDocument{\um_resolve_greek:} -\cs_new:Npn \um_resolve_greek: { - \clist_map_inline:nn { +\AtBeginDocument{\__um_resolve_greek:} +\cs_new:Npn \__um_resolve_greek: + { + \clist_map_inline:nn + { Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda, alpha,beta,gamma,delta, zeta,eta,theta,iota,kappa,lambda, Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega, mu,nu,xi,omicron,pi,rho,sigma,tau,upsilon, chi,psi,omega, varTheta, varsigma,vartheta,varkappa,varrho,varpi - }{ + } + { \tl_set:cx {##1} { \exp_not:c { mit ##1 } } - } - \tl_set:Nn \epsilon { - \bool_if:NTF \g_um_texgreek_bool \mitvarepsilon \mitepsilon - } - \tl_set:Nn \phi { - \bool_if:NTF \g_um_texgreek_bool \mitvarphi \mitphi - } - \tl_set:Nn \varepsilon { - \bool_if:NTF \g_um_texgreek_bool \mitepsilon \mitvarepsilon - } - \tl_set:Nn \varphi { - \bool_if:NTF \g_um_texgreek_bool \mitphi \mitvarphi - } -} -\cs_new:Nn \um_new_mathstyle:N - { - \um_prepare_mathstyle:f {\exp_after:wN \use_none:nnnnn \token_to_str:N #1} - \seq_put_right:Nn \g_um_mathstyles_seq {#1} - } -\seq_new:N \g_um_default_mathalph_seq -\seq_new:N \g_um_mathstyles_seq -\AtEndOfPackage - { -\clist_map_inline:nn - { - {\mathup } {latin,Latin,greek,Greek,num,misc} {\mathup } , - {\mathit } {latin,Latin,greek,Greek,misc} {\mathit } , - {\mathbb } {latin,Latin,num,misc} {\mathbb } , - {\mathbbit } {misc} {\mathbbit } , - {\mathscr } {latin,Latin} {\mathscr } , - {\mathcal } {Latin} {\mathscr } , - {\mathbfcal } {Latin} {\mathbfscr } , - {\mathfrak } {latin,Latin} {\mathfrak } , - {\mathtt } {latin,Latin,num} {\mathtt } , - {\mathsfup } {latin,Latin,num} {\mathsfup } , - {\mathsfit } {latin,Latin} {\mathsfit } , - {\mathbfup } {latin,Latin,greek,Greek,num,misc} {\mathbfup } , - {\mathbfit } {latin,Latin,greek,Greek,misc} {\mathbfit } , - {\mathbfscr } {latin,Latin} {\mathbfscr } , - {\mathbffrak} {latin,Latin} {\mathbffrak} , - {\mathbfsfup} {latin,Latin,greek,Greek,num,misc} {\mathbfsfup} , - {\mathbfsfit} {latin,Latin,greek,Greek,misc} {\mathbfsfit} - } - { - \seq_put_right:Nn \g_um_default_mathalph_seq {#1} - \exp_after:wN \um_new_mathstyle:N \use_i:nnn #1 - } - \um_new_mathstyle:N \mathsf - \um_new_mathstyle:N \mathbf - \um_new_mathstyle:N \mathbfsf + \tl_set:cx {up ##1} { \exp_not:N \symup \exp_not:c { ##1 } } + \tl_set:cx {it ##1} { \exp_not:N \symit \exp_not:c { ##1 } } + } + \tl_set:Nn \epsilon + { \bool_if:NTF \g__um_texgreek_bool \mitvarepsilon \mitepsilon } + \tl_set:Nn \phi + { \bool_if:NTF \g__um_texgreek_bool \mitvarphi \mitphi } + \tl_set:Nn \varepsilon + { \bool_if:NTF \g__um_texgreek_bool \mitepsilon \mitvarepsilon } + \tl_set:Nn \varphi + { \bool_if:NTF \g__um_texgreek_bool \mitphi \mitvarphi } } -\cs_new:Nn \um_prepare_mathstyle:n +\cs_set:Npn \use@mathgroup #1 #2 { - \um_init_alphabet:x {#1} - \cs_set:cpn {_um_math#1_aux:n} ##1 + \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! { - \use:c {um_switchto_math#1:} ##1 \egroup + \math@bgroup + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \mathgroup #2 \relax + \math@egroup } - \cs_set_protected:cpx {math#1} + } +\cs_new:Nn \__um_prepare_mathstyle:n + { + \seq_put_right:Nn \g__um_mathstyles_seq {#1} + \__um_init_alphabet:n {#1} + \cs_set:cpn {__um_sym_#1_aux:n} + { \use:c {__um_switchto_#1:} \math@egroup } + \cs_set_protected:cpx {sym#1} { \exp_not:n { - \bgroup + \math@bgroup \mode_if_math:F { \egroup\expandafter - \non@alpherr\expandafter{\csname math#1\endcsname\space} + \non@alpherr\expandafter{\csname sym#1\endcsname\space} } - \tl_set:Nn \l_um_mathstyle_tl {#1} + \tl_set:Nn \l__um_mathstyle_tl {#1} } - \exp_not:c {_um_math#1_aux:n} + \exp_not:c {__um_sym_#1_aux:n} } } -\tl_new:N \l_um_mathstyle_tl -\cs_generate_variant:Nn \um_prepare_mathstyle:n {f} -\cs_set:Nn \um_init_alphabet:n +\cs_set:Nn \__um_init_alphabet:n { - \um_log:nx {alph-initialise} {#1} - \cs_set_eq:cN {um_switchto_math#1:} \prg_do_nothing: + \__um_log:nx {alph-initialise} {#1} + \cs_set_eq:cN {__um_switchto_#1:} \prg_do_nothing: } -\cs_generate_variant:Nn \um_init_alphabet:n {x} -\cs_new:Npn \um_maybe_init_alphabet:V +\cs_new:Nn \__um_new_named_range:n { - \exp_args:NV \um_maybe_init_alphabet:n + \prop_new:c {g__um_named_range_#1_prop} } -\seq_new:N \l_um_missing_alph_seq -\cs_new:Npn \um_setup_alphabets: +\clist_set:Nn \g__um_named_ranges_clist { - \seq_if_empty:NTF \l_um_mathalph_seq { - \um_log:n {setup-implicit} - \seq_set_eq:NN \l_um_mathalph_seq \g_um_default_mathalph_seq - \bool_set_true:N \l_um_implicit_alph_bool - \um_maybe_init_alphabet:n {sf} - \um_maybe_init_alphabet:n {bf} - \um_maybe_init_alphabet:n {bfsf} - } - { - \um_log:n {setup-explicit} - \bool_set_false:N \l_um_implicit_alph_bool - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_noparse:Nnn - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_noparse:nn - } - \seq_map_inline:Nn \l_um_mathalph_seq { - \tl_set:No \l_um_tmpa_tl { \use_i:nnn ##1 } - \tl_set:No \l_um_tmpb_tl { \use_ii:nnn ##1 } - \tl_set:No \l_um_remap_style_tl { \use_iii:nnn ##1 } - \tl_set:Nx \l_um_remap_style_tl { - \exp_after:wN \exp_after:wN \exp_after:wN \use_none:nnnnn - \exp_after:wN \token_to_str:N \l_um_remap_style_tl - } - \tl_if_empty:NT \l_um_tmpb_tl { - \cs_set_eq:NN \um_maybe_init_alphabet:n \um_init_alphabet:n - \tl_set:Nn \l_um_tmpb_tl { latin,Latin,greek,Greek,num,misc } + up, it, tt, bfup, bfit, bb , bbit, scr, bfscr, cal, bfcal, + frak, bffrak, sfup, sfit, bfsfup, bfsfit, bfsf + } +\clist_map_inline:Nn \g__um_named_ranges_clist + { \__um_new_named_range:n {#1} } +\clist_new:N \g__um_alphabets_seq +\clist_set:Nn \g__um_alphabets_seq { latin, Latin, greek, Greek, num } +\cs_new:Nn \__um_new_alphabet_config:nnn + { + \prop_if_exist:cF {g__um_named_range_#1_prop} + { \__um_warning:nnn {no-named-range} {#1} {#2} } + + \prop_gput:cnn {g__um_named_range_#1_prop} { alpha_tl } + { + \prop_item:cn {g__um_named_range_#1_prop} { alpha_tl } + {#2} } - \um_setup_math_alphabet:VVV - \l_um_tmpa_tl \l_um_tmpb_tl \l_um_remap_style_tl - } - \seq_if_empty:NF \l_um_missing_alph_seq { \um_log:n { missing-alphabets } } + % Q: do I need to bother removing duplicates? + + \cs_new:cn { __um_config_#1_#2:n } {#3} + } +\cs_new:Nn \__um_alphabet_config:nnn { \use:c {__um_config_#1_#2:n} {#3} } +\prg_new_conditional:Nnn \__um_if_alphabet_exists:nn {T,TF} + { + \cs_if_exist:cTF {__um_config_#1_#2:n} + \prg_return_true: \prg_return_false: + } +\cs_new:Nn \__um_default_mathalph:nnn + { + \seq_put_right:Nx \g__um_named_ranges_seq { \tl_to_str:n {#1} } + \seq_put_right:Nn \g__um_default_mathalph_seq {{#1}{#2}{#3}} + } +\__um_default_mathalph:nnn {up } {latin,Latin,greek,Greek,num,misc} {up } +\__um_default_mathalph:nnn {it } {latin,Latin,greek,Greek,misc} {it } +\__um_default_mathalph:nnn {bb } {latin,Latin,num,misc} {bb } +\__um_default_mathalph:nnn {bbit } {misc} {bbit } +\__um_default_mathalph:nnn {scr } {latin,Latin} {scr } +\__um_default_mathalph:nnn {cal } {Latin} {scr } +\__um_default_mathalph:nnn {bfcal } {Latin} {bfscr } +\__um_default_mathalph:nnn {frak } {latin,Latin} {frak } +\__um_default_mathalph:nnn {tt } {latin,Latin,num} {tt } +\__um_default_mathalph:nnn {sfup } {latin,Latin,num} {sfup } +\__um_default_mathalph:nnn {sfit } {latin,Latin} {sfit } +\__um_default_mathalph:nnn {bfup } {latin,Latin,greek,Greek,num,misc} {bfup } +\__um_default_mathalph:nnn {bfit } {latin,Latin,greek,Greek,misc} {bfit } +\__um_default_mathalph:nnn {bfscr } {latin,Latin} {bfscr } +\__um_default_mathalph:nnn {bffrak} {latin,Latin} {bffrak} +\__um_default_mathalph:nnn {bfsfup} {latin,Latin,greek,Greek,num,misc} {bfsfup} +\__um_default_mathalph:nnn {bfsfit} {latin,Latin,greek,Greek,misc} {bfsfit} +\clist_map_inline:nn + { + up, it, bfup, bfit, sfup, sfit, bfsfup, bfsfit, bfsf, + tt, bb, bbit, scr, bfscr, cal, bfcal, frak, bffrak, + normal, literal, sf, bf, + } + { \__um_prepare_mathstyle:n {#1} } +\clist_map_inline:nn + { rm, it, bf, sf, tt } + { \cs_set_eq:cc { mathtext #1 } { math #1 } } +\clist_map_inline:nn + { + normal, bb , bbit, scr, bfscr, cal, bfcal, frak, bffrak, tt, + bfup, bfit, sfup, sfit, bfsfup, bfsfit, bfsf } -\cs_new:Nn \um_setup_math_alphabet:Nnn { - \tl_set:Nx \l_um_style_tl + \cs_set:cpx { math #1 } { \exp_not:c { sym #1 } } + } +\AtBeginDocument{ +\clist_map_inline:nn + { rm, it, bf, sf, tt } + { + \cs_set_protected:cpx { math #1 } { - \exp_after:wN \use_none:nnnnn \token_to_str:N #1 + \exp_not:n { \bool_if:NTF } \exp_not:c { g__um_ math #1 _text_bool} + { \exp_not:c { mathtext #1 } } + { \exp_not:c { sym #1 } } } - \clist_map_inline:nn {#2} + }} +\cs_set_protected:Npn \mathup { \mathrm } +\cs_set_protected:Npn \symrm { \symup } +\cs_set:Npn \operator@font + { + \__um_switchto_literal: + \@fontswitch {} { \g__um_operator_mathfont_tl } + } +\cs_new:Npn \__um_setup_alphabets: + { + \seq_if_empty:NTF \l__um_mathalph_seq + { + \__um_log:n {setup-implicit} + \seq_set_eq:NN \l__um_mathalph_seq \g__um_default_mathalph_seq + \bool_set_true:N \l__um_implicit_alph_bool + \__um_maybe_init_alphabet:n {sf} + \__um_maybe_init_alphabet:n {bf} + \__um_maybe_init_alphabet:n {bfsf} + } + { + \__um_log:n {setup-explicit} + \bool_set_false:N \l__um_implicit_alph_bool + \cs_set_eq:NN \__um_set_mathalphabet_char:nnn \__um_mathmap_noparse:nnn + \cs_set_eq:NN \__um_map_char_single:nn \__um_map_char_noparse:nn + } + \seq_map_inline:Nn \l__um_mathalph_seq { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {##1} } - \cs_if_exist:cT {um_config_ \l_um_style_tl _\l_um_tmpa_tl :n} + \tl_set:No \l__um_style_tl { \use_i:nnn ##1 } + \clist_set:No \l__um_alphabet_clist { \use_ii:nnn ##1 } + \tl_set:No \l__um_remap_style_tl { \use_iii:nnn ##1 } + + \clist_if_empty:NT \l__um_alphabet_clist { - \str_if_eq_x:nnTF {\l_um_tmpa_tl}{misc} + \cs_set_eq:NN \__um_maybe_init_alphabet:n \__um_init_alphabet:n + \clist_set:Nn \l__um_alphabet_clist { latin, Latin, greek, Greek, num, misc } + } + + \__um_setup_math_alphabet:NNN + \l__um_style_tl \l__um_alphabet_clist \l__um_remap_style_tl + } + \seq_if_empty:NF \l__um_missing_alph_seq { \__um_log:n { missing-alphabets } } + } +\cs_new:Nn \__um_setup_math_alphabet:NNN + { + \tl_set_eq:NN \l__um_style_tl #1% actually a no-op but makes the code clearer! + \clist_map_inline:Nn #2 + { + \tl_set:Nn \l__um_alphabet_tl {##1} + \__um_if_alphabet_exists:nnTF \l__um_style_tl \l__um_alphabet_tl + { + \str_if_eq_x:nnTF {\l__um_alphabet_tl} {misc} { - \um_maybe_init_alphabet:V \l_um_style_tl + \__um_maybe_init_alphabet:n \l__um_style_tl \clist_map_break: } { - \um_glyph_if_exist:cT { \um_to_usv:nn {#3}{\l_um_tmpa_tl} } + \__um_glyph_if_exist:nT { \__um_to_usv:nn {\l__um_style_tl} {\l__um_alphabet_tl} } { - \um_maybe_init_alphabet:V \l_um_style_tl + \__um_maybe_init_alphabet:n \l__um_style_tl \clist_map_break: } } } + { \msg_warning:nnx {unicode-math} {no-alphabet} { \l__um_style_tl / \l__um_alphabet_tl } } } - \clist_map_inline:nn {#2} + \csname TIC\endcsname + \clist_map_inline:Nn #2 { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {##1} } - \cs_if_exist:cT {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} + \tl_set:Nx \l__um_alphabet_tl { \tl_trim_spaces:n {##1} } + \cs_if_exist:cT {__um_config_ \l__um_style_tl _ \l__um_alphabet_tl :n} { - \str_if_eq_x:nnTF {\l_um_tmpa_tl}{misc} + \exp_args:No \tl_if_eq:nnTF \l__um_alphabet_tl {misc} { - \um_log:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} + \__um_log:nx {setup-alph} {math \l__um_style_tl~(\l__um_alphabet_tl)} + \__um_alphabet_config:nnn {\l__um_style_tl} {\l__um_alphabet_tl} {#3} } { - \um_glyph_if_exist:cTF { \um_to_usv:nn {#3}{\l_um_tmpa_tl} } + \__um_glyph_if_exist:nTF { \__um_to_usv:nn {\l__um_style_tl} {\l__um_alphabet_tl} } { - \um_log:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} + \__um_log:nx {setup-alph} {math \l__um_style_tl~(\l__um_alphabet_tl)} + \__um_alphabet_config:nnn {\l__um_style_tl} {\l__um_alphabet_tl} {#3} } { - \bool_if:NTF \l_um_implicit_alph_bool + \bool_if:NTF \l__um_implicit_alph_bool { - \seq_put_right:Nx \l_um_missing_alph_seq + \seq_put_right:Nx \l__um_missing_alph_seq { - \@backslashchar math \l_um_style_tl \space - (\tl_use:c{c_um_math_alphabet_name_ \l_um_tmpa_tl _tl}) + \@backslashchar sym \l__um_style_tl \space + (\tl_use:c{c__um_math_alphabet_name_ \l__um_alphabet_tl _tl}) } } { - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {up} + \__um_alphabet_config:nnn {\l__um_style_tl} {\l__um_alphabet_tl} {up} } } } } } + \csname TOC\endcsname } -\cs_generate_variant:Nn \um_setup_math_alphabet:Nnn {VVV} -\cs_new:Npn \um_map_char_single:cc { \exp_args:Ncc \um_map_char_single:nn } -\cs_new:Nn \um_map_char_noparse:nn +\cs_new:Nn \__um_map_char_noparse:nn + { \__um_set_mathcode:nnnn {#1}{\mathalpha}{\__um_symfont_tl}{#2} } +\cs_new:Nn \__um_map_char_parse:nn { - \um_set_mathcode:nnnn {#1}{\mathalpha}{\um_symfont_tl}{#2} + \__um_if_char_spec:nNNT {#1} {\@nil} {\mathalpha} + { \__um_map_char_noparse:nn {#1}{#2} } } -\cs_new:Nn \um_map_char_parse:nn +\cs_new:Nn \__um_map_char_single:nnn { - \um_if_char_spec:nNNT {#1} {\@nil} {\mathalpha} - { - \um_map_char_noparse:nn {#1}{#2} - } + \__um_map_char_single:nn { \__um_to_usv:nn {#1}{#3} } + { \__um_to_usv:nn {#2}{#3} } } -\cs_new:Nn \um_map_char_single:nnn +\cs_set:Nn \__um_map_chars_range:nnn { - \um_map_char_single:cc { \um_to_usv:nn {#1}{#3} } - { \um_to_usv:nn {#2}{#3} } + \int_step_inline:nnnn {0}{1}{#1-1} + { \__um_map_char_single:nn {#2+##1}{#3+##1} } + } +\cs_new:Nn \__um_map_chars_range:nnnn + { + \__um_map_chars_range:nnn {#1} { \__um_to_usv:nn {#2}{#4} } + { \__um_to_usv:nn {#3}{#4} } } -\cs_set:Nn \um_map_single:nnn +\cs_set:Nn \__um_set_normal_char:nnn { - \cs_if_exist:cT { \um_to_usv:nn {#3} {#1} } + \__um_usv_if_exist:nnT {#3} {#1} { \clist_map_inline:nn {#2} { - \um_map_char_single:nnn {##1} {#3} {#1} + \__um_set_mathalphabet_pos:nnnn {normal} {#1} {##1} {#3} + \__um_map_char_single:nnn {##1} {#3} {#1} } } } -\cs_set:Nn \um_map_chars_range:nnn - { - \int_step_inline:nnnn {0}{1}{#1-1} { - \um_map_char_single:nn {#2+##1}{#3+##1} - } - } -\cs_generate_variant:Nn \um_map_chars_range:nnn {ncc} -\cs_new:Nn \um_map_chars_range:nnnn - { - \um_map_chars_range:ncc {#1} { \um_to_usv:nn {#2}{#4} } - { \um_to_usv:nn {#3}{#4} } - } -\cs_new:Nn \um_map_chars_Latin:nn +\cs_new:Nn \__um_set_normal_Latin:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {26} {##1} {#2} {Latin} + \__um_set_mathalphabet_Latin:nnn {normal} {##1} {#2} + \__um_map_chars_range:nnnn {26} {##1} {#2} {Latin} } } -\cs_new:Nn \um_map_chars_latin:nn +\cs_new:Nn \__um_set_normal_latin:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {26} {##1} {#2} {latin} + \__um_set_mathalphabet_latin:nnn {normal} {##1} {#2} + \__um_map_chars_range:nnnn {26} {##1} {#2} {latin} } } -\cs_new:Nn \um_map_chars_greek:nn +\cs_new:Nn \__um_set_normal_greek:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {25} {##1} {#2} {greek} - \um_map_char_single:nnn {##1} {#2} {varepsilon} - \um_map_char_single:nnn {##1} {#2} {vartheta} - \um_map_char_single:nnn {##1} {#2} {varkappa} - \um_map_char_single:nnn {##1} {#2} {varphi} - \um_map_char_single:nnn {##1} {#2} {varrho} - \um_map_char_single:nnn {##1} {#2} {varpi} + \__um_set_mathalphabet_greek:nnn {normal} {##1} {#2} + \__um_map_chars_range:nnnn {25} {##1} {#2} {greek} + \__um_map_char_single:nnn {##1} {#2} {varepsilon} + \__um_map_char_single:nnn {##1} {#2} {vartheta} + \__um_map_char_single:nnn {##1} {#2} {varkappa} + \__um_map_char_single:nnn {##1} {#2} {varphi} + \__um_map_char_single:nnn {##1} {#2} {varrho} + \__um_map_char_single:nnn {##1} {#2} {varpi} + \__um_set_mathalphabet_pos:nnnn {normal} {varepsilon} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {vartheta} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {varkappa} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {varphi} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {varrho} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {varpi} {##1} {#2} } } -\cs_new:Nn \um_map_chars_Greek:nn +\cs_new:Nn \__um_set_normal_Greek:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {25} {##1} {#2} {Greek} - \um_map_char_single:nnn {##1} {#2} {varTheta} + \__um_set_mathalphabet_Greek:nnn {normal} {##1} {#2} + \__um_map_chars_range:nnnn {25} {##1} {#2} {Greek} + \__um_map_char_single:nnn {##1} {#2} {varTheta} + \__um_set_mathalphabet_pos:nnnn {normal} {varTheta} {##1} {#2} } } -\cs_new:Nn \um_map_chars_numbers:nn - { - \um_map_chars_range:nnnn {10} {#1} {#2} {num} - } -\cs_new:Npn \um_set_mathalphabet_char:Ncc +\cs_new:Nn \__um_set_normal_numbers:nn { - \exp_args:NNcc \um_set_mathalphabet_char:Nnn + \__um_set_mathalphabet_numbers:nnn {normal} {#1} {#2} + \__um_map_chars_range:nnnn {10} {#1} {#2} {num} } -\cs_new:Nn \um_mathmap_noparse:Nnn +\cs_new:Nn \__um_mathmap_noparse:nnn { \clist_map_inline:nn {#2} { - \tl_put_right:cx {um_switchto_\cs_to_str:N #1:} + \tl_put_right:cx {__um_switchto_#1:} { - \um_set_mathcode:nnnn{##1}{\mathalpha}{\um_symfont_tl}{#3} + \__um_set_mathcode:nnnn {##1} {\mathalpha} {\__um_symfont_tl} {#3} } } } -\cs_new:Nn \um_mathmap_parse:Nnn +\cs_new:Nn \__um_mathmap_parse:nnn { - \clist_if_in:NnT \l_um_char_num_range_clist {#3} + \clist_if_in:NnT \l__um_char_nrange_clist {#3} { - \um_mathmap_noparse:Nnn {#1}{#2}{#3} + \__um_mathmap_noparse:nnn {#1}{#2}{#3} } } -\cs_new:Nn \um_set_mathalphabet_char:Nnnn +\cs_new:Nn \__um_set_mathalphabet_char:nnnn { - \um_set_mathalphabet_char:Ncc #1 { \um_to_usv:nn {#2} {#4} } - { \um_to_usv:nn {#3} {#4} } + \__um_set_mathalphabet_char:nnn {#1} { \__um_to_usv:nn {#2} {#4} } + { \__um_to_usv:nn {#3} {#4} } } -\cs_new:Nn \um_set_mathalph_range:nNnn +\cs_new:Nn \__um_set_mathalph_range:nnnn { - \int_step_inline:nnnn {0}{1}{#1-1} - { \um_set_mathalphabet_char:Nnn {#2} { ##1 + #3 } { ##1 + #4 } } + \int_step_inline:nnnn {0} {1} {#1-1} + { \__um_set_mathalphabet_char:nnn {#2} { ##1 + #3 } { ##1 + #4 } } } -\cs_generate_variant:Nn \um_set_mathalph_range:nNnn {nNcc} -\cs_new:Nn \um_set_mathalph_range:nNnnn +\cs_new:Nn \__um_set_mathalph_range:nnnnn { - \um_set_mathalph_range:nNcc {#1} #2 { \um_to_usv:nn {#3} {#5} } - { \um_to_usv:nn {#4} {#5} } + \__um_set_mathalph_range:nnnn {#1} {#2} { \__um_to_usv:nn {#3} {#5} } + { \__um_to_usv:nn {#4} {#5} } } -\cs_new:Nn \um_set_mathalphabet_pos:Nnnn +\cs_new:Nn \__um_set_mathalphabet_pos:nnnn { - \cs_if_exist:cT { \um_to_usv:nn {#4}{#2} } + \__um_usv_if_exist:nnT {#4} {#2} { \clist_map_inline:nn {#3} - { \um_set_mathalphabet_char:Nnnn #1 {##1} {#4} {#2} } + { \__um_set_mathalphabet_char:nnnn {#1} {##1} {#4} {#2} } } } -\cs_new:Nn \um_set_mathalphabet_numbers:Nnn +\cs_new:Nn \__um_set_mathalphabet_numbers:nnn { \clist_map_inline:nn {#2} - { \um_set_mathalph_range:nNnnn {10} #1 {##1} {#3} {num} } + { \__um_set_mathalph_range:nnnnn {10} {#1} {##1} {#3} {num} } } -\cs_new:Nn \um_set_mathalphabet_Latin:Nnn +\cs_new:Nn \__um_set_mathalphabet_Latin:nnn { \clist_map_inline:nn {#2} - { \um_set_mathalph_range:nNnnn {26} #1 {##1} {#3} {Latin} } + { \__um_set_mathalph_range:nnnnn {26} {#1} {##1} {#3} {Latin} } } -\cs_new:Nn \um_set_mathalphabet_latin:Nnn +\cs_new:Nn \__um_set_mathalphabet_latin:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {26} #1 {##1} {#3} {latin} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {h} + \__um_set_mathalph_range:nnnnn {26} {#1} {##1} {#3} {latin} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {h} } } -\cs_new:Nn \um_set_mathalphabet_Greek:Nnn +\cs_new:Nn \__um_set_mathalphabet_Greek:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {25} #1 {##1} {#3} {Greek} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varTheta} + \__um_set_mathalph_range:nnnnn {25} {#1} {##1} {#3} {Greek} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varTheta} } } -\cs_new:Nn \um_set_mathalphabet_greek:Nnn +\cs_new:Nn \__um_set_mathalphabet_greek:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {25} #1 {##1} {#3} {greek} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varepsilon} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {vartheta} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varkappa} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varphi} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varrho} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varpi} - } - } -\cs_new:Nn \um_config_up_num:n - { - \um_map_chars_numbers:nn {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathup {up}{#1} - } - -\cs_new:Nn \um_config_up_Latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Latin:nn {up} {#1} } - { - \bool_if:NT \g_um_upLatin_bool { \um_map_chars_Latin:nn {up,it} {#1} } - } - \um_set_mathalphabet_Latin:Nnn \mathup {up,it} {#1} - } - -\cs_new:Nn \um_config_up_latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_latin:nn {up} {#1} } - { - \bool_if:NT \g_um_uplatin_bool - { - \um_map_chars_latin:nn {up,it} {#1} - \um_map_single:nnn {h} {up,it} {#1} - \um_map_single:nnn {dotlessi} {up,it} {#1} - \um_map_single:nnn {dotlessj} {up,it} {#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathup {up,it}{#1} - } - -\cs_new:Nn \um_config_up_Greek:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Greek:nn {up}{#1} } - { - \bool_if:NT \g_um_upGreek_bool { \um_map_chars_Greek:nn {up,it}{#1} } - } - \um_set_mathalphabet_Greek:Nnn \mathup {up,it}{#1} - } - -\cs_new:Nn \um_config_up_greek:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_greek:nn {up} {#1} } - { - \bool_if:NT \g_um_upgreek_bool - { - \um_map_chars_greek:nn {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathup {up,it} {#1} - } - -\cs_new:Nn \um_config_up_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{up}{up} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{up,it}{up} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{up}{up} + \__um_set_mathalph_range:nnnnn {25} {#1} {##1} {#3} {greek} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varepsilon} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {vartheta} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varkappa} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varphi} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varrho} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varpi} } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{up,it}{up} - } - } - \um_set_mathalphabet_pos:Nnnn \mathup {partial} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {Nabla} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {dotlessi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {dotlessj} {up,it} {#1} } -\cs_new:Nn \um_config_it_Latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Latin:nn {it} {#1} } - { - \bool_if:NF \g_um_upLatin_bool { \um_map_chars_Latin:nn {up,it} {#1} } - } - \um_set_mathalphabet_Latin:Nnn \mathit {up,it}{#1} - } - -\cs_new:Nn \um_config_it_latin:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_latin:nn {it} {#1} - \um_map_single:nnn {h}{it}{#1} - } - { - \bool_if:NF \g_um_uplatin_bool - { - \um_map_chars_latin:nn {up,it} {#1} - \um_map_single:nnn {h}{up,it}{#1} - \um_map_single:nnn {dotlessi}{up,it}{#1} - \um_map_single:nnn {dotlessj}{up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathit {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathit {dotlessi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathit {dotlessj} {up,it} {#1} - } - -\cs_new:Nn \um_config_it_Greek:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_Greek:nn {it}{#1} - } - { - \bool_if:NF \g_um_upGreek_bool { \um_map_chars_Greek:nn {up,it}{#1} } - } - \um_set_mathalphabet_Greek:Nnn \mathit {up,it}{#1} - } - -\cs_new:Nn \um_config_it_greek:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_greek:nn {it} {#1} - } - { - \bool_if:NF \g_um_upgreek_bool { \um_map_chars_greek:nn {it,up} {#1} } - } - \um_set_mathalphabet_greek:Nnn \mathit {up,it} {#1} - } - -\cs_new:Nn \um_config_it_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{it}{it} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{up,it}{it} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{it}{it} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{up,it}{it} - } - } - \um_set_mathalphabet_pos:Nnnn \mathit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathit {Nabla} {up,it}{#1} - } -\cs_new:Nn \um_config_bb_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbb {up,it}{#1} - } - -\cs_new:Nn \um_config_bb_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbb {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {C} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {H} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {N} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {P} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Q} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {R} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Z} {up,it} {#1} - } - -\cs_new:Nn \um_config_bb_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbb {up}{#1} - } - -\cs_new:Nn \um_config_bb_misc:n - { - \um_set_mathalphabet_pos:Nnnn \mathbb {Pi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {pi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Gamma} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {gamma} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {summation} {up} {#1} - } - -\cs_new:Nn \um_config_bbit_misc:n - { - \um_set_mathalphabet_pos:Nnnn \mathbbit {D} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {d} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {e} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {i} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {j} {up,it} {#1} - } -\cs_new:Nn \um_config_scr_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathscr {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {B}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {E}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {F}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {L}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {M}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {R}{up,it}{#1} - } - -\cs_new:Nn \um_config_scr_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathscr {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {e}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {g}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {o}{up,it}{#1} - } -\cs_new:Nn \um_config_cal_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathcal {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {B}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {E}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {F}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {L}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {M}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {R}{up,it}{#1} - } -\cs_new:Nn \um_config_frak_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathfrak {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {C}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {R}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {Z}{up,it}{#1} - } -\cs_new:Nn \um_config_frak_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathfrak {up,it}{#1} - } -\cs_new:Nn \um_config_sfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathsf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathsfup {up}{#1} - } -\cs_new:Nn \um_config_sfup_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {sfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathsfup {up,it}{#1} - } -\cs_new:Nn \um_config_sfup_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {sfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathsfup {up,it}{#1} - } -\cs_new:Nn \um_config_sfit_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathsfit {up,it}{#1} - } -\cs_new:Nn \um_config_sfit_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathsfit {up,it}{#1} - } -\cs_new:Nn \um_config_tt_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathtt {up}{#1} - } -\cs_new:Nn \um_config_tt_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathtt {up,it}{#1} - } -\cs_new:Nn \um_config_tt_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathtt {up,it}{#1} - } -\cs_new:Nn \um_config_bfit_Latin:n - { - \bool_if:NF \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_Latin:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Latin:nn {bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_latin:n - { - \bool_if:NF \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_latin:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_latin:nn {bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_Greek:n - { - \um_set_mathalphabet_Greek:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Greek:nn {bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfupGreek_bool - { - \um_map_chars_Greek:nn {bfup,bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_greek:n - { - \um_set_mathalphabet_greek:Nnn \mathbfit {up,it} {#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_greek:nn {bfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {it} {#1} - } - { - \bool_if:NF \g_um_bfupgreek_bool - { - \um_map_chars_greek:nn {bfit,bfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up,it} {#1} - } - } - } - -\cs_new:Nn \um_config_bfit_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { \um_map_single:nnn {Nabla}{bfit}{#1} } - { - \bool_if:NF \g_um_upNabla_bool - { \um_map_single:nnn {Nabla}{bfup,bfit}{#1} } - } - \bool_if:NTF \g_um_literal_partial_bool - { \um_map_single:nnn {partial}{bfit}{#1} } - { - \bool_if:NF \g_um_uppartial_bool - { \um_map_single:nnn {partial}{bfup,bfit}{#1} } - } - \um_set_mathalphabet_pos:Nnnn \mathbfit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfit {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {it}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {it}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up,it}{#1} - } - } - } -\cs_new:Nn \um_config_bfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathbfup {up}{#1} - } - -\cs_new:Nn \um_config_bfup_Latin:n - { - \bool_if:NT \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_Latin:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Latin:nn {bfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfup_latin:n - { - \bool_if:NT \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_latin:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_latin:nn {bfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up,it}{#1} - } - } - } -\cs_new:Nn \um_config_bfup_Greek:n - { - \um_set_mathalphabet_Greek:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Greek:nn {bfup}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfupGreek_bool - { - \um_map_chars_Greek:nn {bfup,bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfup_greek:n - { - \um_set_mathalphabet_greek:Nnn \mathbfup {up,it} {#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_greek:nn {bfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up} {#1} - } - { - \bool_if:NT \g_um_bfupgreek_bool - { - \um_map_chars_greek:nn {bfup,bfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up,it} {#1} - } - } - } - -\cs_new:Nn \um_config_bfup_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfup}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfup,bfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfup}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfup,bfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfup {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {Nabla} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {Digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbf {digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbf {Digamma} {up}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up,it}{#1} - } - } - } -\cs_new:Nn \um_config_bffrak_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbffrak {up,it}{#1} - } - -\cs_new:Nn \um_config_bffrak_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbffrak {up,it}{#1} - } -\cs_new:Nn \um_config_bfscr_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbfscr {up,it}{#1} - } -\cs_new:Nn \um_config_bfscr_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbfscr {up,it}{#1} - } -\cs_new:Nn \um_config_bfcal_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbfcal {up,it}{#1} - } -\cs_new:Nn \um_config_bfsfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbfsf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathbfsfup {up}{#1} - } -\cs_new:Nn \um_config_bfsfup_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {bfsfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {bfsfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_Greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Greek:nn {bfsfup}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Greek:nn {bfsfup,bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Greek:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_greek:nn {bfsfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up} {#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_greek:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathbfsfup {up,it} {#1} - } -\cs_new:Nn \um_config_bfsfup_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup,bfsfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfsfup}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfsfup,bfsfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfsfup {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfsfup {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up,it}{#1} - } - } - } -\cs_new:Nn \um_config_bfsfit_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_Greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Greek:nn {bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Greek:nn {bfsfup,bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Greek:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_greek:nn {bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {it} {#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_greek:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathbfsfit {up,it} {#1} - } - -\cs_new:Nn \um_config_bfsfit_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfsfit}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup,bfsfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfsfit}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfsfup,bfsfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfsfit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfsfit {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {it}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {it}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up,it}{#1} - } - } - } -\cs_new:Npn \um_symbol_setup: +\cs_new:Npn \__um_symbol_setup: { \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { - \exp_not:n { \_um_sym:nnn {##1} {##2} {##3} } + \exp_not:n { \__um_sym:nnn {##1} {##2} {##3} } } } -\CatchFileEdef \g_um_mathtable_tl {unicode-math-table.tex} {\um_symbol_setup:} -\cs_new:Nn \um_input_math_symbol_table: {\g_um_mathtable_tl} +\CatchFileEdef \g__um_mathtable_tl {unicode-math-table.tex} {\__um_symbol_setup:} +\cs_new:Nn \__um_input_math_symbol_table: {\g__um_mathtable_tl} \group_begin: \char_set_catcode_other:N \^ - \cs_gset:Npn \um_cs_set_eq_active_char:Nw #1 = "#2 \q_nil + \cs_gset:Npn \__um_cs_set_eq_active_char:Nw #1 = "#2 \q_nil { \tex_lowercase:D { @@ -2068,7 +1178,7 @@ } } } - \cs_new:Npn \um_active_char_set:wc "#1 \q_nil #2 + \cs_new:Npn \__um_active_char_set:wc "#1 \q_nil #2 { \tex_lowercase:D { @@ -2077,25 +1187,22 @@ } } \group_end: -\AtBeginDocument{\um_define_math_chars:} -\cs_new:Nn \um_define_math_chars: +\AtBeginDocument{\__um_define_math_chars:} +\cs_new:Nn \__um_define_math_chars: { \group_begin: \char_set_catcode_math_superscript:N \^ - \cs_set:Npn \_um_sym:nnn ##1##2##3 + \cs_set:Npn \__um_sym:nnn ##1##2##3 { - \bool_if:nF { \cs_if_eq_p:NN ##3 \mathaccent || - \cs_if_eq_p:NN ##3 \mathopen || - \cs_if_eq_p:NN ##3 \mathclose || - \cs_if_eq_p:NN ##3 \mathover || - \cs_if_eq_p:NN ##3 \mathunder || - \cs_if_eq_p:NN ##3 \mathbotaccent } + \tl_if_in:nnT + { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence } + {##3} { - \um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces + \__um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces } } \char_set_catcode_other:N \# - \um_input_math_symbol_table: + \__um_input_math_symbol_table: \group_end: } \group_begin: @@ -2110,171 +1217,169 @@ } } |group_end: -\AtBeginDocument { \um_load_lm_if_necessary: } -\cs_new:Nn \um_load_lm_if_necessary: +\AtBeginDocument { \__um_load_lm_if_necessary: } +\cs_new:Nn \__um_load_lm_if_necessary: { - \cs_if_exist:NF \l_um_fontname_tl + \cs_if_exist:NF \l__um_fontname_tl { - % XXX: update this when lmmath-bold.otf is released - \setmathfont[BoldFont={latinmodern-math.otf}]{latinmodern-math.otf} + % 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 +\cs_new:Nn \__um_arg_i_before_egroup:n {#1\egroup} +\cs_new:Nn \__um_superscript:n { ^\bgroup #1 - \peek_meaning_remove:NTF ^ \um_arg_i_before_egroup:n \egroup + \peek_meaning_remove:NTF ^ \__um_arg_i_before_egroup:n \egroup } -\muskip_new:N \g_um_primekern_muskip -\muskip_gset:Nn \g_um_primekern_muskip { -\thinmuskip/2 }% arbitrary -\int_new:N \l_um_primecount_int -\cs_new:Nn \um_nprimes:Nn +\cs_new:Nn \__um_nprimes:Nn { - \um_superscript:n + \__um_superscript:n { #1 - \prg_replicate:nn {#2-1} { \mskip \g_um_primekern_muskip #1 } + \prg_replicate:nn {#2-1} { \mskip \g__um_primekern_muskip #1 } } } -\cs_new:Nn \um_nprimes_select:nn +\cs_new:Nn \__um_nprimes_select:nn { - \int_case:nnn {#2} + \int_case:nnF {#2} { - {1} { \um_superscript:n {#1} } + {1} { \__um_superscript:n {#1} } {2} { - \um_glyph_if_exist:nTF {"2033} - { \um_superscript:n {\um_prime_double_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2033} + { \__um_superscript:n {\__um_prime_double_mchar} } + { \__um_nprimes:Nn #1 {#2} } } {3} { - \um_glyph_if_exist:nTF {"2034} - { \um_superscript:n {\um_prime_triple_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2034} + { \__um_superscript:n {\__um_prime_triple_mchar} } + { \__um_nprimes:Nn #1 {#2} } } {4} { - \um_glyph_if_exist:nTF {"2057} - { \um_superscript:n {\um_prime_quad_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2057} + { \__um_superscript:n {\__um_prime_quad_mchar} } + { \__um_nprimes:Nn #1 {#2} } } } { - \um_nprimes:Nn #1 {#2} + \__um_nprimes:Nn #1 {#2} } } -\cs_new:Nn \um_nbackprimes_select:nn +\cs_new:Nn \__um_nbackprimes_select:nn { - \int_case:nnn {#2} + \int_case:nnF {#2} { - {1} { \um_superscript:n {#1} } + {1} { \__um_superscript:n {#1} } {2} { - \um_glyph_if_exist:nTF {"2036} - { \um_superscript:n {\um_backprime_double_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2036} + { \__um_superscript:n {\__um_backprime_double_mchar} } + { \__um_nprimes:Nn #1 {#2} } } {3} { - \um_glyph_if_exist:nTF {"2037} - { \um_superscript:n {\um_backprime_triple_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2037} + { \__um_superscript:n {\__um_backprime_triple_mchar} } + { \__um_nprimes:Nn #1 {#2} } } } { - \um_nprimes:Nn #1 {#2} + \__um_nprimes:Nn #1 {#2} } } -\cs_new:Npn \um_scan_prime: +\cs_new:Npn \__um_scan_prime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_zero:N \l_um_primecount_int - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_zero:N \l__um_primecount_int + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_dprime: +\cs_new:Npn \__um_scan_dprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {1} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {1} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_trprime: +\cs_new:Npn \__um_scan_trprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {2} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_qprime: +\cs_new:Npn \__um_scan_qprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {3} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_sup_prime: +\cs_new:Npn \__um_scan_sup_prime: { - \int_zero:N \l_um_primecount_int - \um_scanprime_collect:N \um_prime_single_mchar + \int_zero:N \l__um_primecount_int + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_sup_dprime: +\cs_new:Npn \__um_scan_sup_dprime: { - \int_set:Nn \l_um_primecount_int {1} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l__um_primecount_int {1} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_sup_trprime: +\cs_new:Npn \__um_scan_sup_trprime: { - \int_set:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l__um_primecount_int {2} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_sup_qprime: +\cs_new:Npn \__um_scan_sup_qprime: { - \int_set:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l__um_primecount_int {3} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Nn \um_scanprime_collect:N +\cs_new:Nn \__um_scanprime_collect:N { - \int_incr:N \l_um_primecount_int + \int_incr:N \l__um_primecount_int \peek_meaning_remove:NTF ' - { \um_scanprime_collect:N #1 } + { \__um_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_prime: - { \um_scanprime_collect:N #1 } + \peek_meaning_remove:NTF \__um_scan_prime: + { \__um_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2032 - { \um_scanprime_collect:N #1 } + { \__um_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_dprime: + \peek_meaning_remove:NTF \__um_scan_dprime: { - \int_incr:N \l_um_primecount_int - \um_scanprime_collect:N #1 + \int_incr:N \l__um_primecount_int + \__um_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2033 { - \int_incr:N \l_um_primecount_int - \um_scanprime_collect:N #1 + \int_incr:N \l__um_primecount_int + \__um_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_trprime: + \peek_meaning_remove:NTF \__um_scan_trprime: { - \int_add:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {2} + \__um_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2034 { - \int_add:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {2} + \__um_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_qprime: + \peek_meaning_remove:NTF \__um_scan_qprime: { - \int_add:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {3} + \__um_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2057 { - \int_add:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {3} + \__um_scanprime_collect:N #1 } { - \um_nprimes_select:nn {#1} {\l_um_primecount_int} + \__um_nprimes_select:nn {#1} {\l__um_primecount_int} } } } @@ -2285,82 +1390,82 @@ } } } -\cs_new:Npn \um_scan_backprime: +\cs_new:Npn \__um_scan_backprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_zero:N \l_um_primecount_int - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_zero:N \l__um_primecount_int + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_backdprime: +\cs_new:Npn \__um_scan_backdprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {1} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {1} + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_backtrprime: +\cs_new:Npn \__um_scan_backtrprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {2} + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backprime: +\cs_new:Npn \__um_scan_sup_backprime: { - \int_zero:N \l_um_primecount_int - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_zero:N \l__um_primecount_int + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backdprime: +\cs_new:Npn \__um_scan_sup_backdprime: { - \int_set:Nn \l_um_primecount_int {1} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_set:Nn \l__um_primecount_int {1} + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backtrprime: +\cs_new:Npn \__um_scan_sup_backtrprime: { - \int_set:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_set:Nn \l__um_primecount_int {2} + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Nn \um_scanbackprime_collect:N +\cs_new:Nn \__um_scanbackprime_collect:N { - \int_incr:N \l_um_primecount_int + \int_incr:N \l__um_primecount_int \peek_meaning_remove:NTF ` { - \um_scanbackprime_collect:N #1 + \__um_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backprime: + \peek_meaning_remove:NTF \__um_scan_backprime: { - \um_scanbackprime_collect:N #1 + \__um_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2035 { - \um_scanbackprime_collect:N #1 + \__um_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backdprime: + \peek_meaning_remove:NTF \__um_scan_backdprime: { - \int_incr:N \l_um_primecount_int - \um_scanbackprime_collect:N #1 + \int_incr:N \l__um_primecount_int + \__um_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2036 { - \int_incr:N \l_um_primecount_int - \um_scanbackprime_collect:N #1 + \int_incr:N \l__um_primecount_int + \__um_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backtrprime: + \peek_meaning_remove:NTF \__um_scan_backtrprime: { - \int_add:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {2} + \__um_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2037 { - \int_add:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {2} + \__um_scanbackprime_collect:N #1 } { - \um_nbackprimes_select:nn {#1} {\l_um_primecount_int} + \__um_nbackprimes_select:nn {#1} {\l__um_primecount_int} } } } @@ -2369,16 +1474,16 @@ } } } -\AtBeginDocument{\um_define_prime_commands: \um_define_prime_chars:} -\cs_new:Nn \um_define_prime_commands: +\AtBeginDocument{\__um_define_prime_commands: \__um_define_prime_chars:} +\cs_new:Nn \__um_define_prime_commands: { - \cs_set_eq:NN \prime \um_prime_single_mchar - \cs_set_eq:NN \dprime \um_prime_double_mchar - \cs_set_eq:NN \trprime \um_prime_triple_mchar - \cs_set_eq:NN \qprime \um_prime_quad_mchar - \cs_set_eq:NN \backprime \um_backprime_single_mchar - \cs_set_eq:NN \backdprime \um_backprime_double_mchar - \cs_set_eq:NN \backtrprime \um_backprime_triple_mchar + \cs_set_eq:NN \prime \__um_prime_single_mchar + \cs_set_eq:NN \dprime \__um_prime_double_mchar + \cs_set_eq:NN \trprime \__um_prime_triple_mchar + \cs_set_eq:NN \qprime \__um_prime_quad_mchar + \cs_set_eq:NN \backprime \__um_backprime_single_mchar + \cs_set_eq:NN \backdprime \__um_backprime_double_mchar + \cs_set_eq:NN \backtrprime \__um_backprime_triple_mchar } \group_begin: \char_set_catcode_active:N \' @@ -2390,150 +1495,153 @@ \char_set_catcode_active:n {"2035} \char_set_catcode_active:n {"2036} \char_set_catcode_active:n {"2037} - \cs_gset:Nn \um_define_prime_chars: - { - \cs_set_eq:NN ' \um_scan_sup_prime: - \cs_set_eq:NN ^^^^2032 \um_scan_sup_prime: - \cs_set_eq:NN ^^^^2033 \um_scan_sup_dprime: - \cs_set_eq:NN ^^^^2034 \um_scan_sup_trprime: - \cs_set_eq:NN ^^^^2057 \um_scan_sup_qprime: - \cs_set_eq:NN ` \um_scan_sup_backprime: - \cs_set_eq:NN ^^^^2035 \um_scan_sup_backprime: - \cs_set_eq:NN ^^^^2036 \um_scan_sup_backdprime: - \cs_set_eq:NN ^^^^2037 \um_scan_sup_backtrprime: + \cs_gset:Nn \__um_define_prime_chars: + { + \cs_set_eq:NN ' \__um_scan_sup_prime: + \cs_set_eq:NN ^^^^2032 \__um_scan_sup_prime: + \cs_set_eq:NN ^^^^2033 \__um_scan_sup_dprime: + \cs_set_eq:NN ^^^^2034 \__um_scan_sup_trprime: + \cs_set_eq:NN ^^^^2057 \__um_scan_sup_qprime: + \cs_set_eq:NN ` \__um_scan_sup_backprime: + \cs_set_eq:NN ^^^^2035 \__um_scan_sup_backprime: + \cs_set_eq:NN ^^^^2036 \__um_scan_sup_backdprime: + \cs_set_eq:NN ^^^^2037 \__um_scan_sup_backtrprime: } \group_end: -\AtBeginDocument{\um_redefine_radical:} -\cs_new:Nn \um_redefine_radical: +\AtBeginDocument{\__um_redefine_radical:} +\cs_new:Nn \__um_redefine_radical: { \@ifpackageloaded { amsmath } { } { \cs_set:Npn \root ##1 \of ##2 { - \luatexUroot \l_um_radical_sqrt_tl { ##1 } { ##2 } + \luatexUroot \l__um_radical_sqrt_tl { ##1 } { ##2 } } } } -\cs_new:Nn \um_fontdimen_to_percent:nn +\cs_new:Nn \__um_fontdimen_to_percent:nn { - \strip@pt\dimexpr\fontdimen#1#2*65536/100\relax + \fp_eval:n { \dim_to_decimal:n { \fontdimen #1 #2 } * 65536 / 100 } } -\cs_new:Nn \um_fontdimen_to_scale:nn +\cs_new:Nn \__um_fontdimen_to_scale:nn { - \um_fontdimen_to_percent:nn {#1} {#2} \dimexpr \f@size pt\relax + \fp_eval:n {\__um_fontdimen_to_percent:nn {#1} {#2} * \f@size } pt } -\cs_new:Nn \um_mathstyle_scale:Nnn +\cs_new:Nn \__um_mathstyle_scale:Nnn { \ifx#1\scriptstyle - #2 \um_fontdimen_to_percent:nn {10} \l_um_font #3 + #2 \__um_fontdimen_to_percent:nn {10} \l__um_font #3 \else \ifx#1\scriptscriptstyle - #2 \um_fontdimen_to_percent:nn {11} \l_um_font #3 + #2 \__um_fontdimen_to_percent:nn {11} \l__um_font #3 \else #2 #3 \fi \fi } -\prop_new:N \g_um_supers_prop -\prop_new:N \g_um_subs_prop \group_begin: -\cs_new:Nn \um_setup_active_superscript:nn +\cs_new:Nn \__um_setup_active_superscript:nn { - \prop_gput:Nxn \g_um_supers_prop {\meaning #1} {#2} + \prop_gput:Non \g__um_supers_prop {\meaning #1} {#2} \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \__um_char_gmake_mathactive:N #1 \scantokens { \cs_gset:Npn #1 { - \tl_set:Nn \l_um_ss_chain_tl {#2} - \cs_set_eq:NN \um_sub_or_super:n \sp - \tl_set:Nn \l_um_tmpa_tl {supers} - \um_scan_sscript: - } - } - } -\um_setup_active_superscript:nn {^^^^2070} {0} -\um_setup_active_superscript:nn {^^^^00b9} {1} -\um_setup_active_superscript:nn {^^^^00b2} {2} -\um_setup_active_superscript:nn {^^^^00b3} {3} -\um_setup_active_superscript:nn {^^^^2074} {4} -\um_setup_active_superscript:nn {^^^^2075} {5} -\um_setup_active_superscript:nn {^^^^2076} {6} -\um_setup_active_superscript:nn {^^^^2077} {7} -\um_setup_active_superscript:nn {^^^^2078} {8} -\um_setup_active_superscript:nn {^^^^2079} {9} -\um_setup_active_superscript:nn {^^^^207a} {+} -\um_setup_active_superscript:nn {^^^^207b} {-} -\um_setup_active_superscript:nn {^^^^207c} {=} -\um_setup_active_superscript:nn {^^^^207d} {(} -\um_setup_active_superscript:nn {^^^^207e} {)} -\um_setup_active_superscript:nn {^^^^2071} {i} -\um_setup_active_superscript:nn {^^^^207f} {n} -\cs_new:Nn \um_setup_active_subscript:nn - { - \prop_gput:Nxn \g_um_subs_prop {\meaning #1} {#2} + \tl_set:Nn \l__um_ss_chain_tl {#2} + \cs_set_eq:NN \__um_sub_or_super:n \sp + \tl_set:Nn \l__um_tmpa_tl {supers} + \__um_scan_sscript: + } + } + } +\__um_setup_active_superscript:nn {^^^^2070} {0} +\__um_setup_active_superscript:nn {^^^^00b9} {1} +\__um_setup_active_superscript:nn {^^^^00b2} {2} +\__um_setup_active_superscript:nn {^^^^00b3} {3} +\__um_setup_active_superscript:nn {^^^^2074} {4} +\__um_setup_active_superscript:nn {^^^^2075} {5} +\__um_setup_active_superscript:nn {^^^^2076} {6} +\__um_setup_active_superscript:nn {^^^^2077} {7} +\__um_setup_active_superscript:nn {^^^^2078} {8} +\__um_setup_active_superscript:nn {^^^^2079} {9} +\__um_setup_active_superscript:nn {^^^^207a} {+} +\__um_setup_active_superscript:nn {^^^^207b} {-} +\__um_setup_active_superscript:nn {^^^^207c} {=} +\__um_setup_active_superscript:nn {^^^^207d} {(} +\__um_setup_active_superscript:nn {^^^^207e} {)} +\__um_setup_active_superscript:nn {^^^^2071} {i} +\__um_setup_active_superscript:nn {^^^^207f} {n} +\__um_setup_active_superscript:nn {^^^^02b0} {h} +\__um_setup_active_superscript:nn {^^^^02b2} {j} +\__um_setup_active_superscript:nn {^^^^02b3} {r} +\__um_setup_active_superscript:nn {^^^^02b7} {w} +\__um_setup_active_superscript:nn {^^^^02b8} {y} +\cs_new:Nn \__um_setup_active_subscript:nn + { + \prop_gput:Non \g__um_subs_prop {\meaning #1} {#2} \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \__um_char_gmake_mathactive:N #1 \scantokens { \cs_gset:Npn #1 { - \tl_set:Nn \l_um_ss_chain_tl {#2} - \cs_set_eq:NN \um_sub_or_super:n \sb - \tl_set:Nn \l_um_tmpa_tl {subs} - \um_scan_sscript: - } - } - } -\um_setup_active_subscript:nn {^^^^2080} {0} -\um_setup_active_subscript:nn {^^^^2081} {1} -\um_setup_active_subscript:nn {^^^^2082} {2} -\um_setup_active_subscript:nn {^^^^2083} {3} -\um_setup_active_subscript:nn {^^^^2084} {4} -\um_setup_active_subscript:nn {^^^^2085} {5} -\um_setup_active_subscript:nn {^^^^2086} {6} -\um_setup_active_subscript:nn {^^^^2087} {7} -\um_setup_active_subscript:nn {^^^^2088} {8} -\um_setup_active_subscript:nn {^^^^2089} {9} -\um_setup_active_subscript:nn {^^^^208a} {+} -\um_setup_active_subscript:nn {^^^^208b} {-} -\um_setup_active_subscript:nn {^^^^208c} {=} -\um_setup_active_subscript:nn {^^^^208d} {(} -\um_setup_active_subscript:nn {^^^^208e} {)} -\um_setup_active_subscript:nn {^^^^2090} {a} -\um_setup_active_subscript:nn {^^^^2091} {e} -\um_setup_active_subscript:nn {^^^^1d62} {i} -\um_setup_active_subscript:nn {^^^^2092} {o} -\um_setup_active_subscript:nn {^^^^1d63} {r} -\um_setup_active_subscript:nn {^^^^1d64} {u} -\um_setup_active_subscript:nn {^^^^1d65} {v} -\um_setup_active_subscript:nn {^^^^2093} {x} -\um_setup_active_subscript:nn {^^^^1d66} {\beta} -\um_setup_active_subscript:nn {^^^^1d67} {\gamma} -\um_setup_active_subscript:nn {^^^^1d68} {\rho} -\um_setup_active_subscript:nn {^^^^1d69} {\phi} -\um_setup_active_subscript:nn {^^^^1d6a} {\chi} + \tl_set:Nn \l__um_ss_chain_tl {#2} + \cs_set_eq:NN \__um_sub_or_super:n \sb + \tl_set:Nn \l__um_tmpa_tl {subs} + \__um_scan_sscript: + } + } + } +\__um_setup_active_subscript:nn {^^^^2080} {0} +\__um_setup_active_subscript:nn {^^^^2081} {1} +\__um_setup_active_subscript:nn {^^^^2082} {2} +\__um_setup_active_subscript:nn {^^^^2083} {3} +\__um_setup_active_subscript:nn {^^^^2084} {4} +\__um_setup_active_subscript:nn {^^^^2085} {5} +\__um_setup_active_subscript:nn {^^^^2086} {6} +\__um_setup_active_subscript:nn {^^^^2087} {7} +\__um_setup_active_subscript:nn {^^^^2088} {8} +\__um_setup_active_subscript:nn {^^^^2089} {9} +\__um_setup_active_subscript:nn {^^^^208a} {+} +\__um_setup_active_subscript:nn {^^^^208b} {-} +\__um_setup_active_subscript:nn {^^^^208c} {=} +\__um_setup_active_subscript:nn {^^^^208d} {(} +\__um_setup_active_subscript:nn {^^^^208e} {)} +\__um_setup_active_subscript:nn {^^^^2090} {a} +\__um_setup_active_subscript:nn {^^^^2091} {e} +\__um_setup_active_subscript:nn {^^^^1d62} {i} +\__um_setup_active_subscript:nn {^^^^2092} {o} +\__um_setup_active_subscript:nn {^^^^1d63} {r} +\__um_setup_active_subscript:nn {^^^^1d64} {u} +\__um_setup_active_subscript:nn {^^^^1d65} {v} +\__um_setup_active_subscript:nn {^^^^2093} {x} +\__um_setup_active_subscript:nn {^^^^1d66} {\beta} +\__um_setup_active_subscript:nn {^^^^1d67} {\gamma} +\__um_setup_active_subscript:nn {^^^^1d68} {\rho} +\__um_setup_active_subscript:nn {^^^^1d69} {\phi} +\__um_setup_active_subscript:nn {^^^^1d6a} {\chi} \group_end: -\cs_new:Npn \um_scan_sscript: +\cs_new:Npn \__um_scan_sscript: { - \um_scan_sscript:TF + \__um_scan_sscript:TF { - \um_scan_sscript: + \__um_scan_sscript: } { - \um_sub_or_super:n {\l_um_ss_chain_tl} + \__um_sub_or_super:n {\l__um_ss_chain_tl} } } -\cs_new:Npn \um_scan_sscript:TF #1#2 +\cs_new:Npn \__um_scan_sscript:TF #1#2 { \tl_set:Nx \__peek_true_aux:w { \exp_not:n{ #1 } } \tl_set_eq:NN \__peek_true:w \__peek_true_remove:w \tl_set:Nx \__peek_false:w { \exp_not:n { \group_align_safe_end: #2 } } \group_align_safe_begin: - \peek_after:Nw \um_peek_execute_branches_ss: + \peek_after:Nw \__um_peek_execute_branches_ss: } -\cs_new:Npn \um_peek_execute_branches_ss: +\cs_new:Npn \__um_peek_execute_branches_ss: { \bool_if:nTF { @@ -2542,24 +1650,24 @@ \token_if_eq_meaning_p:NN \l_peek_token \c_space_token } { \__peek_false:w } - { \um_peek_execute_branches_ss_aux: } + { \__um_peek_execute_branches_ss_aux: } } -\cs_new:Npn \um_peek_execute_branches_ss_aux: +\cs_new:Npn \__um_peek_execute_branches_ss_aux: { - \prop_if_in:cxTF - {g_um_\l_um_tmpa_tl _prop} {\meaning\l_peek_token} + \prop_if_in:coTF + {g__um_\l__um_tmpa_tl _prop} {\meaning\l_peek_token} { - \prop_get:cxN - {g_um_\l_um_tmpa_tl _prop} {\meaning\l_peek_token} \l_um_tmpb_tl - \tl_put_right:NV \l_um_ss_chain_tl \l_um_tmpb_tl + \prop_get:coN + {g__um_\l__um_tmpa_tl _prop} {\meaning\l_peek_token} \l__um_tmpb_tl + \tl_put_right:NV \l__um_ss_chain_tl \l__um_tmpb_tl \__peek_true:w } { \__peek_false:w } } -\cs_new:Npn \um_define_active_frac:Nw #1 #2/#3 +\cs_new:Npn \__um_define_active_frac:Nw #1 #2/#3 { \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \__um_char_gmake_mathactive:N #1 \tl_rescan:nn { \catcode`\_=11\relax @@ -2568,36 +1676,36 @@ { \cs_gset:Npx #1 { - \bool_if:NTF \l_um_smallfrac_bool {\exp_not:N\tfrac} {\exp_not:N\frac} + \bool_if:NTF \l__um_smallfrac_bool {\exp_not:N\tfrac} {\exp_not:N\frac} {#2} {#3} } } } -\cs_new:Npn \um_setup_active_frac: +\cs_new:Npn \__um_setup_active_frac: { \group_begin: - \um_define_active_frac:Nw ^^^^2189 0/3 - \um_define_active_frac:Nw ^^^^2152 1/{10} - \um_define_active_frac:Nw ^^^^2151 1/9 - \um_define_active_frac:Nw ^^^^215b 1/8 - \um_define_active_frac:Nw ^^^^2150 1/7 - \um_define_active_frac:Nw ^^^^2159 1/6 - \um_define_active_frac:Nw ^^^^2155 1/5 - \um_define_active_frac:Nw ^^^^00bc 1/4 - \um_define_active_frac:Nw ^^^^2153 1/3 - \um_define_active_frac:Nw ^^^^215c 3/8 - \um_define_active_frac:Nw ^^^^2156 2/5 - \um_define_active_frac:Nw ^^^^00bd 1/2 - \um_define_active_frac:Nw ^^^^2157 3/5 - \um_define_active_frac:Nw ^^^^215d 5/8 - \um_define_active_frac:Nw ^^^^2154 2/3 - \um_define_active_frac:Nw ^^^^00be 3/4 - \um_define_active_frac:Nw ^^^^2158 4/5 - \um_define_active_frac:Nw ^^^^215a 5/6 - \um_define_active_frac:Nw ^^^^215e 7/8 + \__um_define_active_frac:Nw ^^^^2189 0/3 + \__um_define_active_frac:Nw ^^^^2152 1/{10} + \__um_define_active_frac:Nw ^^^^2151 1/9 + \__um_define_active_frac:Nw ^^^^215b 1/8 + \__um_define_active_frac:Nw ^^^^2150 1/7 + \__um_define_active_frac:Nw ^^^^2159 1/6 + \__um_define_active_frac:Nw ^^^^2155 1/5 + \__um_define_active_frac:Nw ^^^^00bc 1/4 + \__um_define_active_frac:Nw ^^^^2153 1/3 + \__um_define_active_frac:Nw ^^^^215c 3/8 + \__um_define_active_frac:Nw ^^^^2156 2/5 + \__um_define_active_frac:Nw ^^^^00bd 1/2 + \__um_define_active_frac:Nw ^^^^2157 3/5 + \__um_define_active_frac:Nw ^^^^215d 5/8 + \__um_define_active_frac:Nw ^^^^2154 2/3 + \__um_define_active_frac:Nw ^^^^00be 3/4 + \__um_define_active_frac:Nw ^^^^2158 4/5 + \__um_define_active_frac:Nw ^^^^215a 5/6 + \__um_define_active_frac:Nw ^^^^215e 7/8 \group_end: } -\um_setup_active_frac: +\__um_setup_active_frac: \def\to{\rightarrow} \def\le{\leq} \def\ge{\geq} @@ -2620,7 +1728,16 @@ \def\longdivision{\longdivisionsign} \def\backepsilon{\upbackepsilon} \def\eth{\matheth} -\def\smallint{{\textstyle\int}\limits} +\def\dbkarow {\dbkarrow} +\def\drbkarow{\drbkarrow} +\def\hksearow{\hksearrow} +\def\hkswarow{\hkswarrow} +\def\smallint{\mathop{\textstyle\int}\limits} +\cs_set_eq:NN \latexe_underbar:n \underbar +\renewcommand\underbar + { + \mode_if_math:TF \mathunderbar \latexe_underbar:n + } \@ifpackageloaded{amsmath} { % define their own colon, perhaps I should just steal it. (It does look much better.) @@ -2628,23 +1745,65 @@ { \cs_set_protected:Npn \colon { - \bool_if:NTF \g_um_literal_colon_bool {:} { \mathpunct{:} } + \bool_if:NTF \g__um_literal_colon_bool {:} { \mathpunct{:} } } } -\def\mathrm{\mathup} \let\mathfence\mathord \def\digamma{\updigamma} \def\Digamma{\upDigamma} -\def\operator@font{\um_switchto_mathup:} -\cs_new_protected_nopar:Nn \um_check_and_fix:NNnnnn +\cs_set:Npn \| {\Vert} +\cs_set:Npn \mathellipsis {\mathinner{\unicodeellipsis}} +\cs_set:Npn \cdots {\mathinner{\unicodecdots}} +\cs_set_eq:NN \__um_text_slash: \slash +\cs_set_protected:Npn \slash + { + \mode_if_math:TF {\mathslash} {\__um_text_slash:} + } +\cs_new:Npn \__um_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 } + } + { + \__um_oldnot: #1 + } + } + } +\cs_set_eq:NN \__um_oldnot: \not +\AtBeginDocument{\cs_set_eq:NN \not \__um_newnot:N} +\cs_new_protected_nopar:Nn \__um_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 } + } +\cs_new_protected_nopar:Nn \__um_check_and_fix:NNnnnn { \cs_if_exist:NT #1 { \token_if_macro:NTF #1 { \group_begin: - #2 \um_tmpa:w #3 { #4 } - \cs_if_eq:NNTF #1 \um_tmpa:w + #2 \__um_tmpa:w #3 { #4 } + \cs_if_eq:NNTF #1 \__um_tmpa:w { \msg_info:nnx { unicode-math } { patch-macro } { \token_to_str:N #1 } @@ -2655,7 +1814,7 @@ { \msg_warning:nnxxx { unicode-math } { wrong-meaning } { \token_to_str:N #1 } { \token_to_meaning:N #1 } - { \token_to_meaning:N \um_tmpa:w } + { \token_to_meaning:N \__um_tmpa:w } \group_end: } } @@ -2665,21 +1824,18 @@ } } } -\cs_new_protected_nopar:Nn \um_check_and_fix:NNnnn +\cs_new_protected_nopar:Nn \__um_check_and_fix:NNnnn { - \um_check_and_fix:NNnnnn #1 #2 { #3 } { #4 } { #5 } { #5 } + \__um_check_and_fix:NNnnnn #1 #2 { #3 } { #4 } { #5 } { #5 } } -\cs_new_protected_nopar:Nn \um_check_and_fix_luatex:NNnnn +\cs_new_protected_nopar:Nn \__um_check_and_fix_luatex:NNnnn { - \luatex_if_engine:T - { - \um_check_and_fix:NNnnn #1 #2 { #3 } { #4 } { #5 } - } + \__um_check_and_fix:NNnnn #1 #2 { #3 } { #4 } { #5 } } -\cs_generate_variant:Nn \um_check_and_fix_luatex:NNnnn { c } +\cs_generate_variant:Nn \__um_check_and_fix_luatex:NNnnn { c } \AtEndOfPackageFile * {url} { - \tl_put_left:Nn \Url@FormatString { \um_switchto_mathup: } + \tl_put_left:Nn \Url@FormatString { \__um_switchto_up: } \tl_put_right:Nn \UrlSpecials { \do\`{\mathchar`\`} @@ -2692,7 +1848,7 @@ { \cs_set:Npn \@cdots {\mathinner{\cdots}} \cs_set_eq:NN \dotsb@ \cdots - \um_check_and_fix_luatex:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } + \__um_check_and_fix_luatex:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } { \setbox \rootbox \hbox { @@ -2712,7 +1868,7 @@ && \int_compare_p:nNn { \leftroot@ } = { \c_zero } } { - \luatexUroot \l_um_radical_sqrt_tl { #1 } { #2 } + \luatexUroot \l__um_radical_sqrt_tl { #1 } { #2 } } { \hbox_set:Nn \rootbox @@ -2730,7 +1886,7 @@ } \c_group_end_token } - \um_check_and_fix:NNnnnn \r@@t \cs_set_nopar:Npn { #1 #2 } + \__um_check_and_fix:NNnnnn \r@@t \cs_set_nopar:Npn { #1 #2 } { \setboxz@h { $ \m@th #1 \sqrtsign { #2 } $ } \dimen@ \ht\z@ @@ -2753,7 +1909,7 @@ \mskip \uproot@ mu \c_math_toggle_token } - \luatexUroot \l_um_radical_sqrt_tl + \luatexUroot \l__um_radical_sqrt_tl { \box_move_up:nn { \box_wd:N \l_tmpa_box } { @@ -2788,122 +1944,27 @@ \c_math_toggle_token } \mkern -\leftroot@ mu - \um_mathstyle_scale:Nnn #1 { \kern } + \__um_mathstyle_scale:Nnn #1 { \kern } { - \fontdimen 63 \l_um_font + \fontdimen 63 \l__um_font } \box_move_up:nn { \box_wd:N \l_tmpb_box + (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box) - * \number \fontdimen 65 \l_um_font / 100 + * \number \fontdimen 65 \l__um_font / 100 } { \box_use:N \rootbox } - \um_mathstyle_scale:Nnn #1 { \kern } + \__um_mathstyle_scale:Nnn #1 { \kern } { - \fontdimen 64 \l_um_font + \fontdimen 64 \l__um_font } \mkern \leftroot@ mu \box_use_clear:N \l_tmpa_box } } -\cs_set:Npn \| {\Vert} -\cs_set:Npn \mathellipsis {\mathinner{\unicodeellipsis}} -\cs_set:Npn \cdots {\mathinner{\unicodecdots}} -\cs_new_protected_nopar:Nn \um_setup_accents: - { - \cs_gset_protected_nopar:Npx \widehat - { - \um_accent:nnn {} { \um_symfont_tl } { "0302 } - } - \cs_gset_protected_nopar:Npx \widetilde - { - \um_accent:nnn {} { \um_symfont_tl } { "0303 } - } - \cs_gset_protected_nopar:Npx \overleftarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20D6 } - } - \cs_gset_protected_nopar:Npx \overrightarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20D7 } - } - \cs_gset_protected_nopar:Npx \overleftrightarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20E1 } - } - \cs_gset_protected_nopar:Npx \wideutilde - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "0330 } - } - \cs_gset_protected_nopar:Npx \underrightharpoondown - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EC } - } - \cs_gset_protected_nopar:Npx \underleftharpoondown - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20ED } - } - \cs_gset_protected_nopar:Npx \underleftarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EE } - } - \cs_gset_protected_nopar:Npx \underrightarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EF } - } - \cs_gset_protected_nopar:Npx \underleftrightarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "034D } - } - } -\cs_set_eq:NN \um_text_slash: \slash -\cs_set_protected:Npn \slash - { - \mode_if_math:TF {\mathslash} {\um_text_slash:} - } -\tl_new:N \l_not_token_name_tl - -\cs_new:Npn \not_newnot:N #1 - { - \tl_set:Nx \l_not_token_name_tl { \token_to_str:N #1 } - \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 } - } - { - \not_oldnot: #1 %\l_not_token_name_tl - } - } - } - -\cs_set_eq:NN \not_oldnot: \not -\cs_set_eq:NN \not \not_newnot:N - -\cs_new_protected_nopar:Nn \um_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 } - } \AtEndOfPackageFile * { mathtools } { \AtEndOfPackageFile * { mathtools } @@ -2951,4 +2012,3 @@ \RenewDocumentCommand \equalscolon { } { \eqcolon } \RenewDocumentCommand \coloncolonequals { } { \Coloneq } } -\ExplSyntaxOff diff --git a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex index 9ed56cd1001..1babad3be0d 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex @@ -34,7 +34,9 @@ \UnicodeMathSymbol{"00300}{\grave }{\mathaccent}{grave accent}% \UnicodeMathSymbol{"00301}{\acute }{\mathaccent}{acute accent}% \UnicodeMathSymbol{"00302}{\hat }{\mathaccent}{circumflex accent}% +\UnicodeMathSymbol{"00302}{\widehat }{\mathaccentwide}{circumflex accent}% \UnicodeMathSymbol{"00303}{\tilde }{\mathaccent}{tilde}% +\UnicodeMathSymbol{"00303}{\widetilde }{\mathaccentwide}{tilde}% \UnicodeMathSymbol{"00304}{\bar }{\mathaccent}{macron}% \UnicodeMathSymbol{"00305}{\overbar }{\mathaccent}{overbar embellishment}% \UnicodeMathSymbol{"00306}{\breve }{\mathaccent}{breve}% @@ -47,62 +49,63 @@ \UnicodeMathSymbol{"00312}{\oturnedcomma }{\mathaccent}{combining turned comma above}% \UnicodeMathSymbol{"00315}{\ocommatopright }{\mathaccent}{combining comma above right}% \UnicodeMathSymbol{"0031A}{\droang }{\mathaccent}{left angle above (non-spacing)}% -\UnicodeMathSymbol{"00330}{\wideutilde }{\mathbotaccent}{under tilde accent (multiple characters and non-spacing)}% -\UnicodeMathSymbol{"00331}{\underbar }{\mathbotaccent}{combining macron below}% +\UnicodeMathSymbol{"00330}{\wideutilde }{\mathbotaccentwide}{under tilde accent (multiple characters and non-spacing)}% +\UnicodeMathSymbol{"00332}{\mathunderbar }{\mathbotaccentwide}{combining low line}% \UnicodeMathSymbol{"00338}{\not }{\mathaccent}{combining long solidus overlay}% -\UnicodeMathSymbol{"00391}{\upAlpha }{\mathalpha}{capital alpha, greek}% -\UnicodeMathSymbol{"00392}{\upBeta }{\mathalpha}{capital beta, greek}% -\UnicodeMathSymbol{"00393}{\upGamma }{\mathalpha}{capital gamma, greek}% -\UnicodeMathSymbol{"00394}{\upDelta }{\mathalpha}{capital delta, greek}% -\UnicodeMathSymbol{"00395}{\upEpsilon }{\mathalpha}{capital epsilon, greek}% -\UnicodeMathSymbol{"00396}{\upZeta }{\mathalpha}{capital zeta, greek}% -\UnicodeMathSymbol{"00397}{\upEta }{\mathalpha}{capital eta, greek}% -\UnicodeMathSymbol{"00398}{\upTheta }{\mathalpha}{capital theta, greek}% -\UnicodeMathSymbol{"00399}{\upIota }{\mathalpha}{capital iota, greek}% -\UnicodeMathSymbol{"0039A}{\upKappa }{\mathalpha}{capital kappa, greek}% -\UnicodeMathSymbol{"0039B}{\upLambda }{\mathalpha}{capital lambda, greek}% -\UnicodeMathSymbol{"0039C}{\upMu }{\mathalpha}{capital mu, greek}% -\UnicodeMathSymbol{"0039D}{\upNu }{\mathalpha}{capital nu, greek}% -\UnicodeMathSymbol{"0039E}{\upXi }{\mathalpha}{capital xi, greek}% -\UnicodeMathSymbol{"0039F}{\upOmicron }{\mathalpha}{capital omicron, greek}% -\UnicodeMathSymbol{"003A0}{\upPi }{\mathalpha}{capital pi, greek}% -\UnicodeMathSymbol{"003A1}{\upRho }{\mathalpha}{capital rho, greek}% -\UnicodeMathSymbol{"003A3}{\upSigma }{\mathalpha}{capital sigma, greek}% -\UnicodeMathSymbol{"003A4}{\upTau }{\mathalpha}{capital tau, greek}% -\UnicodeMathSymbol{"003A5}{\upUpsilon }{\mathalpha}{capital upsilon, greek}% -\UnicodeMathSymbol{"003A6}{\upPhi }{\mathalpha}{capital phi, greek}% -\UnicodeMathSymbol{"003A7}{\upChi }{\mathalpha}{capital chi, greek}% -\UnicodeMathSymbol{"003A8}{\upPsi }{\mathalpha}{capital psi, greek}% -\UnicodeMathSymbol{"003A9}{\upOmega }{\mathalpha}{capital omega, greek}% -\UnicodeMathSymbol{"003B1}{\upalpha }{\mathalpha}{small alpha, greek}% -\UnicodeMathSymbol{"003B2}{\upbeta }{\mathalpha}{small beta, greek}% -\UnicodeMathSymbol{"003B3}{\upgamma }{\mathalpha}{small gamma, greek}% -\UnicodeMathSymbol{"003B4}{\updelta }{\mathalpha}{small delta, greek}% -\UnicodeMathSymbol{"003B5}{\upepsilon }{\mathalpha}{rounded small epsilon, greek}% -\UnicodeMathSymbol{"003B6}{\upzeta }{\mathalpha}{small zeta, greek}% -\UnicodeMathSymbol{"003B7}{\upeta }{\mathalpha}{small eta, greek}% -\UnicodeMathSymbol{"003B8}{\uptheta }{\mathalpha}{straight theta, small theta, greek}% -\UnicodeMathSymbol{"003B9}{\upiota }{\mathalpha}{small iota, greek}% -\UnicodeMathSymbol{"003BA}{\upkappa }{\mathalpha}{small kappa, greek}% -\UnicodeMathSymbol{"003BB}{\uplambda }{\mathalpha}{small lambda, greek}% -\UnicodeMathSymbol{"003BC}{\upmu }{\mathalpha}{small mu, greek}% -\UnicodeMathSymbol{"003BD}{\upnu }{\mathalpha}{small nu, greek}% -\UnicodeMathSymbol{"003BE}{\upxi }{\mathalpha}{small xi, greek}% -\UnicodeMathSymbol{"003BF}{\upomicron }{\mathalpha}{small omicron, greek}% -\UnicodeMathSymbol{"003C0}{\uppi }{\mathalpha}{small pi, greek}% -\UnicodeMathSymbol{"003C1}{\uprho }{\mathalpha}{small rho, greek}% -\UnicodeMathSymbol{"003C2}{\upvarsigma }{\mathalpha}{terminal sigma, greek}% -\UnicodeMathSymbol{"003C3}{\upsigma }{\mathalpha}{small sigma, greek}% -\UnicodeMathSymbol{"003C4}{\uptau }{\mathalpha}{small tau, greek}% -\UnicodeMathSymbol{"003C5}{\upupsilon }{\mathalpha}{small upsilon, greek}% -\UnicodeMathSymbol{"003C6}{\upvarphi }{\mathalpha}{curly or open small phi, greek}% -\UnicodeMathSymbol{"003C7}{\upchi }{\mathalpha}{small chi, greek}% -\UnicodeMathSymbol{"003C8}{\uppsi }{\mathalpha}{small psi, greek}% -\UnicodeMathSymbol{"003C9}{\upomega }{\mathalpha}{small omega, greek}% -\UnicodeMathSymbol{"003D0}{\upvarbeta }{\mathalpha}{rounded small beta, greek}% -\UnicodeMathSymbol{"003D1}{\upvartheta }{\mathalpha}{/vartheta - curly or open theta}% -\UnicodeMathSymbol{"003D5}{\upphi }{\mathalpha}{/straightphi - small phi, greek}% -\UnicodeMathSymbol{"003D6}{\upvarpi }{\mathalpha}{rounded small pi (pomega), greek}% +\UnicodeMathSymbol{"0034D}{\underleftrightarrow }{\mathbotaccentwide}{underleftrightarrow accent}% +\UnicodeMathSymbol{"00391}{\mupAlpha }{\mathalpha}{capital alpha, greek}% +\UnicodeMathSymbol{"00392}{\mupBeta }{\mathalpha}{capital beta, greek}% +\UnicodeMathSymbol{"00393}{\mupGamma }{\mathalpha}{capital gamma, greek}% +\UnicodeMathSymbol{"00394}{\mupDelta }{\mathalpha}{capital delta, greek}% +\UnicodeMathSymbol{"00395}{\mupEpsilon }{\mathalpha}{capital epsilon, greek}% +\UnicodeMathSymbol{"00396}{\mupZeta }{\mathalpha}{capital zeta, greek}% +\UnicodeMathSymbol{"00397}{\mupEta }{\mathalpha}{capital eta, greek}% +\UnicodeMathSymbol{"00398}{\mupTheta }{\mathalpha}{capital theta, greek}% +\UnicodeMathSymbol{"00399}{\mupIota }{\mathalpha}{capital iota, greek}% +\UnicodeMathSymbol{"0039A}{\mupKappa }{\mathalpha}{capital kappa, greek}% +\UnicodeMathSymbol{"0039B}{\mupLambda }{\mathalpha}{capital lambda, greek}% +\UnicodeMathSymbol{"0039C}{\mupMu }{\mathalpha}{capital mu, greek}% +\UnicodeMathSymbol{"0039D}{\mupNu }{\mathalpha}{capital nu, greek}% +\UnicodeMathSymbol{"0039E}{\mupXi }{\mathalpha}{capital xi, greek}% +\UnicodeMathSymbol{"0039F}{\mupOmicron }{\mathalpha}{capital omicron, greek}% +\UnicodeMathSymbol{"003A0}{\mupPi }{\mathalpha}{capital pi, greek}% +\UnicodeMathSymbol{"003A1}{\mupRho }{\mathalpha}{capital rho, greek}% +\UnicodeMathSymbol{"003A3}{\mupSigma }{\mathalpha}{capital sigma, greek}% +\UnicodeMathSymbol{"003A4}{\mupTau }{\mathalpha}{capital tau, greek}% +\UnicodeMathSymbol{"003A5}{\mupUpsilon }{\mathalpha}{capital upsilon, greek}% +\UnicodeMathSymbol{"003A6}{\mupPhi }{\mathalpha}{capital phi, greek}% +\UnicodeMathSymbol{"003A7}{\mupChi }{\mathalpha}{capital chi, greek}% +\UnicodeMathSymbol{"003A8}{\mupPsi }{\mathalpha}{capital psi, greek}% +\UnicodeMathSymbol{"003A9}{\mupOmega }{\mathalpha}{capital omega, greek}% +\UnicodeMathSymbol{"003B1}{\mupalpha }{\mathalpha}{small alpha, greek}% +\UnicodeMathSymbol{"003B2}{\mupbeta }{\mathalpha}{small beta, greek}% +\UnicodeMathSymbol{"003B3}{\mupgamma }{\mathalpha}{small gamma, greek}% +\UnicodeMathSymbol{"003B4}{\mupdelta }{\mathalpha}{small delta, greek}% +\UnicodeMathSymbol{"003B5}{\mupepsilon }{\mathalpha}{rounded small epsilon, greek}% +\UnicodeMathSymbol{"003B6}{\mupzeta }{\mathalpha}{small zeta, greek}% +\UnicodeMathSymbol{"003B7}{\mupeta }{\mathalpha}{small eta, greek}% +\UnicodeMathSymbol{"003B8}{\muptheta }{\mathalpha}{straight theta, small theta, greek}% +\UnicodeMathSymbol{"003B9}{\mupiota }{\mathalpha}{small iota, greek}% +\UnicodeMathSymbol{"003BA}{\mupkappa }{\mathalpha}{small kappa, greek}% +\UnicodeMathSymbol{"003BB}{\muplambda }{\mathalpha}{small lambda, greek}% +\UnicodeMathSymbol{"003BC}{\mupmu }{\mathalpha}{small mu, greek}% +\UnicodeMathSymbol{"003BD}{\mupnu }{\mathalpha}{small nu, greek}% +\UnicodeMathSymbol{"003BE}{\mupxi }{\mathalpha}{small xi, greek}% +\UnicodeMathSymbol{"003BF}{\mupomicron }{\mathalpha}{small omicron, greek}% +\UnicodeMathSymbol{"003C0}{\muppi }{\mathalpha}{small pi, greek}% +\UnicodeMathSymbol{"003C1}{\muprho }{\mathalpha}{small rho, greek}% +\UnicodeMathSymbol{"003C2}{\mupvarsigma }{\mathalpha}{terminal sigma, greek}% +\UnicodeMathSymbol{"003C3}{\mupsigma }{\mathalpha}{small sigma, greek}% +\UnicodeMathSymbol{"003C4}{\muptau }{\mathalpha}{small tau, greek}% +\UnicodeMathSymbol{"003C5}{\mupupsilon }{\mathalpha}{small upsilon, greek}% +\UnicodeMathSymbol{"003C6}{\mupvarphi }{\mathalpha}{curly or open small phi, greek}% +\UnicodeMathSymbol{"003C7}{\mupchi }{\mathalpha}{small chi, greek}% +\UnicodeMathSymbol{"003C8}{\muppsi }{\mathalpha}{small psi, greek}% +\UnicodeMathSymbol{"003C9}{\mupomega }{\mathalpha}{small omega, greek}% +\UnicodeMathSymbol{"003D0}{\mupvarbeta }{\mathalpha}{rounded small beta, greek}% +\UnicodeMathSymbol{"003D1}{\mupvartheta }{\mathalpha}{/vartheta - curly or open theta}% +\UnicodeMathSymbol{"003D5}{\mupphi }{\mathalpha}{/straightphi - small phi, greek}% +\UnicodeMathSymbol{"003D6}{\mupvarpi }{\mathalpha}{rounded small pi (pomega), greek}% \UnicodeMathSymbol{"003D8}{\upoldKoppa }{\mathord}{greek letter archaic koppa}% \UnicodeMathSymbol{"003D9}{\upoldkoppa }{\mathord}{greek small letter archaic koppa}% \UnicodeMathSymbol{"003DA}{\upStigma }{\mathalpha}{capital stigma}% @@ -113,10 +116,10 @@ \UnicodeMathSymbol{"003DF}{\upkoppa }{\mathalpha}{greek small letter koppa}% \UnicodeMathSymbol{"003E0}{\upSampi }{\mathalpha}{capital sampi}% \UnicodeMathSymbol{"003E1}{\upsampi }{\mathalpha}{greek small letter sampi}% -\UnicodeMathSymbol{"003F0}{\upvarkappa }{\mathalpha}{rounded small kappa, greek}% -\UnicodeMathSymbol{"003F1}{\upvarrho }{\mathalpha}{rounded small rho, greek}% -\UnicodeMathSymbol{"003F4}{\upvarTheta }{\mathalpha}{greek capital theta symbol}% -\UnicodeMathSymbol{"003F5}{\upvarepsilon }{\mathalpha}{greek lunate epsilon symbol}% +\UnicodeMathSymbol{"003F0}{\mupvarkappa }{\mathalpha}{rounded small kappa, greek}% +\UnicodeMathSymbol{"003F1}{\mupvarrho }{\mathalpha}{rounded small rho, greek}% +\UnicodeMathSymbol{"003F4}{\mupvarTheta }{\mathalpha}{greek capital theta symbol}% +\UnicodeMathSymbol{"003F5}{\mupvarepsilon }{\mathalpha}{greek lunate epsilon symbol}% \UnicodeMathSymbol{"003F6}{\upbackepsilon }{\mathord}{greek reversed lunate epsilon symbol}% \UnicodeMathSymbol{"02015}{\horizbar }{\mathord}{horizontal bar}% \UnicodeMathSymbol{"02016}{\Vert }{\mathfence}{double vertical bar}% @@ -144,22 +147,23 @@ \UnicodeMathSymbol{"020D0}{\leftharpoonaccent }{\mathaccent}{combining left harpoon above}% \UnicodeMathSymbol{"020D1}{\rightharpoonaccent }{\mathaccent}{combining right harpoon above}% \UnicodeMathSymbol{"020D2}{\vertoverlay }{\mathaccent}{combining long vertical line overlay}% -\UnicodeMathSymbol{"020D6}{\overleftarrow }{\mathaccent}{combining left arrow above}% +\UnicodeMathSymbol{"020D6}{\overleftarrow }{\mathaccentwide}{combining left arrow above}% +\UnicodeMathSymbol{"020D7}{\overrightarrow }{\mathaccentwide}{combining left arrow above}% \UnicodeMathSymbol{"020D7}{\vec }{\mathaccent}{combining right arrow above}% \UnicodeMathSymbol{"020DB}{\dddot }{\mathaccent}{combining three dots above}% \UnicodeMathSymbol{"020DC}{\ddddot }{\mathaccent}{combining four dots above}% \UnicodeMathSymbol{"020DD}{\enclosecircle }{\mathord}{combining enclosing circle}% \UnicodeMathSymbol{"020DE}{\enclosesquare }{\mathord}{combining enclosing square}% \UnicodeMathSymbol{"020DF}{\enclosediamond }{\mathord}{combining enclosing diamond}% -\UnicodeMathSymbol{"020E1}{\overleftrightarrow }{\mathaccent}{combining left right arrow above}% +\UnicodeMathSymbol{"020E1}{\overleftrightarrow }{\mathaccentwide}{combining left right arrow above}% \UnicodeMathSymbol{"020E4}{\enclosetriangle }{\mathord}{combining enclosing upward pointing triangle}% \UnicodeMathSymbol{"020E7}{\annuity }{\mathaccent}{combining annuity symbol}% \UnicodeMathSymbol{"020E8}{\threeunderdot }{\mathbotaccent}{combining triple underdot}% \UnicodeMathSymbol{"020E9}{\widebridgeabove }{\mathaccent}{combining wide bridge above}% -\UnicodeMathSymbol{"020EC}{\underrightharpoondown }{\mathbotaccent}{combining rightwards harpoon with barb downwards}% -\UnicodeMathSymbol{"020ED}{\underleftharpoondown }{\mathbotaccent}{combining leftwards harpoon with barb downwards}% -\UnicodeMathSymbol{"020EE}{\underleftarrow }{\mathbotaccent}{combining left arrow below}% -\UnicodeMathSymbol{"020EF}{\underrightarrow }{\mathbotaccent}{combining right arrow below}% +\UnicodeMathSymbol{"020EC}{\underrightharpoondown }{\mathbotaccentwide}{combining rightwards harpoon with barb downwards}% +\UnicodeMathSymbol{"020ED}{\underleftharpoondown }{\mathbotaccentwide}{combining leftwards harpoon with barb downwards}% +\UnicodeMathSymbol{"020EE}{\underleftarrow }{\mathbotaccentwide}{combining left arrow below}% +\UnicodeMathSymbol{"020EF}{\underrightarrow }{\mathbotaccentwide}{combining right arrow below}% \UnicodeMathSymbol{"020F0}{\asteraccent }{\mathaccent}{combining asterisk above}% \UnicodeMathSymbol{"02102}{\BbbC }{\mathalpha}{/bbb c, open face c}% \UnicodeMathSymbol{"02107}{\Eulerconst }{\mathord}{euler constant}% @@ -877,8 +881,8 @@ \UnicodeMathSymbol{"0290C}{\leftbkarrow }{\mathrel}{leftwards double dash arrow}% \UnicodeMathSymbol{"0290D}{\rightbkarrow }{\mathrel}{rightwards double dash arrow}% \UnicodeMathSymbol{"0290E}{\leftdbkarrow }{\mathrel}{leftwards triple dash arrow}% -\UnicodeMathSymbol{"0290F}{\dbkarow }{\mathrel}{rightwards triple dash arrow}% -\UnicodeMathSymbol{"02910}{\drbkarow }{\mathrel}{rightwards two-headed triple dash arrow}% +\UnicodeMathSymbol{"0290F}{\dbkarrow }{\mathrel}{rightwards triple dash arrow}% +\UnicodeMathSymbol{"02910}{\drbkarrow }{\mathrel}{rightwards two-headed triple dash arrow}% \UnicodeMathSymbol{"02911}{\rightdotarrow }{\mathrel}{rightwards arrow with dotted stem}% \UnicodeMathSymbol{"02912}{\baruparrow }{\mathrel}{upwards arrow to bar}% \UnicodeMathSymbol{"02913}{\downarrowbar }{\mathrel}{downwards arrow to bar}% @@ -899,8 +903,8 @@ \UnicodeMathSymbol{"02922}{\neswarrow }{\mathrel}{north east and south west arrow}% \UnicodeMathSymbol{"02923}{\hknwarrow }{\mathrel}{north west arrow with hook}% \UnicodeMathSymbol{"02924}{\hknearrow }{\mathrel}{north east arrow with hook}% -\UnicodeMathSymbol{"02925}{\hksearow }{\mathrel}{south east arrow with hook}% -\UnicodeMathSymbol{"02926}{\hkswarow }{\mathrel}{south west arrow with hook}% +\UnicodeMathSymbol{"02925}{\hksearrow }{\mathrel}{south east arrow with hook}% +\UnicodeMathSymbol{"02926}{\hkswarrow }{\mathrel}{south west arrow with hook}% \UnicodeMathSymbol{"02927}{\tona }{\mathrel}{north west arrow and north east arrow}% \UnicodeMathSymbol{"02928}{\toea }{\mathrel}{north east arrow and south east arrow}% \UnicodeMathSymbol{"02929}{\tosa }{\mathrel}{south east arrow and south west arrow}% @@ -1439,10 +1443,6 @@ \UnicodeMathSymbol{"02B53}{\rightpentagonblack }{\mathord}{black right-pointing pentagon}% \UnicodeMathSymbol{"02B54}{\rightpentagon }{\mathord}{white right-pointing pentagon}% \UnicodeMathSymbol{"03012}{\postalmark }{\mathord}{postal mark}% -\UnicodeMathSymbol{"03014}{\lbrbrak }{\mathopen}{left broken bracket}% -\UnicodeMathSymbol{"03015}{\rbrbrak }{\mathclose}{right broken bracket}% -\UnicodeMathSymbol{"03018}{\Lbrbrak }{\mathopen}{left white tortoise shell bracket}% -\UnicodeMathSymbol{"03019}{\Rbrbrak }{\mathclose}{right white tortoise shell bracket}% \UnicodeMathSymbol{"03030}{\hzigzag }{\mathord}{zigzag}% \UnicodeMathSymbol{"1D400}{\mbfA }{\mathalpha}{mathematical bold capital a}% \UnicodeMathSymbol{"1D401}{\mbfB }{\mathalpha}{mathematical bold capital b}% 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 ae66336f6df..72c9dc0878a 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math-xetex.sty @@ -5,9 +5,10 @@ %% The original source files were: %% %% unicode-math.dtx (with options: `package,XE') -%% Copyright 2006-2013 Will Robertson <will.robertson@latex-project.org> +%% unicode-math-compat.dtx (with options: `compat,XE') +%% Copyright 2006-2015 Will Robertson <will.robertson@latex-project.org> %% Copyright 2010-2013 Philipp Stephani <st_philipp@yahoo.de> -%% Copyright 2012-2013 Khaled Hosny <khaledhosny@eglug.org> +%% Copyright 2012-2015 Khaled Hosny <khaledhosny@eglug.org> %% %% This package is free software and may be redistributed and/or modified under %% the conditions of the LaTeX Project Public License, version 1.3c or higher @@ -15,245 +16,10 @@ %% %% This work is "maintained" by Will Robertson. \ExplSyntaxOn -\cs_new:Nn \usv_set:nnn - { - \tl_set:cn { \um_to_usv:nn {#1}{#2} } {#3} - } -\cs_new:Nn \um_to_usv:nn { g_um_#1_#2_usv } -\usv_set:nnn {up} {num} {48} -\usv_set:nnn {up} {Latin}{65} -\usv_set:nnn {up} {latin}{97} -\usv_set:nnn {up} {Greek}{"391} -\usv_set:nnn {up} {greek}{"3B1} -\usv_set:nnn {it} {Latin}{"1D434} -\usv_set:nnn {it} {latin}{"1D44E} -\usv_set:nnn {it} {Greek}{"1D6E2} -\usv_set:nnn {it} {greek}{"1D6FC} -\usv_set:nnn {bb} {num} {"1D7D8} -\usv_set:nnn {bb} {Latin}{"1D538} -\usv_set:nnn {bb} {latin}{"1D552} -\usv_set:nnn {scr} {Latin}{"1D49C} -\usv_set:nnn {cal} {Latin}{"1D49C} -\usv_set:nnn {scr} {latin}{"1D4B6} -\usv_set:nnn {frak}{Latin}{"1D504} -\usv_set:nnn {frak}{latin}{"1D51E} -\usv_set:nnn {sf} {num} {"1D7E2} -\usv_set:nnn {sfup}{num} {"1D7E2} -\usv_set:nnn {sfit}{num} {"1D7E2} -\usv_set:nnn {sfup}{Latin}{"1D5A0} -\usv_set:nnn {sf} {Latin}{"1D5A0} -\usv_set:nnn {sfup}{latin}{"1D5BA} -\usv_set:nnn {sf} {latin}{"1D5BA} -\usv_set:nnn {sfit}{Latin}{"1D608} -\usv_set:nnn {sfit}{latin}{"1D622} -\usv_set:nnn {tt} {num} {"1D7F6} -\usv_set:nnn {tt} {Latin}{"1D670} -\usv_set:nnn {tt} {latin}{"1D68A} -\usv_set:nnn {bf} {num} {"1D7CE} -\usv_set:nnn {bfup} {num} {"1D7CE} -\usv_set:nnn {bfit} {num} {"1D7CE} -\usv_set:nnn {bfup} {Latin}{"1D400} -\usv_set:nnn {bfup} {latin}{"1D41A} -\usv_set:nnn {bfup} {Greek}{"1D6A8} -\usv_set:nnn {bfup} {greek}{"1D6C2} -\usv_set:nnn {bfit} {Latin}{"1D468} -\usv_set:nnn {bfit} {latin}{"1D482} -\usv_set:nnn {bfit} {Greek}{"1D71C} -\usv_set:nnn {bfit} {greek}{"1D736} -\usv_set:nnn {bffrak}{Latin}{"1D56C} -\usv_set:nnn {bffrak}{latin}{"1D586} -\usv_set:nnn {bfscr} {Latin}{"1D4D0} -\usv_set:nnn {bfcal} {Latin}{"1D4D0} -\usv_set:nnn {bfscr} {latin}{"1D4EA} -\usv_set:nnn {bfsf} {num} {"1D7EC} -\usv_set:nnn {bfsfup}{num} {"1D7EC} -\usv_set:nnn {bfsfit}{num} {"1D7EC} -\usv_set:nnn {bfsfup}{Latin}{"1D5D4} -\usv_set:nnn {bfsfup}{latin}{"1D5EE} -\usv_set:nnn {bfsfup}{Greek}{"1D756} -\usv_set:nnn {bfsfup}{greek}{"1D770} -\usv_set:nnn {bfsfit}{Latin}{"1D63C} -\usv_set:nnn {bfsfit}{latin}{"1D656} -\usv_set:nnn {bfsfit}{Greek}{"1D790} -\usv_set:nnn {bfsfit}{greek}{"1D7AA} -\usv_set:nnn {bfsf}{Latin}{ \bool_if:NTF \g_um_upLatin_bool \g_um_bfsfup_Latin_usv \g_um_bfsfit_Latin_usv } -\usv_set:nnn {bfsf}{latin}{ \bool_if:NTF \g_um_uplatin_bool \g_um_bfsfup_latin_usv \g_um_bfsfit_latin_usv } -\usv_set:nnn {bfsf}{Greek}{ \bool_if:NTF \g_um_upGreek_bool \g_um_bfsfup_Greek_usv \g_um_bfsfit_Greek_usv } -\usv_set:nnn {bfsf}{greek}{ \bool_if:NTF \g_um_upgreek_bool \g_um_bfsfup_greek_usv \g_um_bfsfit_greek_usv } -\usv_set:nnn {bf} {Latin}{ \bool_if:NTF \g_um_bfupLatin_bool \g_um_bfup_Latin_usv \g_um_bfit_Latin_usv } -\usv_set:nnn {bf} {latin}{ \bool_if:NTF \g_um_bfuplatin_bool \g_um_bfup_latin_usv \g_um_bfit_latin_usv } -\usv_set:nnn {bf} {Greek}{ \bool_if:NTF \g_um_bfupGreek_bool \g_um_bfup_Greek_usv \g_um_bfit_Greek_usv } -\usv_set:nnn {bf} {greek}{ \bool_if:NTF \g_um_bfupgreek_bool \g_um_bfup_greek_usv \g_um_bfit_greek_usv } -\usv_set:nnn {up}{varTheta} {"3F4} -\usv_set:nnn {up}{Digamma} {"3DC} -\usv_set:nnn {up}{varepsilon}{"3F5} -\usv_set:nnn {up}{vartheta} {"3D1} -\usv_set:nnn {up}{varkappa} {"3F0} -\usv_set:nnn {up}{varphi} {"3D5} -\usv_set:nnn {up}{varrho} {"3F1} -\usv_set:nnn {up}{varpi} {"3D6} -\usv_set:nnn {up}{digamma} {"3DD} -\usv_set:nnn {bfup}{varTheta} {"1D6B9} -\usv_set:nnn {bfup}{Digamma} {"1D7CA} -\usv_set:nnn {bfup}{varepsilon}{"1D6DC} -\usv_set:nnn {bfup}{vartheta} {"1D6DD} -\usv_set:nnn {bfup}{varkappa} {"1D6DE} -\usv_set:nnn {bfup}{varphi} {"1D6DF} -\usv_set:nnn {bfup}{varrho} {"1D6E0} -\usv_set:nnn {bfup}{varpi} {"1D6E1} -\usv_set:nnn {bfup}{digamma} {"1D7CB} -\usv_set:nnn {it}{varTheta} {"1D6F3} -\usv_set:nnn {it}{varepsilon}{"1D716} -\usv_set:nnn {it}{vartheta} {"1D717} -\usv_set:nnn {it}{varkappa} {"1D718} -\usv_set:nnn {it}{varphi} {"1D719} -\usv_set:nnn {it}{varrho} {"1D71A} -\usv_set:nnn {it}{varpi} {"1D71B} -\usv_set:nnn {bfit}{varTheta} {"1D72D} -\usv_set:nnn {bfit}{varepsilon}{"1D750} -\usv_set:nnn {bfit}{vartheta} {"1D751} -\usv_set:nnn {bfit}{varkappa} {"1D752} -\usv_set:nnn {bfit}{varphi} {"1D753} -\usv_set:nnn {bfit}{varrho} {"1D754} -\usv_set:nnn {bfit}{varpi} {"1D755} -\usv_set:nnn {bfsfup}{varTheta} {"1D767} -\usv_set:nnn {bfsfup}{varepsilon}{"1D78A} -\usv_set:nnn {bfsfup}{vartheta} {"1D78B} -\usv_set:nnn {bfsfup}{varkappa} {"1D78C} -\usv_set:nnn {bfsfup}{varphi} {"1D78D} -\usv_set:nnn {bfsfup}{varrho} {"1D78E} -\usv_set:nnn {bfsfup}{varpi} {"1D78F} -\usv_set:nnn {bfsfit}{varTheta} {"1D7A1} -\usv_set:nnn {bfsfit}{varepsilon}{"1D7C4} -\usv_set:nnn {bfsfit}{vartheta} {"1D7C5} -\usv_set:nnn {bfsfit}{varkappa} {"1D7C6} -\usv_set:nnn {bfsfit}{varphi} {"1D7C7} -\usv_set:nnn {bfsfit}{varrho} {"1D7C8} -\usv_set:nnn {bfsfit}{varpi} {"1D7C9} -\usv_set:nnn {up} {Nabla}{"02207} -\usv_set:nnn {it} {Nabla}{"1D6FB} -\usv_set:nnn {bfup} {Nabla}{"1D6C1} -\usv_set:nnn {bfit} {Nabla}{"1D735} -\usv_set:nnn {bfsfup}{Nabla}{"1D76F} -\usv_set:nnn {bfsfit}{Nabla}{"1D7A9} -\usv_set:nnn {up} {partial}{"02202} -\usv_set:nnn {it} {partial}{"1D715} -\usv_set:nnn {bfup} {partial}{"1D6DB} -\usv_set:nnn {bfit} {partial}{"1D74F} -\usv_set:nnn {bfsfup}{partial}{"1D789} -\usv_set:nnn {bfsfit}{partial}{"1D7C3} -\usv_set:nnn {up}{B}{`\B} -\usv_set:nnn {up}{C}{`\C} -\usv_set:nnn {up}{D}{`\D} -\usv_set:nnn {up}{E}{`\E} -\usv_set:nnn {up}{F}{`\F} -\usv_set:nnn {up}{H}{`\H} -\usv_set:nnn {up}{I}{`\I} -\usv_set:nnn {up}{L}{`\L} -\usv_set:nnn {up}{M}{`\M} -\usv_set:nnn {up}{N}{`\N} -\usv_set:nnn {up}{P}{`\P} -\usv_set:nnn {up}{Q}{`\Q} -\usv_set:nnn {up}{R}{`\R} -\usv_set:nnn {up}{Z}{`\Z} -\usv_set:nnn {it}{B}{"1D435} -\usv_set:nnn {it}{C}{"1D436} -\usv_set:nnn {it}{D}{"1D437} -\usv_set:nnn {it}{E}{"1D438} -\usv_set:nnn {it}{F}{"1D439} -\usv_set:nnn {it}{H}{"1D43B} -\usv_set:nnn {it}{I}{"1D43C} -\usv_set:nnn {it}{L}{"1D43F} -\usv_set:nnn {it}{M}{"1D440} -\usv_set:nnn {it}{N}{"1D441} -\usv_set:nnn {it}{P}{"1D443} -\usv_set:nnn {it}{Q}{"1D444} -\usv_set:nnn {it}{R}{"1D445} -\usv_set:nnn {it}{Z}{"1D44D} -\usv_set:nnn {up}{d}{`\d} -\usv_set:nnn {up}{e}{`\e} -\usv_set:nnn {up}{g}{`\g} -\usv_set:nnn {up}{h}{`\h} -\usv_set:nnn {up}{i}{`\i} -\usv_set:nnn {up}{j}{`\j} -\usv_set:nnn {up}{o}{`\o} -\usv_set:nnn {it}{d}{"1D451} -\usv_set:nnn {it}{e}{"1D452} -\usv_set:nnn {it}{g}{"1D454} -\usv_set:nnn {it}{h}{"0210E} -\usv_set:nnn {it}{i}{"1D456} -\usv_set:nnn {it}{j}{"1D457} -\usv_set:nnn {it}{o}{"1D45C} -\usv_set:nnn {bb} {h}{"1D559} -\usv_set:nnn {tt} {h}{"1D691} -\usv_set:nnn {scr} {h}{"1D4BD} -\usv_set:nnn {frak} {h}{"1D525} -\usv_set:nnn {bfup} {h}{"1D421} -\usv_set:nnn {bfit} {h}{"1D489} -\usv_set:nnn {sfup} {h}{"1D5C1} -\usv_set:nnn {sfit} {h}{"1D629} -\usv_set:nnn {bffrak}{h}{"1D58D} -\usv_set:nnn {bfscr} {h}{"1D4F1} -\usv_set:nnn {bfsfup}{h}{"1D5F5} -\usv_set:nnn {bfsfit}{h}{"1D65D} -\usv_set:nnn {up}{dotlessi}{"00131} -\usv_set:nnn {up}{dotlessj}{"00237} -\usv_set:nnn {it}{dotlessi}{"1D6A4} -\usv_set:nnn {it}{dotlessj}{"1D6A5} -\usv_set:nnn {bb}{C}{"2102} -\usv_set:nnn {bb}{H}{"210D} -\usv_set:nnn {bb}{N}{"2115} -\usv_set:nnn {bb}{P}{"2119} -\usv_set:nnn {bb}{Q}{"211A} -\usv_set:nnn {bb}{R}{"211D} -\usv_set:nnn {bb}{Z}{"2124} -\usv_set:nnn {up}{Pi} {"003A0} -\usv_set:nnn {up}{pi} {"003C0} -\usv_set:nnn {up}{Gamma} {"00393} -\usv_set:nnn {up}{gamma} {"003B3} -\usv_set:nnn {up}{summation}{"02211} -\usv_set:nnn {it}{Pi} {"1D6F1} -\usv_set:nnn {it}{pi} {"1D70B} -\usv_set:nnn {it}{Gamma} {"1D6E4} -\usv_set:nnn {it}{gamma} {"1D6FE} -\usv_set:nnn {bb}{Pi} {"0213F} -\usv_set:nnn {bb}{pi} {"0213C} -\usv_set:nnn {bb}{Gamma} {"0213E} -\usv_set:nnn {bb}{gamma} {"0213D} -\usv_set:nnn {bb}{summation}{"02140} -\usv_set:nnn {bbit}{D}{"2145} -\usv_set:nnn {bbit}{d}{"2146} -\usv_set:nnn {bbit}{e}{"2147} -\usv_set:nnn {bbit}{i}{"2148} -\usv_set:nnn {bbit}{j}{"2149} -\usv_set:nnn {scr}{B}{"212C} -\usv_set:nnn {scr}{E}{"2130} -\usv_set:nnn {scr}{F}{"2131} -\usv_set:nnn {scr}{H}{"210B} -\usv_set:nnn {scr}{I}{"2110} -\usv_set:nnn {scr}{L}{"2112} -\usv_set:nnn {scr}{M}{"2133} -\usv_set:nnn {scr}{R}{"211B} -\usv_set:nnn {scr}{e}{"212F} -\usv_set:nnn {scr}{g}{"210A} -\usv_set:nnn {scr}{o}{"2134} -\usv_set:nnn {cal}{B}{"212C} -\usv_set:nnn {cal}{E}{"2130} -\usv_set:nnn {cal}{F}{"2131} -\usv_set:nnn {cal}{H}{"210B} -\usv_set:nnn {cal}{I}{"2110} -\usv_set:nnn {cal}{L}{"2112} -\usv_set:nnn {cal}{M}{"2133} -\usv_set:nnn {cal}{R}{"211B} -\usv_set:nnn {frak}{C}{"212D} -\usv_set:nnn {frak}{H}{"210C} -\usv_set:nnn {frak}{I}{"2111} -\usv_set:nnn {frak}{R}{"211C} -\usv_set:nnn {frak}{Z}{"2128} \tl_map_inline:nn { \new@mathgroup\cdp@list\cdp@elt\DeclareMathSizes - \@DeclareMathSizes\newmathalphabet\newmathalphabet@@\newmathalphabet@@@ + \@DeclareMathSizes\newmathalphabet\newmathalphabet__um\newmathalphabet__um@ \DeclareMathVersion\define@mathalphabet\define@mathgroup\addtoversion \version@list\version@elt\alpha@list\alpha@elt \restore@mathversion\init@restore@version\dorestore@version\process@table @@ -263,223 +29,355 @@ \DeclareMathAccent\set@mathaccent\DeclareMathSymbol\set@mathchar \set@mathsymbol\DeclareMathDelimiter\@xxDeclareMathDelimiter \@DeclareMathDelimiter\@xDeclareMathDelimiter\set@mathdelimiter - \set@@mathdelimiter\DeclareMathRadical\mathchar@type + \set__ummathdelimiter\DeclareMathRadical\mathchar@type \DeclareSymbolFontAlphabet\DeclareSymbolFontAlphabet@ } { \tl_remove_once:Nn \@preamblecmds {\do#1} } -\def\new@mathgroup{\alloc@8\mathgroup\chardef\@cclvi} -\let\newfam\new@mathgroup -\cs_set:Nn \um_set_mathsymbol:nNNn +\cs_set:Nn \__um_set_mathsymbol:nNNn { - \tl_case:Nnn #3 { - \mathop { \um_set_big_operator:nnn {#1} {#2} {#4} } - \mathopen { \um_set_math_open:nnn {#1} {#2} {#4} } - \mathclose { \um_set_math_close:nnn {#1} {#2} {#4} } - \mathfence { \um_set_math_fence:nnnn {#1} {#2} {#3} {#4} } + \int_compare:nT { \char_value_catcode:n {#4} == 11 } + { \char_set_catcode_other:n {#4} } + + \tl_case:Nn #3 + { + \mathord { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathalpha { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathbin { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathrel { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathpunct { \__um_set_mathcode:nnn {#4} {#3} {#1} } + \mathop { \__um_set_big_operator:nnn {#1} {#2} {#4} } + \mathopen { \__um_set_math_open:nnn {#1} {#2} {#4} } + \mathclose { \__um_set_math_close:nnn {#1} {#2} {#4} } + \mathfence { \__um_set_math_fence:nnnn {#1} {#2} {#3} {#4} } \mathaccent - { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {fixed} {#1} {#4} } } + { \__um_set_math_accent:Nnnn #2 {fixed} {#1} {#4} } \mathbotaccent - { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {bottom~ fixed} {#1} {#4} } } + { \__um_set_math_accent:Nnnn #2 {bottom~ fixed} {#1} {#4} } + \mathaccentwide + { \__um_set_math_accent:Nnnn #2 {} {#1} {#4} } + \mathbotaccentwide + { \__um_set_math_accent:Nnnn #2 {bottom} {#1} {#4} } \mathover - { - \cs_set_protected_nopar:Npx #2 ##1 - { \mathop { \um_accent:nnn {} {#1} {#4} {##1} } \limits } - } + { \__um_set_math_overunder:Nnnn #2 {} {#1} {#4} } \mathunder - { - \cs_set_protected_nopar:Npx #2 ##1 - { \mathop { \um_accent:nnn {bottom} {#1} {#4} {##1} } \limits } - } - }{ - \um_set_mathcode:nnn {#4} {#3} {#1} - } + { \__um_set_math_overunder:Nnnn #2 {bottom} {#1} {#4} } + } } \edef\mathfence{\string\mathfence} \edef\mathover{\string\mathover} \edef\mathunder{\string\mathunder} \edef\mathbotaccent{\string\mathbotaccent} -\cs_new:Nn \um_set_big_operator:nnn +\edef\mathaccentwide{\string\mathaccentwide} +\edef\mathbotaccentwide{\string\mathbotaccentwide} +\cs_new:Nn \__um_set_big_operator:nnn { \group_begin: \char_set_catcode_active:n {#3} - \char_gmake_mathactive:n {#3} - \um_active_char_set:wc #3 \q_nil { \cs_to_str:N #2 _sym } + \__um_char_gmake_mathactive:n {#3} + \__um_active_char_set:wc #3 \q_nil { \cs_to_str:N #2 _sym } \group_end: - \um_set_mathchar:cNnn {\cs_to_str:N #2 op} \mathop {#1} {#3} + + \__um_set_mathchar:cNnn {\cs_to_str:N #2 op} \mathop {#1} {#3} + \cs_gset:cpx { \cs_to_str:N #2 _sym } { \exp_not:c { \cs_to_str:N #2 op } - \exp_not:n { \tl_if_in:NnT \l_um_nolimits_tl {#2} \nolimits } + \exp_not:n { \tl_if_in:NnT \l__um_nolimits_tl {#2} \nolimits } } } -\cs_new:Nn \um_set_math_open:nnn +\cs_new:Nn \__um_set_math_open:nnn { - \tl_if_in:NnTF \l_um_radicals_tl {#2} + \tl_if_in:NnTF \l__um_radicals_tl {#2} { \cs_gset_protected_nopar:cpx {\cs_to_str:N #2 sign} - { \um_radical:nn {#1} {#3} } - \tl_set:cn {l_um_radical_\cs_to_str:N #2_tl} {\use:c{sym #1}~ #3} + { \__um_radical:nn {#1} {#3} } + \tl_set:cn {l__um_radical_\cs_to_str:N #2_tl} {\use:c{sym #1}~ #3} } { - \um_set_delcode:nnn {#1} {#3} {#3} - \um_set_mathcode:nnn {#3} \mathopen {#1} + \__um_set_delcode:nnn {#1} {#3} {#3} + \__um_set_mathcode:nnn {#3} \mathopen {#1} \cs_gset_protected_nopar:Npx #2 - { \um_delimiter:Nnn \mathopen {#1} {#3} } + { \__um_delimiter:Nnn \mathopen {#1} {#3} } } } -\cs_new:Nn \um_set_math_close:nnn +\cs_new:Nn \__um_set_math_close:nnn { - \um_set_delcode:nnn {#1} {#3} {#3} - \um_set_mathcode:nnn {#3} \mathclose {#1} + \__um_set_delcode:nnn {#1} {#3} {#3} + \__um_set_mathcode:nnn {#3} \mathclose {#1} \cs_gset_protected_nopar:Npx #2 - { \um_delimiter:Nnn \mathclose {#1} {#3} } + { \__um_delimiter:Nnn \mathclose {#1} {#3} } } -\cs_new:Nn \um_set_math_fence:nnnn +\cs_new:Nn \__um_set_math_fence:nnnn { - \um_set_mathcode:nnn {#4} {#3} {#1} - \um_set_delcode:nnn {#1} {#4} {#4} + \__um_set_mathcode:nnn {#4} {#3} {#1} + \__um_set_delcode:nnn {#1} {#4} {#4} \cs_gset_protected_nopar:cpx {l \cs_to_str:N #2} - { \um_delimiter:Nnn \mathopen {#1} {#4} } + { \__um_delimiter:Nnn \mathopen {#1} {#4} } \cs_gset_protected_nopar:cpx {r \cs_to_str:N #2} - { \um_delimiter:Nnn \mathclose {#1} {#4} } + { \__um_delimiter:Nnn \mathclose {#1} {#4} } + } +\cs_new:Nn \__um_set_math_accent:Nnnn + { + \cs_gset_protected_nopar:Npx #1 + { \__um_accent:nnn {#2} {#3} {#4} } + } +\cs_new:Nn \__um_set_math_overunder:Nnnn + { + \cs_gset_protected_nopar:Npx #1 ##1 + { + \mathop + { \__um_accent:nnn {#2} {#3} {#4} {##1} } + \limits + } + } +\keys_define:nn {__um_mathface} + { + version .code:n = + { \tl_set:Nn \l__um_mversion_tl {#1} } + } + +\DeclareDocumentCommand \setmathfontface { m O{} m O{} } + { + \tl_clear:N \l__um_mversion_tl + + \keys_set_known:nnN {__um_mathface} {#2,#4} \l__um_keyval_clist + \exp_args:Nnx \fontspec_set_family:Nxn \l__um_tmpa_tl + { ItalicFont={}, BoldFont={}, \exp_not:V \l__um_keyval_clist } {#3} + + \tl_if_empty:NT \l__um_mversion_tl + { + \tl_set:Nn \l__um_mversion_tl {normal} + \DeclareMathAlphabet #1 {\g_fontspec_encoding_tl} {\l__um_tmpa_tl} {\mddefault} {\updefault} + } + \SetMathAlphabet #1 {\l__um_mversion_tl} {\g_fontspec_encoding_tl} {\l__um_tmpa_tl} {\mddefault} {\updefault} + + % integrate with fontspec's \setmathrm etc: + \tl_case:Nn #1 + { + \mathrm { \cs_set_eq:NN \g__fontspec_mathrm_tl \l__um_tmpa_tl } + \mathsf { \cs_set_eq:NN \g__fontspec_mathsf_tl \l__um_tmpa_tl } + \mathtt { \cs_set_eq:NN \g__fontspec_mathtt_tl \l__um_tmpa_tl } + } + } + +\@onlypreamble \setmathfontface +\DeclareDocumentCommand \setoperatorfont {m} + { \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} + \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} + \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} + \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 } -\DeclareDocumentCommand \setmathfont { O{} m } { - \tl_set:Nn \l_um_fontname_tl {#2} - \um_init: +\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{} } + { + \tl_set:Nn \l__um_fontname_tl {#2} + \__um_init: \cs_if_exist:cF { S@ \f@size } { \calculate@math@sizes } \csname S@\f@size\endcsname - \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: - \cs_if_exist:cF { sym \um_symfont_tl } + \keys_set_known:nnN {unicode-math} {#1,#3} \l__um_unknown_keys_clist + \bool_if:NT \l__um_init_bool { \__um_log:n {default-math-font} } + + \csname TIC\endcsname + \__um_fontspec_select_font: + \csname TOC\endcsname + \bool_if:nT { \l__um_ot_math_bool && !\g__um_mainfont_already_set_bool } + { + \__um_declare_math_sizes: + \__um_fontspec_select_font: + } + \cs_if_exist:cF { sym \__um_symfont_tl } { - \DeclareSymbolFont{\um_symfont_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + \DeclareSymbolFont{\__um_symfont_tl} + {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} } - \SetSymbolFont{\um_symfont_tl}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \SetSymbolFont{\__um_symfont_tl}{\l__um_mversion_tl} + {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} + \tl_set:Nn \l__um_tmpa_tl {normal} + \tl_if_eq:NNT \l__um_mversion_tl \l__um_tmpa_tl { - \SetSymbolFont{\um_symfont_tl}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + \SetSymbolFont{\__um_symfont_tl}{bold} + {\encodingdefault}{\l__um_family_tl}{\bfdefault}{\updefault} } - \bool_if:nT { \l_um_ot_math_bool && !\g_um_mainfont_already_set_bool } - { - \bool_set_true:N \g_um_mainfont_already_set_bool - \um_declare_math_sizes: - \um_setup_legacy_fam_two: - \um_setup_legacy_fam_three: - } - \um_input_math_symbol_table: - \um_remap_symbols: - \um_setup_mathactives: - \um_setup_accents: - \um_setup_delcodes: - \um_setup_alphabets: - \um_setup_negations: + \bool_if:nT { \l__um_ot_math_bool && !\g__um_mainfont_already_set_bool } + { + \bool_set_true:N \g__um_mainfont_already_set_bool + \__um_setup_legacy_fam_two: + \__um_setup_legacy_fam_three: + } + \csname TIC\endcsname + \__um_input_math_symbol_table: + \csname TOC\endcsname + \__um_remap_symbols: + \__um_setup_mathactives: + \__um_setup_delcodes: + \csname TIC\endcsname + \__um_setup_alphabets: + \csname TOC\endcsname + \__um_setup_negations: \ignorespaces -} + } \cs_set_eq:NN \resetmathfont \setmathfont -\cs_new:Nn \um_init: +\cs_new:Nn \__um_init: { - \bool_set_true:N \l_um_ot_math_bool + \bool_set_true:N \l__um_ot_math_bool \cs_set_eq:NN \glb@currsize \scan_stop: - \bool_set_true:N \l_um_init_bool - \seq_clear:N \l_um_char_range_seq - \clist_clear:N \l_um_char_num_range_clist - \seq_clear:N \l_um_mathalph_seq - \seq_clear:N \l_um_missing_alph_seq - \tl_set:Nn \l_um_mversion_tl {normal} - \tl_set:Nn \um_symfont_tl {operators} - \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_noparse:nnn - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_noparse:Nnn - \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_noparse:nnn - \cs_set_eq:NN \um_maybe_init_alphabet:n \um_init_alphabet:n - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_noparse:nn - \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_noparse:nn - \cs_set_eq:NN \um_make_mathactive:nNN \um_make_mathactive_noparse:nNN - \tl_set:Nn \l_um_script_features_tl {Style=MathScript} - \tl_set:Nn \l_um_sscript_features_tl {Style=MathScriptScript} - \tl_set_eq:NN \l_um_script_font_tl \l_um_fontname_tl - \tl_set_eq:NN \l_um_sscript_font_tl \l_um_fontname_tl - } -\cs_new:Nn \um_declare_math_sizes: + \bool_set_true:N \l__um_init_bool + \seq_clear:N \l__um_char_range_seq + \clist_clear:N \l__um_char_nrange_clist + \seq_clear:N \l__um_mathalph_seq + \seq_clear:N \l__um_missing_alph_seq + \tl_set:Nn \l__um_mversion_tl {normal} + \tl_set:Nn \__um_symfont_tl {operators} + \cs_set_eq:NN \__um_sym:nnn \__um_process_symbol_noparse:nnn + \cs_set_eq:NN \__um_set_mathalphabet_char:nnn \__um_mathmap_noparse:nnn + \cs_set_eq:NN \__um_remap_symbol:nnn \__um_remap_symbol_noparse:nnn + \cs_set_eq:NN \__um_maybe_init_alphabet:n \__um_init_alphabet:n + \cs_set_eq:NN \__um_map_char_single:nn \__um_map_char_noparse:nn + \cs_set_eq:NN \__um_assign_delcode:nn \__um_assign_delcode_noparse:nn + \cs_set_eq:NN \__um_make_mathactive:nNN \__um_make_mathactive_noparse:nNN + \tl_set:Nn \l__um_script_features_tl {Style=MathScript} + \tl_set:Nn \l__um_sscript_features_tl {Style=MathScriptScript} + \tl_set_eq:NN \l__um_script_font_tl \l__um_fontname_tl + \tl_set_eq:NN \l__um_sscript_font_tl \l__um_fontname_tl + } +\cs_new:Nn \__um_declare_math_sizes: { - \dim_compare:nF { \fontdimen 10 \l_um_font == 0pt } + \dim_compare:nF { \fontdimen 10 \l__um_font == 0pt } { \DeclareMathSizes { \f@size } { \f@size } - { \um_fontdimen_to_scale:nn {10} {\l_um_font} } - { \um_fontdimen_to_scale:nn {11} {\l_um_font} } + { \__um_fontdimen_to_scale:nn {10} {\l__um_font} } + { \__um_fontdimen_to_scale:nn {11} {\l__um_font} } } } -\cs_new:Nn \um_setup_legacy_fam_two: +\cs_new:Nn \__um_setup_legacy_fam_two: { - \fontspec_set_family:Nxn \l_um_family_tl + \fontspec_set_family:Nxn \l__um_family_tl { - \l_um_font_keyval_tl, + \l__um_font_keyval_tl, Scale=1.00001, FontAdjustment = { - \fontdimen8\font= \um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax - \fontdimen9\font= \um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax - \fontdimen10\font=\um_get_fontparam:nn {32} {StackTopShiftUp}\relax - \fontdimen11\font=\um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax - \fontdimen12\font=\um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax - \fontdimen13\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax - \fontdimen14\font=\um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax - \fontdimen15\font=\um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax - \fontdimen16\font=\um_get_fontparam:nn {18} {SubscriptShiftDown}\relax - \fontdimen17\font=\um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax - \fontdimen18\font=\um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax - \fontdimen19\font=\um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax + \fontdimen8\font= \__um_get_fontparam:nn {43} {FractionNumeratorDisplayStyleShiftUp}\relax + \fontdimen9\font= \__um_get_fontparam:nn {42} {FractionNumeratorShiftUp}\relax + \fontdimen10\font=\__um_get_fontparam:nn {32} {StackTopShiftUp}\relax + \fontdimen11\font=\__um_get_fontparam:nn {45} {FractionDenominatorDisplayStyleShiftDown}\relax + \fontdimen12\font=\__um_get_fontparam:nn {44} {FractionDenominatorShiftDown}\relax + \fontdimen13\font=\__um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen14\font=\__um_get_fontparam:nn {21} {SuperscriptShiftUp}\relax + \fontdimen15\font=\__um_get_fontparam:nn {22} {SuperscriptShiftUpCramped}\relax + \fontdimen16\font=\__um_get_fontparam:nn {18} {SubscriptShiftDown}\relax + \fontdimen17\font=\__um_get_fontparam:nn {18} {SubscriptShiftDownWithSuperscript}\relax + \fontdimen18\font=\__um_get_fontparam:nn {24} {SuperscriptBaselineDropMax}\relax + \fontdimen19\font=\__um_get_fontparam:nn {20} {SubscriptBaselineDropMin}\relax \fontdimen20\font=0pt\relax % delim1 = FractionDelimiterDisplaySize \fontdimen21\font=0pt\relax % delim2 = FractionDelimiterSize - \fontdimen22\font=\um_get_fontparam:nn {15} {AxisHeight}\relax + \fontdimen22\font=\__um_get_fontparam:nn {15} {AxisHeight}\relax } - } {\l_um_fontname_tl} - \SetSymbolFont{symbols}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + } {\l__um_fontname_tl} + \SetSymbolFont{symbols}{\l__um_mversion_tl} + {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \tl_set:Nn \l__um_tmpa_tl {normal} + \tl_if_eq:NNT \l__um_mversion_tl \l__um_tmpa_tl { \SetSymbolFont{symbols}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + {\encodingdefault}{\l__um_family_tl}{\bfdefault}{\updefault} } } -\cs_new:Nn \um_setup_legacy_fam_three: +\cs_new:Nn \__um_setup_legacy_fam_three: { - \fontspec_set_family:Nxn \l_um_family_tl + \fontspec_set_family:Nxn \l__um_family_tl { - \l_um_font_keyval_tl, + \l__um_font_keyval_tl, Scale=0.99999, FontAdjustment={ - \fontdimen8\font= \um_get_fontparam:nn {48} {FractionRuleThickness}\relax - \fontdimen9\font= \um_get_fontparam:nn {28} {UpperLimitGapMin}\relax - \fontdimen10\font=\um_get_fontparam:nn {30} {LowerLimitGapMin}\relax - \fontdimen11\font=\um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax - \fontdimen12\font=\um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax + \fontdimen8\font= \__um_get_fontparam:nn {48} {FractionRuleThickness}\relax + \fontdimen9\font= \__um_get_fontparam:nn {28} {UpperLimitGapMin}\relax + \fontdimen10\font=\__um_get_fontparam:nn {30} {LowerLimitGapMin}\relax + \fontdimen11\font=\__um_get_fontparam:nn {29} {UpperLimitBaselineRiseMin}\relax + \fontdimen12\font=\__um_get_fontparam:nn {31} {LowerLimitBaselineDropMin}\relax \fontdimen13\font=0pt\relax } - } {\l_um_fontname_tl} - \SetSymbolFont{largesymbols}{\l_um_mversion_tl} - {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + } {\l__um_fontname_tl} + \SetSymbolFont{largesymbols}{\l__um_mversion_tl} + {\encodingdefault}{\l__um_family_tl}{\mddefault}{\updefault} - \tl_set:Nn \l_um_tmpa_tl {normal} - \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + \tl_set:Nn \l__um_tmpa_tl {normal} + \tl_if_eq:NNT \l__um_mversion_tl \l__um_tmpa_tl { \SetSymbolFont{largesymbols}{bold} - {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + {\encodingdefault}{\l__um_family_tl}{\bfdefault}{\updefault} } } -\cs_new:Nn \um_get_fontparam:nn - { \the\fontdimen#1\l_um_font\relax } -\cs_new:Nn \um_fontspec_select_font: +\cs_new:Nn \__um_get_fontparam:nn + { \the\fontdimen#1\l__um_font\relax } +\cs_new:Nn \__um_fontspec_select_font: { - \tl_set:Nx \l_um_font_keyval_tl { + \tl_set:Nx \l__um_font_keyval_tl { BoldItalicFont = {}, ItalicFont = {}, Script = Math, SizeFeatures = @@ -489,131 +387,130 @@ } , { Size = \sf@size-\tf@size , - Font = \l_um_script_font_tl , - \l_um_script_features_tl + Font = \l__um_script_font_tl , + \l__um_script_features_tl } , { Size = -\sf@size , - Font = \l_um_sscript_font_tl , - \l_um_sscript_features_tl + Font = \l__um_sscript_font_tl , + \l__um_sscript_features_tl } } , - \l_um_unknown_keys_clist + \l__um_unknown_keys_clist } - \fontspec_set_fontface:NNxn \l_um_font \l_um_family_tl - {\l_um_font_keyval_tl} {\l_um_fontname_tl} + \fontspec_set_fontface:NNxn \l__um_font \l__um_family_tl + {\l__um_font_keyval_tl} {\l__um_fontname_tl} \group_begin: - \fontfamily{\l_um_family_tl}\selectfont - \fontspec_if_script:nF {math} {\bool_gset_false:N \l_um_ot_math_bool} + \fontfamily{\l__um_family_tl}\selectfont + \fontspec_if_script:nF {math} {\bool_gset_false:N \l__um_ot_math_bool} \group_end: } -\cs_set:Nn \um_process_symbol_noparse:nnn +\cs_set:Nn \__um_process_symbol_noparse:nnn { - \um_set_mathsymbol:nNNn {\um_symfont_tl} #2#3{#1} + \__um_set_mathsymbol:nNNn {\__um_symfont_tl} #2 #3 {#1} } -\cs_set:Nn \um_process_symbol_parse:nnn +\cs_set:Nn \__um_process_symbol_parse:nnn { - \um_if_char_spec:nNNT{#1}{#2}{#3} + \__um_if_char_spec:nNNT {#1} {#2} {#3} { - \um_process_symbol_noparse:nnn {#1}{#2}{#3} + \__um_process_symbol_noparse:nnn {#1} {#2} {#3} } } -\cs_new:Npn \um_remap_symbols: +\cs_new:Npn \__um_remap_symbols: { - \um_remap_symbol:nnn{`\-}{\mathbin}{"02212}% hyphen to minus - \um_remap_symbol:nnn{`\*}{\mathbin}{"02217}% text asterisk to "centred asterisk" - \bool_if:NF \g_um_literal_colon_bool + \__um_remap_symbol:nnn{`\-}{\mathbin}{"02212}% hyphen to minus + \__um_remap_symbol:nnn{`\*}{\mathbin}{"02217}% text asterisk to "centred asterisk" + \bool_if:NF \g__um_literal_colon_bool { - \um_remap_symbol:nnn{`\:}{\mathrel}{"02236}% colon to ratio (i.e., punct to rel) + \__um_remap_symbol:nnn{`\:}{\mathrel}{"02236}% colon to ratio (i.e., punct to rel) } } -\cs_new:Nn \um_remap_symbol_parse:nnn +\cs_new:Nn \__um_remap_symbol_parse:nnn { - \um_if_char_spec:nNNT {#3} {\@nil} {#2} - { - \um_remap_symbol_noparse:nnn {#1} {#2} {#3} - } + \__um_if_char_spec:nNNT {#3} {\@nil} {#2} + { \__um_remap_symbol_noparse:nnn {#1} {#2} {#3} } } -\cs_new:Nn \um_remap_symbol_noparse:nnn +\cs_new:Nn \__um_remap_symbol_noparse:nnn { \clist_map_inline:nn {#1} - { - \um_set_mathcode:nnnn {##1} {#2} {\um_symfont_tl} {#3} - } + { \__um_set_mathcode:nnnn {##1} {#2} {\__um_symfont_tl} {#3} } } -\cs_new:Npn \um_setup_mathactives: +\cs_new:Npn \__um_setup_mathactives: { - \um_make_mathactive:nNN {"2032} \um_prime_single_mchar \mathord - \um_make_mathactive:nNN {"2033} \um_prime_double_mchar \mathord - \um_make_mathactive:nNN {"2034} \um_prime_triple_mchar \mathord - \um_make_mathactive:nNN {"2057} \um_prime_quad_mchar \mathord - \um_make_mathactive:nNN {"2035} \um_backprime_single_mchar \mathord - \um_make_mathactive:nNN {"2036} \um_backprime_double_mchar \mathord - \um_make_mathactive:nNN {"2037} \um_backprime_triple_mchar \mathord - \um_make_mathactive:nNN {`\'} \mathstraightquote \mathord - \um_make_mathactive:nNN {`\`} \mathbacktick \mathord + \__um_make_mathactive:nNN {"2032} \__um_prime_single_mchar \mathord + \__um_make_mathactive:nNN {"2033} \__um_prime_double_mchar \mathord + \__um_make_mathactive:nNN {"2034} \__um_prime_triple_mchar \mathord + \__um_make_mathactive:nNN {"2057} \__um_prime_quad_mchar \mathord + \__um_make_mathactive:nNN {"2035} \__um_backprime_single_mchar \mathord + \__um_make_mathactive:nNN {"2036} \__um_backprime_double_mchar \mathord + \__um_make_mathactive:nNN {"2037} \__um_backprime_triple_mchar \mathord + \__um_make_mathactive:nNN {`\'} \mathstraightquote \mathord + \__um_make_mathactive:nNN {`\`} \mathbacktick \mathord } -\cs_new:Nn \um_make_mathactive_parse:nNN +\cs_new:Nn \__um_make_mathactive_parse:nNN { - \um_if_char_spec:nNNT {#1} #2 #3 - { \um_make_mathactive_noparse:nNN {#1} #2 #3 } + \__um_if_char_spec:nNNT {#1} #2 #3 + { \__um_make_mathactive_noparse:nNN {#1} #2 #3 } } -\cs_new:Nn \um_make_mathactive_noparse:nNN +\cs_new:Nn \__um_make_mathactive_noparse:nNN { - \um_set_mathchar:NNnn #2 #3 {\um_symfont_tl} {#1} - \char_gmake_mathactive:n {#1} + \__um_set_mathchar:NNnn #2 #3 {\__um_symfont_tl} {#1} + \__um_char_gmake_mathactive:n {#1} } -\cs_new:Nn \um_assign_delcode_noparse:nn - { - \um_set_delcode:nnn \um_symfont_tl {#1} {#2} - } -\cs_new:Nn \um_assign_delcode_parse:nn - { - \um_if_char_spec:nNNT {#2} {\@nil} {\@nil} - { - \um_assign_delcode_noparse:nn {#1} {#2} - } - } -\cs_new:Nn \um_assign_delcode:n { \um_assign_delcode:nn {#1} {#1} } -\cs_new:Npn \um_setup_delcodes: - { - \um_assign_delcode:nn {`\.} {\c_zero} % ensure \left. and \right. work - \um_assign_delcode:nn {`\/} {\g_um_slash_delimiter_usv} - \um_assign_delcode:nn {"2044} {\g_um_slash_delimiter_usv} % fracslash - \um_assign_delcode:nn {"2215} {\g_um_slash_delimiter_usv} % divslash - \um_assign_delcode:n {"005C} % backslash - \um_assign_delcode:nn {`\<} {"27E8} % angle brackets with ascii notation - \um_assign_delcode:nn {`\>} {"27E9} % angle brackets with ascii notation - \um_assign_delcode:n {"2191} % up arrow - \um_assign_delcode:n {"2193} % down arrow - \um_assign_delcode:n {"2195} % updown arrow - \um_assign_delcode:n {"219F} % up arrow twohead - \um_assign_delcode:n {"21A1} % down arrow twohead - \um_assign_delcode:n {"21A5} % up arrow from bar - \um_assign_delcode:n {"21A7} % down arrow from bar - \um_assign_delcode:n {"21A8} % updown arrow from bar - \um_assign_delcode:n {"21BE} % up harpoon right - \um_assign_delcode:n {"21BF} % up harpoon left - \um_assign_delcode:n {"21C2} % down harpoon right - \um_assign_delcode:n {"21C3} % down harpoon left - \um_assign_delcode:n {"21C5} % arrows up down - \um_assign_delcode:n {"21F5} % arrows down up - \um_assign_delcode:n {"21C8} % arrows up up - \um_assign_delcode:n {"21CA} % arrows down down - \um_assign_delcode:n {"21D1} % double up arrow - \um_assign_delcode:n {"21D3} % double down arrow - \um_assign_delcode:n {"21D5} % double updown arrow - \um_assign_delcode:n {"21DE} % up arrow double stroke - \um_assign_delcode:n {"21DF} % down arrow double stroke - \um_assign_delcode:n {"21E1} % up arrow dashed - \um_assign_delcode:n {"21E3} % down arrow dashed - \um_assign_delcode:n {"21E7} % up white arrow - \um_assign_delcode:n {"21E9} % down white arrow - \um_assign_delcode:n {"21EA} % up white arrow from bar - \um_assign_delcode:n {"21F3} % updown white arrow - } -\tl_new:N \l_um_nolimits_tl -\tl_set:Nn \l_um_nolimits_tl +\cs_new:Nn \__um_assign_delcode_noparse:nn + { + \__um_set_delcode:nnn \__um_symfont_tl {#1} {#2} + } +\cs_new:Nn \__um_assign_delcode_parse:nn + { + \__um_if_char_spec:nNNT {#2} {\@nil} {\@nil} + { + \__um_assign_delcode_noparse:nn {#1} {#2} + } + } +\cs_new:Nn \__um_assign_delcode:n { \__um_assign_delcode:nn {#1} {#1} } +\cs_new:Npn \__um_setup_delcodes: + { + % ensure \left. and \right. work: + \__um_set_delcode:nnn \__um_symfont_tl {`\.} {\c_zero} + % this is forcefully done to fix a bug -- indicates a larger problem! + + \__um_assign_delcode:nn {`\/} {\g__um_slash_delimiter_usv} + \__um_assign_delcode:nn {"2044} {\g__um_slash_delimiter_usv} % fracslash + \__um_assign_delcode:nn {"2215} {\g__um_slash_delimiter_usv} % divslash + \__um_assign_delcode:n {"005C} % backslash + \__um_assign_delcode:nn {`\<} {"27E8} % angle brackets with ascii notation + \__um_assign_delcode:nn {`\>} {"27E9} % angle brackets with ascii notation + \__um_assign_delcode:n {"2191} % up arrow + \__um_assign_delcode:n {"2193} % down arrow + \__um_assign_delcode:n {"2195} % updown arrow + \__um_assign_delcode:n {"219F} % up arrow twohead + \__um_assign_delcode:n {"21A1} % down arrow twohead + \__um_assign_delcode:n {"21A5} % up arrow from bar + \__um_assign_delcode:n {"21A7} % down arrow from bar + \__um_assign_delcode:n {"21A8} % updown arrow from bar + \__um_assign_delcode:n {"21BE} % up harpoon right + \__um_assign_delcode:n {"21BF} % up harpoon left + \__um_assign_delcode:n {"21C2} % down harpoon right + \__um_assign_delcode:n {"21C3} % down harpoon left + \__um_assign_delcode:n {"21C5} % arrows up down + \__um_assign_delcode:n {"21F5} % arrows down up + \__um_assign_delcode:n {"21C8} % arrows up up + \__um_assign_delcode:n {"21CA} % arrows down down + \__um_assign_delcode:n {"21D1} % double up arrow + \__um_assign_delcode:n {"21D3} % double down arrow + \__um_assign_delcode:n {"21D5} % double updown arrow + \__um_assign_delcode:n {"21DE} % up arrow double stroke + \__um_assign_delcode:n {"21DF} % down arrow double stroke + \__um_assign_delcode:n {"21E1} % up arrow dashed + \__um_assign_delcode:n {"21E3} % down arrow dashed + \__um_assign_delcode:n {"21E7} % up white arrow + \__um_assign_delcode:n {"21E9} % down white arrow + \__um_assign_delcode:n {"21EA} % up white arrow from bar + \__um_assign_delcode:n {"21F3} % updown white arrow + } +\tl_new:N \l__um_nolimits_tl +\tl_set:Nn \l__um_nolimits_tl { \int\iint\iiint\iiiint\oint\oiint\oiiint \intclockwise\varointclockwise\ointctrclockwise\sumint @@ -623,21 +520,21 @@ } \DeclareDocumentCommand \addnolimits {m} { - \tl_put_right:Nn \l_um_nolimits_tl {#1} + \tl_put_right:Nn \l__um_nolimits_tl {#1} } \DeclareDocumentCommand \removenolimits {m} { - \tl_remove_all:Nn \l_um_nolimits_tl {#1} + \tl_remove_all:Nn \l__um_nolimits_tl {#1} } -\tl_new:N \l_um_radicals_tl -\tl_set:Nn \l_um_radicals_tl {\sqrt \longdivision} -\cs_new_protected_nopar:Nn \um_new_cramped_style:N +\tl_new:N \l__um_radicals_tl +\tl_set:Nn \l__um_radicals_tl {\sqrt \longdivision} +\cs_new_protected_nopar:Nn \__um_new_cramped_style:N { \quark_new:N #1 } -\um_new_cramped_style:N \crampeddisplaystyle -\um_new_cramped_style:N \crampedtextstyle -\um_new_cramped_style:N \crampedscriptstyle -\um_new_cramped_style:N \crampedscriptscriptstyle - \cs_new_nopar:Npn \um_font_dimen:Nnnnn #1 #2 #3 #4 #5 { +\__um_new_cramped_style:N \crampeddisplaystyle +\__um_new_cramped_style:N \crampedtextstyle +\__um_new_cramped_style:N \crampedscriptstyle +\__um_new_cramped_style:N \crampedscriptscriptstyle + \cs_new_nopar:Npn \__um_font_dimen:Nnnnn #1 #2 #3 #4 #5 { \fontdimen \cs_if_eq:NNTF #1 \displaystyle { #2 \textfont @@ -670,228 +567,197 @@ } \c_two } -\cs_new_protected_nopar:Nn \um_font_param:nnnnn +\cs_new_protected_nopar:Nn \__um_font_param:nnnnn { - \um_font_param_aux:ccnnnn { um_ #1 :N } { um_set_ #1 :N } + \__um_font_param_aux:ccnnnn { __um_ #1 :N } { __um_set_ #1 :Nn } { #2 } { #3 } { #4 } { #5 } } -\cs_new_protected_nopar:Nn \um_font_param:nnn +\cs_new_protected_nopar:Nn \__um_font_param:nnn { - \um_font_param:nnnnn { #1 } { #2 } { #2 } { #3 } { #3 } + \__um_font_param:nnnnn { #1 } { #2 } { #2 } { #3 } { #3 } } -\cs_new_protected_nopar:Nn \um_font_param:nn +\cs_new_protected_nopar:Nn \__um_font_param:nn { - \um_font_param:nnnnn { #1 } { #2 } { #2 } { #2 } { #2 } + \__um_font_param:nnnnn { #1 } { #2 } { #2 } { #2 } { #2 } } -\cs_new_protected_nopar:Nn \um_font_param:n +\cs_new_protected_nopar:Nn \__um_font_param:n { } -\cs_new_protected_nopar:Nn \um_font_param_aux:NNnnnn +\cs_new_protected_nopar:Nn \__um_font_param_aux:NNnnnn { \cs_new_nopar:Npn #1 ##1 { - \um_font_dimen:Nnnnn ##1 { #3 } { #4 } { #5 } { #6 } + \__um_font_dimen:Nnnnn ##1 { #3 } { #4 } { #5 } { #6 } } \cs_new_protected_nopar:Npn #2 ##1 ##2 { #1 ##1 \dim_eval:n { ##2 } } } -\cs_generate_variant:Nn \um_font_param_aux:NNnnnn { cc } -\um_font_param:nn { axis } { 15 } -\um_font_param:nn { operator_size } { 13 } -\um_font_param:n { fraction_del_size } -\um_font_param:nnn { fraction_denom_down } { 45 } { 44 } -\um_font_param:nnn { fraction_denom_vgap } { 50 } { 49 } -\um_font_param:nnn { fraction_num_up } { 43 } { 42 } -\um_font_param:nnn { fraction_num_vgap } { 47 } { 46 } -\um_font_param:nn { fraction_rule } { 48 } -\um_font_param:nn { limit_above_bgap } { 29 } -\um_font_param:n { limit_above_kern } -\um_font_param:nn { limit_above_vgap } { 28 } -\um_font_param:nn { limit_below_bgap } { 31 } -\um_font_param:n { limit_below_kern } -\um_font_param:nn { limit_below_vgap } { 30 } -\um_font_param:nn { over_delimiter_vgap } { 41 } -\um_font_param:nn { over_delimiter_bgap } { 38 } -\um_font_param:nn { under_delimiter_vgap } { 40 } -\um_font_param:nn { under_delimiter_bgap } { 39 } -\um_font_param:nn { overbar_kern } { 55 } -\um_font_param:nn { overbar_rule } { 54 } -\um_font_param:nn { overbar_vgap } { 53 } -\um_font_param:n { quad } -\um_font_param:nn { radical_kern } { 62 } -\um_font_param:nn { radical_rule } { 61 } -\um_font_param:nnn { radical_vgap } { 60 } { 59 } -\um_font_param:nn { radical_degree_before } { 63 } -\um_font_param:nn { radical_degree_after } { 64 } -\um_font_param:nn { radical_degree_raise } { 65 } -\um_font_param:nn { space_after_script } { 27 } -\um_font_param:nnn { stack_denom_down } { 35 } { 34 } -\um_font_param:nnn { stack_num_up } { 33 } { 32 } -\um_font_param:nnn { stack_vgap } { 37 } { 36 } -\um_font_param:nn { sub_shift_down } { 18 } -\um_font_param:nn { sub_shift_drop } { 20 } -\um_font_param:n { subsup_shift_down } -\um_font_param:nn { sub_top_max } { 19 } -\um_font_param:nn { subsup_vgap } { 25 } -\um_font_param:nn { sup_bottom_min } { 23 } -\um_font_param:nn { sup_shift_drop } { 24 } -\um_font_param:nnnnn { sup_shift_up } { 21 } { 22 } { 21 } { 22 } -\um_font_param:nn { supsub_bottom_max } { 26 } -\um_font_param:nn { underbar_kern } { 58 } -\um_font_param:nn { underbar_rule } { 57 } -\um_font_param:nn { underbar_vgap } { 56 } -\um_font_param:n { connector_overlap_min } -\def\new@mathversion#1{% - \expandafter\in@\expandafter#1\expandafter{\version@list}% - \ifin@ - \@font@info{Redeclaring math version - `\expandafter\@gobblefour\string#1'}% - \else - \expandafter\newcount\csname c@\expandafter - \@gobble\string#1\endcsname - \def\version@elt{\noexpand\version@elt\noexpand}% - \edef\version@list{\version@list\version@elt#1}% - \fi - \toks@{}% - \count@\z@ - \def\group@elt##1##2{% - \advance\count@\@ne - \addto@hook\toks@{\getanddefine@fonts##1##2}% - }% - \group@list - \global\csname c@\expandafter\@gobble\string#1\endcsname\count@ - \def\alpha@elt##1##2##3{% - \ifx##2\no@alphabet@error - \toks@\expandafter{\the\toks@\install@mathalphabet##1% - {\no@alphabet@error##1}}% - \else - \toks@\expandafter{\the\toks@\install@mathalphabet##1% - {\select@group##1##2##3}}% - \fi - }% - \alpha@list - \xdef#1{\the\toks@}% -} +\cs_generate_variant:Nn \__um_font_param_aux:NNnnnn { cc } +\__um_font_param:nn { axis } { 15 } +\__um_font_param:nn { operator_size } { 13 } +\__um_font_param:n { fraction_del_size } +\__um_font_param:nnn { fraction_denom_down } { 45 } { 44 } +\__um_font_param:nnn { fraction_denom_vgap } { 50 } { 49 } +\__um_font_param:nnn { fraction_num_up } { 43 } { 42 } +\__um_font_param:nnn { fraction_num_vgap } { 47 } { 46 } +\__um_font_param:nn { fraction_rule } { 48 } +\__um_font_param:nn { limit_above_bgap } { 29 } +\__um_font_param:n { limit_above_kern } +\__um_font_param:nn { limit_above_vgap } { 28 } +\__um_font_param:nn { limit_below_bgap } { 31 } +\__um_font_param:n { limit_below_kern } +\__um_font_param:nn { limit_below_vgap } { 30 } +\__um_font_param:nn { over_delimiter_vgap } { 41 } +\__um_font_param:nn { over_delimiter_bgap } { 38 } +\__um_font_param:nn { under_delimiter_vgap } { 40 } +\__um_font_param:nn { under_delimiter_bgap } { 39 } +\__um_font_param:nn { overbar_kern } { 55 } +\__um_font_param:nn { overbar_rule } { 54 } +\__um_font_param:nn { overbar_vgap } { 53 } +\__um_font_param:n { quad } +\__um_font_param:nn { radical_kern } { 62 } +\__um_font_param:nn { radical_rule } { 61 } +\__um_font_param:nnn { radical_vgap } { 60 } { 59 } +\__um_font_param:nn { radical_degree_before } { 63 } +\__um_font_param:nn { radical_degree_after } { 64 } +\__um_font_param:nn { radical_degree_raise } { 65 } +\__um_font_param:nn { space_after_script } { 27 } +\__um_font_param:nnn { stack_denom_down } { 35 } { 34 } +\__um_font_param:nnn { stack_num_up } { 33 } { 32 } +\__um_font_param:nnn { stack_vgap } { 37 } { 36 } +\__um_font_param:nn { sub_shift_down } { 18 } +\__um_font_param:nn { sub_shift_drop } { 20 } +\__um_font_param:n { subsup_shift_down } +\__um_font_param:nn { sub_top_max } { 19 } +\__um_font_param:nn { subsup_vgap } { 25 } +\__um_font_param:nn { sup_bottom_min } { 23 } +\__um_font_param:nn { sup_shift_drop } { 24 } +\__um_font_param:nnnnn { sup_shift_up } { 21 } { 22 } { 21 } { 22 } +\__um_font_param:nn { supsub_bottom_max } { 26 } +\__um_font_param:nn { underbar_kern } { 58 } +\__um_font_param:nn { underbar_rule } { 57 } +\__um_font_param:nn { underbar_vgap } { 56 } +\__um_font_param:n { connector_overlap_min } \keys_define:nn {unicode-math} { version .code:n = { - \tl_set:Nn \l_um_mversion_tl {#1} - \DeclareMathVersion{\l_um_mversion_tl} + \tl_set:Nn \l__um_mversion_tl {#1} + \DeclareMathVersion {\l__um_mversion_tl} } } \keys_define:nn {unicode-math} { - script-features .tl_set:N = \l_um_script_features_tl , - sscript-features .tl_set:N = \l_um_sscript_features_tl , - script-font .tl_set:N = \l_um_script_font_tl , - sscript-font .tl_set:N = \l_um_sscript_font_tl , + script-features .tl_set:N = \l__um_script_features_tl , + sscript-features .tl_set:N = \l__um_sscript_features_tl , + script-font .tl_set:N = \l__um_script_font_tl , + sscript-font .tl_set:N = \l__um_sscript_font_tl , } -\seq_new:N \l_um_mathalph_seq -\seq_new:N \l_um_char_range_seq -\seq_new:N \l_um_mclass_range_seq -\seq_new:N \l_um_cmd_range_seq \keys_define:nn {unicode-math} { - range .code:n = { - \bool_set_false:N \l_um_init_bool - \int_incr:N \g_um_fam_int - \tl_set:Nx \um_symfont_tl {um_fam\int_use:N\g_um_fam_int} - \cs_set_eq:NN \_um_sym:nnn \um_process_symbol_parse:nnn - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_parse:Nnn - \cs_set_eq:NN \um_remap_symbol:nnn \um_remap_symbol_parse:nnn - \cs_set_eq:NN \um_maybe_init_alphabet:n \use_none:n - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_parse:nn - \cs_set_eq:NN \um_assign_delcode:nn \um_assign_delcode_parse:nn - \cs_set_eq:NN \um_make_mathactive:nNN \um_make_mathactive_parse:nNN - \seq_clear:N \l_um_char_range_seq - \seq_clear:N \l_um_mclass_range_seq - \seq_clear:N \l_um_cmd_range_seq - \seq_clear:N \l_um_mathalph_seq - \clist_map_inline:nn {#1} { - \um_if_mathalph_decl:nTF {##1} { - \seq_put_right:Nx \l_um_mathalph_seq { - { \exp_not:V \l_um_tmpa_tl } - { \exp_not:V \l_um_tmpb_tl } - { \exp_not:V \l_um_tmpc_tl } - } - }{ - \seq_if_in:NnTF \g_um_mathclasses_seq {##1} - { \seq_put_right:Nn \l_um_mclass_range_seq {##1} } + range .code:n = + { + \bool_set_false:N \l__um_init_bool + \int_incr:N \g__um_fam_int + \tl_set:Nx \__um_symfont_tl {__um_fam\int_use:N\g__um_fam_int} + \cs_set_eq:NN \__um_sym:nnn \__um_process_symbol_parse:nnn + \cs_set_eq:NN \__um_set_mathalphabet_char:Nnn \__um_mathmap_parse:Nnn + \cs_set_eq:NN \__um_remap_symbol:nnn \__um_remap_symbol_parse:nnn + \cs_set_eq:NN \__um_maybe_init_alphabet:n \use_none:n + \cs_set_eq:NN \__um_map_char_single:nn \__um_map_char_parse:nn + \cs_set_eq:NN \__um_assign_delcode:nn \__um_assign_delcode_parse:nn + \cs_set_eq:NN \__um_make_mathactive:nNN \__um_make_mathactive_parse:nNN + \seq_clear:N \l__um_char_range_seq + \seq_clear:N \l__um_mclass_range_seq + \seq_clear:N \l__um_cmd_range_seq + \seq_clear:N \l__um_mathalph_seq + + \clist_map_inline:nn {#1} + { + \__um_if_mathalph_decl:nTF {##1} + { + \seq_put_right:Nx \l__um_mathalph_seq + { + { \exp_not:V \l__um_tmpa_tl } + { \exp_not:V \l__um_tmpb_tl } + { \exp_not:V \l__um_tmpc_tl } + } + } + { + \seq_if_in:NnTF \g__um_mathclasses_seq {##1} + { \seq_put_right:Nn \l__um_mclass_range_seq {##1} } { \bool_if:nTF { \tl_if_single_p:n {##1} && \token_if_cs_p:N ##1 } - { \seq_put_right:Nn \l_um_cmd_range_seq {##1} } - { \seq_put_right:Nn \l_um_char_range_seq {##1} } + { \seq_put_right:Nn \l__um_cmd_range_seq {##1} } + { \seq_put_right:Nn \l__um_char_range_seq {##1} } } - } - } - } + } + } + } } -\seq_new:N \g_um_mathclasses_seq -\seq_set_from_clist:Nn \g_um_mathclasses_seq - { - \mathord,\mathalpha,\mathop,\mathbin,\mathrel, - \mathopen,\mathclose,\mathpunct,\mathaccent, - \mathfence,\mathover,\mathunder,\mathbotaccent - } -\prg_new_conditional:Nnn \um_if_mathalph_decl:n {TF} { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {#1} } - \tl_clear:N \l_um_tmpb_tl - \tl_clear:N \l_um_tmpc_tl - \tl_if_in:NnT \l_um_tmpa_tl {->} { - \exp_after:wN \um_split_arrow:w \l_um_tmpa_tl \q_nil - } - \tl_if_in:NnT \l_um_tmpa_tl {/} { - \exp_after:wN \um_split_slash:w \l_um_tmpa_tl \q_nil - } - \tl_if_empty:NT \l_um_tmpc_tl { \tl_set_eq:NN \l_um_tmpc_tl \l_um_tmpa_tl } - \seq_if_in:NVTF \g_um_mathstyles_seq \l_um_tmpa_tl { - \prg_return_true: - }{ - \prg_return_false: - } -} -\cs_set:Npn \um_split_arrow:w #1->#2 \q_nil { - \tl_set:Nn \l_um_tmpa_tl {#1} - \tl_if_single:nTF {#2} - { \tl_set:Nn \l_um_tmpc_tl {#2} } - { \exp_args:NNc \tl_set:Nn \l_um_tmpc_tl {math#2} } -} -\cs_set:Npn \um_split_slash:w #1/#2 \q_nil { - \tl_set:Nn \l_um_tmpa_tl {#1} - \tl_set:Nn \l_um_tmpb_tl {#2} -} -\cs_new:Nn \um_if_char_spec:nNNT - { +\prg_new_conditional:Nnn \__um_if_mathalph_decl:n {TF} + { + \tl_set:Nn \l__um_tmpa_tl {#1} + \tl_clear:N \l__um_tmpb_tl + \tl_clear:N \l__um_tmpc_tl + + \tl_if_in:NnT \l__um_tmpa_tl {->} + { \exp_after:wN \__um_split_arrow:w \l__um_tmpa_tl \q_nil } + + \tl_if_in:NnT \l__um_tmpa_tl {/} + { \exp_after:wN \__um_split_slash:w \l__um_tmpa_tl \q_nil } + + \tl_set:Nx \l__um_tmpa_tl { \tl_to_str:N \l__um_tmpa_tl } + \exp_args:NNx \tl_remove_all:Nn \l__um_tmpa_tl { \token_to_str:N \math } + \exp_args:NNx \tl_remove_all:Nn \l__um_tmpa_tl { \token_to_str:N \sym } + \tl_trim_spaces:N \l__um_tmpa_tl + \tl_if_empty:NT \l__um_tmpc_tl + { \tl_set_eq:NN \l__um_tmpc_tl \l__um_tmpa_tl } + + \seq_if_in:NVTF \g__um_named_ranges_seq \l__um_tmpa_tl + { \prg_return_true: } { \prg_return_false: } + } +\cs_set:Npn \__um_split_arrow:w #1->#2 \q_nil + { + \tl_set:Nx \l__um_tmpa_tl { \tl_trim_spaces:n {#1} } + \tl_set:Nx \l__um_tmpc_tl { \tl_trim_spaces:n {#2} } + } +\cs_set:Npn \__um_split_slash:w #1/#2 \q_nil + { + \tl_set:Nx \l__um_tmpa_tl { \tl_trim_spaces:n {#1} } + \tl_set:Nx \l__um_tmpb_tl { \tl_trim_spaces:n {#2} } + } +\cs_new:Nn \__um_if_char_spec:nNNT + { % math class: - \seq_if_in:NnT \l_um_mclass_range_seq {#3} + \seq_if_in:NnT \l__um_mclass_range_seq {#3} { \use_none_delimit_by_q_nil:w } % command name: - \seq_if_in:NnT \l_um_cmd_range_seq {#2} + \seq_if_in:NnT \l__um_cmd_range_seq {#2} { \use_none_delimit_by_q_nil:w } % character slot: - \seq_map_inline:Nn \l_um_char_range_seq + \seq_map_inline:Nn \l__um_char_range_seq { - \um_int_if_slot_in_range:nnT {#1} {##1} + \__um_int_if_slot_in_range:nnT {#1} {##1} { \seq_map_break:n { \use_none_delimit_by_q_nil:w } } } - % this executes if no match was found: + % the following expands to nil if no match was found: \use_none:nnn \q_nil \use:n { - \clist_put_right:Nx \l_um_char_num_range_clist { \int_eval:n {#1} } + \clist_put_right:Nx \l__um_char_nrange_clist { \int_eval:n {#1} } #4 } } -\cs_new:Nn \um_int_if_slot_in_range:nnT - { \um_numrange_parse:nwT {#1} #2 - \q_nil - \q_stop {#3} } -\cs_set:Npn \um_numrange_parse:nwT #1 #2 - #3 - #4 \q_stop #5 +\cs_new:Nn \__um_int_if_slot_in_range:nnT + { \__um_numrange_parse:nwT {#1} #2 - \q_nil - \q_stop {#3} } +\cs_set:Npn \__um_numrange_parse:nwT #1 #2 - #3 - #4 \q_stop #5 { \tl_if_empty:nTF {#4} { \int_compare:nT {#1=#2} {#5} } { @@ -902,1185 +768,427 @@ \int_compare:nT {#1>=#2} { \int_compare:nT {#1<=#3} {#5} } } } } } -\AtBeginDocument{\um_resolve_greek:} -\cs_new:Npn \um_resolve_greek: { - \clist_map_inline:nn { +\AtBeginDocument{\__um_resolve_greek:} +\cs_new:Npn \__um_resolve_greek: + { + \clist_map_inline:nn + { Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda, alpha,beta,gamma,delta, zeta,eta,theta,iota,kappa,lambda, Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega, mu,nu,xi,omicron,pi,rho,sigma,tau,upsilon, chi,psi,omega, varTheta, varsigma,vartheta,varkappa,varrho,varpi - }{ + } + { \tl_set:cx {##1} { \exp_not:c { mit ##1 } } - } - \tl_set:Nn \epsilon { - \bool_if:NTF \g_um_texgreek_bool \mitvarepsilon \mitepsilon - } - \tl_set:Nn \phi { - \bool_if:NTF \g_um_texgreek_bool \mitvarphi \mitphi - } - \tl_set:Nn \varepsilon { - \bool_if:NTF \g_um_texgreek_bool \mitepsilon \mitvarepsilon - } - \tl_set:Nn \varphi { - \bool_if:NTF \g_um_texgreek_bool \mitphi \mitvarphi - } -} -\cs_new:Nn \um_new_mathstyle:N - { - \um_prepare_mathstyle:f {\exp_after:wN \use_none:nnnnn \token_to_str:N #1} - \seq_put_right:Nn \g_um_mathstyles_seq {#1} - } -\seq_new:N \g_um_default_mathalph_seq -\seq_new:N \g_um_mathstyles_seq -\AtEndOfPackage - { -\clist_map_inline:nn - { - {\mathup } {latin,Latin,greek,Greek,num,misc} {\mathup } , - {\mathit } {latin,Latin,greek,Greek,misc} {\mathit } , - {\mathbb } {latin,Latin,num,misc} {\mathbb } , - {\mathbbit } {misc} {\mathbbit } , - {\mathscr } {latin,Latin} {\mathscr } , - {\mathcal } {Latin} {\mathscr } , - {\mathbfcal } {Latin} {\mathbfscr } , - {\mathfrak } {latin,Latin} {\mathfrak } , - {\mathtt } {latin,Latin,num} {\mathtt } , - {\mathsfup } {latin,Latin,num} {\mathsfup } , - {\mathsfit } {latin,Latin} {\mathsfit } , - {\mathbfup } {latin,Latin,greek,Greek,num,misc} {\mathbfup } , - {\mathbfit } {latin,Latin,greek,Greek,misc} {\mathbfit } , - {\mathbfscr } {latin,Latin} {\mathbfscr } , - {\mathbffrak} {latin,Latin} {\mathbffrak} , - {\mathbfsfup} {latin,Latin,greek,Greek,num,misc} {\mathbfsfup} , - {\mathbfsfit} {latin,Latin,greek,Greek,misc} {\mathbfsfit} - } - { - \seq_put_right:Nn \g_um_default_mathalph_seq {#1} - \exp_after:wN \um_new_mathstyle:N \use_i:nnn #1 - } - \um_new_mathstyle:N \mathsf - \um_new_mathstyle:N \mathbf - \um_new_mathstyle:N \mathbfsf + \tl_set:cx {up ##1} { \exp_not:N \symup \exp_not:c { ##1 } } + \tl_set:cx {it ##1} { \exp_not:N \symit \exp_not:c { ##1 } } + } + \tl_set:Nn \epsilon + { \bool_if:NTF \g__um_texgreek_bool \mitvarepsilon \mitepsilon } + \tl_set:Nn \phi + { \bool_if:NTF \g__um_texgreek_bool \mitvarphi \mitphi } + \tl_set:Nn \varepsilon + { \bool_if:NTF \g__um_texgreek_bool \mitepsilon \mitvarepsilon } + \tl_set:Nn \varphi + { \bool_if:NTF \g__um_texgreek_bool \mitphi \mitvarphi } } -\cs_new:Nn \um_prepare_mathstyle:n +\cs_set:Npn \use@mathgroup #1 #2 { - \um_init_alphabet:x {#1} - \cs_set:cpn {_um_math#1_aux:n} ##1 + \mode_if_math:T % <- not sure if this is really necessary since we've just checked for mmode and raised an error if not! { - \use:c {um_switchto_math#1:} ##1 \egroup + \math@bgroup + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \mathgroup #2 \relax + \math@egroup } - \cs_set_protected:cpx {math#1} + } +\cs_new:Nn \__um_prepare_mathstyle:n + { + \seq_put_right:Nn \g__um_mathstyles_seq {#1} + \__um_init_alphabet:n {#1} + \cs_set:cpn {__um_sym_#1_aux:n} + { \use:c {__um_switchto_#1:} \math@egroup } + \cs_set_protected:cpx {sym#1} { \exp_not:n { - \bgroup + \math@bgroup \mode_if_math:F { \egroup\expandafter - \non@alpherr\expandafter{\csname math#1\endcsname\space} + \non@alpherr\expandafter{\csname sym#1\endcsname\space} } - \tl_set:Nn \l_um_mathstyle_tl {#1} + \tl_set:Nn \l__um_mathstyle_tl {#1} } - \exp_not:c {_um_math#1_aux:n} + \exp_not:c {__um_sym_#1_aux:n} } } -\tl_new:N \l_um_mathstyle_tl -\cs_generate_variant:Nn \um_prepare_mathstyle:n {f} -\cs_set:Nn \um_init_alphabet:n +\cs_set:Nn \__um_init_alphabet:n { - \um_log:nx {alph-initialise} {#1} - \cs_set_eq:cN {um_switchto_math#1:} \prg_do_nothing: + \__um_log:nx {alph-initialise} {#1} + \cs_set_eq:cN {__um_switchto_#1:} \prg_do_nothing: } -\cs_generate_variant:Nn \um_init_alphabet:n {x} -\cs_new:Npn \um_maybe_init_alphabet:V +\cs_new:Nn \__um_new_named_range:n { - \exp_args:NV \um_maybe_init_alphabet:n + \prop_new:c {g__um_named_range_#1_prop} } -\seq_new:N \l_um_missing_alph_seq -\cs_new:Npn \um_setup_alphabets: +\clist_set:Nn \g__um_named_ranges_clist { - \seq_if_empty:NTF \l_um_mathalph_seq { - \um_log:n {setup-implicit} - \seq_set_eq:NN \l_um_mathalph_seq \g_um_default_mathalph_seq - \bool_set_true:N \l_um_implicit_alph_bool - \um_maybe_init_alphabet:n {sf} - \um_maybe_init_alphabet:n {bf} - \um_maybe_init_alphabet:n {bfsf} - } - { - \um_log:n {setup-explicit} - \bool_set_false:N \l_um_implicit_alph_bool - \cs_set_eq:NN \um_set_mathalphabet_char:Nnn \um_mathmap_noparse:Nnn - \cs_set_eq:NN \um_map_char_single:nn \um_map_char_noparse:nn - } - \seq_map_inline:Nn \l_um_mathalph_seq { - \tl_set:No \l_um_tmpa_tl { \use_i:nnn ##1 } - \tl_set:No \l_um_tmpb_tl { \use_ii:nnn ##1 } - \tl_set:No \l_um_remap_style_tl { \use_iii:nnn ##1 } - \tl_set:Nx \l_um_remap_style_tl { - \exp_after:wN \exp_after:wN \exp_after:wN \use_none:nnnnn - \exp_after:wN \token_to_str:N \l_um_remap_style_tl - } - \tl_if_empty:NT \l_um_tmpb_tl { - \cs_set_eq:NN \um_maybe_init_alphabet:n \um_init_alphabet:n - \tl_set:Nn \l_um_tmpb_tl { latin,Latin,greek,Greek,num,misc } + up, it, tt, bfup, bfit, bb , bbit, scr, bfscr, cal, bfcal, + frak, bffrak, sfup, sfit, bfsfup, bfsfit, bfsf + } +\clist_map_inline:Nn \g__um_named_ranges_clist + { \__um_new_named_range:n {#1} } +\clist_new:N \g__um_alphabets_seq +\clist_set:Nn \g__um_alphabets_seq { latin, Latin, greek, Greek, num } +\cs_new:Nn \__um_new_alphabet_config:nnn + { + \prop_if_exist:cF {g__um_named_range_#1_prop} + { \__um_warning:nnn {no-named-range} {#1} {#2} } + + \prop_gput:cnn {g__um_named_range_#1_prop} { alpha_tl } + { + \prop_item:cn {g__um_named_range_#1_prop} { alpha_tl } + {#2} } - \um_setup_math_alphabet:VVV - \l_um_tmpa_tl \l_um_tmpb_tl \l_um_remap_style_tl - } - \seq_if_empty:NF \l_um_missing_alph_seq { \um_log:n { missing-alphabets } } + % Q: do I need to bother removing duplicates? + + \cs_new:cn { __um_config_#1_#2:n } {#3} + } +\cs_new:Nn \__um_alphabet_config:nnn { \use:c {__um_config_#1_#2:n} {#3} } +\prg_new_conditional:Nnn \__um_if_alphabet_exists:nn {T,TF} + { + \cs_if_exist:cTF {__um_config_#1_#2:n} + \prg_return_true: \prg_return_false: + } +\cs_new:Nn \__um_default_mathalph:nnn + { + \seq_put_right:Nx \g__um_named_ranges_seq { \tl_to_str:n {#1} } + \seq_put_right:Nn \g__um_default_mathalph_seq {{#1}{#2}{#3}} + } +\__um_default_mathalph:nnn {up } {latin,Latin,greek,Greek,num,misc} {up } +\__um_default_mathalph:nnn {it } {latin,Latin,greek,Greek,misc} {it } +\__um_default_mathalph:nnn {bb } {latin,Latin,num,misc} {bb } +\__um_default_mathalph:nnn {bbit } {misc} {bbit } +\__um_default_mathalph:nnn {scr } {latin,Latin} {scr } +\__um_default_mathalph:nnn {cal } {Latin} {scr } +\__um_default_mathalph:nnn {bfcal } {Latin} {bfscr } +\__um_default_mathalph:nnn {frak } {latin,Latin} {frak } +\__um_default_mathalph:nnn {tt } {latin,Latin,num} {tt } +\__um_default_mathalph:nnn {sfup } {latin,Latin,num} {sfup } +\__um_default_mathalph:nnn {sfit } {latin,Latin} {sfit } +\__um_default_mathalph:nnn {bfup } {latin,Latin,greek,Greek,num,misc} {bfup } +\__um_default_mathalph:nnn {bfit } {latin,Latin,greek,Greek,misc} {bfit } +\__um_default_mathalph:nnn {bfscr } {latin,Latin} {bfscr } +\__um_default_mathalph:nnn {bffrak} {latin,Latin} {bffrak} +\__um_default_mathalph:nnn {bfsfup} {latin,Latin,greek,Greek,num,misc} {bfsfup} +\__um_default_mathalph:nnn {bfsfit} {latin,Latin,greek,Greek,misc} {bfsfit} +\clist_map_inline:nn + { + up, it, bfup, bfit, sfup, sfit, bfsfup, bfsfit, bfsf, + tt, bb, bbit, scr, bfscr, cal, bfcal, frak, bffrak, + normal, literal, sf, bf, + } + { \__um_prepare_mathstyle:n {#1} } +\clist_map_inline:nn + { rm, it, bf, sf, tt } + { \cs_set_eq:cc { mathtext #1 } { math #1 } } +\clist_map_inline:nn + { + normal, bb , bbit, scr, bfscr, cal, bfcal, frak, bffrak, tt, + bfup, bfit, sfup, sfit, bfsfup, bfsfit, bfsf + } + { + \cs_set:cpx { math #1 } { \exp_not:c { sym #1 } } } -\cs_new:Nn \um_setup_math_alphabet:Nnn +\AtBeginDocument{ +\clist_map_inline:nn + { rm, it, bf, sf, tt } { - \tl_set:Nx \l_um_style_tl + \cs_set_protected:cpx { math #1 } { - \exp_after:wN \use_none:nnnnn \token_to_str:N #1 + \exp_not:n { \bool_if:NTF } \exp_not:c { g__um_ math #1 _text_bool} + { \exp_not:c { mathtext #1 } } + { \exp_not:c { sym #1 } } } - \clist_map_inline:nn {#2} + }} +\cs_set_protected:Npn \mathup { \mathrm } +\cs_set_protected:Npn \symrm { \symup } +\cs_set:Npn \operator@font + { + \__um_switchto_literal: + \@fontswitch {} { \g__um_operator_mathfont_tl } + } +\cs_new:Npn \__um_setup_alphabets: + { + \seq_if_empty:NTF \l__um_mathalph_seq { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {##1} } - \cs_if_exist:cT {um_config_ \l_um_style_tl _\l_um_tmpa_tl :n} + \__um_log:n {setup-implicit} + \seq_set_eq:NN \l__um_mathalph_seq \g__um_default_mathalph_seq + \bool_set_true:N \l__um_implicit_alph_bool + \__um_maybe_init_alphabet:n {sf} + \__um_maybe_init_alphabet:n {bf} + \__um_maybe_init_alphabet:n {bfsf} + } + { + \__um_log:n {setup-explicit} + \bool_set_false:N \l__um_implicit_alph_bool + \cs_set_eq:NN \__um_set_mathalphabet_char:nnn \__um_mathmap_noparse:nnn + \cs_set_eq:NN \__um_map_char_single:nn \__um_map_char_noparse:nn + } + \seq_map_inline:Nn \l__um_mathalph_seq + { + \tl_set:No \l__um_style_tl { \use_i:nnn ##1 } + \clist_set:No \l__um_alphabet_clist { \use_ii:nnn ##1 } + \tl_set:No \l__um_remap_style_tl { \use_iii:nnn ##1 } + + \clist_if_empty:NT \l__um_alphabet_clist { - \str_if_eq_x:nnTF {\l_um_tmpa_tl}{misc} + \cs_set_eq:NN \__um_maybe_init_alphabet:n \__um_init_alphabet:n + \clist_set:Nn \l__um_alphabet_clist { latin, Latin, greek, Greek, num, misc } + } + + \__um_setup_math_alphabet:NNN + \l__um_style_tl \l__um_alphabet_clist \l__um_remap_style_tl + } + \seq_if_empty:NF \l__um_missing_alph_seq { \__um_log:n { missing-alphabets } } + } +\cs_new:Nn \__um_setup_math_alphabet:NNN + { + \tl_set_eq:NN \l__um_style_tl #1% actually a no-op but makes the code clearer! + \clist_map_inline:Nn #2 + { + \tl_set:Nn \l__um_alphabet_tl {##1} + \__um_if_alphabet_exists:nnTF \l__um_style_tl \l__um_alphabet_tl + { + \str_if_eq_x:nnTF {\l__um_alphabet_tl} {misc} { - \um_maybe_init_alphabet:V \l_um_style_tl + \__um_maybe_init_alphabet:n \l__um_style_tl \clist_map_break: } { - \um_glyph_if_exist:cT { \um_to_usv:nn {#3}{\l_um_tmpa_tl} } + \__um_glyph_if_exist:nT { \__um_to_usv:nn {\l__um_style_tl} {\l__um_alphabet_tl} } { - \um_maybe_init_alphabet:V \l_um_style_tl + \__um_maybe_init_alphabet:n \l__um_style_tl \clist_map_break: } } } + { \msg_warning:nnx {unicode-math} {no-alphabet} { \l__um_style_tl / \l__um_alphabet_tl } } } - \clist_map_inline:nn {#2} + \csname TIC\endcsname + \clist_map_inline:Nn #2 { - \tl_set:Nx \l_um_tmpa_tl { \tl_trim_spaces:n {##1} } - \cs_if_exist:cT {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} + \tl_set:Nx \l__um_alphabet_tl { \tl_trim_spaces:n {##1} } + \cs_if_exist:cT {__um_config_ \l__um_style_tl _ \l__um_alphabet_tl :n} { - \str_if_eq_x:nnTF {\l_um_tmpa_tl}{misc} + \exp_args:No \tl_if_eq:nnTF \l__um_alphabet_tl {misc} { - \um_log:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} + \__um_log:nx {setup-alph} {math \l__um_style_tl~(\l__um_alphabet_tl)} + \__um_alphabet_config:nnn {\l__um_style_tl} {\l__um_alphabet_tl} {#3} } { - \um_glyph_if_exist:cTF { \um_to_usv:nn {#3}{\l_um_tmpa_tl} } + \__um_glyph_if_exist:nTF { \__um_to_usv:nn {\l__um_style_tl} {\l__um_alphabet_tl} } { - \um_log:nx {setup-alph} {math \l_um_style_tl~(\l_um_tmpa_tl)} - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {#3} + \__um_log:nx {setup-alph} {math \l__um_style_tl~(\l__um_alphabet_tl)} + \__um_alphabet_config:nnn {\l__um_style_tl} {\l__um_alphabet_tl} {#3} } { - \bool_if:NTF \l_um_implicit_alph_bool + \bool_if:NTF \l__um_implicit_alph_bool { - \seq_put_right:Nx \l_um_missing_alph_seq + \seq_put_right:Nx \l__um_missing_alph_seq { - \@backslashchar math \l_um_style_tl \space - (\tl_use:c{c_um_math_alphabet_name_ \l_um_tmpa_tl _tl}) + \@backslashchar sym \l__um_style_tl \space + (\tl_use:c{c__um_math_alphabet_name_ \l__um_alphabet_tl _tl}) } } { - \use:c {um_config_ \l_um_style_tl _ \l_um_tmpa_tl :n} {up} + \__um_alphabet_config:nnn {\l__um_style_tl} {\l__um_alphabet_tl} {up} } } } } } + \csname TOC\endcsname } -\cs_generate_variant:Nn \um_setup_math_alphabet:Nnn {VVV} -\cs_new:Npn \um_map_char_single:cc { \exp_args:Ncc \um_map_char_single:nn } -\cs_new:Nn \um_map_char_noparse:nn +\cs_new:Nn \__um_map_char_noparse:nn + { \__um_set_mathcode:nnnn {#1}{\mathalpha}{\__um_symfont_tl}{#2} } +\cs_new:Nn \__um_map_char_parse:nn { - \um_set_mathcode:nnnn {#1}{\mathalpha}{\um_symfont_tl}{#2} + \__um_if_char_spec:nNNT {#1} {\@nil} {\mathalpha} + { \__um_map_char_noparse:nn {#1}{#2} } } -\cs_new:Nn \um_map_char_parse:nn +\cs_new:Nn \__um_map_char_single:nnn { - \um_if_char_spec:nNNT {#1} {\@nil} {\mathalpha} - { - \um_map_char_noparse:nn {#1}{#2} - } + \__um_map_char_single:nn { \__um_to_usv:nn {#1}{#3} } + { \__um_to_usv:nn {#2}{#3} } } -\cs_new:Nn \um_map_char_single:nnn +\cs_set:Nn \__um_map_chars_range:nnn { - \um_map_char_single:cc { \um_to_usv:nn {#1}{#3} } - { \um_to_usv:nn {#2}{#3} } + \int_step_inline:nnnn {0}{1}{#1-1} + { \__um_map_char_single:nn {#2+##1}{#3+##1} } } -\cs_set:Nn \um_map_single:nnn +\cs_new:Nn \__um_map_chars_range:nnnn { - \cs_if_exist:cT { \um_to_usv:nn {#3} {#1} } + \__um_map_chars_range:nnn {#1} { \__um_to_usv:nn {#2}{#4} } + { \__um_to_usv:nn {#3}{#4} } + } +\cs_set:Nn \__um_set_normal_char:nnn + { + \__um_usv_if_exist:nnT {#3} {#1} { \clist_map_inline:nn {#2} { - \um_map_char_single:nnn {##1} {#3} {#1} + \__um_set_mathalphabet_pos:nnnn {normal} {#1} {##1} {#3} + \__um_map_char_single:nnn {##1} {#3} {#1} } } } -\cs_set:Nn \um_map_chars_range:nnn - { - \int_step_inline:nnnn {0}{1}{#1-1} { - \um_map_char_single:nn {#2+##1}{#3+##1} - } - } -\cs_generate_variant:Nn \um_map_chars_range:nnn {ncc} -\cs_new:Nn \um_map_chars_range:nnnn - { - \um_map_chars_range:ncc {#1} { \um_to_usv:nn {#2}{#4} } - { \um_to_usv:nn {#3}{#4} } - } -\cs_new:Nn \um_map_chars_Latin:nn +\cs_new:Nn \__um_set_normal_Latin:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {26} {##1} {#2} {Latin} + \__um_set_mathalphabet_Latin:nnn {normal} {##1} {#2} + \__um_map_chars_range:nnnn {26} {##1} {#2} {Latin} } } -\cs_new:Nn \um_map_chars_latin:nn +\cs_new:Nn \__um_set_normal_latin:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {26} {##1} {#2} {latin} + \__um_set_mathalphabet_latin:nnn {normal} {##1} {#2} + \__um_map_chars_range:nnnn {26} {##1} {#2} {latin} } } -\cs_new:Nn \um_map_chars_greek:nn +\cs_new:Nn \__um_set_normal_greek:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {25} {##1} {#2} {greek} - \um_map_char_single:nnn {##1} {#2} {varepsilon} - \um_map_char_single:nnn {##1} {#2} {vartheta} - \um_map_char_single:nnn {##1} {#2} {varkappa} - \um_map_char_single:nnn {##1} {#2} {varphi} - \um_map_char_single:nnn {##1} {#2} {varrho} - \um_map_char_single:nnn {##1} {#2} {varpi} + \__um_set_mathalphabet_greek:nnn {normal} {##1} {#2} + \__um_map_chars_range:nnnn {25} {##1} {#2} {greek} + \__um_map_char_single:nnn {##1} {#2} {varepsilon} + \__um_map_char_single:nnn {##1} {#2} {vartheta} + \__um_map_char_single:nnn {##1} {#2} {varkappa} + \__um_map_char_single:nnn {##1} {#2} {varphi} + \__um_map_char_single:nnn {##1} {#2} {varrho} + \__um_map_char_single:nnn {##1} {#2} {varpi} + \__um_set_mathalphabet_pos:nnnn {normal} {varepsilon} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {vartheta} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {varkappa} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {varphi} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {varrho} {##1} {#2} + \__um_set_mathalphabet_pos:nnnn {normal} {varpi} {##1} {#2} } } -\cs_new:Nn \um_map_chars_Greek:nn +\cs_new:Nn \__um_set_normal_Greek:nn { \clist_map_inline:nn {#1} { - \um_map_chars_range:nnnn {25} {##1} {#2} {Greek} - \um_map_char_single:nnn {##1} {#2} {varTheta} + \__um_set_mathalphabet_Greek:nnn {normal} {##1} {#2} + \__um_map_chars_range:nnnn {25} {##1} {#2} {Greek} + \__um_map_char_single:nnn {##1} {#2} {varTheta} + \__um_set_mathalphabet_pos:nnnn {normal} {varTheta} {##1} {#2} } } -\cs_new:Nn \um_map_chars_numbers:nn +\cs_new:Nn \__um_set_normal_numbers:nn { - \um_map_chars_range:nnnn {10} {#1} {#2} {num} + \__um_set_mathalphabet_numbers:nnn {normal} {#1} {#2} + \__um_map_chars_range:nnnn {10} {#1} {#2} {num} } -\cs_new:Npn \um_set_mathalphabet_char:Ncc - { - \exp_args:NNcc \um_set_mathalphabet_char:Nnn - } -\cs_new:Nn \um_mathmap_noparse:Nnn +\cs_new:Nn \__um_mathmap_noparse:nnn { \clist_map_inline:nn {#2} { - \tl_put_right:cx {um_switchto_\cs_to_str:N #1:} + \tl_put_right:cx {__um_switchto_#1:} { - \um_set_mathcode:nnnn{##1}{\mathalpha}{\um_symfont_tl}{#3} + \__um_set_mathcode:nnnn {##1} {\mathalpha} {\__um_symfont_tl} {#3} } } } -\cs_new:Nn \um_mathmap_parse:Nnn +\cs_new:Nn \__um_mathmap_parse:nnn { - \clist_if_in:NnT \l_um_char_num_range_clist {#3} + \clist_if_in:NnT \l__um_char_nrange_clist {#3} { - \um_mathmap_noparse:Nnn {#1}{#2}{#3} + \__um_mathmap_noparse:nnn {#1}{#2}{#3} } } -\cs_new:Nn \um_set_mathalphabet_char:Nnnn +\cs_new:Nn \__um_set_mathalphabet_char:nnnn { - \um_set_mathalphabet_char:Ncc #1 { \um_to_usv:nn {#2} {#4} } - { \um_to_usv:nn {#3} {#4} } + \__um_set_mathalphabet_char:nnn {#1} { \__um_to_usv:nn {#2} {#4} } + { \__um_to_usv:nn {#3} {#4} } } -\cs_new:Nn \um_set_mathalph_range:nNnn +\cs_new:Nn \__um_set_mathalph_range:nnnn { - \int_step_inline:nnnn {0}{1}{#1-1} - { \um_set_mathalphabet_char:Nnn {#2} { ##1 + #3 } { ##1 + #4 } } + \int_step_inline:nnnn {0} {1} {#1-1} + { \__um_set_mathalphabet_char:nnn {#2} { ##1 + #3 } { ##1 + #4 } } } -\cs_generate_variant:Nn \um_set_mathalph_range:nNnn {nNcc} -\cs_new:Nn \um_set_mathalph_range:nNnnn +\cs_new:Nn \__um_set_mathalph_range:nnnnn { - \um_set_mathalph_range:nNcc {#1} #2 { \um_to_usv:nn {#3} {#5} } - { \um_to_usv:nn {#4} {#5} } + \__um_set_mathalph_range:nnnn {#1} {#2} { \__um_to_usv:nn {#3} {#5} } + { \__um_to_usv:nn {#4} {#5} } } -\cs_new:Nn \um_set_mathalphabet_pos:Nnnn +\cs_new:Nn \__um_set_mathalphabet_pos:nnnn { - \cs_if_exist:cT { \um_to_usv:nn {#4}{#2} } + \__um_usv_if_exist:nnT {#4} {#2} { \clist_map_inline:nn {#3} - { \um_set_mathalphabet_char:Nnnn #1 {##1} {#4} {#2} } + { \__um_set_mathalphabet_char:nnnn {#1} {##1} {#4} {#2} } } } -\cs_new:Nn \um_set_mathalphabet_numbers:Nnn +\cs_new:Nn \__um_set_mathalphabet_numbers:nnn { \clist_map_inline:nn {#2} - { \um_set_mathalph_range:nNnnn {10} #1 {##1} {#3} {num} } + { \__um_set_mathalph_range:nnnnn {10} {#1} {##1} {#3} {num} } } -\cs_new:Nn \um_set_mathalphabet_Latin:Nnn +\cs_new:Nn \__um_set_mathalphabet_Latin:nnn { \clist_map_inline:nn {#2} - { \um_set_mathalph_range:nNnnn {26} #1 {##1} {#3} {Latin} } + { \__um_set_mathalph_range:nnnnn {26} {#1} {##1} {#3} {Latin} } } -\cs_new:Nn \um_set_mathalphabet_latin:Nnn +\cs_new:Nn \__um_set_mathalphabet_latin:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {26} #1 {##1} {#3} {latin} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {h} + \__um_set_mathalph_range:nnnnn {26} {#1} {##1} {#3} {latin} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {h} } } -\cs_new:Nn \um_set_mathalphabet_Greek:Nnn +\cs_new:Nn \__um_set_mathalphabet_Greek:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {25} #1 {##1} {#3} {Greek} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varTheta} + \__um_set_mathalph_range:nnnnn {25} {#1} {##1} {#3} {Greek} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varTheta} } } -\cs_new:Nn \um_set_mathalphabet_greek:Nnn +\cs_new:Nn \__um_set_mathalphabet_greek:nnn { \clist_map_inline:nn {#2} { - \um_set_mathalph_range:nNnnn {25} #1 {##1} {#3} {greek} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varepsilon} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {vartheta} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varkappa} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varphi} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varrho} - \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varpi} - } - } -\cs_new:Nn \um_config_up_num:n - { - \um_map_chars_numbers:nn {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathup {up}{#1} - } - -\cs_new:Nn \um_config_up_Latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Latin:nn {up} {#1} } - { - \bool_if:NT \g_um_upLatin_bool { \um_map_chars_Latin:nn {up,it} {#1} } - } - \um_set_mathalphabet_Latin:Nnn \mathup {up,it} {#1} - } - -\cs_new:Nn \um_config_up_latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_latin:nn {up} {#1} } - { - \bool_if:NT \g_um_uplatin_bool - { - \um_map_chars_latin:nn {up,it} {#1} - \um_map_single:nnn {h} {up,it} {#1} - \um_map_single:nnn {dotlessi} {up,it} {#1} - \um_map_single:nnn {dotlessj} {up,it} {#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathup {up,it}{#1} - } - -\cs_new:Nn \um_config_up_Greek:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Greek:nn {up}{#1} } - { - \bool_if:NT \g_um_upGreek_bool { \um_map_chars_Greek:nn {up,it}{#1} } - } - \um_set_mathalphabet_Greek:Nnn \mathup {up,it}{#1} - } - -\cs_new:Nn \um_config_up_greek:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_greek:nn {up} {#1} } - { - \bool_if:NT \g_um_upgreek_bool - { - \um_map_chars_greek:nn {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathup {up,it} {#1} - } - -\cs_new:Nn \um_config_up_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{up}{up} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{up,it}{up} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{up}{up} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{up,it}{up} - } - } - \um_set_mathalphabet_pos:Nnnn \mathup {partial} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {Nabla} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {dotlessi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathup {dotlessj} {up,it} {#1} - } -\cs_new:Nn \um_config_it_Latin:n - { - \bool_if:NTF \g_um_literal_bool { \um_map_chars_Latin:nn {it} {#1} } - { - \bool_if:NF \g_um_upLatin_bool { \um_map_chars_Latin:nn {up,it} {#1} } - } - \um_set_mathalphabet_Latin:Nnn \mathit {up,it}{#1} - } - -\cs_new:Nn \um_config_it_latin:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_latin:nn {it} {#1} - \um_map_single:nnn {h}{it}{#1} - } - { - \bool_if:NF \g_um_uplatin_bool - { - \um_map_chars_latin:nn {up,it} {#1} - \um_map_single:nnn {h}{up,it}{#1} - \um_map_single:nnn {dotlessi}{up,it}{#1} - \um_map_single:nnn {dotlessj}{up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathit {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathit {dotlessi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathit {dotlessj} {up,it} {#1} - } - -\cs_new:Nn \um_config_it_Greek:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_Greek:nn {it}{#1} - } - { - \bool_if:NF \g_um_upGreek_bool { \um_map_chars_Greek:nn {up,it}{#1} } - } - \um_set_mathalphabet_Greek:Nnn \mathit {up,it}{#1} - } - -\cs_new:Nn \um_config_it_greek:n - { - \bool_if:NTF \g_um_literal_bool - { - \um_map_chars_greek:nn {it} {#1} - } - { - \bool_if:NF \g_um_upgreek_bool { \um_map_chars_greek:nn {it,up} {#1} } - } - \um_set_mathalphabet_greek:Nnn \mathit {up,it} {#1} - } - -\cs_new:Nn \um_config_it_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{it}{it} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{up,it}{it} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{it}{it} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{up,it}{it} - } - } - \um_set_mathalphabet_pos:Nnnn \mathit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathit {Nabla} {up,it}{#1} - } -\cs_new:Nn \um_config_bb_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbb {up,it}{#1} - } - -\cs_new:Nn \um_config_bb_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbb {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {C} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {H} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {N} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {P} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Q} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {R} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Z} {up,it} {#1} - } - -\cs_new:Nn \um_config_bb_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbb {up}{#1} - } - -\cs_new:Nn \um_config_bb_misc:n - { - \um_set_mathalphabet_pos:Nnnn \mathbb {Pi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {pi} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {Gamma} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {gamma} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbb {summation} {up} {#1} - } - -\cs_new:Nn \um_config_bbit_misc:n - { - \um_set_mathalphabet_pos:Nnnn \mathbbit {D} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {d} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {e} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {i} {up,it} {#1} - \um_set_mathalphabet_pos:Nnnn \mathbbit {j} {up,it} {#1} - } -\cs_new:Nn \um_config_scr_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathscr {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {B}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {E}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {F}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {L}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {M}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {R}{up,it}{#1} - } - -\cs_new:Nn \um_config_scr_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathscr {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {e}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {g}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathscr {o}{up,it}{#1} - } -\cs_new:Nn \um_config_cal_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathcal {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {B}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {E}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {F}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {L}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {M}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathcal {R}{up,it}{#1} - } -\cs_new:Nn \um_config_frak_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathfrak {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {C}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {H}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {I}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {R}{up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathfrak {Z}{up,it}{#1} - } -\cs_new:Nn \um_config_frak_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathfrak {up,it}{#1} - } -\cs_new:Nn \um_config_sfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathsf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathsfup {up}{#1} - } -\cs_new:Nn \um_config_sfup_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {sfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathsfup {up,it}{#1} - } -\cs_new:Nn \um_config_sfup_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {sfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathsfup {up,it}{#1} - } -\cs_new:Nn \um_config_sfit_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathsfit {up,it}{#1} - } -\cs_new:Nn \um_config_sfit_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_latin:nn {sfup,sfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathsfit {up,it}{#1} - } -\cs_new:Nn \um_config_tt_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathtt {up}{#1} - } -\cs_new:Nn \um_config_tt_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathtt {up,it}{#1} - } -\cs_new:Nn \um_config_tt_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathtt {up,it}{#1} - } -\cs_new:Nn \um_config_bfit_Latin:n - { - \bool_if:NF \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_Latin:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Latin:nn {bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_latin:n - { - \bool_if:NF \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_latin:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_latin:nn {bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_Greek:n - { - \um_set_mathalphabet_Greek:Nnn \mathbfit {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Greek:nn {bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {it}{#1} - } - { - \bool_if:NF \g_um_bfupGreek_bool - { - \um_map_chars_Greek:nn {bfup,bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfit_greek:n - { - \um_set_mathalphabet_greek:Nnn \mathbfit {up,it} {#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_greek:nn {bfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {it} {#1} - } - { - \bool_if:NF \g_um_bfupgreek_bool - { - \um_map_chars_greek:nn {bfit,bfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up,it} {#1} - } - } - } - -\cs_new:Nn \um_config_bfit_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { \um_map_single:nnn {Nabla}{bfit}{#1} } - { - \bool_if:NF \g_um_upNabla_bool - { \um_map_single:nnn {Nabla}{bfup,bfit}{#1} } - } - \bool_if:NTF \g_um_literal_partial_bool - { \um_map_single:nnn {partial}{bfit}{#1} } - { - \bool_if:NF \g_um_uppartial_bool - { \um_map_single:nnn {partial}{bfup,bfit}{#1} } - } - \um_set_mathalphabet_pos:Nnnn \mathbfit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfit {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {it}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {it}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up,it}{#1} - } - } - } -\cs_new:Nn \um_config_bfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathbfup {up}{#1} - } - -\cs_new:Nn \um_config_bfup_Latin:n - { - \bool_if:NT \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_Latin:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Latin:nn {bfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfupLatin_bool - { - \um_map_chars_Latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfup_latin:n - { - \bool_if:NT \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - } - \um_set_mathalphabet_latin:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_latin:nn {bfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfuplatin_bool - { - \um_map_chars_latin:nn {bfup,bfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbf {up,it}{#1} - } - } - } -\cs_new:Nn \um_config_bfup_Greek:n - { - \um_set_mathalphabet_Greek:Nnn \mathbfup {up,it}{#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_Greek:nn {bfup}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up}{#1} - } - { - \bool_if:NT \g_um_bfupGreek_bool - { - \um_map_chars_Greek:nn {bfup,bfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbf {up,it}{#1} - } - } - } - -\cs_new:Nn \um_config_bfup_greek:n - { - \um_set_mathalphabet_greek:Nnn \mathbfup {up,it} {#1} - \bool_if:NTF \g_um_bfliteral_bool - { - \um_map_chars_greek:nn {bfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up} {#1} - } - { - \bool_if:NT \g_um_bfupgreek_bool - { - \um_map_chars_greek:nn {bfup,bfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbf {up,it} {#1} - } - } - } - -\cs_new:Nn \um_config_bfup_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfup}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfup,bfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfup}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfup,bfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfup {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {Nabla} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfup {Digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbf {digamma} {up}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbf {Digamma} {up}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbf {Nabla} {up,it}{#1} - } - } - } -\cs_new:Nn \um_config_bffrak_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbffrak {up,it}{#1} - } - -\cs_new:Nn \um_config_bffrak_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbffrak {up,it}{#1} - } -\cs_new:Nn \um_config_bfscr_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbfscr {up,it}{#1} - } -\cs_new:Nn \um_config_bfscr_latin:n - { - \um_set_mathalphabet_latin:Nnn \mathbfscr {up,it}{#1} - } -\cs_new:Nn \um_config_bfcal_Latin:n - { - \um_set_mathalphabet_Latin:Nnn \mathbfcal {up,it}{#1} - } -\cs_new:Nn \um_config_bfsfup_num:n - { - \um_set_mathalphabet_numbers:Nnn \mathbfsf {up}{#1} - \um_set_mathalphabet_numbers:Nnn \mathbfsfup {up}{#1} - } -\cs_new:Nn \um_config_bfsfup_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {bfsfup} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {bfsfup} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_Greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Greek:nn {bfsfup}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up}{#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_Greek:nn {bfsfup,bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Greek:Nnn \mathbfsfup {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfup_greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_greek:nn {bfsfup} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up} {#1} - } - { - \bool_if:NT \g_um_upsans_bool - { - \um_map_chars_greek:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathbfsfup {up,it} {#1} - } -\cs_new:Nn \um_config_bfsfup_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup,bfsfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfsfup}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfsfup,bfsfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfsfup {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfsfup {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up}{#1} - } - { - \bool_if:NT \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up}{#1} - } - { - \bool_if:NT \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up,it}{#1} - } + \__um_set_mathalph_range:nnnnn {25} {#1} {##1} {#3} {greek} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varepsilon} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {vartheta} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varkappa} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varphi} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varrho} + \__um_set_mathalphabet_char:nnnn {#1} {##1} {#3} {varpi} } } -\cs_new:Nn \um_config_bfsfit_Latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Latin:nn {bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_Latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Latin:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_latin:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_latin:nn {bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_latin:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_latin:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_latin:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_Greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_Greek:nn {bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {it}{#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_Greek:nn {bfsfup,bfsfit}{#1} - \um_set_mathalphabet_Greek:Nnn \mathbfsf {up,it}{#1} - } - } - \um_set_mathalphabet_Greek:Nnn \mathbfsfit {up,it}{#1} - } - -\cs_new:Nn \um_config_bfsfit_greek:n - { - \bool_if:NTF \g_um_sfliteral_bool - { - \um_map_chars_greek:nn {bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {it} {#1} - } - { - \bool_if:NF \g_um_upsans_bool - { - \um_map_chars_greek:nn {bfsfup,bfsfit} {#1} - \um_set_mathalphabet_greek:Nnn \mathbfsf {up,it} {#1} - } - } - \um_set_mathalphabet_greek:Nnn \mathbfsfit {up,it} {#1} - } - -\cs_new:Nn \um_config_bfsfit_misc:n - { - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_map_single:nnn {Nabla}{bfsfit}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_map_single:nnn {Nabla}{bfsfup,bfsfit}{#1} - } - } - \bool_if:NTF \g_um_literal_partial_bool - { - \um_map_single:nnn {partial}{bfsfit}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_map_single:nnn {partial}{bfsfup,bfsfit}{#1} - } - } - \um_set_mathalphabet_pos:Nnnn \mathbfsfit {partial} {up,it}{#1} - \um_set_mathalphabet_pos:Nnnn \mathbfsfit {Nabla} {up,it}{#1} - \bool_if:NTF \g_um_literal_partial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {it}{#1} - } - { - \bool_if:NF \g_um_uppartial_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {partial} {up,it}{#1} - } - } - \bool_if:NTF \g_um_literal_Nabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {it}{#1} - } - { - \bool_if:NF \g_um_upNabla_bool - { - \um_set_mathalphabet_pos:Nnnn \mathbfsf {Nabla} {up,it}{#1} - } - } - } -\cs_new:Npn \um_symbol_setup: +\cs_new:Npn \__um_symbol_setup: { \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { - \exp_not:n { \_um_sym:nnn {##1} {##2} {##3} } + \exp_not:n { \__um_sym:nnn {##1} {##2} {##3} } } } -\CatchFileEdef \g_um_mathtable_tl {unicode-math-table.tex} {\um_symbol_setup:} -\cs_new:Nn \um_input_math_symbol_table: {\g_um_mathtable_tl} +\CatchFileEdef \g__um_mathtable_tl {unicode-math-table.tex} {\__um_symbol_setup:} +\cs_new:Nn \__um_input_math_symbol_table: {\g__um_mathtable_tl} \group_begin: \char_set_catcode_other:N \^ - \cs_gset:Npn \um_cs_set_eq_active_char:Nw #1 = "#2 \q_nil + \cs_gset:Npn \__um_cs_set_eq_active_char:Nw #1 = "#2 \q_nil { \tex_lowercase:D { @@ -2098,7 +1206,7 @@ } } } - \cs_new:Npn \um_active_char_set:wc "#1 \q_nil #2 + \cs_new:Npn \__um_active_char_set:wc "#1 \q_nil #2 { \tex_lowercase:D { @@ -2107,25 +1215,22 @@ } } \group_end: -\AtBeginDocument{\um_define_math_chars:} -\cs_new:Nn \um_define_math_chars: +\AtBeginDocument{\__um_define_math_chars:} +\cs_new:Nn \__um_define_math_chars: { \group_begin: \char_set_catcode_math_superscript:N \^ - \cs_set:Npn \_um_sym:nnn ##1##2##3 + \cs_set:Npn \__um_sym:nnn ##1##2##3 { - \bool_if:nF { \cs_if_eq_p:NN ##3 \mathaccent || - \cs_if_eq_p:NN ##3 \mathopen || - \cs_if_eq_p:NN ##3 \mathclose || - \cs_if_eq_p:NN ##3 \mathover || - \cs_if_eq_p:NN ##3 \mathunder || - \cs_if_eq_p:NN ##3 \mathbotaccent } + \tl_if_in:nnT + { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence } + {##3} { - \um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces + \__um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces } } \char_set_catcode_other:N \# - \um_input_math_symbol_table: + \__um_input_math_symbol_table: \group_end: } \group_begin: @@ -2140,171 +1245,169 @@ } } |group_end: -\AtBeginDocument { \um_load_lm_if_necessary: } -\cs_new:Nn \um_load_lm_if_necessary: +\AtBeginDocument { \__um_load_lm_if_necessary: } +\cs_new:Nn \__um_load_lm_if_necessary: { - \cs_if_exist:NF \l_um_fontname_tl + \cs_if_exist:NF \l__um_fontname_tl { - % XXX: update this when lmmath-bold.otf is released - \setmathfont[BoldFont={latinmodern-math.otf}]{latinmodern-math.otf} + % 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 +\cs_new:Nn \__um_arg_i_before_egroup:n {#1\egroup} +\cs_new:Nn \__um_superscript:n { ^\bgroup #1 - \peek_meaning_remove:NTF ^ \um_arg_i_before_egroup:n \egroup + \peek_meaning_remove:NTF ^ \__um_arg_i_before_egroup:n \egroup } -\muskip_new:N \g_um_primekern_muskip -\muskip_gset:Nn \g_um_primekern_muskip { -\thinmuskip/2 }% arbitrary -\int_new:N \l_um_primecount_int -\cs_new:Nn \um_nprimes:Nn +\cs_new:Nn \__um_nprimes:Nn { - \um_superscript:n + \__um_superscript:n { #1 - \prg_replicate:nn {#2-1} { \mskip \g_um_primekern_muskip #1 } + \prg_replicate:nn {#2-1} { \mskip \g__um_primekern_muskip #1 } } } -\cs_new:Nn \um_nprimes_select:nn +\cs_new:Nn \__um_nprimes_select:nn { - \int_case:nnn {#2} + \int_case:nnF {#2} { - {1} { \um_superscript:n {#1} } + {1} { \__um_superscript:n {#1} } {2} { - \um_glyph_if_exist:nTF {"2033} - { \um_superscript:n {\um_prime_double_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2033} + { \__um_superscript:n {\__um_prime_double_mchar} } + { \__um_nprimes:Nn #1 {#2} } } {3} { - \um_glyph_if_exist:nTF {"2034} - { \um_superscript:n {\um_prime_triple_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2034} + { \__um_superscript:n {\__um_prime_triple_mchar} } + { \__um_nprimes:Nn #1 {#2} } } {4} { - \um_glyph_if_exist:nTF {"2057} - { \um_superscript:n {\um_prime_quad_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2057} + { \__um_superscript:n {\__um_prime_quad_mchar} } + { \__um_nprimes:Nn #1 {#2} } } } { - \um_nprimes:Nn #1 {#2} + \__um_nprimes:Nn #1 {#2} } } -\cs_new:Nn \um_nbackprimes_select:nn +\cs_new:Nn \__um_nbackprimes_select:nn { - \int_case:nnn {#2} + \int_case:nnF {#2} { - {1} { \um_superscript:n {#1} } + {1} { \__um_superscript:n {#1} } {2} { - \um_glyph_if_exist:nTF {"2036} - { \um_superscript:n {\um_backprime_double_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2036} + { \__um_superscript:n {\__um_backprime_double_mchar} } + { \__um_nprimes:Nn #1 {#2} } } {3} { - \um_glyph_if_exist:nTF {"2037} - { \um_superscript:n {\um_backprime_triple_mchar} } - { \um_nprimes:Nn #1 {#2} } + \__um_glyph_if_exist:nTF {"2037} + { \__um_superscript:n {\__um_backprime_triple_mchar} } + { \__um_nprimes:Nn #1 {#2} } } } { - \um_nprimes:Nn #1 {#2} + \__um_nprimes:Nn #1 {#2} } } -\cs_new:Npn \um_scan_prime: +\cs_new:Npn \__um_scan_prime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_zero:N \l_um_primecount_int - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_zero:N \l__um_primecount_int + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_dprime: +\cs_new:Npn \__um_scan_dprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {1} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {1} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_trprime: +\cs_new:Npn \__um_scan_trprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {2} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_qprime: +\cs_new:Npn \__um_scan_qprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N \um_prime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {3} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_sup_prime: +\cs_new:Npn \__um_scan_sup_prime: { - \int_zero:N \l_um_primecount_int - \um_scanprime_collect:N \um_prime_single_mchar + \int_zero:N \l__um_primecount_int + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_sup_dprime: +\cs_new:Npn \__um_scan_sup_dprime: { - \int_set:Nn \l_um_primecount_int {1} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l__um_primecount_int {1} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_sup_trprime: +\cs_new:Npn \__um_scan_sup_trprime: { - \int_set:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l__um_primecount_int {2} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Npn \um_scan_sup_qprime: +\cs_new:Npn \__um_scan_sup_qprime: { - \int_set:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N \um_prime_single_mchar + \int_set:Nn \l__um_primecount_int {3} + \__um_scanprime_collect:N \__um_prime_single_mchar } -\cs_new:Nn \um_scanprime_collect:N +\cs_new:Nn \__um_scanprime_collect:N { - \int_incr:N \l_um_primecount_int + \int_incr:N \l__um_primecount_int \peek_meaning_remove:NTF ' - { \um_scanprime_collect:N #1 } + { \__um_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_prime: - { \um_scanprime_collect:N #1 } + \peek_meaning_remove:NTF \__um_scan_prime: + { \__um_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2032 - { \um_scanprime_collect:N #1 } + { \__um_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_dprime: + \peek_meaning_remove:NTF \__um_scan_dprime: { - \int_incr:N \l_um_primecount_int - \um_scanprime_collect:N #1 + \int_incr:N \l__um_primecount_int + \__um_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2033 { - \int_incr:N \l_um_primecount_int - \um_scanprime_collect:N #1 + \int_incr:N \l__um_primecount_int + \__um_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_trprime: + \peek_meaning_remove:NTF \__um_scan_trprime: { - \int_add:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {2} + \__um_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2034 { - \int_add:Nn \l_um_primecount_int {2} - \um_scanprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {2} + \__um_scanprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_qprime: + \peek_meaning_remove:NTF \__um_scan_qprime: { - \int_add:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {3} + \__um_scanprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2057 { - \int_add:Nn \l_um_primecount_int {3} - \um_scanprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {3} + \__um_scanprime_collect:N #1 } { - \um_nprimes_select:nn {#1} {\l_um_primecount_int} + \__um_nprimes_select:nn {#1} {\l__um_primecount_int} } } } @@ -2315,82 +1418,82 @@ } } } -\cs_new:Npn \um_scan_backprime: +\cs_new:Npn \__um_scan_backprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_zero:N \l_um_primecount_int - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_zero:N \l__um_primecount_int + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_backdprime: +\cs_new:Npn \__um_scan_backdprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {1} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {1} + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_backtrprime: +\cs_new:Npn \__um_scan_backtrprime: { - \cs_set_eq:NN \um_superscript:n \use:n - \int_set:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \cs_set_eq:NN \__um_superscript:n \use:n + \int_set:Nn \l__um_primecount_int {2} + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backprime: +\cs_new:Npn \__um_scan_sup_backprime: { - \int_zero:N \l_um_primecount_int - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_zero:N \l__um_primecount_int + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backdprime: +\cs_new:Npn \__um_scan_sup_backdprime: { - \int_set:Nn \l_um_primecount_int {1} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_set:Nn \l__um_primecount_int {1} + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Npn \um_scan_sup_backtrprime: +\cs_new:Npn \__um_scan_sup_backtrprime: { - \int_set:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N \um_backprime_single_mchar + \int_set:Nn \l__um_primecount_int {2} + \__um_scanbackprime_collect:N \__um_backprime_single_mchar } -\cs_new:Nn \um_scanbackprime_collect:N +\cs_new:Nn \__um_scanbackprime_collect:N { - \int_incr:N \l_um_primecount_int + \int_incr:N \l__um_primecount_int \peek_meaning_remove:NTF ` { - \um_scanbackprime_collect:N #1 + \__um_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backprime: + \peek_meaning_remove:NTF \__um_scan_backprime: { - \um_scanbackprime_collect:N #1 + \__um_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2035 { - \um_scanbackprime_collect:N #1 + \__um_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backdprime: + \peek_meaning_remove:NTF \__um_scan_backdprime: { - \int_incr:N \l_um_primecount_int - \um_scanbackprime_collect:N #1 + \int_incr:N \l__um_primecount_int + \__um_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2036 { - \int_incr:N \l_um_primecount_int - \um_scanbackprime_collect:N #1 + \int_incr:N \l__um_primecount_int + \__um_scanbackprime_collect:N #1 } { - \peek_meaning_remove:NTF \um_scan_backtrprime: + \peek_meaning_remove:NTF \__um_scan_backtrprime: { - \int_add:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {2} + \__um_scanbackprime_collect:N #1 } { \peek_meaning_remove:NTF ^^^^2037 { - \int_add:Nn \l_um_primecount_int {2} - \um_scanbackprime_collect:N #1 + \int_add:Nn \l__um_primecount_int {2} + \__um_scanbackprime_collect:N #1 } { - \um_nbackprimes_select:nn {#1} {\l_um_primecount_int} + \__um_nbackprimes_select:nn {#1} {\l__um_primecount_int} } } } @@ -2399,16 +1502,16 @@ } } } -\AtBeginDocument{\um_define_prime_commands: \um_define_prime_chars:} -\cs_new:Nn \um_define_prime_commands: +\AtBeginDocument{\__um_define_prime_commands: \__um_define_prime_chars:} +\cs_new:Nn \__um_define_prime_commands: { - \cs_set_eq:NN \prime \um_prime_single_mchar - \cs_set_eq:NN \dprime \um_prime_double_mchar - \cs_set_eq:NN \trprime \um_prime_triple_mchar - \cs_set_eq:NN \qprime \um_prime_quad_mchar - \cs_set_eq:NN \backprime \um_backprime_single_mchar - \cs_set_eq:NN \backdprime \um_backprime_double_mchar - \cs_set_eq:NN \backtrprime \um_backprime_triple_mchar + \cs_set_eq:NN \prime \__um_prime_single_mchar + \cs_set_eq:NN \dprime \__um_prime_double_mchar + \cs_set_eq:NN \trprime \__um_prime_triple_mchar + \cs_set_eq:NN \qprime \__um_prime_quad_mchar + \cs_set_eq:NN \backprime \__um_backprime_single_mchar + \cs_set_eq:NN \backdprime \__um_backprime_double_mchar + \cs_set_eq:NN \backtrprime \__um_backprime_triple_mchar } \group_begin: \char_set_catcode_active:N \' @@ -2420,21 +1523,21 @@ \char_set_catcode_active:n {"2035} \char_set_catcode_active:n {"2036} \char_set_catcode_active:n {"2037} - \cs_gset:Nn \um_define_prime_chars: - { - \cs_set_eq:NN ' \um_scan_sup_prime: - \cs_set_eq:NN ^^^^2032 \um_scan_sup_prime: - \cs_set_eq:NN ^^^^2033 \um_scan_sup_dprime: - \cs_set_eq:NN ^^^^2034 \um_scan_sup_trprime: - \cs_set_eq:NN ^^^^2057 \um_scan_sup_qprime: - \cs_set_eq:NN ` \um_scan_sup_backprime: - \cs_set_eq:NN ^^^^2035 \um_scan_sup_backprime: - \cs_set_eq:NN ^^^^2036 \um_scan_sup_backdprime: - \cs_set_eq:NN ^^^^2037 \um_scan_sup_backtrprime: + \cs_gset:Nn \__um_define_prime_chars: + { + \cs_set_eq:NN ' \__um_scan_sup_prime: + \cs_set_eq:NN ^^^^2032 \__um_scan_sup_prime: + \cs_set_eq:NN ^^^^2033 \__um_scan_sup_dprime: + \cs_set_eq:NN ^^^^2034 \__um_scan_sup_trprime: + \cs_set_eq:NN ^^^^2057 \__um_scan_sup_qprime: + \cs_set_eq:NN ` \__um_scan_sup_backprime: + \cs_set_eq:NN ^^^^2035 \__um_scan_sup_backprime: + \cs_set_eq:NN ^^^^2036 \__um_scan_sup_backdprime: + \cs_set_eq:NN ^^^^2037 \__um_scan_sup_backtrprime: } \group_end: -\AtBeginDocument{\um_redefine_radical:} -\cs_new:Nn \um_redefine_radical: +\AtBeginDocument{\__um_redefine_radical:} +\cs_new:Nn \__um_redefine_radical: { \@ifpackageloaded { amsmath } { } { @@ -2448,140 +1551,143 @@ \sqrtsign { ##2 } \c_math_toggle_token } - \um_mathstyle_scale:Nnn ##1 { \kern } - { \fontdimen 63 \l_um_font } + \__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 + * \number \fontdimen 65 \l__um_font / 100 } { \box_use:N \rootbox } - \um_mathstyle_scale:Nnn ##1 { \kern } - { \fontdimen 64 \l_um_font } + \__um_mathstyle_scale:Nnn ##1 { \kern } + { \fontdimen 64 \l__um_font } \box_use_clear:N \l_tmpa_box } } } -\cs_new:Nn \um_fontdimen_to_percent:nn +\cs_new:Nn \__um_fontdimen_to_percent:nn { - \strip@pt\dimexpr\fontdimen#1#2*65536/100\relax + \fp_eval:n { \dim_to_decimal:n { \fontdimen #1 #2 } * 65536 / 100 } } -\cs_new:Nn \um_fontdimen_to_scale:nn +\cs_new:Nn \__um_fontdimen_to_scale:nn { - \um_fontdimen_to_percent:nn {#1} {#2} \dimexpr \f@size pt\relax + \fp_eval:n {\__um_fontdimen_to_percent:nn {#1} {#2} * \f@size } pt } -\cs_new:Nn \um_mathstyle_scale:Nnn +\cs_new:Nn \__um_mathstyle_scale:Nnn { \ifx#1\scriptstyle - #2 \um_fontdimen_to_percent:nn {10} \l_um_font #3 + #2 \__um_fontdimen_to_percent:nn {10} \l__um_font #3 \else \ifx#1\scriptscriptstyle - #2 \um_fontdimen_to_percent:nn {11} \l_um_font #3 + #2 \__um_fontdimen_to_percent:nn {11} \l__um_font #3 \else #2 #3 \fi \fi } -\prop_new:N \g_um_supers_prop -\prop_new:N \g_um_subs_prop \group_begin: -\cs_new:Nn \um_setup_active_superscript:nn +\cs_new:Nn \__um_setup_active_superscript:nn { - \prop_gput:Nxn \g_um_supers_prop {\meaning #1} {#2} + \prop_gput:Non \g__um_supers_prop {\meaning #1} {#2} \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \__um_char_gmake_mathactive:N #1 \scantokens { \cs_gset:Npn #1 { - \tl_set:Nn \l_um_ss_chain_tl {#2} - \cs_set_eq:NN \um_sub_or_super:n \sp - \tl_set:Nn \l_um_tmpa_tl {supers} - \um_scan_sscript: - } - } - } -\um_setup_active_superscript:nn {^^^^2070} {0} -\um_setup_active_superscript:nn {^^^^00b9} {1} -\um_setup_active_superscript:nn {^^^^00b2} {2} -\um_setup_active_superscript:nn {^^^^00b3} {3} -\um_setup_active_superscript:nn {^^^^2074} {4} -\um_setup_active_superscript:nn {^^^^2075} {5} -\um_setup_active_superscript:nn {^^^^2076} {6} -\um_setup_active_superscript:nn {^^^^2077} {7} -\um_setup_active_superscript:nn {^^^^2078} {8} -\um_setup_active_superscript:nn {^^^^2079} {9} -\um_setup_active_superscript:nn {^^^^207a} {+} -\um_setup_active_superscript:nn {^^^^207b} {-} -\um_setup_active_superscript:nn {^^^^207c} {=} -\um_setup_active_superscript:nn {^^^^207d} {(} -\um_setup_active_superscript:nn {^^^^207e} {)} -\um_setup_active_superscript:nn {^^^^2071} {i} -\um_setup_active_superscript:nn {^^^^207f} {n} -\cs_new:Nn \um_setup_active_subscript:nn - { - \prop_gput:Nxn \g_um_subs_prop {\meaning #1} {#2} + \tl_set:Nn \l__um_ss_chain_tl {#2} + \cs_set_eq:NN \__um_sub_or_super:n \sp + \tl_set:Nn \l__um_tmpa_tl {supers} + \__um_scan_sscript: + } + } + } +\__um_setup_active_superscript:nn {^^^^2070} {0} +\__um_setup_active_superscript:nn {^^^^00b9} {1} +\__um_setup_active_superscript:nn {^^^^00b2} {2} +\__um_setup_active_superscript:nn {^^^^00b3} {3} +\__um_setup_active_superscript:nn {^^^^2074} {4} +\__um_setup_active_superscript:nn {^^^^2075} {5} +\__um_setup_active_superscript:nn {^^^^2076} {6} +\__um_setup_active_superscript:nn {^^^^2077} {7} +\__um_setup_active_superscript:nn {^^^^2078} {8} +\__um_setup_active_superscript:nn {^^^^2079} {9} +\__um_setup_active_superscript:nn {^^^^207a} {+} +\__um_setup_active_superscript:nn {^^^^207b} {-} +\__um_setup_active_superscript:nn {^^^^207c} {=} +\__um_setup_active_superscript:nn {^^^^207d} {(} +\__um_setup_active_superscript:nn {^^^^207e} {)} +\__um_setup_active_superscript:nn {^^^^2071} {i} +\__um_setup_active_superscript:nn {^^^^207f} {n} +\__um_setup_active_superscript:nn {^^^^02b0} {h} +\__um_setup_active_superscript:nn {^^^^02b2} {j} +\__um_setup_active_superscript:nn {^^^^02b3} {r} +\__um_setup_active_superscript:nn {^^^^02b7} {w} +\__um_setup_active_superscript:nn {^^^^02b8} {y} +\cs_new:Nn \__um_setup_active_subscript:nn + { + \prop_gput:Non \g__um_subs_prop {\meaning #1} {#2} \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \__um_char_gmake_mathactive:N #1 \scantokens { \cs_gset:Npn #1 { - \tl_set:Nn \l_um_ss_chain_tl {#2} - \cs_set_eq:NN \um_sub_or_super:n \sb - \tl_set:Nn \l_um_tmpa_tl {subs} - \um_scan_sscript: - } - } - } -\um_setup_active_subscript:nn {^^^^2080} {0} -\um_setup_active_subscript:nn {^^^^2081} {1} -\um_setup_active_subscript:nn {^^^^2082} {2} -\um_setup_active_subscript:nn {^^^^2083} {3} -\um_setup_active_subscript:nn {^^^^2084} {4} -\um_setup_active_subscript:nn {^^^^2085} {5} -\um_setup_active_subscript:nn {^^^^2086} {6} -\um_setup_active_subscript:nn {^^^^2087} {7} -\um_setup_active_subscript:nn {^^^^2088} {8} -\um_setup_active_subscript:nn {^^^^2089} {9} -\um_setup_active_subscript:nn {^^^^208a} {+} -\um_setup_active_subscript:nn {^^^^208b} {-} -\um_setup_active_subscript:nn {^^^^208c} {=} -\um_setup_active_subscript:nn {^^^^208d} {(} -\um_setup_active_subscript:nn {^^^^208e} {)} -\um_setup_active_subscript:nn {^^^^2090} {a} -\um_setup_active_subscript:nn {^^^^2091} {e} -\um_setup_active_subscript:nn {^^^^1d62} {i} -\um_setup_active_subscript:nn {^^^^2092} {o} -\um_setup_active_subscript:nn {^^^^1d63} {r} -\um_setup_active_subscript:nn {^^^^1d64} {u} -\um_setup_active_subscript:nn {^^^^1d65} {v} -\um_setup_active_subscript:nn {^^^^2093} {x} -\um_setup_active_subscript:nn {^^^^1d66} {\beta} -\um_setup_active_subscript:nn {^^^^1d67} {\gamma} -\um_setup_active_subscript:nn {^^^^1d68} {\rho} -\um_setup_active_subscript:nn {^^^^1d69} {\phi} -\um_setup_active_subscript:nn {^^^^1d6a} {\chi} + \tl_set:Nn \l__um_ss_chain_tl {#2} + \cs_set_eq:NN \__um_sub_or_super:n \sb + \tl_set:Nn \l__um_tmpa_tl {subs} + \__um_scan_sscript: + } + } + } +\__um_setup_active_subscript:nn {^^^^2080} {0} +\__um_setup_active_subscript:nn {^^^^2081} {1} +\__um_setup_active_subscript:nn {^^^^2082} {2} +\__um_setup_active_subscript:nn {^^^^2083} {3} +\__um_setup_active_subscript:nn {^^^^2084} {4} +\__um_setup_active_subscript:nn {^^^^2085} {5} +\__um_setup_active_subscript:nn {^^^^2086} {6} +\__um_setup_active_subscript:nn {^^^^2087} {7} +\__um_setup_active_subscript:nn {^^^^2088} {8} +\__um_setup_active_subscript:nn {^^^^2089} {9} +\__um_setup_active_subscript:nn {^^^^208a} {+} +\__um_setup_active_subscript:nn {^^^^208b} {-} +\__um_setup_active_subscript:nn {^^^^208c} {=} +\__um_setup_active_subscript:nn {^^^^208d} {(} +\__um_setup_active_subscript:nn {^^^^208e} {)} +\__um_setup_active_subscript:nn {^^^^2090} {a} +\__um_setup_active_subscript:nn {^^^^2091} {e} +\__um_setup_active_subscript:nn {^^^^1d62} {i} +\__um_setup_active_subscript:nn {^^^^2092} {o} +\__um_setup_active_subscript:nn {^^^^1d63} {r} +\__um_setup_active_subscript:nn {^^^^1d64} {u} +\__um_setup_active_subscript:nn {^^^^1d65} {v} +\__um_setup_active_subscript:nn {^^^^2093} {x} +\__um_setup_active_subscript:nn {^^^^1d66} {\beta} +\__um_setup_active_subscript:nn {^^^^1d67} {\gamma} +\__um_setup_active_subscript:nn {^^^^1d68} {\rho} +\__um_setup_active_subscript:nn {^^^^1d69} {\phi} +\__um_setup_active_subscript:nn {^^^^1d6a} {\chi} \group_end: -\cs_new:Npn \um_scan_sscript: +\cs_new:Npn \__um_scan_sscript: { - \um_scan_sscript:TF + \__um_scan_sscript:TF { - \um_scan_sscript: + \__um_scan_sscript: } { - \um_sub_or_super:n {\l_um_ss_chain_tl} + \__um_sub_or_super:n {\l__um_ss_chain_tl} } } -\cs_new:Npn \um_scan_sscript:TF #1#2 +\cs_new:Npn \__um_scan_sscript:TF #1#2 { \tl_set:Nx \__peek_true_aux:w { \exp_not:n{ #1 } } \tl_set_eq:NN \__peek_true:w \__peek_true_remove:w \tl_set:Nx \__peek_false:w { \exp_not:n { \group_align_safe_end: #2 } } \group_align_safe_begin: - \peek_after:Nw \um_peek_execute_branches_ss: + \peek_after:Nw \__um_peek_execute_branches_ss: } -\cs_new:Npn \um_peek_execute_branches_ss: +\cs_new:Npn \__um_peek_execute_branches_ss: { \bool_if:nTF { @@ -2590,24 +1696,24 @@ \token_if_eq_meaning_p:NN \l_peek_token \c_space_token } { \__peek_false:w } - { \um_peek_execute_branches_ss_aux: } + { \__um_peek_execute_branches_ss_aux: } } -\cs_new:Npn \um_peek_execute_branches_ss_aux: +\cs_new:Npn \__um_peek_execute_branches_ss_aux: { - \prop_if_in:cxTF - {g_um_\l_um_tmpa_tl _prop} {\meaning\l_peek_token} + \prop_if_in:coTF + {g__um_\l__um_tmpa_tl _prop} {\meaning\l_peek_token} { - \prop_get:cxN - {g_um_\l_um_tmpa_tl _prop} {\meaning\l_peek_token} \l_um_tmpb_tl - \tl_put_right:NV \l_um_ss_chain_tl \l_um_tmpb_tl + \prop_get:coN + {g__um_\l__um_tmpa_tl _prop} {\meaning\l_peek_token} \l__um_tmpb_tl + \tl_put_right:NV \l__um_ss_chain_tl \l__um_tmpb_tl \__peek_true:w } { \__peek_false:w } } -\cs_new:Npn \um_define_active_frac:Nw #1 #2/#3 +\cs_new:Npn \__um_define_active_frac:Nw #1 #2/#3 { \char_set_catcode_active:N #1 - \char_gmake_mathactive:N #1 + \__um_char_gmake_mathactive:N #1 \tl_rescan:nn { \catcode`\_=11\relax @@ -2616,36 +1722,36 @@ { \cs_gset:Npx #1 { - \bool_if:NTF \l_um_smallfrac_bool {\exp_not:N\tfrac} {\exp_not:N\frac} + \bool_if:NTF \l__um_smallfrac_bool {\exp_not:N\tfrac} {\exp_not:N\frac} {#2} {#3} } } } -\cs_new:Npn \um_setup_active_frac: +\cs_new:Npn \__um_setup_active_frac: { \group_begin: - \um_define_active_frac:Nw ^^^^2189 0/3 - \um_define_active_frac:Nw ^^^^2152 1/{10} - \um_define_active_frac:Nw ^^^^2151 1/9 - \um_define_active_frac:Nw ^^^^215b 1/8 - \um_define_active_frac:Nw ^^^^2150 1/7 - \um_define_active_frac:Nw ^^^^2159 1/6 - \um_define_active_frac:Nw ^^^^2155 1/5 - \um_define_active_frac:Nw ^^^^00bc 1/4 - \um_define_active_frac:Nw ^^^^2153 1/3 - \um_define_active_frac:Nw ^^^^215c 3/8 - \um_define_active_frac:Nw ^^^^2156 2/5 - \um_define_active_frac:Nw ^^^^00bd 1/2 - \um_define_active_frac:Nw ^^^^2157 3/5 - \um_define_active_frac:Nw ^^^^215d 5/8 - \um_define_active_frac:Nw ^^^^2154 2/3 - \um_define_active_frac:Nw ^^^^00be 3/4 - \um_define_active_frac:Nw ^^^^2158 4/5 - \um_define_active_frac:Nw ^^^^215a 5/6 - \um_define_active_frac:Nw ^^^^215e 7/8 + \__um_define_active_frac:Nw ^^^^2189 0/3 + \__um_define_active_frac:Nw ^^^^2152 1/{10} + \__um_define_active_frac:Nw ^^^^2151 1/9 + \__um_define_active_frac:Nw ^^^^215b 1/8 + \__um_define_active_frac:Nw ^^^^2150 1/7 + \__um_define_active_frac:Nw ^^^^2159 1/6 + \__um_define_active_frac:Nw ^^^^2155 1/5 + \__um_define_active_frac:Nw ^^^^00bc 1/4 + \__um_define_active_frac:Nw ^^^^2153 1/3 + \__um_define_active_frac:Nw ^^^^215c 3/8 + \__um_define_active_frac:Nw ^^^^2156 2/5 + \__um_define_active_frac:Nw ^^^^00bd 1/2 + \__um_define_active_frac:Nw ^^^^2157 3/5 + \__um_define_active_frac:Nw ^^^^215d 5/8 + \__um_define_active_frac:Nw ^^^^2154 2/3 + \__um_define_active_frac:Nw ^^^^00be 3/4 + \__um_define_active_frac:Nw ^^^^2158 4/5 + \__um_define_active_frac:Nw ^^^^215a 5/6 + \__um_define_active_frac:Nw ^^^^215e 7/8 \group_end: } -\um_setup_active_frac: +\__um_setup_active_frac: \def\to{\rightarrow} \def\le{\leq} \def\ge{\geq} @@ -2668,7 +1774,16 @@ \def\longdivision{\longdivisionsign} \def\backepsilon{\upbackepsilon} \def\eth{\matheth} -\def\smallint{{\textstyle\int}\limits} +\def\dbkarow {\dbkarrow} +\def\drbkarow{\drbkarrow} +\def\hksearow{\hksearrow} +\def\hkswarow{\hkswarrow} +\def\smallint{\mathop{\textstyle\int}\limits} +\cs_set_eq:NN \latexe_underbar:n \underbar +\renewcommand\underbar + { + \mode_if_math:TF \mathunderbar \latexe_underbar:n + } \@ifpackageloaded{amsmath} { % define their own colon, perhaps I should just steal it. (It does look much better.) @@ -2676,23 +1791,65 @@ { \cs_set_protected:Npn \colon { - \bool_if:NTF \g_um_literal_colon_bool {:} { \mathpunct{:} } + \bool_if:NTF \g__um_literal_colon_bool {:} { \mathpunct{:} } } } -\def\mathrm{\mathup} \let\mathfence\mathord \def\digamma{\updigamma} \def\Digamma{\upDigamma} -\def\operator@font{\um_switchto_mathup:} -\cs_new_protected_nopar:Nn \um_check_and_fix:NNnnnn +\cs_set:Npn \| {\Vert} +\cs_set:Npn \mathellipsis {\mathinner{\unicodeellipsis}} +\cs_set:Npn \cdots {\mathinner{\unicodecdots}} +\cs_set_eq:NN \__um_text_slash: \slash +\cs_set_protected:Npn \slash + { + \mode_if_math:TF {\mathslash} {\__um_text_slash:} + } +\cs_new:Npn \__um_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 } + } + { + \__um_oldnot: #1 + } + } + } +\cs_set_eq:NN \__um_oldnot: \not +\AtBeginDocument{\cs_set_eq:NN \not \__um_newnot:N} +\cs_new_protected_nopar:Nn \__um_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 } + } +\cs_new_protected_nopar:Nn \__um_check_and_fix:NNnnnn { \cs_if_exist:NT #1 { \token_if_macro:NTF #1 { \group_begin: - #2 \um_tmpa:w #3 { #4 } - \cs_if_eq:NNTF #1 \um_tmpa:w + #2 \__um_tmpa:w #3 { #4 } + \cs_if_eq:NNTF #1 \__um_tmpa:w { \msg_info:nnx { unicode-math } { patch-macro } { \token_to_str:N #1 } @@ -2703,7 +1860,7 @@ { \msg_warning:nnxxx { unicode-math } { wrong-meaning } { \token_to_str:N #1 } { \token_to_meaning:N #1 } - { \token_to_meaning:N \um_tmpa:w } + { \token_to_meaning:N \__um_tmpa:w } \group_end: } } @@ -2713,21 +1870,17 @@ } } } -\cs_new_protected_nopar:Nn \um_check_and_fix:NNnnn +\cs_new_protected_nopar:Nn \__um_check_and_fix:NNnnn { - \um_check_and_fix:NNnnnn #1 #2 { #3 } { #4 } { #5 } { #5 } + \__um_check_and_fix:NNnnnn #1 #2 { #3 } { #4 } { #5 } { #5 } } -\cs_new_protected_nopar:Nn \um_check_and_fix_luatex:NNnnn +\cs_new_protected_nopar:Nn \__um_check_and_fix_luatex:NNnnn { - \luatex_if_engine:T - { - \um_check_and_fix:NNnnn #1 #2 { #3 } { #4 } { #5 } - } } -\cs_generate_variant:Nn \um_check_and_fix_luatex:NNnnn { c } +\cs_generate_variant:Nn \__um_check_and_fix_luatex:NNnnn { c } \AtEndOfPackageFile * {url} { - \tl_put_left:Nn \Url@FormatString { \um_switchto_mathup: } + \tl_put_left:Nn \Url@FormatString { \__um_switchto_up: } \tl_put_right:Nn \UrlSpecials { \do\`{\mathchar`\`} @@ -2752,7 +1905,7 @@ \setbox\z@\hbox{$($}%) \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ } - \um_check_and_fix:NNnnn \subarray \cs_set:Npn { #1 } + \__um_check_and_fix:NNnnn \subarray \cs_set:Npn { #1 } { \vcenter \bgroup @@ -2778,10 +1931,10 @@ \default@tag \skip_set:Nn \baselineskip { - \um_stack_num_up:N \scriptstyle - + \um_stack_denom_down:N \scriptstyle + \__um_stack_num_up:N \scriptstyle + + \__um_stack_denom_down:N \scriptstyle } - \lineskip \um_stack_vgap:N \scriptstyle + \lineskip \__um_stack_vgap:N \scriptstyle \lineskiplimit \lineskip \ialign \c_group_begin_token @@ -2794,7 +1947,7 @@ \hfil \crcr } - \um_check_and_fix_luatex:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } + \__um_check_and_fix_luatex:NNnnn \plainroot@ \cs_set_nopar:Npn { #1 \of #2 } { \setbox \rootbox \hbox { @@ -2814,7 +1967,7 @@ && \int_compare_p:nNn { \leftroot@ } = { \c_zero } } { - \luatexUroot \l_um_radical_sqrt_tl { #1 } { #2 } + \luatexUroot \l__um_radical_sqrt_tl { #1 } { #2 } } { \hbox_set:Nn \rootbox @@ -2832,7 +1985,7 @@ } \c_group_end_token } - \um_check_and_fix:NNnnnn \r@@t \cs_set_nopar:Npn { #1 #2 } + \__um_check_and_fix:NNnnnn \r@@t \cs_set_nopar:Npn { #1 #2 } { \setboxz@h { $ \m@th #1 \sqrtsign { #2 } $ } \dimen@ \ht\z@ @@ -2855,7 +2008,7 @@ \mskip \uproot@ mu \c_math_toggle_token } - \luatexUroot \l_um_radical_sqrt_tl + \luatexUroot \l__um_radical_sqrt_tl { \box_move_up:nn { \box_wd:N \l_tmpa_box } { @@ -2890,22 +2043,22 @@ \c_math_toggle_token } \mkern -\leftroot@ mu - \um_mathstyle_scale:Nnn #1 { \kern } + \__um_mathstyle_scale:Nnn #1 { \kern } { - \fontdimen 63 \l_um_font + \fontdimen 63 \l__um_font } \box_move_up:nn { \box_wd:N \l_tmpb_box + (\box_ht:N \l_tmpa_box - \box_dp:N \l_tmpa_box) - * \number \fontdimen 65 \l_um_font / 100 + * \number \fontdimen 65 \l__um_font / 100 } { \box_use:N \rootbox } - \um_mathstyle_scale:Nnn #1 { \kern } + \__um_mathstyle_scale:Nnn #1 { \kern } { - \fontdimen 64 \l_um_font + \fontdimen 64 \l__um_font } \mkern \leftroot@ mu \box_use_clear:N \l_tmpa_box @@ -2926,105 +2079,10 @@ \mathcode`\:"603A\scan_stop: } } -\cs_set:Npn \| {\Vert} -\cs_set:Npn \mathellipsis {\mathinner{\unicodeellipsis}} -\cs_set:Npn \cdots {\mathinner{\unicodecdots}} -\cs_new_protected_nopar:Nn \um_setup_accents: - { - \cs_gset_protected_nopar:Npx \widehat - { - \um_accent:nnn {} { \um_symfont_tl } { "0302 } - } - \cs_gset_protected_nopar:Npx \widetilde - { - \um_accent:nnn {} { \um_symfont_tl } { "0303 } - } - \cs_gset_protected_nopar:Npx \overleftarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20D6 } - } - \cs_gset_protected_nopar:Npx \overrightarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20D7 } - } - \cs_gset_protected_nopar:Npx \overleftrightarrow - { - \um_accent:nnn {} { \um_symfont_tl } { "20E1 } - } - \cs_gset_protected_nopar:Npx \wideutilde - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "0330 } - } - \cs_gset_protected_nopar:Npx \underrightharpoondown - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EC } - } - \cs_gset_protected_nopar:Npx \underleftharpoondown - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20ED } - } - \cs_gset_protected_nopar:Npx \underleftarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EE } - } - \cs_gset_protected_nopar:Npx \underrightarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "20EF } - } - \cs_gset_protected_nopar:Npx \underleftrightarrow - { - \um_accent:nnn {bottom} { \um_symfont_tl } { "034D } - } - } -\cs_set_eq:NN \um_text_slash: \slash -\cs_set_protected:Npn \slash - { - \mode_if_math:TF {\mathslash} {\um_text_slash:} - } -\tl_new:N \l_not_token_name_tl - -\cs_new:Npn \not_newnot:N #1 - { - \tl_set:Nx \l_not_token_name_tl { \token_to_str:N #1 } - \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 } - } - { - \not_oldnot: #1 %\l_not_token_name_tl - } - } - } - -\cs_set_eq:NN \not_oldnot: \not -\cs_set_eq:NN \not \not_newnot:N - -\cs_new_protected_nopar:Nn \um_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 } - } \AtEndOfPackageFile * { mathtools } { - \newfam \g_um_empty_fam - \um_check_and_fix:NNnnn + \newfam \g__um_empty_fam + \__um_check_and_fix:NNnnn \MT_cramped_internal:Nn \cs_set_nopar:Npn { #1 #2 } { \sbox \z@ @@ -3064,14 +2122,14 @@ \m@th #1 \dim_zero:N \nulldelimiterspace - \XeTeXradical \g_um_empty_fam \c_zero { #2 } + \XeTeXradical \g__um_empty_fam \c_zero { #2 } \c_math_toggle_token \color@endgroup } \box_set_ht:Nn \l_tmpa_box { \box_ht:N \l_tmpa_box - - \um_radical_vgap:N #1 + - \__um_radical_vgap:N #1 } \box_use_clear:N \l_tmpa_box } @@ -3120,4 +2178,3 @@ \RenewDocumentCommand \equalscolon { } { \eqcolon } \RenewDocumentCommand \coloncolonequals { } { \Coloneq } } -\ExplSyntaxOff 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 87163c8219e..f0422ef27c9 100644 --- a/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty +++ b/Master/texmf-dist/tex/latex/unicode-math/unicode-math.sty @@ -5,11 +5,13 @@ %% The original source files were: %% %% unicode-math.dtx (with options: `preamble') -%% unicode-math.dtx (with options: `msg') +%% unicode-math-msg.dtx (with options: `msg') +%% unicode-math-usv.dtx (with options: `usv') %% unicode-math.dtx (with options: `load') -%% Copyright 2006-2013 Will Robertson <will.robertson@latex-project.org> +%% unicode-math-alphabets.dtx (with options: `alphabets') +%% Copyright 2006-2015 Will Robertson <will.robertson@latex-project.org> %% Copyright 2010-2013 Philipp Stephani <st_philipp@yahoo.de> -%% Copyright 2012-2013 Khaled Hosny <khaledhosny@eglug.org> +%% Copyright 2012-2015 Khaled Hosny <khaledhosny@eglug.org> %% %% This package is free software and may be redistributed and/or modified under %% the conditions of the LaTeX Project Public License, version 1.3c or higher @@ -17,7 +19,7 @@ %% %% This work is "maintained" by Will Robertson. \ProvidesPackage{unicode-math} - [2014/06/30 v0.7f Unicode maths in XeLaTeX and LuaLaTeX] + [2014/07/30 v0.8 Unicode maths in XeLaTeX and LuaLaTeX] \usepackage{ifxetex,ifluatex} \ifxetex \ifdim\number\XeTeXversion\XeTeXrevision in<0.9998in% @@ -39,122 +41,145 @@ Use XeLaTeX or LuaLaTeX instead.% }\@ehd \fi\fi -\RequirePackage{expl3}[2011/07/01] -\RequirePackage{xparse}[2009/08/31] +\RequirePackage{expl3}[2015/03/01] +\RequirePackage{xparse} \RequirePackage{l3keys2e} -\RequirePackage{fontspec}[2010/10/25] +\RequirePackage{fontspec}[2015/03/14] \RequirePackage{catchfile} \RequirePackage{fix-cm} % avoid some warnings -\RequirePackage{filehook}[2011/01/03] -\def\@DeclareMathSizes #1#2#3#4#5{% - \@defaultunits\dimen@ #2pt\relax\@nnil - \if $#3$% - \expandafter\let\csname S@\strip@pt\dimen@\endcsname\math@fontsfalse - \else - \@defaultunits\dimen@ii #3pt\relax\@nnil - \@defaultunits\@tempdima #4pt\relax\@nnil - \@defaultunits\@tempdimb #5pt\relax\@nnil - \toks@{#1}% - \expandafter\xdef\csname S@\strip@pt\dimen@\endcsname{% - \gdef\noexpand\tf@size{\strip@pt\dimen@ii}% - \gdef\noexpand\sf@size{\strip@pt\@tempdima}% - \gdef\noexpand\ssf@size{\strip@pt\@tempdimb}% - \the\toks@ - }% - \fi -} +\RequirePackage{filehook} \ExplSyntaxOn -\cs_generate_variant:Nn \tl_put_right:Nn {cx} -\cs_generate_variant:Nn \seq_if_in:NnTF {NV} -\cs_generate_variant:Nn \prop_gput:Nnn {Nxn} -\cs_generate_variant:Nn \prop_get:NnN {cxN} -\cs_generate_variant:Nn \prop_if_in:NnTF {cx} -\cs_set:Npn \exp_args:NNcc #1#2#3#4 { - \exp_after:wN #1 \exp_after:wN #2 - \cs:w #3 \exp_after:wN \cs_end: - \cs:w #4 \cs_end: -} \cs_generate_variant:Nn \fontspec_set_family:Nnn {Nx} \cs_generate_variant:Nn \fontspec_set_fontface:NNnn {NNx} -\bool_new:N \l_um_ot_math_bool -\bool_new:N \l_um_init_bool -\bool_new:N \l_um_implicit_alph_bool -\bool_new:N \g_um_mainfont_already_set_bool -\bool_new:N \g_um_literal_bool -\bool_new:N \g_um_upLatin_bool -\bool_new:N \g_um_uplatin_bool -\bool_new:N \g_um_upGreek_bool -\bool_new:N \g_um_upgreek_bool -\bool_new:N \g_um_bfliteral_bool -\bool_new:N \g_um_bfupLatin_bool -\bool_new:N \g_um_bfuplatin_bool -\bool_new:N \g_um_bfupGreek_bool -\bool_new:N \g_um_bfupgreek_bool -\bool_new:N \g_um_upsans_bool -\bool_new:N \g_um_sfliteral_bool -\bool_new:N \g_um_upNabla_bool -\bool_new:N \g_um_uppartial_bool -\bool_new:N \g_um_literal_Nabla_bool -\bool_new:N \g_um_literal_partial_bool -\bool_new:N \g_um_texgreek_bool -\bool_set_true:N \g_um_texgreek_bool -\bool_new:N \l_um_smallfrac_bool -\bool_new:N \g_um_literal_colon_bool -\int_new:N \g_um_fam_int -\tl_const:Nn \c_um_math_alphabet_name_latin_tl {Latin,~lowercase} -\tl_const:Nn \c_um_math_alphabet_name_Latin_tl {Latin,~uppercase} -\tl_const:Nn \c_um_math_alphabet_name_greek_tl {Greek,~lowercase} -\tl_const:Nn \c_um_math_alphabet_name_Greek_tl {Greek,~uppercase} -\tl_const:Nn \c_um_math_alphabet_name_num_tl {Numerals} -\tl_const:Nn \c_um_math_alphabet_name_misc_tl {Misc.} -\prg_new_conditional:Nnn \um_glyph_if_exist:n {p,TF,T,F} - { - \etex_iffontchar:D \l_um_font #1 \scan_stop: +\bool_new:N \l__um_ot_math_bool +\bool_new:N \l__um_init_bool +\bool_new:N \l__um_implicit_alph_bool +\bool_new:N \g__um_mainfont_already_set_bool +\bool_new:N \g__um_literal_bool +\bool_new:N \g__um_upLatin_bool +\bool_new:N \g__um_uplatin_bool +\bool_new:N \g__um_upGreek_bool +\bool_new:N \g__um_upgreek_bool +\bool_new:N \g__um_bfliteral_bool +\bool_new:N \g__um_bfupLatin_bool +\bool_new:N \g__um_bfuplatin_bool +\bool_new:N \g__um_bfupGreek_bool +\bool_new:N \g__um_bfupgreek_bool +\bool_new:N \g__um_upsans_bool +\bool_new:N \g__um_sfliteral_bool +\bool_new:N \g__um_upNabla_bool +\bool_new:N \g__um_uppartial_bool +\bool_new:N \g__um_literal_Nabla_bool +\bool_new:N \g__um_literal_partial_bool +\bool_new:N \g__um_texgreek_bool +\bool_set_true:N \g__um_texgreek_bool +\bool_new:N \l__um_smallfrac_bool +\bool_new:N \g__um_literal_colon_bool +\bool_new:N \g__um_mathrm_text_bool +\bool_new:N \g__um_mathit_text_bool +\bool_new:N \g__um_mathbf_text_bool +\bool_new:N \g__um_mathsf_text_bool +\bool_new:N \g__um_mathtt_text_bool +\int_new:N \g__um_fam_int +\tl_const:Nn \c__um_math_alphabet_name_latin_tl {Latin,~lowercase} +\tl_const:Nn \c__um_math_alphabet_name_Latin_tl {Latin,~uppercase} +\tl_const:Nn \c__um_math_alphabet_name_greek_tl {Greek,~lowercase} +\tl_const:Nn \c__um_math_alphabet_name_Greek_tl {Greek,~uppercase} +\tl_const:Nn \c__um_math_alphabet_name_num_tl {Numerals} +\tl_const:Nn \c__um_math_alphabet_name_misc_tl {Misc.} +\tl_new:N \l__um_mathstyle_tl +\tl_new:N \g__um_operator_mathfont_tl +\seq_new:N \l__um_missing_alph_seq +\seq_new:N \l__um_mathalph_seq +\seq_new:N \l__um_char_range_seq +\seq_new:N \l__um_mclass_range_seq +\seq_new:N \l__um_cmd_range_seq +\seq_new:N \g__um_mathclasses_seq +\seq_set_from_clist:Nn \g__um_mathclasses_seq + { + \mathord,\mathalpha,\mathbin,\mathrel,\mathpunct, + \mathop, + \mathopen,\mathclose, + \mathfence,\mathover,\mathunder, + \mathaccent,\mathbotaccent,\mathaccentwide,\mathbotaccentwide + } + +\seq_new:N \g__um_default_mathalph_seq +\seq_new:N \g__um_named_ranges_seq +\seq_new:N \g__um_mathstyles_seq +\muskip_new:N \g__um_primekern_muskip +\muskip_gset:Nn \g__um_primekern_muskip { -\thinmuskip/2 }% arbitrary +\int_new:N \l__um_primecount_int +\prop_new:N \g__um_supers_prop +\prop_new:N \g__um_subs_prop +\tl_new:N \l_not_token_name_tl +\prg_new_conditional:Nnn \__um_glyph_if_exist:n {p,TF,T,F} + { + \etex_iffontchar:D \l__um_font #1 \scan_stop: \prg_return_true: \else: \prg_return_false: \fi: } -\cs_generate_variant:Nn \um_glyph_if_exist_p:n {c} -\cs_generate_variant:Nn \um_glyph_if_exist:nTF {c} -\cs_generate_variant:Nn \um_glyph_if_exist:nT {c} -\cs_generate_variant:Nn \um_glyph_if_exist:nF {c} -\cs_set:Npn \um_set_mathcode:nnnn #1#2#3#4 { +\cs_set:Npn \__um_set_mathcode:nnnn #1#2#3#4 { \Umathcode \int_eval:n {#1} = \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop: } -\cs_set:Npn \um_set_mathcode:nnn #1#2#3 { +\cs_set:Npn \__um_set_mathcode:nnn #1#2#3 { \Umathcode \int_eval:n {#1} = \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#1} \scan_stop: } -\cs_set:Npn \um_set_mathchar:NNnn #1#2#3#4 { +\cs_set:Npn \__um_set_mathchar:NNnn #1#2#3#4 { \Umathchardef #1 = \mathchar@type#2 \csname sym#3\endcsname \int_eval:n {#4} \scan_stop: } -\cs_new:Nn \um_set_delcode:nnn { +\cs_new:Nn \__um_set_delcode:nnn { \Udelcode#2 = \csname sym#1\endcsname #3 \scan_stop: } -\cs_new:Nn \um_radical:nn { +\cs_new:Nn \__um_radical:nn { \Uradical \csname sym#1\endcsname #2 \scan_stop: } -\cs_new:Nn \um_delimiter:Nnn { +\cs_new:Nn \__um_delimiter:Nnn { \Udelimiter \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: } -\cs_new:Nn \um_accent:nnn { +\cs_new:Nn \__um_accent:nnn { \Umathaccent #1~ \mathchar@type\mathaccent \use:c { sym #2 } #3 \scan_stop: } -\cs_generate_variant:Nn \um_set_mathchar:NNnn {c} -\cs_new:Nn \char_gmake_mathactive:N { +\cs_generate_variant:Nn \__um_set_mathchar:NNnn {c} +\cs_new:Nn \__um_char_gmake_mathactive:N + { \global\mathcode `#1 = "8000 \scan_stop: -} -\cs_new:Nn \char_gmake_mathactive:n { + } +\cs_new:Nn \__um_char_gmake_mathactive:n + { \global\mathcode #1 = "8000 \scan_stop: -} + } +\cs_new:Nn \usv_set:nnn + { \tl_set:cn { g__um_#1_#2_usv } {#3} } +\cs_new:Nn \__um_to_usv:nn + { \use:c { g__um_#1_#2_usv } } +\prg_new_conditional:Nnn \__um_usv_if_exist:nn {T,F,TF} + { + \cs_if_exist:cTF { g__um_#1_#2_usv } + \prg_return_true: \prg_return_false: + } \DeclareDocumentCommand \unimathsetup {m} + { \keys_set:nn {unicode-math} {#1} } +\cs_new:Nn \__um_keys_choices:nn { - \keys_set:nn {unicode-math} {#1} + \cs_set:Npn \__um_keys_choices_fn:nn { \__um_keys_choices_aux:nnn {#1} } + \use:x + { + \exp_not:N \keys_define:nn {unicode-math} + { + #1 .choice: , + \__um_tl_map_dbl:nN {#2} \__um_keys_choices_fn:nn + } + } } -\cs_new:Nn \um_tl_map_dbl:nN +\cs_new:Nn \__um_keys_choices_aux:nnn { #1 / #2 .code:n = { \exp_not:n {#3} } , } + +\cs_new:Nn \__um_tl_map_dbl:nN { \__um_tl_map_dbl:Nnn #2 #1 \q_recursion_tail {}{} \q_recursion_stop } @@ -165,145 +190,183 @@ #1 {#2} {#3} \__um_tl_map_dbl:Nnn #1 } -\cs_new:Nn \um_keys_choices:nn +\__um_keys_choices:nn {mathup} { - \cs_set:Npn \um_keys_choices_fn:nn { \um_keys_choices_aux:nnn {#1} } - \use:x - { - \exp_not:N \keys_define:nn {unicode-math} - { - #1 .choice: , - \um_tl_map_dbl:nN {#2} \um_keys_choices_fn:nn - } - } + {sym} { \bool_set_false:N \g__um_mathrm_text_bool } + {text} { \bool_set_true:N \g__um_mathrm_text_bool } } -\cs_new:Nn \um_keys_choices_aux:nnn { #1 / #2 .code:n = { \exp_not:n {#3} } , } -\um_keys_choices:nn {normal-style} +\__um_keys_choices:nn {mathrm} { - {ISO} { - \bool_set_false:N \g_um_literal_bool - \bool_set_false:N \g_um_upGreek_bool - \bool_set_false:N \g_um_upgreek_bool - \bool_set_false:N \g_um_upLatin_bool - \bool_set_false:N \g_um_uplatin_bool } - {TeX} { - \bool_set_false:N \g_um_literal_bool - \bool_set_true:N \g_um_upGreek_bool - \bool_set_false:N \g_um_upgreek_bool - \bool_set_false:N \g_um_upLatin_bool - \bool_set_false:N \g_um_uplatin_bool } - {french} { - \bool_set_false:N \g_um_literal_bool - \bool_set_true:N \g_um_upGreek_bool - \bool_set_true:N \g_um_upgreek_bool - \bool_set_true:N \g_um_upLatin_bool - \bool_set_false:N \g_um_uplatin_bool } + {sym} { \bool_set_false:N \g__um_mathrm_text_bool } + {text} { \bool_set_true:N \g__um_mathrm_text_bool } + } +\__um_keys_choices:nn {mathit} + { + {sym} { \bool_set_false:N \g__um_mathit_text_bool } + {text} { \bool_set_true:N \g__um_mathit_text_bool } + } +\__um_keys_choices:nn {mathbf} + { + {sym} { \bool_set_false:N \g__um_mathbf_text_bool } + {text} { \bool_set_true:N \g__um_mathbf_text_bool } + } +\__um_keys_choices:nn {mathsf} + { + {sym} { \bool_set_false:N \g__um_mathsf_text_bool } + {text} { \bool_set_true:N \g__um_mathsf_text_bool } + } +\__um_keys_choices:nn {mathtt} + { + {sym} { \bool_set_false:N \g__um_mathtt_text_bool } + {text} { \bool_set_true:N \g__um_mathtt_text_bool } + } +\__um_keys_choices:nn {normal-style} + { + {ISO} { + \bool_set_false:N \g__um_literal_bool + \bool_set_false:N \g__um_upGreek_bool + \bool_set_false:N \g__um_upgreek_bool + \bool_set_false:N \g__um_upLatin_bool + \bool_set_false:N \g__um_uplatin_bool + } + {TeX} { + \bool_set_false:N \g__um_literal_bool + \bool_set_true:N \g__um_upGreek_bool + \bool_set_false:N \g__um_upgreek_bool + \bool_set_false:N \g__um_upLatin_bool + \bool_set_false:N \g__um_uplatin_bool + } + {french} { + \bool_set_false:N \g__um_literal_bool + \bool_set_true:N \g__um_upGreek_bool + \bool_set_true:N \g__um_upgreek_bool + \bool_set_true:N \g__um_upLatin_bool + \bool_set_false:N \g__um_uplatin_bool + } {upright} { - \bool_set_false:N \g_um_literal_bool - \bool_set_true:N \g_um_upGreek_bool - \bool_set_true:N \g_um_upgreek_bool - \bool_set_true:N \g_um_upLatin_bool - \bool_set_true:N \g_um_uplatin_bool } + \bool_set_false:N \g__um_literal_bool + \bool_set_true:N \g__um_upGreek_bool + \bool_set_true:N \g__um_upgreek_bool + \bool_set_true:N \g__um_upLatin_bool + \bool_set_true:N \g__um_uplatin_bool + } {literal} { - \bool_set_true:N \g_um_literal_bool } - } -\um_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 } } + \bool_set_true:N \g__um_literal_bool + } + } +\__um_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 } } + \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 } } - } -\um_keys_choices:nn {bold-style} - { - {ISO} { - \bool_set_false:N \g_um_bfliteral_bool - \bool_set_false:N \g_um_bfupGreek_bool - \bool_set_false:N \g_um_bfupgreek_bool - \bool_set_false:N \g_um_bfupLatin_bool - \bool_set_false:N \g_um_bfuplatin_bool } - {TeX} { - \bool_set_false:N \g_um_bfliteral_bool - \bool_set_true:N \g_um_bfupGreek_bool - \bool_set_false:N \g_um_bfupgreek_bool - \bool_set_true:N \g_um_bfupLatin_bool - \bool_set_true:N \g_um_bfuplatin_bool } + \unimathsetup { colon=literal, nabla=literal, partial=literal, + normal-style=literal, bold-style=literal, sans-style=literal } + } + } +\__um_keys_choices:nn {bold-style} + { + {ISO} { + \bool_set_false:N \g__um_bfliteral_bool + \bool_set_false:N \g__um_bfupGreek_bool + \bool_set_false:N \g__um_bfupgreek_bool + \bool_set_false:N \g__um_bfupLatin_bool + \bool_set_false:N \g__um_bfuplatin_bool + } + {TeX} { + \bool_set_false:N \g__um_bfliteral_bool + \bool_set_true:N \g__um_bfupGreek_bool + \bool_set_false:N \g__um_bfupgreek_bool + \bool_set_true:N \g__um_bfupLatin_bool + \bool_set_true:N \g__um_bfuplatin_bool + } {upright} { - \bool_set_false:N \g_um_bfliteral_bool - \bool_set_true:N \g_um_bfupGreek_bool - \bool_set_true:N \g_um_bfupgreek_bool - \bool_set_true:N \g_um_bfupLatin_bool - \bool_set_true:N \g_um_bfuplatin_bool } + \bool_set_false:N \g__um_bfliteral_bool + \bool_set_true:N \g__um_bfupGreek_bool + \bool_set_true:N \g__um_bfupgreek_bool + \bool_set_true:N \g__um_bfupLatin_bool + \bool_set_true:N \g__um_bfuplatin_bool + } {literal} { - \bool_set_true:N \g_um_bfliteral_bool } + \bool_set_true:N \g__um_bfliteral_bool + } } -\um_keys_choices:nn {sans-style} +\__um_keys_choices:nn {sans-style} { - {italic} { \bool_set_false:N \g_um_upsans_bool } - {upright} { \bool_set_true:N \g_um_upsans_bool } - {literal} { \bool_set_true:N \g_um_sfliteral_bool } + {italic} { \bool_set_false:N \g__um_upsans_bool } + {upright} { \bool_set_true:N \g__um_upsans_bool } + {literal} { \bool_set_true:N \g__um_sfliteral_bool } } -\um_keys_choices:nn {nabla} +\__um_keys_choices:nn {nabla} { - {upright} { \bool_set_false:N \g_um_literal_Nabla_bool - \bool_set_true:N \g_um_upNabla_bool } - {italic} { \bool_set_false:N \g_um_literal_Nabla_bool - \bool_set_false:N \g_um_upNabla_bool } - {literal} { \bool_set_true:N \g_um_literal_Nabla_bool } + {upright} { + \bool_set_false:N \g__um_literal_Nabla_bool + \bool_set_true:N \g__um_upNabla_bool + } + {italic} { + \bool_set_false:N \g__um_literal_Nabla_bool + \bool_set_false:N \g__um_upNabla_bool + } + {literal} { \bool_set_true:N \g__um_literal_Nabla_bool } } -\um_keys_choices:nn {partial} +\__um_keys_choices:nn {partial} { - {upright} { \bool_set_false:N \g_um_literal_partial_bool - \bool_set_true:N \g_um_uppartial_bool } - {italic} { \bool_set_false:N \g_um_literal_partial_bool - \bool_set_false:N \g_um_uppartial_bool } - {literal} { \bool_set_true:N \g_um_literal_partial_bool } + {upright} { + \bool_set_false:N \g__um_literal_partial_bool + \bool_set_true:N \g__um_uppartial_bool + } + {italic} { + \bool_set_false:N \g__um_literal_partial_bool + \bool_set_false:N \g__um_uppartial_bool + } + {literal} { \bool_set_true:N \g__um_literal_partial_bool } } -\um_keys_choices:nn {vargreek-shape} +\__um_keys_choices:nn {vargreek-shape} { - {unicode} {\bool_set_false:N \g_um_texgreek_bool} - {TeX} {\bool_set_true:N \g_um_texgreek_bool} + {unicode} { \bool_set_false:N \g__um_texgreek_bool } + {TeX} { \bool_set_true:N \g__um_texgreek_bool } } -\um_keys_choices:nn {colon} +\__um_keys_choices:nn {colon} { - {literal} {\bool_set_true:N \g_um_literal_colon_bool} - {TeX} {\bool_set_false:N \g_um_literal_colon_bool} + {literal} { \bool_set_true:N \g__um_literal_colon_bool } + {TeX} { \bool_set_false:N \g__um_literal_colon_bool } } -\um_keys_choices:nn {slash-delimiter} +\__um_keys_choices:nn {slash-delimiter} { - {ascii} {\tl_set:Nn \g_um_slash_delimiter_usv {"002F}} - {frac} {\tl_set:Nn \g_um_slash_delimiter_usv {"2044}} - {div} {\tl_set:Nn \g_um_slash_delimiter_usv {"2215}} + {ascii} { \tl_set:Nn \g__um_slash_delimiter_usv {"002F} } + {frac} { \tl_set:Nn \g__um_slash_delimiter_usv {"2044} } + {div} { \tl_set:Nn \g__um_slash_delimiter_usv {"2215} } } -\um_keys_choices:nn {active-frac} +\__um_keys_choices:nn {active-frac} { {small} { \cs_if_exist:NTF \tfrac + { \bool_set_true:N \l__um_smallfrac_bool } { - \bool_set_true:N \l_um_smallfrac_bool - }{ - \um_warning:n {no-tfrac} - \bool_set_false:N \l_um_smallfrac_bool + \__um_warning:n {no-tfrac} + \bool_set_false:N \l__um_smallfrac_bool } - \use:c {um_setup_active_frac:} + \use:c {__um_setup_active_frac:} } {normalsize} { - \bool_set_false:N \l_um_smallfrac_bool - \use:c {um_setup_active_frac:} + \bool_set_false:N \l__um_smallfrac_bool + \use:c {__um_setup_active_frac:} } } \keys_define:nn {unicode-math} @@ -314,7 +377,7 @@ { \msg_redirect_name:nnn { unicode-math } { ##1 } { none } } } } -\um_keys_choices:nn {trace} +\__um_keys_choices:nn {trace} { {on} {} % default {debug} { \msg_redirect_module:nnn { unicode-math } { log } { warning } } @@ -323,11 +386,19 @@ \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} -\cs_new:Npn \um_warning:n { \msg_warning:nn {unicode-math} } -\cs_new:Npn \um_log:n { \msg_log:nn {unicode-math} } -\cs_new:Npn \um_log:nx { \msg_log:nnx {unicode-math} } +\cs_new:Nn \unimath_get_mathstyle: + { + \tl_use:N \l__um_mathstyle_tl + } + +\cs_new:Npn \__um_error:n { \msg_error:nn {unicode-math} } +\cs_new:Npn \__um_warning:n { \msg_warning:nn {unicode-math} } +\cs_new:Npn \__um_warning:nnn { \msg_warning:nnxx {unicode-math} } +\cs_new:Npn \__um_log:n { \msg_log:nn {unicode-math} } +\cs_new:Npn \__um_log:nx { \msg_log:nnx {unicode-math} } \msg_new:nnn {unicode-math} {no-tfrac} { Small~ fraction~ command~ \protect\tfrac\ not~ defined.\\ @@ -335,7 +406,7 @@ } \msg_new:nnn {unicode-math} {default-math-font} { - Defining~ the~ default~ maths~ font~ as~ '\l_um_fontname_tl'. + Defining~ the~ default~ maths~ font~ as~ '\l__um_fontname_tl'. } \msg_new:nnn {unicode-math} {setup-implicit} { @@ -353,12 +424,21 @@ { Setup~ alphabet:~ #1. } +\msg_new:nnn {unicode-math} {no-alphabet} +{ + I~ am~ trying~ to~ set~ up~ alphabet~"#1"~ but~ there~ are~ no~ configuration~ settings~ for~ it. + See~ file~ "unicode-math-alphabets.dtx". +} +\msg_new:nnn { unicode-math } { no-named-range } + { + I~ am~ trying~ to~ define~ new~ alphabet~ "#2"~ in~ range~ "#1",~ but~ range~ "#1"~ hasn't~ been~ defined~ yet. + } \msg_new:nnn { unicode-math } { missing-alphabets } - { - Missing~math~alphabets~in~font~ "\fontname\l_um_font" \\ \\ - \seq_map_function:NN \l_um_missing_alph_seq \um_print_indent:n - } -\cs_new:Nn \um_print_indent:n { \space\space\space\space #1 \\ } + { + Missing~math~alphabets~in~font~ "\fontname\l__um_font" \\ \\ + \seq_map_function:NN \l__um_missing_alph_seq \__um_print_indent:n + } +\cs_new:Nn \__um_print_indent:n { \space\space\space\space #1 \\ } \msg_new:nnn {unicode-math} {macro-expected} { I've~ expected~ that~ #1~ is~ a~ macro,~ but~ it~ isn't. @@ -405,5 +485,1075 @@ or~ \token_to_str:N \doublecolonsep \c_space_tl won't~ have~ any~ effect~ on~ the~ re-defined~ commands. } -\luatex_if_engine:T { \RequirePackage{unicode-math-luatex} \endinput } -\xetex_if_engine:T { \RequirePackage{unicode-math-xetex} \endinput } + +\usv_set:nnn {normal} {num} {48} +\usv_set:nnn {normal} {Latin}{"1D434} +\usv_set:nnn {normal} {latin}{"1D44E} +\usv_set:nnn {normal} {Greek}{"1D6E2} +\usv_set:nnn {normal} {greek}{"1D6FC} +\usv_set:nnn {normal}{varTheta} {"1D6F3} +\usv_set:nnn {normal}{varepsilon}{"1D716} +\usv_set:nnn {normal}{vartheta} {"1D717} +\usv_set:nnn {normal}{varkappa} {"1D718} +\usv_set:nnn {normal}{varphi} {"1D719} +\usv_set:nnn {normal}{varrho} {"1D71A} +\usv_set:nnn {normal}{varpi} {"1D71B} +\usv_set:nnn {normal} {Nabla}{"1D6FB} +\usv_set:nnn {normal} {partial}{"1D715} + +\usv_set:nnn {up} {num} {48} +\usv_set:nnn {up} {Latin}{65} +\usv_set:nnn {up} {latin}{97} +\usv_set:nnn {up} {Greek}{"391} +\usv_set:nnn {up} {greek}{"3B1} +\usv_set:nnn {it} {Latin}{"1D434} +\usv_set:nnn {it} {latin}{"1D44E} +\usv_set:nnn {it} {Greek}{"1D6E2} +\usv_set:nnn {it} {greek}{"1D6FC} +\usv_set:nnn {bb} {num} {"1D7D8} +\usv_set:nnn {bb} {Latin}{"1D538} +\usv_set:nnn {bb} {latin}{"1D552} +\usv_set:nnn {scr} {Latin}{"1D49C} +\usv_set:nnn {cal} {Latin}{"1D49C} +\usv_set:nnn {scr} {latin}{"1D4B6} +\usv_set:nnn {frak}{Latin}{"1D504} +\usv_set:nnn {frak}{latin}{"1D51E} +\usv_set:nnn {sf} {num} {"1D7E2} +\usv_set:nnn {sfup}{num} {"1D7E2} +\usv_set:nnn {sfit}{num} {"1D7E2} +\usv_set:nnn {sfup}{Latin}{"1D5A0} +\usv_set:nnn {sf} {Latin}{"1D5A0} +\usv_set:nnn {sfup}{latin}{"1D5BA} +\usv_set:nnn {sf} {latin}{"1D5BA} +\usv_set:nnn {sfit}{Latin}{"1D608} +\usv_set:nnn {sfit}{latin}{"1D622} +\usv_set:nnn {tt} {num} {"1D7F6} +\usv_set:nnn {tt} {Latin}{"1D670} +\usv_set:nnn {tt} {latin}{"1D68A} +\usv_set:nnn {bf} {num} {"1D7CE} +\usv_set:nnn {bfup} {num} {"1D7CE} +\usv_set:nnn {bfit} {num} {"1D7CE} +\usv_set:nnn {bfup} {Latin}{"1D400} +\usv_set:nnn {bfup} {latin}{"1D41A} +\usv_set:nnn {bfup} {Greek}{"1D6A8} +\usv_set:nnn {bfup} {greek}{"1D6C2} +\usv_set:nnn {bfit} {Latin}{"1D468} +\usv_set:nnn {bfit} {latin}{"1D482} +\usv_set:nnn {bfit} {Greek}{"1D71C} +\usv_set:nnn {bfit} {greek}{"1D736} +\usv_set:nnn {bffrak}{Latin}{"1D56C} +\usv_set:nnn {bffrak}{latin}{"1D586} +\usv_set:nnn {bfscr} {Latin}{"1D4D0} +\usv_set:nnn {bfcal} {Latin}{"1D4D0} +\usv_set:nnn {bfscr} {latin}{"1D4EA} +\usv_set:nnn {bfsf} {num} {"1D7EC} +\usv_set:nnn {bfsfup}{num} {"1D7EC} +\usv_set:nnn {bfsfit}{num} {"1D7EC} +\usv_set:nnn {bfsfup}{Latin}{"1D5D4} +\usv_set:nnn {bfsfup}{latin}{"1D5EE} +\usv_set:nnn {bfsfup}{Greek}{"1D756} +\usv_set:nnn {bfsfup}{greek}{"1D770} +\usv_set:nnn {bfsfit}{Latin}{"1D63C} +\usv_set:nnn {bfsfit}{latin}{"1D656} +\usv_set:nnn {bfsfit}{Greek}{"1D790} +\usv_set:nnn {bfsfit}{greek}{"1D7AA} +\usv_set:nnn {bfsf}{Latin}{ \bool_if:NTF \g__um_upLatin_bool \g__um_bfsfup_Latin_usv \g__um_bfsfit_Latin_usv } +\usv_set:nnn {bfsf}{latin}{ \bool_if:NTF \g__um_uplatin_bool \g__um_bfsfup_latin_usv \g__um_bfsfit_latin_usv } +\usv_set:nnn {bfsf}{Greek}{ \bool_if:NTF \g__um_upGreek_bool \g__um_bfsfup_Greek_usv \g__um_bfsfit_Greek_usv } +\usv_set:nnn {bfsf}{greek}{ \bool_if:NTF \g__um_upgreek_bool \g__um_bfsfup_greek_usv \g__um_bfsfit_greek_usv } +\usv_set:nnn {bf} {Latin}{ \bool_if:NTF \g__um_bfupLatin_bool \g__um_bfup_Latin_usv \g__um_bfit_Latin_usv } +\usv_set:nnn {bf} {latin}{ \bool_if:NTF \g__um_bfuplatin_bool \g__um_bfup_latin_usv \g__um_bfit_latin_usv } +\usv_set:nnn {bf} {Greek}{ \bool_if:NTF \g__um_bfupGreek_bool \g__um_bfup_Greek_usv \g__um_bfit_Greek_usv } +\usv_set:nnn {bf} {greek}{ \bool_if:NTF \g__um_bfupgreek_bool \g__um_bfup_greek_usv \g__um_bfit_greek_usv } +\usv_set:nnn {up}{varTheta} {"3F4} +\usv_set:nnn {up}{Digamma} {"3DC} +\usv_set:nnn {up}{varepsilon}{"3F5} +\usv_set:nnn {up}{vartheta} {"3D1} +\usv_set:nnn {up}{varkappa} {"3F0} +\usv_set:nnn {up}{varphi} {"3D5} +\usv_set:nnn {up}{varrho} {"3F1} +\usv_set:nnn {up}{varpi} {"3D6} +\usv_set:nnn {up}{digamma} {"3DD} +\usv_set:nnn {bfup}{varTheta} {"1D6B9} +\usv_set:nnn {bfup}{Digamma} {"1D7CA} +\usv_set:nnn {bfup}{varepsilon}{"1D6DC} +\usv_set:nnn {bfup}{vartheta} {"1D6DD} +\usv_set:nnn {bfup}{varkappa} {"1D6DE} +\usv_set:nnn {bfup}{varphi} {"1D6DF} +\usv_set:nnn {bfup}{varrho} {"1D6E0} +\usv_set:nnn {bfup}{varpi} {"1D6E1} +\usv_set:nnn {bfup}{digamma} {"1D7CB} +\usv_set:nnn {it}{varTheta} {"1D6F3} +\usv_set:nnn {it}{varepsilon}{"1D716} +\usv_set:nnn {it}{vartheta} {"1D717} +\usv_set:nnn {it}{varkappa} {"1D718} +\usv_set:nnn {it}{varphi} {"1D719} +\usv_set:nnn {it}{varrho} {"1D71A} +\usv_set:nnn {it}{varpi} {"1D71B} +\usv_set:nnn {bfit}{varTheta} {"1D72D} +\usv_set:nnn {bfit}{varepsilon}{"1D750} +\usv_set:nnn {bfit}{vartheta} {"1D751} +\usv_set:nnn {bfit}{varkappa} {"1D752} +\usv_set:nnn {bfit}{varphi} {"1D753} +\usv_set:nnn {bfit}{varrho} {"1D754} +\usv_set:nnn {bfit}{varpi} {"1D755} +\usv_set:nnn {bfsfup}{varTheta} {"1D767} +\usv_set:nnn {bfsfup}{varepsilon}{"1D78A} +\usv_set:nnn {bfsfup}{vartheta} {"1D78B} +\usv_set:nnn {bfsfup}{varkappa} {"1D78C} +\usv_set:nnn {bfsfup}{varphi} {"1D78D} +\usv_set:nnn {bfsfup}{varrho} {"1D78E} +\usv_set:nnn {bfsfup}{varpi} {"1D78F} +\usv_set:nnn {bfsfit}{varTheta} {"1D7A1} +\usv_set:nnn {bfsfit}{varepsilon}{"1D7C4} +\usv_set:nnn {bfsfit}{vartheta} {"1D7C5} +\usv_set:nnn {bfsfit}{varkappa} {"1D7C6} +\usv_set:nnn {bfsfit}{varphi} {"1D7C7} +\usv_set:nnn {bfsfit}{varrho} {"1D7C8} +\usv_set:nnn {bfsfit}{varpi} {"1D7C9} +\usv_set:nnn {up} {Nabla}{"02207} +\usv_set:nnn {it} {Nabla}{"1D6FB} +\usv_set:nnn {bfup} {Nabla}{"1D6C1} +\usv_set:nnn {bfit} {Nabla}{"1D735} +\usv_set:nnn {bfsfup}{Nabla}{"1D76F} +\usv_set:nnn {bfsfit}{Nabla}{"1D7A9} +\usv_set:nnn {up} {partial}{"02202} +\usv_set:nnn {it} {partial}{"1D715} +\usv_set:nnn {bfup} {partial}{"1D6DB} +\usv_set:nnn {bfit} {partial}{"1D74F} +\usv_set:nnn {bfsfup}{partial}{"1D789} +\usv_set:nnn {bfsfit}{partial}{"1D7C3} +\usv_set:nnn {up}{B}{`\B} +\usv_set:nnn {up}{C}{`\C} +\usv_set:nnn {up}{D}{`\D} +\usv_set:nnn {up}{E}{`\E} +\usv_set:nnn {up}{F}{`\F} +\usv_set:nnn {up}{H}{`\H} +\usv_set:nnn {up}{I}{`\I} +\usv_set:nnn {up}{L}{`\L} +\usv_set:nnn {up}{M}{`\M} +\usv_set:nnn {up}{N}{`\N} +\usv_set:nnn {up}{P}{`\P} +\usv_set:nnn {up}{Q}{`\Q} +\usv_set:nnn {up}{R}{`\R} +\usv_set:nnn {up}{Z}{`\Z} +\usv_set:nnn {it}{B}{"1D435} +\usv_set:nnn {it}{C}{"1D436} +\usv_set:nnn {it}{D}{"1D437} +\usv_set:nnn {it}{E}{"1D438} +\usv_set:nnn {it}{F}{"1D439} +\usv_set:nnn {it}{H}{"1D43B} +\usv_set:nnn {it}{I}{"1D43C} +\usv_set:nnn {it}{L}{"1D43F} +\usv_set:nnn {it}{M}{"1D440} +\usv_set:nnn {it}{N}{"1D441} +\usv_set:nnn {it}{P}{"1D443} +\usv_set:nnn {it}{Q}{"1D444} +\usv_set:nnn {it}{R}{"1D445} +\usv_set:nnn {it}{Z}{"1D44D} +\usv_set:nnn {up}{d}{`\d} +\usv_set:nnn {up}{e}{`\e} +\usv_set:nnn {up}{g}{`\g} +\usv_set:nnn {up}{h}{`\h} +\usv_set:nnn {up}{i}{`\i} +\usv_set:nnn {up}{j}{`\j} +\usv_set:nnn {up}{o}{`\o} +\usv_set:nnn {it}{d}{"1D451} +\usv_set:nnn {it}{e}{"1D452} +\usv_set:nnn {it}{g}{"1D454} +\usv_set:nnn {it}{h}{"0210E} +\usv_set:nnn {it}{i}{"1D456} +\usv_set:nnn {it}{j}{"1D457} +\usv_set:nnn {it}{o}{"1D45C} +\usv_set:nnn {bb} {h}{"1D559} +\usv_set:nnn {tt} {h}{"1D691} +\usv_set:nnn {scr} {h}{"1D4BD} +\usv_set:nnn {frak} {h}{"1D525} +\usv_set:nnn {bfup} {h}{"1D421} +\usv_set:nnn {bfit} {h}{"1D489} +\usv_set:nnn {sfup} {h}{"1D5C1} +\usv_set:nnn {sfit} {h}{"1D629} +\usv_set:nnn {bffrak}{h}{"1D58D} +\usv_set:nnn {bfscr} {h}{"1D4F1} +\usv_set:nnn {bfsfup}{h}{"1D5F5} +\usv_set:nnn {bfsfit}{h}{"1D65D} +\usv_set:nnn {up}{dotlessi}{"00131} +\usv_set:nnn {up}{dotlessj}{"00237} +\usv_set:nnn {it}{dotlessi}{"1D6A4} +\usv_set:nnn {it}{dotlessj}{"1D6A5} +\usv_set:nnn {bb}{C}{"2102} +\usv_set:nnn {bb}{H}{"210D} +\usv_set:nnn {bb}{N}{"2115} +\usv_set:nnn {bb}{P}{"2119} +\usv_set:nnn {bb}{Q}{"211A} +\usv_set:nnn {bb}{R}{"211D} +\usv_set:nnn {bb}{Z}{"2124} +\usv_set:nnn {up}{Pi} {"003A0} +\usv_set:nnn {up}{pi} {"003C0} +\usv_set:nnn {up}{Gamma} {"00393} +\usv_set:nnn {up}{gamma} {"003B3} +\usv_set:nnn {up}{summation}{"02211} +\usv_set:nnn {it}{Pi} {"1D6F1} +\usv_set:nnn {it}{pi} {"1D70B} +\usv_set:nnn {it}{Gamma} {"1D6E4} +\usv_set:nnn {it}{gamma} {"1D6FE} +\usv_set:nnn {bb}{Pi} {"0213F} +\usv_set:nnn {bb}{pi} {"0213C} +\usv_set:nnn {bb}{Gamma} {"0213E} +\usv_set:nnn {bb}{gamma} {"0213D} +\usv_set:nnn {bb}{summation}{"02140} +\usv_set:nnn {bbit}{D}{"2145} +\usv_set:nnn {bbit}{d}{"2146} +\usv_set:nnn {bbit}{e}{"2147} +\usv_set:nnn {bbit}{i}{"2148} +\usv_set:nnn {bbit}{j}{"2149} +\usv_set:nnn {scr}{B}{"212C} +\usv_set:nnn {scr}{E}{"2130} +\usv_set:nnn {scr}{F}{"2131} +\usv_set:nnn {scr}{H}{"210B} +\usv_set:nnn {scr}{I}{"2110} +\usv_set:nnn {scr}{L}{"2112} +\usv_set:nnn {scr}{M}{"2133} +\usv_set:nnn {scr}{R}{"211B} +\usv_set:nnn {scr}{e}{"212F} +\usv_set:nnn {scr}{g}{"210A} +\usv_set:nnn {scr}{o}{"2134} +\usv_set:nnn {cal}{B}{"212C} +\usv_set:nnn {cal}{E}{"2130} +\usv_set:nnn {cal}{F}{"2131} +\usv_set:nnn {cal}{H}{"210B} +\usv_set:nnn {cal}{I}{"2110} +\usv_set:nnn {cal}{L}{"2112} +\usv_set:nnn {cal}{M}{"2133} +\usv_set:nnn {cal}{R}{"211B} +\usv_set:nnn {frak}{C}{"212D} +\usv_set:nnn {frak}{H}{"210C} +\usv_set:nnn {frak}{I}{"2111} +\usv_set:nnn {frak}{R}{"211C} +\usv_set:nnn {frak}{Z}{"2128} +\luatex_if_engine:T { \RequirePackage{unicode-math-luatex} } +\xetex_if_engine:T { \RequirePackage{unicode-math-xetex} } +\__um_new_alphabet_config:nnn {up} {num} + { + \__um_set_normal_numbers:nn {up} {#1} + \__um_set_mathalphabet_numbers:nnn {up} {up} {#1} + } + +\__um_new_alphabet_config:nnn {up} {Latin} + { + \bool_if:NTF \g__um_literal_bool { \__um_set_normal_Latin:nn {up} {#1} } + { + \bool_if:NT \g__um_upLatin_bool { \__um_set_normal_Latin:nn {up,it} {#1} } + } + \__um_set_mathalphabet_Latin:nnn {up} {up,it} {#1} + \__um_set_mathalphabet_Latin:nnn {literal} {up} {up} + \__um_set_mathalphabet_Latin:nnn {literal} {it} {it} + } + +\__um_new_alphabet_config:nnn {up} {latin} + { + \bool_if:NTF \g__um_literal_bool { \__um_set_normal_latin:nn {up} {#1} } + { + \bool_if:NT \g__um_uplatin_bool + { + \__um_set_normal_latin:nn {up,it} {#1} + \__um_set_normal_char:nnn {h} {up,it} {#1} + \__um_set_normal_char:nnn {dotlessi} {up,it} {#1} + \__um_set_normal_char:nnn {dotlessj} {up,it} {#1} + } + } + \__um_set_mathalphabet_latin:nnn {up} {up,it}{#1} + \__um_set_mathalphabet_latin:nnn {literal} {up} {up} + \__um_set_mathalphabet_latin:nnn {literal} {it} {it} + } + +\__um_new_alphabet_config:nnn {up} {Greek} + { + \bool_if:NTF \g__um_literal_bool { \__um_set_normal_Greek:nn {up}{#1} } + { + \bool_if:NT \g__um_upGreek_bool { \__um_set_normal_Greek:nn {up,it}{#1} } + } + \__um_set_mathalphabet_Greek:nnn {up} {up,it}{#1} + \__um_set_mathalphabet_Greek:nnn {literal} {up} {up} + \__um_set_mathalphabet_Greek:nnn {literal} {it} {it} + } + +\__um_new_alphabet_config:nnn {up} {greek} + { + \bool_if:NTF \g__um_literal_bool { \__um_set_normal_greek:nn {up} {#1} } + { + \bool_if:NT \g__um_upgreek_bool + { + \__um_set_normal_greek:nn {up,it} {#1} + } + } + \__um_set_mathalphabet_greek:nnn {up} {up,it} {#1} + \__um_set_mathalphabet_greek:nnn {literal} {up} {up} + \__um_set_mathalphabet_greek:nnn {literal} {it} {it} + } + +\__um_new_alphabet_config:nnn {up} {misc} + { + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_normal_char:nnn {Nabla}{up}{up} + } + { + \bool_if:NT \g__um_upNabla_bool + { + \__um_set_normal_char:nnn {Nabla}{up,it}{up} + } + } + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_normal_char:nnn {partial}{up}{up} + } + { + \bool_if:NT \g__um_uppartial_bool + { + \__um_set_normal_char:nnn {partial}{up,it}{up} + } + } + \__um_set_mathalphabet_pos:nnnn {up} {partial} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {up} {Nabla} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {up} {dotlessi} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {up} {dotlessj} {up,it} {#1} + } +\__um_new_alphabet_config:nnn {it} {Latin} + { + \bool_if:NTF \g__um_literal_bool { \__um_set_normal_Latin:nn {it} {#1} } + { + \bool_if:NF \g__um_upLatin_bool { \__um_set_normal_Latin:nn {up,it} {#1} } + } + \__um_set_mathalphabet_Latin:nnn {it}{up,it}{#1} + } + +\__um_new_alphabet_config:nnn {it} {latin} + { + \bool_if:NTF \g__um_literal_bool + { + \__um_set_normal_latin:nn {it} {#1} + \__um_set_normal_char:nnn {h}{it}{#1} + } + { + \bool_if:NF \g__um_uplatin_bool + { + \__um_set_normal_latin:nn {up,it} {#1} + \__um_set_normal_char:nnn {h}{up,it}{#1} + \__um_set_normal_char:nnn {dotlessi}{up,it}{#1} + \__um_set_normal_char:nnn {dotlessj}{up,it}{#1} + } + } + \__um_set_mathalphabet_latin:nnn {it} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {it} {dotlessi} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {it} {dotlessj} {up,it} {#1} + } + +\__um_new_alphabet_config:nnn {it} {Greek} + { + \bool_if:NTF \g__um_literal_bool + { + \__um_set_normal_Greek:nn {it}{#1} + } + { + \bool_if:NF \g__um_upGreek_bool { \__um_set_normal_Greek:nn {up,it}{#1} } + } + \__um_set_mathalphabet_Greek:nnn {it} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {it} {greek} + { + \bool_if:NTF \g__um_literal_bool + { + \__um_set_normal_greek:nn {it} {#1} + } + { + \bool_if:NF \g__um_upgreek_bool { \__um_set_normal_greek:nn {it,up} {#1} } + } + \__um_set_mathalphabet_greek:nnn {it} {up,it} {#1} + } + +\__um_new_alphabet_config:nnn {it} {misc} + { + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_normal_char:nnn {Nabla}{it}{it} + } + { + \bool_if:NF \g__um_upNabla_bool + { + \__um_set_normal_char:nnn {Nabla}{up,it}{it} + } + } + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_normal_char:nnn {partial}{it}{it} + } + { + \bool_if:NF \g__um_uppartial_bool + { + \__um_set_normal_char:nnn {partial}{up,it}{it} + } + } + \__um_set_mathalphabet_pos:nnnn {it} {partial} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {it} {Nabla} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {bb} {latin} + { + \__um_set_mathalphabet_latin:nnn {bb} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {bb} {Latin} + { + \__um_set_mathalphabet_Latin:nnn {bb} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {bb} {C} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {H} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {N} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {P} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {Q} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {R} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {Z} {up,it} {#1} + } + +\__um_new_alphabet_config:nnn {bb} {num} + { + \__um_set_mathalphabet_numbers:nnn {bb} {up}{#1} + } + +\__um_new_alphabet_config:nnn {bb} {misc} + { + \__um_set_mathalphabet_pos:nnnn {bb} {Pi} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {pi} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {Gamma} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {gamma} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bb} {summation} {up} {#1} + } + +\__um_new_alphabet_config:nnn {bbit} {misc} + { + \__um_set_mathalphabet_pos:nnnn {bbit} {D} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bbit} {d} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bbit} {e} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bbit} {i} {up,it} {#1} + \__um_set_mathalphabet_pos:nnnn {bbit} {j} {up,it} {#1} + } +\__um_new_alphabet_config:nnn {scr} {Latin} + { + \__um_set_mathalphabet_Latin:nnn {scr} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {B}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {E}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {F}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {H}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {I}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {L}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {M}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {R}{up,it}{#1} + } + +\__um_new_alphabet_config:nnn {scr} {latin} + { + \__um_set_mathalphabet_latin:nnn {scr} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {e}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {g}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {scr} {o}{up,it}{#1} + } +\__um_new_alphabet_config:nnn {cal} {Latin} + { + \__um_set_mathalphabet_Latin:nnn {cal} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {cal} {B}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {cal} {E}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {cal} {F}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {cal} {H}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {cal} {I}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {cal} {L}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {cal} {M}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {cal} {R}{up,it}{#1} + } +\__um_new_alphabet_config:nnn {frak} {Latin} + { + \__um_set_mathalphabet_Latin:nnn {frak} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {frak} {C}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {frak} {H}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {frak} {I}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {frak} {R}{up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {frak} {Z}{up,it}{#1} + } +\__um_new_alphabet_config:nnn {frak} {latin} + { + \__um_set_mathalphabet_latin:nnn {frak} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {sfup} {num} + { + \__um_set_mathalphabet_numbers:nnn {sf} {up}{#1} + \__um_set_mathalphabet_numbers:nnn {sfup} {up}{#1} + } +\__um_new_alphabet_config:nnn {sfup} {Latin} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_Latin:nn {sfup} {#1} + \__um_set_mathalphabet_Latin:nnn {sf} {up}{#1} + } + { + \bool_if:NT \g__um_upsans_bool + { + \__um_set_normal_Latin:nn {sfup,sfit} {#1} + \__um_set_mathalphabet_Latin:nnn {sf} {up,it}{#1} + } + } + \__um_set_mathalphabet_Latin:nnn {sfup} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {sfup} {latin} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_latin:nn {sfup} {#1} + \__um_set_mathalphabet_latin:nnn {sf} {up}{#1} + } + { + \bool_if:NT \g__um_upsans_bool + { + \__um_set_normal_latin:nn {sfup,sfit} {#1} + \__um_set_mathalphabet_latin:nnn {sf} {up,it}{#1} + } + } + \__um_set_mathalphabet_latin:nnn {sfup} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {sfit} {Latin} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_Latin:nn {sfit} {#1} + \__um_set_mathalphabet_Latin:nnn {sf} {it}{#1} + } + { + \bool_if:NF \g__um_upsans_bool + { + \__um_set_normal_Latin:nn {sfup,sfit} {#1} + \__um_set_mathalphabet_Latin:nnn {sf} {up,it}{#1} + } + } + \__um_set_mathalphabet_Latin:nnn {sfit} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {sfit} {latin} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_latin:nn {sfit} {#1} + \__um_set_mathalphabet_latin:nnn {sf} {it}{#1} + } + { + \bool_if:NF \g__um_upsans_bool + { + \__um_set_normal_latin:nn {sfup,sfit} {#1} + \__um_set_mathalphabet_latin:nnn {sf} {up,it}{#1} + } + } + \__um_set_mathalphabet_latin:nnn {sfit} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {tt} {num} + { + \__um_set_mathalphabet_numbers:nnn {tt} {up}{#1} + } +\__um_new_alphabet_config:nnn {tt} {Latin} + { + \__um_set_mathalphabet_Latin:nnn {tt} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {tt} {latin} + { + \__um_set_mathalphabet_latin:nnn {tt} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {bfit} {Latin} + { + \bool_if:NF \g__um_bfupLatin_bool + { + \__um_set_normal_Latin:nn {bfup,bfit} {#1} + } + \__um_set_mathalphabet_Latin:nnn {bfit} {up,it}{#1} + \bool_if:NTF \g__um_bfliteral_bool + { + \__um_set_normal_Latin:nn {bfit} {#1} + \__um_set_mathalphabet_Latin:nnn {bf} {it}{#1} + } + { + \bool_if:NF \g__um_bfupLatin_bool + { + \__um_set_normal_Latin:nn {bfup,bfit} {#1} + \__um_set_mathalphabet_Latin:nnn {bf} {up,it}{#1} + } + } + } + +\__um_new_alphabet_config:nnn {bfit} {latin} + { + \bool_if:NF \g__um_bfuplatin_bool + { + \__um_set_normal_latin:nn {bfup,bfit} {#1} + } + \__um_set_mathalphabet_latin:nnn {bfit} {up,it}{#1} + \bool_if:NTF \g__um_bfliteral_bool + { + \__um_set_normal_latin:nn {bfit} {#1} + \__um_set_mathalphabet_latin:nnn {bf} {it}{#1} + } + { + \bool_if:NF \g__um_bfuplatin_bool + { + \__um_set_normal_latin:nn {bfup,bfit} {#1} + \__um_set_mathalphabet_latin:nnn {bf} {up,it}{#1} + } + } + } + +\__um_new_alphabet_config:nnn {bfit} {Greek} + { + \__um_set_mathalphabet_Greek:nnn {bfit} {up,it}{#1} + \bool_if:NTF \g__um_bfliteral_bool + { + \__um_set_normal_Greek:nn {bfit}{#1} + \__um_set_mathalphabet_Greek:nnn {bf} {it}{#1} + } + { + \bool_if:NF \g__um_bfupGreek_bool + { + \__um_set_normal_Greek:nn {bfup,bfit}{#1} + \__um_set_mathalphabet_Greek:nnn {bf} {up,it}{#1} + } + } + } + +\__um_new_alphabet_config:nnn {bfit} {greek} + { + \__um_set_mathalphabet_greek:nnn {bfit} {up,it} {#1} + \bool_if:NTF \g__um_bfliteral_bool + { + \__um_set_normal_greek:nn {bfit} {#1} + \__um_set_mathalphabet_greek:nnn {bf} {it} {#1} + } + { + \bool_if:NF \g__um_bfupgreek_bool + { + \__um_set_normal_greek:nn {bfit,bfup} {#1} + \__um_set_mathalphabet_greek:nnn {bf} {up,it} {#1} + } + } + } + +\__um_new_alphabet_config:nnn {bfit} {misc} + { + \bool_if:NTF \g__um_literal_Nabla_bool + { \__um_set_normal_char:nnn {Nabla}{bfit}{#1} } + { + \bool_if:NF \g__um_upNabla_bool + { \__um_set_normal_char:nnn {Nabla}{bfup,bfit}{#1} } + } + \bool_if:NTF \g__um_literal_partial_bool + { \__um_set_normal_char:nnn {partial}{bfit}{#1} } + { + \bool_if:NF \g__um_uppartial_bool + { \__um_set_normal_char:nnn {partial}{bfup,bfit}{#1} } + } + \__um_set_mathalphabet_pos:nnnn {bfit} {partial} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {bfit} {Nabla} {up,it}{#1} + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_mathalphabet_pos:nnnn {bf} {partial} {it}{#1} + } + { + \bool_if:NF \g__um_uppartial_bool + { + \__um_set_mathalphabet_pos:nnnn {bf} {partial} {up,it}{#1} + } + } + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_mathalphabet_pos:nnnn {bf} {Nabla} {it}{#1} + } + { + \bool_if:NF \g__um_upNabla_bool + { + \__um_set_mathalphabet_pos:nnnn {bf} {Nabla} {up,it}{#1} + } + } + } +\__um_new_alphabet_config:nnn {bfup} {num} + { + \__um_set_mathalphabet_numbers:nnn {bf} {up}{#1} + \__um_set_mathalphabet_numbers:nnn {bfup} {up}{#1} + } + +\__um_new_alphabet_config:nnn {bfup} {Latin} + { + \bool_if:NT \g__um_bfupLatin_bool + { + \__um_set_normal_Latin:nn {bfup,bfit} {#1} + } + \__um_set_mathalphabet_Latin:nnn {bfup} {up,it}{#1} + \bool_if:NTF \g__um_bfliteral_bool + { + \__um_set_normal_Latin:nn {bfup} {#1} + \__um_set_mathalphabet_Latin:nnn {bf} {up}{#1} + } + { + \bool_if:NT \g__um_bfupLatin_bool + { + \__um_set_normal_Latin:nn {bfup,bfit} {#1} + \__um_set_mathalphabet_Latin:nnn {bf} {up,it}{#1} + } + } + } + +\__um_new_alphabet_config:nnn {bfup} {latin} + { + \bool_if:NT \g__um_bfuplatin_bool + { + \__um_set_normal_latin:nn {bfup,bfit} {#1} + } + \__um_set_mathalphabet_latin:nnn {bfup} {up,it}{#1} + \bool_if:NTF \g__um_bfliteral_bool + { + \__um_set_normal_latin:nn {bfup} {#1} + \__um_set_mathalphabet_latin:nnn {bf} {up}{#1} + } + { + \bool_if:NT \g__um_bfuplatin_bool + { + \__um_set_normal_latin:nn {bfup,bfit} {#1} + \__um_set_mathalphabet_latin:nnn {bf} {up,it}{#1} + } + } + } +\__um_new_alphabet_config:nnn {bfup} {Greek} + { + \__um_set_mathalphabet_Greek:nnn {bfup} {up,it}{#1} + \bool_if:NTF \g__um_bfliteral_bool + { + \__um_set_normal_Greek:nn {bfup}{#1} + \__um_set_mathalphabet_Greek:nnn {bf} {up}{#1} + } + { + \bool_if:NT \g__um_bfupGreek_bool + { + \__um_set_normal_Greek:nn {bfup,bfit}{#1} + \__um_set_mathalphabet_Greek:nnn {bf} {up,it}{#1} + } + } + } + +\__um_new_alphabet_config:nnn {bfup} {greek} + { + \__um_set_mathalphabet_greek:nnn {bfup} {up,it} {#1} + \bool_if:NTF \g__um_bfliteral_bool + { + \__um_set_normal_greek:nn {bfup} {#1} + \__um_set_mathalphabet_greek:nnn {bf} {up} {#1} + } + { + \bool_if:NT \g__um_bfupgreek_bool + { + \__um_set_normal_greek:nn {bfup,bfit} {#1} + \__um_set_mathalphabet_greek:nnn {bf} {up,it} {#1} + } + } + } + +\__um_new_alphabet_config:nnn {bfup} {misc} + { + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_normal_char:nnn {Nabla}{bfup}{#1} + } + { + \bool_if:NT \g__um_upNabla_bool + { + \__um_set_normal_char:nnn {Nabla}{bfup,bfit}{#1} + } + } + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_normal_char:nnn {partial}{bfup}{#1} + } + { + \bool_if:NT \g__um_uppartial_bool + { + \__um_set_normal_char:nnn {partial}{bfup,bfit}{#1} + } + } + \__um_set_mathalphabet_pos:nnnn {bfup} {partial} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {bfup} {Nabla} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {bfup} {digamma} {up}{#1} + \__um_set_mathalphabet_pos:nnnn {bfup} {Digamma} {up}{#1} + \__um_set_mathalphabet_pos:nnnn {bf} {digamma} {up}{#1} + \__um_set_mathalphabet_pos:nnnn {bf} {Digamma} {up}{#1} + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_mathalphabet_pos:nnnn {bf} {partial} {up}{#1} + } + { + \bool_if:NT \g__um_uppartial_bool + { + \__um_set_mathalphabet_pos:nnnn {bf} {partial} {up,it}{#1} + } + } + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_mathalphabet_pos:nnnn {bf} {Nabla} {up}{#1} + } + { + \bool_if:NT \g__um_upNabla_bool + { + \__um_set_mathalphabet_pos:nnnn {bf} {Nabla} {up,it}{#1} + } + } + } +\__um_new_alphabet_config:nnn {bffrak} {Latin} + { + \__um_set_mathalphabet_Latin:nnn {bffrak} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {bffrak} {latin} + { + \__um_set_mathalphabet_latin:nnn {bffrak} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {bfscr} {Latin} + { + \__um_set_mathalphabet_Latin:nnn {bfscr} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {bfscr} {latin} + { + \__um_set_mathalphabet_latin:nnn {bfscr} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {bfcal} {Latin} + { + \__um_set_mathalphabet_Latin:nnn {bfcal} {up,it}{#1} + } +\__um_new_alphabet_config:nnn {bfsfup} {num} + { + \__um_set_mathalphabet_numbers:nnn {bfsf} {up}{#1} + \__um_set_mathalphabet_numbers:nnn {bfsfup} {up}{#1} + } +\__um_new_alphabet_config:nnn {bfsfup} {Latin} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_Latin:nn {bfsfup} {#1} + \__um_set_mathalphabet_Latin:nnn {bfsf} {up}{#1} + } + { + \bool_if:NT \g__um_upsans_bool + { + \__um_set_normal_Latin:nn {bfsfup,bfsfit} {#1} + \__um_set_mathalphabet_Latin:nnn {bfsf} {up,it}{#1} + } + } + \__um_set_mathalphabet_Latin:nnn {bfsfup} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {bfsfup} {latin} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_latin:nn {bfsfup} {#1} + \__um_set_mathalphabet_latin:nnn {bfsf} {up}{#1} + } + { + \bool_if:NT \g__um_upsans_bool + { + \__um_set_normal_latin:nn {bfsfup,bfsfit} {#1} + \__um_set_mathalphabet_latin:nnn {bfsf} {up,it}{#1} + } + } + \__um_set_mathalphabet_latin:nnn {bfsfup} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {bfsfup} {Greek} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_Greek:nn {bfsfup}{#1} + \__um_set_mathalphabet_Greek:nnn {bfsf} {up}{#1} + } + { + \bool_if:NT \g__um_upsans_bool + { + \__um_set_normal_Greek:nn {bfsfup,bfsfit}{#1} + \__um_set_mathalphabet_Greek:nnn {bfsf} {up,it}{#1} + } + } + \__um_set_mathalphabet_Greek:nnn {bfsfup} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {bfsfup} {greek} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_greek:nn {bfsfup} {#1} + \__um_set_mathalphabet_greek:nnn {bfsf} {up} {#1} + } + { + \bool_if:NT \g__um_upsans_bool + { + \__um_set_normal_greek:nn {bfsfup,bfsfit} {#1} + \__um_set_mathalphabet_greek:nnn {bfsf} {up,it} {#1} + } + } + \__um_set_mathalphabet_greek:nnn {bfsfup} {up,it} {#1} + } +\__um_new_alphabet_config:nnn {bfsfup} {misc} + { + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_normal_char:nnn {Nabla}{bfsfup}{#1} + } + { + \bool_if:NT \g__um_upNabla_bool + { + \__um_set_normal_char:nnn {Nabla}{bfsfup,bfsfit}{#1} + } + } + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_normal_char:nnn {partial}{bfsfup}{#1} + } + { + \bool_if:NT \g__um_uppartial_bool + { + \__um_set_normal_char:nnn {partial}{bfsfup,bfsfit}{#1} + } + } + \__um_set_mathalphabet_pos:nnnn {bfsfup} {partial} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {bfsfup} {Nabla} {up,it}{#1} + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_mathalphabet_pos:nnnn {bfsf} {partial} {up}{#1} + } + { + \bool_if:NT \g__um_uppartial_bool + { + \__um_set_mathalphabet_pos:nnnn {bfsf} {partial} {up,it}{#1} + } + } + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_mathalphabet_pos:nnnn {bfsf} {Nabla} {up}{#1} + } + { + \bool_if:NT \g__um_upNabla_bool + { + \__um_set_mathalphabet_pos:nnnn {bfsf} {Nabla} {up,it}{#1} + } + } + } +\__um_new_alphabet_config:nnn {bfsfit} {Latin} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_Latin:nn {bfsfit} {#1} + \__um_set_mathalphabet_Latin:nnn {bfsf} {it}{#1} + } + { + \bool_if:NF \g__um_upsans_bool + { + \__um_set_normal_Latin:nn {bfsfup,bfsfit} {#1} + \__um_set_mathalphabet_Latin:nnn {bfsf} {up,it}{#1} + } + } + \__um_set_mathalphabet_Latin:nnn {bfsfit} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {bfsfit} {latin} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_latin:nn {bfsfit} {#1} + \__um_set_mathalphabet_latin:nnn {bfsf} {it}{#1} + } + { + \bool_if:NF \g__um_upsans_bool + { + \__um_set_normal_latin:nn {bfsfup,bfsfit} {#1} + \__um_set_mathalphabet_latin:nnn {bfsf} {up,it}{#1} + } + } + \__um_set_mathalphabet_latin:nnn {bfsfit} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {bfsfit} {Greek} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_Greek:nn {bfsfit}{#1} + \__um_set_mathalphabet_Greek:nnn {bfsf} {it}{#1} + } + { + \bool_if:NF \g__um_upsans_bool + { + \__um_set_normal_Greek:nn {bfsfup,bfsfit}{#1} + \__um_set_mathalphabet_Greek:nnn {bfsf} {up,it}{#1} + } + } + \__um_set_mathalphabet_Greek:nnn {bfsfit} {up,it}{#1} + } + +\__um_new_alphabet_config:nnn {bfsfit} {greek} + { + \bool_if:NTF \g__um_sfliteral_bool + { + \__um_set_normal_greek:nn {bfsfit} {#1} + \__um_set_mathalphabet_greek:nnn {bfsf} {it} {#1} + } + { + \bool_if:NF \g__um_upsans_bool + { + \__um_set_normal_greek:nn {bfsfup,bfsfit} {#1} + \__um_set_mathalphabet_greek:nnn {bfsf} {up,it} {#1} + } + } + \__um_set_mathalphabet_greek:nnn {bfsfit} {up,it} {#1} + } + +\__um_new_alphabet_config:nnn {bfsfit} {misc} + { + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_normal_char:nnn {Nabla}{bfsfit}{#1} + } + { + \bool_if:NF \g__um_upNabla_bool + { + \__um_set_normal_char:nnn {Nabla}{bfsfup,bfsfit}{#1} + } + } + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_normal_char:nnn {partial}{bfsfit}{#1} + } + { + \bool_if:NF \g__um_uppartial_bool + { + \__um_set_normal_char:nnn {partial}{bfsfup,bfsfit}{#1} + } + } + \__um_set_mathalphabet_pos:nnnn {bfsfit} {partial} {up,it}{#1} + \__um_set_mathalphabet_pos:nnnn {bfsfit} {Nabla} {up,it}{#1} + \bool_if:NTF \g__um_literal_partial_bool + { + \__um_set_mathalphabet_pos:nnnn {bfsf} {partial} {it}{#1} + } + { + \bool_if:NF \g__um_uppartial_bool + { + \__um_set_mathalphabet_pos:nnnn {bfsf} {partial} {up,it}{#1} + } + } + \bool_if:NTF \g__um_literal_Nabla_bool + { + \__um_set_mathalphabet_pos:nnnn {bfsf} {Nabla} {it}{#1} + } + { + \bool_if:NF \g__um_upNabla_bool + { + \__um_set_mathalphabet_pos:nnnn {bfsf} {Nabla} {up,it}{#1} + } + } + } |