\NeedsTeXFormat{LaTeX2e}[2022/06/01]
\def\fileversion{0.70}
\def\filedate{2025-10-28}
\ProvidesPackage{euler-math}[\filedate\space\fileversion]

% Ensure luatex or xetex engine
\RequirePackage{iftex}[2019/10/24]
\RequireTUTeX
\RequirePackage[math-style=upright]{unicode-math}

\newopentypefeature{Style}{smaller}{+ss05}
\newopentypefeature{Style}{subsetneq}{+ss06}

\newtoks\NEUtoks
\newcommand*{\NEstore@KV@Option}[2]{%
  \NEUtoks=\expandafter{\the\NEUtoks #1={#2},}}

% Package options:
\DeclareKeys
  {
   CharacterVariant.code = \NEstore@KV@Option{CharacterVariant}{#1} ,
   StylisticSet.code     = \NEstore@KV@Option{StylisticSet}{#1}     ,
   Style.code            = \NEstore@KV@Option{Style}{#1}            ,
   Scale.code            = \NEstore@KV@Option{Scale}{#1}            ,
   Numbers.code          = \NEstore@KV@Option{Numbers}{#1}
  }
\ProcessKeyOptions

% Following Joseph Wright in https://tex.stackexchange.com/questions/451
\begingroup
  \edef\temp{%
    \endgroup
    \noexpand\setmathfont{Euler-Math.otf}%
    [\unexpanded\expandafter{\the\NEUtoks}]%
  }
  \temp

\AtBeginDocument{%
  % Euler specific math
  % \Umathchardef\<cmd> = <math type> <family> <slot>
  % <math type> : \mathord=0 \mathrel=3 ; <family>=0
  \Umathchardef\hbar =                0 0 "0127 \relax
  \Umathchardef\varemptyset =         0 0 "E021 \relax
  \Umathchardef\mbfwp =               0 0 "E045 \relax
  \Umathchardef\mbfdotlessi =         0 0 "E046 \relax
  \Umathchardef\mbfdotlessj =         0 0 "E047 \relax
  \Umathchardef\mbfhbar =             0 0 "E048 \relax
  \Umathchardef\mapstochar =          3 0 "E08D \relax
  \Umathchardef\lhook =               3 0 "E08E \relax
  \Umathchardef\rhook =               3 0 "E08F \relax
  \let\lesseqslantgtr\lesseqgtr
  \let\gtreqslantless\gtreqless
  \let\lesseqqslantgtr\lesseqqgtr
  \let\gtreqqslantless\gtreqqless
  \let\nleqqslant\nleqq
  \let\ngeqqslant\ngeqq
% \widearc and\overrightarc
  \providecommand*{\widearc}{\Umathaccent 0 0 "E540 }%
  \providecommand*{\overrightarc}{\Umathaccent 0 0 "20D5 }%
  % Greek sans-serif glyphs in Private Area (temporary fix)
  \Umathchardef\msansAlpha =          0 0 "E741 \relax
  \Umathchardef\msansBeta =           0 0 "E742 \relax
  \Umathchardef\msansGamma =          0 0 "E743 \relax
  \Umathchardef\msansDelta =          0 0 "E744 \relax
  \Umathchardef\msansEpsilon =        0 0 "E745 \relax
  \Umathchardef\msansZeta =           0 0 "E746 \relax
  \Umathchardef\msansEta =            0 0 "E747 \relax
  \Umathchardef\msansTheta =          0 0 "E748 \relax
  \Umathchardef\msansIota =           0 0 "E749 \relax
  \Umathchardef\msansKappa =          0 0 "E74A \relax
  \Umathchardef\msansLambda =         0 0 "E74B \relax
  \Umathchardef\msansMu =             0 0 "E74C \relax
  \Umathchardef\msansNu =             0 0 "E74D \relax
  \Umathchardef\msansXi =             0 0 "E74E \relax
  \Umathchardef\msansOmicron =        0 0 "E74F \relax
  \Umathchardef\msansPi =             0 0 "E750 \relax
  \Umathchardef\msansRho =            0 0 "E751 \relax
  \Umathchardef\msansvarTheta =       0 0 "E752 \relax
  \Umathchardef\msansSigma =          0 0 "E753 \relax
  \Umathchardef\msansTau =            0 0 "E754 \relax
  \Umathchardef\msansUpsilon =        0 0 "E755 \relax
  \Umathchardef\msansPhi =            0 0 "E756 \relax
  \Umathchardef\msansChi =            0 0 "E757 \relax
  \Umathchardef\msansPsi =            0 0 "E758 \relax
  \Umathchardef\msansOmega =          0 0 "E759 \relax
  \Umathchardef\msansnabla =          0 0 "E75A \relax
  \Umathchardef\msansalpha =          0 0 "E761 \relax
  \Umathchardef\msansbeta  =          0 0 "E762 \relax
  \Umathchardef\msansgamma =          0 0 "E763 \relax
  \Umathchardef\msansdelta =          0 0 "E764 \relax
  \Umathchardef\msansvarepsilon =     0 0 "E765 \relax
  \Umathchardef\msanszeta =           0 0 "E766 \relax
  \Umathchardef\msanseta =            0 0 "E767 \relax
  \Umathchardef\msanstheta =          0 0 "E768 \relax
  \Umathchardef\msansiota =           0 0 "E769 \relax
  \Umathchardef\msanskappa =          0 0 "E76A \relax
  \Umathchardef\msanslambda =         0 0 "E76B \relax
  \Umathchardef\msansmu =             0 0 "E76C \relax
  \Umathchardef\msansnu =             0 0 "E76D \relax
  \Umathchardef\msansxi =             0 0 "E76E \relax
  \Umathchardef\msansomicron =        0 0 "E76F \relax
  \Umathchardef\msanspi =             0 0 "E770 \relax
  \Umathchardef\msansrho =            0 0 "E771 \relax
  \Umathchardef\msansvarsigma =       0 0 "E772 \relax
  \Umathchardef\msanssigma =          0 0 "E773 \relax
  \Umathchardef\msanstau =            0 0 "E774 \relax
  \Umathchardef\msansupsilon =        0 0 "E775 \relax
  \Umathchardef\msansphi =            0 0 "E776 \relax
  \Umathchardef\msanschi =            0 0 "E777 \relax
  \Umathchardef\msanspsi =            0 0 "E778 \relax
  \Umathchardef\msansomega =          0 0 "E779 \relax
  \Umathchardef\msanspartial =        0 0 "E77A \relax
  \Umathchardef\msansepsilon =        0 0 "E77B \relax
% \Umathchardef\msansvartheta =       0 0 "E77C \relax
% \Umathchardef\msansvarkappa =       0 0 "E77D \relax
  \Umathchardef\msansvarphi =         0 0 "E77E \relax
% \Umathchardef\msansvarrho =         0 0 "E77F \relax
% \Umathchardef\msansvarpi =          0 0 "E780 \relax
  % amssymb
  \@ifpackageloaded{amssymb}%
    {\PackageWarning{euler-math}{%
       Euler-Math provides all AMS symbols.\MessageBreak
       Loading amssymb.sty is not advisable.\MessageBreak
       Reported}%
    }%
    {% AMS Symbols not referenced in unicode-math-table.tex
     % \Umathchardef\<cmd> = <math type> <family> <slot>
     % <math type> : \mathord=0 \mathrel=3 ; <family>=0
     \Umathchardef\circledR =       0 0 "24C7 \relax
     \Umathchardef\circledS =       0 0 "24C8 \relax
     \Umathchardef\diagup =         0 0 "27CB \relax
     \Umathchardef\diagdown =       0 0 "27CD \relax
     \Umathchardef\shortmid =       3 0 "E0A2 \relax
     \Umathchardef\shortparallel =  3 0 "E0A3 \relax
     \Umathchardef\nshortmid =      3 0 "E0A4 \relax
     \Umathchardef\nshortparallel = 3 0 "E0A5 \relax
     \Umathchardef\lvertneqq =      3 0 "E0A6 \relax
     \Umathchardef\gvertneqq =      3 0 "E0A7 \relax
     \Umathchardef\nleqslant =      3 0 "E0A8 \relax
     \Umathchardef\ngeqslant =      3 0 "E0A9 \relax
     \Umathchardef\nleqq =          3 0 "E0AA \relax
     \Umathchardef\ngeqq =          3 0 "E0AB \relax
     \Umathchardef\varsubsetneq =   3 0 "E0AC \relax
     \Umathchardef\varsupsetneq =   3 0 "E0AD \relax
     \Umathchardef\nsubseteqq =     3 0 "E0AE \relax
     \Umathchardef\nsupseteqq =     3 0 "E0AF \relax
     \Umathchardef\varsubsetneqq =  3 0 "E09C \relax
     \Umathchardef\varsupsetneqq =  3 0 "E09D \relax
     \Umathchardef\npreceq =        3 0 "E09E \relax
     \Umathchardef\nsucceq =        3 0 "E09F \relax
     \let\centerdot\cdotp
     \let\restriction\upharpoonright
     \let\doteqdot\Doteq
     \let\doublecup\Cup
     \let\doublecap\Cap
     \let\llless\lll
     \let\gggtr\ggg
     \let\circlearrowleft\acwopencirclearrow
     \let\circlearrowright\cwopencirclearrow
     \let\lozenge\mdlgwhtlozenge
     \let\blacklozenge\mdlgblklozenge
     \let\square\mdlgwhtsquare
     \let\blacksquare\mdlgblksquare
     \let\dashleftarrow\leftdasharrow
     \let\dashrightarrow\rightdasharrow
     \let\ntriangleleft\nvartriangleleft
     \let\ntriangleright\nvartriangleright
     \let\varpropto\propto
     \let\thicksim\sim
     \let\thickapprox\approx
     \let\smallsmile\smile
     \let\smallfrown\frown
    }%
  % latexsym
  \@ifpackageloaded{latexsym}%
    {\PackageWarning{euler-math}{%
       Euler-Math provides all LaTeX symbols.\MessageBreak
       Loading latexsym.sty is not advisable.\MessageBreak
       Reported}%
    }%
    {\let\lhd\vartriangleleft
     \let\rhd\vartriangleright
     \let\unlhd\trianglelefteq
     \let\unrhd\trianglerighteq
     \let\leadsto\rightcurvedarrow
     \let\Box\lgwhtsquare
     \let\Diamond\mdlgwhtdiamond
    }%
}

\endinput
