diff options
author | Karl Berry <karl@freefriends.org> | 2023-02-19 20:58:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-02-19 20:58:53 +0000 |
commit | c666b5ea066ddc000060a8d9235eb60e9974ac9e (patch) | |
tree | 8f436ffd36dc87fd549f4db3513424d63749f2f2 /Master/texmf-dist/tex | |
parent | 9afc56b372db98e63ad4f247cb3f701bb488ae6a (diff) |
mismath (19feb23)
git-svn-id: svn://tug.org/texlive/trunk@65936 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/mismath/mismath.sty | 390 |
1 files changed, 220 insertions, 170 deletions
diff --git a/Master/texmf-dist/tex/latex/mismath/mismath.sty b/Master/texmf-dist/tex/latex/mismath/mismath.sty index ecb8d44fd90..cf2ef7cad52 100644 --- a/Master/texmf-dist/tex/latex/mismath/mismath.sty +++ b/Master/texmf-dist/tex/latex/mismath/mismath.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright (C) 2019-2022 by Antoine Missier <antoine.missier@ac-toulouse.fr> +%% Copyright (C) 2019-2023 by Antoine Missier <antoine.missier@ac-toulouse.fr> %% %% This file may be distributed and/or modified under the conditions of %% the LaTeX Project Public License, either version 1.3 of this license @@ -22,143 +22,195 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{mismath} - [2023/02/10 v2.3 .dtx mismath file] -\RequirePackage{kvoptions} -\DeclareBoolOption[false]{enumber} -\DeclareBoolOption[false]{inumber} -\DeclareBoolOption[false]{jnumber} -\DeclareStringOption{pinumber} -\DeclareBoolOption[true]{arrowvect} -\DeclareComplementaryOption{boldvect}{arrowvect} -\DeclareBoolOption[false]{PEupright} -\DeclareBoolOption[false]{ibrackets} -\DeclareDefaultOption{% - \ifx\CurrentOptionValue\relax - \PackageWarningNoLine{\@currname}{% - Unknown option `\CurrentOption’\MessageBreak - is passed to package `amsmath’}% - % Pass the option to package amsmath. - % Again it is better to expand \CurrentOption. - \expandafter\PassOptionsToPackage - \expandafter{\CurrentOption}{amsmath}% - \else - % Package amsmath does not take options with values. - % We provide the standard LaTeX error. - \@unknownoptionerror - \fi } - -\ProcessKeyvalOptions* - + [2023/02/19 v2.4 .dtx mismath file] +\newif\ifmm@ibrackets % initialized to false +\DeclareOption{ibrackets}{\mm@ibracketstrue} +\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{amsmath}} +\ProcessOptions \relax \@ifpackageloaded{amsmath}{}{\RequirePackage{amsmath}} \@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}} \@ifpackageloaded{esvect}{}{\RequirePackage[b]{esvect}} +\RequirePackage{ifthen} \RequirePackage{xspace} +\RequirePackage{iftex} +\ifmm@ibrackets\RequirePackage{ibrackets}\fi {\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} % \bslash command -\def\mismathset#1{\setkeys{mismath}{#1}} +\newcommand\mm@warning[1]{ + \PackageWarningNoLine{mismath}{ + Command \bslash #1 already exist and will not be redefined} +} +\newcommand\mm@macro[2]{ + \@ifundefined{#1}{ + \expandafter\def\csname #1\endcsname{#2} + }{\\mm@warning{#1}} +} +\newcommand\mm@operator[3][]{% + \ifthenelse{\equal{#1}{}}{\def\tempa{#3}}{\def\tempa{#1}} + \@ifundefined{\tempa}{ + \DeclareMathOperator{#2}{#3} + }{\mm@warning{\tempa}} +} + +\providecommand{\mathup}[1]{{\operatorfont #1}} % also in kpfonts +\mm@macro{e}{\mathup{e}} +\AtBeginDocument{\let\oldi\i \let\oldj\j + \renewcommand{\i}{\TextOrMath{\oldi}{\mathup{i}}} + \renewcommand{\j}{\TextOrMath{\oldj}{\mathup{j}}} } + +\newcount\mm@charcode +\newcount\mm@charclass +\newcount\mm@charslot -\AtBeginDocument{ - \ifmismath@enumber - \DeclareMathSymbol{e}\mathalpha{operators}{`e} \fi - \ifmismath@inumber - \DeclareMathSymbol{i}\mathalpha{operators}{`i}\fi - \ifmismath@jnumber - \DeclareMathSymbol{j}\mathalpha{operators}{`j}\fi - \ifthenelse{\equal{\mismath@pinumber}{}}{}{% else - \@ifundefined{itpi}{\let\itpi\pi}{\@mwarning{itpi}} - \ifthenelse{\equal{\mismath@pinumber}{*}}{ - \RequirePackage[LGR,T1]{fontenc} - \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n} - \DeclareMathSymbol{\pi}\mathalpha{UpGr}{"70} - }{% else - \@ifundefined{\mismath@pinumber}{ - \PackageWarningNoLine{mismath}{% - Value \mismath@pinumber\space must be a valid - command name\MessageBreak for pinumber option, - but command \bslash \mismath@pinumber\space - is undefined.\MessageBreak - Perhaps a missing package} - }{\renewcommand{\pi}{% - \csname\mismath@pinumber\endcsname} - } - }} - \ifmismath@PEupright - \DeclareMathSymbol{P}\mathalpha{operators}{`P} - \DeclareMathSymbol{E}\mathalpha{operators}{`E} \fi - \ifmismath@ibrackets \RequirePackage{ibrackets} \fi +\newcommand\@MathUp[1]{% + \ifluatex + \mm@charclass=\Umathcharclass`#1 + %\mm@charfam=\Umathcharfam`#1 + \mm@charslot=\Umathcharslot`#1 + \Umathcode`#1= \mm@charclass 0 \mm@charslot + \else + \mm@charcode=\mathcode`#1 + % extract charclass + \@tempcnta=\mm@charcode + \divide\@tempcnta by "1000 + \multiply\@tempcnta by "1000 % charclass + \mm@charclass=\@tempcnta + % extract charslot + \@tempcnta=\mm@charcode + \@tempcntb=\mm@charcode + \divide\@tempcnta by "100 + \multiply\@tempcnta by "100 % charclass + charfam + \advance\@tempcntb by -\@tempcnta % charslot + \mm@charslot=\@tempcntb + % construct charcode + \mm@charcode=\mm@charclass + \advance\mm@charcode by \mm@charslot % charfam is now 0 + \mathcode`#1=\mm@charcode + \fi +} - \DisableKeyvalOption[action=warning,package=mismath]{mismath}{enumber} - \DisableKeyvalOption[action=warning,package=mismath]{mismath}{inumber} - \DisableKeyvalOption[action=warning,package=mismath]{mismath}{jnumber} - \DisableKeyvalOption[action=warning,package=mismath]{mismath}{pinumber} - \DisableKeyvalOption[action=warning,package=mismath]{mismath}{PEupright} - \DisableKeyvalOption[action=warning,package=mismath]{mismath}{ibrackets} +\newcommand\MathUp[1]{% + \ifx\@onlypreamble\@notprerr + \@MathUp{#1} + \else % in the preamble + \AtBeginDocument{\@MathUp{#1}} + \fi +} + +\newcommand\MathIt[1]{% + \ifluatex + \mm@charclass=\Umathcharclass`#1 + %\mm@charfam=\Umathcharfam`#1 + \mm@charslot=\Umathcharslot`#1 + \Umathcode`#1= \mm@charclass 1 \mm@charslot + \else + \mm@charcode=\mathcode`#1 + % extract charclass + \@tempcnta=\mm@charcode + \divide\@tempcnta by "1000 + \multiply\@tempcnta by "1000 % charclass + \mm@charclass=\@tempcnta + % extract charslot + \@tempcnta=\mm@charcode + \@tempcntb=\mm@charcode + \divide\@tempcnta by "100 + \multiply\@tempcnta by "100 % charclass + charfam + \advance\@tempcntb by -\@tempcnta % charslot + \mm@charslot=\@tempcntb + % construct charcode + \mm@charcode=\mm@charclass + \advance\mm@charcode by \mm@charslot + \advance\mm@charcode by "100 % sets charfam to 1 + \mathcode`#1=\mm@charcode + \fi +} + +\newcommand*\MathNumbers[1]{% + \in@{e}{#1} \ifin@ \MathUp{e} \fi + \in@{i}{#1} \ifin@ \MathUp{i} \fi + \in@{j}{#1} \ifin@ \MathUp{j} \fi +} + +\newcommand*\MathProba[1]{% + \in@{P}{#1} \ifin@ \MathUp{P} \fi + \in@{E}{#1} \ifin@ \MathUp{E} \fi + \in@{V}{#1} \ifin@ \MathUp{V} \fi +} + +\newcommand*\MathNormal[1]{ + \in@{e}{#1} \ifin@ \MathIt{e} \fi + \in@{i}{#1} \ifin@ \MathIt{i} \fi + \in@{j}{#1} \ifin@ \MathIt{j} \fi + \in@{P}{#1} \ifin@ \MathIt{P} \fi + \in@{E}{#1} \ifin@ \MathIt{E} \fi + \in@{V}{#1} \ifin@ \MathIt{V} \fi } \newcommand{\enumber}{% \PackageWarning{mismath}{Command \string\enumber\space is deprecated, \MessageBreak - use `enumber' as package option instead} - \mismath@enumbertrue + use \bslash MathUp{e} instead} + \MathUp{e} } \newcommand{\inumber}{% \PackageWarning{mismath}{Command \string\inumber\space is deprecated, \MessageBreak - use `inumber' as package option instead} - \mismath@inumbertrue + use \bslash MathUp{i} instead} + \MathUp{i} } \newcommand{\jnumber}{ \PackageWarning{mismath}{Command \string\jnumber\space is deprecated, \MessageBreak - use `jnumber' as package option instead} - \mismath@jnumbertrue -} -\newcommand*{\pinumber}[1][*]{ - \PackageWarning{mismath}{Command \string\pinumber\space - is deprecated, - use `pinumber=#1'\MessageBreak as package option instead} - \def\mismath@pinumber{#1} + use \bslash MathUp{j} instead} + \MathUp{j} } \newcommand{\PEupright}{ \PackageWarning{mismath}{Command \string\PEupright\space is deprecated, \MessageBreak - use `PEupright' as package option instead} - \mismath@PEuprighttrue + use \bslash MathUp{P} and \bslash MathUp{R} instead} + \MathUp{P}\MathUp{E} } -\newcommand\@mwarning[1]{ - \PackageWarningNoLine{mismath}{ - Command \bslash #1 already exist and will not be redefined} -} -\newcommand\@mmacro[2]{ - \@ifundefined{#1}{ - \expandafter\def\csname #1\endcsname{#2} - }{\@mwarning{#1}} -} -\newcommand\@moperator[3][]{% this macro is ugly, by default #1=#3 +\newcommand*\pinumber[1][]{ + \@ifundefined{itpi}{\let\itpi\pi}{} \ifthenelse{\equal{#1}{}}{ - \@ifundefined{#3}{ - \DeclareMathOperator{#2}{#3} - }{\@mwarning{#3}} + \ifx\@onlypreamble\@notprerr + \@ifundefined{savedpi}{ + \PackageWarning{mismath}{% + \bslash pinumber without argument\MessageBreak + must be used in the preamble first\MessageBreak + to load LGR fontenc for upright pi} + }{\let\pi\savedpi} + \else % in the preamble + \RequirePackage[LGR,T1]{fontenc} + \DeclareSymbolFont{UpGr}{LGR}{lmr}{m}{n} + \DeclareMathSymbol{\pi}\mathalpha{UpGr}{"70} + \let\savedpi\pi + \fi }{ \@ifundefined{#1}{ - \DeclareMathOperator{#2}{#3} - }{\@mwarning{#1}} + \PackageWarning{mismath}{% + Value #1 must be a valid + command name\MessageBreak for pinumber, + but command \bslash #1\space + is undefined.\MessageBreak + Perhaps a missing package} + }{\renewcommand{\pi}{% + \csname #1\endcsname} + } } } -\providecommand{\mathup}[1]{{\operatorfont #1}} % also in kpfonts -\@mmacro{e}{\mathup{e}} -\AtBeginDocument{\let\oldi\i \let\oldj\j - \renewcommand{\i}{\TextOrMath{\oldi}{\mathup{i}}} - \renewcommand{\j}{\TextOrMath{\oldj}{\mathup{j}}} } +\newcommand{\pinormal}{\@ifundefined{itpi}{}{\let\pi\itpi}} -\newcommand{\arrowvect}{\mismath@arrowvecttrue} -\newcommand{\boldvect}{\mismath@arrowvectfalse} +\newboolean{arrowvect} +\setboolean{arrowvect}{true} +\newcommand{\arrowvect}{\setboolean{arrowvect}{true}} +\newcommand{\boldvect}{\setboolean{arrowvect}{false}} \newcommand{\boldvectcommand}{\boldsymbol} % from amsbsy package -\@mmacro{vect}{\ifthenelse{\boolean{mismath@arrowvect}}{ - \vv}{\boldvectcommand}} %\if \fi doesn't work well here +\mm@macro{vect}{\ifthenelse{\boolean{arrowvect}}{ + \vv}{\boldvectcommand}} % doesn't work well with \if... \fi \newcommand*{\hvect}[1]{\vect{\vphantom{t}#1}} \newcommand*{\hvec}[1]{\vec{\vphantom{t}#1}} @@ -174,101 +226,99 @@ \@ifundefined{norm}{\providecommand*{\norm}[1]{ \mathchoice{\@norm{#1}}{\@norm{#1}}{\@@norm{#1}}{\@@@norm{#1}} } - }{\@mwarning{norm} } % bad result with libertinust1math + }{\mm@warning{norm} } % bad result with libertinust1math -\@mmacro{di}{\mathop{}\!\mathup{d}} +\mm@macro{di}{\mathop{}\!\mathup{d}} \newcommand\probastyle{} \let\Par\P % end of paragraph symbol \renewcommand{\P}{\operatorname{\probastyle{P}}} -\@mmacro{E}{\operatorname{\probastyle{E}}} -\@mmacro{V}{\operatorname{\probastyle{V}}} +\mm@macro{E}{\operatorname{\probastyle{E}}} +\mm@macro{V}{\operatorname{\probastyle{V}}} -\@moperator{\adj}{adj} -\@moperator{\Aut}{Aut} -\@moperator{\codim}{codim} -\@moperator{\Conv}{Conv} -\@moperator{\cov}{cov} -\@moperator{\Cov}{Cov} -\@mmacro{curl}{\operatorname{\vect{\mathup{curl}}}} -\@moperator[divg]{\divg}{div} -\@moperator{\End}{End} +\mm@operator{\adj}{adj} +\mm@operator{\Aut}{Aut} +\mm@operator{\codim}{codim} +\mm@operator{\Conv}{Conv} +\mm@operator{\cov}{cov} +\mm@operator{\Cov}{Cov} +\mm@macro{curl}{\operatorname{\vect{\mathup{curl}}}} +\mm@operator[divg]{\divg}{div} +\mm@operator{\End}{End} -\@moperator{\erf}{erf} -\@mmacro{grad}{\operatorname{\vect{\mathup{grad}}}} -\@moperator{\id}{id} % mathop or mathord ? -\@moperator{\Id}{Id} -\@moperator{\im}{im} +\mm@operator{\erf}{erf} +\mm@macro{grad}{\operatorname{\vect{\mathup{grad}}}} +\mm@operator{\id}{id} % mathop or mathord ? +\mm@operator{\Id}{Id} +\mm@operator{\im}{im} \let\oldIm\Im \renewcommand{\Im}{\operatorname{Im}} -\@moperator{\lb}{lb} -\@moperator{\lcm}{lcm} +\mm@operator{\lb}{lb} +\mm@operator{\lcm}{lcm} -\@moperator{\rank}{rank} +\mm@operator{\rank}{rank} \let\oldRe\Re \renewcommand{\Re}{\operatorname{Re}} -\@mmacro{rot}{\operatorname{\vect{\mathup{rot}}}} -\@moperator{\sgn}{sgn} -\@moperator{\sinc}{sinc} -\@moperator[spa]{\spa}{span} -\@moperator{\tr}{tr} -\@moperator{\var}{var} -\@moperator{\Var}{Var} -\@moperator[Zu]{\Zu}{Z} +\mm@macro{rot}{\operatorname{\vect{\mathup{rot}}}} +\mm@operator{\sgn}{sgn} +\mm@operator{\sinc}{sinc} +\mm@operator[spa]{\spa}{span} +\mm@operator{\tr}{tr} +\mm@operator{\var}{var} +\mm@operator{\Var}{Var} +\mm@operator[Zu]{\Zu}{Z} -\@moperator{\arccot}{arccot} -\@moperator{\sech}{sech} -\@moperator{\csch}{csch} -\@moperator{\arsinh}{arsinh} -\@moperator{\arcosh}{arcosh} -\@moperator{\artanh}{artanh} -\@moperator{\arcoth}{arcoth} -\@moperator{\arsech}{arsech} -\@moperator{\arcsch}{arcsch} +\mm@operator{\arccot}{arccot} +\mm@operator{\sech}{sech} +\mm@operator{\csch}{csch} +\mm@operator{\arsinh}{arsinh} +\mm@operator{\arcosh}{arcosh} +\mm@operator{\artanh}{artanh} +\mm@operator{\arcoth}{arcoth} +\mm@operator{\arsech}{arsech} +\mm@operator{\arcsch}{arcsch} -\@moperator[bigO]{\bigO}{\mathcal{O}} -\@moperator[bigo]{\bigo}{O} -\@moperator[lito]{\lito}{o} +\mm@operator[bigO]{\bigO}{\mathcal{O}} +\mm@operator[bigo]{\bigo}{O} +\mm@operator[lito]{\lito}{o} -\@mmacro{mathset}{\mathbf} -\@mmacro{R}{\ensuremath{\mathset{R}}\xspace} -\@mmacro{C}{\ensuremath{\mathset{C}}\xspace} -\@mmacro{N}{\ensuremath{\mathset{N}}\xspace} -\@mmacro{Z}{\ensuremath{\mathset{Z}}\xspace} -\@mmacro{Q}{\ensuremath{\mathset{Q}}\xspace} -\@mmacro{F}{\ensuremath{\mathset{F}}\xspace} -\@mmacro{K}{\ensuremath{\mathset{K}}\xspace} +\mm@macro{mathset}{\mathbf} +\mm@macro{R}{\ensuremath{\mathset{R}}\xspace} +\mm@macro{C}{\ensuremath{\mathset{C}}\xspace} +\mm@macro{N}{\ensuremath{\mathset{N}}\xspace} +\mm@macro{Z}{\ensuremath{\mathset{Z}}\xspace} +\mm@macro{Q}{\ensuremath{\mathset{Q}}\xspace} +\mm@macro{F}{\ensuremath{\mathset{F}}\xspace} +\mm@macro{K}{\ensuremath{\mathset{K}}\xspace} -\@mmacro{ds}{\displaystyle} -\@mmacro{dlim}{\lim\limits} -\@mmacro{dsum}{\sum\limits} -\@mmacro{dprod}{\prod\limits} -\@mmacro{dcup}{\bigcup\limits} -\@mmacro{dcap}{\bigcap\limits} +\mm@macro{ds}{\displaystyle} +\mm@macro{dlim}{\lim\limits} +\mm@macro{dsum}{\sum\limits} +\mm@macro{dprod}{\prod\limits} +\mm@macro{dcup}{\bigcup\limits} +\mm@macro{dcap}{\bigcap\limits} -\@mmacro{lbar}{\overline} +\mm@macro{lbar}{\overline} \@ifundefined{hlbar}{ \providecommand*{\hlbar}[1]{\overline{\vphantom{t}#1}}}{ - \@mwarning{hlbar} } + \mm@warning{hlbar} } \newcommand\@eqdef{\stackrel{\mathup{def}}{=}} \newcommand\@@eqdef{\stackrel{\Delta}{=}} -\@mmacro{eqdef}{\@ifstar{\@@eqdef}{\@eqdef}} -\@mmacro{unbr}{\underbrace} -\@mmacro{iif}{if and only if\xspace} +\mm@macro{eqdef}{\@ifstar{\@@eqdef}{\@eqdef}} +\mm@macro{unbr}{\underbrace} +\mm@macro{iif}{if and only if\xspace} -\@mmacro{then}{\ \Longrightarrow \ \mbox{} } +\mm@macro{then}{\ \Longrightarrow \ \mbox{} } \@ifundefined{txt}{ \providecommand*{\txt}[1]{\quad\text{#1}\quad} }{ - \@mwarning{txt} } -\@mmacro{mul}{\mathord{\times}} -\providecommand\paren{\PackageWarning{mismath}{Command - \bslash paren is no longer supported}} + \mm@warning{txt} } +\mm@macro{mul}{\mathord{\times}} \@ifundefined{pow}{ \providecommand*{\pow}[2]{\left( #1 \right)^{\!#2}} }{ - \@mwarning{pow} } + \mm@warning{pow} } \@ifundefined{abs}{ \providecommand*{\abs}[1]{\left\vert#1\right\vert} }{ - \@mwarning{abs} } + \mm@warning{abs} } \@ifundefined{lfrac}{ \providecommand*{\lfrac}[2]{\frac{\;#1\;}{\;#2\;}} }{ - \@mwarning{lfrac} } + \mm@warning{lfrac} } \newcommand{\systemstretch}{1.2} \newcommand{\systemsep}{\medspace} |