\NeedsTeXFormat{LaTeX2e}[2022/06/01]
\def\fileversion{0.71}
\def\filedate{2026-07-07}
\ProvidesPackage{luciole-math}[\filedate\space\fileversion]

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

\newopentypefeature{Style}{mathscr}{+ss01}
\newopentypefeature{Style}{leqslant}{+ss04}
\newopentypefeature{Style}{smaller}{+ss05}
\newopentypefeature{Style}{subsetneq}{+ss06}
\newopentypefeature{Style}{parallelslant}{+ss07}

\newtoks\LuciMtoks
\newtoks\LuciScale
\newcommand*{\Lucistore@KV@Option}[2]{%
  \LuciMtoks=\expandafter{\the\LuciMtoks #1={#2},}
  \def\Luci@opt{#1}%
  \def\Luci@scale{Scale}%
  \ifx\Luci@opt\Luci@scale
    \LuciScale=\expandafter{Scale={#2}}%
  \fi
}

% Package options:
\DeclareKeys
  {
   no-logos.if           = Luci@nologos                               ,
   Numbers.code          = \Lucistore@KV@Option{Numbers}{#1}          ,
   math-style.code       = \Lucistore@KV@Option{math-style}{#1}       ,
   bold-style.code       = \Lucistore@KV@Option{bold-style}{#1}       ,
   nabla.code            = \Lucistore@KV@Option{nabla}{#1}            ,
   partial.code          = \Lucistore@KV@Option{partial}{#1}          ,
   CharacterVariant.code = \Lucistore@KV@Option{CharacterVariant}{#1} ,
   StylisticSet.code     = \Lucistore@KV@Option{StylisticSet}{#1}     ,
   Style.code            = \Lucistore@KV@Option{Style}{#1}            ,
   Scale.code            = \Lucistore@KV@Option{Scale}{#1}
  }
%
\ProcessKeyOptions
%
% The Luciole text fonts are *not* loaded by luciole-math.sty.  Add
% \setmainfont{Luciole}[ <options> ]
% *after* this package to load them (see file "Luciole-Doc.pdf"
% for possible options).
% Fine tune TeX logos for the Luciole fonts
\ifLuci@nologos
\else
  \DeclareRobustCommand{\TeX}{T\kern -.125em\lower .4ex
    \hbox {E}\kern -.05emX\@}
  \DeclareRobustCommand{\LaTeX}{L\kern -.25em
    \raisebox{.38ex}{\textsc{a}}\kern -.1em\TeX}
  \DeclareRobustCommand{\LaTeXe}{\mbox{\m@th
    \if b\expandafter \@car \f@series \@nil \boldmath \fi \LaTeX
    \kern .05em2$_{\textstyle \varepsilon }$}}
\fi
% Math fonts: Luciole-Math.otf, Luciole-Math-Bold.otf.
\IfFontExistsTF{Luciole-Math-Bold}%
             {\Lucistore@KV@Option{BoldFont}{Luciole-Math-Bold.otf}}%
             {\PackageInfo{luciole}{%
                 File Luciole-Math-Bold.otf not found,}}
% Following Joseph Wright in https://tex.stackexchange.com/questions/451
\begingroup
  \edef\temp{%
    \endgroup
    \noexpand\setmathfont{Luciole-Math.otf}%
    [\unexpanded\expandafter{\the\LuciMtoks}]%
  }
  \temp
% For Maths operators (use Luciole text fonts).
\begingroup
  \edef\temp{%
    \endgroup
      \noexpand\setmathfontface\noexpand\mathrm{Luciole-Regular.ttf}%
        [\unexpanded\expandafter{\the\LuciScale}]%
      \noexpand\setmathfontface\noexpand\mathit{Luciole-Regular-Italic.ttf}%
        [\unexpanded\expandafter{\the\LuciScale}]%
      \noexpand\setmathfontface\noexpand\mathbf{Luciole-Bold.ttf}%
        [\unexpanded\expandafter{\the\LuciScale}]%
      \noexpand\setmathfontface\noexpand\mathsf{Luciole-Regular.ttf}%
        [\unexpanded\expandafter{\the\LuciScale}]%
  }
  \temp
%
\AtBeginDocument{%
  % Luciole-Math specific
  % \Umathchardef\<cmd> = <math type> <family> <slot>
  % <math type> : \mathord=0 \mathrel=3 ; <family>=0
  \Umathchardef\mupvarzero =          0 0 "E000 \relax
  \Umathchardef\varemptyset =         0 0 "E001 \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\mbfvarzero =          0 0 "E04D \relax
  \Umathchardef\lesseqslantgtr =      3 0 "E060 \relax
  \Umathchardef\gtreqslantless =      3 0 "E061 \relax
  \Umathchardef\lesseqqslantgtr =     3 0 "E062 \relax
  \Umathchardef\gtreqqslantless =     3 0 "E063 \relax
  \Umathchardef\nleqqslant =          3 0 "E066 \relax
  \Umathchardef\ngeqqslant =          3 0 "E067 \relax
  \Umathchardef\lesssimslant =        3 0 "E06A \relax
  \Umathchardef\gtrsimslant =         3 0 "E06B \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
 % \widearc and\overrightarc
  \providecommand*{\widearc}{\Umathaccent 0 0 "E540 }%
  \providecommand*{\overrightarc}{\Umathaccent 0 0 "20D5 }%
  % amssymb
  \@ifpackageloaded{amssymb}%
    {\PackageWarning{luciole}{%
       Luciole-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\lvertneqq =      3 0 "E068 \relax
     \Umathchardef\gvertneqq =      3 0 "E069 \relax
     \Umathchardef\varsubsetneq =   3 0 "E06C \relax
     \Umathchardef\varsupsetneq =   3 0 "E06D \relax
     \Umathchardef\varsubsetneqq =  3 0 "E06E \relax
     \Umathchardef\varsupsetneqq =  3 0 "E06F \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{luciole}{%
       Luciole-Math 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}%
    }%
  % For \xLeftarrow, etc. (amsmath, mathtools)
  \@ifpackageloaded{amsmath}%
    {\Umathchardef\std@equal = 2 0 "E4F3 \relax
    }{}%
}

\endinput
