From 9de37ad7dbd5b10933f4fc87f93ddf5a77501004 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 29 May 2012 22:51:18 +0000 Subject: unicode-math 0.7 (29may12) git-svn-id: svn://tug.org/texlive/trunk@26720 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/unicode-math/Makefile | 2 +- .../source/latex/unicode-math/unicode-math.dtx | 586 ++++++++++----------- .../source/latex/unicode-math/unimath-symbols.ltx | 352 ++++++++++--- 3 files changed, 560 insertions(+), 380 deletions(-) (limited to 'Master/texmf-dist/source/latex/unicode-math') diff --git a/Master/texmf-dist/source/latex/unicode-math/Makefile b/Master/texmf-dist/source/latex/unicode-math/Makefile index 807cda3fe6e..74bec7e2f19 100644 --- a/Master/texmf-dist/source/latex/unicode-math/Makefile +++ b/Master/texmf-dist/source/latex/unicode-math/Makefile @@ -70,7 +70,7 @@ hometree = `kpsewhich -var-value=TEXMFHOME` PKGSOURCE = $(PKG).dtx $(TBL) Makefile DOC = $(PKG).pdf $(SUITE).pdf README $(XMPL) $(SYM).pdf -CTANFILES = $(PKGSOURCE) $(DOC) $(testdir) +CTANFILES = $(PKGSOURCE) $(XMPL) $(SYM).ltx $(DOC) $(testdir) BUILDCTAN = $(addprefix $(builddir)/,$(CTANFILES)) BUILDDOC = $(addprefix $(builddir)/,$(DOC)) 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 000f6953597..c045a13e3c7 100644 --- a/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/unicode-math.dtx @@ -8,8 +8,9 @@ \keepsilent \let\MetaPrefix\DoubleperCent \declarepreamble\texpreamble -Copyright 2006-2011 Will Robertson +Copyright 2006-2012 Will Robertson Copyright 2010-2011 Philipp Stephani +Copyright 2012 Khaled Hosny 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 @@ -21,6 +22,7 @@ This work is "author-maintained" by Will Robertson. \declarepreamble\luapreamble Copyright 2006-2011 Will Robertson Copyright 2010-2011 Philipp Stephani +Copyright 2012 Khaled Hosny 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 @@ -58,7 +60,7 @@ This work is "author-maintained" by Will Robertson. %\ProvidesPackage{unicode-math-xetex} %\ProvidesPackage{unicode-math-luatex} %<*preamble> - [2011/09/19 v0.6a Unicode maths in XeLaTeX and LuaLaTeX] + [2012/05/30 v0.7 Unicode maths in XeLaTeX and LuaLaTeX] % %<*internal> \documentclass[a4paper]{ltxdoc} @@ -74,7 +76,7 @@ This work is "author-maintained" by Will Robertson. % ^^A %%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \title{Experimental Unicode mathematical typesetting: The \pkg{unicode-math} package} -% \author{Will Robertson and Philipp Stephani\\ +% \author{Will Robertson, Philipp Stephani and Khaled Hosny\\ % \texttt{will.robertson@latex-project.org}} % \date{\umfiledate \qquad \umfileversion} % @@ -110,11 +112,11 @@ This work is "author-maintained" by Will Robertson. % % \end{abstract} % -% \newpage -% \tableofcontents +% \doparttoc\faketableofcontents % % \newpage % \part{User documentation} +% \parttoc % \section{Introduction} % % This document describes the \pkg{unicode-math} package, which is an @@ -172,6 +174,7 @@ This work is "author-maintained" by Will Robertson. % % 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} @@ -228,10 +231,9 @@ This work is "author-maintained" by Will Robertson. % % 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 underbraces, -% overbraces, and arrows that can grow longer if necessary. Behaviour with -% such symbols is not necessarily going to be consistent; please report -% problem areas to me. +% 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 @@ -288,13 +290,6 @@ This work is "author-maintained" by Will Robertson. % 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.) % -% \paragraph{\XeTeX\ users only} -% \XeTeX\ uses the first maths font selected for choosing various parameters -% such as the thickness of fraction rules and so on. -% (In \LuaTeX, they are chosen automatically based on the current font.) -% To select a new font for these parameters use \cs{resetmathfont}, -% which behaves identically to \cs{setmathfont}. -% % \subsubsection{Control over maths alphabets} % % Exact control over maths alphabets can be somewhat involved. @@ -613,11 +608,11 @@ This work is "author-maintained" by Will Robertson. % \\ \cmidrule(r){1-2}\cmidrule(l){3-3} % Upright & Serif & $\mathup\nabla$ \\ % & Bold serif & $\mathbfup\nabla$ \\ -% & Bold sans & \umfont\char"1D76F \\ +% & Bold sans & $\mathbfsfup\nabla$ \\ % \cmidrule(lr){1-2}\cmidrule(lr){3-3} % Italic & Serif & $\mathit\nabla$ \\ % & Bold serif & $\mathbfit\nabla$ \\ -% & Bold sans & \umfont\char"1D7A9 \\ +% & Bold sans & $\mathbfsfit\nabla$ \\ % \bottomrule % \end{tabular} % \end{table} @@ -658,8 +653,8 @@ This work is "author-maintained" by Will Robertson. % & Italic & $\mathit\partial$ \\ % Bold & Upright & $\mathbfup\partial$ \\ % & Italic & $\mathbfit\partial$ \\ -% Sans bold & Upright & \umfont\char"1D789 \\ -% & Italic & \umfont\char"1D7C3 \\ +% Sans bold & Upright & $\mathbfsfup\partial$ \\ +% & Italic & $\mathbfsfit\partial$ \\ % \bottomrule % \end{tabular} % \end{table} @@ -894,10 +889,11 @@ This work is "author-maintained" by Will Robertson. % versions. Among these are \cs{hat} and \cs{tilde}; the corresponding growing % versions are called \cs{widehat} and \cs{widetilde}, respectively. % -% \XeTeX\ and older versions of \LuaTeX\ do not support this distinction, however, -% and \emph{all} accents there will grow automatically. (I.e., \cs{hat} and \cs{widehat} -% are equivalent.) Unfortunately this is not always appropriate. As of \LuaTeX\ v0.65, -% these wide/non-wide commands will again behave in their expected manner. +% 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} @@ -905,13 +901,12 @@ This work is "author-maintained" by Will Robertson. % 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. -% -% \centerline{\fontspec{Calibri} -% ¼ ½ ¾ ↉ ⅐ ⅑ ⅒ ⅓ ⅔ ⅕ ⅖ ⅗ ⅘ ⅙ ⅚ ⅛ ⅜ ⅝ ⅞} -% -% For example, instead of writing `|\tfrac12 x|', it's more readable to have -% `|½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.) +% \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 @@ -997,21 +992,6 @@ This work is "author-maintained" by Will Robertson. % \tablabel{uptriangles} % \end{table} % -% \subsubsection{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" -% * -% * ... ... -% \end{Verbatim} -% This warning could be suppressed by loading the package as follows: -% \begin{Verbatim} -% \usepackage[warnings-off={mathtools-colon}]{unicode-math} -% \end{Verbatim} -% % \iffalse % \subsubsection{Normalising some input characters} % @@ -1035,7 +1015,24 @@ This work is "author-maintained" by Will Robertson. % (Not yet implemented.) % \fi % -% \subsubsection{Programmer's interface} +% \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}[gobble=2] +% * unicode-math warning: "mathtools-colon" +% * +% * ... ... +% \end{Verbatim} +% This warning could be suppressed by loading the package as follows: +% \begin{Verbatim}[gobble=2] +% \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 @@ -1047,27 +1044,41 @@ This work is "author-maintained" by Will Robertson. % % \StopEventually{} % +% \clearpage % \part{Package implementation} +% \parttoc +% +% \section{Header code} % % We (later on) bifurcate the package based on the engine being used. % \begin{macrocode} %<*load> -\luatex_if_engine:T { \usepackage{unicode-math-luatex} \endinput } -\xetex_if_engine:T { \usepackage{unicode-math-xetex} \endinput } +\luatex_if_engine:T { \RequirePackage{unicode-math-luatex} \endinput } +\xetex_if_engine:T { \RequirePackage{unicode-math-xetex} \endinput } % % \end{macrocode} -% -% \section{Header code} -% -% The shared part of the code starts here before the split mentioned above. -% +% The shared part of the code starts here before the split above. % \begin{macrocode} %<*preamble&!XE&!LU> % \end{macrocode} % % \begin{macrocode} \usepackage{ifxetex,ifluatex} -\ifxetex\else\ifluatex\else +\ifxetex + \ifdim\number\XeTeXversion\XeTeXrevision in<0.9998in% + \PackageError{unicode-math}{% + Cannot run with this version of XeTeX!\MessageBreak + You need XeTeX 0.9998 or newer.% + }\@ehd + \fi +\else\ifluatex + \ifnum\luatexversion<64% + \PackageError{unicode-math}{% + Cannot run with this version of LuaTeX!\MessageBreak + You need LuaTeX 0.64 or newer.% + }\@ehd + \fi +\else \PackageError{unicode-math}{% Cannot be run with pdfLaTeX!\MessageBreak Use XeLaTeX or LuaLaTeX instead.% @@ -1085,7 +1096,6 @@ This work is "author-maintained" by Will Robertson. \RequirePackage{fix-cm} % avoid some warnings \RequirePackage{filehook}[2011/01/03] % \end{macrocode} -% % Start using \LaTeX3 --- finally! % \begin{macrocode} \ExplSyntaxOn @@ -1099,31 +1109,19 @@ This work is "author-maintained" by Will Robertson. \cs_generate_variant:Nn \prop_get:NnN {cxN} \cs_generate_variant:Nn \prop_if_in:NnTF {cx} % \end{macrocode} -% +% Extra expansion command: % \begin{macrocode} -\cs_new:Npn \exp_args:NNcc #1#2#3#4 { +\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 for old command in lualatex-math: (Sept 2011) -% \begin{macrocode} -\cs_set_eq:NN \tl_replace_in:Nnn \tl_replace_once:Nnn -% \end{macrocode} -% % % \paragraph{Conditionals} % % \begin{macrocode} -\cs_new_protected_nopar:Npn \bool_const:Nn #1 #2 { - \bool_new:N #1 - \bool_set:Nn #1 { #2 } -} -% \end{macrocode} -% -% \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 @@ -1489,7 +1487,7 @@ This work is "author-maintained" by Will Robertson. %<*lua> local err, warn, info, log = luatexbase.provides_module({ name = "unicode-math", - date = "2011/04/23", + date = "2012/04/23", version = 0.1, description = "Unicode math typesetting for LuaLaTeX", author = "Khaled Hosny, Will Robertson, Philipp Stephani", @@ -1509,6 +1507,22 @@ local function set_sscale_dimens(fontdata) end end luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_math.set_sscale_dimens") +% \end{macrocode} +% +% Cambria Math has too small \texttt{DisplayOperatorMinHeight} constant, so we +% patch it to amore accebtable value. +% +% \begin{macrocode} +local function patch_cambria_domh(fontdata) + local mc = fontdata.MathConstants + local mh = 2800 / fontdata.units * fontdata.size + if fontdata.psname == "CambriaMath" and mc then + if mc.DisplayOperatorMinHeight < mh then + mc.DisplayOperatorMinHeight = mh + end + end +end +luatexbase.add_to_callback("luaotfload.patch_font", patch_cambria_domh, "cambria.domh") % % \end{macrocode} % @@ -1541,19 +1555,11 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \end{macrocode} % % \begin{macrocode} -%\bool_set_false:N \c_um_have_fixed_accents_bool -%<*LU> -\bool_const:Nn \c_um_have_fixed_accents_bool - { \int_compare_p:n { \luatexversion > 64 } } -% -% \end{macrocode} -% -% \begin{macrocode} %<*LU> \RequirePackage { lualatex-math } [ 2011/08/07 ] \RequirePackage { luatexbase } \RequirePackage { luaotfload } [ 2010/11/26 ] -\RequireLuaModule { unicode-math } [ 2011/04/23 ] +\RequireLuaModule { unicode-math } [ 2012/04/23 ] % % \end{macrocode} % @@ -2110,7 +2116,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ %<*package&(XE|LU)> % \end{macrocode} % -% \subsection{Overcoming \cmd\@onlypreamble} +% \subsection{Overcoming \texorpdfstring{\cmd\@onlypreamble}{\textbackslash @onlypreamble}} % % The requirement of only setting up the maths fonts in the preamble is now removed. The following list might be overly ambitious. % \begin{macrocode} @@ -2183,8 +2189,6 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \cs_gset_protected_nopar:Npx #2 { \um_delimiter:Nnn \mathclose {#1} {#4} } } - \mathaccent - { \cs_gset_protected_nopar:Npx #2 { \um_accent:Nnn #3 {#1} {#4} } } \mathfence { \um_set_mathcode:nnn {#4} {#3} {#1} @@ -2194,18 +2198,20 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \cs_gset_protected_nopar:cpx {r \cs_to_str:N #2} { \um_delimiter:Nnn \mathclose {#1} {#4} } } -%<*LU> + \mathaccent + { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {fixed} {#1} {#4} } } + \mathbotaccent + { \cs_gset_protected_nopar:Npx #2 { \um_accent:nnn {bottom~ fixed} {#1} {#4} } } \mathover { \cs_set_protected_nopar:Npx #2 ##1 - { \mathop { \um_overbrace:nnn {#1} {#4} {##1} } \limits } + { \mathop { \um_accent:nnn {} {#1} {#4} {##1} } \limits } } \mathunder { \cs_set_protected_nopar:Npx #2 ##1 - { \mathop { \um_underbrace:nnn {#1} {#4} {##1} } \limits } + { \mathop { \um_accent:nnn {bottom} {#1} {#4} {##1} } \limits } } -% }{ \um_set_mathcode:nnn {#4} {#3} {#1} } @@ -2217,6 +2223,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \edef\mathfence{\string\mathfence} \edef\mathover{\string\mathover} \edef\mathunder{\string\mathunder} +\edef\mathbotaccent{\string\mathbotaccent} % \end{macrocode} % % @@ -2224,7 +2231,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \darg{Symbol font name} % \darg{Macro to assign} % \darg{Glyph slot} -% In the examples following, say we're defining for the symbol \cmd\sum ($\sum$). +% In the examples following, say we're defining for the symbol \cmd\sum\ ($\sum$). % In order for literal Unicode characters to be used in the source and still % have the correct limits behaviour, big operators are made math-active. % This involves three steps: @@ -2271,9 +2278,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \begin{macro}{\um_set_delcode:nnn} % \begin{macro}{\um_radical:nn} % \begin{macro}{\um_delimiter:Nnn} -% \begin{macro}{\um_accent:Nnn} -% \begin{macro}{\um_wide_top_accent:Nnn} -% \begin{macro}{\um_wide_bottom_accent:Nnn} +% \begin{macro}{\um_accent:nnn} % \begin{macro}{\um_accent_keyword:} % These are all wrappers for the primitive commands that take numerical % input only. @@ -2299,31 +2304,9 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \cs_new:Nn \um_delimiter:Nnn { \Udelimiter \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: } -\cs_new:Nn \um_accent:Nnn -%<*XE> - { - \Umathaccent \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: - } -% -%<*LU> - { - \Umathaccent \c_um_accent_keyword_tl - \mathchar@type#1 \csname sym#2\endcsname #3 \scan_stop: - } -% -%<*LU> - \cs_new_nopar:Npn \um_wide_top_accent:Nnn #1 #2 #3 { - \Umathaccent \mathchar@type #1 \use:c { sym #2 } #3 \scan_stop: - } - \bool_if:NTF \c_um_have_fixed_accents_bool { - \cs_new_nopar:Npn \um_wide_bottom_accent:Nnn #1 #2 #3 { - \Umathaccent bottom~ \mathchar@type #1 \use:c { sym #2 } #3 \scan_stop: - } - \tl_const:Nn \c_um_accent_keyword_tl { fixed } - } { - \tl_const:Nn \c_um_accent_keyword_tl { } - } -% +\cs_new:Nn \um_accent:nnn { + \Umathaccent #1~ \mathchar@type\mathaccent \use:c { sym #2 } #3 \scan_stop: +} % \end{macrocode} % % \begin{macrocode} @@ -2338,24 +2321,6 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \end{macro} % \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} @@ -2374,38 +2339,6 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % % \subsection{The main \cs{setmathfont} macro} % -% \begin{macro}{\um_saved_ltxe_glb_settings:} -% Save the original definition of \cmd{\glb@settings} in a macro. -% \begin{macrocode} -\cs_new_eq:NN \um_saved_ltxe_glb_settings: \glb@settings -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\glb@settings} -% We issue an error if the user tried to typeset math before setting a font. -% \begin{macrocode} -\CheckCommand * \glb@settings { - \expandafter\ifx\csname S@\f@size\endcsname\relax - \calculate@math@sizes - \fi - \csname S@\f@size\endcsname - \ifmath@fonts - \begingroup - \escapechar\m@ne - \csname mv@\math@version \endcsname - \globaldefs\@ne - \math@fonts - \let \glb@currsize \f@size - \endgroup - \the\every@math@size - \fi -} -\cs_set_protected_nopar:Npn \glb@settings { - \msg_error:nn { unicode-math } { no-font-selected } -} -% \end{macrocode} -% \end{macro} -% % Using a |range| including large character sets such as \cmd\mathrel, % \cmd\mathalpha, \etc, is \emph{very slow}! % I hope to improve the performance somehow. @@ -2421,11 +2354,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \item Erase any conception \LaTeX\ has of previously defined math symbol fonts; % this allows \cmd\DeclareSymbolFont\ at any point in the document. % \begin{macrocode} - \let\glb@currsize\relax -% \end{macrocode} -% \item Restore \LaTeXe\ kernel macro to apply settings instead of giving an error. -% \begin{macrocode} - \cs_set_eq:NN \glb@settings \um_saved_ltxe_glb_settings: + \cs_set_eq:NN \glb@currsize \scan_stop: % \end{macrocode} % \item To start with, assume we're defining the font for every math symbol character. % \begin{macrocode} @@ -2492,6 +2421,15 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \SetSymbolFont{\um_symfont_tl}{\l_um_mversion_tl} {\encodingdefault}{\l_um_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 + { + \SetSymbolFont{\um_symfont_tl}{bold} + {\encodingdefault}{\l_um_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: @@ -2521,6 +2459,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \um_setup_accents: \um_setup_delcodes: \um_setup_alphabets: + \um_setup_negations: % \end{macrocode} % Prevent spaces, and that's it: % \begin{macrocode} @@ -2575,6 +2514,13 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ } {\l_um_fontname_tl} \SetSymbolFont{symbols}{\l_um_mversion_tl} {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + + \tl_set:Nn \l_um_tmpa_tl {normal} + \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + { + \SetSymbolFont{symbols}{bold} + {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + } } % \end{macrocode} % \end{macro} @@ -2598,6 +2544,13 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ } {\l_um_fontname_tl} \SetSymbolFont{largesymbols}{\l_um_mversion_tl} {\encodingdefault}{\l_um_family_tl}{\mddefault}{\updefault} + + \tl_set:Nn \l_um_tmpa_tl {normal} + \tl_if_eq:NNT \l_um_mversion_tl \l_um_tmpa_tl + { + \SetSymbolFont{largesymbols}{bold} + {\encodingdefault}{\l_um_family_tl}{\bfdefault}{\updefault} + } } % \end{macrocode} % \end{macro} @@ -2609,14 +2562,10 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % { \directlua{fontspec.mathfontdimen("l_um_font","#2")} } % \end{macrocode} % -% \begin{macro}{\resetmathfont} +% Backward compatibility alias. % \begin{macrocode} -\DeclareDocumentCommand \resetmathfont { O{} m } { - \bool_set_false:N \g_um_mainfont_already_set_bool - \setmathfont[#1]{#2} -} +\cs_set_eq:NN \resetmathfont \setmathfont % \end{macrocode} -% \end{macro} % % % \begin{macro}{\um_fontspec_select_font:} @@ -2625,7 +2574,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \cs_new:Nn \um_fontspec_select_font: { \tl_set:Nx \l_um_font_keyval_tl { % Renderer = Basic, - BoldFont = {}, ItalicFont = {}, + BoldItalicFont = {}, ItalicFont = {}, Script = Math, SizeFeatures = { {Size = \tf@size-} , @@ -2888,7 +2837,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % 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} +\tl_set:Nn \l_um_radicals_tl {\sqrt \longdivision} % \end{macrocode} % \end{macro} % @@ -3283,7 +3232,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ { \mathord,\mathalpha,\mathop,\mathbin,\mathrel, \mathopen,\mathclose,\mathpunct,\mathaccent, - \mathfence,\mathover,\mathunder + \mathfence,\mathover,\mathunder,\mathbotaccent } % \end{macrocode} % @@ -3379,7 +3328,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % character slot: \seq_map_inline:Nn \l_um_char_range_seq { - \um_int_if_range_matches_slot:nnT {##1} {#1} + \um_int_if_slot_in_range:nnT {#1} {##1} { \seq_map_break:n { \use_none_delimit_by_q_nil:w } } } @@ -3395,20 +3344,20 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \end{macrocode} % \end{macro} % -% \begin{macro}{\um_int_if_range_matches_slot:nnT} +% \begin{macro}{\um_int_if_slot_in_range:nnT} % A `numrange' is like |-2,5-8,12,17-| (can be unsorted). % % Four cases, four argument types: % \begin{Verbatim} -% #2 #3 #4 -% [ 1] - [qn] - [ ] qs -% [ 1] - [ ] - [qn-] qs -% [ ] - [ 3] - [qn-] qs -% [ 1] - [ 3] - [qn-] qs +% input #2 #3 #4 +% "1 " [ 1] - [qn] - [ ] qs +% "1- " [ 1] - [ ] - [qn-] qs +% " -3" [ ] - [ 3] - [qn-] qs +% "1-3" [ 1] - [ 3] - [qn-] qs % \end{Verbatim} % % \begin{macrocode} -\cs_new:Nn \um_int_if_range_matches_slot:nnT +\cs_new:Nn \um_int_if_slot_in_range:nnT { \um_numrange_parse:nwT {#1} #2 - \q_nil - \q_stop {#3} } % \end{macrocode} % @@ -4685,24 +4634,11 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % 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: -%<*XE> - { - \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { - \prg_case_tl:Nnn ##3 { \mathover {} \mathunder {} } - { - \exp_not:n {\_um_sym:nnn{##1}{##2}{##3}} - } - } - } -% -%<*LU> - { - \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { - \exp_not:n {\_um_sym:nnn{##1}{##2}{##3}} - } +\cs_new:Npn \um_symbol_setup: { + \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { + \exp_not:n {\_um_sym:nnn{##1}{##2}{##3}} } -% +} % \end{macrocode} % % \begin{macrocode} @@ -4781,7 +4717,8 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \cs_if_eq_p:NN ##3 \mathopen || \cs_if_eq_p:NN ##3 \mathclose || \cs_if_eq_p:NN ##3 \mathover || - \cs_if_eq_p:NN ##3 \mathunder } { + \cs_if_eq_p:NN ##3 \mathunder || + \cs_if_eq_p:NN ##3 \mathbotaccent } { \um_cs_set_eq_active_char:Nw ##2 = ##1 \q_nil \ignorespaces } } @@ -4808,6 +4745,21 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \begin{macrocode} % \end{macrocode} % +% \section{Fall-back font} +% +% Want to load Latin Modern Math if nothing else. +% \begin{macrocode} +\AtBeginDocument { \um_load_lm_if_necessary: } +\cs_new:Nn \um_load_lm_if_necessary: + { + \cs_if_exist:NF \l_um_fontname_tl + { + % XXX: update this when lmmath-bold.otf is released + \setmathfont[BoldFont={lmmath-regular.otf}]{lmmath-regular.otf} + } + } +% \end{macrocode} +% % \section{Epilogue} % % Lots of little things to tidy up. @@ -5429,51 +5381,6 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \um_setup_active_frac: % \end{macrocode} % -% \subsection{\XeTeX\ over- and under- brace, paren, bracket} -% Thanks to Claudio Beccari for this code. -% \begin{macrocode} -%<*XE> -\cs_new:Nn \um_over_bracket:nN - { - \mathop { \vbox { - \setbox\z@\hbox{$\displaystyle#1$} - \dimen@=\dimexpr\wd\z@+3\p@\relax - \setbox\tw@\hbox{$\left #2 \vcenter to\dimen@{\vss} \right. $} - \m@th\ialign - { - ##\crcr\noalign{\kern-\p@}% - \rotatebox[origin=Bl]{-90} - {\box\tw@}\crcr\noalign{\kern0\p@\nointerlineskip}% - \hfil\box\z@\hfil\crcr - } - } } \limits - } -% \end{macrocode} -% -% \begin{macrocode} -\cs_new:Nn \um_under_bracket:nN - { - \mathop { \vtop { - \setbox\z@\hbox{$\displaystyle#1$} - \dimen@=\dimexpr\wd\z@+3\p@\relax - \setbox\tw@\hbox{$\left #2 \vcenter to\dimen@{\vss} \right. $} - \m@th\ialign - { - ##\crcr\hfil\box\z@\hfil\crcr - \noalign{\kern1\p@\nointerlineskip}% - \rotatebox[origin=Br]{-90}{\box\tw@}\crcr\noalign{\kern0\p@} - } - } } \limits - } -\RenewDocumentCommand \overbrace {m} { \um_over_bracket:nN {#1} \{ } -\DeclareDocumentCommand \overbracket {m} { \um_over_bracket:nN {#1} [ } -\DeclareDocumentCommand \overparen {m} { \um_over_bracket:nN {#1} ( } -\RenewDocumentCommand \underbrace {m} { \um_under_bracket:nN {#1} \} } -\DeclareDocumentCommand \underbracket {m} { \um_under_bracket:nN {#1} ] } -\DeclareDocumentCommand \underparen {m} { \um_under_bracket:nN {#1} ) } -% -% \end{macrocode} -% % \subsection{Synonyms and all the rest} % % These are symbols with multiple names. Eventually to be taken care of @@ -5498,6 +5405,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \def\gets{\leftarrow} \def\mathring{\ocirc} \def\lnot{\neg} +\def\longdivision{\longdivisionsign} % \end{macrocode} % These are somewhat odd: (and their usual Unicode uprightness does not match their amssymb glyphs) % \begin{macrocode} @@ -5867,47 +5775,41 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \end{macrocode} % \paragraph{Accents} % \begin{macrocode} -\cs_new_protected_nopar:Nn \um_setup_accents: -%<*XE> - { - \def\widehat{\hat} - \def\widetilde{\tilde} - \def\overrightarrow{\vec} - } -% -%<*LU> - { +\cs_new_protected_nopar:Nn \um_setup_accents: { \cs_gset_protected_nopar:Npx \widehat { - \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "0302 } + \um_accent:nnn {} { \um_symfont_tl } { "0302 } } \cs_gset_protected_nopar:Npx \widetilde { - \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "0303 } + \um_accent:nnn {} { \um_symfont_tl } { "0303 } } \cs_gset_protected_nopar:Npx \overleftarrow { - \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20D6 } + \um_accent:nnn {} { \um_symfont_tl } { "20D6 } } \cs_gset_protected_nopar:Npx \overrightarrow { - \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20D7 } + \um_accent:nnn {} { \um_symfont_tl } { "20D7 } } \cs_gset_protected_nopar:Npx \overleftrightarrow { - \um_wide_top_accent:Nnn \mathaccent { \um_symfont_tl } { "20E1 } + \um_accent:nnn {} { \um_symfont_tl } { "20E1 } } - \bool_if:NT \c_um_have_fixed_accents_bool { - \cs_gset_protected_nopar:Npx \underrightharpoondown { - \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EC } - } - \cs_gset_protected_nopar:Npx \underleftharpoondown { - \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20ED } - } - \cs_gset_protected_nopar:Npx \underleftarrow { - \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EE } - } - \cs_gset_protected_nopar:Npx \underrightarrow { - \um_wide_bottom_accent:Nnn \mathaccent { \um_symfont_tl } { "20EF } - } + \cs_gset_protected_nopar:Npx \wideutilde { + \um_accent:nnn {bottom} { \um_symfont_tl } { "0330 } } - } -% + \cs_gset_protected_nopar:Npx \underrightharpoondown { + \um_accent:nnn {bottom} { \um_symfont_tl } { "20EC } + } + \cs_gset_protected_nopar:Npx \underleftharpoondown { + \um_accent:nnn {bottom} { \um_symfont_tl } { "20ED } + } + \cs_gset_protected_nopar:Npx \underleftarrow { + \um_accent:nnn {bottom} { \um_symfont_tl } { "20EE } + } + \cs_gset_protected_nopar:Npx \underrightarrow { + \um_accent:nnn {bottom} { \um_symfont_tl } { "20EF } + } + \cs_gset_protected_nopar:Npx \underleftrightarrow { + \um_accent:nnn {bottom} { \um_symfont_tl } { "034D } + } +} % \end{macrocode} % % \begin{macrocode} @@ -5917,6 +5819,57 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ } % \end{macrocode} % +% \paragraph{\cs{not}} +% The situation of \cs{not} symbol is currently messy, in Unicode it is defined +% as a combining mark so naturally it should be treated as a math accent, +% however neither Lua\TeX\ nor \XeTeX\ correctly place it as it needs special +% treatment compared to other accents, furthermore a math accent changes the +% spacing of its nucleus, so \cs{not=} will be spaced as an ordinary not +% relational symbol, which is undesired. +% +% Here modify \cs{not} to a macro that tries to use predefined negated symbols, +% which would give better results in most cases, until there is more robust +% solution in the engines. +% +% This code is based on an answer to a TeX -- Stack Exchange question by Enrico +% Gregorio\footnote{\url{http://tex.stackexchange.com/a/47260/729}}. +% +% \begin{macrocode} +\tl_new:N \l_not_token_name_tl + +\cs_new:Npn \not_newnot:N #1 { + \tl_set:Nx \l_not_token_name_tl { \token_to_str:N #1 } + \tl_if_empty:xF { \tl_tail:V \l_not_token_name_tl } { + \tl_set:Nx \l_not_token_name_tl { \tl_tail:V \l_not_token_name_tl } + } + \cs_if_exist:cTF { n \l_not_token_name_tl } { + \use:c { n \l_not_token_name_tl } + } { + \cs_if_exist:cTF { not \l_not_token_name_tl } { + \use:c { not \l_not_token_name_tl } + } { + \not_oldnot: #1 %\l_not_token_name_tl + } + } +} + +\cs_new_protected_nopar:Nn \um_setup_negations: { + \cs_set_eq:NN \not_oldnot: \not + \cs_set_eq:NN \not \not_newnot:N + + \cs_gset:cpn { not= } { \neq } + \cs_gset:cpn { not< } { \nless } + \cs_gset:cpn { not> } { \ngtr } + \cs_gset:Npn \ngets { \nleftarrow } + \cs_gset:Npn \nsimeq { \nsime } + \cs_gset:Npn \nequal { \ne } + \cs_gset:Npn \nle { \nleq } + \cs_gset:Npn \nge { \ngeq } + \cs_gset:Npn \ngreater { \ngtr } + \cs_gset:Npn \nforksnot { \forks } +} +% \end{macrocode} +% % \paragraph{\pkg{mathtools}} % \pkg{mathtools}’s |\cramped| command and others that make use of its internal version use an incorrect font dimension. % @@ -5982,6 +5935,45 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ } % % \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 } { + \let\MToverbracket =\overbracket + \let\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} @@ -6082,15 +6074,6 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ { Setup~ alphabet:~ #1. } -\msg_new:nnnn { unicode-math } { no-font-selected } { - You've~ loaded~ the~ unicode-math~ package,~ but~ you~ forgot~ to~ select~ - a~ Unicode~ math~ font.~ Please~ select~ one~ with~ the~ \token_to_str:N \setmathfont \\ - command. -} { - Loading~ the~ unicode-math~ package~ without~ using~ a~ Unicode~ math~ font~ - is~ not~ supported.~ Either~ select~ a~ Unicode~ math~ font,~ or~ don't~ - load~ the~ unicode-math~ package. -} \msg_new:nnn { unicode-math } { missing-alphabets } { Missing~math~alphabets~in~font~ "\fontname\l_um_font" \\ \\ @@ -6109,6 +6092,15 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ { 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 \underbracke\ from~ + `mathtools'~ package.\\ + \\ + Use~ \token_to_str:N \Uoverbracket\ and~ + \token_to_str:N \Uunderbracke\ for~ + original~ `unicode-math'~ definition. +} \msg_new:nnn { unicode-math } { mathtools-colon } { I'm~ going~ to~ overwrite~ the~ following~ commands~ from~ the~ `mathtools'~ package: \\ \\ @@ -6214,7 +6206,7 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ % \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'. \cmd\sqrt\ might very well be the only one. +% 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. @@ -6467,21 +6459,19 @@ luatexbase.add_to_callback("luaotfload.patch_font", set_sscale_dimens, "unicode_ \usepackage[slash-delimiter=frac,nabla=literal]{unicode-math} \usepackage{metalogo,hologo} -\@ifundefined{HOLOGO@ReflectBox@\hologodriver}{% - \@namedef{HOLOGO@ReflectBox@\hologodriver}{}% -}{} - %\usepackage[rm,small]{titlesec} -\setmainfont[Mapping=tex-text]{TeX Gyre Pagella} -\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Candara} +\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} +\setsansfont[Scale=MatchLowercase,Ligatures=TeX]{Candara} \setmonofont[Scale=MatchLowercase]{Consolas} \setmathfont{Cambria Math} -\newfontface\umfont{STIXGeneral} +\newfontface\umfont{XITS Math} \usepackage{hypdoc} \hypersetup{linktocpage} +\usepackage{minitoc} + \linespread{1.069} % A bit more space between lines \frenchspacing % Remove ugly extra space after punctuation diff --git a/Master/texmf-dist/source/latex/unicode-math/unimath-symbols.ltx b/Master/texmf-dist/source/latex/unicode-math/unimath-symbols.ltx index 451fd687ca5..7488731ccd3 100644 --- a/Master/texmf-dist/source/latex/unicode-math/unimath-symbols.ltx +++ b/Master/texmf-dist/source/latex/unicode-math/unimath-symbols.ltx @@ -1,3 +1,4 @@ +%!TEX TS-program = LuaLaTeX %%%%%%%%%%%%%%%%%%%%%%% % SYMBOLS DEFINED BY UNICODE-MATH @@ -6,7 +7,7 @@ \documentclass{article} \makeatletter -\usepackage{booktabs,shortvrb,geometry,varwidth,textcomp,longtable,hyperref} +\usepackage{booktabs,catchfile,shortvrb,geometry,metalogo,varwidth,textcomp,longtable,hyperref} \geometry{margin=3cm} \hypersetup{colorlinks,linkcolor=black} @@ -15,69 +16,38 @@ \usepackage{fontspec} \setmainfont[Ligatures=TeX,Numbers={Lowercase,Monospaced}]{TeX Gyre Pagella} -\usepackage{unicode-math} -\setmathfont{XITS Math} - -\newcounter{lm} -\setcounter{lm}{-1} -\setmathfont[version=lm,SizeFeatures={ - {Size=-10, Colour=999999}, - {Size=10-, Colour=CC6666}}]{lmmath-regular.otf} - -\newcounter{xits} -\setcounter{xits}{-1} -\setmathfont[version=xits,SizeFeatures={ - {Size=-10, Colour=999999}, - {Size=10-, Colour=CCCC66}}]{xits-math.otf} - -\newcounter{lucida} -\setcounter{lucida}{-1} -\setmathfont[version=lucida,SizeFeatures={ - {Size=-10, Colour=999999}, - {Size=10-, Colour=66CC66}}]{Lucida Math} - -\newcounter{lucibold} -\setcounter{lucibold}{-1} -\setmathfont[version=lucibold,SizeFeatures={ - {Size=-10, Colour=999999}, - {Size=10-, Colour=66CC66}}]{Lucida Math Demibold} - -\newcounter{cambria} -\setcounter{cambria}{-1} -\setmathfont[version=cambria,SizeFeatures={ - {Size=-10, Colour=999999}, - {Size=10-, Colour=66CCCC}}]{Cambria Math} - -\newcounter{asana} -\setcounter{asana}{-1} -\setmathfont[version=asana,SizeFeatures={ - {Size=-10, Colour=999999}, - {Size=10-, Colour=6666CC}}]{Asana-Math.otf} - -\newcounter{euler} -\setcounter{euler}{-1} -\setmathfont[version=euler,SizeFeatures={ - {Size=-10, Colour=999999}, - {Size=10-, Colour=CC66CC}}]{Neo Euler} - +\usepackage[math-style=literal,bold-style=literal]{unicode-math} + \ExplSyntaxOn -\fontspec_set_fontface:NNnn \lm \x {} {lmmath-regular.otf} -\fontspec_set_fontface:NNnn \xits \x {} {xits-math.otf} -\fontspec_set_fontface:NNnn \lucida \x {} {Lucida~ Math} -\fontspec_set_fontface:NNnn \lucibold \x {} {Lucida~ Math~ Demibold} -\fontspec_set_fontface:NNnn \cambria \x {} {Cambria~ Math} -\fontspec_set_fontface:NNnn \asana \x {} {Asana-Math.otf} -\fontspec_set_fontface:NNnn \euler \x {} {Neo~ Euler} +\cs_generate_variant:Nn \fontspec_set_fontface:NNnn {c} + +\def\defmathfont#1#2#3{ + \newcounter{#1} + \setcounter{#1}{-1} + \setmathfont[version=#1,SizeFeatures={ + {Size=-10, Colour=999999}, + {Size=10-, Colour=#3}}]{#2} + \fontspec_set_fontface:cNnn {#1} \x {ItalicFont={},BoldFont={}} {#2} +} \ExplSyntaxOff +\defmathfont{lm}{lmmath-regular.otf}{CC6666} +\defmathfont{xits}{xits-math.otf}{CCCC66} +\defmathfont{lucida}{Lucida Bright Math OT}{66CC66} +\defmathfont{lucibold}{Lucida Bright Math OT Demibold}{66CC66} +\defmathfont{cambria}{Cambria Math}{66CCCC} +\defmathfont{asana}{Asana-Math.otf}{6666CC} +\defmathfont{pagella}{texgyrepagella-math.otf}{AA6666} +\defmathfont{euler}{Neo Euler}{CC66CC} + +\def\INPUT{\input{unicode-math-table.tex}} \def\TABLE{% -\setlength\LTleft{-2cm} \par\noindent -\begin{longtable}[l]{@{}lcccccccll@{}} +\begin{longtable}[l]{@{}lccccccccll@{}} \toprule - \textsc{usv} & M & X & C & L & D & A & E & Macro & Description \\ + \textsc{usv} & M & X & C & L & D & A & P & E & Macro & Description \\ \midrule \endhead - \input unicode-math-table.tex\relax\\ + \INPUT\\ \bottomrule \end{longtable} } @@ -90,26 +60,41 @@ } \newcommand\SHOW[1]{% -\def\UnicodeMathSymbol##1##2##3##4{% - \def\1{#1}\def\2{##3}% - \ifx\1\2% - \def\tempa{% - \USV{##1} & - \SYMB{##2}{lm}{##1} & - \SYMB{##2}{xits}{##1} & - \SYMB{##2}{cambria}{##1} & - \SYMB{##2}{lucida}{##1} & - \SYMB{##2}{lucibold}{##1} & - \SYMB{##2}{asana}{##1} & - \SYMB{##2}{euler}{##1} & - \CMD{##2} & - \DESC{##4} \\% + \def\UnicodeMathSymbol##1##2##3##4{% + \def\1{#1}\def\2{##3}% + \ifx\1\2\PRINTLINE{##1}{##2}{##4}\fi + }% + \TABLE +} +\ExplSyntaxOn +\def\PRINTLINE#1#2#3{ + \def\tempa{ + \USV{#1} & + \SYMB{#2}{lm}{#1} & + \SYMB{#2}{xits}{#1} & + \SYMB{#2}{cambria}{#1} & + \SYMB{#2}{lucida}{#1} & + \SYMB{#2}{lucibold}{#1} & + \SYMB{#2}{asana}{#1} & + \SYMB{#2}{pagella}{#1} & + \SYMB{#2}{euler}{#1} & + \CMD{#2} + \tl_if_in:NnT \PLAIN {#2} + { + \makebox[0pt][l] + { \color[gray]{0.7} \textsuperscript{\sffamily (p)} } + } + \tl_if_in:NnT \AMSSYMB {#2} + { + \makebox[0pt][l] + { \color[gray]{0.7} \textsuperscript{\sffamily (a)} } + } + & + \DESC{#3} \\ }% \expandafter\tempa - \fi -}% -\TABLE } +\ExplSyntaxOff \def\SYMB#1#2#3{% \expandafter\iffontchar\csname#2\endcsname #3\relax \refstepcounter{#2}% @@ -118,9 +103,13 @@ \fi } +\def\PLAIN{\alpha\beta\gamma\delta\epsilon\zeta\eta\theta\iota\kappa\lambda\mu\nu\xi\pi\rho\sigma\tau\upsilon\phi\chi\psi\omega\varepsilon\vartheta\varpi\varrho\varsigma\varphi\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega\aleph\hbar\imath\jmath\ell\wp\Re\Im\partial\infty\prime\emptyset\nabla\surd\top\bot\angle\triangle\forall\exists\neg\flat\natural\sharp\clubsuit\diamondsuit\heartsuit\spadesuit\coprod\bigvee\bigwedge\biguplus\bigcap\bigcup\int\prod\sum\bigotimes\bigoplus\bigodot\oint\bigsqcup\smallint\triangleleft\triangleright\bigtriangleup\bigtriangledown\wedge\land\vee\lor\cap\cup\ddagger\dagger\sqcap\sqcup\uplus\amalg\diamond\bullet\wr\div\odot\oslash\otimes\ominus\oplus\mp\pm\circ\bigcirc\setminus\cdot\ast\times\star\propto\sqsubseteq\sqsupseteq\parallel\mid\dashv\vdash\nearrow\searrow\nwarrow\swarrow\Leftrightarrow\Leftarrow\Rightarrow\neq\ne\lnot\leq\le\geq\ge\succ\prec\approx\succeq\preceq\supset\subset\supseteq\subseteq\in\ni\owns\gg\ll\not\leftrightarrow\leftarrow\gets\rightarrow\to\mapstochar\mapsto\sim\simeq\perp\equiv\asymp\smile\frown\leftharpoonup\leftharpoondown\rightharpoonup\rightharpoondown\joinrel\relbar\Relbar\lhook\hookrightarrow\rhook\hookleftarrow\bowtie\models\Longrightarrow\longrightarrow\longleftarrow\Longleftarrow\longmapsto\longleftrightarrow\Longleftrightarrow\iff\ldotp\cdotp\colon\ldots\cdots\vdots\ddots\acute\grave\ddot\tilde\bar\breve\check\hat\vec\dot\widetilde\widehat\overrightarrow\overleftarrow\overbrace\underbrace\lmoustache\rmoustache\lgroup\rgroup\arrowvert\Arrowvert\bracevert\Vert\vert\uparrow\downarrow\updownarrow\Uparrow\Downarrow\Updownarrow\backslash\rangle\langle\rbrace\lbrace\rceil\lceil\rfloor\lfloor\sqrt} + +\def\AMSSYMB{\boxdot\boxplus\boxtimes\square\blacksquare\centerdot\lozenge\blacklozenge\circlearrowright\circlearrowleft\leftrightharpoons\boxminus\Vdash\Vvdash\vDash\twoheadrightarrow\twoheadleftarrow\leftleftarrows\rightrightarrows\upuparrows\downdownarrows\upharpoonright\restriction\downharpoonright\upharpoonleft\downharpoonleft\rightarrowtail\leftarrowtail\leftrightarrows\rightleftarrows\Lsh\Rsh\rightsquigarrow\leftrightsquigarrow\looparrowleft\looparrowright\circeq\succsim\gtrsim\gtrapprox\multimap\therefore\because\doteqdot\Doteq\triangleq\precsim\lesssim\lessapprox\eqslantless\eqslantgtr\curlyeqprec\curlyeqsucc\preccurlyeq\leqq\leqslant\lessgtr\backprime\risingdotseq\fallingdotseq\succcurlyeq\geqq\geqslant\gtrless\vartriangleright\vartriangleleft\trianglerighteq\trianglelefteq\bigstar\between\blacktriangledown\blacktriangleright\blacktriangleleft\vartriangle\blacktriangle\triangledown\eqcirc\lesseqgtr\gtreqless\lesseqqgtr\gtreqqless\Rrightarrow\Lleftarrow\veebar\barwedge\doublebarwedge\measuredangle\sphericalangle\varpropto\smallsmile\smallfrown\Subset\Supset\Cup\doublecup\Cap\doublecap\curlywedge\curlyvee\leftthreetimes\rightthreetimes\subseteqq\supseteqq\bumpeq\Bumpeq\lll\llless\ggg\gggtr\circledS\pitchfork\dotplus\backsim\backsimeq\complement\intercal\circledcirc\circledast\circleddash\lvertneqq\gvertneqq\nleq\ngeq\nless\ngtr\nprec\nsucc\lneqq\gneqq\nleqslant\ngeqslant\lneq\gneq\npreceq\nsucceq\precnsim\succnsim\lnsim\gnsim\nleqq\ngeqq\precneqq\succneqq\precnapprox\succnapprox\lnapprox\gnapprox\nsim\ncong\diagup\diagdown\varsubsetneq\varsupsetneq\nsubseteqq\nsupseteqq\subsetneqq\supsetneqq\varsubsetneqq\varsupsetneqq\subsetneq\supsetneq\nsubseteq\nsupseteq\nparallel\nmid\nshortmid\nshortparallel\nvdash\nVdash\nvDash\nVDash\ntrianglerighteq\ntrianglelefteq\ntriangleleft\ntriangleright\nleftarrow\nrightarrow\nLeftarrow\nRightarrow\nLeftrightarrow\nleftrightarrow\divideontimes\varnothing\nexists\Finv\Game\eth\eqsim\beth\gimel\daleth\lessdot\gtrdot\ltimes\rtimes\shortmid\shortparallel\smallsetminus\thicksim\thickapprox\approxeq\succapprox\precapprox\curvearrowleft\curvearrowright\digamma\varkappa\Bbbk\hslash\backepsilon} + \begin{document} \MakeShortVerb\| -\title{Every symbol defined by \textsf{unicode-math}} +\title{Every symbol (most symbols) defined by \textsf{unicode-math}} \author{Will Robertson\\\texttt{wspr81@gmail.com}} \maketitle @@ -128,7 +117,7 @@ This document uses the file \texttt{unicode-math-table.tex} to print every symbol defined by the \textsf{unicode-math} package. Use this document to find the command name or the Unicode glyph slot for a symbol that you wish to use. -Seven fonts are shown: (with approximate symbol counts) +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}) @@ -136,16 +125,19 @@ Seven fonts are shown: (with approximate symbol counts) \item[L] \mathversion{lucida} $\mathup{Lucida\ Math}$ (\ref{count:lucida}) \item[D] \mathversion{lucibold} $\mathup{Lucida\ Math\ Demibold}$ (\ref{count:lucibold}) \item[A] \mathversion{asana} $\mathup{Asana\ Math}$ (\ref{count:asana}) +\item[P] \mathversion{pagella} $\mathup{TeX\ Gyre\ Pagella\ Math}$ (\ref{count:pagella}) \item[E] \mathversion{euler} $\mathup{Neo\ Euler}$ (\ref{count:euler}) \end{itemize} +Symbols defined in Plain \TeX\ are indicated with {\color[gray]{0.6} \textsuperscript{\sffamily (p)}} after their macro name. +Symbols defined in \textsf{amssymb} are indicated with {\color[gray]{0.6} \textsuperscript{\sffamily (a)}}. \tableofcontents \clearpage \section{Opening symbols, \cmd\mathopen} \begingroup -\let\sqrtold\sqrt -\def\sqrt{\sqrtold{}} +\def\sqrt{\sqrtsign{}} +\def\longdivision{\longdivisionsign{}} \SHOW\mathopen \endgroup @@ -160,6 +152,31 @@ Seven fonts are shown: (with approximate symbol counts) \section{Punctuation symbols, \cmd\mathpunct} \SHOW\mathpunct +\section{`Over' symbols, \cmd\mathover} +\begingroup +\def\SYMB#1#2#3{% + \expandafter\iffontchar\csname#2\endcsname #3\relax + \refstepcounter{#2}% + \mathversion{#2}% + $\displaystyle #1{\mitx+\mity}$% + \fi +} +\SHOW\mathover +\endgroup + + +\section{`Under' symbols, \cmd\mathunder} +\begingroup +\def\SYMB#1#2#3{% + \expandafter\iffontchar\csname#2\endcsname #3\relax + \refstepcounter{#2}% + \mathversion{#2}% + $\displaystyle #1{\mitx+\mity}$% + \fi +} +\SHOW\mathunder +\endgroup + \clearpage \section{Accents, \cmd\mathaccent} @@ -170,12 +187,24 @@ Note that accents will only be properly placed if used with an OpenType font wit \expandafter\iffontchar\csname#2\endcsname #3\relax \refstepcounter{#2}% \mathversion{#2}% - $\displaystyle#1 x$% + $\displaystyle#1 \mitx$% \fi } \SHOW\mathaccent \endgroup +\section{Bottom accents, \cmd\mathbotaccent} +\begingroup +\def\SYMB#1#2#3{% + \expandafter\iffontchar\csname#2\endcsname #3\relax + \refstepcounter{#2}% + \mathversion{#2}% + $\displaystyle#1 \mitx$% + \fi +} +\SHOW\mathbotaccent +\endgroup + \clearpage \section{Big operators, \cmd\mathop} @@ -192,7 +221,6 @@ The limits behaviour as specified by \textsf{unicode-math} are shown with grey s \SHOW\mathop \endgroup -\clearpage \section{Binary relations, \cmd\mathbin} \SHOW\mathbin @@ -206,7 +234,168 @@ The limits behaviour as specified by \textsf{unicode-math} are shown with grey s \clearpage \section{Alphabetical symbols, \cmd\mathalpha} -\SHOW\mathalpha + +% first read in all \mathalpha symbols into a variable: +\ExplSyntaxOn +\cs_set:Npn \UnicodeMathSymbol #1#2#3#4 { + \str_if_eq:nnT {\mathalpha} {#3} { + \exp_not:n { \UnicodeMathSymbol {#1}{#2}{#3}{#4} } + } +} +\CatchFileEdef + \ALPHA{unicode-math-table.tex} + {\char_set_catcode_space:N \ } + +% now each time we print an alphabet we remove the slot; +% this ensures we won't miss anything + +\def\INPUT{\ALPHA} +\cs_new:Npn \SLOTS #1#2 { + \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { + \bool_if:nT + { + \int_compare_p:n {##1 >= #1} && \int_compare_p:n {##1 <= #2} + } + { + \PRINTLINE{##1}{##2}{##4} + } + } + \TABLE + \cs_set:Npn \UnicodeMathSymbol ##1##2##3##4 { + \bool_if:nT + { + \int_compare_p:n {##1 > #2} || \int_compare_p:n {##1 < #1} + } + { + \exp_not:n { \UnicodeMathSymbol {##1}{##2}{##3}{##4} } + } + } + \edef\ALPHA{\ALPHA} +} + +\ExplSyntaxOff + +\subsection{Normal weight} + +\subsubsection{Upright Greek, uppercase} +\SLOTS{"00391}{"003A9} + +\subsubsection{Upright Greek, lowercase} +\SLOTS{"003B1}{"003F5} + +\subsubsection{Italic, Latin, uppercase} +\SLOTS{"1D434}{"1D44D} + +\subsubsection{Italic, Latin, lowercase} +\SLOTS{"1D44E}{"1D467} + +\subsubsection{Italic Greek, uppercase} +\SLOTS{"1D6E2}{"1D6FA} + +\subsubsection{Italic Greek, lowercase} +\SLOTS{"1D6FC}{"1D71B} + +\subsubsection{Script, Latin, uppercase} +\SLOTS{"1D49C}{"1D4B5} + +\subsubsection{Script, Latin, lowercase} +\SLOTS{"1D4B6}{"1D4CF} + +\subsubsection{Fraktur, Latin, uppercase} +\SLOTS{"1D504}{"1D51C} + +\subsubsection{Fraktur, Latin, lowercase} +\SLOTS{"1D51E}{"1D537} + +\subsubsection{Blackboard, Latin, uppercase} +\SLOTS{"1D538}{"1D550} + +\subsubsection{Blackboard, Latin, lowercase} +\SLOTS{"1D552}{"1D56B} + +\subsubsection{Sans serif, Latin, uppercase} +\SLOTS{"1D5A0}{"1D5B9} + +\subsubsection{Sans serif, Latin, lowercase} +\SLOTS{"1D5BA}{"1D5D3} + +\subsubsection{Italic sans serif, Latin, uppercase} +\SLOTS{"1D608}{"1D621} + +\subsubsection{Italic sans serif, Latin, lowercase} +\SLOTS{"1D622}{"1D63B} + +\subsubsection{Typewriter, Latin, uppercase} +\SLOTS{"1D670}{"1D689} + +\subsubsection{Typewriter, Latin, lowercase} +\SLOTS{"1D68A}{"1D6A3} + +\subsection{Bold} + +\subsubsection{Bold, Latin, uppercase} +\SLOTS{"1D400}{"1D419} + +\subsubsection{Bold, Latin, lowercase} +\SLOTS{"1D41A}{"1D433} + +\subsubsection{Bold Greek, uppercase} +\SLOTS{"1D6A8}{"1D6C0} + +\subsubsection{Bold Greek, lowercase} +\SLOTS{"1D6C2}{"1D6E1} + +\subsubsection{Bold italic, Latin, uppercase} +\SLOTS{"1D468}{"1D481} + +\subsubsection{Bold italic, Latin, lowercase} +\SLOTS{"1D482}{"1D49B} + +\subsubsection{Bold italic Greek, uppercase} +\SLOTS{"1D71C}{"1D734} + +\subsubsection{Bold italic Greek, lowercase} +\SLOTS{"1D736}{"1D755} + +\subsubsection{Bold script, Latin, uppercase} +\SLOTS{"1D4D0}{"1D4E9} + +\subsubsection{Bold script, Latin, lowercase} +\SLOTS{"1D4EA}{"1D503} + +\subsubsection{Bold fraktur, Latin, uppercase} +\SLOTS{"1D56C}{"1D585} + +\subsubsection{Bold fraktur, Latin, lowercase} +\SLOTS{"1D586}{"1D59F} + +\subsubsection{Bold sans serif, Latin, uppercase} +\SLOTS{"1D5D4}{"1D5ED} + +\subsubsection{Bold sans serif, Latin, lowercase} +\SLOTS{"1D5EE}{"1D607} + +\subsubsection{Bold italic sans serif, Latin, uppercase} +\SLOTS{"1D63C}{"1D655} + +\subsubsection{Bold italic sans serif, Latin, lowercase} +\SLOTS{"1D656}{"1D66F} + +\subsubsection{Bold sans serif Greek, uppercase} +\SLOTS{"1D756}{"1D76E} + +\subsubsection{Bold sans serif Greek, lowercase} +\SLOTS{"1D770}{"1D78F} + +\subsubsection{Bold italic sans serif Greek, uppercase} +\SLOTS{"1D790}{"1D7A8} + +\subsubsection{Bold italic sans serif Greek, lowercase} +\SLOTS{"1D7AA}{"1D7C9} + +\subsection{Miscellaneous} +\def\UnicodeMathSymbol#1#2#3#4{\PRINTLINE{#1}{#2}{#4}} +\TABLE \refstepcounter{lm}\label{count:lm} \refstepcounter{xits}\label{count:xits} @@ -214,6 +403,7 @@ The limits behaviour as specified by \textsf{unicode-math} are shown with grey s \refstepcounter{lucida}\label{count:lucida} \refstepcounter{lucibold}\label{count:lucibold} \refstepcounter{asana}\label{count:asana} +\refstepcounter{pagella}\label{count:pagella} \refstepcounter{euler}\label{count:euler} \end{document} -- cgit v1.2.3