\NeedsTeXFormat{LaTeX2e}[2022/06/01]
\def\fileversion{0.61}
\def\filedate{2026-03-22}
\ProvidesPackage{lete-sans-math}[\filedate\space\fileversion]

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

\newopentypefeature{Style}{mathcal}{+ss01}
\newopentypefeature{Style}{leqslant}{+ss04}
\newopentypefeature{Style}{smaller}{+ss05}
\newopentypefeature{Style}{subsetneq}{+ss06}
\newopentypefeature{Style}{parallelslant}{+ss07}
\newopentypefeature{Style}{upint}{+ss08}
\newopentypefeature{Style}{vertneg}{+ss09}

\newtoks\LeteMtoks
\newtoks\LeteScale
\newcommand*{\Letestore@KV@Option}[2]{%
  \LeteMtoks=\expandafter{\the\LeteMtoks #1={#2},}
  \def\Lete@opt{#1}%
  \def\Lete@scale{Scale}%
  \ifx\Lete@opt\Lete@scale
    \LeteScale=\expandafter{Scale={#2}}%
  \fi
}

% Package options:
\DeclareKeys
  {
   tight.if              = Lete@tight                                 ,
   loose.code            = \Lete@tightfalse                           ,
   fulloldstyle.code     = \Letestore@KV@Option{Numbers}{OldStyle}    ,
   math-style.code       = \Letestore@KV@Option{math-style}{#1}       ,
   bold-style.code       = \Letestore@KV@Option{bold-style}{#1}       ,
   nabla.code            = \Letestore@KV@Option{nabla}{#1}            ,
   partial.code          = \Letestore@KV@Option{partial}{#1}          ,
   CharacterVariant.code = \Letestore@KV@Option{CharacterVariant}{#1} ,
   StylisticSet.code     = \Letestore@KV@Option{StylisticSet}{#1}     ,
   Style.code            = \Letestore@KV@Option{Style}{#1}            ,
   Scale.code            = \Letestore@KV@Option{Scale}{#1}            ,
   textrm.if             = Lete@textrm                                ,
   textit.if             = Lete@textit                                ,
   textbf.if             = Lete@textbf                                ,
   textsf.if             = Lete@textsf
  }
%
\ProcessKeyOptions
%
% Math fonts: LeteSansMath.otf, LeteSansMath-Bold.otf.
% Following Joseph Wright in https://tex.stackexchange.com/questions/451
\Letestore@KV@Option{BoldFont}{LeteSansMath-Bold.otf}
\begingroup
  \edef\temp{%
    \endgroup
    \noexpand\setmathfont{LeteSansMath.otf}%
    [\unexpanded\expandafter{\the\LeteMtoks}]%
  }
  \temp
% For Maths operators in case Lato isn't the main text font.
\begingroup
  \edef\temp{%
    \endgroup
    \ifLete@textrm\else
      \noexpand\setmathfontface\noexpand\mathrm{Lato-Regular.ttf}%
        [\unexpanded\expandafter{\the\LeteScale}]%
    \fi
    \ifLete@textit\else
      \noexpand\setmathfontface\noexpand\mathit{Lato-Italic.ttf}%
        [\unexpanded\expandafter{\the\LeteScale}]%
    \fi
    \ifLete@textbf\else
      \noexpand\setmathfontface\noexpand\mathbf{Lato-Bold.ttf}%
        [\unexpanded\expandafter{\the\LeteScale}]%
    \fi
    \ifLete@textsf\else
      \noexpand\setmathfontface\noexpand\mathsf{Lato-Regular.ttf}%
        [\unexpanded\expandafter{\the\LeteScale}]%
    \fi
  }
  \temp
%
\ifLete@tight
  \thinmuskip=2mu
  \medmuskip=2.5mu plus 1mu minus 2.5mu
  \thickmuskip=3.5mu plus 2.5mu
\fi

\AtBeginDocument{%
  % LeteSansMath specific
  % \Umathchardef\<cmd> = <math type> <family> <slot>
  % <math type> : \mathord=0 \mathrel=3 ; <family>=0
  \Umathchardef\lesssimslant =         3 0 "E004 \relax
  \Umathchardef\gtrsimslant =          3 0 "E005 \relax
  \Umathchardef\simslantless =         3 0 "E011 \relax
  \Umathchardef\simslantgtr =          3 0 "E012 \relax
  \Umathchardef\lesseqslantgtr =       3 0 "E00D \relax
  \Umathchardef\gtreqslantless =       3 0 "E00E \relax
  \Umathchardef\lesseqqslantgtr =      3 0 "E017 \relax
  \Umathchardef\gtreqqslantless =      3 0 "E018 \relax
  \Umathchardef\smteslant =            3 0 "E013 \relax
  \Umathchardef\lateslant =            3 0 "E014 \relax
  \Umathchardef\vertnotin =            3 0 "E020 \relax
  \Umathchardef\vertnni =              3 0 "E021 \relax
  \Umathchardef\vertnsim =             3 0 "E022 \relax
  \Umathchardef\vertnsimeq =           3 0 "E023 \relax
  \Umathchardef\vertncong =            3 0 "E024 \relax
  \Umathchardef\vertne =               3 0 "E025 \relax
  \Umathchardef\vertnequiv =           3 0 "E026 \relax
  \Umathchardef\vertnasymp =           3 0 "E029 \relax
  \Umathchardef\vertnless =            3 0 "E02A \relax
  \Umathchardef\vertngtr =             3 0 "E02B \relax
  \Umathchardef\vertnleq =             3 0 "E02C \relax
  \Umathchardef\vertngeq =             3 0 "E02D \relax
  \Umathchardef\vertnlesssim =         3 0 "E02E \relax
  \Umathchardef\vertngtrsim =          3 0 "E02F \relax
  \Umathchardef\vertnlessgtr =         3 0 "E030 \relax
  \Umathchardef\vertngtrless =         3 0 "E031 \relax
  \Umathchardef\vertnprec  =           3 0 "E032 \relax
  \Umathchardef\vertnsucc =            3 0 "E033\relax
  \Umathchardef\vertnsubset =          3 0 "E034 \relax
  \Umathchardef\vertnsupset =          3 0 "E035 \relax
  \Umathchardef\vertnsubseteq =        3 0 "E036\relax
  \Umathchardef\vertnsupseteq =        3 0 "E037 \relax
  \Umathchardef\vertnpreccurlyeq =     3 0 "E038 \relax
  \Umathchardef\vertnsucccurlyeq =     3 0 "E039\relax
  \Umathchardef\vertntrianglelefteq =  3 0 "E03A \relax
  \Umathchardef\vertntrianglerighteq = 3 0 "E03B \relax
  \Umathchardef\mbfimath =             0 0 "E041 \relax
  \Umathchardef\mbfjmath =             0 0 "E042 \relax
  \Umathchardef\mbfdotlessi =          0 0 "E043 \relax
  \Umathchardef\mbfdotlessj =          0 0 "E044 \relax
  \Umathchardef\mithbar =              0 0 "E048 \relax
  \Umathchardef\mupvarg =              0 0 "E04B \relax
  \Umathchardef\mbfvarg =              0 0 "E04C \relax
  \Umathchardef\mitvarg =              0 0 "E04D \relax
  \Umathchardef\mbfitvarg =            0 0 "E04E \relax
  \Umathchardef\varemptyset =          0 0 "E04F \relax
  \Umathchardef\BbbDelta =             0 0 "E050 \relax
  \Umathchardef\BbbTheta =             0 0 "E051 \relax
  \Umathchardef\BbbLambda =            0 0 "E052 \relax
  \Umathchardef\BbbXi =                0 0 "E053 \relax
  \Umathchardef\BbbSigma =             0 0 "E054 \relax
  \Umathchardef\BbbPhi =               0 0 "E055 \relax
  \Umathchardef\BbbPsi =               0 0 "E056 \relax
  \Umathchardef\BbbOmega =             0 0 "E057 \relax
  \Umathchardef\nleqqslant =           3 0 "E066 \relax
  \Umathchardef\ngeqqslant =           3 0 "E067 \relax
  \Umathchardef\parallelslant  =       3 0 "E080 \relax
  \Umathchardef\nparallelslant =       3 0 "E081 \relax
  \Umathchardef\shortparallelslant =   3 0 "E082 \relax
  \Umathchardef\nshortparallelslant =  3 0 "E083 \relax
  \Umathchardef\mapstochar =           3 0 "E08D \relax
  \Umathchardef\lhook =                3 0 "E08E \relax
  \Umathchardef\rhook =                3 0 "E08F \relax
  % amssymb
  \@ifpackageloaded{amssymb}%
    {\PackageWarning{lete-sans-math}{%
       LeteSansMath 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\lvertneqq =      3 0 "E002 \relax
     \Umathchardef\gvertneqq =      3 0 "E003 \relax
     \Umathchardef\varsubsetneq =   3 0 "E006 \relax
     \Umathchardef\varsupsetneq =   3 0 "E007 \relax
     \Umathchardef\varsubsetneqq =  3 0 "E015 \relax
     \Umathchardef\varsupsetneqq =  3 0 "E016 \relax
     \Umathchardef\shortmid =       3 0 "E070 \relax
     \Umathchardef\shortparallel =  3 0 "E071 \relax
     \Umathchardef\nshortmid =      3 0 "E072 \relax
     \Umathchardef\nshortparallel = 3 0 "E073 \relax
     \Umathchardef\nleqslant =      3 0 "E076 \relax
     \Umathchardef\ngeqslant =      3 0 "E077 \relax
     \Umathchardef\nleqq =          3 0 "E078 \relax
     \Umathchardef\ngeqq =          3 0 "E079 \relax
     \Umathchardef\npreceq =        3 0 "E07C \relax
     \Umathchardef\nsucceq =        3 0 "E07D \relax
     \Umathchardef\nsubseteqq =     3 0 "E07E \relax
     \Umathchardef\nsupseteqq =     3 0 "E07F \relax
     \protected\def\centerdot{\cdotp}%
     \protected\def\restriction{\upharpoonright}%
     \protected\def\doteqdot{\Doteq}%
     \protected\def\doublecup{\Cup}%
     \protected\def\doublecap{\Cap}%
     \protected\def\llless{\lll}%
     \protected\def\gggtr{\ggg}%
     \protected\def\circlearrowleft{\acwopencirclearrow}%
     \protected\def\circlearrowright{\cwopencirclearrow}%
     \protected\def\lozenge{\mdlgwhtlozenge}%
     \protected\def\blacklozenge{\mdlgblklozenge}%
     \protected\def\square{\mdlgwhtsquare}%
     \protected\def\blacksquare{\mdlgblksquare}%
     \protected\def\dashleftarrow{\leftdasharrow}%
     \protected\def\dashrightarrow{\rightdasharrow}%
     \protected\def\ntriangleleft{\nvartriangleleft}%
     \protected\def\ntriangleright{\nvartriangleright}%
     \protected\def\varpropto{\propto}%
     \protected\def\thicksim{\sim}%
     \protected\def\thickapprox{\approx}%
     \protected\def\smallsmile{\smile}%
     \protected\def\smallfrown{\frown}%
    }%
  % latexsym
  \@ifpackageloaded{latexsym}%
    {\PackageWarning{lete-sans-math}{%
       LeteSansMath provides all LaTeX symbols.\MessageBreak
       Loading latexsym.sty is not advisable.\MessageBreak
       Reported}%
    }%
    {\protected\def\lhd{\vartriangleleft}%
     \protected\def\rhd{\vartriangleright}%
     \protected\def\unlhd{\trianglelefteq}%
     \protected\def\unrhd{\trianglerighteq}%
     \protected\def\leadsto{\rightcurvedarrow}%
     \protected\def\Box{\lgwhtsquare}%
     \protected\def\Diamond{\mdlgwhtdiamond}%
    }%
}

\endinput
