From 98766f71d95e3aa7dcf598359ffb0f9902c73797 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 1 Apr 2019 21:09:08 +0000 Subject: mathfont (1apr19) git-svn-id: svn://tug.org/texlive/trunk@50698 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/mathfont/mathfont.sty | 131 ++++++++++++++-------- 1 file changed, 83 insertions(+), 48 deletions(-) (limited to 'Master/texmf-dist/tex/latex/mathfont/mathfont.sty') diff --git a/Master/texmf-dist/tex/latex/mathfont/mathfont.sty b/Master/texmf-dist/tex/latex/mathfont/mathfont.sty index db4e26242a5..b4512aa9d0e 100644 --- a/Master/texmf-dist/tex/latex/mathfont/mathfont.sty +++ b/Master/texmf-dist/tex/latex/mathfont/mathfont.sty @@ -6,7 +6,7 @@ %% %% mathfont.dtx (with options: `package') %% -%% Copyright 2018 by Conrad Kosowsky +%% Copyright 2018-2019 by Conrad Kosowsky %% %% This file may be distributed and modified under the terms %% of the LaTeX Public Project License, version 1.3c or any later version. @@ -23,10 +23,9 @@ %% information, see the original mathfont.dtx file. %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{mathfont}[2019/01/19 v. 1.3 Package mathfont] +\ProvidesPackage{mathfont}[2019/04/01 v. 1.4 Package mathfont] \newif\if@packages \newif\if@operators -\@operatorstrue \DeclareOption{packages}{\@packagestrue} \DeclareOption{operators}{\@operatorstrue} \DeclareOption{no-operators}{\@operatorsfalse} @@ -75,11 +74,21 @@ \def\M@InvalidOptionError#1{\PackageError{mathfont} {Invalid option "#1"\MessageBreak for \string\mathfont} {Hm. Check that you spelled the\MessageBreak - option correctly and didn't include\MessageBreak - any extra spaces. Otherwise, I'm\MessageBreak + option correctly. Otherwise, I'm\MessageBreak not sure what's wrong. Is this\MessageBreak option listed in the package\MessageBreak documentation?}} +\def\M@MissingOptionError{\PackageError{mathfont} + {Missing option for \string\mathfont} + {It looks like you included a , or = in\MessageBreak + the optional argument of \string\mathfont\space\MessageBreak + but didn't put anything before it.}} +\def\M@MissingSuboptionError{\PackageError{mathfont} + {Missing suboption for \string\mathfont} + {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.}} \def\M@InternalsRestoredError{\PackageError{mathfont} {Internal commands restored} {This package slightly changes two LaTeX\MessageBreak @@ -113,11 +122,25 @@ math mode. I've inserted a \string$\MessageBreak just before your \string#1, so\MessageBreak we should be all good now.}} -\def\M@XeTeXLuaTeXError{\PackageError{mathfont} - {!!FATAL ERROR!! : Missing\MessageBreak XeTeX or LuaTeX} +\begingroup +\catcode`\+=\active +\def+{\space} +\def\M@XeTeXLuaTeXError{\GenericError{} + {\MessageBreak\MessageBreak + Package mathfont fatal error: + \MessageBreak\MessageBreak + +*********************\MessageBreak + +*+++++++++++++++++++*\MessageBreak + +*++!!FATAL ERROR!!++*\MessageBreak + +*+++++++++++++++++++*\MessageBreak + +*+++Missing XeTeX+++*\MessageBreak + +*+++++or LuaTeX+++++*\MessageBreak + +*+++++++++++++++++++*\MessageBreak + +*********************\MessageBreak\@gobbletwo} + {See the mathfont package documentation for explanation.} {This package requires either\MessageBreak XeLaTeX or LuaLaTeX. Please\MessageBreak - retypeset this document with\MessageBreak + retypeset your document with\MessageBreak one of those two engines. This\MessageBreak error is fatal, so I'm going\MessageBreak to stop processing once you\MessageBreak @@ -130,6 +153,7 @@ \fi \fi \M@XeTeXLuaTeXError +\endgroup \@ifpackageloaded{fontspec} {\ifnum\csname g__fontspec_math_bool\endcsname=1 \M@NoMathError @@ -149,6 +173,7 @@ \global\Umathchardef#2\mathchar@type#3+#1+\count\z@} \newcount\M@count \M@count\z@ +\newtoks\M@toks \newif\if@upper \newif\if@lower \newif\if@greekupper @@ -174,18 +199,6 @@ \def\@frakshape{roman} \def\@bcalshape{roman} \def\@bfrakshape{roman} -\def\strip@equals#1={#1} -\def\check@suboption#1=#2\@nil{% - \def\@tempa{#1} - \def\@tempb{#2} - \check@option@valid\@tempa - \ifx\@tempb\@empty - \@suboptionpresentfalse - \else - \edef\@tempb{\expandafter\strip@equals\@tempb} - \check@suboption@valid\@tempb - \@suboptionpresenttrue - \fi} \def\check@option@valid#1{% \def\@temperror{\M@InvalidOptionError{#1}} \@for\@j:=upper,lower,greekupper,greeklower,digits,symbols,operator\do{% @@ -205,21 +218,56 @@ \let\@temperror\relax \fi} \@temperror} -\def\gobble@equals#1=#2\@nil{#1} +\def\@gobble@equals#1=#2\@nil{#1} +\def\@gobblesp{\@ifnextchar\@empty\relax\g@bblesp@def} +\def\g@bblesp@def#1 #2\@nil#3{\def#3{#1}} +\def\parse@suboption#1=#2\@nil{% + \@gobblesp#1 \\ \@nil\@tempa + \def\@tempb{\\} + \ifx\@tempa\@tempb + \M@MissingOptionError + \else + \check@option@valid\@tempa + \fi + \def\@tempb{#2} + \ifx\@tempb\@empty + \@suboptionpresentfalse + \else + \@gobblesp#2 \@nil\@tempb + \if\@let@token= + \M@MissingSuboptionError + \else + \edef\@tempb{\expandafter\@gobble@equals\@tempb=\@nil} + \check@suboption@valid\@tempb + \fi + \@suboptionpresenttrue + \fi} \def\mathfont{\@ifnextchar[{\@mathfont} {\@mathfont[upper,lower,greekupper,greeklower,digits,symbols,operator]}} \def\@mathfont[#1]#2{% \ifx\@@set@mathchar\set@mathchar \M@InternalsRestoredError \else + \M@toks{} + \@tempswafalse \expandafter\@newfont\csname M@font\the\M@count\endcsname{}{#2} - \@for\@i:=#1\do{\expandafter\check@suboption\@i=\@nil + \edef\@tempa{#1} + \@for\@i:=\@tempa\do{\expandafter\parse@suboption\@i=\@nil \expandafter\ifx\csname if@\@tempa\expandafter\endcsname \csname iftrue\endcsname \M@CharsSetWarning{\@tempa} \else + \if@tempswa + \expandafter\M@toks\expandafter{\the\M@toks, } + \else + \@tempswatrue + \fi + \edef\@tempc{\the\M@toks\@tempa} + \expandafter\M@toks\expandafter{\@tempc} \if@suboptionpresent \expandafter\edef\csname @\@tempa shape\endcsname{\@tempb} + \edef\@tempc{\the\M@toks\space(\@tempb)} + \expandafter\M@toks\expandafter{\@tempc} \fi \def\@tempb{roman} \expandafter\ifx\csname @\@tempa shape\endcsname\@tempb @@ -238,10 +286,12 @@ \csname @\@tempa true\endcsname \fi} \advance\M@count\@ne\relax - \message{^^J:: mathfont :: math font for character keyword classes^^J#1^^J% - changed to #2^^J^^J} + \message{:: mathfont :: following keyword(s) changed to #2:^^J% + --\the\M@toks.^^J} \fi} \@onlypreamble\mathfont +\def\setfont#1{\mathfont{#1}\setmainfont[Ligatures=TeX]{#1}} +\@onlypreamble\setfont \def\check@csarg#1#2#3{% \ifcat\relax\noexpand#2 \def\@tempa{#2} @@ -267,8 +317,8 @@ \ifmmode \expandafter\@tempa \else - \leavevmode\M@HModeError#1% - \expandafter$\expandafter\@tempa + \M@HModeError#1% + \leavevmode\expandafter$\expandafter\@tempa \fi} \def\process@tokens#1#2{\@tfor\@k:=#1\do{\csname M@#2@\@k\endcsname}} \def\define@bb{% @@ -442,7 +492,7 @@ \edef\M@symbols{M\@symbolsshape\the\M@count} \DeclareMathSymbol{.}{\mathord}{\M@symbols}{"2E} \DeclareMathSymbol{@}{\mathord}{\M@symbols}{"40} - \DeclareMathSymbol{\mathpound}{\mathord}{\M@symbols}{"23} + \DeclareMathSymbol{\mathhash}{\mathord}{\M@symbols}{"23} \DeclareMathSymbol{\mathdollar}{\mathord}{\M@symbols}{"24} \DeclareMathSymbol{\mathpercent}{\mathord}{\M@symbols}{"25} \DeclareMathSymbol{\mathand}{\mathord}{\M@symbols}{"26} @@ -458,6 +508,7 @@ \DeclareMathSymbol{\Delta}{\mathord}{\M@symbols}{"2206} \DeclareMathSymbol{'}{\mathord}{\M@symbols}{"2032} \DeclareMathSymbol{"}{\mathord}{\M@symbols}{"2033} + \DeclareMathSymbol{\comma}{\mathord}{\M@symbols}{"2C} \if@operators \DeclareMathSymbol{\sum}{\mathop}{\M@symbols}{"2211} \DeclareMathSymbol{\prod}{\mathop}{\M@symbols}{"220F} @@ -499,25 +550,10 @@ \DeclareMathSymbol{\colon}{\mathpunct}{\M@symbols}{"3A} \let\mathellipsis\@undefined \DeclareMathSymbol{\mathellipsis}{\mathinner}{\M@symbols}{"2026} - \count@\escapechar - \escapechar\m@ne - \edef\#{\noexpand\protect - \expandafter\noexpand\csname\string\# \endcsname} - \expandafter\def\csname\string\# \endcsname{\ifmmode - \mathpound\else\char"23\fi} - \edef\${\noexpand\protect - \expandafter\noexpand\csname\string\$ \endcsname} - \expandafter\def\csname\string\$ \endcsname{\ifmmode - \mathdollar\else\char"24\fi} - \edef\%{\noexpand\protect - \expandafter\noexpand\csname\string\% \endcsname} - \expandafter\def\csname\string\% \endcsname{\ifmmode - \mathpercent\else\char"25\fi} - \edef\&{\noexpand\protect - \expandafter\noexpand\csname\string\& \endcsname} - \expandafter\def\csname\string\& \endcsname{\ifmmode - \mathand\else\char"26\fi} - \escapechar\count@ + \DeclareRobustCommand\#{\ifmmode\mathhash\else\char"23\fi} + \DeclareRobustCommand\${\ifmmode\mathdollar\else\char"24\fi} + \DeclareRobustCommand\%{\ifmmode\mathpercent\else\char"25\fi} + \DeclareRobustCommand\&{\ifmmode\mathand\else\char"26\fi} \DeclareMathSymbol{\@relbar}{\mathbin}{symbols}{"00} \DeclareMathSymbol{\@Relbar}{\mathrel}{operators}{"3D} \DeclareMathSymbol{\@verticalbar}{\mathord}{symbols}{"6A} @@ -526,8 +562,7 @@ \DeclareRobustCommand\models{\mathrel{\@verticalbar}\joinrel\Relbar}} \def\M@operator@set{% \edef\operator@font{\noexpand\mathgroup - \expandafter\noexpand - \csname symM\@operatorshape\the\M@count\endcsname}} + \expandafter\noexpand\csname symM\@operatorshape\the\M@count\endcsname}} \def\M@bb@set{% \edef\M@bb{M\@bbshape\the\M@count} \DeclareMathSymbol{\M@bb@A}{\mathord}{\M@bb}{"1D538} -- cgit v1.2.3