summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-09-11 21:17:53 +0000
committerKarl Berry <karl@freefriends.org>2023-09-11 21:17:53 +0000
commit17c4a2fddf7936f6c81aa83dd7ea1a4f65a01578 (patch)
tree5b79970841615804d7a177d1f29dad660f62c53c /Master/texmf-dist/tex
parent304e38aa8844c0e7bbccc14f155ead5bd3832028 (diff)
mathfont (11sep23)
git-svn-id: svn://tug.org/texlive/trunk@68241 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/mathfont/mathfont.sty625
1 files changed, 323 insertions, 302 deletions
diff --git a/Master/texmf-dist/tex/latex/mathfont/mathfont.sty b/Master/texmf-dist/tex/latex/mathfont/mathfont.sty
index 603196eb9a1..ca31d047dfa 100644
--- a/Master/texmf-dist/tex/latex/mathfont/mathfont.sty
+++ b/Master/texmf-dist/tex/latex/mathfont/mathfont.sty
@@ -6,8 +6,8 @@
%%
%% mathfont_code.dtx (with options: `package')
%%
-%% This file is from version 2.2b of the free and open-source
-%% LaTeX package "mathfont," released August 2023, to be used
+%% This file is from version 2.3 of the free and open-source
+%% LaTeX package "mathfont," released September 2023, to be used
%% with the XeTeX or LuaTeX engines. (As of version 2.0, LuaTeX
%% is recommended.)
%%
@@ -60,46 +60,56 @@
%% For more information, see mathfont_code.dtx. Happy TeXing!
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{mathfont}[2023/08/21 v. 2.2b Package mathfont]
+\ProvidesPackage{mathfont}[2023/09/09 v. 2.3 Package mathfont]
\newif\ifM@XeTeXLuaTeX % is engine one of xetex or luatex?
\newif\ifM@Noluaotfload % cannot find luaotfload.sty?
\newif\ifM@adjust@font % should adjust fonts with lua script?
\newif\ifM@font@loaded % load mathfont with font specified?
\newif\ifE@sterEggDecl@red % already did easter egg?
-\long\def\@gobbletwo@brackets[#1]#2{}
+\newcount\M@loader % specifies which font-loader to use
+\long\def\@gobble@brackets[#1]{}
\def\M@NoMathfontError#1{\PackageError{mathfont}
{\MessageBreak Invalid command\MessageBreak
\string#1 on line \the\inputlineno}
{Your command was ignored. I couldn't\MessageBreak
load mathfont, so I never defined this\MessageBreak
control sequence.}}
-\protected\def\mathfont{\M@NoMathfontError\mathfont
- \@ifnextchar[\@gobbletwo@brackets\@gobble}
-\protected\def\setfont{\M@NoMathfontError\setfont\@gobble}
-\protected\def\mathconstantsfont{\M@NoMathfontError\mathconstantsfont
- \@ifnextchar[\@gobbletwo@brackets\@gobble}
-\protected\def\newmathrm{\M@NoMathfontError\newmathrm\@gobbletwo}
-\protected\def\newmathit{\M@NoMathfontError\newmathit\@gobbletwo}
-\protected\def\newmathbf{\M@NoMathfontError\newmathbf\@gobbletwo}
-\protected\def\newmathbfit{\M@NoMathfontError\newmathbf\@gobbletwo}
-\protected\def\newmathbold{\M@NoMathfontError\newmathbold\@gobbletwo}
-\protected\def\newmathboldit{\M@NoMathfontError\newmathbold\@gobbletwo}
-\protected\def\newmathsc{\M@NoMathfontError\newmathsc\@gobbletwo}
-\protected\def\newmathscit{\M@NoMathfontError\newmathscit\@gobbletwo}
-\protected\def\newmathbfsc{\M@NoMathfontError\newmathbfsc\@gobbletwo}
-\protected\def\newmathbfscit{\M@NoMathfontError\newmathbfscit\@gobbletwo}
+\@tfor\@i:=\setfont
+ \RuleThicknessFactor
+ \IntegralItalicFactor
+ \SurdVerticalFactor
+ \SurdHorizontalFactor
+ \CharmLine
+ \CharmFile\do{%
+ \edef\@tempa{\protected\def\expandafter\noexpand\@i}%
+ \edef\@tempb{\noexpand\M@NoMathfontError
+ \expandafter\noexpand\@i
+ \noexpand\@gobble}%
+ \expandafter\@tempa\expandafter{\@tempb}}
+\@tfor\@i:=\newmathrm
+ \newmathit
+ \newmathbf
+ \newmathbfit
+ \newmathbold
+ \newmathboldit
+ \newmathsc
+ \newmathscit
+ \newmathbfsc
+ \newmathbfscit\do{%
+ \edef\@tempa{\protected\def\expandafter\noexpand\@i}%
+ \edef\@tempb{\noexpand\M@NoMathfontError
+ \expandafter\noexpand\@i
+ \noexpand\@gobbletwo}%
+ \expandafter\@tempa\expandafter{\@tempb}}
+\@tfor\@i:=\mathfont\mathconstantsfont\do{%
+ \edef\@tempa{\protected\def\expandafter\noexpand\@i}%
+ \edef\@tempb{\noexpand\M@NoMathfontError
+ \expandafter\noexpand\@i
+ \noexpand\@ifnextchar[{\noexpand\expandafter
+ \noexpand\@gobble\noexpand\@gobble@brackets}{\noexpand\@gobble}}
+ \expandafter\@tempa\expandafter{\@tempb}}
\protected\def\newmathfontcommand{%
\M@NoMathfontError\newmathfontcommand\@gobblefour}
-\protected\def\RuleThicknessFactor{%
- \M@NoMathfontError\RuleThicknessFactor\@gobble}
-\protected\def\IntegralItalicFactor{%
- \M@NoMathfontError\IntegralItalicFactor\@gobble}
-\protected\def\SurdVerticalFactor{%
- \M@NoMathfontError\SurdVerticalFactor\@gobble}
-\protected\def\SurdHorizontalFactor{%
- \M@NoMathfontError\SurdHorizontalFactor\@gobble}
-\protected\def\CharmLine{\M@NoMathfontError\CharmLine\@gobble}
-\protected\def\CharmFile{\M@NoMathfontError\CharmFile\@gobble}
\ifdefined\directlua
\M@XeTeXLuaTeXtrue
\fi
@@ -140,12 +150,12 @@ document with one of those two engines.^^J}}%
\IfFileExists{luaotfload.sty}
{\M@Noluaotfloadfalse\RequirePackage{luaotfload}}{\M@Noluaotfloadtrue}
\else
- \PackageWarningNoLine{mathfont}{%
+ \AtEndOfPackage{\PackageWarningNoLine{mathfont}{%
The current engine is XeTeX, but as\MessageBreak
of mathfont version 2.0, LuaTeX is\MessageBreak
recommended. Consider compiling with\MessageBreak
LuaLaTeX. Certain features will not\MessageBreak
- work with XeTeX}
+ work with XeTeX}}
\fi
\ifM@Noluaotfload % false by default; true if LuaTeX AND no luaotfload.sty
\begingroup
@@ -232,31 +242,80 @@ by TeX or compile with XeLaTeX.^^J}}%
\let\E@sterEggUpd@te\relax
\let\EasterEggUpdate\relax}
\fi}% my easter egg :)
+\DeclareOption{default-loader}{\M@loader\z@}
+\DeclareOption{fontspec-loader}{\M@loader\@ne}
\DeclareOption{adjust}{\M@adjust@fonttrue}
\DeclareOption{no-adjust}{\M@adjust@fontfalse}
\DeclareOption*{\M@font@loadedtrue\edef\M@font@load{\CurrentOption}}
\ProcessOptions*
+\ifcase\M@loader
+ \wlog{Package mathfont Info: Default font-loader was
+ requested for font loading.}
+\or
+ \wlog{Package mathfont Info: Package fontspec was
+ requested for font loading.}
+ \@ifpackageloaded{fontspec}
+ {\wlog{Package mathfont Info: Package fontspec detected.}
+ \csname bool_if:NTF\expandafter\endcsname
+ \csname g__fontspec_math_bool\endcsname
+ {\wlog{Package mathfont Info: Setting
+ \string\g__fontspec_math_bool to false.}
+ \csname bool_set_false:N\expandafter\endcsname
+ \csname g__fontspec_math_bool\endcsname}{\relax}}
+ {\wlog{Package mathfont Info: Package fontspec not detected.}
+ \IfFileExists{fontspec.sty}
+ {\wlog{Package mathfont Info: File fontspec.sty was found.}
+ \wlog{Package mathfont Info: Loading fontspec.}
+ \RequirePackage[no-math]{fontspec}}
+ {\PackageError{mathfont}{Missing package fontspec;\MessageBreak
+ using default font-loader instead}
+ {You requested fontspec as the font-loader for\MessageBreak
+ mathfont. However, I can't find the fontspec\MessageBreak
+ package file, so I'm going to use the default\MessageBreak
+ font-loader instead. (This likely means that\MessageBreak
+ something is wrong with your TeX installation.)\MessageBreak
+ Check your TeX distribution for a list of the\MessageBreak
+ packages installed on your system. To resolve\MessageBreak
+ this error, make sure fontspec is installed in\MessageBreak
+ a directory searchable by TeX or load mathfont\MessageBreak
+ with the default-loader option.^^J}
+ \M@loader\z@}}
+\fi
+\ifcase\M@loader
+ \wlog{Package mathfont Info: Using default font-loader.}
+ \AtEndOfPackage{\typeout{:: mathfont :: Using default font-loader.}}
+ \def\M@otf@features{script=latin;language=DFLT;+tlig;+liga;+lnum}
+\or
+ \wlog{Package mathfont Info: Using fontspec as font-loader.}
+ \AtEndOfPackage{\typeout{:: mathfont :: Using fontspec as font-loader.}}
+ \def\M@otf@features{Script=Latin,
+ Language=Default,
+ Ligatures={TeX,Common},
+ Numbers=Lining}
+\fi
\ifdefined\directlua
\ifM@adjust@font
+ \wlog{Package mathfont Info: Enabling Lua-based font adjustments.}
\AtEndOfPackage{%
\typeout{:: mathfont :: Lua-based font adjustments enabled.}}
\else
+ \wlog{Package mathfont Info: Disabling Lua-based font adjustments.}
\AtEndOfPackage{%
\typeout{:: mathfont :: Lua-based font adjustments disabled.}}
\fi
\else
- \AtEndOfPackage{%
- \typeout{:: mathfont :: Lua-based font adjustments disabled.}}
\ifM@adjust@font
- \AtEndOfPackage{%
\PackageError{mathfont}{Option^^J"adjust" ignored with XeTeX}
{Your package option "adjust" was ignored.\MessageBreak
This option works only with LuaTeX, and it\MessageBreak
looks like the current engine is XeTeX. To\MessageBreak
enable Lua-based font adjustments, typeset\MessageBreak
- with LuaLaTeX.^^J}}
+ with LuaLaTeX.^^J}
\M@adjust@fontfalse
\fi
+ \wlog{Package mathfont Info: Disabling Lua-based font adjustments.}
+ \AtEndOfPackage{%
+ \typeout{:: mathfont :: Lua-based font adjustments disabled.}}
\fi
\def\M@SymbolFontInfo#1#2#3#4{\wlog{^^JPackage mathfont Info:
Declaring new symbol font from #1!^^J%
@@ -274,6 +333,18 @@ by TeX or compile with XeLaTeX.^^J}}%
#1 chars, so I'm ignoring\MessageBreak
this option for \string\mathfont\space
on line \the\inputlineno\@gobble}}
+\def\M@MissingNFSSShapesWarning#1#2{\PackageWarning{mathfont}
+ {The nfss family "#1"\MessageBreak
+ from line \the\inputlineno\space is missing shapes. You\MessageBreak
+ may see some substitutions or errors.\MessageBreak
+ Missing shape(s):#2\@gobble}}
+\def\M@NoBaseModeDetectedWarning#1{\PackageWarning{mathfont}
+ {I couldn't find a base-mode version of\MessageBreak
+ the nfss family "#1"\MessageBreak
+ from line \the\inputlineno, so I'm using the family\MessageBreak
+ you specified for the math font. Some\MessageBreak
+ font features may not work in math\MessageBreak
+ mode\@gobble}}
\def\M@DeprecatedWarning#1#2{\PackageWarning{mathfont}
{Your \string#1\space command on\MessageBreak
line \the\inputlineno\space is deprecated, and I\MessageBreak
@@ -302,9 +373,9 @@ by TeX or compile with XeLaTeX.^^J}}%
\def\M@MissingSuboptionError{\PackageError{mathfont}
{Missing^^Jsuboption for \string\mathfont\on@line}
{It looks like you included an = somewhere\MessageBreak
- but didn't put the suboption after it. Either\MessageBreak
- that or you typed == instead of = in the\MessageBreak
- optional argument of \string\mathfont.^^J}}
+ in the optional argument of \string\mathfont\space but\MessageBreak
+ didn't put the suboption after it. Either\MessageBreak
+ that or you typed == instead of =.^^J}}
\def\M@InternalsRestoredError{\PackageError{mathfont}
{Internal^^Jcommands restored}
{This package slightly changes two LaTeX\MessageBreak
@@ -319,30 +390,10 @@ by TeX or compile with XeLaTeX.^^J}}%
Try typesetting this document with all\MessageBreak
\string\mathfont\space commands placed before you call\MessageBreak
\string\restoremathinternals.^^J}}
-\def\M@NoFontspecFamilyError{\PackageError{mathfont}
- {No previous^^Jfont loaded by fontspec}
- {You called \string\mathfont\space
- with the argument "fontspec" \MessageBreak
- on line \the\inputlineno,
- and that tells me to use the previous \MessageBreak
- font loaded by the fontspec package. However, it \MessageBreak
- looks like you haven't loaded any fonts yet with \MessageBreak
- fontspec. To resolve this error, try using for \MessageBreak
- example \string\setmainfont\space
- before calling \string\mathfont.^^J}}
-\def\M@NoFontspecError{\PackageError{mathfont}
- {Missing^^Jpackage fontspec}
- {You called \string\mathfont\space
- with the argument "fontspec" \MessageBreak
- on line \the\inputlineno,
- and that tells me to use the previous \MessageBreak
- font loaded by the fontspec package. However, you\MessageBreak
- haven't loaded fontspec, so some things are about\MessageBreak
- to get messed up. To resolve this error, load\MessageBreak
- fontspec before calling \string\mathfont.^^J}}
\def\M@BadMathConstantsFontError#1{\PackageError{mathfont}
- {Invalid\MessageBreak font specifier for
- \string\mathconstantsfont:\MessageBreak"#1"}
+ {Invalid font specifier\MessageBreak
+ for \string\mathconstantsfont:\MessageBreak
+ "#1"}
{Your command was ignored--I can't parse your argument.\MessageBreak
Please make sure to use text that you have previously\MessageBreak
fed to \string\mathfont\space for the argument of
@@ -353,10 +404,13 @@ by TeX or compile with XeLaTeX.^^J}}%
{The optional argument of \string\mathconstantsfont\MessageBreak
should be "upright" or "italic." Right now,\MessageBreak
it's "#1."^^J}}
-\def\M@LuaTeXOnlyWarning{\PackageWarning{mathfont}
- {Your \string\mathconstantsfont\space
- on line \the\inputlineno\space is\MessageBreak
- for LuaTeX only, and I'm ignoring it\@gobble}}
+\def\M@MathConstantsNoFontAdjustWarning{\PackageWarning{mathfont}
+ {Your \string\mathconstantsfont\space
+ on line \the\inputlineno\MessageBreak
+ is mainly for use in LuaTeX with font\MessageBreak
+ adjustments enabled. In the current\MessageBreak
+ situation, it is probably not doing\MessageBreak
+ anything\@gobble}}
\def\M@MissingControlSequenceError#1#2{\PackageError{mathfont}
{Missing control sequence\MessageBreak
for\string#1\MessageBreak on input line \the\inputlineno}
@@ -411,16 +465,6 @@ by TeX or compile with XeLaTeX.^^J}}%
that your argument of \string#1\space\MessageBreak
is a nonnegative integer. Right now it's\MessageBreak
"#2".^^J}}
-\@ifpackageloaded{fontspec}
- {\wlog{Package mathfont Info: Package fontspec detected.}
- \wlog{Package mathfont Info: Setting \string\g__fontspec_math_bool
- to false.}
- \csname bool_set_false:N\expandafter\endcsname
- \csname g__fontspec_math_bool\endcsname}
- {\wlog{Package mathfont Info: Package fontspec not detected.}
- \wlog{Package mathfont Info: Will pass no-math option to fontspec
- if it gets loaded.}
- \PassOptionsToPackage{no-math}{fontspec}}
\let\@@set@mathchar\set@mathchar
\let\@@set@mathsymbol\set@mathsymbol
\let\@@set@mathaccent\set@mathaccent
@@ -469,18 +513,18 @@ by TeX or compile with XeLaTeX.^^J}}%
\fi
\newbox\surdbox
\newcount\M@count
-\newcount\M@rule@thickness@factor
-\newcount\M@integral@italic@factor
-\newcount\M@surd@vertical@factor
-\newcount\M@surd@horizontal@factor
+\newcount\M@RuleThicknessFactor
+\newcount\M@IntegralItalicFactor
+\newcount\M@SurdVerticalFactor
+\newcount\M@SurdHorizontalFactor
\newmuskip\radicandoffset
\newread\M@Charm
\newtoks\M@toks
\M@count\z@
-\M@rule@thickness@factor\@m
-\M@integral@italic@factor=400\relax
-\M@surd@horizontal@factor\@m
-\M@surd@vertical@factor\@m
+\M@RuleThicknessFactor\@m
+\M@IntegralItalicFactor=400\relax
+\M@SurdHorizontalFactor\@m
+\M@SurdVerticalFactor\@m
\radicandoffset=3mu\relax
\newif\ifM@upper
\newif\ifM@lower
@@ -510,7 +554,6 @@ by TeX or compile with XeLaTeX.^^J}}%
\newif\if@suboptionpresent
\newif\ifM@arg@good
\newif\ifM@Decl@reF@mily
-\newif\ifM@Decl@reF@milyB@se
\newif\ifM@fromCharmFile
\def\M@uppershape{italic} % latin upper
\def\M@lowershape{italic} % latin lower
@@ -546,117 +589,108 @@ by TeX or compile with XeLaTeX.^^J}}%
\ifM@adjust@font
\edef\M@defaultkeys{\M@defaultkeys,delimiters,radical,bigops}
\fi
-\def\M@otf@features{script=latin;language=DFLT;%
- tlig=true;liga=true;smcp=false;lnum=true}
-\def\M@otf@features@sc{script=latin;language=DFLT;%
- tlig=true;liga=true;smcp=true;lnum=true}
+\def\M@declare@shape#1#2#3#4#5#6{%
+ \ifcsname TU/#1/#5/#6\endcsname
+ \else
+ \DeclareFontShape{TU}{#1}{#5}{#6}{<->"\@tempbase#2:#3;#4"}{}
+ \fi}
+\def\M@fill@nfss@shapes#1#2#3{%
+ \@for\@i:={#1}{}{#2;-smcp}{#3}{\mddefault}{\shapedefault},%
+ {#1}{/I}{#2;-smcp}{#3}{\mddefault}{\itdefault},%
+ {#1}{/B}{#2;-smcp}{#3}{\bfdefault}{\shapedefault},%
+ {#1}{/BI}{#2;-smcp}{#3}{\bfdefault}{\itdefault},%
+ {#1}{}{#2;+smcp}{#3}{\mddefault}{\scdefault},%
+ {#1}{/I}{#2;+smcp}{#3}{\mddefault}{\scdefault\itdefault},%
+ {#1}{/B}{#2;+smcp}{#3}{\bfdefault}{\shapedefault},%
+ {#1}{/BI}{#2;+smcp}{#3}{\bfdefault}{\scdefault\itdefault}%
+ \do{\expandafter\M@declare@shape\@i}}
+\def\M@check@nfss@shapes#1{%
+ \let\@tempb\@empty
+ \let\@tempwarning\@gobble
+ \@for\@i:=\mddefault/\shapedefault,%
+ \mddefault/\itdefault,%
+ \bfdefault/\shapedefault,%
+ \bfdefault/\itdefault\do{%
+ \expandafter\ifx\csname TU/#1/\@i\endcsname\relax
+ \def\@tempwarning{\M@MissingNFSSShapesWarning{#1}}
+ \edef\@tempb{\@tempb, \@i}
+ \fi}
+ \@tempwarning{\expandafter\@gobble\@tempb}}
\def\M@split@colon#1:#2\@nil{\def\@tempbase{#1}
\def\@tempfeatures{#2}}
\def\M@strip@colon#1:{#1}
-\def\M@fill@nfss@shapes#1#2{%
- \ifcsname TU/#1/\mddefault/\shapedefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\mddefault}{\shapedefault}
- {<->"\@tempbase:\M@otf@features;#2"}{}
- \fi
- \ifcsname TU/#1/\mddefault/\itdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\mddefault}{\itdefault}
- {<->"\@tempbase/I:\M@otf@features;#2"}{}
- \fi
- \ifcsname TU/#1/\bfdefault/\shapedefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\bfdefault}{\shapedefault}
- {<->"\@tempbase/B:\M@otf@features;#2"}{}
- \fi
- \ifcsname TU/#1/\bfdefault/\itdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\bfdefault}{\itdefault}
- {<->"\@tempbase/BI:\M@otf@features;#2"}{}
- \fi
- \ifcsname TU/#1/\mddefault/\scdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\mddefault}{\scdefault}
- {<->"\@tempbase:\M@otf@features@sc;#2"}{}
- \fi
- \ifcsname TU/#1/\mddefault/\scdefault\itdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\mddefault}{\scdefault\itdefault}
- {<->"\@tempbase/I:\M@otf@features@sc;#2"}{}
- \fi
- \ifcsname TU/#1/\bfdefault/\scdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\bfdefault}{\scdefault}
- {<->"\@tempbase/B:\M@otf@features@sc;#2"}{}
- \fi
- \ifcsname TU/#1/\bfdefault/\scdefault\itdefault\endcsname
- \else
- \DeclareFontShape{TU}{#1}{\bfdefault}{\scdefault\itdefault}
- {<->"\@tempbase/BI:\M@otf@features@sc;#2"}{}
- \fi}
\def\M@newfont#1{%
\edef\@tempa{#1}
\expandafter\M@split@colon\@tempa:\@nil
- \def\@tempb{fontspec}
- \ifx\@tempa\@tempb
- \@ifpackageloaded{fontspec}{%
- \expandafter\ifx\csname l_fontspec_family_tl\endcsname\@empty
- \M@NoFontspecFamilyError
+ \ifx\@tempfeatures\@empty\else
+ \edef\@tempfeatures{\expandafter\M@strip@colon\@tempfeatures}
+ \fi
+ \ifcsname TU+\@tempbase\endcsname % is font family already in nfss?
+ \let\M@f@ntn@me\@tempbase
+ \M@check@nfss@shapes\M@f@ntn@me
+ \ifx\directlua\@undefined % if XeTeX
+ \expandafter\edef\csname\M@f@ntn@me-base\endcsname{\M@f@ntn@me}
+ \let\M@f@ntn@meb@se\M@f@ntn@me
+ \else % if LuaTeX
+ \ifcsname\M@f@ntn@me-base\endcsname % if base-mode version is known
+ \edef\M@f@ntn@meb@se{\csname\M@f@ntn@me-base\endcsname}
+ \M@check@nfss@shapes\M@f@ntn@meb@se
\else
- \expandafter
- \let\expandafter\M@f@ntn@me\csname l_fontspec_family_tl\encsname
- \def\@tempbase{\M@f@ntn@me\space(from fontspec)}
- \let\M@f@ntn@meb@se\M@f@ntn@me % no separate font in base mode
- \fi}{\M@NoFontspecError}
+ \M@NoBaseModeDetectedWarning{\M@f@ntn@me}
+ \edef\M@f@ntn@meb@se{\M@f@ntn@me}
+ \expandafter\edef\csname\M@f@ntn@me-base\endcsname{\M@f@ntn@me}
+ \fi
+ \fi
+ \expandafter\edef\csname M@fontfamily@\@tempbase\endcsname
+ {\M@f@ntn@me}
+ \expandafter\edef\csname M@fontfamily@base@\@tempbase\endcsname
+ {\M@f@ntn@meb@se}
\else
- \@ifpackageloaded{fontspec}
- {\csname fontspec_set_family:Nnn\endcsname\M@f@ntn@me{}{\@tempa}
- % no separate font in base mode
- \let\M@f@ntn@meb@se\M@f@ntn@me}
- {\M@Decl@reF@milytrue
- \M@Decl@reF@milyB@setrue
- \ifx\@tempfeatures\@empty
+ \edef@nospace\@tempa{\@tempa}
+ \ifcsname M@fontfamily@\@tempa\endcsname
+ \edef\M@f@ntn@me{\csname M@fontfamily@\@tempa\endcsname}
+ \edef\M@f@ntn@meb@se{\csname M@fontfamily@base@\@tempa\endcsname}
+ \else
+ \edef@nospace\@tempa{\@tempa}
+ \ifcase\M@loader % are we using default font-loader?
+ \let\M@f@ntn@me\@tempa
+ \wlog{Package mathfont Info: Adding \@tempbase\space to the nfss!}
+ \wlog{Family name: \M@f@ntn@me}
+ \DeclareFontFamily{TU}{\M@f@ntn@me}{}
+ \M@fill@nfss@shapes{\M@f@ntn@me}{\M@otf@features}{\@tempfeatures}
\ifdefined\directlua
- \edef\@basefeatures{mode=base}
+ \edef\M@f@ntn@meb@se{\M@f@ntn@me-base}
+ \wlog{Package mathfont Info: Adding \@tempbase with mode=base
+ to the nfss!}
+ \wlog{Family name: \M@f@ntn@meb@se}
+ \DeclareFontFamily{TU}{\M@f@ntn@meb@se}{}
+ \M@fill@nfss@shapes
+ {\M@f@ntn@meb@se}{\M@otf@features}{\@tempfeatures;mode=base}
\else
- \let\@basefeatures\@tempfeatures
+ \edef\M@f@ntn@meb@se{\M@f@ntn@me}
\fi
- \else
- \edef\@tempfeatures{\expandafter\M@strip@colon\@tempfeatures}
+ \or % are we using fontspec as font-loader?
+ \wlog{Package mathfont Info: Passing \@tempbase\space to fontspec
+ for handling!}
+ \csname fontspec_set_family:Nnn\endcsname\M@f@ntn@me
+ {\M@otf@features,\@tempfeatures}{\@tempbase}
\ifdefined\directlua
- \edef\@basefeatures{\@tempfeatures;mode=base}
+ \wlog{Package mathfont Info: Passing \@tempbase\space with
+ Renderer=Base to fontspec for handling!}
+ \csname fontspec_set_family:Nnn\endcsname\M@f@ntn@meb@se
+ {\M@otf@features,\@tempfeatures,Renderer=Base}{\@tempbase}
\else
- \let\@basefeatures\@tempfeatures
+ \edef\M@f@ntn@meb@se{\M@f@ntn@me}
\fi
\fi
- \edef@nospace\@tempa{\@tempa}
- \edef@nospace\@tempb{\@tempbase}
- \M@Decl@reF@milytrue
- \@tfor\@i:=\@tempa\@tempb\@tempbase\do{%
- \ifcsname TU+\@i\endcsname
- \expandafter\let\expandafter\M@f@ntn@me\@i
- \M@Decl@reF@milyfalse
- \M@fill@nfss@shapes\M@f@ntn@me\@tempfeatures
- \@break@tfor
- \fi}
- \ifM@Decl@reF@mily
- \let\M@f@ntn@me\@tempa
- \wlog{Package mathfont Info: Adding \M@f@ntn@me\space to the nfss!}
- \DeclareFontFamily{TU}{\M@f@ntn@me}{}
- \M@fill@nfss@shapes\M@f@ntn@me\@tempfeatures
- \fi
- \ifdefined\directlua
- \edef\M@f@ntn@meb@se{\M@f@ntn@me-base}
- \else
- \let\M@f@ntn@meb@se\M@f@ntn@me
- \fi
- \ifcsname TU+\M@f@ntn@meb@se\endcsname\else
- \wlog{Package mathfont Info: Adding \M@f@ntn@meb@se\space
- to the nfss!}
- \DeclareFontFamily{TU}{\M@f@ntn@meb@se}{}
- \fi
- \M@fill@nfss@shapes\M@f@ntn@meb@se\@basefeatures}
+ \expandafter\edef\csname\M@f@ntn@me-base\endcsname{\M@f@ntn@meb@se}
+ \expandafter\edef\csname M@fontfamily@\@tempa\endcsname
+ {\M@f@ntn@me}
+ \expandafter\edef\csname M@fontfamily@base@\@tempa\endcsname
+ {\M@f@ntn@meb@se}
+ \fi
\fi}
+\@onlypreamble\M@declare@shape
\@onlypreamble\M@fill@nfss@shapes
\@onlypreamble\M@newfont
\def\M@check@option@valid#1{%
@@ -720,12 +754,11 @@ by TeX or compile with XeLaTeX.^^J}}%
\else
\M@toks{}
\M@newfont{#2}
- \expandafter\edef\csname M@fontfamily@#2\endcsname{\M@f@ntn@me}
- \expandafter\edef\csname M@fontfamily@base@#2\endcsname{\M@f@ntn@meb@se}
\ifcsname M@fontid@\M@f@ntn@me\endcsname\else % need new \M@count value?
- \expandafter\edef\csname M@fontid@\M@f@ntn@me\endcsname{\the\M@count}
- \expandafter\let\csname M@fontid@\M@f@ntn@meb@se\expandafter\endcsname
- \csname M@fontid@\M@f@ntn@me\endcsname
+ \expandafter\edef\csname M@fontid@\M@f@ntn@me\endcsname{\the
+ \M@count}
+ \expandafter\edef\csname M@fontid@\M@f@ntn@meb@se\endcsname{\the
+ \M@count}
\advance\M@count\@ne
\fi
\edef\@tempa{\csname M@fontid@\M@f@ntn@me\endcsname}
@@ -784,52 +817,51 @@ by TeX or compile with XeLaTeX.^^J}}%
\setmathfontcommands{#1}
\let\rmdefault\M@f@ntn@me}
\@onlypreamble\setfont
-\ifdefined\directlua
- \let\M@SetMathConstants\relax
- \protected\def\mathconstantsfont{%
- \@ifnextchar[{\@mathconstantsfont}{\@mathconstantsfont[upright]}}
- \def\@mathconstantsfont[#1]#2{%
- \edef\@tempa{\csname M@fontfamily@base@#2\endcsname}
- \expandafter\ifx\@tempa\relax
- \M@BadMathConstantsFontError{#2}
+\let\M@SetMathConstants\relax
+\protected\def\mathconstantsfont{%
+ \@ifnextchar[{\@mathconstantsfont}{\@mathconstantsfont[upright]}}
+\def\@mathconstantsfont[#1]#2{%
+ \edef@nospace\@tempa{#2}
+ \edef\@tempa{\csname M@fontfamily@base@\@tempa\endcsname}
+ \expandafter\ifx\@tempa\relax
+ \M@BadMathConstantsFontError{#2}
+ \else
+ \def\@tempb{#1}
+ \def\@tempc{upright}
+ \ifx\@tempb\@tempc
+ \let\m@th@const@nts@font@sh@pe\shapedefault
\else
- \def\@tempb{#1}
- \def\@tempc{upright}
+ \def\@tempc{italic}
\ifx\@tempb\@tempc
- \let\m@th@const@nts@font@sh@pe\shapedefault
+ \let\m@th@const@nts@font@sh@pe\itdefault
\else
- \def\@tempc{italic}
- \ifx\@tempb\@tempc
- \let\m@th@const@nts@font@sh@pe\itdefault
- \else
- \M@BadMathConstantsFontTypeError{#1}
- \fi
- \fi
- \ifcsname symM#1\csname M@fontid@\@tempa\endcsname\endcsname\else
- \DeclareSymbolFont{M#1\csname M@fontid@\@tempa\endcsname}
- {TU}{\@tempa}{\mddefault}{\m@th@const@nts@font@sh@pe}
+ \M@BadMathConstantsFontTypeError{#1}
\fi
- \let\m@th@const@nts@font\@tempa
- \protected\def\M@SetMathConstants{%
- \begingroup
- \escapechar\m@ne
- \expandafter\getanddefine@fonts
- \csname symM#1\csname M@fontid@\m@th@const@nts@font\endcsname
- \expandafter
- \endcsname % expands to \symMupright<id>
- \csname TU/\m@th@const@nts@font
- /\seriesdefault
- /\m@th@const@nts@font@sh@pe
- \endcsname % expands to \TU/<nfss family name>/m/<shape>
- \globaldefs\@ne
- \expandafter\@gobbletwo\math@fonts % gobble to avoid infinite loop
- \endgroup}
- \fi}
- \def\math@fonts{\aftergroup\M@SetMathConstants}
-\else
- \protected\def\mathconstantsfont{\M@LuaTeXOnlyWarning
- \@ifnextchar[\@gobbletwo@brackets\@gobble}
-\fi
+ \fi
+ \ifcsname symM#1\csname M@fontid@\@tempa\endcsname\endcsname\else
+ \DeclareSymbolFont{M#1\csname M@fontid@\@tempa\endcsname}
+ {TU}{\@tempa}{\mddefault}{\m@th@const@nts@font@sh@pe}
+ \fi
+ \let\m@th@const@nts@font\@tempa
+ \protected\def\M@SetMathConstants{%
+ \begingroup
+ \escapechar\m@ne
+ \expandafter\getanddefine@fonts
+ \csname symM#1\csname M@fontid@\m@th@const@nts@font\endcsname
+ \expandafter
+ \endcsname % expands to \symMupright<id>
+ \csname TU/\m@th@const@nts@font
+ /\seriesdefault
+ /\m@th@const@nts@font@sh@pe
+ \endcsname % expands to \TU/<nfss family name>/m/<shape>
+ \globaldefs\@ne
+ \expandafter\@gobbletwo\math@fonts % gobble to avoid infinite loop
+ \endgroup}
+ \fi
+ \ifM@adjust@font\else
+ \M@MathConstantsNoFontAdjustWarning
+ \fi}
+\def\math@fonts{\aftergroup\M@SetMathConstants}
\@onlypreamble\mathconstantsfont
\def\M@check@csarg#1#2{%
\expandafter\ifx\expandafter\@nnil\@gobble#2\@nnil % good
@@ -920,34 +952,22 @@ by TeX or compile with XeLaTeX.^^J}}%
end}
\fi
\fi}
- \protected\def\RuleThicknessFactor#1{%
- \M@check@int{#1}
- \ifM@arg@good
- \global\M@rule@thickness@factor=#1\relax
- \else
- \M@BadIntegerError\RuleThicknessFactor{#1}
- \fi}
- \protected\def\IntegralItalicFactor#1{%
- \M@check@int{#1}
- \ifM@arg@good
- \global\M@integral@italic@factor=#1\relax
- \else
- \M@BadIntegerError\IntegralItalicFactor{#1}
- \fi}
- \protected\def\SurdHorizontalFactor#1{%
- \M@check@int{#1}
- \ifM@arg@good
- \global\M@surd@horizontal@factor=#1\relax
- \else
- \M@BadIntegerError\SurdHorizontalFactor{#1}
- \fi}
- \protected\def\SurdVerticalFactor#1{%
- \M@check@int{#1}
- \ifM@arg@good
- \global\M@surd@vertical@factor=#1\relax
- \else
- \M@BadIntegerError\SurdVerticalFactor{#1}
- \fi}
+ \let\@tempa~
+ \let~\noexpand
+ \count@\escapechar
+ \escapechar\m@ne
+ \@tfor\@i:=\RuleThicknessFactor\IntegralItalicFactor
+ \SurdHorizontalFactor\SurdVerticalFactor\do{%
+ \protected\expandafter\edef\@i#1{%
+ ~\M@check@int{#1}%
+ ~\ifM@arg@good
+ ~\global
+ \expandafter~\csname M@\expandafter\string\@i\endcsname=#1\relax
+ ~\else
+ ~\M@BadIntegerError\expandafter~\@i{#1}%
+ ~\fi}}
+ \let~\@tempa
+ \escapechar\count@
\else
\@tfor\@i:=\RuleThicknessFactor\IntegralItalicFactor\SurdHorizontalFactor
\SurdVerticalFactor\CharmLine\CharmFile
@@ -994,19 +1014,6 @@ by TeX or compile with XeLaTeX.^^J}}%
\ifnum\tracinglostchars<\tw@
\tracinglostchars\tw@
\fi
-\ifdefined\XeTeXrevision
- \ifM@font@loaded
- \AtEndOfPackage{%
- \PackageWarningNoLine{mathfont}
- {XeTeX detected. It looks like you\MessageBreak
- specified a font when you loaded\MessageBreak
- mathfont. If you run into problems\MessageBreak
- with a font whose name is multiple\MessageBreak
- words, try compiling with LuaLaTeX\MessageBreak
- or call \string\setfont\space or \string\mathfont\MessageBreak
- manually}}
- \fi
-\fi
\def\keyword@info@begindocument#1:#2\@nil{%
\expandafter\ifx % next line is two cs to be compared
\csname ifM@#1\expandafter\endcsname\csname iftrue\endcsname
@@ -1046,6 +1053,19 @@ by TeX or compile with XeLaTeX.^^J}}%
\@for\@i:=\@tempa\do{%
\expandafter\keyword@info@begindocument\@i\@nil}
\wlog{}}
+\ifdefined\XeTeXrevision
+ \ifM@font@loaded
+ \AtEndOfPackage{%
+ \PackageWarningNoLine{mathfont}
+ {XeTeX detected. It looks like you\MessageBreak
+ specified a font when you loaded\MessageBreak
+ mathfont. If you run into problems\MessageBreak
+ with a font whose name is multiple\MessageBreak
+ words, try compiling with LuaLaTeX\MessageBreak
+ or call \string\setfont\space or \string\mathfont\MessageBreak
+ manually}}
+ \fi
+\fi
\ifM@font@loaded
\AtEndOfPackage{\setfont\M@font@load}
\fi
@@ -1061,12 +1081,13 @@ by TeX or compile with XeLaTeX.^^J}}%
\@onlypreamble\M@hebrew@set
\@onlypreamble\M@digits@set
\@onlypreamble\M@operator@set
-\@onlypreamble\M@symbols@set
-\@onlypreamble\M@extsymbols@set
\@onlypreamble\M@delimiters@set
-\@onlypreamble\M@arrows@set
+\@onlypreamble\M@radical@set
\@onlypreamble\M@bigops@set
\@onlypreamble\M@extbigops@set
+\@onlypreamble\M@symbols@set
+\@onlypreamble\M@extsymbols@set
+\@onlypreamble\M@arrows@set
\@onlypreamble\M@bb@set
\@onlypreamble\M@cal@set
\@onlypreamble\M@frak@set
@@ -1351,13 +1372,13 @@ function mathfont:modify_e_base(index, fontdata)
local width, height, depth, italic = self.glyph_info(char)
char.width = width + italic
if index == 8730 then
- local horizontal_scale = tex.getcount("M@surd@horizontal@factor") / 1000
- local vertical_scale = tex.getcount("M@surd@vertical@factor") / 1000
+ local horizontal_scale = tex.getcount("M@SurdHorizontalFactor") / 1000
+ local vertical_scale = tex.getcount("M@SurdVerticalFactor") / 1000
char.width = horizontal_scale * char.width
char.height = vertical_scale * height
end
if index == 8747 then
- local scale_factor = tex.getcount("M@integral@italic@factor") / 1000
+ local scale_factor = tex.getcount("M@IntegralItalicFactor") / 1000
char.italic = scale_factor * width
end
end
@@ -1519,7 +1540,7 @@ function mathfont.math_constants(fontdata)
local rule_thickness = 0
local dim = "FractionRuleThickness"
if not fontdata.MathConstants[dim] then
- local scale_factor = tex.getcount("M@rule@thickness@factor") / 1000
+ local scale_factor = tex.getcount("M@RuleThicknessFactor") / 1000
rule_thickness = (size / 18) * scale_factor
fontdata.MathConstants[dim] = rule_thickness
else
@@ -1825,32 +1846,32 @@ mathfont:new_type_a(121, 1044504, {150, 50, -50, 0}) % y
mathfont:new_type_a(122, 1044505, {100, 50, -100, 0}) % z
mathfont:new_type_a(305, 1044506, {100, 100, -150, 0}) % \imath
mathfont:new_type_a(567, 1044507, {700, 50, -150, 0}) % \jmath
-mathfont:new_type_a(65, 1044512, {50, 0, 150, 0}) % A
-mathfont:new_type_a(66, 1044513, {50, 0, 0, 0}) % B
-mathfont:new_type_a(67, 1044514, {0, 0, 0, 0}) % C
-mathfont:new_type_a(68, 1044515, {50, 0, -50, 0}) % D
-mathfont:new_type_a(69, 1044516, {50, 0, 0, 0}) % E
-mathfont:new_type_a(70, 1044517, {50, 0, 0, 0}) % F
-mathfont:new_type_a(71, 1044518, {0, 0, 0, 0}) % G
-mathfont:new_type_a(72, 1044519, {50, 0, -50, 0}) % H
-mathfont:new_type_a(73, 1044520, {100, 0, 0, 0}) % I
-mathfont:new_type_a(74, 1044521, {50, 0, 100, 0}) % J
-mathfont:new_type_a(75, 1044522, {50, 0, 0, 0}) % K
-mathfont:new_type_a(76, 1044523, {50, 0, -180, 0}) % L
-mathfont:new_type_a(77, 1044524, {50, 0, -50, 0}) % M
-mathfont:new_type_a(78, 1044525, {50, 0, -50, 0}) % N
-mathfont:new_type_a(79, 1044526, {0, 0, 0, 0}) % O
-mathfont:new_type_a(80, 1044527, {0, 0, -50, 0}) % P
-mathfont:new_type_a(81, 1044528, {0, 50, 0, 0}) % Q
-mathfont:new_type_a(82, 1044529, {50, 0, -50, 0}) % R
-mathfont:new_type_a(83, 1044530, {0, 0, -50, 0}) % S
-mathfont:new_type_a(84, 1044531, {0, 0, -50, 0}) % T
-mathfont:new_type_a(85, 1044532, {0, 0, -50, 0}) % U
-mathfont:new_type_a(86, 1044533, {0, 50, 0, 0}) % V
-mathfont:new_type_a(87, 1044534, {0, 50, -50, 0}) % W
-mathfont:new_type_a(88, 1044535, {50, 0, 0, 0}) % X
-mathfont:new_type_a(89, 1044536, {0, 0, -50, 0}) % Y
-mathfont:new_type_a(90, 1044537, {50, 0, -50, 0}) % Z
+mathfont:new_type_a(65, 1044512, {50, 0, 150, 0}) % A
+mathfont:new_type_a(66, 1044513, {50, 0, 0, 0}) % B
+mathfont:new_type_a(67, 1044514, {0, 0, 0, 0}) % C
+mathfont:new_type_a(68, 1044515, {50, 0, -50, 0}) % D
+mathfont:new_type_a(69, 1044516, {50, 0, 0, 0}) % E
+mathfont:new_type_a(70, 1044517, {50, 0, 0, 0}) % F
+mathfont:new_type_a(71, 1044518, {0, 0, 0, 0}) % G
+mathfont:new_type_a(72, 1044519, {50, 0, -50, 0}) % H
+mathfont:new_type_a(73, 1044520, {100, 0, 0, 0}) % I
+mathfont:new_type_a(74, 1044521, {50, 0, 100, 0}) % J
+mathfont:new_type_a(75, 1044522, {50, 0, 0, 0}) % K
+mathfont:new_type_a(76, 1044523, {50, 0, -180, 0}) % L
+mathfont:new_type_a(77, 1044524, {50, 0, -50, 0}) % M
+mathfont:new_type_a(78, 1044525, {50, 0, -50, 0}) % N
+mathfont:new_type_a(79, 1044526, {0, 0, 0, 0}) % O
+mathfont:new_type_a(80, 1044527, {0, 0, -50, 0}) % P
+mathfont:new_type_a(81, 1044528, {0, 50, 0, 0}) % Q
+mathfont:new_type_a(82, 1044529, {50, 0, -50, 0}) % R
+mathfont:new_type_a(83, 1044530, {0, 0, -50, 0}) % S
+mathfont:new_type_a(84, 1044531, {0, 0, -50, 0}) % T
+mathfont:new_type_a(85, 1044532, {0, 0, -50, 0}) % U
+mathfont:new_type_a(86, 1044533, {0, 50, 0, 0}) % V
+mathfont:new_type_a(87, 1044534, {0, 50, -50, 0}) % W
+mathfont:new_type_a(88, 1044535, {50, 0, 0, 0}) % X
+mathfont:new_type_a(89, 1044536, {0, 0, -50, 0}) % Y
+mathfont:new_type_a(90, 1044537, {50, 0, -50, 0}) % Z
mathfont:new_type_u(945, {0, 0}) % \alpha
mathfont:new_type_u(946, {0, 0}) % \beta
mathfont:new_type_u(947, {-50, 0}) % \gamma
@@ -2562,8 +2583,8 @@ mathfont:add_extensible_variants(smash, int_glyphs, int_scale)
\DeclareMathSymbol{-}{\mathbin}{\M@symbols@font}{"2212}
\DeclareMathSymbol{*}{\mathbin}{\M@symbols@font}{"2A}
\DeclareMathSymbol{\times}{\mathbin}{\M@symbols@font}{"D7}
- \DeclareMathSymbol{/}{\mathbin}{\M@symbols@font}{"2F}
- \DeclareMathSymbol{\fractionslash}{\mathbin}{\M@symbols@font}{"2215}
+ \DeclareMathSymbol{/}{\mathord}{\M@symbols@font}{"2F}
+ \DeclareMathSymbol{\fractionslash}{\mathord}{\M@symbols@font}{"2215}
\DeclareMathSymbol{\div}{\mathbin}{\M@symbols@font}{"F7}
\DeclareMathSymbol{\pm}{\mathbin}{\M@symbols@font}{"B1}
\DeclareMathSymbol{\bullet}{\mathbin}{\M@symbols@font}{"2022}