%%
%% This is file `mathcommand.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mathcommand.dtx  (with options: `head,package')
%% 
%% This is a generated file. Copyright (C) 2019 by Thomas Colcombet
%% 
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.2 of this license or (at your option) any later
%% version.  The latest version of this license is in:
%% 
%%        http://www.latex-project.org/lppl.txt
%% 
%% and version 1.2 or later is part of all distributions of
%% LaTeX version 1999/12/01 or later.
%% 
\usepackage{expl3}
\ProvidesExplPackage{mathcommand}{2019/07/03}{1.02}{}
%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\RequirePackage{expl3}
\RequirePackage{etoolbox}
\RequirePackage{xparse}

\ExplSyntaxOn
\bool_if_exist:NTF\mathcommand_package_loaded_bool
 \endinput
 {\bool_new:N\mathcommand_package_loaded_bool
  \bool_set_true:N\mathcommand_package_loaded_bool}

\cs_new:Npn\__mathcommand_absorb_PIE:nw#1{
  \tl_set:Nn\__mathcommand_absorb_finished_tl{#1}
  \tl_set:Nn\__mathcommand_primes_tl{}
  \tl_set:Nn\__mathcommand_index_tl{}
  \tl_set:Nn\__mathcommand_exponent_tl{}
  \__mathcommand_absorb:w
}
\cs_new:Nn\__mathcommand_absorb_finished:{
  \exp_args:NV\__mathcommand_absorb_finished_:\__mathcommand_exponent_tl
}
\cs_new:Nn\__mathcommand_absorb_finished_:{
  \exp_args:NV\__mathcommand_absorb_finished__:\__mathcommand_index_tl
}
\cs_new:Nn\__mathcommand_absorb_finished__:{
  \exp_args:NV\__mathcommand_absorb_finished_tl\__mathcommand_primes_tl
}
\cs_new:Npn\peek_subscript_remove:TFw
    {\peek_charcode_remove:NTF _}
\cs_new:Npn\peek_superscript_remove:TFw
    {\peek_charcode_remove:NTF ^}
\cs_new:Npn\peek_prime_remove:TFw
    {\peek_charcode_remove:NTF '}
\cs_new:Nn\__mathcommand_absorb_add_prime:{
  \tl_put_right:Nn\__mathcommand_primes_tl{'}
}
\ExplSyntaxOff
\expandafter\def\csname g_tmpa_tl\endcsname{_}
\ExplSyntaxOn
\cs_new:Nx\__mathcommand_absorb_add_index_after:Nn{
  \exp_not:N\tl_set:Nn\exp_not:N\__mathcommand_index_tl
     {\g_tmpa_tl{#2}}
  #1
}
\cs_new:Nn\__mathcommand_absorb_add_exponent_after:Nn{
  \tl_set:Nn\__mathcommand_exponent_tl{^{#2}}
  #1
}
\cs_new:Npn\__mathcommand_absorb:w{
   \peek_prime_remove:TFw
      {\__mathcommand_absorb_add_prime:
       \__mathcommand_absorb_p:w}
      \__mathcommand_absorb_:w}
\cs_new:Npn\__mathcommand_absorb_:w{
   \peek_subscript_remove:TFw
      {\__mathcommand_absorb_add_index_after:Nn
       \__mathcommand_absorb_i:w}
      \__mathcommand_absorb__:w}
\cs_new:Npn\__mathcommand_absorb__:w{
   \peek_superscript_remove:TFw
      {\__mathcommand_absorb_add_exponent_after:Nn
       \__mathcommand_absorb_e:w}
      \__mathcommand_absorb_finished:}
\cs_new:Npn\__mathcommand_absorb_p:w{
   \peek_prime_remove:TFw
      {\__mathcommand_absorb_add_prime:
       \__mathcommand_absorb_p:w}
      \__mathcommand_absorb_p_:w}
\cs_new:Npn\__mathcommand_absorb_p_:w{
   \peek_subscript_remove:TFw
      {\__mathcommand_absorb_add_index_after:Nn
       \__mathcommand_absorb_pi:w}
      \__mathcommand_absorb_finished:}
\cs_new:Npn\__mathcommand_absorb_pi:w{
   \peek_prime_remove:TFw
      {\__mathcommand_absorb_add_prime:
       \__mathcommand_absorb_pi:w}
      \__mathcommand_absorb_finished:}
\cs_new:Npn\__mathcommand_absorb_e:w{
   \peek_subscript_remove:TFw
      {\__mathcommand_absorb_add_index_after:Nn
       \__mathcommand_absorb_finished:}
      \__mathcommand_absorb_finished:}
\cs_new:Npn\__mathcommand_absorb_i:w{
   \peek_prime_remove:TFw
      {\__mathcommand_absorb_add_prime:
       \__mathcommand_absorb_pi:w}
      \__mathcommand_absorb_i_:w}
\cs_new:Npn\__mathcommand_absorb_i_:w{
   \peek_superscript_remove:TFw
      {\__mathcommand_absorb_add_exponent_after:Nn
       \__mathcommand_absorb_finished:}
      \__mathcommand_absorb_finished:}
\NewDocumentCommand\newcommandPIE{ m o  o m }{
   \__xparse_check_definable:nNT {#1} \newcommandPIE
      {
        \cs_if_exist:NTF #1
          {
            \__kernel_msg_error:nnxx { mathcommand } { command-already-defined }
              { \use:nnn \token_to_str:N #1 { } }
              { \token_to_str:N \newcommandPIE }
          }
          { \__mathcommand_declarecommandPIE:Nnnn #1{#2}{#3}{#4} }
      }
}
\NewDocumentCommand\renewcommandPIE{ m o  o m }{
   \__xparse_check_definable:nNT {#1} \renewcommandPIE
      {
        \cs_if_exist:NTF #1
          { \__mathcommand_declarecommandPIE:Nnnn #1{#2}{#3}{#4} }
          {
            \__kernel_msg_error:nnxx { mathcommand } { command-not-yet-defined }
              { \use:nnn \token_to_str:N #1 { } }
              { \token_to_str:N \renewcommandPIE }
          }
      }
}
\NewDocumentCommand\declarecommandPIE{ m o  o m }{
   \__xparse_check_definable:nNT {#1} \declarecommandPIE
        { \__mathcommand_declarecommandPIE:Nnnn #1{#2}{#3}{#4} }
}
\cs_new:Nn\__mathcommand_declarecommandPIE:Nnnn{
   \use:x{
   \exp_not:N\__mathcommand_declarePIE_generic:Nnnn
      \exp_not:N#1
      {\IfNoValueTF{#2}{0}{#2}}
      {\cs_if_exist:NTF#1
            {\exp_not:N\renewrobustcmd}
            {\exp_not:N\newrobustcmd}
         \exp_not:N#1
         \IfNoValueTF{#2}{}{[#2]}
         \IfNoValueTF{#3}{}{[{\exp_not:n{#3}}]}}
      {\exp_not:n{#4}}
}}
\cs_new_protected:Npn\NewDocumentCommandPIE#1#2#3{
   \__xparse_check_definable:nNT {#1} \NewDocumentCommandPIE
      {
        \cs_if_exist:NTF #1
          {
            \__kernel_msg_error:nnxx { mathcommand } { command-already-defined }
              { \use:nnn \token_to_str:N #1 { } }
              { \token_to_str:N \NewDocumentCommandPIE }
          }
          { \__mathcommand_DeclareDocumentCommandPIE:Nnn #1 {#2} {#3} }
      }
}
\cs_new_protected:Npn\RenewDocumentCommandPIE#1#2#3{
   \__xparse_check_definable:nNT {#1} \RenewDocumentCommandPIE
      {
        \cs_if_exist:NTF #1
          { \__mathcommand_DeclareDocumentCommandPIE:Nnn #1 {#2} {#3} }
          {
             \__kernel_msg_error:nnxx { xparse } { command-not-yet-defined }
              { \use:nnn \token_to_str:N #1 { } }
              { \token_to_str:N \RenewDocumentCommandPIE }
          }
      }
}
\cs_new_protected:Npn\DeclareDocumentCommandPIE#1#2#3{
   \__xparse_check_definable:nNT {#1} \DeclareDocumentCommandPIE
      {
          \__mathcommand_DeclareDocumentCommandPIE:Nnn #1 {#2} {#3}
      }
}
\cs_new_protected:Npn\ProvideDocumentCommandPIE#1#2#3{
   \__xparse_check_definable:nNT {#1} \ProvideDocumentCommandPIE
      {
        \cs_if_exist:NTF #1{}
          {
            \__mathcommand_DeclareDocumentCommandPIE:Nnn #1 {#2} {#3}
          }
      }
}
\cs_set:Nn\__mathcommand_DeclareDocumentCommandPIE:Nnn{
   \group_begin:
      \DeclareDocumentCommand#1{#2}{}
      \int_gset_eq:NN\g_tmpa_int\l__xparse_current_arg_int
   \group_end:
   \__mathcommand_declarePIE_generic:Nnnn
      #1
      {\g_tmpa_int}
      {\DeclareDocumentCommand#1{#2}}
      {#3}
}
\cs_new:Nn\__mathcommand_declarePIE_generic:Nnnn{
   \int_compare:nNnTF{#2}>{6}
    {\PackageError{mathcommand}
          {At~most~6~parameters~in~PIE~commands~when~defining~`\token_to_str:N#1'}
          {PIE~commands~(mathcommand~package)~do~not~accept~more~than~six~parameters.}}
    {\int_case:nn{#2}
     {{0} {\cs_set:cpn{\cs_to_str:N#1~PIE~code}##1##2##3}
      {1} {\cs_set:cpn{\cs_to_str:N#1~PIE~code}##1##2##3##4}
      {2} {\cs_set:cpn{\cs_to_str:N#1~PIE~code}##1##2##3##4##5}
      {3} {\cs_set:cpn{\cs_to_str:N#1~PIE~code}##1##2##3##4##5##6}
      {4} {\cs_set:cpn{\cs_to_str:N#1~PIE~code}##1##2##3##4##5##6##7}
      {5} {\cs_set:cpn{\cs_to_str:N#1~PIE~code}##1##2##3##4##5##6##7##8}
      {6} {\cs_set:cpn{\cs_to_str:N#1~PIE~code}##1##2##3##4##5##6##7##8##9}}
    {#4}
   \use:x{
      \exp_not:n{#3}
      {\exp_not:N\__mathcommand_absorb_PIE:nw
          {\exp_not:c{\cs_to_str:N#1~PIE~code}
          \int_case:nn{#2}
          {{0}{}
           {1}{\exp_not:n{{##1}}}
           {2}{\exp_not:n{{##1}{##2}}}
           {3}{\exp_not:n{{##1}{##2}{##3}}}
           {4}{\exp_not:n{{##1}{##2}{##3}{##4}}}
           {5}{\exp_not:n{{##1}{##2}{##3}{##4}{##5}}}
           {6}{\exp_not:n{{##1}{##2}{##3}{##4}{##5}{##6}}}}}}}
   }
}
\def\lettersUppercase{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\def\lettersLowercase{abcdefghijklmnopqrstuvwxyz}
\xdef\lettersAll{\lettersLowercase\lettersUppercase}
\def\lettersGreekLowercase{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\lambda\mu\nu\xi\pi\varpi\rho\varrho\sigma\varsigma\tau\upsilon\phi\varphi\chi\psi\omega}
\def\lettersGreekUppercase{\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega}
\xdef\lettersGreekAll{\lettersGreekLowercase\lettersGreekUppercase}
\cs_set_eq:NN\IfEmptyTF\tl_if_empty:nTF
\cs_new:Npn\EmptyContent#1{
    \tl_if_empty:nTF{#1}{{}}{
        \__mathcommand_EmptyContent:w #1*\end_marker:
    }
}
\cs_new:Npn\__mathcommand_EmptyContent:w #1#2\end_marker:{
    #1*
}
\cs_new:Npn\GetExponent#1{
    \tl_if_empty:nTF{#1}{}{
        \__mathcommand_GetIndexOrExponent:w #1\__end_marker__
    }
}
\cs_new:Npn\GetIndex#1{
    \tl_if_empty:nTF{#1}{}{
        \__mathcommand_GetIndexOrExponent:w #1\__end_marker__
    }
}
\cs_new:Npn\__mathcommand_GetIndexOrExponent:w #1#2#3\__end_marker__{
    #2
}
\tl_const:Nn\__mathcommand_prefix_math_tl{Math~}
\tl_const:Nn\__mathcommand_prefix_text_tl{Text~}
\tl_const:Nn\__mathcommand_prefix_store_tl{LaTeX}
\cs_new:Nn\__mathcommand_to_mathtl:N{\__mathcommand_prefix_math_tl\cs_to_str:N#1}
\cs_new:Nn\__mathcommand_to_texttl:N{\__mathcommand_prefix_text_tl\cs_to_str:N#1}
\cs_new:Nn\__mathcommand_to_storetl:N{\__mathcommand_prefix_store_tl\cs_to_str:N#1}
\cs_new:Nn\__mathcommand_coretl:N
    {\expandafter\__command_coretl:w\string#1\end_mark}
\cs_new:Npn\__command_coretl:w#1~#2\end_mark{#2}
\cs_new:Npn\__mathcommand_if_exist:NTF
  {\cs_if_exist:NTF}
\cs_new:Npn\__mathcommand_if_exist_math:NTF#1
  {\cs_if_exist:cTF{\__mathcommand_to_mathtl:N#1}}
\cs_new:Npn\__mathcommand_if_exist_text:NTF#1
  {\cs_if_exist:cTF{\__mathcommand_to_texttl:N#1}}
\cs_new:Npn\__mathcommand_if_exist_text_or_math:NTF#1
  {\__mathcommand_if_exist_math:NTF#1
      \use_i:nn{\__mathcommand_if_exist_text:NTF#1}}
\cs_new:Nn\__mathcommand_error_if_exist_math:NF{
   \cs_if_exist:cTF{\__mathcommand_to_mathtl:N#1}
   {\exp_args:Nnx\PackageError{}
       {Command~`\token_to_str:N#1'~already~exists~in~math~mode}
       {}
   }{#2}
}
\cs_new:Nn\__mathcommand_error_if_exist_text:NF{
   \cs_if_exist:cTF{\__mathcommand_to_texttl:N#1}
   {\exp_args:Nnx\PackageError{}
       {Command~`\token_to_str:N#1'~already~exists~in~text~mode}
       {}
   }{#2}
}
\cs_new:Nn\__mathcommand_error_if_not_exist_math:NF{
   \cs_if_exist:cTF{\__mathcommand_to_mathtl:N#1}
     {#2}
     {\exp_args:Nnx\PackageError{}
       {Command~`\token_to_str:N#1'~does~not~exist~in~math~mode}
       {}
   }
}
\cs_new:Nn\__mathcommand_error_if_not_exist_text:NF{
   \cs_if_exist:cTF{\__mathcommand_to_texttl:N#1}
     {#2}
     {\exp_args:Nnx\PackageError{}
       {Command~`\token_to_str:N#1'~does~not~exist~in~text~mode}
       {}
   }
}
\cs_new:Nn\__mathcommand_error_unknownmath:N{
   \exp_args:Nnx\PackageError{}
       {Command~`\token_to_str:c{\__mathcommand_coretl:N #1}'~does~not~exist~in~math~mode}
       {}
}
\cs_new:Nn\__mathcommand_error_unknowntext:N{
   \exp_args:Nnx\PackageError{}
       {Command~`\token_to_str:c{\__mathcommand_coretl:N #1}'~does~not~exist~in~text~mode}
       {}
}
\cs_new:Nn\__mathcommand_try_math:N{
   \cs_if_exist:NTF#1#1{\__mathcommand_error_unknownmath:N#1}
}
\cs_new:Nn\__mathcommand_try_text:N{
   \cs_if_exist:NTF#1#1{\__mathcommand_error_unknowntext:N#1}
}
\cs_set:Nn\__mathcommand_create_fork:N{
   \let\__mathcommand_tmp_cs\undefined
   \exp_args:NNx
      \cs_new_protected:Npn\__mathcommand_tmp_cs{
         \exp_not:N\mode_if_math:TF
          {\exp_not:N\__mathcommand_try_math:N\exp_not:c{\__mathcommand_to_mathtl:N#1}}
          {\exp_not:N\__mathcommand_try_text:N\exp_not:c{\__mathcommand_to_texttl:N#1}}
      }
   \cs_if_exist:NTF#1{
     \cs_if_eq:NNTF#1\__mathcommand_tmp_cs
       { }
       { \cs_set_eq:cN{\__mathcommand_to_storetl:N#1}#1
         \cs_set_eq:cN{\__mathcommand_to_mathtl:N#1}#1
         \cs_set_eq:cN{\__mathcommand_to_texttl:N#1}#1
         \cs_set_eq:NN#1\__mathcommand_tmp_cs
       }
     }{ \cs_set_eq:NN#1\__mathcommand_tmp_cs }
}
\NewDocumentCommand\declarecommand{m}{
   \__xparse_check_definable:nNT {#1} \declarecommand
   {
     \cs_if_exist:NTF#1
        {\renewcommand#1}
        {\newcommand#1}
   }
}
\newrobustcmd\storecommand[2][\__mathcommand_prefix_store_tl]{
   \__xparse_check_definable:nNT {#2} \storecommand
   {
       \cs_if_exist:NTF#2{
           \cs_set_eq:cN{\__mathcommand_prefix_store_tl\cs_to_str:N#2}#2
       }
       {
           \PackageError{mathcommand}
          {The~command~`\token_to_str:N#2'~does~not~exist~(in~\token_to_str:N\storecommand)}
          {}
       }
   }
}

\NewDocumentCommand\NewDocumentMathCommand{m}{
   \__xparse_check_definable:nNT {#1} \NewDocumentMathCommand
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_exist_math:NF#1
      {\exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_mathtl:N#1}}
   }
}
\NewDocumentCommand\NewDocumentTextCommand{m}{
   \__xparse_check_definable:nNT {#1} \NewDocumentTextCommand
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_exist_text:NF#1
      {\exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_texttl:N#1}}
   }
}
\NewDocumentCommand\newmathcommand{m}{
   \__xparse_check_definable:nNT {#1} \newmathcommand
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_exist_math:NF#1
      {\exp_args:Nc\newcommand{\__mathcommand_to_mathtl:N#1}}
   }
}
\NewDocumentCommand\newtextcommand{m}{
   \__xparse_check_definable:nNT {#1} \newtextcommand
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_exist_text:NF#1
      {\exp_args:Nc\newcommand{\__mathcommand_to_texttl:N#1}}
   }
}
\NewDocumentCommand\RenewDocumentMathCommand{m}{
   \__xparse_check_definable:nNT {#1} \RenewDocumentMathCommand
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_not_exist_math:NF#1
      {\exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_mathtl:N#1}}
   }
}
\NewDocumentCommand\RenewDocumentTextCommand{m}{
   \__xparse_check_definable:nNT {#1} \RenewDocumentMathCommand
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_not_exist_text:NF#1
      {\exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_texttl:N#1}}
   }
}
\NewDocumentCommand\renewmathcommand{m}{
   \__xparse_check_definable:nNT {#1} \renewmathcommand
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_not_exist_math:NF#1
      {\exp_args:Nc\renewcommand{\__mathcommand_to_mathtl:N#1}}
   }
}
\NewDocumentCommand\renewtextcommand{m}{
   \__xparse_check_definable:nNT {#1} \renewtextcommand
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_not_exist_text:NF#1
      {\exp_args:Nc\renewcommand{\__mathcommand_to_texttl:N#1}}
   }
}
\NewDocumentCommand\declaremathcommand{m}{
   \__xparse_check_definable:nNT {#1} \renewmathcommand
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\declarecommand{\__mathcommand_to_mathtl:N#1}
   }
}
\NewDocumentCommand\declaretextcommand{m}{
   \__xparse_check_definable:nNT {#1} \renewtextcommand
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\declarecommand{\__mathcommand_to_texttl:N#1}
   }
}

\NewDocumentCommand\DeclareDocumentMathCommand{m}{
   \__xparse_check_definable:nNT {#1} \DeclareDocumentMathCommand
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_mathtl:N#1}
   }
}
\NewDocumentCommand\DeclareDocumentTextCommand{m}{
   \__xparse_check_definable:nNT {#1} \DeclareDocumentTextCommand
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_texttl:N#1}
   }
}
\NewDocumentCommand\ProvideDocumentMathCommand{mmm}{
   \__xparse_check_definable:nNT {#1} \ProvideDocumentMathCommand
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\ProvideDocumentCommand{\__mathcommand_to_mathtl:N#1}{#2}{#3}
   }
}
\NewDocumentCommand\ProvideDocumentTextCommand{m}{
   \__xparse_check_definable:nNT {#1} \ProvideDocumentTextCommand
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\ProvideDocumentCommand{\__mathcommand_to_texttl:N#1}
   }
}
\NewDocumentCommand\NewDocumentMathCommandPIE{m}{
   \__xparse_check_definable:nNT {#1} \NewDocumentMathCommandPIE
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_exist_math:NF#1
      {\exp_args:Nc\DeclareDocumentCommandPIE{\__mathcommand_to_mathtl:N#1}}
   }
}
\NewDocumentCommand\newmathcommandPIE{m}{
   \__xparse_check_definable:nNT {#1} \newmathcommandPiE
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_exist_math:NF#1
      {\exp_args:Nc\newcommandPIE{\__mathcommand_to_mathtl:N#1}}
   }
}
\NewDocumentCommand\RenewDocumentMathCommandPIE{m}{
   \__xparse_check_definable:nNT {#1} \RenewDocumentMathCommandPIE
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_not_exist_math:NF#1
      {\exp_args:Nc\DeclareDocumentCommandPIE{\__mathcommand_to_mathtl:N#1}}
   }
}
\NewDocumentCommand\renewmathcommandPIE{m}{
   \__xparse_check_definable:nNT {#1} \renewmathcommandPIE
   {
      \__mathcommand_create_fork:N#1
      \__mathcommand_error_if_not_exist_math:NF#1
      {\exp_args:Nc\renewcommandPIE{\__mathcommand_to_mathtl:N#1}}
   }
}
\NewDocumentCommand\DeclareDocumentMathCommandPIE{m}{
   \__xparse_check_definable:nNT {#1} \DeclareDocumentMathCommand
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\DeclareDocumentCommand{\__mathcommand_to_mathtl:N#1}
   }
}
\NewDocumentCommand\declaremathcommandPIE{m}{
   \__xparse_check_definable:nNT {#1} \declaremathcommandPIE
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\declarecommandPIE{\__mathcommand_to_mathtl:N#1}
   }
}

\NewDocumentCommand\ProvideDocumentMathCommandPIE{mmm}{
   \__xparse_check_definable:nNT {#1} \ProvideDocumentMathCommandPIE
   {
      \__mathcommand_create_fork:N#1
      \exp_args:Nc\ProvideDocumentCommandPIE{\__mathcommand_to_mathtl:N#1}{#2}{#3}
   }
}
\NewDocumentCommand\LoopCommands{ m ooooooo m }{
   \IfNoValueTF{#2}
     {\cs_set:Nn\__tmp_two:n{\exp_not:c{##1}}}
     {\cs_set:Nn\__tmp_two:n{\exp_not:c{#2}}}
   \IfNoValueTF{#3}
     {\cs_set:Nn\__tmp_three:n{\exp_not:c{##1}}}
     {\cs_set:Nn\__tmp_three:n{\exp_not:c{#3}}}
   \IfNoValueTF{#4}
     {\cs_set:Nn\__tmp_four:n{\exp_not:c{##1}}}
     {\cs_set:Nn\__tmp_four:n{\exp_not:c{#4}}}
   \IfNoValueTF{#5}
     {\cs_set:Nn\__tmp_five:n{\exp_not:c{##1}}}
     {\cs_set:Nn\__tmp_five:n{\exp_not:c{#5}}}
   \IfNoValueTF{#6}
     {\cs_set:Nn\__tmp_six:n{\exp_not:c{##1}}}
     {\cs_set:Nn\__tmp_six:n{\exp_not:c{#6}}}
   \IfNoValueTF{#7}
     {\cs_set:Nn\__tmp_seven:n{\exp_not:c{##1}}}
     {\cs_set:Nn\__tmp_seven:n{\exp_not:c{#7}}}
   \IfNoValueTF{#8}
     {\cs_set:Nn\__tmp_eight:n{\exp_not:c{##1}}}
     {\cs_set:Nn\__tmp_eight:n{\exp_not:c{#8}}}
   %
   \cs_gset:Nn\g_tmpb_cs:nnnnnnnn{#9}
   %
   \cs_gset:Nn\g_tmpa_cs:n{
     \tl_set:Nn\l_tmpa_tl{##1}
     \use:x{
        \exp_not:N\g_tmpb_cs:nnnnnnnn
           {\l_tmpa_tl}
           \__tmp_two:n{\l_tmpa_tl}
           \__tmp_three:n{\l_tmpa_tl}
           \__tmp_four:n{\l_tmpa_tl}
           \__tmp_five:n{\l_tmpa_tl}
           \__tmp_six:n{\l_tmpa_tl}
           \__tmp_seven:n{\l_tmpa_tl}
           \__tmp_eight:n{\l_tmpa_tl}}
     }
  \exp_args:Nx\tl_map_inline:nn{#1}
     {\tl_if_blank:nTF{##1}
       {}
       {\g_tmpa_cs:n{\__mathcommand_getbasename:n{##1}}}
     }
}
\cs_new:Nn\__mathcommand_getbasename:n{
      \tl_if_single:nTF{#1}{
         \token_if_cs:NTF#1
            {\cs_to_str:N#1}
            {#1}
      }{#1}
}
\ExplSyntaxOff

\endinput
%%
%% End of file `mathcommand.sty'.
