% \iffalse meta-comment
%
% Copyright (C) 2021-2022 by Jinwen XU
% ------------------------------------
%
% This file may be distributed and/or modified under the conditions of the LaTeX
% Project Public License, either version 1.3c 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
%
% \fi
%
%<*driver>
\ProvidesFile{ProjLib.dtx}
%</driver>
\NeedsTeXFormat{LaTeX2e}[2020-10-01]
\RequirePackage{l3keys2e}
%
%<*ProjLib>
\ProvidesExplPackage
  {ProjLib}
  {2022/03/17} {}
  {Collective interface of the ProjLib toolkit}
%</ProjLib>
%
%<*projlib-author>
\ProvidesExplPackage
  {projlib-author}
  {2022/03/17} {}
  {Enhanced author information block}
%</projlib-author>
%
%<*projlib-datetime>
\ProvidesExplPackage
  {projlib-datetime}
  {2022/03/17} {}
  {Convert numeric date-time string to natural language}
%</projlib-datetime>
%
%<*projlib-draft>
\ProvidesExplPackage
  {projlib-draft}
  {2022/03/17} {}
  {Useful commands during draft stage}
%</projlib-draft>
%
%<*projlib-font>
\ProvidesExplPackage
  {projlib-font}
  {2022/03/17} {}
  {Font selection and configuration}
%</projlib-font>
%
%<*projlib-language>
\ProvidesExplPackage
  {projlib-language}
  {2022/03/17} {}
  {Multi-language configuration}
%</projlib-language>
%
%<*projlib-logo>
\ProvidesExplPackage
  {projlib-logo}
  {2022/03/17} {}
  {The ProjLib logo}
%</projlib-logo>
%
%<*projlib-math>
\ProvidesExplPackage
  {projlib-math}
  {2022/03/17} {}
  {Efficient math setup}
%</projlib-math>
%
%<*projlib-paper>
\ProvidesExplPackage
  {projlib-paper}
  {2022/03/17} {}
  {Configuration of the paper style}
%</projlib-paper>
%
%<*projlib-theorem>
\ProvidesExplPackage
  {projlib-theorem}
  {2022/03/17} {}
  {Configuration of theorem-like environments}
%</projlib-theorem>

%<*ProjLib>
\keys_define:nn { ProjLib }
  {
    , author          .bool_set:N         = \l__projlib_main_author_bool
    , author          .initial:n          = { false }
    , author-block    .bool_set:N         = \l__projlib_main_author_bool
    , author~block    .bool_set:N         = \l__projlib_main_author_bool
    , author block    .bool_set:N         = \l__projlib_main_author_bool
    , ams-fashion     .bool_set:N         = \l__projlib_main_amsfashion_bool
    , ams-fashion     .initial:n          = { false }
    , ams~fashion     .bool_set:N         = \l__projlib_main_amsfashion_bool
    , ams fashion     .bool_set:N         = \l__projlib_main_amsfashion_bool
    , unknown         .code:n             = {
                                              \PassOptionsToPackage { \CurrentOption } { projlib-language }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-author }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-datetime }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-draft }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-font }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-logo }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-math }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-paper }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-theorem }
                                            }
  }
\ProcessKeysOptions { ProjLib }

\bool_if:NT \l__projlib_main_amsfashion_bool
  {
    \bool_set_true:N \l__projlib_main_author_bool
    \PassOptionsToPackage { amsfashion } { projlib-author }
  }

\RequirePackage { projlib-language }

\bool_if:NT \l__projlib_main_author_bool
  {
    \RequirePackage { projlib-author }
  }
\RequirePackage { projlib-datetime }
\RequirePackage { projlib-draft }
\RequirePackage { projlib-font }
\RequirePackage { projlib-logo }
\RequirePackage { projlib-math }
\RequirePackage { projlib-paper }

\RequirePackage { projlib-theorem }
%</ProjLib>
%
%<*projlib-author>
\keys_define:nn { projlib-author }
  {
    , ams-fashion .bool_set:N = \l__projlib_author_amsfashion_bool
    , ams-fashion .initial:n  = { false }
    , ams~fashion .bool_set:N = \l__projlib_author_amsfashion_bool
    , ams fashion .bool_set:N = \l__projlib_author_amsfashion_bool
    , unknown     .code:n     = {}
  }
\ProcessKeysOptions { projlib-author }

\cs_if_exist:NT \subjclass { \endinput }

\tl_new:N   \g__projlib_author_font_author_tl
\tl_new:N   \g__projlib_author_font_institute_tl
\tl_new:N   \g__projlib_author_font_address_tl
\tl_new:N   \g__projlib_author_font_curraddr_tl
\tl_new:N   \g__projlib_author_font_email_tl

\tl_gset:Nn \g__projlib_author_font_author_tl      { \normalsize \normalfont \scshape }
\tl_gset:Nn \g__projlib_author_font_institute_tl   { \small \normalfont }
\tl_gset:Nn \g__projlib_author_font_address_tl     { \small \normalfont \itshape }
\tl_gset:Nn \g__projlib_author_font_curraddr_tl    { \small \normalfont \itshape }
\tl_gset:Nn \g__projlib_author_font_email_tl       { \small \normalfont \ttfamily }

\dim_new:N  \g__projlib_author_length_innersep_dim
\dim_new:N  \g__projlib_author_length_sep_dim
\dim_new:N  \g__projlib_author_length_aftersep_dim

\dim_set:Nn \g__projlib_author_length_innersep_dim { 0.3 \baselineskip }
\dim_set:Nn \g__projlib_author_length_sep_dim      { 0.5 \baselineskip }
\dim_set:Nn \g__projlib_author_length_aftersep_dim { 0.3 \baselineskip }


\bool_new:N \g__projlib_author_affil_already_exist_bool

\NewCommandCopy \projlib_author_backup_author:w \author
\RenewDocumentCommand \author { m }
  {
    \hook_gput_code:nnn { cmd/@author/after } { projlib-author }
      {
        \phantom {A} \\[-\baselineskip]
        \skip_vertical:n { \g__projlib_author_length_sep_dim }
        { \g__projlib_author_font_author_tl #1 }
        \bool_set_false:N \g__projlib_author_affil_already_exist_bool
        \\ \phantom {}
      }
  }

\cs_new_protected:Nn \projlib_author_affil_generic:nn
  % #1 = the item
  % #2 = the text
  {
    \hook_gput_code:nnn { cmd/@author/after } { projlib-author }
      {
        \phantom {A} \\[-.85\baselineskip]
        \bool_if:NF \g__projlib_author_affil_already_exist_bool
          {
            \skip_vertical:n { \g__projlib_author_length_innersep_dim }
          }
        \bool_set_true:N \g__projlib_author_affil_already_exist_bool
        { \use:c { g__projlib_author_font_ #1 _tl } #2 }
        \\ \phantom {}
      }
  }

\ProvideDocumentCommand \institute { m }
  {
    \projlib_author_affil_generic:nn { institute } { #1 }
  }

\ProvideDocumentCommand \address { m }
  {
    \projlib_author_affil_generic:nn { address } { #1 }
  }

\ProvideDocumentCommand \curraddr { m }
  {
    \projlib_author_affil_generic:nn { curraddr } { #1 }
  }

\ProvideDocumentCommand \email { m }
  {
    \projlib_author_affil_generic:nn { email } { #1 }
  }

\RequirePackage { regexpatch }

\xpatchcmd { \@maketitle } { \begin{tabular}[t]{c} } {}
  {
    \xpatchcmd { \@maketitle } { \end{tabular} } {} {} {}
  } {}

\tl_set:cn {@author} {}

\hook_gput_code:nnn { cmd/@maketitle/before } { projlib-author }
  {
    \hook_gput_code:nnn { cmd/@author/before } { projlib-author }
      {
        \skip_vertical:n { - \g__projlib_author_length_sep_dim }
      }
    \hook_gput_code:nnn { cmd/@author/after } { projlib-author }
      {
        \skip_vertical:n { - \baselineskip }
        \bool_if:NT \g__projlib_author_affil_already_exist_bool
          {
            \skip_vertical:n { \g__projlib_author_length_aftersep_dim }
          }
      }
  }

\bool_if:NT \l__projlib_author_amsfashion_bool
  {
    \RequirePackage{ projlib-language }

    \tl_new:N   \g_projlib_author_keywordsname_style_tl
    \tl_gset:Nn \g_projlib_author_keywordsname_style_tl { \itshape }

    \projlib_langauge_define_multilingual_text:Nn \keywordsname
      {
        EN = Key~words~and~phrases                  ,
        FR = Mots~et~phrases~clés                   ,
        DE = Schlüsselwörter~und~Phrasen            ,
        IT = Parole~e~frasi~chiave                  ,
        PT = Palavras~e~frases~chave                ,
        BR = Palavras~e~frases~chave                ,
        ES = Palabras~y~frases~clave                ,
        CN = 关键词                                 ,
        TC = 關鍵詞                                 ,
        JP = キーワード                             ,
        RU = Ключевые~слова~и~фразы                 ,
      }

    \tl_new:N \g__projlib_author_keywords_tl
    \NewDocumentCommand \keywords { m }
      {
        \tl_gset:Nn \g__projlib_author_keywords_tl { #1 }
      }

    \tl_new:N \g__projlib_author_dedicatory_tl
    \NewDocumentCommand \dedicatory { m }
      {
        \tl_gset:Nn \g__projlib_author_dedicatory_tl { #1 }
      }

    \hook_gput_code:nnn { begindocument/before } { projlib-author }
      {
        \NewCommandCopy \projlib_author_backup_footnotemark: \footnotemark
        \tl_gset:Nn \footnotemark {}

        \NewCommandCopy \projlib_author_backup_thanks:w \thanks
        \cs_undefine:N \thanks

        % measure the width of "*"
        \hbox_set:Nn \l_tmpa_box { * }
        \dim_const:Nn \c__projlib_author_length_width_of_asterisk_dim { \box_wd:N \l_tmpa_box }

        \cs_new_nopar:Nn \projlib_author_pre_thanks:n
          {
            \projlib_author_backup_thanks:w
              {
                \skip_horizontal:n { - \c__projlib_author_length_width_of_asterisk_dim }
                #1
              }
          }

        \NewDocumentCommand \thanks { m }
          {
            \tl_if_blank:nF { #1 }
              {
                \hook_gput_code:nnn { cmd/@title/after } { projlib-author }
                  {
                    \projlib_author_pre_thanks:n { #1 }
                  }
              }
          }

        \NewCommandCopy \projlib_author_backup_my_author:w \author
        \RenewDocumentCommand \author { m }
          {
            \projlib_author_backup_my_author:w
              {
                \RenewCommandCopy \footnotemark \projlib_author_backup_footnotemark:
                \RenewCommandCopy \thanks \projlib_author_backup_thanks:w
                #1
                \cs_undefine:N \footnotemark
              }
          }
      }

    \NewCommandCopy \projlib_author_backup_abstract: \abstract
    \NewCommandCopy \projlib_author_backup_endabstract: \endabstract
    \cs_undefine:N \abstract
    \cs_undefine:N \endabstract

    \bool_new:N \g__projlib_author_already_maketitle_bool
    \bool_gset_false:N \g__projlib_author_already_maketitle_bool
    \bool_new:N \g__projlib_author_abstract_before_maketitle_bool
    \bool_gset_false:N \g__projlib_author_abstract_before_maketitle_bool

    \msg_redirect_name:nnn { scontents } { unsupported-verbatim } { info }
    \RequirePackage{ scontents }
    \newenvsc{abstract}[store-env=projlib-author-abstract,print-env=false]

    \hook_gput_code:nnn { env/abstract/after } { projlib-author }
      {
        \bool_if:NTF \g__projlib_author_already_maketitle_bool
          {
            \group_begin:
            \projlib_author_backup_abstract:
              \getstored{projlib-author-abstract}
            \projlib_author_backup_endabstract:
            \group_end:
          }
          {
            \bool_gset_true:N \g__projlib_author_abstract_before_maketitle_bool
          }
      }

    \hook_gput_code:nnn { begindocument/before } { projlib-author }
      {
        \makeatletter
        \xpatchcmd { \@maketitle } { \@date }
          {
            \tl_if_blank:eTF { \@date } { \skip_vertical:n { -2 \baselineskip } } { \@date }
            \tl_if_blank:eF { \g__projlib_author_dedicatory_tl }
              {
                \tl_if_blank:eT { \@date } { \skip_vertical:n { 2 \baselineskip } }
                \par
                \skip_vertical:n { -\parskip }
                \skip_vertical:n { \baselineskip }
                \textit{ \g__projlib_author_dedicatory_tl }
                \tl_if_blank:eT { \@date }
                  {
                    \skip_vertical:n { -\parskip }
                    \skip_vertical:n { \dim_eval:n { -1.7 \baselineskip } }
                  }
              }
          } {} {}
        \makeatother

        \hook_gput_code:nnn { cmd/maketitle/before } { projlib-author }
          {
            \tl_if_blank:eF { \g__projlib_author_keywords_tl }
              {
                \projlib_author_pre_thanks:n
                  {
                    \group_begin:
                      \g_projlib_author_keywordsname_style_tl
                      \keywordsname .
                    \group_end:
                    \c_space_tl
                    \g__projlib_author_keywords_tl
                  }
              }
          }

        \hook_gput_code:nnn { cmd/maketitle/after } { projlib-author }
          {
            \bool_if:NT \g__projlib_author_abstract_before_maketitle_bool
              {
                \group_begin:
                \projlib_author_backup_abstract:
                  \getstored{projlib-author-abstract}
                \projlib_author_backup_endabstract:
                \group_end:
              }
            \cs_undefine:N \institute
            \cs_undefine:N \address
            \cs_undefine:N \curraddr
            \cs_undefine:N \email
            \cs_undefine:N \dedicatory
            \cs_undefine:N \keywords
            \bool_gset_true:N \g__projlib_author_already_maketitle_bool
          }
      }

      \tl_new:N \l_projlib_author_subjclassname_tl
      \tl_new:N \l_projlib_author_subjclass_tl
      \msg_new:nnn { projlib-author }
        { unknown-msc-edition }
        { Unknown~edition~(#1)~of~Mathematics~Subject~Classification;~using~'2020' }
      \NewDocumentCommand \subjclass { O{2020} m }
        {
          \tl_set:Nn \l_projlib_author_subjclass_tl { #2 }
          \tl_if_exist:cTF { subjclassname_#1 }
            {
              \tl_set:Nn \l_projlib_author_subjclassname_tl { \tl_use:c { subjclassname_#1 } }
            }
            {
              \msg_warning:nnn { projlib-author } { unknown-msc-edition } { #1 }
              \tl_set:Nn \l_projlib_author_subjclassname_tl { \tl_use:c { subjclassname_2020 } }
            }
          \projlib_author_pre_thanks:n
            {
              \textit{ \l_projlib_author_subjclassname_tl . }
              \enspace
              \l_projlib_author_subjclass_tl .
            }
        }
      \tl_const:cn { subjclassname_1991 } { \textup{1991}~Mathematics~Subject~Classification }
      \tl_const:cn { subjclassname_2000 } { \textup{2000}~Mathematics~Subject~Classification }
      \tl_const:cn { subjclassname_2010 } { \textup{2010}~Mathematics~Subject~Classification }
      \tl_const:cn { subjclassname_2020 } { \textup{2020}~Mathematics~Subject~Classification }
  }
%</projlib-author>
%
%<*projlib-datetime>
\tl_new:N   \g__projlib_datetime_input_format_tl
\tl_gset:Nn \g__projlib_datetime_input_format_tl { year-month-day }

\keys_define:nn { projlib-datetime }
  {
    , plain           .bool_set:N   = \l__projlib_datetime_plain_bool
    , plain           .initial:n    = { false }
    , year-month-day  .code:n       = { \tl_gset:Nn \g__projlib_datetime_input_format_tl { year-month-day } }
    , month-day-year  .code:n       = { \tl_gset:Nn \g__projlib_datetime_input_format_tl { month-day-year } }
    , day-month-year  .code:n       = { \tl_gset:Nn \g__projlib_datetime_input_format_tl { day-month-year } }
    , year-month      .code:n       = { \tl_gset:Nn \g__projlib_datetime_input_format_tl { year-month-day } }
    , month-day       .code:n       = { \tl_gset:Nn \g__projlib_datetime_input_format_tl { year-month-day } }
    , month-year      .code:n       = { \tl_gset:Nn \g__projlib_datetime_input_format_tl { day-month-year } }
    , day-month       .code:n       = { \tl_gset:Nn \g__projlib_datetime_input_format_tl { day-month-year } }
    , unknown         .code:n       = {}
  }
\ProcessKeysOptions { projlib-datetime }

\bool_if:NT \l__projlib_datetime_plain_bool
  {
    \hook_gput_code:nnn { begindocument/before } { projlib-datetime }
      {
        \cs_set:Nn \projlib_datetime_text_superscript:n { #1 }
      }
  }

\tl_new:N \l__projlib_datetime_output_format_tl
\keys_define:nn { projlib-datetime-command }
  {
    , year-month-day  .code:n       = { \tl_set:Nn \g__projlib_datetime_input_format_tl { year-month-day } }
    , month-day-year  .code:n       = { \tl_set:Nn \g__projlib_datetime_input_format_tl { month-day-year } }
    , day-month-year  .code:n       = { \tl_set:Nn \g__projlib_datetime_input_format_tl { day-month-year } }
    , year-month      .code:n       = { \tl_set:Nn \g__projlib_datetime_input_format_tl { year-month-day } }
    , month-day       .code:n       = { \tl_set:Nn \g__projlib_datetime_input_format_tl { year-month-day } }
    , month-year      .code:n       = { \tl_set:Nn \g__projlib_datetime_input_format_tl { day-month-year } }
    , day-month       .code:n       = { \tl_set:Nn \g__projlib_datetime_input_format_tl { day-month-year } }
    , only-year-month .code:n       = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-year-month } }
    , only-month-day  .code:n        = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-month-day } }
    , only-year       .code:n        = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-year } }
    , only-month      .code:n        = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-month } }
    , only-day        .code:n        = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-day } }
    , unknown         .code:n       = {}
  }

\msg_new:nnnn { projlib-datetime }
  { non-supported-date-format }
  { The~date~format~"#1"~is~not~supported. }
  { The~only~formats~available~are~"year-month-day",~ "month-day-year"~and~"day-month-year". }

\cs_new:Nn \projlib_datetime_set_input_format:n
  {
    \str_case:nnF { #1 }
      {
        { year-month-day } { \tl_gset:Nn \g__projlib_datetime_input_format_tl { year-month-day } }
        { month-day-year } { \tl_gset:Nn \g__projlib_datetime_input_format_tl { month-day-year } }
        { day-month-year } { \tl_gset:Nn \g__projlib_datetime_input_format_tl { day-month-year } }
      }
      {
        \msg_error:nnn  { projlib-datetime } { non-supported-date-format } { #1 }
      }
  }

\NewDocumentCommand \ProjLibSetDatetimeInputFormat { m }
  {
    \projlib_datetime_set_input_format:n { #1 }
  }


\seq_new:N \l__projlib_datetime_date_seq

\cs_new_protected:Nn \projlib_datetime_text_superscript:n
  {
    \group_begin:
      \small
      \textsuperscript { #1 }
    \group_end:
  }


\cs_new:Nn \__projlib_datetime_today:n
  {
    \str_case_e:nnF { \l__projlib_datetime_output_format_tl }
        {
          { only-year-month }
            {
              \cs_if_exist_use:c { projlib_datetime_display_year_month #1 _ \languagename :nn }
                { \int_use:N \c_sys_year_int }
                { \int_use:N \c_sys_month_int }
            }
          { only-month-day  }
            {
              \cs_if_exist_use:c { projlib_datetime_display_month_day #1 _ \languagename :nn }
                { \int_use:N \c_sys_month_int }
                { \int_use:N \c_sys_day_int }
            }
          { only-year       }
            {
              \cs_if_exist_use:cT { projlib_datetime_display_year #1 _ \languagename :n }
                {
                  { \int_use:N \c_sys_year_int }
                }
            }
          { only-month      }
            {
              \cs_if_exist_use:cT { projlib_datetime_display_month #1 _ \languagename :n }
                {
                  { \int_use:N \c_sys_month_int }
                }
            }
          { only-day        }
            {
              \cs_if_exist_use:cT { projlib_datetime_display_day #1 _ \languagename :n }
                {
                  { \int_use:N \c_sys_day_int }
                }
            }
        }
        {
          \cs_if_exist_use:c { projlib_datetime_display_year_month_day #1 _ \languagename :nnn }
            { \int_use:N \c_sys_year_int }
            { \int_use:N \c_sys_month_int }
            { \int_use:N \c_sys_day_int }
        }
  }

\NewDocumentCommand \ProjLibtoday { O{} }
  {
    \group_begin:
      \keys_set:nn { projlib-datetime-command } { #1 }
      \__projlib_datetime_today:n {}
    \group_end:
  }

\NewDocumentCommand \ProjLibToday { O{} }
  {
    \group_begin:
      \keys_set:nn { projlib-datetime-command } { #1 }
      \__projlib_datetime_today:n { _uppercase }
    \group_end:
  }


\cs_new_protected:Nn \projlib_datetime_display_year_month_day:n
  {
    \__projlib_datetime_display_year_month_day:en { #1 } {}
  }

\cs_new_protected:Nn \projlib_datetime_display_year_month_day_uppercase:n
  {
    \__projlib_datetime_display_year_month_day:en { #1 } { _uppercase }
  }

\cs_new_protected:Nn \__projlib_datetime_display_year_month_day:nn
  {
    \regex_match:nnTF { \A \d{4}-\d{1,2}-\d{1,2} \Z } { #1 }
      {
        \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
        \cs_if_exist_use:c { projlib_datetime_display_year_month_day #2 _ \languagename :nnn }
          { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % year
          { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % month
          { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 3 } } } % day
      }
      {
        \regex_match:nnTF { \A \d{4}-\d{1,2} \Z } { #1 }
          {
            \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
            \cs_if_exist_use:c { projlib_datetime_display_year_month #2 _ \languagename :nn }
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % year
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % month
          }
          {
            \regex_match:nnTF { \A \d{1,2}-\d{1,2} \Z } { #1 }
              {
                \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
                \cs_if_exist_use:c { projlib_datetime_display_month_day #2 _ \languagename :nn }
                  { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % month
                  { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % day
              }
              {
                #1
              }
          }
      }
  }
\cs_generate_variant:Nn \__projlib_datetime_display_year_month_day:nn { en }


\cs_new_protected:Nn \projlib_datetime_display_month_day_year:n
{
  \__projlib_datetime_display_month_day_year:en { #1 } {}
}

\cs_new_protected:Nn \projlib_datetime_display_month_day_year_uppercase:n
{
  \__projlib_datetime_display_month_day_year:en { #1 } { _uppercase }
}

\cs_new_protected:Nn \__projlib_datetime_display_month_day_year:nn
{
  \regex_match:nnTF { \A \d{1,2}-\d{1,2}-\d{4} \Z } { #1 }
    {
      \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
      \cs_if_exist_use:c { projlib_datetime_display_month_day_year #2 _ \languagename :nnn }
        { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 3 } } } % year
        { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % month
        { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % day
    }
    {
      \regex_match:nnTF { \A \d{1,2}-\d{4} \Z } { #1 }
        {
          \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
          \cs_if_exist_use:c { projlib_datetime_display_year_month #2 _ \languagename :nn }
            { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % year
            { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % month
        }
        {
          \regex_match:nnTF { \A \d{1,2}-\d{1,2} \Z } { #1 }
            {
              \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
              \cs_if_exist_use:c { projlib_datetime_display_month_day #2 _ \languagename :nn }
                { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % month
                { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % day
            }
            {
              #1
            }
        }
    }
}
\cs_generate_variant:Nn \__projlib_datetime_display_month_day_year:nn { en }


\cs_new_protected:Nn \projlib_datetime_display_day_month_year:n
{
  \__projlib_datetime_display_day_month_year:en { #1 } {}
}

\cs_new_protected:Nn \projlib_datetime_display_day_month_year_uppercase:n
{
  \__projlib_datetime_display_day_month_year:en { #1 } { _uppercase }
}

\cs_new_protected:Nn \__projlib_datetime_display_day_month_year:nn
{
  \regex_match:nnTF { \A \d{1,2}-\d{1,2}-\d{4} \Z } { #1 }
    {
      \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
      \cs_if_exist_use:c { projlib_datetime_display_day_month_year #2 _ \languagename :nnn }
        { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 3 } } } % year
        { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % month
        { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % day
    }
    {
      \regex_match:nnTF { \A \d{1,2}-\d{4} \Z } { #1 }
        {
          \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
          \cs_if_exist_use:c { projlib_datetime_display_year_month #2 _ \languagename :nn }
            { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % year
            { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % month
        }
        {
          \regex_match:nnTF { \A \d{1,2}-\d{1,2} \Z } { #1 }
            {
              \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
              \cs_if_exist_use:c { projlib_datetime_display_month_day #2 _ \languagename :nn }
                { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } } % month
                { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } } % day
            }
            {
              #1
            }
        }
    }
}
\cs_generate_variant:Nn \__projlib_datetime_display_day_month_year:nn { en }


\cs_new_protected:Nn \__projlib_datetime_date_parse_year_month_day:n
  {
    \regex_match:nnTF { \A \d{4}-\d{1,2}(|-\d{1,2}) \Z } { #1 }
      {
        \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
      }
      {
        \regex_match:nnT { \A \d{1,2}-\d{1,2} \Z } { #1 }
          {
            \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
            \seq_put_left:Nn \l__projlib_datetime_date_seq {}
          }
      }
  }

\cs_new_protected:Nn \__projlib_datetime_date_parse_month_day_year:n
  {
    \regex_match:nnTF { \A \d{1,2}(|-\d{1,2})-\d{4} \Z } { #1 }
      {
        \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
        \seq_pop_right:NN \l__projlib_datetime_date_seq \l_tmpa_tl
        \seq_put_left:NV \l__projlib_datetime_date_seq \l_tmpa_tl
      }
      {
        \regex_match:nnT { \A \d{1,2}-\d{1,2} \Z } { #1 }
          {
            \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
            \seq_put_left:Nn \l__projlib_datetime_date_seq {}
          }
      }
  }

\cs_new_protected:Nn \__projlib_datetime_date_parse_day_month_year:n
  {
    \regex_match:nnTF { \A \d{1,2}(|-\d{1,2})-\d{4} \Z } { #1 }
      {
        \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
        \seq_reverse:N \l__projlib_datetime_date_seq
      }
      {
        \regex_match:nnT { \A \d{1,2}-\d{1,2} \Z } { #1 }
          {
            \seq_set_split:Nnn \l__projlib_datetime_date_seq { - } { #1 }
            \seq_reverse:N \l__projlib_datetime_date_seq
            \seq_put_left:Nn \l__projlib_datetime_date_seq {}
          }
      }
  }

\cs_new:Nn \__projlib_datetime_input_format_to_str:
  {
    \str_case_e:nn { \g__projlib_datetime_input_format_tl }
      {
        { year-month-day } { year_month_day }
        { month-day-year } { month_day_year }
        { day-month-year } { day_month_year }
      }
  }

\cs_new_protected:Nn \__projlib_datetime_display_date_according_to_format:nn
  {
    \cs_if_exist_use:c { __projlib_datetime_date_parse_ \__projlib_datetime_input_format_to_str: :n } { #1 }
    \str_case_e:nnF { \l__projlib_datetime_output_format_tl }
      {
        { only-year-month }
          {
            \cs_if_exist_use:c { projlib_datetime_display_year_month #2 _ \languagename :nn }
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } }
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } }
          }
        { only-month-day  }
          {
            \cs_if_exist_use:c { projlib_datetime_display_month_day #2 _ \languagename :nn }
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } }
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 3 } } }
          }
        { only-year       }
          {
            \cs_if_exist_use:c { projlib_datetime_display_year #2 _ \languagename :n }
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } }
          }
        { only-month      }
          {
            \cs_if_exist_use:c { projlib_datetime_display_month #2 _ \languagename :n }
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } }
          }
        { only-day        }
          {
            \cs_if_exist_use:c { projlib_datetime_display_day #2 _ \languagename :n }
              { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 3 } } }
          }
      }
      {
        \cs_if_exist_use:c { projlib_datetime_display_ \__projlib_datetime_input_format_to_str: #2 :n } { #1 }
      }
  }

\NewDocumentCommand \ProjLibdate { O{} m O{} }
  {
    \group_begin:
      \tl_if_blank:eF { #1 } { \keys_set:nn { projlib-datetime-command } { #1 } }
      \tl_if_blank:eF { #3 } { \keys_set:nn { projlib-datetime-command } { #3 } }
      \tl_set:Nx \l_tmpa_tl { #2 }
      \regex_replace_all:nnN { \D } { - } \l_tmpa_tl
      \exp_args:Ne \__projlib_datetime_display_date_according_to_format:nn { \l_tmpa_tl } {}
    \group_end:
  }

  \NewDocumentCommand \ProjLibDate { O{} m O{} }
  {
    \group_begin:
      \tl_if_blank:eF { #1 } { \keys_set:nn { projlib-datetime-command } { #1 } }
      \tl_if_blank:eF { #3 } { \keys_set:nn { projlib-datetime-command } { #3 } }
      \tl_set:Nx \l_tmpa_tl { #2 }
      \regex_replace_all:nnN { \D } { - } \l_tmpa_tl
      \exp_args:Ne \__projlib_datetime_display_date_according_to_format:nn { \l_tmpa_tl } { _uppercase }
    \group_end:
  }

\ProvideDocumentCommand \Thedate {} { \ProjLibdate }
\ProvideDocumentCommand \TheDate {} { \ProjLibDate }


\int_new:N \l__projlib_datetime_day_of_week_day_int
\int_new:N \l__projlib_datetime_day_of_week_month_int
\int_new:N \l__projlib_datetime_day_of_week_year_int
\int_new:N \l__projlib_datetime_day_of_week_century_int
\int_new:N \l__projlib_datetime_day_of_week_result_int
\cs_new:Nn \__projlib_datetime_calculate_day_of_week_with_year_month_day:nnn
  {
    \int_set:Nn \l__projlib_datetime_day_of_week_day_int { #3 }
    \int_compare:nNnTF { #2 } < { 3 }
      {
        \int_set:Nn \l__projlib_datetime_day_of_week_year_int { \int_eval:n { #1 - 1 } }
      }
      {
        \int_set:Nn \l__projlib_datetime_day_of_week_year_int { #1 }
      }
    \int_set:Nn \l__projlib_datetime_day_of_week_century_int { \int_eval:n { \l__projlib_datetime_day_of_week_year_int / 100 } }
    \int_set:Nn \l__projlib_datetime_day_of_week_year_int { \int_mod:nn { \l__projlib_datetime_day_of_week_year_int } { 100 } }
    \int_set:Nn \l__projlib_datetime_day_of_week_month_int
      {
        \int_case:nnF { #2 }
          {
            {  1 } { 0 }
            {  2 } { 3 }
            {  3 } { 2 }
            {  4 } { 5 }
            {  5 } { 0 }
            {  6 } { 3 }
            {  7 } { 5 }
            {  8 } { 1 }
            {  9 } { 4 }
            { 10 } { 6 }
            { 11 } { 2 }
            { 12 } { 4 }
          }        { 0 }
      }
    \int_set:Nn \l__projlib_datetime_day_of_week_result_int
      {
        \int_eval:n
          {
              \l__projlib_datetime_day_of_week_day_int
            + \l__projlib_datetime_day_of_week_month_int
            +\l__projlib_datetime_day_of_week_year_int
            + \int_div_truncate:nn { \l__projlib_datetime_day_of_week_year_int } { 4 }
            + \int_div_truncate:nn { \l__projlib_datetime_day_of_week_century_int } { 4 }
            - 2 * \l__projlib_datetime_day_of_week_century_int
          }
      }
    \int_set:Nn \l__projlib_datetime_day_of_week_result_int
      {
        \int_mod:nn { \l__projlib_datetime_day_of_week_result_int } { 7 }
      }
    \int_compare:nNnT { \l__projlib_datetime_day_of_week_result_int } < { 1 }
      {
        \int_set:Nn \l__projlib_datetime_day_of_week_result_int
          {
            \int_eval:n { \l__projlib_datetime_day_of_week_result_int + 7 }
          }
      }
  }


\cs_new_protected:Nn \projlib_datetime_display_week:n
  {
    \__projlib_datetime_display_week_according_to_format:en { #1 } {}
  }

\cs_new_protected:Nn \projlib_datetime_display_week_uppercase:n
  {
    \__projlib_datetime_display_week_according_to_format:en { #1 } { _uppercase }
  }

\cs_new_protected:Nn \__projlib_datetime_display_week_according_to_format:nn
  {
    \projlib_datetime_calculate_week_according_to_format:n { #1 }
    \cs_if_exist_use:c { projlib_datetime_display_week #2 _ \languagename :n } { \l__projlib_datetime_day_of_week_result_int }
  }
\cs_generate_variant:Nn \__projlib_datetime_display_week_according_to_format:nn { en }


\cs_new_protected:Nn \projlib_datetime_calculate_week_according_to_format:n
  {
    \cs_if_exist_use:c { __projlib_datetime_date_parse_ \__projlib_datetime_input_format_to_str: :n } { #1 }
    \__projlib_datetime_calculate_day_of_week_with_year_month_day:nnn
      { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 1 } } }
      { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 2 } } }
      { \int_eval:n { \seq_item:Nn \l__projlib_datetime_date_seq { 3 } } }
  }


% For each language, there are 7 groups of functions:
% 1) \projlib_datetime_display_year_month_day_<languagename>:nnn
%    \projlib_datetime_display_year_month_day_uppercase_<languagename>:nnn
% 2) \projlib_datetime_display_year_month_<languagename>:nn
%    \projlib_datetime_display_year_month_uppercase_<languagename>:nn
% 3) \projlib_datetime_display_month_day_<languagename>:nn
%    \projlib_datetime_display_month_day_uppercase_<languagename>:nn
% 4) \projlib_datetime_display_year_<languagename>:n
%    \projlib_datetime_display_year_uppercase_<languagename>:n
% 5) \projlib_datetime_display_month_<languagename>:n
%    \projlib_datetime_display_month_uppercase_<languagename>:n
% 6) \projlib_datetime_display_day_<languagename>:n
%    \projlib_datetime_display_day_uppercase_<languagename>:n
% 7) \projlib_datetime_display_week_<languagename>:n
%    \projlib_datetime_display_week_uppercase_<languagename>:n

\cs_new:Nn \projlib_datetime_display_year_month_day_english:nnn
  {
    \projlib_datetime_display_month_day_english:nn { #2 } { #3 }
    ,\nobreakspace
    \projlib_datetime_display_year_english:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_english:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_english:nnn
  {
    \projlib_datetime_display_month_day_uppercase_english:nn { #2 } { #3 }
    ,\nobreakspace
    \projlib_datetime_display_year_english:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_english:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_english:nn
  {
    \projlib_datetime_display_month_english:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_english:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_english:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_english:nn
  {
    \projlib_datetime_display_month_uppercase_english:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_english:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_english:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_english:nn
  {
    \projlib_datetime_display_month_english:n { #1 }
    \nobreakspace
    \projlib_datetime_display_day_english:n { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_english:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_english:nn
  {
    \projlib_datetime_display_month_uppercase_english:n { #1 }
    \nobreakspace
    \projlib_datetime_display_day_english:n { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_english:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_english:n { #1 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_english:n { #1 }

\cs_new:Nn \projlib_datetime_display_month_english:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { January   }
        { 2 }  { February  }
        { 3 }  { March     }
        { 4 }  { April     }
        { 5 }  { May       }
        { 6 }  { June      }
        { 7 }  { July      }
        { 8 }  { August    }
        { 9 }  { September }
        { 10 } { October   }
        { 11 } { November  }
        { 12 } { December  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_month_uppercase_english:n
  {
    \projlib_datetime_display_month_english:n { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_english:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_english:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_english:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Monday    }
        { 2 }  { Tuesday   }
        { 3 }  { Wednesday }
        { 4 }  { Thursday  }
        { 5 }  { Friday    }
        { 6 }  { Saturday  }
        { 7 }  { Sunday    }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_english:n
  {
    \projlib_datetime_display_week_english:n { #1 }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_french:nnn
  {
    \projlib_datetime_display_month_day_french:nn { #2 } { #3 }
    \nobreakspace
    \projlib_datetime_display_year_french:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_french:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_french:nnn
  {
    \projlib_datetime_display_month_day_uppercase_french:nn { #2 } { #3 }
    \nobreakspace
    \projlib_datetime_display_year_french:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_french:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_french:nn
  {
    \projlib_datetime_display_month_french:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_french:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_french:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_french:nn
  {
    \projlib_datetime_display_month_uppercase_french:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_french:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_french:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_french:nn
  {
    \projlib_datetime_display_day_french:n { #2 }
    \nobreakspace
    \projlib_datetime_display_month_french:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_french:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_french:nn
  {
    \projlib_datetime_display_month_day_french:nn { #1 } { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_french:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_french:n { #1 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_french:n { #1 }

\cs_new:Nn \projlib_datetime_display_month_french:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { janvier   }
        { 2 }  { février   }
        { 3 }  { mars      }
        { 4 }  { avril     }
        { 5 }  { mai       }
        { 6 }  { juin      }
        { 7 }  { juillet   }
        { 8 }  { août      }
        { 9 }  { septembre }
        { 10 } { octobre   }
        { 11 } { novembre  }
        { 12 } { décembre  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_month_uppercase_french:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Janvier   }
        { 2 }  { Février   }
        { 3 }  { Mars      }
        { 4 }  { Avril     }
        { 5 }  { Mai       }
        { 6 }  { Juin      }
        { 7 }  { Juillet   }
        { 8 }  { Août      }
        { 9 }  { Septembre }
        { 10 } { Octobre   }
        { 11 } { Novembre  }
        { 12 } { Décembre  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_french:n
  {
    \int_case:nnF { #1 }
      {
        { 1 } { 1 \projlib_datetime_text_superscript:n { er } }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_uppercase_french:n
  {
    \int_case:nnF { #1 }
      {
        { 1 } { 1 \projlib_datetime_text_superscript:n { er } }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_week_french:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { lundi    }
        { 2 }  { mardi    }
        { 3 }  { mercredi }
        { 4 }  { jeudi    }
        { 5 }  { vendredi }
        { 6 }  { samedi   }
        { 7 }  { dimanche }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_french:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Lundi    }
        { 2 }  { Mardi    }
        { 3 }  { Mercredi }
        { 4 }  { Jeudi    }
        { 5 }  { Vendredi }
        { 6 }  { Samedi   }
        { 7 }  { Dimanche }
      } { ??? }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_ngerman:nnn
  {
    \projlib_datetime_display_month_day_ngerman:nn { #2 } { #3 }
    \nobreakspace
    \projlib_datetime_display_year_ngerman:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_ngerman:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_ngerman:nnn
  {
    \projlib_datetime_display_month_day_uppercase_ngerman:nn { #2 } { #3 }
    \nobreakspace
    \projlib_datetime_display_year_ngerman:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_ngerman:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_ngerman:nn
  {
    \projlib_datetime_display_month_ngerman:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_ngerman:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_ngerman:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_ngerman:nn
  {
    \projlib_datetime_display_month_uppercase_ngerman:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_ngerman:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_ngerman:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_ngerman:nn
  {
    \projlib_datetime_display_day_ngerman:n { #2 }
    .\nobreakspace
    \projlib_datetime_display_month_ngerman:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_ngerman:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_ngerman:nn
  {
    \projlib_datetime_display_month_day_ngerman:nn { #1 } { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_ngerman:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_ngerman:n { #1 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_ngerman:n { #1 }

\cs_new:Nn \projlib_datetime_display_month_ngerman:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Januar    }
        { 2 }  { Februar   }
        { 3 }  { März      }
        { 4 }  { April     }
        { 5 }  { Mai       }
        { 6 }  { Juni      }
        { 7 }  { Juli      }
        { 8 }  { August    }
        { 9 }  { September }
        { 10 } { Oktober   }
        { 11 } { November  }
        { 12 } { Dezember  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_month_uppercase_ngerman:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Januar    }
        { 2 }  { Februar   }
        { 3 }  { März      }
        { 4 }  { April     }
        { 5 }  { Mai       }
        { 6 }  { Juni      }
        { 7 }  { Juli      }
        { 8 }  { August    }
        { 9 }  { September }
        { 10 } { Oktober   }
        { 11 } { November  }
        { 12 } { Dezember  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_ngerman:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_ngerman:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_ngerman:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Montag     }
        { 2 }  { Dienstag   }
        { 3 }  { Mittwoch   }
        { 4 }  { Donnerstag }
        { 5 }  { Freitag    }
        { 6 }  { Samstag    }
        { 7 }  { Sonntag    }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_ngerman:n
  {
    \projlib_datetime_display_week_ngerman:n { #1 }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_italian:nnn
  {
    \projlib_datetime_display_month_day_italian:nn { #2 } { #3 }
    \nobreakspace
    \projlib_datetime_display_year_italian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_italian:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_italian:nnn
  {
    \projlib_datetime_display_month_day_uppercase_italian:nn { #2 } { #3 }
    \nobreakspace
    \projlib_datetime_display_year_italian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_italian:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_italian:nn
  {
    \projlib_datetime_display_month_italian:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_italian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_italian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_italian:nn
  {
    \projlib_datetime_display_month_uppercase_italian:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_italian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_italian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_italian:nn
  {
    \projlib_datetime_display_day_italian:n { #2 }
    \nobreakspace
    \projlib_datetime_display_month_italian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_italian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_italian:nn
  {
    \projlib_datetime_display_month_day_italian:nn { #1 } { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_italian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_italian:n { #1 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_italian:n { #1 }

\cs_new:Nn \projlib_datetime_display_month_italian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { gennaio   }
        { 2 }  { febbraio  }
        { 3 }  { marzo     }
        { 4 }  { aprile    }
        { 5 }  { maggio    }
        { 6 }  { giugno    }
        { 7 }  { luglio    }
        { 8 }  { agosto    }
        { 9 }  { settembre }
        { 10 } { ottobre   }
        { 11 } { novembre  }
        { 12 } { dicembre  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_month_uppercase_italian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Gennaio   }
        { 2 }  { Febbraio  }
        { 3 }  { Marzo     }
        { 4 }  { Aprile    }
        { 5 }  { Maggio    }
        { 6 }  { Giugno    }
        { 7 }  { Luglio    }
        { 8 }  { Agosto    }
        { 9 }  { Settembre }
        { 10 } { Ottobre   }
        { 11 } { Novembre  }
        { 12 } { Dicembre  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_italian:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_italian:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_italian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { lunedì     }
        { 2 }  { martedì    }
        { 3 }  { mercoledì  }
        { 4 }  { giovedì    }
        { 5 }  { venerdì    }
        { 6 }  { sabato     }
        { 7 }  { domenica   }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_italian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Lunedì     }
        { 2 }  { Martedì    }
        { 3 }  { Mercoledì  }
        { 4 }  { Giovedì    }
        { 5 }  { Venerdì    }
        { 6 }  { Sabato     }
        { 7 }  { Domenica   }
      } { ??? }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_portuguese:nnn
  {
    \projlib_datetime_display_month_day_portuguese:nn { #2 } { #3 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_year_portuguese:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_portuguese:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_portuguese:nnn
  {
    \projlib_datetime_display_month_day_uppercase_portuguese:nn { #2 } { #3 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_year_portuguese:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_portuguese:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_portuguese:nn
  {
    \projlib_datetime_display_month_portuguese:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_portuguese:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_portuguese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_portuguese:nn
  {
    \projlib_datetime_display_month_uppercase_portuguese:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_portuguese:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_portuguese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_portuguese:nn
  {
    \projlib_datetime_display_day_portuguese:n { #2 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_month_uppercase_portuguese:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_portuguese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_portuguese:nn
  {
    \projlib_datetime_display_month_day_portuguese:nn { #1 } { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_portuguese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_portuguese:n { #1 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_portuguese:n { #1 }

\cs_new:Nn \projlib_datetime_display_month_portuguese:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { janeiro   }
        { 2 }  { fevereiro }
        { 3 }  { março     }
        { 4 }  { abril     }
        { 5 }  { maio      }
        { 6 }  { junho     }
        { 7 }  { julho     }
        { 8 }  { agosto    }
        { 9 }  { setembro  }
        { 10 } { outubro   }
        { 11 } { novembro  }
        { 12 } { dezembro  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_month_uppercase_portuguese:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Janeiro   }
        { 2 }  { Fevereiro }
        { 3 }  { Março     }
        { 4 }  { Abril     }
        { 5 }  { Maio      }
        { 6 }  { Junho     }
        { 7 }  { Julho     }
        { 8 }  { Agosto    }
        { 9 }  { Setembro  }
        { 10 } { Outubro   }
        { 11 } { Novembro  }
        { 12 } { Dezembro  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_portuguese:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_portuguese:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_portuguese:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { segunda-feira }
        { 2 }  { terça-feira   }
        { 3 }  { quarta-feira  }
        { 4 }  { quinta-feira  }
        { 5 }  { sexta-feira   }
        { 6 }  { sábado        }
        { 7 }  { domingo       }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_portuguese:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Segunda-feira }
        { 2 }  { Terça-feira   }
        { 3 }  { Quarta-feira  }
        { 4 }  { Quinta-feira  }
        { 5 }  { Sexta-feira   }
        { 6 }  { Sábado        }
        { 7 }  { Domingo       }
      } { ??? }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_brazilian:nnn
  {
    \projlib_datetime_display_month_day_brazilian:nn { #2 } { #3 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_year_brazilian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_brazilian:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_brazilian:nnn
  {
    \projlib_datetime_display_month_day_uppercase_brazilian:nn { #2 } { #3 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_year_brazilian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_brazilian:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_brazilian:nn
  {
    \projlib_datetime_display_month_brazilian:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_brazilian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_brazilian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_brazilian:nn
  {
    \projlib_datetime_display_month_uppercase_brazilian:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_brazilian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_brazilian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_brazilian:nn
  {
    \projlib_datetime_display_day_brazilian:n { #2 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_month_uppercase_brazilian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_brazilian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_brazilian:nn
  {
    \projlib_datetime_display_month_day_brazilian:nn { #1 } { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_brazilian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_brazilian:n { #1 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_brazilian:n { #1 }

\cs_new:Nn \projlib_datetime_display_month_brazilian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { janeiro   }
        { 2 }  { fevereiro }
        { 3 }  { março     }
        { 4 }  { abril     }
        { 5 }  { maio      }
        { 6 }  { junho     }
        { 7 }  { julho     }
        { 8 }  { agosto    }
        { 9 }  { setembro  }
        { 10 } { outubro   }
        { 11 } { novembro  }
        { 12 } { dezembro  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_month_uppercase_brazilian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Janeiro   }
        { 2 }  { Fevereiro }
        { 3 }  { Março     }
        { 4 }  { Abril     }
        { 5 }  { Maio      }
        { 6 }  { Junho     }
        { 7 }  { Julho     }
        { 8 }  { Agosto    }
        { 9 }  { Setembro  }
        { 10 } { Outubro   }
        { 11 } { Novembro  }
        { 12 } { Dezembro  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_brazilian:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_brazilian:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_brazilian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { segunda-feira }
        { 2 }  { terça-feira   }
        { 3 }  { quarta-feira  }
        { 4 }  { quinta-feira  }
        { 5 }  { sexta-feira   }
        { 6 }  { sábado        }
        { 7 }  { domingo       }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_brazilian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Segunda-feira }
        { 2 }  { Terça-feira   }
        { 3 }  { Quarta-feira  }
        { 4 }  { Quinta-feira  }
        { 5 }  { Sexta-feira   }
        { 6 }  { Sábado        }
        { 7 }  { Domingo       }
      } { ??? }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_spanish:nnn
  {
    \projlib_datetime_display_month_day_spanish:nn { #2 } { #3 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_year_spanish:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_spanish:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_spanish:nnn
  {
    \projlib_datetime_display_month_day_uppercase_spanish:nn { #2 } { #3 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_year_spanish:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_spanish:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_spanish:nn
  {
    \projlib_datetime_display_month_spanish:n { #2 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_year_spanish:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_spanish:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_spanish:nn
  {
    \projlib_datetime_display_month_uppercase_spanish:n { #2 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_year_spanish:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_spanish:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_spanish:nn
  {
    \projlib_datetime_display_day_spanish:n { #2 }
    \nobreakspace de \nobreakspace
    \projlib_datetime_display_month_spanish:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_spanish:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_spanish:nn
  {
    \projlib_datetime_display_month_day_spanish:nn { #1 } { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_spanish:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_spanish:n { #1 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_spanish:n { #1 }

\cs_new:Nn \projlib_datetime_display_month_spanish:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { enero      }
        { 2 }  { febrero    }
        { 3 }  { marzo      }
        { 4 }  { abril      }
        { 5 }  { mayo       }
        { 6 }  { junio      }
        { 7 }  { julio      }
        { 8 }  { agosto     }
        { 9 }  { septiembre }
        { 10 } { octubre    }
        { 11 } { noviembre  }
        { 12 } { diciembre  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_month_uppercase_spanish:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Enero      }
        { 2 }  { Febrero    }
        { 3 }  { Marzo      }
        { 4 }  { Abril      }
        { 5 }  { Mayo       }
        { 6 }  { Junio      }
        { 7 }  { Julio      }
        { 8 }  { Agosto     }
        { 9 }  { Septiembre }
        { 10 } { Octubre    }
        { 11 } { Noviembre  }
        { 12 } { Diciembre  }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_spanish:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_spanish:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_spanish:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { lunes      }
        { 2 }  { martes     }
        { 3 }  { miércoles  }
        { 4 }  { jueves     }
        { 5 }  { viernes    }
        { 6 }  { sábado     }
        { 7 }  { domingo    }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_spanish:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Lunes      }
        { 2 }  { Martes     }
        { 3 }  { Miércoles  }
        { 4 }  { Jueves     }
        { 5 }  { Viernes    }
        { 6 }  { Sábado     }
        { 7 }  { Domingo    }
      } { ??? }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_schinese:nnn
  {
    #1 年 #2 月 #3 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_schinese:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_schinese:nnn
  {
    #1 年 #2 月 #3 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_schinese:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_schinese:nn
  {
    #1 年 #2 月
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_schinese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_schinese:nn
  {
    #1 年 #2 月
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_schinese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_schinese:nn
  {
    #1 月 #2 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_schinese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_schinese:nn
  {
    #1 月 #2 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_schinese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_schinese:n { #1 年 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_schinese:n { #1 年 }
\cs_new:Nn \projlib_datetime_display_month_schinese:n { #1 月 }
\cs_new:Nn \projlib_datetime_display_month_uppercase_schinese:n { #1 月 }
\cs_new:Nn \projlib_datetime_display_day_schinese:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_schinese:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_schinese:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { 星期一    }
        { 2 }  { 星期二    }
        { 3 }  { 星期三    }
        { 4 }  { 星期四    }
        { 5 }  { 星期五    }
        { 6 }  { 星期六    }
        { 7 }  { 星期日    }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_schinese:n
  {
    \projlib_datetime_display_week_schinese:n { #1 }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_tchinese:nnn
  {
    #1 年 #2 月 #3 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_tchinese:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_tchinese:nnn
  {
    #1 年 #2 月 #3 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_tchinese:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_tchinese:nn
  {
    #1 年 #2 月
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_tchinese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_tchinese:nn
  {
    #1 年 #2 月
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_tchinese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_tchinese:nn
  {
    #1 月 #2 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_tchinese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_tchinese:nn
  {
    #1 月 #2 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_tchinese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_tchinese:n { #1 年 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_tchinese:n { #1 年 }
\cs_new:Nn \projlib_datetime_display_month_tchinese:n { #1 月 }
\cs_new:Nn \projlib_datetime_display_month_uppercase_tchinese:n { #1 月 }
\cs_new:Nn \projlib_datetime_display_day_tchinese:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_tchinese:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_tchinese:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { 星期一    }
        { 2 }  { 星期二    }
        { 3 }  { 星期三    }
        { 4 }  { 星期四    }
        { 5 }  { 星期五    }
        { 6 }  { 星期六    }
        { 7 }  { 星期日    }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_tchinese:n
  {
    \projlib_datetime_display_week_tchinese:n { #1 }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_japanese:nnn
  {
    #1 年 #2 月 #3 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_japanese:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_japanese:nnn
  {
    #1 年 #2 月 #3 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_japanese:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_japanese:nn
  {
    #1 年 #2 月
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_japanese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_japanese:nn
  {
    #1 年 #2 月
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_japanese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_japanese:nn
  {
    #1 月 #2 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_japanese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_japanese:nn
  {
    #1 月 #2 日
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_japanese:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_japanese:n { #1 年 }
\cs_new:Nn \projlib_datetime_display_year_uppercase_japanese:n { #1 年 }
\cs_new:Nn \projlib_datetime_display_month_japanese:n { #1 月 }
\cs_new:Nn \projlib_datetime_display_month_uppercase_japanese:n { #1 月 }
\cs_new:Nn \projlib_datetime_display_day_japanese:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_japanese:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_japanese:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { 月曜日    }
        { 2 }  { 火曜日    }
        { 3 }  { 水曜日    }
        { 4 }  { 木曜日    }
        { 5 }  { 金曜日    }
        { 6 }  { 土曜日    }
        { 7 }  { 日曜日    }
      } { ??? }
  }

\cs_new:Nn \projlib_datetime_display_week_uppercase_japanese:n
  {
    \projlib_datetime_display_week_japanese:n { #1 }
  }


\cs_new:Nn \projlib_datetime_display_year_month_day_russian:nnn
  {
    \projlib_datetime_display_month_day_russian:nn { #2 } { #3 }
    \nobreakspace
    \projlib_datetime_display_year_russian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_russian:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_day_uppercase_russian:nnn
  {
    \projlib_datetime_display_month_day_uppercase_russian:nn { #2 } { #3 }
    \nobreakspace
    \projlib_datetime_display_year_russian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_day_uppercase_russian:nnn { VVV, eee }

\cs_new:Nn \projlib_datetime_display_year_month_russian:nn
  {
    \projlib_datetime_display_month_russian:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_russian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_russian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_month_uppercase_russian:nn
  {
    \projlib_datetime_display_month_uppercase_russian:n { #2 }
    \nobreakspace
    \projlib_datetime_display_year_russian:n { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_year_month_uppercase_russian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_russian:nn
  {
    \projlib_datetime_display_day_russian:n { #2 }
    \nobreakspace
    \int_case:nnF { #1 }
      {
        { 1 }  { января    }
        { 2 }  { февраля   }
        { 3 }  { марта     }
        { 4 }  { апреля    }
        { 5 }  { мая       }
        { 6 }  { июня      }
        { 7 }  { июля      }
        { 8 }  { августа   }
        { 9 }  { сентября  }
        { 10 } { октября   }
        { 11 } { ноября    }
        { 12 } { декабря   }
      } { #1 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_russian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_month_day_uppercase_russian:nn
  {
    \projlib_datetime_display_month_day_russian:nn { #1 } { #2 }
  }
\cs_generate_variant:Nn \projlib_datetime_display_month_day_uppercase_russian:nn { VV, ee }

\cs_new:Nn \projlib_datetime_display_year_russian:n { #1 ~ г. }
\cs_new:Nn \projlib_datetime_display_year_uppercase_russian:n { #1 ~ г. }

\cs_new:Nn \projlib_datetime_display_month_russian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { январь    }
        { 2 }  { февраль   }
        { 3 }  { март      }
        { 4 }  { апрель    }
        { 5 }  { май       }
        { 6 }  { июнь      }
        { 7 }  { июль      }
        { 8 }  { август    }
        { 9 }  { сентябрь  }
        { 10 } { октябрь   }
        { 11 } { ноябрь    }
        { 12 } { декабрь   }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_month_uppercase_russian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Январь    }
        { 2 }  { Февраль   }
        { 3 }  { Март      }
        { 4 }  { Апрель    }
        { 5 }  { Май       }
        { 6 }  { Июнь      }
        { 7 }  { Июль      }
        { 8 }  { Август    }
        { 9 }  { Сентябрь  }
        { 10 } { Октябрь   }
        { 11 } { Ноябрь    }
        { 12 } { Декабрь   }
      } { #1 }
  }

\cs_new:Nn \projlib_datetime_display_day_russian:n { #1 }
\cs_new:Nn \projlib_datetime_display_day_uppercase_russian:n { #1 }

\cs_new:Nn \projlib_datetime_display_week_russian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { понедельник }
        { 2 }  { вторник     }
        { 3 }  { среда       }
        { 4 }  { четверг     }
        { 5 }  { пятница     }
        { 6 }  { суббота     }
        { 7 }  { воскресенье }
      } { ??? }
  }
\cs_new:Nn \projlib_datetime_display_week_uppercase_russian:n
  {
    \int_case:nnF { #1 }
      {
        { 1 }  { Понедельник }
        { 2 }  { Вторник     }
        { 3 }  { Среда       }
        { 4 }  { Четверг     }
        { 5 }  { Пятница     }
        { 6 }  { Суббота     }
        { 7 }  { Воскресенье }
      } { ??? }
  }
%</projlib-datetime>
%
%<*projlib-draft>
\keys_define:nn { projlib-draft }
  {
    , draft   .bool_set:N   = \l__projlib_draft_fast_bool
    , draft   .initial:n    = { false }
    , fast    .bool_set:N   = \l__projlib_draft_fast_bool
    , unknown .code:n       = {}
  }
\ProcessKeysOptions { projlib-draft }

\RequirePackage { projlib-language }
\RequirePackage { xcolor }

\bool_if:NTF \l__projlib_draft_fast_bool
  {
    \NewDocumentCommand \projlib_draft_plain_box { O{-paper} m }
      {
        \group_begin:
          \color { #1 }
          \dim_set:Nn \fboxsep  { 1.5pt }
          \dim_set:Nn \fboxrule { 1.5pt }
          \fbox { #2 }
        \group_end:
      }
  }
  {
    \PassOptionsToPackage { many } { tcolorbox }
    \RequirePackage { tcolorbox }
    \NewTCBox \projlib_draft_plain_box { O{-paper} }
      {
        enhanced~jigsaw, breakable,
        on~line, arc = 1.2pt, outer~arc = 1pt,
        colframe = #1, colupper = #1, opacityback = 0,
        boxsep = 1pt, boxrule = 1.2pt,
        left = 1pt, right = 1pt, top = 0pt, bottom = 0pt,
      }
  }

\projlib_langauge_define_multilingual_text:Nn \__projlib_draft_dnf_text
  {
    EN = To\ be\ finished     ,
    FR = Pas\ encore\ fini    ,
    DE = Nicht\ beendet       ,
    IT = Per\ essere\ finito  ,
    PT = Não\ terminou        ,
    BR = Não\ terminou        ,
    ES = Estar\ terminado     ,
    CN = 这里尚未完成         ,
    TC = 這裡尚未完成         ,
    JP = 終わってない         ,
    RU = Не\ закончен         ,
  }

\projlib_langauge_define_multilingual_text:Nn \__projlib_draft_dnf_report_text
  {
    EN = { Below\ is\ a\ list\ of\ outstanding\ items,
           \ followed\ by\ the\ corresponding\ page\ numbers.         }     ,
    FR = { Voici\ la\ liste\ des\ éléments\ en\ suspens,
           \ suivie\ des\ numéros\ de\ page\ correspondants.          }     ,
    DE = { Unten\ ist\ eine\ Liste\ der\ ausstehenden\ Posten,
           \ gefolgt\ von\ den\ entsprechenden\ Seitenzahlen.         }     ,
    IT = { Qui\ sotto\ c'è\ una\ lista\ di\ voci\ in\ sospeso,
           \ seguita\ dai\ numeri\ di\ pagina\ corrispondenti.        }     ,
    PT = { Abaixo\ está\ uma\ lista\ de\ itens\ pendentes,
           \ seguida\ dos\ números\ de\ página\ correspondentes.      }     ,
    BR = { Abaixo\ está\ uma\ lista\ de\ itens\ pendentes,
           \ seguida\ dos\ números\ de\ página\ correspondentes.      }     ,
    ES = { Aquí está\ la\ lista\ de\ elementos\ pendientes,
           \ seguida\ de\ los\ números\ de\ página\ correspondientes. }     ,
    CN = { 以下是未完成事项列表，括号内注明了对应的页码。             }     ,
    TC = { 以下是未完成事項的列表，括號內註明了對應頁碼。             }     ,
    JP = { 以下は、未解決の項目とそれに対応するページ番号の一覧です。 }     ,
    RU = { Ниже\ приведен\ список\ невыполненных\ пунктов
           \ с\ соответствующими\ номерами\ страниц\ в\ скобках.      }     ,
  }

\tl_new:c    { __projlib_draft_dnf_font }
\tl_gset:cn  { __projlib_draft_dnf_font }        { \normalfont \ttfamily \bfseries \small }

\definecolor { __projlib_draft_dnf_color }       { RGB } {  21, 122,  20 }

\newcounter  { __projlib_draft_dnf_counter }

\tl_new:N \g__projlib_draft_dnf_report_tl

\NewDocumentCommand \dnf { d<> }
  {
    \noindent
    \projlib_draft_plain_box [ __projlib_draft_dnf_color ]
      {
        \stepcounter { __projlib_draft_dnf_counter }
        \__projlib_draft_dnf_font
        \__projlib_draft_dnf_text
        \c_space_tl
        \# \the__projlib_draft_dnf_counter
        \IfNoValueF { #1 } { \, : ~ #1 }
        \tl_gput_right:Nx \g__projlib_draft_dnf_report_tl
          {
            \# \,
            \int_value:w \the__projlib_draft_dnf_counter
            \c_space_tl \c_space_tl
            $\langle$
            \skip_horizontal:n { 0.1em }
            \cs_if_exist:cTF { hyperlink }
              {
                \exp_not:N \hyperlink { page.\thepage } { \thepage }
              }
              {
                \thepage
              }
            \skip_horizontal:n { 0.1em }
            $\rangle$
            \c_space_tl
            \IfNoValueF { #1 } { : ~ #1 }
            \\
          }
      }
  }

\hook_gput_code:nnn { enddocument } { projlib-draft }
  {
    \tl_if_blank:VF \g__projlib_draft_dnf_report_tl
      {
        \clearpage
        \pagestyle{empty}
        \noindent
        \color { __projlib_draft_dnf_color }
        \__projlib_draft_dnf_font
        \__projlib_draft_dnf_report_text \\[0.75\baselineskip]
        \g__projlib_draft_dnf_report_tl
      }
  }


\projlib_langauge_define_multilingual_text:Nn \__projlib_draft_blind_text_tl
  {
    , EN = {
              Hello,~here~is~some~text~without~a~meaning.~This~text~should~show~what~a~printed~text~will~look~like~at~this~place.~If~you~read~this~text,~you~will~get~no~information.~Really?~Is~there~no~information?~Is~there~a~difference~between~this~text~and~some~nonsense~like~``Huardest~gefburn''?~Not~at~all!~A~blind~text~like~this~gives~you~information~about~the~selected~font,~how~the~letters~are~written~and~an~impression~of~the~look.~This~text~should~contain~all~letters~of~the~alphabet~and~it~should~be~written~in~of~the~original~language.~There~is~no~need~for~special~content,~but~the~length~of~words~should~match~the~language.
           }
    , FR = {
              Bonjour,~voici~un~texte~sans~signification.~Ce~texte~doit~montrer~à~quoi~ressemble~un~texte~imprimé~à~cet~endroit.~Si~vous~lisez~ce~texte,~vous~n'obtiendrez~aucune~information.~Vraiment~?~Il~n'y~a~aucune~information~?~Y~a-t-il~une~différence~entre~ce~texte~et~une~absurdité~comme~«~Huardest~gefburn~»~?~Pas~du~tout~!~Un~texte~aveugle~comme~celui-ci~vous~donne~des~informations~sur~la~police~choisie,~la~façon~dont~les~lettres~sont~écrites~et~une~impression~de~l'apparence.~Ce~texte~doit~contenir~toutes~les~lettres~de~l'alphabet~et~être~écrit~dans~la~langue~d'origine.~Il~n'est~pas~nécessaire~de~prévoir~un~contenu~spécial,~mais~la~longueur~des~mots~doit~correspondre~à~la~langue.
           }
    , DE = {
              Hallo,~hier~ist~ein~Text~ohne~Bedeutung.~Dieser~Text~soll~zeigen,~wie~ein~gedruckter~Text~an~dieser~Stelle~aussehen~wird.~Wenn~Sie~diesen~Text~lesen,~werden~Sie~keine~Informationen~erhalten.~Wirklich?~Gibt~es~keine~Informationen?~Gibt~es~einen~Unterschied~zwischen~diesem~Text~und~irgendeinem~Blödsinn~wie~``Huardest~gefburn''?~Ganz~und~gar~nicht!~Ein~solcher~Blindtext~gibt~Ihnen~Informationen~über~die~gewählte~Schriftart,~wie~die~Buchstaben~geschrieben~sind~und~einen~Eindruck~vom~Aussehen.~Dieser~Text~sollte~alle~Buchstaben~des~Alphabets~enthalten~und~in~der~Originalsprache~geschrieben~sein.~Es~ist~kein~besonderer~Inhalt~erforderlich,~aber~die~Länge~der~Wörter~sollte~der~Sprache~entsprechen.
           }
    , IT = {
              Ciao,~qui~c'è~un~drafto~senza~significato.~Questo~drafto~dovrebbe~mostrare~come~sarà~un~drafto~stampato~in~questo~posto.~Se~leggete~questo~drafto,~non~otterrete~alcuna~informazione.~Davvero?~Non~c'è~nessuna~informazione?~C'è~una~differenza~tra~questo~drafto~e~qualche~sciocchezza~come~``Huardest~gefburn''?~Niente~affatto!~Un~drafto~cieco~come~questo~ti~dà~informazioni~sul~font~selezionato,~su~come~sono~scritte~le~lettere~e~un'impressione~dell'aspetto.~Questo~drafto~dovrebbe~contenere~tutte~le~lettere~dell'alfabeto~e~dovrebbe~essere~scritto~nella~lingua~originale.~Non~c'è~bisogno~di~contenuti~speciali,~ma~la~lunghezza~delle~parole~dovrebbe~corrispondere~alla~lingua.
           }
    , PT = {
              Olá,~aqui~está~um~texto~sem~significado.~Este~texto~deve~mostrar~como~será~um~texto~impresso~neste~local.~Se~ler~este~texto,~não~obterá~qualquer~informação.~A~sério?~Não~há~informação?~Há~alguma~diferença~entre~este~texto~e~alguns~disparates~como~"Huardest~gefburn"?~De~modo~algum!~Um~texto~cego~como~este~dá-lhe~informações~sobre~a~fonte~seleccionada,~como~as~letras~são~escritas~e~uma~impressão~do~aspecto.~Este~texto~deve~conter~todas~as~letras~do~alfabeto~e~deve~ser~escrito~na~língua~original.~Não~há~necessidade~de~conteúdo~especial,~mas~o~tamanho~das~palavras~deve~corresponder~à~língua.
           }
    , BR = {
              Olá,~aqui~está~um~texto~sem~sentido.~Este~texto~deve~mostrar~como~será~um~texto~impresso~neste~lugar.~Se~você~ler~este~texto,~você~não~obterá~nenhuma~informação.~É~mesmo?~Não~há~nenhuma~informação?~Há~alguma~diferença~entre~este~texto~e~alguns~disparates~como~"Huardest~gefburn"?~De~jeito~nenhum!~Um~texto~cego~como~este~lhe~dá~informações~sobre~a~fonte~selecionada,~como~as~letras~são~escritas~e~uma~impressão~da~aparência.~Este~texto~deve~conter~todas~as~letras~do~alfabeto~e~deve~ser~escrito~no~idioma~original.~Não~há~necessidade~de~conteúdo~especial,~mas~o~tamanho~das~palavras~deve~corresponder~ao~idioma.
           }
    , ES = {
              Hola,~aquí~hay~un~texto~sin~significado.~Este~texto~debe~mostrar~cómo~se~verá~un~texto~impreso~en~este~lugar.~Si~lees~este~texto,~no~obtendrás~ninguna~información.~¿En~serio?~¿No~hay~información?~¿Hay~alguna~diferencia~entre~este~texto~y~alguna~tontería~como~``Huardest~gefburn''?~¡Para~nada!~Un~texto~oculto~como~este~le~brinda~información~sobre~la~fuente~seleccionada,~cómo~se~escriben~las~letras~y~una~impresión~de~la~apariencia.~Este~texto~debe~contener~todas~las~letras~del~alfabeto~y~debe~estar~escrito~en~el~idioma~original.~No~hay~necesidad~de~contenido~especial,~pero~la~longitud~de~las~palabras~debe~coincidir~con~el~idioma.
           }
    , CN = {
              你好，这里有一些没有意义的文字。 此文本应显示打印文本在此位置的外观。 如果你阅读这段文字，你将不会得到任何信息。 真的没有信息吗？ 这段文字和诸如 “劳仑衣普桑，认至将指点效则机，最你更枝” 或者 “想极整月正进好志次回总般，段然取向使张规军证回，世市总李率英茄持伴” 之类的废话有区别吗？ 一点都没有！ 这样的一段文本会给你提供关于所选字体的信息、字母的书写方式以及对外观的印象。 该文本应包含字母表中的所有字母，并且应使用原始语言编写。 不需要特别的内容，但字长要与语言相匹配。
           }
    , TC = {
              你好，這裡有一些沒有意義的文字。此文本應顯示打印文本在此位置的外觀。如果你閱讀這段文字，你將不會得到任何信息。真的沒有信息嗎？這段文字和諸如 “勞崙衣普桑，認至將指點效則機，最你更枝” 或者 “想極整月正進好志次回總般，段然取向使張規軍證回，世市總李率英茄持伴” 之類的廢話有區別嗎？一點都沒有！這樣的一段文本會給你提供關於所選字體的信息、字母的書寫方式以及對外觀的印象。該文本應包含字母表中的所有字母，並且應使用原始語言編寫。不需要特別的內容，但字長要與語言相匹配。
           }
    , JP = {
              こんにちは、ここに意味のないテキストがあります。 このテキストは、この場所で印刷されたテキストがどのように見えるかを示す必要があります。 このテキストを読んでも、情報は得られません。 本当に？ 情報はありませんか？ このテキストと「アでニンはすミ」のようなナンセンスとの間に違いはありますか？ 全くない！ このようなブラインドテキストは、選択したフォント、文字の書き方、外観の印象に関する情報を提供します。 このテキストにはアルファベットのすべての文字が含まれている必要があり、元の言語で書かれている必要があります。 特別なコンテンツは必要ありませんが、単語の長さは言語と一致している必要があります。
           }
    , RU = {
              Здравствуйте,~вот~какой-то~текст~без~смысла.~Этот~текст~должен~показывать,~как~будет~выглядеть~печатный~текст~в~этом~месте.~Если~вы~прочитаете~этот~текст,~вы~не~получите~никакой~информации.~Действительно?~Нет~информации?~Есть~ли~разница~между~этим~текстом~и~какой-то~чепухой~вроде~``Бзостачщв~дрероих''?~Нисколько!~Слепой~текст,~подобный~этому,~дает~вам~информацию~о~выбранном~шрифте,~о~том,~как~написаны~буквы,~и~о~впечатлении~от~внешнего~вида.~Этот~текст~должен~содержать~все~буквы~алфавита~и~должен~быть~написан~на~языке~оригинала.~В~специальном~содержании~нет~необходимости,~но~длина~слов~должна~соответствовать~языку.
           }
  }

\cs_new:Nn \projlib_draft_blind_text:n
  {
    \int_set:Nn \l_tmpa_int { #1 }
    \int_do_until:nNnn { \l_tmpa_int } = { 0 }
      {
        \__projlib_draft_blind_text_tl
        \c_space_tl
        \int_add:Nn \l_tmpa_int { -1 }
      }
  }

\hook_gput_code:nnn { begindocument/before } { projlib-draft }
  {
    \ProvideDocumentCommand \blindtext { O{} }
      {
        \tl_if_blank:nTF { #1 }
          {
            \__projlib_draft_blind_text_tl
          }
          {
            \projlib_draft_blind_text:n { #1 }
          }
      }
  }
%</projlib-draft>
%
%<*projlib-font>
\keys_define:nn { projlib-font }
  {
    , useosf           .bool_set:N   = \l__projlib_font_useosf_bool
    , useosf           .initial:n    = { false }
    , old-style-figures.bool_set:N   = \l__projlib_font_useosf_bool
    , old~style~figures.bool_set:N   = \l__projlib_font_useosf_bool
    , old style figures.bool_set:N   = \l__projlib_font_useosf_bool
    , lmodern          .bool_set:N   = \l__projlib_font_lmodern_bool
    , lmodern          .initial:n    = { false }
    , latin-modern     .bool_set:N   = \l__projlib_font_lmodern_bool
    , latin~modern     .bool_set:N   = \l__projlib_font_lmodern_bool
    , latin modern     .bool_set:N   = \l__projlib_font_lmodern_bool
    , palatino         .bool_set:N   = \l__projlib_font_palatino_bool
    , palatino         .initial:n    = { false }
    , times            .bool_set:N   = \l__projlib_font_times_bool
    , times            .initial:n    = { false }
    , garamond         .bool_set:N   = \l__projlib_font_garamond_bool
    , garamond         .initial:n    = { false }
    , noto             .bool_set:N   = \l__projlib_font_noto_bool
    , noto             .initial:n    = { false }
    , biolinum         .bool_set:N   = \l__projlib_font_biolinum_bool
    , biolinum         .initial:n    = { false }
    , unknown          .code:n       = {}
  }
\ProcessKeysOptions { projlib-font }

\bool_new:N \g_projlib_font_already_set_bool
\bool_gset_false:N \g_projlib_font_already_set_bool

\RequirePackage { setspace }

\cs_new:Nn \projlib_font_set_linespacing_latin:n
  {
    \cs_if_exist:NTF \projlib_language_set_linespacing_latin:n
      {
        \projlib_language_set_linespacing_latin:n { #1 }
      }
      {
        #1
      }
  }

\bool_if:NT \l__projlib_font_lmodern_bool
  {
    \RequirePackage { amssymb }
    \bool_if:NTF \l__projlib_font_useosf_bool
      {
        \RequirePackage { cfr-lm }
      }
      {
        \RequirePackage { lmodern }
      }
    \projlib_font_set_linespacing_latin:n { \setstretch { 1.00 } }
    \bool_gset_true:N \g_projlib_font_already_set_bool
  }

\bool_if:NT \l__projlib_font_palatino_bool
  {
    \sys_if_engine_pdftex:TF
    {
      \RequirePackage { mathpazo }
      \PassOptionsToPackage { defaultsups } { newpxtext }
      \RequirePackage { newpxtext }
      \cs_undefine:c { openbox }
      \bool_if:NT \l__projlib_font_useosf_bool { \useosf }
    }
    {
      \PassOptionsToPackage { warnings-off = { mathtools-colon, mathtools-overbracket } } { unicode-math }
      \RequirePackage { unicode-math }
      \defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
      \bool_if:NTF \l__projlib_font_useosf_bool
        {
          \setmainfont { TeXGyrePagellaX-Regular.otf }
            [
              BoldFont       = TeXGyrePagellaX-Bold.otf ,
              ItalicFont     = TeXGyrePagellaX-Italic.otf ,
              BoldItalicFont = TeXGyrePagellaX-BoldItalic.otf,
              Numbers        = OldStyle ]
        }
        {
          \setmainfont { TeXGyrePagellaX-Regular.otf }
            [
              BoldFont       = TeXGyrePagellaX-Bold.otf ,
              ItalicFont     = TeXGyrePagellaX-Italic.otf ,
              BoldItalicFont = TeXGyrePagellaX-BoldItalic.otf,
            ]
        }
      \setmathfont { texgyrepagella-math.otf }
    }
    \projlib_font_set_linespacing_latin:n { \setstretch { 1.07 } }
    \bool_gset_true:N \g_projlib_font_already_set_bool
  }

\bool_if:NT \l__projlib_font_times_bool
  {
    \sys_if_engine_pdftex:TF
      {
        \PassOptionsToPackage { defaultsups } { newtxtext }
        \RequirePackage { newtxtext }
        \RequirePackage { newtxmath }
        \cs_undefine:c { openbox }
        \bool_if:NT \l__projlib_font_useosf_bool { \useosf }
      }
      {
        \PassOptionsToPackage { warnings-off = { mathtools-colon, mathtools-overbracket } } { unicode-math }
        \RequirePackage { unicode-math }
        \defaultfontfeatures{ Scale=MatchLowercase, Ligatures=TeX }
        \bool_if:NTF \l__projlib_font_useosf_bool
          {
            \setmainfont { TeXGyreTermesX-Regular.otf }
              [
                BoldFont       = TeXGyreTermesX-Bold.otf ,
                ItalicFont     = TeXGyreTermesX-Italic.otf ,
                BoldItalicFont = TeXGyreTermesX-BoldItalic.otf,
                Numbers        = OldStyle ]
          }
          {
            \setmainfont { TeXGyreTermesX-Regular.otf }
              [
                BoldFont       = TeXGyreTermesX-Bold.otf ,
                ItalicFont     = TeXGyreTermesX-Italic.otf ,
                BoldItalicFont = TeXGyreTermesX-BoldItalic.otf,
              ]
          }
        \setmathfont { texgyretermes-math.otf }
      }
    \projlib_font_set_linespacing_latin:n { \setstretch { 1.00 } }
    \bool_gset_true:N \g_projlib_font_already_set_bool
  }

\bool_if:NT \l__projlib_font_garamond_bool
  {
    \bool_if:NF \l__projlib_font_useosf_bool
      {
        \PassOptionsToPackage { lining } { ebgaramond }
      }
    \RequirePackage [ cmintegrals, cmbraces ] { newtxmath }
    \cs_undefine:c { openbox }
    \RequirePackage { ebgaramond-maths }
    \RequirePackage { ebgaramond }
    \cs_undefine:c { Bbbk }
    \projlib_font_set_linespacing_latin:n { \setstretch { 1.00 } }
    \bool_gset_true:N \g_projlib_font_already_set_bool
  }

\bool_if:NT \l__projlib_font_noto_bool
  {
    \bool_if:NT \l__projlib_font_useosf_bool
      {
        \PassOptionsToPackage { oldstyle } { notomath }
      }
    \RequirePackage { anyfontsize }
    \RequirePackage { notomath }
    \cs_undefine:c { Bbbk }
    \projlib_font_set_linespacing_latin:n { \setstretch { 1.00 } }
    \bool_gset_true:N \g_projlib_font_already_set_bool
  }

\bool_if:NT \l__projlib_font_biolinum_bool
  {
    \RequirePackage [ OT1 ] { eulervm }
    \sys_if_engine_pdftex:TF
      {
        \bool_if:NT \l__projlib_font_useosf_bool
          {
            \PassOptionsToPackage { osf } { biolinum }
          }
          \RequirePackage { biolinum }
          \tl_gset:Nn \familydefault { \biolinum@family }
      }
      {
        \PassOptionsToPackage { no-math } { fontspec }
        \RequirePackage { fontspec }
        \bool_if:NTF \l__projlib_font_useosf_bool
          {
            \setmainfont { LinBiolinum_R.otf } [
              BoldFont       = LinBiolinum_RB.otf  ,
              ItalicFont     = LinBiolinum_RI.otf  ,
              BoldItalicFont = LinBiolinum_RBO.otf ,
              Numbers        = OldStyle            , ]
          }
          {
            \setmainfont { LinBiolinum_R.otf } [
              BoldFont       = LinBiolinum_RB.otf  ,
              ItalicFont     = LinBiolinum_RI.otf  ,
              BoldItalicFont = LinBiolinum_RBO.otf , ]
          }
      }
    \projlib_font_set_linespacing_latin:n { \setstretch { 1.05 } }
    \RequirePackage [ italic, defaultmathsizes ] { mathastext }
    \bool_gset_true:N \g_projlib_font_already_set_bool
  }

\PassOptionsToPackage { verbose = silent } { microtype }
\RequirePackage { microtype }
%</projlib-font>
%
%<*projlib-language>
\clist_const:Nn \c__projlib_language_supported_clist
  {
    english     ,
    french      ,
    ngerman     ,
    italian     ,
    portuguese  ,
    brazilian   ,
    spanish     ,
    schinese    ,
    tchinese    ,
    japanese    ,
    russian     ,
  }

\clist_new:N \g__projlib_language_babel_option_clist

\str_new:N \g__projlib_language_main_str

\bool_new:N        \g__projlib_language_enabled_all_bool
\bool_gset_true:N  \g__projlib_language_enabled_all_bool

\clist_map_inline:Nn \c__projlib_language_supported_clist
  {
    \bool_new:c        { g__projlib_language_enabled_ #1 _bool }
    \bool_gset_false:c { g__projlib_language_enabled_ #1 _bool }
  }

\cs_new:Nn \projlib_language_set_option_no_babel:n
  {
    \bool_gset_false:N \g__projlib_language_enabled_all_bool
    \bool_gset_true:c { g__projlib_language_enabled_ #1 _bool }
    \str_if_empty:NT \g__projlib_language_main_str
      {
        \str_gset:Nn \g__projlib_language_main_str { #1 }
      }
  }
\cs_new:Nn \projlib_language_set_option:n
  {
    \projlib_language_set_option_no_babel:n { #1 }
    \clist_gput_left:Nn \g__projlib_language_babel_option_clist { #1 }
  }

\keys_define:nn { projlib-language }
  {
    , EN                  .meta:n       = { english }
    , english             .code:n       = { \projlib_language_set_option:n { english } }
    , English             .meta:n       = { english }
    , FR                  .meta:n       = { french }
    , french              .code:n       = { \projlib_language_set_option:n { french } }
    , French              .meta:n       = { french }
    , DE                  .meta:n       = { ngerman }
    , german              .meta:n       = { ngerman }
    , ngerman             .code:n       = { \projlib_language_set_option:n { ngerman } }
    , German              .meta:n       = { ngerman }
    , IT                  .meta:n       = { italian }
    , italian             .code:n       = { \projlib_language_set_option:n { italian } }
    , Italian             .meta:n       = { italian }
    , PT                  .meta:n       = { portuguese }
    , portuguese          .code:n       = { \projlib_language_set_option:n { portuguese } }
    , Portuguese          .meta:n       = { portuguese }
    , BR                  .meta:n       = { brazilian }
    , brazilian           .code:n       = { \projlib_language_set_option:n { brazilian } }
    , Brazilian           .meta:n       = { brazilian }
    , ES                  .meta:n       = { spanish }
    , spanish             .code:n       = { \clist_gput_left:Nn \g__projlib_language_babel_option_clist { es-notilde, es-noquoting }
                                            \projlib_language_set_option:n { spanish } }
    , Spanish             .meta:n       = { spanish }
    , CN                  .meta:n       = { schinese }
    , chinese             .meta:n       = { schinese }
    , schinese            .code:n       = { \projlib_language_set_option_no_babel:n { schinese } }
    , simplified-chinese  .meta:n       = { schinese }
    , simplified~chinese  .meta:n       = { schinese }
    , simplified chinese  .meta:n       = { schinese }
    , Chinese             .meta:n       = { schinese }
    , SChinese            .meta:n       = { schinese }
    , Simplified-Chinese  .meta:n       = { schinese }
    , Simplified~Chinese  .meta:n       = { schinese }
    , Simplified Chinese  .meta:n       = { schinese }
    , TC                  .meta:n       = { tchinese }
    , tchinese            .code:n       = { \projlib_language_set_option_no_babel:n { tchinese } }
    , traditional-chinese .meta:n       = { tchinese }
    , traditional~chinese .meta:n       = { tchinese }
    , traditional chinese .meta:n       = { tchinese }
    , TChinese            .meta:n       = { tchinese }
    , Traditional-Chinese .meta:n       = { tchinese }
    , Traditional~Chinese .meta:n       = { tchinese }
    , Traditional Chinese .meta:n       = { tchinese }
    , JP                  .meta:n       = { japanese }
    , japanese            .code:n       = { \projlib_language_set_option:n { japanese } }
    , Japanese            .meta:n       = { japanese }
    , RU                  .meta:n       = { russian }
    , russian             .code:n       = { \projlib_language_set_option:n { russian } }
    , Russian             .meta:n       = { russian }
    , unknown             .code:n       = {}
  }
\ProcessKeysOptions { projlib-language }

\cs_new_protected:Nn \projlib_language_clear_global_option:n
  {
    \clist_remove_all:cn { @classoptionslist } { #1 }
  }

\projlib_language_clear_global_option:n { chinese }
\projlib_language_clear_global_option:n { Chinese }

\clist_gput_right:Nn \g__projlib_language_babel_option_clist { shorthands = off }

\str_if_empty:NT \g__projlib_language_main_str
  {
    \str_gset:Nn \g__projlib_language_main_str { english }
  }

\bool_if:NT \g__projlib_language_enabled_all_bool
  {
    \clist_map_inline:Nn \c__projlib_language_supported_clist
      {
        \bool_gset_true:c { g__projlib_language_enabled_ #1 _bool }
      }
  }


\cs_new:Nn \projlib_language_str_to_languagename:n
  {
    \str_case_e:nnF { \str_foldcase:n { #1 } }
      {
        { all                }    { common     }
        { common             }    { common     }
        { cn                 }    { schinese   }
        { chinese            }    { schinese   }
        { schinese           }    { schinese   }
        { simplifiedchinese  }    { schinese   }
        { simplified-chinese }    { schinese   }
        { tc                 }    { tchinese   }
        { tchinese           }    { tchinese   }
        { traditionalchinese }    { tchinese   }
        { traditional-chinese}    { tchinese   }
        { jp                 }    { japanese   }
        { japanese           }    { japanese   }
        { en                 }    { english    }
        { english            }    { english    }
        { fr                 }    { french     }
        { french             }    { french     }
        { de                 }    { ngerman    }
        { german             }    { ngerman    }
        { ngerman            }    { ngerman    }
        { it                 }    { italian    }
        { italian            }    { italian    }
        { pt                 }    { portuguese }
        { portuguese         }    { portuguese }
        { br                 }    { brazilian  }
        { brazilian          }    { brazilian  }
        { es                 }    { spanish    }
        { spanish            }    { spanish    }
        { ru                 }    { russian    }
        { russian            }    { russian    }
      }
      { #1 }
  }

\cs_new:Nn \projlib_language_str_to_languagetype:n
  {
    \str_case_e:nn { \str_foldcase:n { #1 } }
      {
        { cn                 }    {  cjk  }
        { chinese            }    {  cjk  }
        { schinese           }    {  cjk  }
        { simplifiedchinese  }    {  cjk  }
        { simplified-chinese }    {  cjk  }
        { tc                 }    {  cjk  }
        { tchinese           }    {  cjk  }
        { traditionalchinese }    {  cjk  }
        { traditional-chinese}    {  cjk  }
        { jp                 }    {  cjk  }
        { japanese           }    {  cjk  }
        { en                 }    { latin }
        { english            }    { latin }
        { fr                 }    { latin }
        { french             }    { latin }
        { de                 }    { latin }
        { german             }    { latin }
        { ngerman            }    { latin }
        { it                 }    { latin }
        { italian            }    { latin }
        { pt                 }    { latin }
        { portuguese         }    { latin }
        { br                 }    { latin }
        { brazilian          }    { latin }
        { es                 }    { latin }
        { spanish            }    { latin }
        { ru                 }    { latin }
        { russian            }    { latin }
      }
  }

\sys_if_engine_pdftex:T
  {
    \RequirePackage [T1] { fontenc }
  }

\bool_if:NTF \g__projlib_language_enabled_all_bool
  {
    \sys_if_engine_pdftex:F
      {
        \PassOptionsToPackage { japanese, russian } { babel }
      }
    \PassOptionsToPackage { italian, portuguese, brazilian, spanish, es-notilde, es-noquoting, ngerman, french, english, shorthands = off } { babel }
  }
  {
    \PassOptionsToPackage { \g__projlib_language_babel_option_clist } { babel }
  }

\PassOptionsToPackage { italian, brazilian, spanish, ngerman, french, english } { cleveref }
\RequirePackage { babel }


\bool_if:NT \g__projlib_language_enabled_french_bool
  {
    \frenchsetup { PartNameFull = false }
  }

\bool_if:NT \g__projlib_language_enabled_portuguese_bool
  {
    \NewCommandCopy \__projlib_language_babel_ord: \ord
    \cs_undefine:N \ord
    \hook_gput_code:nnn { begindocument } { projlib-language }
      {
        \cs_if_exist:NT \ord
          {
            \NewCommandCopy \__projlib_language_user_ord: \ord
            \cs_set_protected:Npn \ord
              {
                \mode_if_math:TF
                  { \__projlib_language_user_ord:  }
                  { \__projlib_language_babel_ord: }
              }
          }
      }
  }

\babelprovide { schinese }
\babelprovide { tchinese }


\NewCommandCopy \projlib_language_backup_today:n \today

\tl_new:N \g_projlib_language_settings_common_tl
\clist_map_inline:Nn \c__projlib_language_supported_clist
  {
    \tl_new:c { g_projlib_language_settings_ #1 _tl }
  }

\tl_gput_right:Nn \g_projlib_language_settings_common_tl
  {
    \cs_if_exist:NT \ProjLibToday
      {
        \RenewCommandCopy \today \ProjLibToday
      }
  }

\tl_gput_right:Nn \g_projlib_language_settings_schinese_tl
  {
    \g_projlib_language_settings_common_tl
    \tl_gset:Nn \languagename          { schinese }
    \tl_gset:cn { abstractname   }     { 摘要     }
    \tl_gset:cn { proofname      }     { 证明     }
    \tl_gset:cn { contentsname   }     { 目录     }
    \tl_gset:cn { listfigurename }     { 插图     }
    \tl_gset:cn { listtablename  }     { 表格     }
    \tl_gset:cn { figurename     }     { 图       }
    \tl_gset:cn { tablename      }     { 表       }
    \tl_gset:cn { indexname      }     { 索引     }
    \tl_gset:cn { appendixname   }     { 附录     }
    \tl_gset:cn { refname        }     { 参考文献 }
    \tl_gset:cn { bibname        }     { 参考文献 }
  }

\tl_gput_right:Nn \g_projlib_language_settings_tchinese_tl
  {
    \g_projlib_language_settings_common_tl
    \tl_gset:Nn \languagename          { tchinese }
    \tl_gset:cn { abstractname   }     { 摘要     }
    \tl_gset:cn { proofname      }     { 證明     }
    \tl_gset:cn { contentsname   }     { 目錄     }
    \tl_gset:cn { listfigurename }     { 插圖     }
    \tl_gset:cn { listtablename  }     { 表格     }
    \tl_gset:cn { figurename     }     { 圖       }
    \tl_gset:cn { tablename      }     { 表       }
    \tl_gset:cn { indexname      }     { 索引     }
    \tl_gset:cn { appendixname   }     { 附錄     }
    \tl_gset:cn { refname        }     { 參考文獻 }
    \tl_gset:cn { bibname        }     { 參考文獻 }
  }

\tl_gput_right:Nn \g_projlib_language_settings_japanese_tl
  {
    \selectlanguage { japanese }
    \g_projlib_language_settings_common_tl
  }

\tl_gput_right:Nn \g_projlib_language_settings_english_tl
  {
    \selectlanguage { english }
    \g_projlib_language_settings_common_tl
  }

\tl_gput_right:Nn \g_projlib_language_settings_french_tl
  {
    \selectlanguage { french }
    \g_projlib_language_settings_common_tl
    \tl_gset:cn { frenchpartname } { Partie }
  }

\tl_gput_right:Nn \g_projlib_language_settings_ngerman_tl
  {
    \selectlanguage { ngerman }
    \g_projlib_language_settings_common_tl
  }

\tl_gput_right:Nn \g_projlib_language_settings_italian_tl
  {
    \selectlanguage { italian }
    \g_projlib_language_settings_common_tl
  }

\tl_gput_right:Nn \g_projlib_language_settings_portuguese_tl
  {
    \selectlanguage { portuguese }
    \g_projlib_language_settings_common_tl
  }

\tl_gput_right:Nn \g_projlib_language_settings_brazilian_tl
  {
    \selectlanguage { brazilian }
    \g_projlib_language_settings_common_tl
  }

\tl_gput_right:Nn \g_projlib_language_settings_spanish_tl
  {
    \selectlanguage { spanish }
    \g_projlib_language_settings_common_tl
  }

\tl_gput_right:Nn \g_projlib_language_settings_russian_tl
  {
    \selectlanguage { russian }
    \g_projlib_language_settings_common_tl
  }

\NewDocumentCommand \AddLanguageSetting { O{} m }
  {
    \tl_if_empty:nTF { #1 }
      {
        \tl_gput_right:Nn \g_projlib_language_settings_common_tl { #2 }
      }
      {
        \tl_gput_right:cn { g_projlib_language_settings_ \projlib_language_str_to_languagename:n { #1 } _tl } { #2 }
      }
  }


\RequirePackage { setspace }

\tl_new:N  \g_projlib_language_linespacing_latin_tl
\tl_new:N  \g_projlib_language_linespacing_cjk_tl

\tl_gset:Nn \g_projlib_language_linespacing_latin_tl
  {
    \setstretch { 1.00 }
  }
\tl_gset:Nn \g_projlib_language_linespacing_cjk_tl
  {
    \onehalfspacing
  }

\cs_new:Nn \projlib_language_set_linespacing_latin:n
  {
    \tl_gset:Nn \g_projlib_language_linespacing_latin_tl { #1 }
  }
\cs_new:Nn \projlib_language_set_linespacing_cjk:n
  {
    \tl_gset:Nn \g_projlib_language_linespacing_cjk_tl { #1 }
  }

\tl_new:N  \g_projlib_language_parindent_latin_tl
\tl_new:N  \g_projlib_language_parindent_cjk_tl

\@ifclassloaded { beamer }
  {
    \tl_gset:Nn \g_projlib_language_parindent_latin_tl
      {
        \dim_set:Nn \parindent { 0em }
      }
    \tl_gset:Nn \g_projlib_language_parindent_cjk_tl
      {
        \dim_set:Nn \parindent { 0em }
      }
  }
  {
    \tl_gset:Nn \g_projlib_language_parindent_latin_tl
      {
        \dim_set:Nn \parindent { 1.5em }
      }
    \tl_gset:Nn \g_projlib_language_parindent_cjk_tl
      {
        \dim_set:Nn \parindent { 2em }
      }
  }

\hook_gput_code:nnn { begindocument } { projlib-language }
  {
    \@ifpackageloaded { parskip }
      {
        \tl_gset:Nn \g_projlib_language_parindent_latin_tl
          {
            \dim_set:Nn \parindent { 0em }
          }
        \tl_gset:Nn \g_projlib_language_parindent_cjk_tl
          {
            \dim_set:Nn \parindent { 0em }
          }
      } {}
  }

\cs_new:Nn \projlib_language_set_parindent_latin:n
  {
    \tl_gset:Nn \g_projlib_language_parindent_latin_tl { #1 }
  }
\cs_new:Nn \projlib_language_set_parindent_cjk:n
  {
    \tl_gset:Nn \g_projlib_language_parindent_cjk_tl { #1 }
  }

\NewDocumentCommand \ProjLibLanguageSet { m m m }
  % #1 = the thing to set
  % #2 = language or type
  % #3 = the setting
  {
    \use:c { projlib_language_set_ #1 _ #2 :n } { #3 }
  }


\cs_new:Nn \projlib_language_use_language_pure:n
  {
    \tl_use:c { g_projlib_language_settings_ \projlib_language_str_to_languagename:n { #1 } _tl }
  }
\cs_generate_variant:Nn \projlib_language_use_language_pure:n { e }

\cs_new:Nn \projlib_language_use_language:n
  {
    \projlib_language_use_language_pure:n { #1 }
    \tl_use:c { g_projlib_language_linespacing_ \projlib_language_str_to_languagetype:n { #1 } _tl }
    \tl_use:c { g_projlib_language_parindent_ \projlib_language_str_to_languagetype:n { #1 } _tl }
  }
\cs_generate_variant:Nn \projlib_language_use_language:n { e }

\NewDocumentCommand \UseLanguage { m }
  {
    \hook_gput_code:nnn { begindocument } { projlib-language }
      {
        \projlib_language_use_language:e { #1 }
      }
  }
\NewDocumentCommand \UseOtherLanguage { m m }
  {
    \group_begin:
      \projlib_language_use_language_pure:e { #1 }
      #2
    \group_end:
  }

\UseLanguage { \g__projlib_language_main_str }


\cs_new:Nn \projlib_langauge_define_multilingual_text:Nn
  { % #1 = command name (with backslash)
    % #2 = key-value name configuration
    \keyval_parse:nnn
      {}
      { \__projlib_langauge_define_multilingual_text_do:nnn { \cs_to_str:N #1 } }
      { #2 }
    \tl_gset:Nn #1
      {
        \tl_use:c { \cs_to_str:N #1 _projlib_language_text_ \languagename }
      }
  }
\cs_generate_variant:Nn \projlib_langauge_define_multilingual_text:Nn { cn }

\cs_new:Nn \__projlib_langauge_define_multilingual_text_do:nnn
  { % #1 = command name
    % #2 = language name
    % #3 = the text
    \exp_args:Ne \tl_gset:cn { #1 _projlib_language_text_ \projlib_language_str_to_languagename:n { #2 } } { #3 }
  }

\NewDocumentCommand \DefineMultilingualText { m m }
  % #1 = command name
  % #2 = key-value name configuration
  {
    \projlib_langauge_define_multilingual_text:Nn #1 { #2 }
  }
%</projlib-language>
%
%<*projlib-logo>
\keys_define:nn { projlib-logo }
  {
    , draft   .bool_set:N   = \l__projlib_logo_fast_bool
    , draft   .initial:n    = { false }
    , fast    .bool_set:N   = \l__projlib_logo_fast_bool
    , unknown .code:n       = {}
  }
\ProcessKeysOptions { projlib-logo }

\bool_if:NT \l__projlib_logo_fast_bool
  {
    \DeclareRobustCommand * \ProjLib
      {
        \group_begin:
          \normalfont ProjLib
        \group_end:
      }
    \endinput
  }

\cs_if_exist:cTF { fontspec }
  {
    \newfontface \__projlib_logo_font: { LinBiolinum_R.otf }
  }
  {
    \RequirePackage [T1] { fontenc }
    \cs_gset:Nn \__projlib_logo_font:
      { \fontfamily { LinuxBiolinumT-TLF } \selectfont }
  }

\tl_new:N   \g__projlib_logo_sigma_j_tl
\tl_gset:Nn \g__projlib_logo_sigma_j_tl
  {
    \vbox:n
      {
        \offinterlineskip
        \hbox_overlap_center:n
          {
            \skip_horizontal:n { 0.75ex }
            \hbox_set:Nn    \l_tmpa_box { \usefont{U}{zeur}{b}{n} \symbol{"06} }
            \box_rotate:Nn  \l_tmpa_box { -10 }
            \box_scale:Nnn  \l_tmpa_box {.4} {.4}
            \box_use:N      \l_tmpa_box
          }
        \skip_vertical:n { 0.15ex }
        \hbox:n { \j }
      }
  }

% \RequirePackage { xcolor }
% \cs_new_protected:Nn \projlib_logo_generic:n
%   {
%     \group_begin:
%       \normalfont
%       \__projlib_logo_font:
%       \textcolor { blue!55!cyan }       { P }
%       \textcolor { blue!45!cyan }       { r }
%       \textcolor { blue!30!cyan }       { o }
%       \textcolor { green!70!black!70 }  { #1 }
%       \textcolor { red!20!yellow }      { L }
%       \textcolor { red!40!yellow }      { i }
%       \textcolor { red!55!yellow }      { b }
%     \group_end:
%   }
\cs_new_protected:Nn \projlib_logo_generic:n
  {
    \group_begin:
      \normalfont
      \__projlib_logo_font:
      \color_group_begin:
        \color_select:n { blue!60!cyan }      { P }
        \color_select:n { blue!45!cyan }      { r }
        \color_select:n { blue!30!cyan }      { o }
        \color_select:n { green!70!black!70 } { #1 }
        \color_select:n { red!20!yellow }     { L }
        \color_select:n { red!40!yellow }     { i }
        \color_select:n { red!60!yellow }     { b }
      \color_group_end:
    \group_end:
  }

\DeclareRobustCommand * \ProjLib
  {
    \projlib_logo_generic:n { \g__projlib_logo_sigma_j_tl }
  }
\DeclareRobustCommand * \ProjLibText
  {
    \projlib_logo_generic:n { j }
  }
%</projlib-logo>
%
%<*projlib-math>
\keys_define:nn { projlib-math }
  {
    , unknown     .code:n     = {}
  }
\ProcessKeysOptions { projlib-math }

\RequirePackage { mathtools }
\RequirePackage { mathrsfs }
\PassOptionsToPackage { warnings-off = { mathtools-colon, mathtools-overbracket } } { unicode-math }
\@ifpackageloaded { unicode-math } {} { \RequirePackage { amssymb } }


\msg_new:nnn { projlib-math }
  { operator-not-define }
  { The~math~operator~"\iow_char:N \\#1"~cannot~be~defined,~a~command~with~the~same~name~has~already~existed. }

\keys_define:nn { projlib-math-operator }
  {
    , style        .tl_set:N     = \l__projlib_math_operator_style_tl
    , unknown      .code:n       = {}
  }

\cs_new_protected:Nn \projlib_math_define_operator:nnn
  % #1 = bool for star or empty
  % #2 = list of operators
  % #3 = the option
  {
    \tl_clear:N \l__projlib_math_operator_style_tl
    \keys_set:nn { projlib-math-operator } { #3 }
    \clist_map_inline:nn { #2 }
      {
        \str_if_in:nnTF { ##1 } { = }
          {
            \seq_set_split:Nnn \l_tmpa_seq { = } { ##1 }
            \__projlib_math_define_operator:nee { #1 } { \seq_item:Nn \l_tmpa_seq { 1 } } { \seq_item:Nn \l_tmpa_seq { 2 } }
          }
          {
            \__projlib_math_define_operator:nee { #1 } { ##1 } { ##1 }
          }
      }
  }

\cs_new_protected:Nn \__projlib_math_define_operator:nnn
  % #1 = bool for star or empty
  % #2 = the operator
  % #3 = the content
  {
    \cs_if_exist:cTF { #2 }
      {
        \msg_warning:nnn  { projlib-math } { operator-not-define } { #2 }
      }
      {
        \bool_if:NTF #1
          {
            \exp_args:Nnf \use:n
              { \exp_args:Nnc \use:n { \DeclareMathOperator* } { #2 } }
          }
          {
            \exp_args:Nnf \use:n
              { \exp_args:Nc \DeclareMathOperator { #2 } }
          }
          % This is the f-argument of  \exp_args:Nnf :
          {
            \exp_args:NnV \use:nn
              { \exp_stop_f: }
              { \l__projlib_math_operator_style_tl } { #3 }
          }
      }
  }
\cs_generate_variant:Nn \__projlib_math_define_operator:nnn { nee }

\NewDocumentCommand \DefineOperator { s O{} m O{} }
  {
    \tl_if_blank:nTF { #2 }
      {
        \projlib_math_define_operator:nnn { #1 } { #3 } { #4 }
      }
      {
        \projlib_math_define_operator:nnn { #1 } { #3 } { #2 }
      }
  }


\msg_new:nnn { projlib-math }
  { shortcut-not-define }
  { The~shortcut~"\iow_char:N \\#1"~cannot~be~defined,~a~command~with~the~same~name~has~already~existed. }

\msg_new:nnn { projlib-math }
  { shortcut-type-not-define }
  { The~shortcut~type~"#1"~is~not~available,~a~command~with~the~same~name~has~already~existed. }

\keys_define:nn { projlib-math-shortcut }
  {
    , prefix       .clist_set:N  = \l__projlib_math_shortcut_prefix_clist
    , type         .tl_set:N     = \l__projlib_math_shortcut_type_tl
    , style        .tl_set:N     = \l__projlib_math_shortcut_style_tl
    , unknown      .code:n       = {}
  }

\cs_new_protected:Nn \projlib_math_define_shortcut:nnn
  % #1 = bool for star or empty
  % (currently the starred version is the same as normal version)
  % #2 = list of shortcuts
  % #3 = the option
  {
    \clist_clear:N \l__projlib_math_shortcut_prefix_clist
    \tl_clear:N \l__projlib_math_shortcut_type_tl
    \tl_clear:N \l__projlib_math_shortcut_style_tl
    \keys_set:nn { projlib-math-shortcut } { #3 }
    \tl_if_empty:NF \l__projlib_math_shortcut_type_tl
      {
        \cs_if_exist:cTF { \l__projlib_math_shortcut_type_tl }
          {
            \exp_args:Nne \use:n
              { \msg_warning:nnn  { projlib-math } { shortcut-type-not-define } }
              { \l__projlib_math_shortcut_type_tl }
          }
          {
            \exp_args:Nno \use:n
              {
                \exp_args:Nc \NewDocumentCommand { \l__projlib_math_shortcut_type_tl } { m }
              }
              {
                \l__projlib_math_shortcut_style_tl { ##1 }
              }
          }
      }
    \clist_map_inline:nn { #2 }
      {
        \str_if_in:nnTF { ##1 } { = }
          {
            \seq_set_split:Nnn \l_tmpa_seq { = } { ##1 }
            \clist_if_empty:NTF \l__projlib_math_shortcut_prefix_clist
              {
                \__projlib_math_define_shortcut:ee { \seq_item:Nn \l_tmpa_seq { 1 } } { \seq_item:Nn \l_tmpa_seq { 2 } }
              }
              {
                \clist_map_inline:Nn \l__projlib_math_shortcut_prefix_clist
                  {
                    \__projlib_math_define_shortcut:ee { ####1 \seq_item:Nn \l_tmpa_seq { 1 } } { \seq_item:Nn \l_tmpa_seq { 2 } }
                  }
              }
          }
          {
            \clist_if_empty:NTF \l__projlib_math_shortcut_prefix_clist
              {
                \__projlib_math_define_shortcut:ee { ##1 } { ##1 }
              }
              {
                \clist_map_inline:Nn \l__projlib_math_shortcut_prefix_clist
                  {
                    \__projlib_math_define_shortcut:ee { ####1 ##1 } { ##1 }
                  }
              }
          }
      }
  }

\cs_new_protected:Nn \__projlib_math_define_shortcut:nn
  % #1 = command name
  % #2 = the content
  {
    \cs_if_exist:cTF { #1 }
      {
        \msg_warning:nnn { projlib-math } { shortcut-type-not-define } { #1 }
      }
      {
        \exp_args:Nno \use:n
          { \exp_args:Nc \NewDocumentCommand { #1 } {} }
          { \l__projlib_math_shortcut_style_tl { #2 } }
      }
  }
\cs_generate_variant:Nn \__projlib_math_define_shortcut:nn { ee }

\NewDocumentCommand \DefineShortcut { s O{} m O{} }
  {
    \tl_if_blank:nTF { #2 }
      {
        \projlib_math_define_shortcut:nnn { #1 } { #3 } { #4 }
      }
      {
        \projlib_math_define_shortcut:nnn { #1 } { #3 } { #2 }
      }
  }
%</projlib-math>
%
%<*projlib-paper>
\keys_define:nn { projlib-paper }
  {
    , preview-mode      .bool_set:N         = \l__projlib_paper_preview_bool
    , preview-mode      .initial:n          = { false }
    , paper-style       .tl_set:N           = \l__projlib_paper_paperstyle_tl
    , paper-style       .initial:n          = { normal }
    , paper-style       .value_required:n   = true
    , paper~style       .tl_set:N           = \l__projlib_paper_paperstyle_tl
    , paper style       .tl_set:N           = \l__projlib_paper_paperstyle_tl
    , yellow-paper      .meta:n             = { paperstyle = yellow     }
    , yellow~paper      .meta:n             = { paperstyle = yellow     }
    , yellow paper      .meta:n             = { paperstyle = yellow     }
    , parchment-paper   .meta:n             = { paperstyle = parchment  }
    , parchment~paper   .meta:n             = { paperstyle = parchment  }
    , parchment paper   .meta:n             = { paperstyle = parchment  }
    , green-paper       .meta:n             = { paperstyle = green      }
    , green~paper       .meta:n             = { paperstyle = green      }
    , green paper       .meta:n             = { paperstyle = green      }
    , light-gray-paper  .meta:n             = { paperstyle = lightgray  }
    , light~gray~paper  .meta:n             = { paperstyle = lightgray  }
    , light gray-paper  .meta:n             = { paperstyle = lightgray  }
    , light gray~paper  .meta:n             = { paperstyle = lightgray  }
    , light gray paper  .meta:n             = { paperstyle = lightgray  }
    , gray-paper        .meta:n             = { paperstyle = gray       }
    , gray~paper        .meta:n             = { paperstyle = gray       }
    , gray paper        .meta:n             = { paperstyle = gray       }
    , nord-paper        .meta:n             = { paperstyle = nord       }
    , nord~paper        .meta:n             = { paperstyle = nord       }
    , nord paper        .meta:n             = { paperstyle = nord       }
    , dark-paper        .meta:n             = { paperstyle = dark       }
    , dark~paper        .meta:n             = { paperstyle = dark       }
    , dark paper        .meta:n             = { paperstyle = dark       }
    , unknown           .code:n             = {}
  }
\ProcessKeysOptions { projlib-paper }

\cs_new:Nn \projlib_paper_preview_disable:
  {
    \bool_set_false:c { l__projlib_paper_preview_bool }
  }

\hook_gput_code:nnn { begindocument/before } { projlib-paper }
  {
    \bool_if:NT \l__projlib_paper_preview_bool
      {
        \dim_set:Nn \paperwidth
          {
            \dim_eval:n { \textwidth * 21 / 20 }
          }
        \dim_set:Nn \paperheight
          {
            \dim_eval:n { ( \textheight + \headheight + \headsep + \footskip ) * 21 / 20 }
          }
        \dim_set:Nn \oddsidemargin
          {
            \dim_eval:n { ( \paperwidth - \textwidth ) / 2 - 1in }
          }
        \dim_set:Nn \evensidemargin
          {
            \dim_eval:n { ( \paperwidth - \textwidth ) / 2 - 1in }
          }
        \dim_set:Nn \topmargin
          {
            \dim_eval:n { ( \paperheight - \textheight - \headheight - \headsep - \footskip ) / 2 - 1in }
          }
      }
  }

\RequirePackage { xcolor }

\definecolor { paper }     { RGB } { 255, 255, 255 }
\definecolor { main-text } { RGB } {   0,   0,   0 }

\str_case_e:nn { \l__projlib_paper_paperstyle_tl }
  {
    { yellow      } { \definecolor { paper }     { RGB } { 247, 246, 233 } }
    { parchment   } { \definecolor { paper }     { RGB } { 224, 204, 160 } }
    { green       } { \definecolor { paper }     { RGB } { 207, 231, 207 } }
    { lightgray   } { \definecolor { paper }     { RGB } { 236, 239, 244 }
                      \definecolor { main-text } { RGB } {  37,  41,  46 } }
    { light-gray  } { \definecolor { paper }     { RGB } { 236, 239, 244 }
                      \definecolor { main-text } { RGB } {  37,  41,  46 } }
    { gray        } { \definecolor { paper }     { RGB } { 127, 130, 136 }
                      \definecolor { main-text } { RGB } { 236, 239, 244 } }
    { nord        } { \definecolor { paper }     { RGB } {  46,  52,  64 }
                      \definecolor { main-text } { RGB } { 214, 220, 230 } }
    { dark        } { \definecolor { paper }     { RGB } {  28,  29,  33 }
                      \definecolor { main-text } { RGB } { 210, 213, 217 } }
  }

\cs_new:Nn \projlib_paper_set_page_color:n
  {
    \pagecolor { #1 }
  }
\cs_new:Nn \projlib_paper_set_text_color:n
  {
    \color { #1 }
    \cs_gset_eq:cc { default@color } { current@color }
  }

\projlib_paper_set_page_color:n { paper }
\projlib_paper_set_text_color:n { main-text }

\hook_gput_code:nnn { begindocument/before } { projlib-paper }
  {
    \cs_if_exist:NT \tcbset
      { \tcbset { colupper = main-text, collower = main-text } }
  }
%</projlib-paper>
%
%<*projlib-theorem>
\keys_define:nn { projlib-theorem }
  {
    , no-theorems           .bool_set:N         = \l__projlib_theorem_no_theorems_bool
    , no-theorems           .initial:n          = { false }
    , no~theorems           .bool_set:N         = \l__projlib_theorem_no_theorems_bool
    , no theorems           .bool_set:N         = \l__projlib_theorem_no_theorems_bool
    , nothms                .bool_set:N         = \l__projlib_theorem_no_theorems_bool
    , no-theorem-numbering  .bool_set:N         = \l__projlib_theorem_no_theorem_numbering_bool
    , no-theorem-numbering  .initial:n          = { false }
    , no~theorem~numbering  .bool_set:N         = \l__projlib_theorem_no_theorem_numbering_bool
    , no theorem numbering  .bool_set:N         = \l__projlib_theorem_no_theorem_numbering_bool
    , nothmnum              .bool_set:N         = \l__projlib_theorem_no_theorem_numbering_bool
    , theorem-numbering     .tl_set:N           = \l__projlib_theorem_theorem_numbering_tl
    , theorem-numbering     .default:n          = { * }
    , theorem~numbering     .tl_set:N           = \l__projlib_theorem_theorem_numbering_tl
    , theorem~numbering     .default:n          = { * }
    , theorem numbering     .tl_set:N           = \l__projlib_theorem_theorem_numbering_tl
    , theorem numbering     .default:n          = { * }
    , thmnum                .tl_set:N           = \l__projlib_theorem_theorem_numbering_tl
    , thmnum                .default:n          = { * }
    , complex-name          .bool_set:N         = \l__projlib_theorem_complexname_bool
    , complex-name          .initial:n          = { true }
    , complex~name          .bool_set:N         = \l__projlib_theorem_complexname_bool
    , complex name          .bool_set:N         = \l__projlib_theorem_complexname_bool
    , simple-name           .bool_set_inverse:N = \l__projlib_theorem_complexname_bool
    , simple~name           .bool_set_inverse:N = \l__projlib_theorem_complexname_bool
    , simple name           .bool_set_inverse:N = \l__projlib_theorem_complexname_bool
    , no-preset-names       .bool_set_inverse:N = \l__projlib_theorem_presetname_bool
    , no-preset-names       .initial:n          = { false }
    , no~preset~names       .bool_set_inverse:N = \l__projlib_theorem_presetname_bool
    , no preset names       .bool_set_inverse:N = \l__projlib_theorem_presetname_bool
    , unknown               .code:n             = { \PassOptionsToPackage { \CurrentOption } { create-theorem } }
  }
\ProcessKeysOptions { projlib-theorem }

\clist_const:Nn \c_projlib_theorem_supported_clist
  {
    assertion                 ,
    assumption                ,
    axiom                     ,
    conclusion                ,
    conjecture                ,
    convention                ,
    corollary                 ,
    definition                ,
    example                   ,
    exercise                  ,
    fact                      ,
    hypothesis                ,
    lemma                     ,
    notation                  ,
    observation               ,
    postulate                 ,
    problem                   ,
    property                  ,
    proposition               ,
    question                  ,
    remark                    ,
    theorem                   ,
    definition-proposition    ,
    definition-theorem        ,
  }

\@ifclassloaded { beamer }
  {
    \RequirePackage { silence }
    \WarningFilter { cleveref } { hyperref~package~loaded~with~implicit=false~option }
    \bool_set_true:N \l__projlib_theorem_no_theorem_numbering_bool
    \bool_if:NF \l__projlib_theorem_no_theorems_bool
      {
        \cs_undefine:c { theorem    }
        \cs_undefine:c { lemma      }
        \cs_undefine:c { corollary  }
        \cs_undefine:c { definition }
        \cs_undefine:c { fact       }
        \cs_undefine:c { example    }
        \cs_undefine:c { problem    }
      }
  } {}

\RequirePackage { projlib-language }

% \bool_if:NF \l__projlib_theorem_complexname_bool
%   {
%     \PassOptionsToPackage { no preset names } { create-theorem }
%   }

\RequirePackage { amsthm }
\RequirePackage { create-theorem }


\bool_if:NF \l__projlib_theorem_no_theorems_bool
  {
    \bool_if:NTF \l__projlib_theorem_no_theorem_numbering_bool
      {
        \exp_args:Nv \CreateTheorem { c_projlib_theorem_supported_clist } { numberless, create starred version }
      }
      {
        \tl_if_blank:eTF \l__projlib_theorem_theorem_numbering_tl
          {
            \cs_if_exist:cTF { c@chapter }
              { % with \chapter
                \CreateTheorem {theorem} { parent counter = chapter, create starred version }
              }
              { % without \chapter
                \CreateTheorem {theorem} { parent counter = section, create starred version }
              }
          }
          {
            \tl_if_eq:NnTF \l__projlib_theorem_theorem_numbering_tl { * }
              {
                \CreateTheorem {theorem} { create starred version }
              }
              {
                \CreateTheorem {theorem} { parent counter = \l__projlib_theorem_theorem_numbering_tl, create starred version }
              }
          }

        \exp_args:Nv \CreateTheorem { c_projlib_theorem_supported_clist } { shared counter = theorem, create starred version, quiet }
      }
  }


\AddLanguageSetting [ schinese ]
  {
    \crefname { equation } { 式 } { 式 }
    \crefname { figure } { 图 } { 图 }
    \crefname { table } { 表 } { 表 }
    \crefname { appendix } { 附录 } { 附录 }
    \Crefname { equation } { 式 } { 式 }
    \Crefname { figure } { 图 } { 图 }
    \Crefname { table } { 表 } { 表 }
    \Crefname { appendix } { 附录 } { 附录 }
    \tl_gset:Nn { \crefpairconjunction } { 、 }
    \tl_gset:Nn { \crefmiddleconjunction } { 、 }
    \tl_gset:Nn { \creflastconjunction } { \nobreakspace 和 \nobreakspace }
    \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace 和 \nobreakspace }
    \tl_gset:Nn { \crefmiddlegroupconjunction } { 、 }
    \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace 以及 \nobreakspace }
    \tl_gset:Nn { \crefrangeconjunction } { ～ }
  }

\AddLanguageSetting [ tchinese ]
  {
    \crefname { equation } { 式 } { 式 }
    \crefname { figure } { 圖 } { 圖 }
    \crefname { table } { 表 } { 表 }
    \crefname { appendix } { 附錄 } { 附錄 }
    \Crefname { equation } { 式 } { 式 }
    \Crefname { figure } { 圖 } { 圖 }
    \Crefname { table } { 表 } { 表 }
    \Crefname { appendix } { 附錄 } { 附錄 }
    \tl_gset:Nn { \crefpairconjunction } { 、 }
    \tl_gset:Nn { \crefmiddleconjunction } { 、 }
    \tl_gset:Nn { \creflastconjunction } { \nobreakspace 與 \nobreakspace }
    \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace 與 \nobreakspace }
    \tl_gset:Nn { \crefmiddlegroupconjunction } { 、 }
    \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace 以及 \nobreakspace }
    \tl_gset:Nn { \crefrangeconjunction } { ～ }
  }

\AddLanguageSetting [ japanese ]
  {
    \crefname { equation } { 式 } { 式 }
    \crefname { figure } { 図 } { 図 }
    \crefname { table } { 表 } { 表 }
    \Crefname { appendix } { 付録 } { 付録 }
    \Crefname { equation } { 式 } { 式 }
    \Crefname { figure } { 図 } { 図 }
    \Crefname { table } { 表 } { 表 }
    \Crefname { appendix } { 付録 } { 付録 }
    \tl_gset:Nn { \crefpairconjunction } { \nobreakspace と \nobreakspace }
    \tl_gset:Nn { \crefmiddleconjunction } { \nobreakspace と \nobreakspace }
    \tl_gset:Nn { \creflastconjunction } { \nobreakspace と \nobreakspace }
    \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace と \nobreakspace }
    \tl_gset:Nn { \crefmiddlegroupconjunction } { \nobreakspace と \nobreakspace }
    \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace 及び \nobreakspace }
    \tl_gset:Nn { \crefrangeconjunction } { ～ }
  }

\AddLanguageSetting [ russian ]
  {
    \crefname { equation } { уравнение } { уравнения }
    \crefname { figure } { рис. } { рис. }
    \crefname { table } { таблица } { таблицы }
    \crefname { appendix } { приложение } { приложения }
    \Crefname { equation } { Уравнение } { Уравнения }
    \Crefname { figure } { Рис. } { Рис. }
    \Crefname { table } { Таблица } { Таблицы }
    \Crefname { appendix } { Приложение } { Приложения }
    \tl_gset:Nn { \crefpairconjunction } { \nobreakspace и \nobreakspace }
    \tl_gset:Nn { \crefmiddleconjunction } { , \nobreakspace }
    \tl_gset:Nn { \creflastconjunction } { \nobreakspace и \nobreakspace }
    \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace и \nobreakspace }
    \tl_gset:Nn { \crefmiddlegroupconjunction } { , \nobreakspace  }
    \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace и \nobreakspace }
    \tl_gset:Nn { \crefrangeconjunction } { \nobreakspace \textasciitilde \nobreakspace }
  }

\AddLanguageSetting [ portuguese ]
  {
    \crefname { equation } { eq. } { eqs. }
    \crefname { figure } { fig. } { figs. }
    \crefname { table } { tabela } { tabelas }
    \crefname { appendix } { apêndice } { apêndices }
    \Crefname { equation } { Eq. } { Eqs. }
    \Crefname { figure } { Fig. } { Figs. }
    \Crefname { table } { Tabela } { Tabelas }
    \Crefname { appendix } { Apêndice } { Apêndices }
    \tl_gset:Nn { \crefpairconjunction } { \nobreakspace e \nobreakspace }
    \tl_gset:Nn { \crefmiddleconjunction } { , \nobreakspace }
    \tl_gset:Nn { \creflastconjunction } { \nobreakspace e \nobreakspace }
    \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace e \nobreakspace }
    \tl_gset:Nn { \crefmiddlegroupconjunction } { , \nobreakspace }
    \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace e \nobreakspace }
    \tl_gset:Nn { \crefrangeconjunction } { \nobreakspace a \nobreakspace }
  }


\bool_if:NF \l__projlib_theorem_presetname_bool { \endinput }
\bool_if:NT \l__projlib_theorem_complexname_bool { \endinput }


\NameTheorem { assertion }
  {
    , heading =   {
                    , english     = Assertion
                    , french      = Assertion
                    , ngerman     = Behauptung
                    , italian     = Asserzione
                    , portuguese  = Asserção
                    , brazilian   = Asserção
                    , spanish     = Aserción
                    , schinese    = 断言
                    , tchinese    = 斷言
                    , japanese    = アサーション
                    , russian     = Утверждение
                  }
    , crefname =  {
                    , english     = {Assertion}{Assertion}
                    , french      = [l']{Assertion}[les]{Assertion}
                    , ngerman     = {Behauptung}{Behauptung}
                    , italian     = [l']{Asserzione}[le]{Asserzione}
                    , portuguese  = [a]{Asserção}[as]{Asserção}
                    , brazilian   = [a]{Asserção}[as]{Asserção}
                    , spanish     = [la]{Aserción}[las]{Aserción}
                    , schinese    = {断言}{断言}
                    , tchinese    = {斷言}{斷言}
                    , japanese    = {アサーション}{アサーション}
                    , russian     = {Утверждение}{Утверждение}
                  }
    , Crefname =  {
                    , english     = {Assertion}{Assertion}
                    , french      = [L']{Assertion}[Les]{Assertion}
                    , ngerman     = {Behauptung}{Behauptung}
                    , italian     = [L']{Asserzione}[Le]{Asserzione}
                    , portuguese  = [A]{Asserção}[As]{Asserção}
                    , brazilian   = [A]{Asserção}[As]{Asserção}
                    , spanish     = [La]{Aserción}[Las]{Aserción}
                    , schinese    = {断言}{断言}
                    , tchinese    = {斷言}{斷言}
                    , japanese    = {アサーション}{アサーション}
                    , russian     = {Утверждение}{Утверждение}
                  }
  }

\NameTheorem { assumption }
  {
    , heading =   {
                    , english     = Assumption
                    , french      = Supposition
                    , ngerman     = Annahme
                    , italian     = Supposizione
                    , portuguese  = Suposição
                    , brazilian   = Suposição
                    , spanish     = Suposición
                    , schinese    = 假定
                    , tchinese    = 假定
                    , japanese    = 仮定
                    , russian     = Предположение
                  }
    , crefname =  {
                    , english     = {Assumption}{Assumption}
                    , french      = [la]{Supposition}[les]{Supposition}
                    , ngerman     = {Annahme}{Annahme}
                    , italian     = [la]{Supposizione}[le]{Supposizione}
                    , portuguese  = [a]{Suposição}[as]{Suposição}
                    , brazilian   = [a]{Suposição}[as]{Suposição}
                    , spanish     = [la]{Suposición}[las]{Suposición}
                    , schinese    = {假定}{假定}
                    , tchinese    = {假定}{假定}
                    , japanese    = {仮定}{仮定}
                    , russian     = {Предположение}{Предположение}
                  }
    , Crefname =  {
                    , english     = {Assumption}{Assumption}
                    , french      = [La]{Supposition}[Les]{Supposition}
                    , ngerman     = {Annahme}{Annahme}
                    , italian     = [la]{Supposizione}[le]{Supposizione}
                    , portuguese  = [A]{Suposição}[As]{Suposição}
                    , brazilian   = [A]{Suposição}[As]{Suposição}
                    , spanish     = [La]{Suposición}[Las]{Suposición}
                    , schinese    = {假定}{假定}
                    , tchinese    = {假定}{假定}
                    , japanese    = {仮定}{仮定}
                    , russian     = {Предположение}{Предположение}
                  }
  }

\NameTheorem { axiom }
  {
    , heading =   {
                    , english     = Axiom
                    , french      = Axiome
                    , ngerman     = Axiom
                    , italian     = Assioma
                    , portuguese  = Axioma
                    , brazilian   = Axioma
                    , spanish     = Axioma
                    , schinese    = 公理
                    , tchinese    = 公理
                    , japanese    = 公理
                    , russian     = Аксиома
                  }
    , crefname =  {
                    , english     = {Axiom}{Axiom}
                    , french      = [l']{Axiome}[les]{Axiome}
                    , ngerman     = {Axiom}{Axiom}
                    , italian     = [l']{Assioma}[gli]{Assioma}
                    , portuguese  = [o]{Axioma}[os]{Axioma}
                    , brazilian   = [o]{Axioma}[os]{Axioma}
                    , spanish     = [el]{Axioma}[los]{Axioma}
                    , schinese    = {公理}{公理}
                    , tchinese    = {公理}{公理}
                    , japanese    = {公理}{公理}
                    , russian     = {Аксиома}{Аксиома}
                  }
    , Crefname =  {
                    , english     = {Axiom}{Axiom}
                    , french      = [L']{Axiome}[Les]{Axiome}
                    , ngerman     = {Axiom}{Axiom}
                    , italian     = [L']{Assioma}[Gli]{Assioma}
                    , portuguese  = [O]{Axioma}[Os]{Axioma}
                    , brazilian   = [O]{Axioma}[Os]{Axioma}
                    , spanish     = [El]{Axioma}[Los]{Axioma}
                    , schinese    = {公理}{公理}
                    , tchinese    = {公理}{公理}
                    , japanese    = {公理}{公理}
                    , russian     = {Аксиома}{Аксиома}
                  }
  }

\NameTheorem { conclusion }
  {
    , heading =   {
                    , english     = Conclusion
                    , french      = Conclusion
                    , ngerman     = Schlussfolgerung
                    , italian     = Conclusione
                    , portuguese  = Conclusão
                    , brazilian   = Conclusão
                    , spanish     = Conclusión
                    , schinese    = 结论
                    , tchinese    = 結論
                    , japanese    = 結論
                    , russian     = Вывод
                  }
    , crefname =  {
                    , english     = {Conclusion}{Conclusion}
                    , french      = [la]{Conclusion}[Les]{Conclusion}
                    , ngerman     = {Schlussfolgerung}{Schlussfolgerung}
                    , italian     = [la]{Conclusione}[le]{Conclusione}
                    , portuguese  = [a]{Conclusão}[as]{Conclusão}
                    , brazilian   = [a]{Conclusão}[as]{Conclusão}
                    , spanish     = [la]{Conclusión}[las]{Conclusión}
                    , schinese    = {结论}{结论}
                    , tchinese    = {結論}{結論}
                    , japanese    = {結論}{結論}
                    , russian     = {Вывод}{Вывод}
                  }
    , Crefname =  {
                    , english     = {Conclusion}{Conclusion}
                    , french      = [La]{Conclusion}[Les]{Conclusion}
                    , ngerman     = {Schlussfolgerung}{Schlussfolgerung}
                    , italian     = [La]{Conclusione}[Le]{Conclusione}
                    , portuguese  = [A]{Conclusão}[As]{Conclusão}
                    , brazilian   = [A]{Conclusão}[As]{Conclusão}
                    , spanish     = [La]{Conclusión}[Las]{Conclusión}
                    , schinese    = {结论}{结论}
                    , tchinese    = {結論}{結論}
                    , japanese    = {結論}{結論}
                    , russian     = {Вывод}{Вывод}
                  }
  }

\NameTheorem { conjecture }
  {
    , heading =   {
                    , english     = Conjecture
                    , french      = Conjecture
                    , ngerman     = Vermutung
                    , italian     = Congettura
                    , portuguese  = Conjetura
                    , brazilian   = Conjectura
                    , spanish     = Conjetura
                    , schinese    = 猜想
                    , tchinese    = 猜想
                    , japanese    = 予想
                    , russian     = Гипотеза
                  }
    , crefname =  {
                    , english     = {Conjecture}{Conjecture}
                    , french      = [la]{Conjecture}[les]{Conjecture}
                    , ngerman     = {Vermutung}{Vermutung}
                    , italian     = [la]{Congettura}[le]{Congettura}
                    , portuguese  = [a]{Conjetura}[as]{Conjetura}
                    , brazilian   = [a]{Conjectura}[as]{Conjectura}
                    , spanish     = [la]{Conjetura}[las]{Conjetura}
                    , schinese    = {猜想}{猜想}
                    , tchinese    = {猜想}{猜想}
                    , japanese    = {予想}{予想}
                    , russian     = {Гипотеза}{Гипотеза}
                  }
    , Crefname =  {
                    , english     = {Conjecture}{Conjecture}
                    , french      = [La]{Conjecture}[Les]{Conjecture}
                    , ngerman     = {Vermutung}{Vermutung}
                    , italian     = [La]{Congettura}[Le]{Congettura}
                    , portuguese  = [A]{Conjetura}[As]{Conjetura}
                    , brazilian   = [A]{Conjectura}[As]{Conjectura}
                    , spanish     = [La]{Conjetura}[Las]{Conjetura}
                    , schinese    = {猜想}{猜想}
                    , tchinese    = {猜想}{猜想}
                    , japanese    = {予想}{予想}
                    , russian     = {Гипотеза}{Гипотеза}
                  }
  }

\NameTheorem { convention }
  {
    , heading =   {
                    , english     = Convention
                    , french      = Convention
                    , ngerman     = Konvention
                    , italian     = Convenzione
                    , portuguese  = Convenção
                    , brazilian   = Convenção
                    , spanish     = Convención
                    , schinese    = 约定
                    , tchinese    = 約定
                    , japanese    = 慣例
                    , russian     = Конвенция
                  }
    , crefname =  {
                    , english     = {Convention}{Convention}
                    , french      = [la]{Convention}[les]{Convention}
                    , ngerman     = {Konvention}{Konvention}
                    , italian     = [la]{Convenzione}[le]{Convenzione}
                    , portuguese  = [a]{Convenção}[as]{Convenção}
                    , brazilian   = [a]{Convenção}[as]{Convenção}
                    , spanish     = [la]{Convención}[las]{Convención}
                    , schinese    = {约定}{约定}
                    , tchinese    = {約定}{約定}
                    , japanese    = {慣例}{慣例}
                    , russian     = {Конвенция}{Конвенция}
                  }
    , Crefname =  {
                    , english     = {Convention}{Convention}
                    , french      = [La]{Convention}[Les]{Convention}
                    , ngerman     = {Konvention}{Konvention}
                    , italian     = [La]{Convenzione}[Le]{Convenzione}
                    , portuguese  = [A]{Convenção}[As]{Convenção}
                    , brazilian   = [A]{Convenção}[As]{Convenção}
                    , spanish     = [La]{Convención}[Las]{Convención}
                    , schinese    = {约定}{约定}
                    , tchinese    = {約定}{約定}
                    , japanese    = {慣例}{慣例}
                    , russian     = {Конвенция}{Конвенция}
                  }
  }

\NameTheorem { corollary }
  {
    , heading =   {
                    , english     = Corollary
                    , french      = Corollaire
                    , ngerman     = Korollar
                    , italian     = Corollario
                    , portuguese  = Corolário
                    , brazilian   = Corolário
                    , spanish     = Corolario
                    , schinese    = 推论
                    , tchinese    = 推論
                    , japanese    = 系
                    , russian     = Следствие
                  }
    , crefname =  {
                    , english     = {Corollary}{Corollary}
                    , french      = [le]{Corollaire}[les]{Corollaire}
                    , ngerman     = {Korollar}{Korollar}
                    , italian     = [il]{Corollario}[i]{Corollario}
                    , portuguese  = [o]{Corolário}[os]{Corolário}
                    , brazilian   = [o]{Corolário}[os]{Corolário}
                    , spanish     = [el]{Corolario}[los]{Corolario}
                    , schinese    = {推论}{推论}
                    , tchinese    = {推論}{推論}
                    , japanese    = {系}{系}
                    , russian     = {Следствие}{Следствие}
                  }
    , Crefname =  {
                    , english     = {Corollary}{Corollary}
                    , french      = [Le]{Corollaire}[Les]{Corollaire}
                    , ngerman     = {Korollar}{Korollar}
                    , italian     = [Il]{Corollario}[I]{Corollario}
                    , portuguese  = [O]{Corolário}[Os]{Corolário}
                    , brazilian   = [O]{Corolário}[Os]{Corolário}
                    , spanish     = [El]{Corolario}[Los]{Corolario}
                    , schinese    = {推论}{推论}
                    , tchinese    = {推論}{推論}
                    , japanese    = {系}{系}
                    , russian     = {Следствие}{Следствие}
                  }
  }

\NameTheorem { definition }
  {
    , heading =   {
                    , english     = Definition
                    , french      = Définition
                    , ngerman     = Definition
                    , italian     = Definizione
                    , portuguese  = Definição
                    , brazilian   = Definição
                    , spanish     = Definición
                    , schinese    = 定义
                    , tchinese    = 定義
                    , japanese    = 定義
                    , russian     = Определение
                  }
    , crefname =  {
                    , english     = {Definition}{Definition}
                    , french      = [la]{Définition}[les]{Définition}
                    , ngerman     = {Definition}{Definition}
                    , italian     = [la]{Definizione}[le]{Definizione}
                    , portuguese  = [a]{Definição}[as]{Definição}
                    , brazilian   = [a]{Definição}[as]{Definição}
                    , spanish     = [la]{Definición}[las]{Definición}
                    , schinese    = {定义}{定义}
                    , tchinese    = {定義}{定義}
                    , japanese    = {定義}{定義}
                    , russian     = {Определение}{Определение}
                  }
    , Crefname =  {
                    , english     = {Definition}{Definition}
                    , french      = [La]{Définition}[Les]{Définition}
                    , ngerman     = {Definition}{Definition}
                    , italian     = [La]{Definizione}[Le]{Definizione}
                    , portuguese  = [A]{Definição}[As]{Definição}
                    , brazilian   = [A]{Definição}[As]{Definição}
                    , spanish     = [La]{Definición}[Las]{Definición}
                    , schinese    = {定义}{定义}
                    , tchinese    = {定義}{定義}
                    , japanese    = {定義}{定義}
                    , russian     = {Определение}{Определение}
                  }
  }

\NameTheorem { example }
  {
    , heading =   {
                    , english     = Example
                    , french      = Exemple
                    , ngerman     = Beispiel
                    , italian     = Esempio
                    , portuguese  = Exemplo
                    , brazilian   = Exemplo
                    , spanish     = Ejemplo
                    , schinese    = 例
                    , tchinese    = 例
                    , japanese    = 例
                    , russian     = Пример
                  }
    , crefname =  {
                    , english     = {Example}{Example}
                    , french      = [l']{Example}[les]{Example}
                    , ngerman     = {Beispiel}{Beispiel}
                    , italian     = [l']{Esempio}[gli]{Esempio}
                    , portuguese  = [o]{Exemplo}[os]{Exemplo}
                    , brazilian   = [o]{Exemplo}[os]{Exemplo}
                    , spanish     = [el]{Ejemplo}[los]{Ejemplo}
                    , schinese    = {例}{例}
                    , tchinese    = {例}{例}
                    , japanese    = {例}{例}
                    , russian     = {Пример}{Пример}
                  }
    , Crefname =  {
                    , english     = {Example}{Example}
                    , french      = [L']{Example}[Les]{Example}
                    , ngerman     = {Beispiel}{Beispiel}
                    , italian     = [L']{Esempio}[Gli]{Esempio}
                    , portuguese  = [O]{Exemplo}[Os]{Exemplo}
                    , brazilian   = [O]{Exemplo}[Os]{Exemplo}
                    , spanish     = [El]{Ejemplo}[Los]{Ejemplo}
                    , schinese    = {例}{例}
                    , tchinese    = {例}{例}
                    , japanese    = {例}{例}
                    , russian     = {Пример}{Пример}
                  }
  }

\NameTheorem { exercise }
  {
    , heading =   {
                    , english     = Exercise
                    , french      = Exercice
                    , ngerman     = Übung
                    , italian     = Esercizio
                    , portuguese  = Exercício
                    , brazilian   = Exercício
                    , spanish     = Ejercicio
                    , schinese    = 练习
                    , tchinese    = 練習
                    , japanese    = 練習
                    , russian     = Упражнение
                  }
    , crefname =  {
                    , english     = {Exercise}{Exercise}
                    , french      = [l']{Exercice}[les]{Exercice}
                    , ngerman     = {Übung}{Übung}
                    , italian     = [l']{Esercizio}[gli]{Esercizio}
                    , portuguese  = [o]{Exercício}[os]{Exercício}
                    , brazilian   = [o]{Exercício}[os]{Exercício}
                    , spanish     = [el]{Ejercicio}[los]{Ejercicio}
                    , schinese    = {练习}{练习}
                    , tchinese    = {練習}{練習}
                    , japanese    = {練習}{練習}
                    , russian     = {Упражнение}{Упражнение}
                  }
    , Crefname =  {
                    , english     = {Exercise}{Exercise}
                    , french      = [L']{Exercice}[Les]{Exercice}
                    , ngerman     = {Übung}{Übung}
                    , italian     = [L']{Esercizio}[Gli]{Esercizio}
                    , portuguese  = [O]{Exercício}[Os]{Exercício}
                    , brazilian   = [O]{Exercício}[Os]{Exercício}
                    , spanish     = [El]{Ejercicio}[Los]{Ejercicio}
                    , schinese    = {练习}{练习}
                    , tchinese    = {練習}{練習}
                    , japanese    = {練習}{練習}
                    , russian     = {Упражнение}{Упражнение}
                  }
  }

\NameTheorem { fact }
  {
    , heading =   {
                    , english     = Fact
                    , french      = Fait
                    , ngerman     = Fakt
                    , italian     = Fatto
                    , portuguese  = Facto
                    , brazilian   = Fato
                    , spanish     = Hecho
                    , schinese    = 事实
                    , tchinese    = 事實
                    , japanese    = 事実
                    , russian     = Факт
                  }
    , crefname =  {
                    , english     = {Fact}{Fact}
                    , french      = [le]{Fait}[les]{Fait}
                    , ngerman     = {Fakt}{Fakt}
                    , italian     = [il]{Fatto}[i]{Fatto}
                    , portuguese  = [o]{Facto}[os]{Facto}
                    , brazilian   = [o]{Fato}[os]{Fato}
                    , spanish     = [el]{Hecho}[los]{Hecho}
                    , schinese    = {事实}{事实}
                    , tchinese    = {事實}{事實}
                    , japanese    = {事実}{事実}
                    , russian     = {Факт}{Факт}
                  }
    , Crefname =  {
                    , english     = {Fact}{Fact}
                    , french      = [Le]{Fait}[Les]{Fait}
                    , ngerman     = {Fakt}{Fakt}
                    , italian     = [Il]{Fatto}[I]{Fatto}
                    , portuguese  = [O]{Facto}[Os]{Facto}
                    , brazilian   = [O]{Fato}[Os]{Fato}
                    , spanish     = [El]{Hecho}[Los]{Hecho}
                    , schinese    = {事实}{事实}
                    , tchinese    = {事實}{事實}
                    , japanese    = {事実}{事実}
                    , russian     = {Факт}{Факт}
                  }
  }

\NameTheorem { hypothesis }
  {
    , heading =   {
                    , english     = Hypothesis
                    , french      = Hypothèse
                    , ngerman     = Hypothese
                    , italian     = Ipotesi
                    , portuguese  = Hipótese
                    , brazilian   = Hipótese
                    , spanish     = Hipótesis
                    , schinese    = 假设
                    , tchinese    = 假設
                    , japanese    = 仮設
                    , russian     = Гипотеза
                  }
    , crefname =  {
                    , english     = {Hypothesis}{Hypothesis}
                    , french      = [l']{Hypothèse}[les]{Hypothèse}
                    , ngerman     = {Hypothese}{Hypothese}
                    , italian     = [l']{Ipotesi}[le]{Ipotesi}
                    , portuguese  = [a]{Hipótese}[as]{Hipótese}
                    , brazilian   = [a]{Hipótese}[as]{Hipótese}
                    , spanish     = [la]{Hipótesis}[las]{Hipótesis}
                    , schinese    = {假设}{假设}
                    , tchinese    = {假設}{假設}
                    , japanese    = {仮設}{仮設}
                    , russian     = {Гипотеза}{Гипотеза}
                  }
    , Crefname =  {
                    , english     = {Hypothesis}{Hypothesis}
                    , french      = [L']{Hypothèse}[Les]{Hypothèse}
                    , ngerman     = {Hypothese}{Hypothese}
                    , italian     = [L']{Ipotesi}[Le]{Ipotesi}
                    , portuguese  = [A]{Hipótese}[As]{Hipótese}
                    , brazilian   = [A]{Hipótese}[As]{Hipótese}
                    , spanish     = [La]{Hipótesis}[Las]{Hipótesis}
                    , schinese    = {假设}{假设}
                    , tchinese    = {假設}{假設}
                    , japanese    = {仮設}{仮設}
                    , russian     = {Гипотеза}{Гипотеза}
                  }
  }

\NameTheorem { lemma }
  {
    , heading   = {
                    , english     = Lemma
                    , french      = Lemme
                    , ngerman     = Lemma
                    , italian     = Lemma
                    , portuguese  = Lema
                    , brazilian   = Lema
                    , spanish     = Lema
                    , schinese    = 引理
                    , tchinese    = 引理
                    , japanese    = 補題
                    , russian     = Лемма
                  }
    , crefname  = {
                    , english     = {Lemma}{Lemma}
                    , french      = [le]{Lemme}[les]{Lemme}
                    , ngerman     = {Lemma}{Lemma}
                    , italian     = [il]{Lemma}[i]{Lemma}
                    , portuguese  = [o]{Lema}[os]{Lema}
                    , brazilian   = [o]{Lema}[os]{Lema}
                    , spanish     = [el]{Lema}[las]{Lema}
                    , schinese    = {引理}{引理}
                    , tchinese    = {引理}{引理}
                    , japanese    = {補題}{補題}
                    , russian     = {Лемма}{Лемма}
                  }
    , Crefname  = {
                    , english     = {Lemma}{Lemma}
                    , french      = [Le]{Lemme}[Les]{Lemme}
                    , ngerman     = {Lemma}{Lemma}
                    , italian     = [Il]{Lemma}[I]{Lemma}
                    , portuguese  = [O]{Lema}[Os]{Lema}
                    , brazilian   = [O]{Lema}[Os]{Lema}
                    , spanish     = [el]{Lema}[las]{Lema}
                    , schinese    = {引理}{引理}
                    , tchinese    = {引理}{引理}
                    , japanese    = {補題}{補題}
                    , russian     = {Лемма}{Лемма}
                  }
  }

\NameTheorem { notation }
  {
    , heading =   {
                    , english     = Notation
                    , french      = Notation
                    , ngerman     = Notation
                    , italian     = Notazione
                    , portuguese  = Notação
                    , brazilian   = Notação
                    , spanish     = Notación
                    , schinese    = 记号
                    , tchinese    = 記號
                    , japanese    = 記法
                    , russian     = Нотация
                  }
    , crefname =  {
                    , english     = {Notation}{Notation}
                    , french      = [la]{Notation}[les]{Notation}
                    , ngerman     = {Notation}{Notation}
                    , italian     = [la]{Notazione}[le]{Notazione}
                    , portuguese  = [a]{Notação}[as]{Notação}
                    , brazilian   = [a]{Notação}[as]{Notação}
                    , spanish     = [la]{Notación}[las]{Notación}
                    , schinese    = {记号}{记号}
                    , tchinese    = {記號}{記號}
                    , japanese    = {記法}{記法}
                    , russian     = {Нотация}{Нотация}
                  }
    , Crefname =  {
                    , english     = {Notation}{Notation}
                    , french      = [La]{Notation}[Les]{Notation}
                    , ngerman     = {Notation}{Notation}
                    , italian     = [La]{Notazione}[Le]{Notazione}
                    , portuguese  = [A]{Notação}[As]{Notação}
                    , brazilian   = [A]{Notação}[As]{Notação}
                    , spanish     = [La]{Notación}[Las]{Notación}
                    , schinese    = {记号}{记号}
                    , tchinese    = {記號}{記號}
                    , japanese    = {記法}{記法}
                    , russian     = {Нотация}{Нотация}
                  }
  }

\NameTheorem { observation }
  {
    , heading =   {
                    , english     = Observation
                    , french      = Observation
                    , ngerman     = Beobachtung
                    , italian     = Osservazione
                    , portuguese  = Observação
                    , brazilian   = Observação
                    , spanish     = Observación
                    , schinese    = 观察
                    , tchinese    = 觀察
                    , japanese    = 観察
                    , russian     = Наблюдение
                  }
    , crefname =  {
                    , english     = {Observation}{Observation}
                    , french      = [la]{Observation}[les]{Observation}
                    , ngerman     = {Beobachtung}{Beobachtung}
                    , italian     = [l']{Osservazione}[le]{Osservazione}
                    , portuguese  = [a]{Observação}[as]{Observação}
                    , brazilian   = [a]{Observação}[as]{Observação}
                    , spanish     = [la]{Observación}[las]{Observación}
                    , schinese    = {观察}{观察}
                    , tchinese    = {觀察}{觀察}
                    , japanese    = {観察}{観察}
                    , russian     = {Наблюдение}{Наблюдение}
                  }
    , Crefname =  {
                    , english     = {Observation}{Observation}
                    , french      = [La]{Observation}[Les]{Observation}
                    , ngerman     = {Beobachtung}{Beobachtung}
                    , italian     = [L']{Osservazione}[Le]{Osservazione}
                    , portuguese  = [A]{Observação}[As]{Observação}
                    , brazilian   = [A]{Observação}[As]{Observação}
                    , spanish     = [La]{Observación}[Las]{Observación}
                    , schinese    = {观察}{观察}
                    , tchinese    = {觀察}{觀察}
                    , japanese    = {観察}{観察}
                    , russian     = {Наблюдение}{Наблюдение}
                  }
  }

\NameTheorem { postulate }
  {
    , heading =   {
                    , english     = Postulate
                    , french      = Postulat
                    , ngerman     = Postulat
                    , italian     = Postulato
                    , portuguese  = Postulado
                    , brazilian   = Postulado
                    , spanish     = Postulado
                    , schinese    = 公设
                    , tchinese    = 公設
                    , japanese    = 公準
                    , russian     = Постулат
                  }
    , crefname =  {
                    , english     = {Postulate}{Postulate}
                    , french      = [le]{Postulat}[les]{Postulat}
                    , ngerman     = {Postulat}{Postulat}
                    , italian     = [il]{Postulato}[i]{Postulato}
                    , portuguese  = [o]{Postulado}[os]{Postulado}
                    , brazilian   = [o]{Postulado}[os]{Postulado}
                    , spanish     = [el]{Postulado}[los]{Postulado}
                    , schinese    = {公设}{公设}
                    , tchinese    = {公設}{公設}
                    , japanese    = {公準}{公準}
                    , russian     = {Постулат}{Постулат}
                  }
    , Crefname =  {
                    , english     = {Postulate}{Postulate}
                    , french      = [Le]{Postulat}[Les]{Postulat}
                    , ngerman     = {Postulat}{Postulat}
                    , italian     = [Il]{Postulato}[I]{Postulato}
                    , portuguese  = [O]{Postulado}[Os]{Postulado}
                    , brazilian   = [O]{Postulado}[Os]{Postulado}
                    , spanish     = [El]{Postulado}[Los]{Postulado}
                    , schinese    = {公设}{公设}
                    , tchinese    = {公設}{公設}
                    , japanese    = {公準}{公準}
                    , russian     = {Постулат}{Постулат}
                  }
  }

\NameTheorem { problem }
  {
    , heading =   {
                    , english     = Problem
                    , french      = Problème
                    , ngerman     = Problem
                    , italian     = Problema
                    , portuguese  = Problema
                    , brazilian   = Problema
                    , spanish     = Problema
                    , schinese    = 问题
                    , tchinese    = 問題
                    , japanese    = 問題
                    , russian     = Проблема
                  }
    , crefname =  {
                    , english     = {Problem}{Problem}
                    , french      = [le]{Problème}[les]{Problème}
                    , ngerman     = {Problem}{Problem}
                    , italian     = [il]{Problema}[i]{Problema}
                    , portuguese  = [o]{Problema}[os]{Problema}
                    , brazilian   = [o]{Problema}[os]{Problema}
                    , spanish     = [el]{Problema}[los]{Problema}
                    , schinese    = {问题}{问题}
                    , tchinese    = {問題}{問題}
                    , japanese    = {問題}{問題}
                    , russian     = {Проблема}{Проблема}
                  }
    , Crefname =  {
                    , english     = {Problem}{Problem}
                    , french      = [Le]{Problème}[Les]{Problème}
                    , ngerman     = {Problem}{Problem}
                    , italian     = [Il]{Problema}[I]{Problema}
                    , portuguese  = [O]{Problema}[Os]{Problema}
                    , brazilian   = [O]{Problema}[Os]{Problema}
                    , spanish     = [El]{Problema}[Los]{Problema}
                    , schinese    = {问题}{问题}
                    , tchinese    = {問題}{問題}
                    , japanese    = {問題}{問題}
                    , russian     = {Проблема}{Проблема}
                  }
  }

\NameTheorem { property }
  {
    , heading =   {
                    , english     = Property
                    , french      = Propriété
                    , ngerman     = Eigenschaft
                    , italian     = Proprietà
                    , portuguese  = Propriedade
                    , brazilian   = Propriedade
                    , spanish     = Propiedad
                    , schinese    = 性质
                    , tchinese    = 性質
                    , japanese    = 性質
                    , russian     = Имущество
                  }
    , crefname =  {
                    , english     = {Property}{Property}
                    , french      = [la]{Propriété}[les]{Propriété}
                    , ngerman     = {Eigenschaft}{Eigenschaft}
                    , italian     = [la]{Proprietà}[le]{Proprietà}
                    , portuguese  = [a]{Propriedade}[as]{Propriedade}
                    , brazilian   = [a]{Propriedade}[as]{Propriedade}
                    , spanish     = [la]{Propiedad}[las]{Propiedad}
                    , schinese    = {性质}{性质}
                    , tchinese    = {性質}{性質}
                    , japanese    = {性質}{性質}
                    , russian     = {Имущество}{Имущество}
                  }
    , Crefname =  {
                    , english     = {Property}{Property}
                    , french      = [La]{Propriété}[Les]{Propriété}
                    , ngerman     = {Eigenschaft}{Eigenschaft}
                    , italian     = [La]{Proprietà}[Le]{Proprietà}
                    , portuguese  = [A]{Propriedade}[As]{Propriedade}
                    , brazilian   = [A]{Propriedade}[As]{Propriedade}
                    , spanish     = [La]{Propiedad}[Las]{Propiedad}
                    , schinese    = {性质}{性质}
                    , tchinese    = {性質}{性質}
                    , japanese    = {性質}{性質}
                    , russian     = {Имущество}{Имущество}
                  }
  }

\NameTheorem { proposition }
  {
    , heading =   {
                    , english     = Proposition
                    , french      = Proposition
                    , ngerman     = Proposition
                    , italian     = Proposizione
                    , portuguese  = Proposição
                    , brazilian   = Proposição
                    , spanish     = Proposición
                    , schinese    = 命题
                    , tchinese    = 命題
                    , japanese    = 命題
                    , russian     = Предложение
                  }
    , crefname =  {
                    , english     = {Proposition}{Proposition}
                    , french      = [la]{Proposition}[les]{Proposition}
                    , ngerman     = {Proposition}{Proposition}
                    , italian     = [la]{Proposizione}[le]{Proposizione}
                    , portuguese  = [a]{Proposição}[as]{Proposição}
                    , brazilian   = [a]{Proposição}[as]{Proposição}
                    , spanish     = [la]{Proposición}[las]{Proposición}
                    , schinese    = {命题}{命题}
                    , tchinese    = {命題}{命題}
                    , japanese    = {命題}{命題}
                    , russian     = {Предложение}{Предложение}
                  }
    , Crefname =  {
                    , english     = {Proposition}{Proposition}
                    , french      = [La]{Proposition}[Les]{Proposition}
                    , ngerman     = {Proposition}{Proposition}
                    , italian     = [La]{Proposizione}[Le]{Proposizione}
                    , portuguese  = [A]{Proposição}[As]{Proposição}
                    , brazilian   = [A]{Proposição}[As]{Proposição}
                    , spanish     = [La]{Proposición}[Las]{Proposición}
                    , schinese    = {命题}{命题}
                    , tchinese    = {命題}{命題}
                    , japanese    = {命題}{命題}
                    , russian     = {Предложение}{Предложение}
                  }
  }

\NameTheorem { question }
  {
    , heading =   {
                    , english     = Question
                    , french      = Question
                    , ngerman     = Frage
                    , italian     = Domanda
                    , portuguese  = Pergunta
                    , brazilian   = Pergunta
                    , spanish     = Pregunta
                    , schinese    = 问题
                    , tchinese    = 問題
                    , japanese    = 問題
                    , russian     = Вопрос
                  }
    , crefname =  {
                    , english     = {Question}{Question}
                    , french      = [la]{Question}[les]{Question}
                    , ngerman     = {Frage}{Frage}
                    , italian     = [la]{Domanda}[le]{Domanda}
                    , portuguese  = [a]{Pergunta}[as]{Pergunta}
                    , brazilian   = [a]{Pergunta}[as]{Pergunta}
                    , spanish     = [la]{Pregunta}[las]{Pregunta}
                    , schinese    = {问题}{问题}
                    , tchinese    = {問題}{問題}
                    , japanese    = {問題}{問題}
                    , russian     = {Вопрос}{Вопрос}
                  }
    , Crefname =  {
                    , english     = {Question}{Question}
                    , french      = [La]{Question}[Les]{Question}
                    , ngerman     = {Frage}{Frage}
                    , italian     = [La]{Domanda}[Le]{Domanda}
                    , portuguese  = [A]{Pergunta}[As]{Pergunta}
                    , brazilian   = [A]{Pergunta}[As]{Pergunta}
                    , spanish     = [La]{Pregunta}[Las]{Pregunta}
                    , schinese    = {问题}{问题}
                    , tchinese    = {問題}{問題}
                    , japanese    = {問題}{問題}
                    , russian     = {Вопрос}{Вопрос}
                  }
  }

\NameTheorem { remark }
  {
    , heading =   {
                    , english     = Remark
                    , french      = Remarque
                    , ngerman     = Bemerkung
                    , italian     = Commento
                    , portuguese  = Comentário
                    , brazilian   = Comentário
                    , spanish     = Comentario
                    , schinese    = 备注
                    , tchinese    = 備註
                    , japanese    = 注釈
                    , russian     = Замечание
                  }
    , crefname =  {
                    , english     = {Remark}{Remark}
                    , french      = [la]{Remarque}[les]{Remarque}
                    , ngerman     = {Bemerkung}{Bemerkung}
                    , italian     = [il]{Commento}[i]{Commento}
                    , portuguese  = [o]{Comentário}[os]{Comentário}
                    , brazilian   = [o]{Comentário}[os]{Comentário}
                    , spanish     = [el]{Comentario}[los]{Comentario}
                    , schinese    = {备注}{备注}
                    , tchinese    = {備註}{備註}
                    , japanese    = {注釈}{注釈}
                    , russian     = {Замечание}{Замечание}
                  }
    , Crefname =  {
                    , english     = {Remark}{Remark}
                    , french      = [La]{Remarque}[Les]{Remarque}
                    , ngerman     = {Bemerkung}{Bemerkung}
                    , italian     = [Il]{Commento}[I]{Commento}
                    , portuguese  = [O]{Comentário}[Os]{Comentário}
                    , brazilian   = [O]{Comentário}[Os]{Comentário}
                    , spanish     = [El]{Comentario}[Los]{Comentario}
                    , schinese    = {备注}{备注}
                    , tchinese    = {備註}{備註}
                    , japanese    = {注釈}{注釈}
                    , russian     = {Замечание}{Замечание}
                  }
  }

\NameTheorem { theorem }
  {
    , heading =   {
                    , english     = Theorem
                    , french      = Théorème
                    , ngerman     = Satz
                    , italian     = Teorema
                    , portuguese  = Teorema
                    , brazilian   = Teorema
                    , spanish     = Teorema
                    , schinese    = 定理
                    , tchinese    = 定理
                    , japanese    = 定理
                    , russian     = Теорема
                  }
    , crefname =  {
                    , english     = {Theorem}{Theorem}
                    , french      = [le]{Théorème}[les]{Théorème}
                    , ngerman     = {Satz}{Satz}
                    , italian     = [il]{Teorema}[i]{Teorema}
                    , portuguese  = [o]{Teorema}[os]{Teorema}
                    , brazilian   = [o]{Teorema}[os]{Teorema}
                    , spanish     = [el]{Teorema}[los]{Teorema}
                    , schinese    = {定理}{定理}
                    , tchinese    = {定理}{定理}
                    , japanese    = {定理}{定理}
                    , russian     = {Теорема}{Теорема}
                  }
    , Crefname =  {
                    , english     = {Theorem}{Theorem}
                    , french      = [Le]{Théorème}[Les]{Théorème}
                    , ngerman     = {Satz}{Satz}
                    , italian     = [Il]{Teorema}[I]{Teorema}
                    , portuguese  = [O]{Teorema}[Os]{Teorema}
                    , brazilian   = [O]{Teorema}[Os]{Teorema}
                    , spanish     = [El]{Teorema}[Los]{Teorema}
                    , schinese    = {定理}{定理}
                    , tchinese    = {定理}{定理}
                    , japanese    = {定理}{定理}
                    , russian     = {Теорема}{Теорема}
                  }
  }

\NameTheorem { definition-proposition }
  {
    , heading =   {
                    , english     = Definition-Proposition
                    , french      = Définition-Proposition
                    , ngerman     = Definition-Proposition
                    , italian     = Definizione-Proposizione
                    , portuguese  = Definição-Proposição
                    , brazilian   = Definição-Proposição
                    , spanish     = Definición-Proposición
                    , schinese    = 定义-命题
                    , tchinese    = 定義-命題
                    , japanese    = 定義-命題
                    , russian     = Определение-Предложение
                  }
    , crefname =  {
                    , english     = {Definition-Proposition}{Definition-Proposition}
                    , french      = [la]{Définition-Proposition}[les]{Définition-Proposition}
                    , ngerman     = {Definition-Proposition}{Definition-Proposition}
                    , italian     = [la]{Definizione-Proposizione}[le]{Definizione-Proposizione}
                    , portuguese  = [a]{Definição-Proposição}[as]{Definição-Proposição}
                    , brazilian   = [a]{Definição-Proposição}[as]{Definição-Proposição}
                    , spanish     = [la]{Definición-Proposición}[las]{Definición-Proposición}
                    , schinese    = {定义-命题}{定义-命题}
                    , tchinese    = {定義-命題}{定義-命題}
                    , japanese    = {定義-命題}{定義-命題}
                    , russian     = {Определение-Предложение}{Определение-Предложение}
                  }
    , Crefname =  {
                    , english     = {Definition-Proposition}{Definition-Proposition}
                    , french      = [La]{Définition-Proposition}[Les]{Définition-Proposition}
                    , ngerman     = {Definition-Proposition}{Definition-Proposition}
                    , italian     = [La]{Definizione-Proposizione}[Le]{Definizione-Proposizione}
                    , portuguese  = [A]{Definição-Proposição}[As]{Definição-Proposição}
                    , brazilian   = [A]{Definição-Proposição}[As]{Definição-Proposição}
                    , spanish     = [La]{Definición-Proposición}[Las]{Definición-Proposición}
                    , schinese    = {定义-命题}{定义-命题}
                    , tchinese    = {定義-命題}{定義-命題}
                    , japanese    = {定義-命題}{定義-命題}
                    , russian     = {Определение-Предложение}{Определение-Предложение}
                  }
  }

\NameTheorem { definition-theorem }
  {
    , heading =   {
                    , english     = Definition-Theorem
                    , french      = Définition-Théorème
                    , ngerman     = Definition-Satz
                    , italian     = Definizione-Teorema
                    , portuguese  = Definição-Teorema
                    , brazilian   = Definição-Teorema
                    , spanish     = Definición-Teorema
                    , schinese    = 定义-定理
                    , tchinese    = 定義-定理
                    , japanese    = 定義-定理
                    , russian     = Определение-Теорема
                  }
    , crefname =  {
                    , english     = {Definition-Theorem}{Definition-Theorem}
                    , french      = [la]{Définition-Théorème}[les]{Définition-Théorème}
                    , ngerman     = {Definition-Satz}{Definition-Satz}
                    , italian     = [la]{Definizione-Teorema}[le]{Definizione-Teorema}
                    , portuguese  = [a]{Definição-Teorema}[as]{Definição-Teorema}
                    , brazilian   = [a]{Definição-Teorema}[as]{Definição-Teorema}
                    , spanish     = [la]{Definición-Teorema}[las]{Definición-Teorema}
                    , schinese    = {定义-定理}{定义-定理}
                    , tchinese    = {定義-定理}{定義-定理}
                    , japanese    = {定義-定理}{定義-定理}
                    , russian     = {Определение-Теорема}{Определение-Теорема}
                  }
    , Crefname =  {
                    , english     = {Definition-Theorem}{Definition-Theorem}
                    , french      = [La]{Définition-Théorème}[Les]{Définition-Théorème}
                    , ngerman     = {Definition-Satz}{Definition-Satz}
                    , italian     = [La]{Definizione-Teorema}[Le]{Definizione-Teorema}
                    , portuguese  = [A]{Definição-Teorema}[As]{Definição-Teorema}
                    , brazilian   = [A]{Definição-Teorema}[As]{Definição-Teorema}
                    , spanish     = [La]{Definición-Teorema}[Las]{Definición-Teorema}
                    , schinese    = {定义-定理}{定义-定理}
                    , tchinese    = {定義-定理}{定義-定理}
                    , japanese    = {定義-定理}{定義-定理}
                    , russian     = {Определение-Теорема}{Определение-Теорема}
                  }
  }
%</projlib-theorem>

\endinput