diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/mismath/mismath.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/mismath/mismath.sty | 107 |
1 files changed, 78 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/latex/mismath/mismath.sty b/Master/texmf-dist/tex/latex/mismath/mismath.sty index 9e7bd0726b1..7def34be729 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-2023 by Antoine Missier <antoine.missier@ac-toulouse.fr> +%% Copyright (C) 2019-2024 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,7 +22,7 @@ %% \NeedsTeXFormat{LaTeX2e}[2005/12/01] \ProvidesPackage{mismath} - [2023/12/19 v2.9 .dtx mismath file] + [2024/02/20 v2.10 .dtx Miscellaneous mathematical macros] \newif\ifmm@ibrackets % initialized to false \newif\ifmm@decimalcomma \DeclareOption{ibrackets}{\mm@ibracketstrue} @@ -33,11 +33,24 @@ \@ifpackageloaded{mathtools}{}{\RequirePackage{mathtools}} \@ifpackageloaded{esvect}{}{\RequirePackage[b]{esvect}} \RequirePackage{ifthen} -\RequirePackage{xparse} % for \NewDocumentCommand +\RequirePackage{xparse} % provides \NewDocumentCommand \RequirePackage{xspace} \RequirePackage{iftex} -\ifmm@ibrackets\RequirePackage{ibrackets}\fi -\ifmm@decimalcomma\RequirePackage{decimalcomma}\fi +\RequirePackage{etoolbox} % provides \AtEndPreamble + +\newif\ifmm@unicodemath +\newif\ifmm@multicol +\AtEndPreamble{% necessary to work with unicode-math + \@ifpackageloaded{multicol}{\mm@multicoltrue}{\mm@multicolfalse} + \@ifpackageloaded{unicode-math}{\mm@unicodemathtrue}{ + \mm@unicodemathfalse + \DeclareMathAlphabet{\mathbfsfit}{\encodingdefault}% + {\sfdefault}{bx}{it}} + \AtBeginDocument{% necessary to work with unicode-math + \ifmm@ibrackets\RequirePackage{ibrackets}\fi + \ifmm@decimalcomma\RequirePackage{decimalcomma}\fi + } +} {\catcode`\|=\z@ \catcode`\\=12 |gdef|bslash{\}} % \bslash command @@ -56,7 +69,9 @@ }{\mm@warning{#1}} } -\providecommand{\mathup}[1]{{\operatorfont #1}} % also in kpfonts +\@ifundefined{mathup}{ + \providecommand*{\mathup}[1]{{\operatorfont #1}} + }{\mm@warning{mathup} } % also in kpfonts (and unicode-math) \mm@macro{e}{\mathup{e}} \AtBeginDocument{\let\oldi\i \let\oldj\j \renewcommand{\i}{\TextOrMath{\oldi}{\mathup{i}}} @@ -67,7 +82,7 @@ \newcount\mm@charfam \newcount\mm@charslot -\newcommand*\math@family[2]{% +\newcommand*\MathFamily[2]{% \mm@charfam=#2 \ifluatex \mm@charclass=\Umathcharclass`#1 @@ -97,16 +112,41 @@ \fi } -\newcommand*\MathFamily[2]{% - \ifx\@onlypreamble\@notprerr - \math@family{#1}{#2} - \else % before \begin{document} - \AtBeginDocument{\math@family{#1}{#2}} +\newcommand*\MathUp[1]{% + \ifx\@onlypreamble\@notprerr % not in preamble + \ifmm@unicodemath + \DeclareMathSymbol{#1}{\mathalpha}{operators}{`#1} + \else + \MathFamily{#1}{0} + \fi + \else % in preamble + \AtBeginDocument{ + \ifmm@unicodemath + \DeclareMathSymbol{#1}{\mathalpha}{operators}{`#1} + \else + \MathFamily{#1}{0} + \fi + } \fi } -\newcommand*\MathUp[1]{\MathFamily{#1}{0}} -\newcommand*\MathIt[1]{\MathFamily{#1}{1}} +\newcommand*\MathIt[1]{% + \ifx\@onlypreamble\@notprerr % not in preamble + \ifmm@unicodemath + \DeclareMathSymbol{#1}{\mathalpha}{letters}{`#1} + \else + \MathFamily{#1}{1} + \fi + \else % in preamble + \AtBeginDocument{ + \ifmm@unicodemath + \DeclareMathSymbol{#1}{\mathalpha}{letters}{`#1} + \else + \MathFamily{#1}{1} + \fi + } + \fi +} \newcommand*\MathNumbers[1]{% \in@{e}{#1} \ifin@ \MathUp{e} \fi @@ -132,36 +172,41 @@ \newcommand{\enumber}{% \PackageWarning{mismath}{Old command \string\enumber\space is used. \MessageBreak - It can be replaced by \bslash MathUp{e}} + It can be replaced by \string\MathUp{e}} \MathUp{e} } \newcommand{\inumber}{% \PackageWarning{mismath}{Old command \string\inumber\space is used. \MessageBreak - It can be replaced by \bslash MathUp{i}} + It can be replaced by \string\MathUp{i}} \MathUp{i} } \newcommand{\jnumber}{ \PackageWarning{mismath}{Old command \string\jnumber\space is used. \MessageBreak - It can be replaced by \bslash MathUp{j}} + It can be replaced by \string\MathUp{j}} \MathUp{j} } \newcommand{\PEupright}{ \PackageWarning{mismath}{Old command \string\PEupright\space is used. \MessageBreak - It can be replaced by \bslash MathUp{P} - and \bslash MathUp{E}} + It can be replaced by \string\MathUp{P}\space + and \string\MathUp{E}} \MathUp{P}\MathUp{E} } \newcommand*\pinumber[1][]{ + \ifmm@unicodemath + \PackageError{mismath}{Command \string\pinumber\space + is incompatible with unicode-math. \MessageBreak + Use \string\uppi\space to get the upright pi}{} + \fi \@ifundefined{itpi}{\let\itpi\pi}{} \ifthenelse{\equal{#1}{}}{ - \ifx\@onlypreamble\@notprerr + \ifx\@onlypreamble\@notprerr % not in preamble \@ifundefined{savedpi}{ \PackageWarning{mismath}{% - \bslash pinumber without argument\MessageBreak + \string\pinumber\space without argument\MessageBreak must be used in the preamble first\MessageBreak to load LGR fontenc for upright pi} }{\let\pi\savedpi} @@ -175,9 +220,8 @@ }{ \@ifundefined{#1}{ \PackageWarning{mismath}{% - Value #1 must be a valid - command name\MessageBreak for pinumber, - but command \bslash #1\space + #1 must be a valid command name\MessageBreak + for pinumber, but command \bslash #1 is undefined.\MessageBreak Perhaps a missing package} }{\renewcommand{\pi}{% @@ -208,11 +252,10 @@ \mbox{\tiny\raisebox{1pt}{$\Vert$}} #1 \mbox{\tiny\raisebox{1pt}{$\Vert$}} } \@ifundefined{norm}{\providecommand*{\norm}[1]{ - \mathchoice{\@norm{#1}}{\@norm{#1}}{\@@norm{#1}}{\@@@norm{#1}} - } - }{\mm@warning{norm} } % bad result with libertinust1math + \mathchoice{\@norm{#1}}{\@norm{#1}}{\@@norm{#1}}{\@@@norm{#1}} + } +}{\mm@warning{norm}} % bad result with libertinust1math -\DeclareMathAlphabet{\mathbfsfit}{\encodingdefault}{\sfdefault}{bx}{it} \newcommand{\tensor}{\mathbfsfit} % isomath uses \mathsfbfit \mm@macro{di}{\mathop{}\!\mathup{d}} @@ -234,7 +277,7 @@ \mm@operator{\erf}{erf} \mm@macro{grad}{\operatorname{\vect{\mathup{grad}}}} -\mm@operator{\id}{id} % mathop or mathord ? +\mm@operator{\id}{id} % mathop or mathord? \mm@operator{\Id}{Id} \mm@operator{\im}{im} \let\oldIm\Im \renewcommand{\Im}{\operatorname{Im}} @@ -322,10 +365,16 @@ }{\end{smallmatrix}\right)} \newenvironment{mathcols}{% needs multicol package + \ifmm@multicol \renewcommand{\columnseprule}{0.1pt} \begin{multicols}{2} \par\noindent\hfill \begin{math}\begin{aligned}\displaystyle + \else + \PackageError{mismath}{The mathcols environment + needs the multicol package}{Add the package multicol + to your preamble.} + \fi }{% \end{aligned}\end{math} \hfill\mbox{} \end{multicols} |