% This file is part of babel. For further details see:
% https://www.ctan.org/pkg/babel
\ifx\BabelBeforeIni\undefined
  \PackageError{babel}%
    {This file is a component of babel and cannot\MessageBreak
     be loaded directly. I'll stop immediately}%
    {Just use babel as documented.}%
  \stop
\fi
\BabelBeforeIni{el-monoton}{%
  \BabelDefinitionFile{0}{greek}{%
    \PackageWarning{babel}{%
      Requested: monotonicgreek\MessageBreak
      Provided: greek\MessageBreak
      Reported on}%
    \def\languagename{greek}%
    \AddBabelHook[monotonicgreek]{babel-greek}{languagename}{%
        \def\languagename{greek}}%
    \def\BabelIniTag{el-monoton}%
    \AtBeginDocument{%
      \def\bbl@tempa{TU}%
      \ifx\f@encoding\bbl@tempa
        \babelprovide[import=el-monoton]{greek}%
        \babelprovide[import=el-monoton]{monotonicgreek}%
        \selectlanguage{\mainlocalename}%
      \fi}}%
}

\ifcase\bbl@engine\else

  % Numerals (Ionian)
  
  \@namedef{bbl@cntr@ionian@\CurrentOption}#1%
    {\expandafter\greeknumeral\expandafter{\the\numexpr#1}}

  \def\BabelGreekNumeralMarkerEnd#1{#1ʹ}
  \def\BabelGreekNumeralMarker#1{#1}
  \def\BabelGreekNumeralVI{ϛ} % ϝ, στ
  \def\BabelGreekNumeralXC{ϟ} % ϙ
  \def\BabelGreekNumeralCM{ϡ} % ͳ

  \def\greek@num@aux#1#2#3#4#5#6#7#8#9\@@{%
    \ifcase\@car#9\@nil\or
       \greek@num@format0000000#1\or
       \greek@num@format000000#1#2\or
       \greek@num@format00000#1#2#3\or
       \greek@num@format0000#1#2#3#4\or
       \greek@num@format000#1#2#3#4#5\or
       \greek@num@format00#1#2#3#4#5#6\or
       \greek@num@format0#1#2#3#4#5#6#7\or
       \greek@num@format#1#2#3#4#5#6#7#8\else
       \greek@invalid
    \fi}

  \def\BabelGreekNumeralMyriads#1#2#3#4{%
    \ifnum#1#2=\z@
      \ifcase#3\or ͵ρ\or ͵σ\or ͵τ\or ͵υ\or ͵φ\or
          ͵χ\or ͵ψ\or ͵ω\or ͵\BabelGreekNumeralCM\fi
      \ifcase#4\or ͵ι\or ͵κ\or ͵λ\or ͵μ\or ͵ν\or
          ͵ξ\or ͵ο\or ͵π\or ͵\BabelGreekNumeralXC\fi
    \else
      \greek@invalid
    \fi}

  \def\greek@num@format#1#2#3#4#5#6#7#8{%
    \BabelGreekNumeralMarker{%
      \BabelGreekNumeralMyriads#1#2#3#4%
      \ifcase#5\or ͵α\or ͵β\or ͵γ\or ͵δ\or ͵ε\or
          ͵\BabelGreekNumeralVI\or ͵ζ\or ͵η\or ͵θ\fi
      \ifnum#6#7#8=\z@\else
        \BabelGreekNumeralMarkerEnd{%
          \ifcase#6\or ρ\or σ\or τ\or υ\or
              φ\or χ\or ψ\or ω\or \BabelGreekNumeralCM\fi
          \ifcase#7\or ι\or κ\or λ\or μ\or ν\or
              ξ\or ο\or π\or \BabelGreekNumeralXC\fi
          \ifcase#8\or α\or β\or γ\or δ\or ε\or
              \BabelGreekNumeralVI\or ζ\or η\or θ\fi}%
      \fi}}

  \def\greek@invalid{%
    \bbl@error{Greek numeral too large (>999999)}%
      {Currently this is the limit.}}

  \expandafter\addto\csname extras\languagename\endcsname{%
    \babel@save\greeknumeral
    \def\greeknumeral#1{\expandafter\greek@num@aux\number#1 876543210\@@}}

\fi

\endinput
