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

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

\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
  {
   lum.if                = Luci@lum                                   ,
   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
%
\ifxetex  \RequirePackage{unicode-math} \Luci@lumfalse\fi
\ifluatex
  \ifLuci@lum \RequirePackage{fontspec,lua-unicode-math}
  \else      \RequirePackage{unicode-math}
  \fi
\fi
%
\newopentypefeature{Style}{mathscr}{+ss01}
\newopentypefeature{Style}{leqslant}{+ss04}
\newopentypefeature{Style}{smaller}{+ss05}
\newopentypefeature{Style}{subsetneq}{+ss06}
\newopentypefeature{Style}{parallelslant}{+ss07}
%
% 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.otf}%
             {\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\setmathrm{Luciole-Regular.ttf}%
      [\unexpanded\expandafter{\the\LuciScale}]%
    \noexpand\setmathsf{Luciole-Regular.ttf}%
      [\unexpanded\expandafter{\the\LuciScale}]%
  }
\temp
%
%  For AMS symbols with lua-unicode-math.
\ifLuci@lum
  \RequirePackage{amssymb}
\fi
%
% Missing Math symbols definitions
\newcount\Luci@fam
\AtBeginDocument{%
  \ifluatex \Luci@fam=\Umathcharfam"30 \fi
  % For both unicode-math and lua-unicode-math:
  % Avoid (way too thin) AMS symbols for the next seven chars.
  \protected\def\varpropto{\propto}%
  \protected\def\thicksim{\sim}%
  \protected\def\thickapprox{\approx}%
  \protected\def\smallfrown{\frown}%
  \protected\def\smallsmile{\smile}%
  % \Umathchardef\<cmd> = <math type> <family> <slot>
  % <math type> : \mathord=0 \mathbin=2 \mathrel=3 ; <family>=0
  \Umathchardef\circledR =            0 \the\Luci@fam  "24C7 \relax
  \Umathchardef\circledS =            0 \the\Luci@fam  "24C8 \relax
  % Luciole-Math specific
  \Umathchardef\mupvarzero =          0 \the\Luci@fam  "E000 \relax
  \Umathchardef\varemptyset =         0 \the\Luci@fam  "E001 \relax
  \Umathchardef\varsubsetneq =        3 \the\Luci@fam  "E010 \relax
  \Umathchardef\varsupsetneq =        3 \the\Luci@fam  "E011 \relax
  \Umathchardef\varsubsetneqq =       3 \the\Luci@fam  "E012 \relax
  \Umathchardef\varsupsetneqq =       3 \the\Luci@fam  "E013 \relax
  \Umathchardef\lesseqslantgtr =      3 \the\Luci@fam  "E014 \relax
  \Umathchardef\gtreqslantless =      3 \the\Luci@fam  "E015 \relax
  \Umathchardef\lesseqqslantgtr =     3 \the\Luci@fam  "E016 \relax
  \Umathchardef\gtreqqslantless =     3 \the\Luci@fam  "E017 \relax
  \Umathchardef\lesssimslant =        3 \the\Luci@fam  "E019 \relax
  \Umathchardef\gtrsimslant =         3 \the\Luci@fam  "E01A \relax
  \Umathchardef\lvertneqq =           3 \the\Luci@fam  "E01B \relax
  \Umathchardef\gvertneqq =           3 \the\Luci@fam  "E01C \relax
  \Umathchardef\mbfimath =            0 \the\Luci@fam  "E041 \relax
  \Umathchardef\mbfjmath =            0 \the\Luci@fam  "E042 \relax
  \Umathchardef\mbfdotlessi =         0 \the\Luci@fam  "E043 \relax
  \Umathchardef\mbfdotlessj =         0 \the\Luci@fam  "E044 \relax
  \Umathchardef\mithbar =             0 \the\Luci@fam  "E048 \relax
  \Umathchardef\mbfvarzero =          0 \the\Luci@fam  "E04D \relax
  \Umathchardef\mupvarl =             0 \the\Luci@fam  "E051 \relax
  \Umathchardef\mitvarl =             0 \the\Luci@fam  "E052 \relax
  \Umathchardef\mbfvarl =             0 \the\Luci@fam  "E053 \relax
  \Umathchardef\mbfitvarl =           0 \the\Luci@fam  "E054 \relax
  \Umathchardef\mbfell =              0 \the\Luci@fam  "E055 \relax
  \Umathchardef\mupvara =             0 \the\Luci@fam  "E058 \relax
  \Umathchardef\mitvara =             0 \the\Luci@fam  "E059 \relax
  \Umathchardef\mbfvara =             0 \the\Luci@fam  "E05A \relax
  \Umathchardef\mbfitvara =           0 \the\Luci@fam  "E05B \relax
  \Umathchardef\nleqqslant =          3 \the\Luci@fam  "E066 \relax
  \Umathchardef\ngeqqslant =          3 \the\Luci@fam  "E067 \relax
  \Umathchardef\shortmid =            3 \the\Luci@fam  "E070 \relax
  \Umathchardef\shortparallel =       3 \the\Luci@fam  "E071 \relax
  \Umathchardef\nshortmid =           3 \the\Luci@fam  "E072 \relax
  \Umathchardef\nshortparallel =      3 \the\Luci@fam  "E073 \relax
  \Umathchardef\smallsetminus =       2 \the\Luci@fam  "E074 \relax
  \Umathchardef\nleqslant =           3 \the\Luci@fam  "E076 \relax
  \Umathchardef\ngeqslant =           3 \the\Luci@fam  "E077 \relax
  \Umathchardef\nleqq =               3 \the\Luci@fam  "E078 \relax
  \Umathchardef\ngeqq =               3 \the\Luci@fam  "E079 \relax
  \Umathchardef\npreceq =             3 \the\Luci@fam  "E07C \relax
  \Umathchardef\nsucceq =             3 \the\Luci@fam  "E07D \relax
  \Umathchardef\nsubseteqq =          3 \the\Luci@fam  "E07E \relax
  \Umathchardef\nsupseteqq =          3 \the\Luci@fam  "E07F \relax
  \Umathchardef\parallelslant  =      3 \the\Luci@fam  "E080 \relax
  \Umathchardef\nparallelslant =      3 \the\Luci@fam  "E081 \relax
  \Umathchardef\shortparallelslant =  3 \the\Luci@fam  "E082 \relax
  \Umathchardef\nshortparallelslant = 3 \the\Luci@fam  "E083 \relax
  \Umathchardef\mapstochar =          3 \the\Luci@fam  "E08D \relax
  \Umathchardef\lhook =               3 \the\Luci@fam  "E08E \relax
  \Umathchardef\rhook =               3 \the\Luci@fam  "E08F \relax
  % \widearc and\overrightarc
  \providecommand*{\widearc}{\Umathaccent 0 \the\Luci@fam  "E540 }%
  \providecommand*{\overrightarc}{\Umathaccent 0 0 "20D5 }%
  % For \xLeftarrow, etc. (amsmath, mathtools)
  \@ifpackageloaded{amsmath}%
    {\Umathchardef\std@equal = 2 \the\Luci@fam  "E4F3 \relax
    }{}%
  % For unicode-math only:
  \ifLuci@lum \else
    % 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
       \protected\def\centerdot{\vysmblksquare}%
       \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}%
      }%
\fi
}

\endinput
