diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx | 1261 |
1 files changed, 754 insertions, 507 deletions
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 ac8271416b2..fe8cdb34302 100644 --- a/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx @@ -17,7 +17,11 @@ This work is "author-maintained" by Will Robertson. \endpreamble \nopostamble \askforoverwritefalse -\generate{\file{unicode-math.sty}{\from{unicode-math.dtx}{package}}} +\generate{\file{unicode-math.sty}{ + \from{unicode-math.dtx}{preamble} + \from{unicode-math.dtx}{msg} + \from{unicode-math.dtx}{package,stix} +}} \nopreamble \def\tempa{plain} \ifx\tempa\fmtname\endgroup\expandafter\bye\fi @@ -25,10 +29,10 @@ This work is "author-maintained" by Will Robertson. \endgroup \ProvidesFile{unicode-math.dtx} %</internal> -%<package>\ProvidesPackage{unicode-math} -%<*package> - [2010/06/03 v0.5 Unicode maths in XeLaTeX] -%</package> +%<preamble>\ProvidesPackage{unicode-math} +%<*preamble> + [2010/07/14 v0.5a Unicode maths in XeLaTeX] +%</preamble> %<*internal> \documentclass{ltxdoc} \usepackage{dtx-style} @@ -208,8 +212,8 @@ This work is "author-maintained" by Will Robertson. % 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., |\mathcal{H}| -% to $\mathcal{H}$ and so on, all for Unicode glyphs within a single font. +% 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, @@ -466,8 +470,8 @@ This work is "author-maintained" by Will Robertson. % & & Bold & \cs{mathbfit} & \Y & \Y & \M \\ % Sans serif & Upright & Normal & \cs{mathsfup} & \Y & & \Y \\ % & Italic & Normal & \cs{mathsfit} & \Y & & \M \\ -% & Upright & Bold & \cs{mathsfbfup} & \Y & \Y & \Y \\ -% & Italic & Bold & \cs{mathsfbfit} & \Y & \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 & & \\ @@ -496,6 +500,28 @@ This work is "author-maintained" by Will Robertson. % 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} +% \end{verbatim} +% An example is shown below. +% \begin{quote} +% \setmathfont[range=\mathscr]{XITS Math} +% \setmathfont[range=\mathcal,StylisticSet=1]{XITS Math} +% 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} @@ -528,12 +554,12 @@ This work is "author-maintained" by Will Robertson. % \multicolumn{2}{@{}l}{Description} & Glyph % \\ \cmidrule(r){1-2}\cmidrule(l){3-3} % Upright & Serif & $\mathup\nabla$ \\ -% & Bold serif & $\mathup\mbfnabla$ \\ -% & Bold sans & \fontspec{STIXGeneral-BoldItalic}\char"1D76F \\ +% & Bold serif & $\mathbfup\nabla$ \\ +% & Bold sans & \umfont\char"1D76F \\ % \cmidrule(lr){1-2}\cmidrule(lr){3-3} % Italic & Serif & $\mathit\nabla$ \\ % & Bold serif & $\mathbfit\nabla$ \\ -% & Bold sans & \fontspec{STIXGeneral-Bold}\char"1D7A9 \\ +% & Bold sans & \umfont\char"1D7A9 \\ % \bottomrule % \end{tabular} % \end{table} @@ -839,10 +865,11 @@ This work is "author-maintained" by Will Robertson. % as input characters to abbreviate common fractions. % % \centerline{\fontspec{Calibri} -% ¼ ½ ¾ ⅐ ⅑ ⅒ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞} +% ¼ ½ ¾ ↉ ⅐ ⅑ ⅒ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞} % % For example, instead of writing `|\tfrac12 x|', it's more readable to have -% `|½x|' in the source instead. +% `|½x|' in the source instead. (There are four missing glyphs above for +% $0/3$, $1/7$, $1/9$, and $1/10$; I don't have a font that contains them.) % % 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 @@ -898,9 +925,7 @@ This work is "author-maintained" by Will Robertson. % \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. -% Namely, $\triangle$ and $\vartriangle$ and $\increment$ and $\mathup\Delta$. -% See \tabref{uptriangles} for the full summary. +% 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 @@ -908,7 +933,7 @@ This work is "author-maintained" by Will Robertson. % 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: $\increment x$. +% 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 @@ -957,9 +982,8 @@ This work is "author-maintained" by Will Robertson. % \StopEventually{} % % \part{The \pkg{unicode-math} package} -%\iffalse -%<*package> -%\fi +% +%<*preamble> % % \section{Things we need} % @@ -979,6 +1003,7 @@ This work is "author-maintained" by Will Robertson. \RequirePackage{xparse}[2009/08/31] \RequirePackage{l3keys2e} \RequirePackage{fontspec}[2010/05/18] +\RequirePackage{catchfile} % \end{macrocode} % % Start using \LaTeX3 --- finally! @@ -1104,6 +1129,17 @@ This work is "author-maintained" by Will Robertson. \cs_generate_variant:Nn \fontspec_select:nn {x} % \end{macrocode} % +% \begin{macrocode} +%</preamble> +% \end{macrocode} +% +% (Error messages and warning definitions go here from the |msg| chunk +% defined in \secref[vref]{codemsg}.) +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% % \subsection{Alphabet Unicode positions} % % Before we begin, let's define the positions of the various Unicode @@ -1132,6 +1168,7 @@ This work is "author-maintained" by Will Robertson. \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} @@ -1164,6 +1201,7 @@ This work is "author-maintained" by Will Robertson. \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} @@ -1394,6 +1432,17 @@ This work is "author-maintained" by Will Robertson. \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} @@ -1419,222 +1468,224 @@ This work is "author-maintained" by Will Robertson. % % \paragraph{Upright} % \begin{macrocode} -\usv_set:nnn {stix_sfup}{partial}{"E17C} -\usv_set:nnn {stix_sfup}{Greek}{"E17D} -\usv_set:nnn {stix_sfup}{greek}{"E196} -\usv_set:nnn {stix_sfup}{varTheta}{"E18E} -\usv_set:nnn {stix_sfup}{varepsilon}{"E1AF} -\usv_set:nnn {stix_sfup}{vartheta}{"E1B0} -\usv_set:nnn {stix_sfup}{varkappa}{0000} % ??? -\usv_set:nnn {stix_sfup}{varphi}{"E1B1} -\usv_set:nnn {stix_sfup}{varrho}{"E1B2} -\usv_set:nnn {stix_sfup}{varpi}{"E1B3} -\usv_set:nnn {stix_upslash}{Greek}{"E2FC} +\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 {stix_bbit}{A}{"E154} -\usv_set:nnn {stix_bbit}{B}{"E155} -\usv_set:nnn {stix_bbit}{E}{"E156} -\usv_set:nnn {stix_bbit}{F}{"E157} -\usv_set:nnn {stix_bbit}{G}{"E158} -\usv_set:nnn {stix_bbit}{I}{"E159} -\usv_set:nnn {stix_bbit}{J}{"E15A} -\usv_set:nnn {stix_bbit}{K}{"E15B} -\usv_set:nnn {stix_bbit}{L}{"E15C} -\usv_set:nnn {stix_bbit}{M}{"E15D} -\usv_set:nnn {stix_bbit}{O}{"E15E} -\usv_set:nnn {stix_bbit}{S}{"E15F} -\usv_set:nnn {stix_bbit}{T}{"E160} -\usv_set:nnn {stix_bbit}{U}{"E161} -\usv_set:nnn {stix_bbit}{V}{"E162} -\usv_set:nnn {stix_bbit}{W}{"E163} -\usv_set:nnn {stix_bbit}{X}{"E164} -\usv_set:nnn {stix_bbit}{Y}{"E165} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_bbit}{a}{"E166} -\usv_set:nnn {stix_bbit}{b}{"E167} -\usv_set:nnn {stix_bbit}{c}{"E168} -\usv_set:nnn {stix_bbit}{f}{"E169} -\usv_set:nnn {stix_bbit}{g}{"E16A} -\usv_set:nnn {stix_bbit}{h}{"E16B} -\usv_set:nnn {stix_bbit}{k}{"E16C} -\usv_set:nnn {stix_bbit}{l}{"E16D} -\usv_set:nnn {stix_bbit}{m}{"E16E} -\usv_set:nnn {stix_bbit}{n}{"E16F} -\usv_set:nnn {stix_bbit}{o}{"E170} -\usv_set:nnn {stix_bbit}{p}{"E171} -\usv_set:nnn {stix_bbit}{q}{"E172} -\usv_set:nnn {stix_bbit}{r}{"E173} -\usv_set:nnn {stix_bbit}{s}{"E174} -\usv_set:nnn {stix_bbit}{t}{"E175} -\usv_set:nnn {stix_bbit}{u}{"E176} -\usv_set:nnn {stix_bbit}{v}{"E177} -\usv_set:nnn {stix_bbit}{w}{"E178} -\usv_set:nnn {stix_bbit}{x}{"E179} -\usv_set:nnn {stix_bbit}{y}{"E17A} -\usv_set:nnn {stix_bbit}{z}{"E17B} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_sfit}{Numerals}{"E1B4} -\usv_set:nnn {stix_sfit}{partial}{"E1BE} -\usv_set:nnn {stix_sfit}{Greek}{"E1BF} -\usv_set:nnn {stix_sfit}{greek}{"E1D8} -\usv_set:nnn {stix_sfit}{varTheta}{"E1D0} -\usv_set:nnn {stix_sfit}{varepsilon}{"E1F1} -\usv_set:nnn {stix_sfit}{vartheta}{"E1F2} -\usv_set:nnn {stix_sfit}{varkappa}{0000} % ??? -\usv_set:nnn {stix_sfit}{varphi}{"E1F3} -\usv_set:nnn {stix_sfit}{varrho}{"E1F4} -\usv_set:nnn {stix_sfit}{varpi}{"E1F5} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_cal}{Latin}{"E22D} -\usv_set:nnn {stix_cal}{Numerals}{"E262} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_sfitslash}{Latin}{"E294} -\usv_set:nnn {stix_sfitslash}{latin}{"E2C8} -\usv_set:nnn {stix_sfitslash}{greek}{"E32C} -\usv_set:nnn {stix_sfitslash}{varepsilon}{"E37A} -\usv_set:nnn {stix_sfitslash}{vartheta}{"E35E} -\usv_set:nnn {stix_sfitslash}{varkappa}{"E374} -\usv_set:nnn {stix_sfitslash}{varphi}{"E360} -\usv_set:nnn {stix_sfitslash}{varrho}{"E376} -\usv_set:nnn {stix_sfitslash}{varpi}{"E362} -\usv_set:nnn {stix_sfitslash}{digamma}{"E36A} +\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 {stix_bfupslash}{Greek}{"E2FD} -\usv_set:nnn {stix_bfupslash}{Digamma}{"E369} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_bfbb}{A}{"E38A} -\usv_set:nnn {stix_bfbb}{B}{"E38B} -\usv_set:nnn {stix_bfbb}{E}{"E38D} -\usv_set:nnn {stix_bfbb}{F}{"E38E} -\usv_set:nnn {stix_bfbb}{G}{"E38F} -\usv_set:nnn {stix_bfbb}{I}{"E390} -\usv_set:nnn {stix_bfbb}{J}{"E391} -\usv_set:nnn {stix_bfbb}{K}{"E392} -\usv_set:nnn {stix_bfbb}{L}{"E393} -\usv_set:nnn {stix_bfbb}{M}{"E394} -\usv_set:nnn {stix_bfbb}{O}{"E395} -\usv_set:nnn {stix_bfbb}{S}{"E396} -\usv_set:nnn {stix_bfbb}{T}{"E397} -\usv_set:nnn {stix_bfbb}{U}{"E398} -\usv_set:nnn {stix_bfbb}{V}{"E399} -\usv_set:nnn {stix_bfbb}{W}{"E39A} -\usv_set:nnn {stix_bfbb}{X}{"E39B} -\usv_set:nnn {stix_bfbb}{Y}{"E39C} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_bfbb}{a}{"E39D} -\usv_set:nnn {stix_bfbb}{b}{"E39E} -\usv_set:nnn {stix_bfbb}{c}{"E39F} -\usv_set:nnn {stix_bfbb}{f}{"E3A2} -\usv_set:nnn {stix_bfbb}{g}{"E3A3} -\usv_set:nnn {stix_bfbb}{h}{"E3A4} -\usv_set:nnn {stix_bfbb}{k}{"E3A7} -\usv_set:nnn {stix_bfbb}{l}{"E3A8} -\usv_set:nnn {stix_bfbb}{m}{"E3A9} -\usv_set:nnn {stix_bfbb}{n}{"E3AA} -\usv_set:nnn {stix_bfbb}{o}{"E3AB} -\usv_set:nnn {stix_bfbb}{p}{"E3AC} -\usv_set:nnn {stix_bfbb}{q}{"E3AD} -\usv_set:nnn {stix_bfbb}{r}{"E3AE} -\usv_set:nnn {stix_bfbb}{s}{"E3AF} -\usv_set:nnn {stix_bfbb}{t}{"E3B0} -\usv_set:nnn {stix_bfbb}{u}{"E3B1} -\usv_set:nnn {stix_bfbb}{v}{"E3B2} -\usv_set:nnn {stix_bfbb}{w}{"E3B3} -\usv_set:nnn {stix_bfbb}{x}{"E3B4} -\usv_set:nnn {stix_bfbb}{y}{"E3B5} -\usv_set:nnn {stix_bfbb}{z}{"E3B6} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_bftt}{Numerals}{"E3B7} +\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 {stix_bfsfit}{Numerals}{"E1F6} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_bfbbit}{A}{"E200} -\usv_set:nnn {stix_bfbbit}{B}{"E201} -\usv_set:nnn {stix_bfbbit}{E}{"E203} -\usv_set:nnn {stix_bfbbit}{F}{"E204} -\usv_set:nnn {stix_bfbbit}{G}{"E205} -\usv_set:nnn {stix_bfbbit}{I}{"E206} -\usv_set:nnn {stix_bfbbit}{J}{"E207} -\usv_set:nnn {stix_bfbbit}{K}{"E208} -\usv_set:nnn {stix_bfbbit}{L}{"E209} -\usv_set:nnn {stix_bfbbit}{M}{"E20A} -\usv_set:nnn {stix_bfbbit}{O}{"E20B} -\usv_set:nnn {stix_bfbbit}{S}{"E20C} -\usv_set:nnn {stix_bfbbit}{T}{"E20D} -\usv_set:nnn {stix_bfbbit}{U}{"E20E} -\usv_set:nnn {stix_bfbbit}{V}{"E20F} -\usv_set:nnn {stix_bfbbit}{W}{"E210} -\usv_set:nnn {stix_bfbbit}{X}{"E211} -\usv_set:nnn {stix_bfbbit}{Y}{"E212} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_bfbbit}{a}{"E213} -\usv_set:nnn {stix_bfbbit}{b}{"E214} -\usv_set:nnn {stix_bfbbit}{c}{"E215} -\usv_set:nnn {stix_bfbbit}{e}{"E217} -\usv_set:nnn {stix_bfbbit}{f}{"E218} -\usv_set:nnn {stix_bfbbit}{g}{"E219} -\usv_set:nnn {stix_bfbbit}{h}{"E21A} -\usv_set:nnn {stix_bfbbit}{k}{"E21D} -\usv_set:nnn {stix_bfbbit}{l}{"E21E} -\usv_set:nnn {stix_bfbbit}{m}{"E21F} -\usv_set:nnn {stix_bfbbit}{n}{"E220} -\usv_set:nnn {stix_bfbbit}{o}{"E221} -\usv_set:nnn {stix_bfbbit}{p}{"E222} -\usv_set:nnn {stix_bfbbit}{q}{"E223} -\usv_set:nnn {stix_bfbbit}{r}{"E224} -\usv_set:nnn {stix_bfbbit}{s}{"E225} -\usv_set:nnn {stix_bfbbit}{t}{"E226} -\usv_set:nnn {stix_bfbbit}{u}{"E227} -\usv_set:nnn {stix_bfbbit}{v}{"E228} -\usv_set:nnn {stix_bfbbit}{w}{"E229} -\usv_set:nnn {stix_bfbbit}{x}{"E22A} -\usv_set:nnn {stix_bfbbit}{y}{"E22B} -\usv_set:nnn {stix_bfbbit}{z}{"E22C} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_bfcal}{Latin}{"E247} -% \end{macrocode} -% -% \begin{macrocode} -\usv_set:nnn {stix_bfitslash}{Latin}{"E295} -\usv_set:nnn {stix_bfitslash}{latin}{"E2C9} -\usv_set:nnn {stix_bfitslash}{greek}{"E32D} -\usv_set:nnn {stix_sfitslash}{varepsilon}{"E37B} -\usv_set:nnn {stix_sfitslash}{vartheta}{"E35F} -\usv_set:nnn {stix_sfitslash}{varkappa}{"E375} -\usv_set:nnn {stix_sfitslash}{varphi}{"E361} -\usv_set:nnn {stix_sfitslash}{varrho}{"E377} -\usv_set:nnn {stix_sfitslash}{varpi}{"E363} -\usv_set:nnn {stix_sfitslash}{digamma}{"E36B} +\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} @@ -1972,25 +2023,32 @@ This work is "author-maintained" by Will Robertson. \mathopen { \tl_if_in:NnTF \l_um_radicals_tl {#2} { \cs_gset:cpx {\cs_to_str:N #2 sign} { \um_radical:nn {#1} {#4} } + \tl_set:cn {l_um_radical_\cs_to_str:N #2_tl} {\use:c{sym #1}~ #4} }{ - \um_set_delcode:n {#4} + \um_set_delcode:nnn {#1} {#4} {#4} \um_set_mathcode:nnn {#4} \mathopen {#1} \cs_gset:Npx #2 { \um_delimiter:Nnn \mathopen {#1} {#4} } } } \mathclose { - \um_set_delcode:n {#4} + \um_set_delcode:nnn {#1} {#4} {#4} \um_set_mathcode:nnn {#4} \mathclose {#1} \cs_gset:Npx #2 { \um_delimiter:Nnn \mathclose {#1} {#4} } } + \mathaccent { + \cs_gset:Npx #2 { \um_accent:Nnn #3 {#1} {#4} } + } \mathfence { \um_set_mathcode:nnn {#4} {#3} {#1} - \um_set_delcode:n {#4} + \um_set_delcode:nnn {#1} {#4} {#4} \cs_gset:cpx {l \cs_to_str:N #2} { \um_delimiter:Nnn \mathopen {#1} {#4} } \cs_gset:cpx {r \cs_to_str:N #2} { \um_delimiter:Nnn \mathclose {#1} {#4} } } - \mathaccent { - \cs_gset:Npx #2 { \um_accent:Nnn #3 {#1} {#4} } + \mathover { % LuaTeX only + \cs_set:Npn #2 ##1 { \mathop { \um_overbrace:nnn {#1} {#4} {##1} } \limits } + } + \mathunder { % LuaTeX only + \cs_set:Npn #2 ##1 { \mathop { \um_underbrace:nnn {#1} {#4} {##1} } \limits } } }{ \um_set_mathcode:nnn {#4} {#3} {#1} @@ -2048,9 +2106,12 @@ This work is "author-maintained" by Will Robertson. % \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} +% 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 { \Umathcode \intexpr_eval:n {#1} = @@ -2064,6 +2125,9 @@ This work is "author-maintained" by Will Robertson. \Umathchardef #1 = \mathchar@type#2 \csname sym#3\endcsname \intexpr_eval:n {#4} \scan_stop: } +\cs_new:Npn \um_set_delcode:nnn #1#2#3 { + \Udelcode#2 = \csname sym#1\endcsname #3 +} \cs_new:Npn \um_radical:nn #1#2 { \Uradical \csname sym#1\endcsname #2 \scan_stop: } @@ -2073,6 +2137,9 @@ This work is "author-maintained" by Will Robertson. \cs_new:Npn \um_accent:Nnn #1#2#3 { \Umathaccent \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: } +% \end{macrocode} +% +% \begin{macrocode} \cs_generate_variant:Nn \um_set_mathchar:NNnn {c} % \end{macrocode} % \end{macro} @@ -2082,6 +2149,23 @@ This work is "author-maintained" by Will Robertson. % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% +% +% \begin{macro}{\um_overbrace:nnn} +% \begin{macro}{\um_underbrace:nnn} +% \LuaTeX\ functions for defining over/under-braces +% \begin{macrocode} +\cs_set:Npn \um_overbrace:nnn #1#2#3 { + \luatexUdelimiterover \csname sym#1\endcsname #2 {#3} +} +\cs_set:Npn \um_underbrace:nnn #1#2#3 { + \luatexUdelimiterunder \csname sym#1\endcsname #2 {#3} +} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % % % \begin{macro}{\char_gmake_mathactive:N} @@ -2174,26 +2258,28 @@ This work is "author-maintained" by Will Robertson. % If we're defining the full Unicode math repetoire, then we skip all % the parsing processing needed if we're only defining a subset. % \begin{itemize} -% \item Math symbols are defined with \cmd\UnicodeMathSymbol; see \secref{mathsymbol} +% \item Math symbols are defined with \cmd\_um_sym:nnn; see \secref{mathsymbol} % for the individual definitions % \end{itemize} % \begin{macrocode} \bool_if:NTF \l_um_init_bool { \tl_set:Nn \um_symfont_tl {um_allsym} \msg_trace:nnx {unicode-math} {default-math-font} {#2} - \cs_set_eq:NN \UnicodeMathSymbol \um_process_symbol_noparse:nnnn + \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 }{ \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 \UnicodeMathSymbol \um_process_symbol_parse:nnnn + \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 } % \end{macrocode} % Now defined |\um_symfont_tl| as the \LaTeX\ math font to access everything: @@ -2201,12 +2287,9 @@ This work is "author-maintained" by Will Robertson. \DeclareSymbolFont{\um_symfont_tl} {\encodingdefault}{\zf@family}{\mddefault}{\updefault} % \end{macrocode} -% And now we input every single maths char. See File~\ref{part:awk} for -% the source to |unicode-math.tex| which is used to create -% |unicode-math-table.tex|. +% And now we input every single maths char. % \begin{macrocode} - \@input{unicode-math-table.tex} - \cs_set_eq:NN \UnicodeMathSymbol \use_none:nnnn + \um_input_math_symbol_table: % \end{macrocode} % Finally, % \begin{itemize} @@ -2236,6 +2319,7 @@ This work is "author-maintained" by Will Robertson. \bool_set_true:N \l_um_fontspec_feature_bool \fontspec_select:xn { + \luatex_if_engine:T { Renderer = Basic, } BoldFont = {}, ItalicFont = {}, Script = Math, SizeFeatures = { @@ -2262,20 +2346,20 @@ This work is "author-maintained" by Will Robertson. % \subsubsection{Functions for setting up symbols with mathcodes} % \seclabel{mathsymbol} % -% \begin{macro}{\um_process_symbol_noparse:nnnn} -% \begin{macro}{\um_process_symbol_parse:nnnn} +% \begin{macro}{\um_process_symbol_noparse:nnn} +% \begin{macro}{\um_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:Npn \um_process_symbol_noparse:nnnn #1#2#3#4 { +\cs_set:Npn \um_process_symbol_noparse:nnn #1#2#3 { \um_set_mathsymbol:nNNn {\um_symfont_tl} #2#3{#1} } % \end{macrocode} % \begin{macrocode} -\cs_set:Npn \um_process_symbol_parse:nnnn #1#2#3#4 { +\cs_set:Npn \um_process_symbol_parse:nnn #1#2#3 { \um@parse@term{#1}{#2}{#3}{ - \um_process_symbol_noparse:nnnn{#1}{#2}{#3}{#4} + \um_process_symbol_noparse:nnn {#1}{#2}{#3} } } % \end{macrocode} @@ -2352,103 +2436,80 @@ This work is "author-maintained" by Will Robertson. % % \subsubsection{Delimiter codes} % -% 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{macro}{\um_setup_delcodes:} -% \begin{macrocode} -\cs_new:Npn \um_setup_delcodes: { - \um_set_delcode:nn {`\/} {\g_um_slash_delimiter_usv} - \um_set_delcode:nn {"2044} {\g_um_slash_delimiter_usv} % fracslash - \um_set_delcode:nn {"2215} {\g_um_slash_delimiter_usv} % divslash - \um_set_delcode:n {"005C} % backslash - \um_set_delcode:nn {`\<} {"27E8} % angle brackets with ascii notation - \um_set_delcode:nn {`\>} {"27E9} % angle brackets with ascii notation - \um_set_delcode:n {"2191} % up arrow - \um_set_delcode:n {"2193} % down arrow - \um_set_delcode:n {"2195} % updown arrow - \um_set_delcode:n {"219F} % up arrow twohead - \um_set_delcode:n {"21A1} % down arrow twohead - \um_set_delcode:n {"21A5} % up arrow from bar - \um_set_delcode:n {"21A7} % down arrow from bar - \um_set_delcode:n {"21A8} % updown arrow from bar - \um_set_delcode:n {"21BE} % up harpoon right - \um_set_delcode:n {"21BF} % up harpoon left - \um_set_delcode:n {"21C2} % down harpoon right - \um_set_delcode:n {"21C3} % down harpoon left - \um_set_delcode:n {"21C5} % arrows up down - \um_set_delcode:n {"21F5} % arrows down up - \um_set_delcode:n {"21C8} % arrows up up - \um_set_delcode:n {"21CA} % arrows down down - \um_set_delcode:n {"21D1} % double up arrow - \um_set_delcode:n {"21D3} % double down arrow - \um_set_delcode:n {"21D5} % double updown arrow - \um_set_delcode:n {"21DE} % up arrow double stroke - \um_set_delcode:n {"21DF} % down arrow double stroke - \um_set_delcode:n {"21E1} % up arrow dashed - \um_set_delcode:n {"21E3} % down arrow dashed - \um_set_delcode:n {"21E7} % up white arrow - \um_set_delcode:n {"21E9} % down white arrow - \um_set_delcode:n {"21EA} % up white arrow from bar - \um_set_delcode:n {"21F3} % updown white arrow -} -% \end{macrocode} -% \end{macro} % -% \begin{macro}{\um_set_delcode:nn} -% \begin{macro}{\um_set_delcode:n} -%: TODO : hook into range feature +% \begin{macro}{\um_assign_delcode:nn} +%: TODO : hook csnames into range feature % \begin{macrocode} -\cs_new:Npn \um_set_delcode:nn #1#2 { - \Udelcode#1 = \csname sym\um_symfont_tl\endcsname #2 +\cs_new:Npn \um_assign_delcode_noparse:nn #1#2 { + \um_set_delcode:nnn \um_symfont_tl {#1} {#2} } -\cs_new:Npn \um_set_delcode:n #1 { - \Udelcode#1 = \csname sym\um_symfont_tl\endcsname #1 +\cs_new:Npn \um_assign_delcode_parse:nn #1#2 { + \um@parse@term {#2}{\@nil}{\@nil} { + \um_assign_delcode_noparse:nn {#1} {#2} + } } % \end{macrocode} % \end{macro} -% \end{macro} % -% \subsubsection{Maths alphabets' character mapping} -% \seclabel{mathmap} -% -% -% \subsubsection{Functions for setting up the maths alphabets} % -% \begin{macro}{\um_mathmap_noparse:Nnn} -% \darg{Maths alphabet, \eg, \cmd\mathbb} -% \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. +% \begin{macro}{\um_assign_delcode:n} +% Shorthand. % \begin{macrocode} -\cs_set:Npn \um_mathmap_noparse:Nnn #1#2#3 { - \clist_map_inline:nn {#2} { - \tl_put_right:cx {um_switchto_\cs_to_str:N #1:} { - \um_set_mathcode:nnnn{##1}{\mathalpha}{\um_symfont_tl}{#3} - } - } +\cs_new:Npn \um_assign_delcode:n #1 { + \um_assign_delcode:nn {#1} {#1} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_mathmap_parse:Nnn} -% \darg{Maths alphabet, \eg, \cmd\mathbb} -% \darg{Input slot(s), \eg, the slot for `A' (comma separated)} -% \darg{Output slot, \eg, the slot for `$\mathbb{A}$'} -% When \cmd\um@parse@term\ is executed, it populates the \cmd\l_um_char_num_range_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. +% +% +% 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{macro}{\um_setup_delcodes:} % \begin{macrocode} -\cs_set:Npn \um_mathmap_parse:Nnn #1#2#3 { - \clist_if_in:NnT \l_um_char_num_range_clist {#3} { - \um_mathmap_noparse:Nnn {#1}{#2}{#3} - } +\cs_new:Npn \um_setup_delcodes: { + \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 } % \end{macrocode} % \end{macro} % % +% +% % \subsection{(Big) operators} % % Turns out that \XeTeX\ is clever enough to deal with big operators for us @@ -2457,7 +2518,7 @@ This work is "author-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\UnicodeMathSymbol\ in the appropriate contexts. +% \cmd\_um_sym:nnn\ in the appropriate contexts. % % \begin{macro}{\l_um_nolimits_tl} % This macro is a sequence containing those maths operators that require a @@ -2501,8 +2562,8 @@ This work is "author-maintained" by Will Robertson. % % \subsection{Radicals} % -% The radical for square root is organised in \cs{um_set_mathsymbol:nNNn} on -% page. I think it's the only radical ever. +% The radical for square root is organised in \cs{um_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.) % @@ -2516,11 +2577,6 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % \end{macro} % -% \begin{example}{} -% \setmathfont{Cambria Math} -% \[ \sqrt[2]{1+\sqrt[3]{1+x}} \] -% \end{example} -% % \subsection{Delimiters} % \begin{macro}{\left} % We redefine the primitive to be preceded by \cmd\mathopen; @@ -2560,12 +2616,12 @@ This work is "author-maintained" by Will Robertson. % % \subsection{OpenType maths font features} % \begin{macrocode} -\um@zf@feature{ScriptStyle}{ - \zf@update@ff{+ssty=0} -} -\um@zf@feature{ScriptScriptStyle}{ - \zf@update@ff{+ssty=1} -} +\xetex_or_luatex:nnn { \um@zf@feature {ScriptStyle} } + { \zf@update@ff{+ssty=0} } + { \zf@update@ff{+ssty=1} } +\xetex_or_luatex:nnn { \um@zf@feature {ScriptScriptStyle} } + { \zf@update@ff{+ssty=1} } + { \zf@update@ff{+ssty=2} } % \end{macrocode} % % \subsection{Script and scriptscript font options} @@ -2615,6 +2671,9 @@ This work is "author-maintained" by Will Robertson. % |tmpa|: math style (\eg, |\mathscr|)\\ % |tmpb|: alphabets (\eg, |Latin|)\\ % |tmpc|: remap style (\eg, |\mathup|). Defaults to |tmpa|. +% +% 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} { \KV_remove_surrounding_spaces:nw {\tl_set:Nf\l_um_tmpa_tl} #1 \q_nil @@ -2627,7 +2686,7 @@ This work is "author-maintained" by Will Robertson. \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_mathalph_seq \l_um_tmpa_tl { + \seq_if_in:NVTF \g_um_mathstyles_seq \l_um_tmpa_tl { \prg_return_true: }{ \prg_return_false: @@ -2635,7 +2694,9 @@ This work is "author-maintained" by Will Robertson. } \cs_set:Npn \um_split_arrow:w #1->#2 \q_nil { \tl_set:Nn \l_um_tmpa_tl {#1} - \tl_set:Nn \l_um_tmpc_tl {#2} + \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} @@ -2856,35 +2917,74 @@ This work is "author-maintained" by Will Robertson. % \item Otherwise, use the \ascii\ letters instead. % \end{itemize} % -% \subsection{Defining the math style macros} +% \subsection{Initialising math styles} % -% We call the different shapes that a math alphabet can be a `math style'. -% Note that different alphabets can exist within the same math style. E.g., -% 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_new_mathstyle:N} +% This function defines a new command like \cs{mathfrak}. +% \begin{macrocode} +\cs_new:Npn \um_new_mathstyle:N #1 { + \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_mathalph_seq} +% \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_mathalph_seq +\seq_new:N \g_um_mathstyles_seq % \end{macrocode} +% \end{macro} % % \begin{macrocode} \AtEndOfPackage{ - \tl_map_inline:nn { - \mathup\mathit\mathbb\mathbbit - \mathscr\mathfrak\mathtt - \mathsf\mathsfup\mathsfit - \mathbf\mathbfup\mathbfit - \mathbfscr\mathbffrak - \mathbfsf\mathbfsfup\mathbfsfit - }{ - \seq_put_right:Nn \g_um_mathalph_seq {#1} - \um_prepare_mathstyle:f {\exp_after:wN \use_none:nnnnn \token_to_str:N #1} - } +\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} -% \end{macro} +% 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} +% +% We call the different shapes that a math alphabet can be a `math style'. +% Note that different alphabets can exist within the same math style. E.g., +% 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} % \darg{math style name (e.g., \texttt{it} or \texttt{bb})} @@ -2934,34 +3034,6 @@ This work is "author-maintained" by Will Robertson. % % \subsection{Defining the math alphabets per style} % -% \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} -% -% \begin{macrocode} -\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 } , - {\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} -} -% \end{macrocode} -% \end{macro} % % Variables: % \begin{macrocode} @@ -3094,23 +3166,71 @@ This work is "author-maintained" by Will Robertson. % |\um_config_\l_um_style_tl_##1:n|, we first want to define some functions % to be used inside them to actually perform the character mapping. % -% \darg{Starting input char (single)} -% \darg{Starting output char} -% Loops through character ranges setting \cmd\mathcode. +% \subsubsection{Functions} +% +% \begin{macro}{\um_map_char_single:nn} +% Wrapper for |\um_map_char_noparse:nn| or |\um_map_char_parse:nn| +% depending on the context. % \begin{macrocode} -\cs_set:Npn \um_map_chars_range:nnn #1#2#3 { - \prg_stepwise_inline:nnnn {0}{1}{#1-1} { - \um_map_char_single:nn {#2+##1}{#3+##1} +\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{macrocode} +\cs_new:Npn \um_map_char_noparse:nn #1#2 { + \um_set_mathcode:nnnn {#1}{\mathalpha}{\um_symfont_tl}{#2} +} +% \end{macrocode} +% +% \begin{macrocode} +\cs_new:Npn \um_map_char_parse:nn #1#2 { + \um@parse@term {#1} {\@nil} {\mathalpha} { + \um_map_char_noparse:nn {#1}{#2} } } -\cs_generate_variant:Nn \um_map_chars_range:nnn {ncc} % \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\um_map_single:nnn} +% \darg{char name (`dotlessi')} +% \darg{from alphabet(s)} +% \darg{to alphabet} +% \begin{macrocode} +\cs_new:Npn \um_map_char_single:nnn #1#2#3 { + \um_map_char_single:cc { \um_to_usv:nn {#1}{#3} } + { \um_to_usv:nn {#2}{#3} } +} +\cs_set:Npn \um_map_single:nnn #1#2#3 { + \cs_if_exist:cT { \um_to_usv:nn {#3} {#1} } + { + \clist_map_inline:nn {#2} { + \um_map_char_single:nnn {##1} {#3} {#1} + } + } +} +% \end{macrocode} +% \end{macro} +% % % \begin{macro}{\um_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:Npn \um_map_chars_range:nnn #1#2#3 { + \prg_stepwise_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} +% \end{macrocode} +% And the wrapper with names: % \begin{macrocode} \cs_new:Npn \um_map_chars_range:nnnn #1#2#3#4 { \um_map_chars_range:ncc {#1} { \um_to_usv:nn {#2}{#4} } @@ -3119,25 +3239,25 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % \end{macro} % +% \subsubsection{Functions for alphabets} +% % \begin{macrocode} -\cs_new:Npn \um_map_char_noparse:nn #1#2 { - \um_set_mathcode:nnnn {#1}{\mathalpha}{\um_symfont_tl}{#2} -} -\cs_new:Npn \um_map_char_parse:nn #1#2 { - \um@parse@term {#1} {\@nil} {\mathalpha} { - \um_map_char_noparse:nn {#1}{#2} - } -} \cs_set:Npn \um_map_chars_Latin:nn #1#2 { \clist_map_inline:nn {#1} { \um_map_chars_range:nnnn {26} {##1} {#2} {Latin} } } +% \end{macrocode} +% +% \begin{macrocode} \cs_set:Npn \um_map_chars_latin:nn #1#2 { \clist_map_inline:nn {#1} { \um_map_chars_range:nnnn {26} {##1} {#2} {latin} } } +% \end{macrocode} +% +% \begin{macrocode} \cs_set:Npn \um_map_chars_greek:nn #1#2 { \clist_map_inline:nn {#1} { \um_map_chars_range:nnnn {25} {##1} {#2} {greek} @@ -3149,46 +3269,89 @@ This work is "author-maintained" by Will Robertson. \um_map_char_single:nnn {##1} {#2} {varpi} } } +% \end{macrocode} +% +% \begin{macrocode} \cs_set:Npn \um_map_chars_Greek:nn #1#2 { \clist_map_inline:nn {#1} { \um_map_chars_range:nnnn {25} {##1} {#2} {Greek} \um_map_char_single:nnn {##1} {#2} {varTheta} } } +% \end{macrocode} +% +% \begin{macrocode} \cs_set:Npn \um_map_chars_numbers:nn #1#2 { \um_map_chars_range:nnnn {10} {#1} {#2} {num} } % \end{macrocode} % -% \begin{macro}{\um_map_single:nnn} -% \darg{char name (`dotlessi')} -% \darg{from alphabet(s)} -% \darg{to alphabet} +% +% \subsection{Mapping chars inside a math style} +% +% \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. % \begin{macrocode} -\cs_new:Npn \um_map_char_single:cc { \exp_args:Ncc \um_map_char_single:nn } -\cs_new:Npn \um_map_char_single:nnn #1#2#3 { - \um_map_char_single:cc { \um_to_usv:nn {#1}{#3} } - { \um_to_usv:nn {#2}{#3} } +\cs_new:Npn \um_set_mathalphabet_char:Ncc { + \exp_args:NNcc \um_set_mathalphabet_char:Nnn } -\cs_set:Npn \um_map_single:nnn #1#2#3 { - \cs_if_exist:cT { \um_to_usv:nn {#3} {#1} } - { - \clist_map_inline:nn {#2} { - \um_map_char_single:nnn {##1} {#3} {#1} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\um_mathmap_noparse:Nnn} +% \darg{Maths alphabet, \eg, \cmd\mathbb} +% \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. +% \begin{macrocode} +\cs_set:Npn \um_mathmap_noparse:Nnn #1#2#3 { + \clist_map_inline:nn {#2} { + \tl_put_right:cx {um_switchto_\cs_to_str:N #1:} { + \um_set_mathcode:nnnn{##1}{\mathalpha}{\um_symfont_tl}{#3} } } } % \end{macrocode} % \end{macro} % -% \subsection{Mapping chars inside a math style} +% \begin{macro}{\um_mathmap_parse:Nnn} +% \darg{Maths alphabet, \eg, \cmd\mathbb} +% \darg{Input slot(s), \eg, the slot for `A' (comma separated)} +% \darg{Output slot, \eg, the slot for `$\mathbb{A}$'} +% When \cmd\um@parse@term\ is executed, it populates the \cmd\l_um_char_num_range_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. +% \begin{macrocode} +\cs_set:Npn \um_mathmap_parse:Nnn #1#2#3 { + \clist_if_in:NnT \l_um_char_num_range_clist {#3} { + \um_mathmap_noparse:Nnn {#1}{#2}{#3} + } +} +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\um_set_mathalph_range:Nnn} -% \oarg{Number of iterations} +% \begin{macro}{\um_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:Npn \um_set_mathalphabet_char:Nnnn #1#2#3#4 { + \um_set_mathalphabet_char:Ncc #1 { \um_to_usv:nn {#2} {#4} } + { \um_to_usv:nn {#3} {#4} } +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\um_set_mathalph_range:nNnn} +% \darg{Number of iterations} % \darg{Maths alphabet} % \darg{Starting input char (single)} % \darg{Starting output char} % Loops through character ranges setting \cmd\mathcode. +% First the version that uses numbers: % \begin{macrocode} \cs_new:Npn \um_set_mathalph_range:nNnn #1#2#3#4 { \prg_stepwise_inline:nnnn {0}{1}{#1-1} { @@ -3197,6 +3360,16 @@ This work is "author-maintained" by Will Robertson. } \cs_generate_variant:Nn \um_set_mathalph_range:nNnn {nNcc} % \end{macrocode} +% Then the wrapper version that uses names: +% \begin{macrocode} +\cs_new:Npn \um_set_mathalph_range:nNnnn #1#2#3#4#5 { + \um_set_mathalph_range:nNcc {#1} #2 { \um_to_usv:nn {#3} {#5} } + { \um_to_usv:nn {#4} {#5} } +} +% \end{macrocode} +% \end{macro} +% +% \subsubsection{Individual mapping functions for different alphabets} % % \begin{macrocode} \cs_new:Npn \um_set_mathalphabet_pos:Nnnn #1#2#3#4 { @@ -3206,28 +3379,43 @@ This work is "author-maintained" by Will Robertson. } } } +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Npn \um_set_mathalphabet_numbers:Nnn #1#2#3 { \clist_map_inline:nn {#2} { \um_set_mathalph_range:nNnnn {10} #1 {##1} {#3} {num} } } +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Npn \um_set_mathalphabet_Latin:Nnn #1#2#3 { \clist_map_inline:nn {#2} { \um_set_mathalph_range:nNnnn {26} #1 {##1} {#3} {Latin} } } +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Npn \um_set_mathalphabet_latin:Nnn #1#2#3 { \clist_map_inline:nn {#2} { \um_set_mathalph_range:nNnnn {26} #1 {##1} {#3} {latin} \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {h} } } +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Npn \um_set_mathalphabet_Greek:Nnn #1#2#3 { \clist_map_inline:nn {#2} { \um_set_mathalph_range:nNnnn {25} #1 {##1} {#3} {Greek} \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varTheta} } } +% \end{macrocode} +% +% \begin{macrocode} \cs_new:Npn \um_set_mathalphabet_greek:Nnn #1#2#3 { \clist_map_inline:nn {#2} { \um_set_mathalph_range:nNnnn {25} #1 {##1} {#3} {greek} @@ -3239,19 +3427,7 @@ This work is "author-maintained" by Will Robertson. \um_set_mathalphabet_char:Nnnn #1 {##1} {#3} {varpi} } } -\cs_new:Npn \um_set_mathalphabet_char:Ncc { - \exp_args:NNcc \um_set_mathalphabet_char:Nnn -} -\cs_new:Npn \um_set_mathalphabet_char:Nnnn #1#2#3#4 { - \um_set_mathalphabet_char:Ncc #1 { \um_to_usv:nn {#2} {#4} } - { \um_to_usv:nn {#3} {#4} } -} -\cs_new:Npn \um_set_mathalph_range:nNnnn #1#2#3#4#5 { - \um_set_mathalph_range:nNcc {#1} #2 { \um_to_usv:nn {#3} {#5} } - { \um_to_usv:nn {#4} {#5} } -} % \end{macrocode} -% \end{macro} % % \subsection{Alphabets} % @@ -3430,7 +3606,7 @@ This work is "author-maintained" by Will Robertson. } % \end{macrocode} % -% \subsubsection{Script or caligraphic: \cmd\mathscr\ and \cmd\mathcal} +% \subsubsection{Script and caligraphic: \cmd\mathscr\ and \cmd\mathcal} % % \begin{macrocode} \cs_new:Npn \um_config_scr_Latin:n #1 { @@ -3451,6 +3627,21 @@ This work is "author-maintained" by Will Robertson. \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:Npn \um_config_cal_Latin:n #1 { + \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} % @@ -3750,6 +3941,9 @@ This work is "author-maintained" by Will Robertson. \cs_new:Npn \um_config_bfscr_latin:n #1 { \um_set_mathalphabet_latin:Nnn \mathbfscr {up,it}{#1} } +\cs_new:Npn \um_config_bfcal_Latin:n #1 { + \um_set_mathalphabet_Latin:Nnn \mathbfcal {up,it}{#1} +} % \end{macrocode} % % \subsubsection{Bold upright sans serif: \cmd\mathbfsfup} @@ -3925,6 +4119,49 @@ This work is "author-maintained" by Will Robertson. } % \end{macrocode} % +% \section{A token list to contain the data of the math table} +% +% Instead of \cmd\input-ing the unicode math table every time we +% want to re-read its data, we save it within a macro. This has two +% advantages: 1.~it should be slightly faster, at the expense of memory; +% 2.~we don't need to worry about catcodes later, since they're frozen +% at this point. +% +% In time, the case statement inside |set_mathsymbol| will be moved in here +% to avoid re-running it every time. +% \begin{macrocode} +\xetex_or_luatex:nnn { \cs_set:Npn \um_symbol_setup: } + { + \def\mathfence{\mathfence} + \def\mathover{\mathover} + \def\mathunder{\mathunder} + \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { + \prg_case_tl:Nnn ##3 { \mathover {} \mathunder {} } + { + \exp_not:n {\_um_sym:nnn{##1}{##2}{##3}} + } + } + } + { + \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { + \exp_not:n {\_um_sym:nnn{##1}{##2}{##3}} + } + } +% \end{macrocode} +% +% \begin{macrocode} +\CatchFileEdef \g_um_mathtable_tl {unicode-math-table.tex} {\um_symbol_setup:} +% \end{macrocode} +% +% +% \begin{macro}{\um_input_math_symbol_table:} +% This function simply expands to the token list containing all the data. +% \begin{macrocode} +\cs_new:Npn \um_input_math_symbol_table: {\g_um_mathtable_tl} +% \end{macrocode} +% \end{macro} +% +% % \section{Definitions of the active math characters} % % Here we define every Unicode math codepoint an equivalent macro name. @@ -3932,7 +4169,7 @@ This work is "author-maintained" by Will Robertson. % % \begin{macro}{\um@scancharlet} % \begin{macro}{\um@scanactivedef} -% We need to do some trickery to transform the |\UnicodeMathSymbol| argument +% We need to do some trickery to transform the |\_um_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. % @@ -3973,22 +4210,26 @@ This work is "author-maintained" by Will Robertson. % \end{macro} % \end{macro} % -% Now give \cmd\UnicodeMathSymbol\ a definition in terms of \cmd\um@scancharlet\ +% Now give \cmd\_um_sym:nnn\ a definition in terms of \cmd\um@scancharlet\ % and we're good to go. -% Make sure |#| is an `other' so that we don't get confused with \cs{mathoctothorpe}. +% +% Ensure catcodes are appropriate; +% make sure |#| is an `other' so that we don't get confused with \cs{mathoctothorpe}. % \begin{macrocode} \AtBeginDocument{ \group_begin: - \char_make_math_superscript:N\^ - \def\UnicodeMathSymbol#1#2#3#4{ + \char_make_math_superscript:N \^ + \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 \mathclose || + \cs_if_eq_p:NN #3 \mathover || + \cs_if_eq_p:NN #3 \mathunder } { \um@scancharlet#2=#1\@nil\ignorespaces } } \char_make_other:N \# - \@input{unicode-math-table.tex} + \um_input_math_symbol_table: \group_end: } % \end{macrocode} @@ -4061,6 +4302,17 @@ This work is "author-maintained" by Will Robertson. % \item If pcount>4 or the glyph doesn't exist, insert pcount \cs{prime}s with \cs{primekern} between each. % \end{itemize} % +% This is a wrapper to insert a superscript; if there is a subsequent +% trailing superscript, then it is included within the insertion. +% \begin{macrocode} +\cs_new:Nn \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 +} +% \end{macrocode} +% % \begin{macrocode} \muskip_new:N \g_um_primekern_muskip \muskip_gset:Nn \g_um_primekern_muskip { -\thinmuskip/2 }% arbitrary @@ -4069,22 +4321,28 @@ This work is "author-maintained" by Will Robertson. % % \begin{macrocode} \cs_new:Npn \um_nprimes:Nn #1#2 { - ^{ - #1 - \prg_replicate:nn {#2-1} { \mskip \g_um_primekern_muskip #1 } - } + \um_superscript:n { + #1 + \prg_replicate:nn {#2-1} { \mskip \g_um_primekern_muskip #1 } + } } \cs_new:Npn \um_nprimes_select:nn #1#2 { \prg_case_int:nnn {#2}{ - {1} { ^{#1} } + {1} { \um_superscript:n {#1} } {2} { - \um_glyph_if_exist:nTF {"2033} { ^{\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_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_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} @@ -4092,12 +4350,16 @@ This work is "author-maintained" by Will Robertson. } \cs_new:Npn \um_nbackprimes_select:nn #1#2 { \prg_case_int:nnn {#2}{ - {1} { ^{#1} } + {1} { \um_superscript:n {#1} } {2} { - \um_glyph_if_exist:nTF {"2033} { ^{\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 {"2034} {^{\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} @@ -4256,6 +4518,22 @@ This work is "author-maintained" by Will Robertson. % % \subsection{Unicode radicals} % +% +% \begin{macro}{\sqrt} +% Redefine this macro for \LuaTeX, which provides us a nice primitive to use. +% \begin{macrocode} +\luatex_if_engine:T { + \DeclareDocumentCommand \sqrt { O{} m } { + \luatexUroot \l_um_radical_sqrt_tl {#1} {#2} + } + \cs_set:Npn \root #1 \of #2 { + \luatexUroot \l_um_radical_sqrt_tl {#1} {#2} + } +} +% \end{macrocode} +% \end{macro} +% +% % \begin{macro}{\r@@t} % \darg{A mathstyle (for \cmd\mathpalette)} % \darg{Leading superscript for the sqrt sign} @@ -4504,6 +4782,7 @@ This work is "author-maintained" by Will Robertson. % \begin{macrocode} \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 @@ -4560,12 +4839,6 @@ This work is "author-maintained" by Will Robertson. % \end{macrocode} % \end{macro} % -% \begin{macro}{\mathcal} -% \begin{macrocode} -\def\mathcal{\mathscr} -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\mathrm} % \begin{macrocode} \def\mathrm{\mathup} @@ -4640,8 +4913,18 @@ This work is "author-maintained" by Will Robertson. } \def\std@minus{\Umathcharnum\Umathcodenum`\-\relax} \def\std@equal{\Umathcharnum\Umathcodenum`\=\relax} - \def\@cdots{\mathinner{\cdots}} +% \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} + \def \resetMathstrut@ {% + \setbox\z@\hbox{$($}% + \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@ + } } % \end{macrocode} % \paragraph{\pkg{amsopn}} @@ -4691,8 +4974,23 @@ This work is "author-maintained" by Will Robertson. } % \end{macrocode} % +% \begin{macrocode} +\ExplSyntaxOff +% \end{macrocode} +% +% \begin{macrocode} +%</package> +% \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} @@ -4738,15 +5036,11 @@ This work is "author-maintained" by Will Robertson. } % \end{macrocode} % -% The end. % \begin{macrocode} -\ExplSyntaxOff -\errorcontextlines=999 +%</msg> % \end{macrocode} % -%\iffalse -%</package> -%\fi +% The end. % % % \section{\STIX\ table data extraction}\label{part:awk} @@ -5014,7 +5308,7 @@ This work is "author-maintained" by Will Robertson. \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]{unicode-math} +\usepackage[slash-delimiter=frac,nabla=literal]{unicode-math} \usepackage{metalogo} %\usepackage[rm,small]{titlesec} @@ -5025,62 +5319,15 @@ This work is "author-maintained" by Will Robertson. \setmathfont{Cambria Math} \newfontface\umfont{STIXGeneral} -\usepackage{hyperref} +\usepackage{hypdoc} \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} -\newenvironment{example}[1] - {\VerbatimEnvironment - \def\Options{#1} - \begin{VerbatimOut}[gobble=4]{\examplefilename}} - {\end{VerbatimOut}\relax - \typesetexample} \def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}} -\let\examplesize\normalsize -\let\auxwidth\relax - -\newlength\examplewidth\newlength\verbatimwidth -\newlength\exoutdent \newlength\exverbgap -\setlength\exverbgap{1em} -\setlength\exoutdent{-0.15\textwidth} -\newsavebox\verbatimbox -\edef\examplefilename{\jobname.example} - -\newcommand\typesetexample{\relax - \smallskip - \noindent - \begin{minipage}{\linewidth} - \color{niceblue} - \hrulefill\par - \edef\@tempa{[gobble=0,fontsize=\noexpand\scriptsize,\Options]} - \begin{lrbox}{\verbatimbox}\relax - \expandafter\BVerbatimInput\@tempa{\examplefilename} - \end{lrbox} - \begin{list}{}{\setlength\itemindent{0pt} - \setlength\leftmargin\exoutdent - \setlength\rightmargin{0pt}}\item - \ifx\auxwidth\relax - \setlength\verbatimwidth{\wd\verbatimbox} - \else - \setlength\verbatimwidth{\auxwidth} - \fi - \begin{minipage}[c]{\textwidth-\exoutdent-\verbatimwidth-\exverbgap} - \catcode`\%=14\centering\input\examplefilename\relax - \end{minipage}\hfill - \begin{minipage}[c]{\verbatimwidth} - \usebox\verbatimbox - \end{minipage} - \end{list} - \par\noindent\hrulefill - \end{minipage} - \smallskip} - -\newcommand*\setverbwidth[1]{\def\auxwidth{#1}} - \newcommand*\name[1]{{#1}} \newcommand*\pkg[1]{\textsf{#1}} \newcommand*\feat[1]{\texttt{#1}} |