% \iffalse meta-comment
%
% Copyright (C) 2021-2024 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}[2022-06-01]
%
%<*ProjLib>
\ProvidesExplPackage
  {ProjLib}
  {2024/02/20} {}
  {Collective interface of the ProjLib toolkit}
%</ProjLib>
%
%<*projlib-author>
\ProvidesExplPackage
  {projlib-author}
  {2024/02/20} {}
  {Enhanced author information block}
%</projlib-author>
%
%<*projlib-datetime>
\ProvidesExplPackage
  {projlib-datetime}
  {2024/02/20} {}
  {Convert numeric date-time string to natural language}
%</projlib-datetime>
%
%<*projlib-draft>
\ProvidesExplPackage
  {projlib-draft}
  {2024/02/20} {}
  {Useful commands during draft stage}
%</projlib-draft>
%
%<*projlib-font>
\ProvidesExplPackage
  {projlib-font}
  {2024/02/20} {}
  {Font selection and configuration}
%</projlib-font>
%
%<*projlib-language>
\ProvidesExplPackage
  {projlib-language}
  {2024/02/20} {}
  {Multi-language configuration}
%</projlib-language>
%
%<*projlib-logo>
\ProvidesExplPackage
  {projlib-logo}
  {2024/02/20} {}
  {The ProjLib logo}
%</projlib-logo>
%
%<*projlib-math>
\ProvidesExplPackage
  {projlib-math}
  {2024/02/20} {}
  {Efficient math setup}
%</projlib-math>
%
%<*projlib-paper>
\ProvidesExplPackage
  {projlib-paper}
  {2024/02/20} {}
  {Configuration of the paper style}
%</projlib-paper>
%
%<*projlib-text>
\ProvidesExplPackage
  {projlib-text}
  {2024/02/20} {}
  {Text-related commands}
%</projlib-text>
%
%<*projlib-theorem>
\ProvidesExplPackage
  {projlib-theorem}
  {2024/02/20} {}
  {Configuration of theorem-like environments}
%</projlib-theorem>
%
%<*projlib-titlepage>
\ProvidesExplPackage
  {projlib-titlepage}
  {2024/02/20} {}
  {Interface for title page rendering}
%</projlib-titlepage>

%<*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
    , AMS-fashion     .bool_set:N         = \l__projlib_main_amsfashion_bool
    , AMS~fashion     .bool_set:N         = \l__projlib_main_amsfashion_bool
    , AMS fashion     .bool_set:N         = \l__projlib_main_amsfashion_bool

    , title-page      .bool_set:N         = \l__projlib_main_titlepage_bool
    , title-page      .initial:n          = { false }
    , title~page      .bool_set:N         = \l__projlib_main_titlepage_bool
    , title page      .bool_set:N         = \l__projlib_main_titlepage_bool

    , unknown         .code:n             = {
                                              \PassOptionsToPackage { \CurrentOption } { projlib-author }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-datetime }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-draft }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-font }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-language }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-logo }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-math }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-paper }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-text }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-theorem }
                                              \PassOptionsToPackage { \CurrentOption } { projlib-titlepage }
                                            }
  }
\ProcessKeyOptions [ 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-text }

\bool_if:NT \l__projlib_main_titlepage_bool
  {
    \RequirePackage { projlib-titlepage }
  }

\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
    , AMS-fashion .bool_set:N = \l__projlib_author_amsfashion_bool
    , AMS~fashion .bool_set:N = \l__projlib_author_amsfashion_bool
    , AMS fashion .bool_set:N = \l__projlib_author_amsfashion_bool

    , unknown     .code:n     = {}
  }
\ProcessKeyOptions [ projlib-author ]

\cs_if_exist:NT \subjclass { \endinput }

\prg_new_conditional:Nnn \projlib_author_if_content_empty:n { T, F, TF }
  {
    \hbox_set:Nn \l_tmpa_box { #1 }
    \dim_compare:nNnTF { \box_wd:N \l_tmpa_box } > \c_zero_dim
      { \prg_return_false: }
      { \prg_return_true: }
  }

\tl_new:N   \g__projlib_author_font_author_tl
\tl_new:N   \g__projlib_author_font_date_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_date_tl      { \normalsize \normalfont }
\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_groupsep_dim
\dim_new:N  \g__projlib_author_innersep_dim
\dim_new:N  \g__projlib_author_affilsep_dim
\dim_new:N  \g__projlib_author_aftersep_dim
\dim_new:N  \g__projlib_author_emptysep_dim

\dim_set:Nn \g__projlib_author_groupsep_dim { 0.5 \baselineskip }
\dim_set:Nn \g__projlib_author_innersep_dim { .25 \baselineskip }
\dim_set:Nn \g__projlib_author_affilsep_dim {   0 \baselineskip }
\dim_set:Nn \g__projlib_author_aftersep_dim { .15 \baselineskip }
\dim_set:Nn \g__projlib_author_emptysep_dim { .15 \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 }
      {
        \bool_set_false:N \g__projlib_author_affil_already_exist_bool
        % If there is nothing before, the following line does nothing
        % If there is an affil before, this will backward one line
        \phantom {A} \\[-\baselineskip]
        \tl_if_blank:nTF { #1 }
          {
            \skip_vertical:n { \g__projlib_author_emptysep_dim }
            \phantom {}
          }
          {
            \skip_vertical:n { \g__projlib_author_groupsep_dim }
            { \g__projlib_author_font_author_tl #1 }
            \\ \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} \\[-\baselineskip]
        \bool_if:NTF \g__projlib_author_affil_already_exist_bool
          {
            \skip_vertical:n { \g__projlib_author_affilsep_dim }
          }
          {
            \skip_vertical:n { \g__projlib_author_innersep_dim }
          }
        { \use:c { g__projlib_author_font_ #1 _tl } #2 }
        \bool_set_true:N \g__projlib_author_affil_already_exist_bool
        \\ \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_groupsep_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_aftersep_dim }
          }
      }
  }

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

    \tl_const:Nn \c_projlib_author_dot_tl { . }

    \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 }
      }


    \NewCommandCopy \projlib_author_backup_footnotemark: \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_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_width_of_asterisk_dim }
            #1
          }
      }

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

    \hook_gput_code:nnn { begindocument/before } { projlib-author }
      {
        \NewCommandCopy \projlib_author_backup_my_author:w \author
        \RenewDocumentCommand \author { m }
          {
            \projlib_author_backup_my_author:w
              {
                \RenewCommandCopy \thanks \projlib_author_backup_thanks:w
                #1
              }
          }
      }

    \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

    \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 }
          {
            \projlib_author_if_content_empty:nTF { \@date } { \skip_vertical:n { -2 \baselineskip } } { \g__projlib_author_font_date_tl \@date }
            \projlib_author_if_content_empty:nF { \g__projlib_author_dedicatory_tl }
              {
                \projlib_author_if_content_empty:nT { \@date } { \skip_vertical:n { 2 \baselineskip } }
                \par
                \skip_vertical:n { -\parskip }
                \skip_vertical:n { \baselineskip }
                \textit{ \g__projlib_author_dedicatory_tl }
                \projlib_author_if_content_empty:nT { \@date }
                  {
                    \skip_vertical:n { -\parskip }
                    \skip_vertical:n { \dim_eval:n { -1.7 \baselineskip } }
                  }
              }
          } {} {}
        \makeatother

        \hook_gput_code:nnn { cmd/maketitle/before } { projlib-author }
          {
            \projlib_author_if_content_empty:nF { \g__projlib_author_keywords_tl }
              {
                \projlib_author_pre_thanks:n
                  {
                    \group_begin:
                      \g_projlib_author_keywordsname_style_tl
                      \keywordsname \c_projlib_author_dot_tl
                    \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
            % \cs_undefine:N \footnotemark
            % \NewCommandCopy \footnotemark \projlib_author_backup_footnotemark:
            \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 \footnotemark {}
          \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 \c_projlib_author_dot_tl }
              \enspace
              \l_projlib_author_subjclass_tl .
            }
          \RenewCommandCopy \footnotemark \projlib_author_backup_footnotemark:
        }
      \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       = {}
  }
\ProcessKeyOptions [ projlib-datetime ]

\RequirePackage { relsize }

\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~year~month .meta:n       = { only-year-month }
    , only year month .meta:n       = { only-year-month }
    , only-month-day  .code:n       = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-month-day } }
    , only~month~day  .meta:n       = { only-month-day }
    , only month day  .meta:n       = { only-month-day }
    , only-year       .code:n       = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-year } }
    , only~year       .meta:n       = { only-year }
    , only year       .meta:n       = { only-year }
    , only-month      .code:n       = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-month } }
    , only~month      .meta:n       = { only-month }
    , only month      .meta:n       = { only-month }
    , only-day        .code:n       = { \tl_set:Nn \l__projlib_datetime_output_format_tl { only-day } }
    , only~day        .meta:n       = { only-day }
    , only day        .meta:n       = { 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 }
  {
    \tl_set:Nn \l_tmpa_tl { \exp_args:Ne \tl_trim_spaces:n { #1 } }
    \exp_args:Ne \projlib_datetime_set_input_format:n { \l_tmpa_tl }
  }
\ProvideDocumentCommand \SetDatetimeInputFormat {} { \ProjLibSetDatetimeInputFormat }


\seq_new:N \l__projlib_datetime_date_seq

\cs_new_protected:Nn \projlib_datetime_text_superscript:n
  {
    \group_begin:
      \smaller
      \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_year_month_day #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_year_month_day #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_generate_variant:Nn \__projlib_datetime_date_parse_year_month_day:n { e }

\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_generate_variant:Nn \__projlib_datetime_date_parse_month_day_year:n { e }

\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_generate_variant:Nn \__projlib_datetime_date_parse_day_month_year:n { e }

\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
  {
    \tl_set:Nx \l_tmpa_tl { #1 }
    \regex_replace_all:nnN { \D } { - } \l_tmpa_tl
    \cs_if_exist_use:c { __projlib_datetime_date_parse_ \__projlib_datetime_input_format_to_str: :e } { \l_tmpa_tl }
    \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:oF { #1 } { \keys_set:nn { projlib-datetime-command } { #1 } }
      \tl_if_blank:oF { #3 } { \keys_set:nn { projlib-datetime-command } { #3 } }
      \tl_set:Nx \l_tmpa_tl { \exp_args:Ne \tl_trim_spaces:n { #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:oF { #1 } { \keys_set:nn { projlib-datetime-command } { #1 } }
      \tl_if_blank:oF { #3 } { \keys_set:nn { projlib-datetime-command } { #3 } }
      \tl_set:Nx \l_tmpa_tl { \exp_args:Ne \tl_trim_spaces:n { #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
  {
    \tl_set:Nx \l_tmpa_tl { #1 }
    \regex_replace_all:nnN { \D } { - } \l_tmpa_tl
    \cs_if_exist_use:c { __projlib_datetime_date_parse_ \__projlib_datetime_input_format_to_str: :e } { \l_tmpa_tl }
    \__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
    , no-report-page    .bool_set:N   = \l__projlib_draft_no_report_page_bool
    , no-report-page    .initial:n    = { false }
    , no~report~page    .bool_set:N   = \l__projlib_draft_no_report_page_bool
    , no report page    .bool_set:N   = \l__projlib_draft_no_report_page_bool
    , unknown           .code:n       = {}
  }
\ProcessKeyOptions [ projlib-draft ]

\RequirePackage { projlib-language }
\RequirePackage { xcolor }
\PassOptionsToPackage { normalem } { ulem }
\RequirePackage { ulem }

\cs_new_protected:Nn \projlib_draft_plain_box_lines:n
  {
    \bgroup\markoverwith{
      \rule[-0.6ex]{1pt}{1.25pt}
      \skip_horizontal:n { -1pt }
      \rule[1.8ex]{1pt}{1.25pt}
      \skip_horizontal:n { -.1pt }
    }\ULon { #1 }
  }

  \bool_if:NTF \l__projlib_draft_fast_bool
  {
    \tl_const:Nn \l_projlib_draft_plain_box_begin_tl { [ }
    \tl_const:Nn \l_projlib_draft_plain_box_after_tl { ] }
  }
  {
    \RequirePackage { tikz }
    \tl_const:Nn \l_projlib_draft_plain_box_begin_tl
      {
        \tikz[line~width=1.25pt,baseline=-.625pt]
          \draw (1ex,-.6ex) -- (.5ex,-.6ex)
                (0,-.1ex) arc [start~angle=180, end~angle=270, radius=.5ex]
                (0,-.1ex) -- (0,1.3ex)
                (0,1.3ex) arc [start~angle=180, end~angle=90, radius=.5ex]
                (0.5ex,1.8ex) -- (1ex,1.8ex);
      }
    \tl_const:Nn \l_projlib_draft_plain_box_after_tl
      {
        \tikz[line~width=1.25pt,baseline=-.625pt]
          \draw (-1ex,-.6ex) -- (-.5ex,-.6ex)
                (0,-.1ex) arc [start~angle=0, end~angle=-90, radius=.5ex]
                (0,-.1ex) -- (0,1.3ex)
                (0,1.3ex) arc [start~angle=0, end~angle=90, radius=.5ex]
                (-0.5ex,1.8ex) -- (-1ex,1.8ex);
      }
  }

\cs_new_protected:Nn \projlib_draft_plain_box:nn
  {
    \group_begin:
      \color{ #1 }
      \l_projlib_draft_plain_box_begin_tl
      \nobreak
      \hspace{-.5ex}
      \nobreak
      \projlib_draft_plain_box_lines:n { #2 }
      \nobreak
      \hspace{-.5ex}
      \nobreak
      \l_projlib_draft_plain_box_after_tl
    \group_end:
  }


\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 = Aún ~ por ~ completar  ,
    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 }        { \small \normalfont \bfseries }

\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 { s D<>{} }
  {
    \noindent
    \group_begin: \projlib_draft_DNF_font
      \stepcounter { projlib_draft_DNF_counter }
      \raisebox{\baselineskip}{
        \cs_if_exist:cT { hypertarget }
          {
            \hypertarget { DNF. \jobname. \arabic { projlib_draft_DNF_counter } } {}
          }
        \label { DNF. \jobname. \arabic { projlib_draft_DNF_counter } }
      }
      \nobreak
      \projlib_draft_plain_box:nn { projlib_draft_DNF_color }
        {
          \IfBooleanF { #1 } { \projlib_draft_DNF_text \nobreakspace }
          \texttt { \# \theprojlib_draft_DNF_counter }
          \tl_if_blank:nF { #2 } { : \nobreakspace }
          \tl_trim_spaces:n { #2 }
        }
    \group_end:
    \tl_gput_right:Nn \g__projlib_draft_DNF_report_tl
      {
        \setlength { \parfillskip } { 0pt plus 1fil }
        \noindent
        \group_begin: \ttfamily
        \# \,
      }
    \tl_gput_right:Nx \g__projlib_draft_DNF_report_tl
      {
        \int_value:w \theprojlib_draft_DNF_counter
      }
    \tl_gput_right:Nn \g__projlib_draft_DNF_report_tl
      {
        \group_end:
        \c_space_tl \c_space_tl
        $\langle$
        \skip_horizontal:n { 0.1em }
      }
    \tl_gput_right:Nx \g__projlib_draft_DNF_report_tl
      {
        \group_begin:
        \exp_not:N \normalfont
        \cs_if_exist:cTF { hyperlink }
          {
            \exp_not:N \hyperlink { DNF. \jobname. \int_value:w \theprojlib_draft_DNF_counter } { \exp_not:N \pageref* { DNF. \jobname. \int_value:w \theprojlib_draft_DNF_counter } }
          }
          {
            \exp_not:N \pageref* { DNF. \jobname. \int_value:w \theprojlib_draft_DNF_counter }
          }
        \group_end:
      }
    \tl_gput_right:Nn \g__projlib_draft_DNF_report_tl
      {
        \skip_horizontal:n { 0.1em }
        $\rangle$
        \nobreakspace
        \tl_if_blank:nF { #2 } { : ~ }
        \tl_trim_spaces:n { #2 }
        \par \skip_vertical:n { -\parskip }
        \skip_vertical:n { .15\baselineskip }
      }
  }

\bool_if:NF \l__projlib_draft_no_report_page_bool
  {
    \hook_gput_code:nnn { begindocument/before } { projlib-draft }
      {
        \hook_gput_code:nnn { enddocument } { projlib-draft }
          {
            \tl_if_blank:VF \g__projlib_draft_DNF_report_tl
              {
                \clearpage
                \addtocounter{page}{-1}
                \pagestyle { empty }
                \color { projlib_draft_DNF_color }
                \noindent
                \projlib_draft_DNF_font
                \projlib_draft_DNF_report_text
                \par \bigskip
                \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~\textquote{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~\textquote{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~\textquote{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~\textquote{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~\textquote{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~\textquote{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~\textquote{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 = {
              你好，这里有一些没有意义的文字。此文本应显示打印文本在此位置的外观。如果你阅读这段文字，你将不会得到任何信息。真的没有信息吗？这段文字和诸如\textquote{劳仑衣普桑，认至将指点效则机，最你更枝}或者\textquote{想极整月正进好志次回总般，段然取向使张规军证回，世市总李率英茄持伴}之类的废话有区别吗？一点都没有！这样的一段文本会给你提供关于所选字体的信息、字母的书写方式以及对外观的印象。该文本应包含字母表中的所有字母，并且应使用原始语言编写。不需要特别的内容，但字长要与语言相匹配。
           }
    , TC = {
              你好，這裡有一些沒有意義的文字。此文本應顯示打印文本在此位置的外觀。如果你閱讀這段文字，你將不會得到任何信息。真的沒有信息嗎？這段文字和諸如\textquote{勞崙衣普桑，認至將指點效則機，最你更枝}或者\textquote{想極整月正進好志次回總般，段然取向使張規軍證回，世市總李率英茄持伴}之類的廢話有區別嗎？一點都沒有！這樣的一段文本會給你提供關於所選字體的信息、字母的書寫方式以及對外觀的印象。該文本應包含字母表中的所有字母，並且應使用原始語言編寫。不需要特別的內容，但字長要與語言相匹配。
           }
    , JP = {
              こんにちは、ここに意味のないテキストがあります。このテキストは、この場所で印刷されたテキストがどのように見えるかを示す必要があります。このテキストを読んでも、情報は得られません。本当に？情報はありませんか？このテキストと\textquote{アでニンはすミ}のようなナンセンスとの間に違いはありますか？全くない！このようなブラインドテキストは、選択したフォント、文字の書き方、外観の印象に関する情報を提供します。このテキストにはアルファベットのすべての文字が含まれている必要があり、元の言語で書かれている必要があります。特別なコンテンツは必要ありませんが、単語の長さは言語と一致している必要があります。
           }
    , RU = {
              Здравствуйте,~вот~какой-то~текст~без~смысла.~Этот~текст~должен~показывать,~как~будет~выглядеть~печатный~текст~в~этом~месте.~Если~вы~прочитаете~этот~текст,~вы~не~получите~никакой~информации.~Действительно?~Нет~информации?~Есть~ли~разница~между~этим~текстом~и~какой-то~чепухой~вроде~\textquote{Бзостачщв~дрероих}?~Нисколько!~Слепой~текст,~подобный~этому,~дает~вам~информацию~о~выбранном~шрифте,~о~том,~как~написаны~буквы,~и~о~впечатлении~от~внешнего~вида.~Этот~текст~должен~содержать~все~буквы~алфавита~и~должен~быть~написан~на~языке~оригинала.~В~специальном~содержании~нет~необходимости,~но~длина~слов~должна~соответствовать~языку.
           }
  }

\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
    , new-computer-modern .bool_set:N   = \l__projlib_font_newcomputermodern_bool
    , new-computer-modern .initial:n    = { false }
    , new~computer~modern .bool_set:N   = \l__projlib_font_newcomputermodern_bool
    , new computer modern .bool_set:N   = \l__projlib_font_newcomputermodern_bool
    , newcm               .bool_set:N   = \l__projlib_font_computermodern_bool
    , computer-modern     .bool_set:N   = \l__projlib_font_computermodern_bool
    , computer-modern     .initial:n    = { false }
    , computer~modern     .bool_set:N   = \l__projlib_font_computermodern_bool
    , computer modern     .bool_set:N   = \l__projlib_font_computermodern_bool
    , latin-modern        .initial:n    = { false }
    , latin-modern        .bool_set:N   = \l__projlib_font_latinmodern_bool
    , latin~modern        .bool_set:N   = \l__projlib_font_latinmodern_bool
    , latin modern        .bool_set:N   = \l__projlib_font_latinmodern_bool
    , lmodern             .bool_set:N   = \l__projlib_font_latinmodern_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       = {}
  }
\ProcessKeyOptions [ projlib-font ]

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

\RequirePackage { anyfontsize }
\RequirePackage { setspaceenhanced }

\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_newcomputermodern_bool
  {
    \usepackage[default]{fontsetup}
    \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_computermodern_bool
  {
    \usepackage[olddefault]{fontsetup}
    \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_latinmodern_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
  {
    \RequirePackage { mathpazo }
    \PassOptionsToPackage { defaultsups } { newpxtext }
    \PassOptionsToPackage { no-math } { fontspec }
    \hook_gput_code:nnn { begindocument/before } { projlib-font }
      {
        \bool_if:NT \l__projlib_font_useosf_bool
          {
            \PassOptionsToPackage { osf } { newpxtext }
          }
        \RequirePackage { newpxtext }
        \sys_if_engine_pdftex:F
          {
            \setsansfont { texgyreheros }
              [
                Scale          = MatchUppercase ,
                UprightFont    = *-regular ,
                BoldFont       = *-bold ,
                ItalicFont     = *-italic ,
                BoldItalicFont = *-bolditalic ,
              ]
          }
      }
    \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
  {
    \PassOptionsToPackage { defaultsups } { newtxtext }
    \PassOptionsToPackage { no-math } { fontspec }
    \hook_gput_code:nnn { begindocument/before } { projlib-font }
      {
        \bool_if:NT \l__projlib_font_useosf_bool
          {
            \PassOptionsToPackage { osf } { newtxtext }
          }
        \RequirePackage { newtxtext }
        \RequirePackage { newtxmath }
        \sys_if_engine_pdftex:F
          {
            \setsansfont { texgyreheros }
              [
                Scale          = MatchUppercase ,
                UprightFont    = *-regular ,
                BoldFont       = *-bold ,
                ItalicFont     = *-italic ,
                BoldItalicFont = *-bolditalic ,
              ]
          }
      }
    \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 }
    \cs_undefine:c { Top }
    % https://tex.stackexchange.com/a/215272
    \DeclareSymbolFont{ntxletters}{OML}{ntxmi}{m}{it}
    \SetSymbolFont{ntxletters}{bold}{OML}{ntxmi}{b}{it}
    \re@DeclareMathSymbol{\leftharpoonup}{\mathrel}{ntxletters}{"28}
    \re@DeclareMathSymbol{\leftharpoondown}{\mathrel}{ntxletters}{"29}
    \re@DeclareMathSymbol{\rightharpoonup}{\mathrel}{ntxletters}{"2A}
    \re@DeclareMathSymbol{\rightharpoondown}{\mathrel}{ntxletters}{"2B}
    \re@DeclareMathSymbol{\triangleleft}{\mathbin}{ntxletters}{"2F}
    \re@DeclareMathSymbol{\triangleright}{\mathbin}{ntxletters}{"2E}
    \re@DeclareMathSymbol{\partial}{\mathord}{ntxletters}{"40}
    \re@DeclareMathSymbol{\flat}{\mathord}{ntxletters}{"5B}
    \re@DeclareMathSymbol{\natural}{\mathord}{ntxletters}{"5C}
    \re@DeclareMathSymbol{\star}{\mathbin}{ntxletters}{"3F}
    \re@DeclareMathSymbol{\smile}{\mathrel}{ntxletters}{"5E}
    \re@DeclareMathSymbol{\frown}{\mathrel}{ntxletters}{"5F}
    \re@DeclareMathSymbol{\sharp}{\mathord}{ntxletters}{"5D}
    \re@DeclareMathAccent{\vec}{\mathord}{ntxletters}{"7E}
    \sys_if_engine_pdftex:F
      {
        \setsansfont { texgyreheros }
          [
            Scale          = MatchUppercase ,
            UprightFont    = *-regular ,
            BoldFont       = *-bold ,
            ItalicFont     = *-italic ,
            BoldItalicFont = *-bolditalic ,
          ]
      }
    \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
  }

% \bool_if:NF \l__projlib_font_lmodern_bool
%   {
%     \hook_gput_code:nnn { package/tikz-cd/after } { projlib-font }
%       {
%         \tikzcdset{arrow~style={math~font}}
%       }
%   }

\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 }
    , SC                  .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       = {}
  }
\ProcessKeyOptions [ 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 { \exp_args:Ne \str_foldcase:n { \tl_trim_spaces:n { #1 } } }
      {
        { all                }    { common     }
        { common             }    { common     }
        { cn                 }    { schinese   }
        { sc                 }    { schinese   }
        { chinese            }    { schinese   }
        { schinese           }    { schinese   }
        { simplified chinese }    { schinese   }
        { simplified-chinese }    { schinese   }
        { simplified~chinese }    { schinese   }
        { tc                 }    { tchinese   }
        { tchinese           }    { tchinese   }
        { traditional chinese}    { tchinese   }
        { traditional-chinese}    { 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:nnF { \exp_args:Ne \str_foldcase:n { \tl_trim_spaces:n { #1 } } }
      {
        { cn                 }    {  cjk  }
        { sc                 }    {  cjk  }
        { chinese            }    {  cjk  }
        { schinese           }    {  cjk  }
        { simplified chinese }    {  cjk  }
        { simplified-chinese }    {  cjk  }
        { simplified~chinese }    {  cjk  }
        { tc                 }    {  cjk  }
        { tchinese           }    {  cjk  }
        { traditional chinese}    {  cjk  }
        { traditional-chinese}    {  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 }
      }
      { 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 }

\RequirePackage { silence }
\WarningFilter { biblatex } { Language }

\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
  {
    \tl_set:Nn  \languagename         { schinese }
    \tl_set:cn { abstractname   }     { 摘要     }
    \tl_set:cn { proofname      }     { 证明     }
    \tl_set:cn { contentsname   }     { 目录     }
    \tl_set:cn { listfigurename }     { 插图     }
    \tl_set:cn { listtablename  }     { 表格     }
    \tl_set:cn { figurename     }     { 图       }
    \tl_set:cn { tablename      }     { 表       }
    \tl_set:cn { indexname      }     { 索引     }
    \tl_set:cn { appendixname   }     { 附录     }
    \tl_set:cn { refname        }     { 参考文献 }
    \tl_set:cn { bibname        }     { 参考文献 }
  }
\cs_new_protected:Nn \projlib_language_apply_settings_globally_schinese:
  {
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_schinese_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_schinese:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_schinese_tl
    #1
    \group_end:
  }

\tl_gput_right:Nn \g_projlib_language_settings_tchinese_tl
  {
    \tl_set:Nn  \languagename         { tchinese }
    \tl_set:cn { abstractname   }     { 摘要     }
    \tl_set:cn { proofname      }     { 證明     }
    \tl_set:cn { contentsname   }     { 目錄     }
    \tl_set:cn { listfigurename }     { 插圖     }
    \tl_set:cn { listtablename  }     { 表格     }
    \tl_set:cn { figurename     }     { 圖       }
    \tl_set:cn { tablename      }     { 表       }
    \tl_set:cn { indexname      }     { 索引     }
    \tl_set:cn { appendixname   }     { 附錄     }
    \tl_set:cn { refname        }     { 參考文獻 }
    \tl_set:cn { bibname        }     { 參考文獻 }
  }
\cs_new_protected:Nn \projlib_language_apply_settings_globally_tchinese:
  {
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_tchinese_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_tchinese:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_tchinese_tl
    #1
    \group_end:
  }

\cs_new_protected:Nn \projlib_language_apply_settings_globally_japanese:
  {
    \selectlanguage { japanese }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_japanese_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_japanese:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_japanese_tl
    \foreignlanguage { japanese } { #1 }
    \group_end:
  }

\cs_new_protected:Nn \projlib_language_apply_settings_globally_english:
  {
    \selectlanguage { english }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_english_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_english:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_english_tl
    \foreignlanguage { english } { #1 }
    \group_end:
  }

\tl_gput_right:Nn \g_projlib_language_settings_french_tl
  {
    \tl_gset:cn { frenchpartname } { Partie }
  }
\cs_new_protected:Nn \projlib_language_apply_settings_globally_french:
  {
    \selectlanguage { french }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_french_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_french:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_french_tl
    \foreignlanguage { french } { #1 }
    \group_end:
  }

\cs_new_protected:Nn \projlib_language_apply_settings_globally_ngerman:
  {
    \selectlanguage { ngerman }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_ngerman_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_ngerman:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_ngerman_tl
    \foreignlanguage { ngerman } { #1 }
    \group_end:
  }

\cs_new_protected:Nn \projlib_language_apply_settings_globally_italian:
  {
    \selectlanguage { italian }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_italian_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_italian:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_italian_tl
    \foreignlanguage { italian } { #1 }
    \group_end:
  }

\cs_new_protected:Nn \projlib_language_apply_settings_globally_portuguese:
  {
    \selectlanguage { portuguese }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_portuguese_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_portuguese:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_portuguese_tl
    \foreignlanguage { portuguese } { #1 }
    \group_end:
  }

\cs_new_protected:Nn \projlib_language_apply_settings_globally_brazilian:
  {
    \selectlanguage { brazilian }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_brazilian_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_brazilian:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_brazilian_tl
    \foreignlanguage { brazilian } { #1 }
    \group_end:
  }

\cs_new_protected:Nn \projlib_language_apply_settings_globally_spanish:
  {
    \selectlanguage { spanish }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_spanish_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_spanish:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_spanish_tl
    \foreignlanguage { spanish } { #1 }
    \group_end:
  }

\cs_new_protected:Nn \projlib_language_apply_settings_globally_russian:
  {
    \selectlanguage { russian }
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_russian_tl
  }
\cs_new_protected:Nn \projlib_language_apply_settings_locally_russian:n
  {
    \group_begin:
    \g_projlib_language_settings_common_tl
    \g_projlib_language_settings_russian_tl
    \foreignlanguage { russian } { #1 }
    \group_end:
  }

\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 { setspaceenhanced }

\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 }
  {
    \IfPackageLoadedTF { 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 }
  }

\msg_new:nnn { projlib-language }
  { language-not-supported }
  { The~language~"#1"~is~not~supported. }
\msg_new:nnn { projlib-language }
  { language-not-enabled }
  { The~language~"#1"~is~not~enabled. }

\tl_new:N \l_projlib_language_current_languagetype_tl

\cs_new:Nn \projlib_language_use_language_locally:nn
  {
    \cs_if_exist:cTF { projlib_language_apply_settings_locally_ \projlib_language_str_to_languagename:n { #1 } :n }
      {
        \bool_if:cTF { g__projlib_language_enabled_ \projlib_language_str_to_languagename:n { #1 } _bool }
          {
            \use:c { projlib_language_apply_settings_locally_ \projlib_language_str_to_languagename:n { #1 } :n } { #2 }
            \tl_set:Ne \l_projlib_language_current_languagetype_tl { \projlib_language_str_to_languagetype:n { #1 } }
          }
          {
            \msg_warning:nnn { projlib-language } { language-not-enabled } { #1 }
            #2
          }
      }
      {
        \msg_warning:nnn { projlib-language } { language-not-supported } { #1 }
        #2
      }
  }
\cs_generate_variant:Nn \projlib_language_use_language_locally:nn { e }

\cs_new:Nn \projlib_language_use_language:n
  {
    \cs_if_exist:cTF { projlib_language_apply_settings_globally_ \projlib_language_str_to_languagename:n { #1 } : }
      {
        \bool_if:cTF { g__projlib_language_enabled_ \projlib_language_str_to_languagename:n { #1 } _bool }
          {
            \use:c { projlib_language_apply_settings_globally_ \projlib_language_str_to_languagename:n { #1 } : }
            \cs_if_exist_use:c { g_projlib_language_linespacing_ \projlib_language_str_to_languagetype:n { #1 } _tl }
            \cs_if_exist_use:c { g_projlib_language_parindent_ \projlib_language_str_to_languagetype:n { #1 } _tl }
            \tl_set:Ne \l_projlib_language_current_languagetype_tl { \projlib_language_str_to_languagetype:n { #1 } }
          }
          {
            \msg_warning:nnn { projlib-language } { language-not-enabled } { #1 }
          }
      }
      {
        \msg_warning:nnn { projlib-language } { language-not-supported } { #1 }
      }
  }
\cs_generate_variant:Nn \projlib_language_use_language:n { e }

\NewDocumentCommand \UseLanguage { m }
  {
    % Set the configuration twice at different stages of begindocument
    \hook_gput_code:nnn { begindocument } { projlib-language }
      {
        \projlib_language_use_language:e { #1 }
      }
    \hook_gput_code:nnn { begindocument/end } { projlib-language }
      {
        \projlib_language_use_language:e { #1 }
      }
  }
\NewDocumentCommand \UseOtherLanguage { m m }
  {
    \group_begin:
      \projlib_language_use_language_locally:en { #1 } { #2 }
    \group_end:
  }
\NewDocumentEnvironment { OtherLanguage } { m +b }
  {
    \projlib_language_use_language_locally:en { #1 } { #2 }
  }
  { }

\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
      { \use_none:n }
      { \__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 }
  }


\PassOptionsToPackage { autostyle } { csquotes }
\RequirePackage { csquotes }

\DeclareQuoteStyle { schinese } {“} {”} {‘} {’}
\DeclareQuoteStyle { tchinese } {“} {”} {‘} {’}
\DeclareQuoteStyle { japanese } {「} {」} {『} {』}
%</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       = {}
  }
\ProcessKeyOptions [ projlib-logo ]

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

\RequirePackage { tikz }

\cs_new_protected:Nn \projlib_logo_generic:nn
  {
    \colorlet{projlib-logo-saved-color}{.}
    \skip_horizontal:n { .2em }
    \begin{tikzpicture}[line~width=.1em, baseline=0]
      \begin{scope}[color=#1!30!projlib-logo-saved-color]
        \draw (0.22em,.5em) circle (.22em);
        \draw (0em,0em) -- (0em,.5em);
      \end{scope}
      \begin{scope}[color=#1!40!projlib-logo-saved-color, xshift=.65em]
        \draw (0em,0em) -- (0em,.25em) arc [start~angle=180, end~angle=90, radius=.2em];
      \end{scope}
      \begin{scope}[color=#1!45!projlib-logo-saved-color, xshift=1.0em]
        \draw (0.2em,.24em) circle (.2em);
      \end{scope}
      \begin{scope}[color=#1!50!projlib-logo-saved-color, xshift=1.65em]
        \draw (0em,-.25em) -- (0em,.5em);
        \begin{scope}[yshift=.75em]
          % \draw[line~width=.032em, color=#2, xshift=.01em, yshift=-.003em] (0,0) circle (.13em);
          % \node[rotate=-15,scale=0.45, xshift=.033em] { \usefont{U}{zeur}{b}{n} \symbol{"02} };
          \draw[line~width=.06em, color=#2] (0,0) circle (.13em);
        \end{scope}
      \end{scope}
      \begin{scope}[color=#1!67!projlib-logo-saved-color, xshift=2.0em]
        \draw (0em,0em) -- (0em,.75em);
      \end{scope}
      \begin{scope}[color=#1!75!projlib-logo-saved-color, xshift=2.35em]
        \draw (0em,0em) -- (0em,.5em);
      \end{scope}
      \begin{scope}[color=#1!90!projlib-logo-saved-color, xshift=2.63em]
        \draw (0.2em,.24em) circle (.2em);
        \draw (0em,0.24em) -- (0em,.75em);
      \end{scope}
    \end{tikzpicture}
    \skip_horizontal:n { .1em }
  }

\DeclareRobustCommand * \ProjLib
  {
    \projlib_logo_generic:nn { blue!50!cyan } { orange!60!yellow }
  }


\DeclareRobustCommand * \ProjLibText
  {
    \projlib_logo_generic:nn { projlib-logo-saved-color } { projlib-logo-saved-color }
  }
%</projlib-logo>
%
%<*projlib-math>
\keys_define:nn { projlib-math }
  {
    , unknown     .code:n     = {}
  }
\ProcessKeyOptions [ projlib-math ]


% https://tex.stackexchange.com/a/643233
\providecommand* \ProvideCommandCopy
  {
    \declare@commandcopy{\@firstofone}{\@firstoftwo{}}
  }


\RequirePackage { mathtools }
\RequirePackage { mathrsfs }
\PassOptionsToPackage { warnings-off = { mathtools-colon, mathtools-overbracket } } { unicode-math }
\IfPackageLoadedTF { 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 \ProjLibDefineMathOperator { 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 }
      }
  }

\ProvideCommandCopy \DefineMathOperator \ProjLibDefineMathOperator
\ProvideCommandCopy \DefineOperator \ProjLibDefineMathOperator


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

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

\keys_define:nn { projlib-math-symbol }
  {
    , prefix       .clist_set:N  = \l__projlib_math_symbol_prefix_clist
    , type         .tl_set:N     = \l__projlib_math_symbol_type_tl
    , style        .tl_set:N     = \l__projlib_math_symbol_style_tl
    , unknown      .code:n       = {}
  }

\cs_new_protected:Nn \projlib_math_define_symbol:nnn
  % #1 = bool for star or empty
  % (currently the starred version is the same as normal version)
  % #2 = list of symbols
  % #3 = the option
  {
    \clist_clear:N \l__projlib_math_symbol_prefix_clist
    \tl_clear:N \l__projlib_math_symbol_type_tl
    \tl_set:Nn \l__projlib_math_symbol_style_tl { \mathrm }
    \keys_set:nn { projlib-math-symbol } { #3 }
    \tl_if_empty:NF \l__projlib_math_symbol_type_tl
      {
        \cs_if_exist:cTF { \l__projlib_math_symbol_type_tl }
          {
            \exp_args:Nne \use:n
              { \msg_warning:nnn  { projlib-math } { symbol-type-not-define } }
              { \l__projlib_math_symbol_type_tl }
          }
          {
            \exp_args:Nno \use:n
              {
                \exp_args:Nc \NewDocumentCommand { \l__projlib_math_symbol_type_tl } { m }
              }
              {
                \l__projlib_math_symbol_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_symbol_prefix_clist
              {
                \__projlib_math_define_symbol:ee { \seq_item:Nn \l_tmpa_seq { 1 } } { \seq_item:Nn \l_tmpa_seq { 2 } }
              }
              {
                \clist_map_inline:Nn \l__projlib_math_symbol_prefix_clist
                  {
                    \__projlib_math_define_symbol:ee { ####1 \seq_item:Nn \l_tmpa_seq { 1 } } { \seq_item:Nn \l_tmpa_seq { 2 } }
                  }
              }
          }
          {
            \clist_if_empty:NTF \l__projlib_math_symbol_prefix_clist
              {
                \__projlib_math_define_symbol:ee { ##1 } { ##1 }
              }
              {
                \clist_map_inline:Nn \l__projlib_math_symbol_prefix_clist
                  {
                    \__projlib_math_define_symbol:ee { ####1 ##1 } { ##1 }
                  }
              }
          }
      }
  }

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

\NewDocumentCommand \ProjLibDefineMathSymbol { s O{} m O{} }
  {
    \tl_if_blank:nTF { #2 }
      {
        \projlib_math_define_symbol:nnn { #1 } { #3 } { #4 }
      }
      {
        \projlib_math_define_symbol:nnn { #1 } { #3 } { #2 }
      }
  }
\ProvideCommandCopy \DefineMathSymbol \ProjLibDefineMathSymbol
\ProvideCommandCopy \DefineShortcut \ProjLibDefineMathSymbol


\cs_new:Nn \projlib_math_redefine_in_math_mode:Nn
  {
    \exp_args:Nc \NewCommandCopy { projlib_math_original_ \cs_to_str:N #1 : } #1
    \RenewDocumentCommand #1 { }
      {
        \mode_if_math:TF
          { #2 }
          { \use:c { projlib_math_original_ \cs_to_str:N #1 : } }
      }
  }

\NewDocumentCommand \ProjLibRedefineInMathMode { m m }
  {
    \projlib_math_redefine_in_math_mode:Nn #1 { #2 }
  }

\ProvideCommandCopy \RedefineInMathMode \ProjLibRedefineInMathMode


\cs_new:Nn \__projlib_math_list_of_symbols_entry:nnnn
  % #1 = column one width
  % #2 = column two width
  % #3 = symbol
  % #4 = description
  {
    \noindent
    \begin { tabular } { p{#1} p{#2} }
      \parbox [t] { #1 } { #3 } & \parbox [t] { #2 } { #4 }
    \end { tabular }
    \par
    \skip_vertical:n { -\parskip }
  }

\cs_new:Nn \projlib_math_list_of_symbols:nnn
  % #1 = column one width
  % #2 = column two width
  % #3 = key-val list
  {
    \keyval_parse:nnn
      { \use_none:n }
      { \__projlib_math_list_of_symbols_entry:nnnn { #1 } { #2 } }
      { #3 }
  }

\NewDocumentCommand \ProjLibListOfSymbols { O{0.17\textwidth} O{0.75\textwidth} m }
  {
    \projlib_math_list_of_symbols:nnn { #1 } { #2 } { #3 }
  }

\ProvideCommandCopy \ListOfSymbols \ProjLibListOfSymbols
%</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
    , light-yellow-paper .meta:n             = { paperstyle = lightyellow }
    , light~yellow~paper .meta:n             = { paperstyle = lightyellow }
    , light yellow-paper .meta:n             = { paperstyle = lightyellow }
    , light yellow~paper .meta:n             = { paperstyle = lightyellow }
    , light yellow paper .meta:n             = { paperstyle = lightyellow }
    , 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             = {}
  }
\ProcessKeyOptions [ 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 }
  {
    { light yellow } { \definecolor { paper }     { RGB } { 255, 254, 245 }
                       \definecolor { main-text } { RGB } {  37,  41,  46 } }
    { light-yellow } { \definecolor { paper }     { RGB } { 255, 254, 245 }
                       \definecolor { main-text } { RGB } {  37,  41,  46 } }
    { light~yellow } { \definecolor { paper }     { RGB } { 255, 254, 245 }
                       \definecolor { main-text } { RGB } {  37,  41,  46 } }
    { yellow       } { \definecolor { paper }     { RGB } { 247, 246, 233 } }
    { parchment    } { \definecolor { paper }     { RGB } { 232, 225, 204 }
                       \definecolor { main-text } { RGB } {  94,  78,  62 } }
    { green        } { \definecolor { paper }     { RGB } { 207, 231, 207 } }
    { light gray   } { \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 } }
    { 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 { package/tcolorbox/after } { projlib-paper }
  {
    \tcbset { colupper = main-text, collower = main-text }
  }
\hook_gput_code:nnn { package/tikz-cd/after } { projlib-paper }
  {
    \tikzset { /tikz/commutative~diagrams/background~color = paper }
  }
%</projlib-paper>
%
%<*projlib-text>
\keys_define:nn { projlib-text }
  {
    , unknown .code:n       = {}
  }
\ProcessKeyOptions [ projlib-text ]

\RequirePackage { projlib-paper }

\ProvideDocumentCommand \ItemDescription { m }
  {
    \textcolor { main-text!50!paper } { $($ #1 $)$  }
    \nobreakspace
    \ignorespaces
  }

\cs_new_protected:Nn \projlib_text_abbreviation_generic:nn
  % #1 is the text
  % #2 is usually some spacing adjustment
  {
    #1
    % if followed by a dot, then remove that dot and adjust the spacing
    \peek_meaning_ignore_spaces:NTF .
      { #2 \use_none:n }
      {
        % if followed by a comma, then act like nothing happens
        % otherwise adjust the spacing
        \peek_meaning_ignore_spaces:NTF ,
          { \prg_do_nothing: }
          { #2 }
      }
  }

\hook_gput_code:nnn { begindocument/before } { projlib-text }
  {
    % i.e.
    \ProvideDocumentCommand { \ie } { }
      {
        \projlib_text_abbreviation_generic:nn { \textit{i. \nobreak \hskip.2ex \nobreak e.} } { \skip_horizontal:n { -.15ex ~plus -.15\tex_fontdimen:D 3 \tex_font:D~minus -.15\tex_fontdimen:D 4 \tex_font:D } }
      }

    % e.g.
    \ProvideDocumentCommand { \eg } { }
      {
        \projlib_text_abbreviation_generic:nn { \textit{e. \nobreak \hskip.2ex \nobreak g.} } { \skip_horizontal:n { -.15ex ~plus -.15\tex_fontdimen:D 3 \tex_font:D~minus -.15\tex_fontdimen:D 4 \tex_font:D } }
      }

    % cf.
    \ProvideDocumentCommand { \cf } { }
      {
        \projlib_text_abbreviation_generic:nn { \textit{cf.} } { }
      }

    % etc.
    \ProvideDocumentCommand { \etc } { }
      {
        \projlib_text_abbreviation_generic:nn { etc. } { }
      }
  }
%</projlib-text>
%
%<*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          = { * }
    , separate-theorem-numbering  .bool_set:N         = \l__projlib_theorem_separate_theorem_numbering_bool
    , separate-theorem-numbering  .initial:n          = { false }
    , separate~theorem~numbering  .bool_set:N         = \l__projlib_theorem_separate_theorem_numbering_bool
    , separate theorem numbering  .bool_set:N         = \l__projlib_theorem_separate_theorem_numbering_bool
    , number-theorems-separately  .bool_set:N         = \l__projlib_theorem_separate_theorem_numbering_bool
    , number~theorems~separately  .bool_set:N         = \l__projlib_theorem_separate_theorem_numbering_bool
    , number theorems separately  .bool_set:N         = \l__projlib_theorem_separate_theorem_numbering_bool
    , theorem-style               .tl_set:N           = \l__projlib_theorem_theorem_style_tl
    , theorem-style               .initial:n          = { }
    , theorem-style               .value_required:n   = true
    , theorem~style               .tl_set:N           = \l__projlib_theorem_theorem_style_tl
    , theorem~style               .value_required:n   = true
    , theorem style               .tl_set:N           = \l__projlib_theorem_theorem_style_tl
    , theorem style               .value_required:n   = true
    , 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 } }
  }
\ProcessKeyOptions [ projlib-theorem ]

\clist_const:Nn \c_projlib_theorem_supported_clist
  {
    application               ,
    assertion                 ,
    assumption                ,
    axiom                     ,
    claim                     ,
    commentary                ,
    conclusion                ,
    conjecture                ,
    construction              ,
    convention                ,
    corollary                 ,
    definition                ,
    example                   ,
    exercise                  ,
    fact                      ,
    hypothesis                ,
    lemma                     ,
    motivation                ,
    notation                  ,
    observation               ,
    postulate                 ,
    problem                   ,
    property                  ,
    proposition               ,
    question                  ,
    recall                    ,
    remark                    ,
    theorem                   ,
    definition-corollary      ,
    definition-proposition    ,
    definition-theorem        ,
    corollary-definition      ,
    proposition-definition    ,
    theorem-definition        ,
    applications              ,
    assertions                ,
    assumptions               ,
    axioms                    ,
    claims                    ,
    commentaries              ,
    conclusions               ,
    conjectures               ,
    constructions             ,
    conventions               ,
    corollaries               ,
    definitions               ,
    examples                  ,
    exercises                 ,
    facts                     ,
    hypotheses                ,
    lemmas                    ,
    motivations               ,
    notations                 ,
    observations              ,
    postulates                ,
    problems                  ,
    properties                ,
    propositions              ,
    questions                 ,
    recalls                   ,
    remarks                   ,
    theorems                  ,
  }

\@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 { endtheorem    }
        \cs_undefine:c { lemma      } \cs_undefine:c { endlemma      }
        \cs_undefine:c { corollary  } \cs_undefine:c { endcorollary  }
        \cs_undefine:c { definition } \cs_undefine:c { enddefinition }
        \cs_undefine:c { fact       } \cs_undefine:c { endfact       }
        \cs_undefine:c { example    } \cs_undefine:c { endexample    }
        \cs_undefine:c { problem    } \cs_undefine:c { endproblem    }
      }
  } {}

\RequirePackage { projlib-language }

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

\cs_new_protected:Nn \projlib_theorem_preset_theorem_style:nn
  {
    \str_case:nnTF { #1 }
      {
        { theorem-with-name } { }
        { proof } { }
      }
      {
        \tl_const:cn { c_crthm_theorem_style_preset_ #1 _inner _tl } { #2 }
      }
      {
        \tl_const:cn { c_crthm_theorem_style_preset_ #1 _tl } { #2 }
      }
  }

\cs_generate_variant:Nn \keyval_parse:nnn { nno }
\keyval_parse:nno
  { \use_none:n }
  { \projlib_theorem_preset_theorem_style:nn }
  { \l__projlib_theorem_theorem_style_tl }

% If the style of proof is not given, use "remark" as default.
\cs_if_exist:cF { c_crthm_theorem_style_preset_ proof_inner _tl }
  {
    \tl_const:cn { c_crthm_theorem_style_preset_ proof_inner _tl } { remark }
  }

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

\RenewCommandCopy \cref      \crefthe
\RenewCommandCopy \Cref      \Crefthe
\RenewCommandCopy \namecref  \namecrefthe
\RenewCommandCopy \nameCref  \nameCrefthe
\RenewCommandCopy \namecrefs \namecrefsthe
\RenewCommandCopy \nameCrefs \nameCrefsthe
\RenewCommandCopy \cpageref  \cpagerefthe
\RenewCommandCopy \Cpageref  \Cpagerefthe
\RenewCommandCopy \crefname  \crefthename
\RenewCommandCopy \Crefname  \Crefthename

\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:oTF \l__projlib_theorem_theorem_numbering_tl
          {
            \cs_if_exist:cTF { c@chapter }
              { % with \chapter
                \CreateTheorem { theorem } { parent counter = chapter, create starred version }
                \bool_if:NT \l__projlib_theorem_separate_theorem_numbering_bool
                  {
                    \exp_args:Nv \CreateTheorem { c_projlib_theorem_supported_clist } { parent counter = chapter, create starred version, quiet }
                  }
              }
              { % without \chapter
                \CreateTheorem { theorem } { parent counter = section, create starred version }
                \bool_if:NT \l__projlib_theorem_separate_theorem_numbering_bool
                  {
                    \exp_args:Nv \CreateTheorem { c_projlib_theorem_supported_clist } { parent counter = section, create starred version, quiet }
                  }
              }
          }
          {
            \tl_if_eq:NnTF \l__projlib_theorem_theorem_numbering_tl { * }
              {
                \CreateTheorem { theorem } { create starred version }
                \bool_if:NT \l__projlib_theorem_separate_theorem_numbering_bool
                  {
                    \exp_args:Nv \CreateTheorem { c_projlib_theorem_supported_clist } { create starred version, quiet }
                  }
              }
              {
                \CreateTheorem { theorem } { parent counter = \l__projlib_theorem_theorem_numbering_tl, create starred version }
                \bool_if:NT \l__projlib_theorem_separate_theorem_numbering_bool
                  {
                    \exp_args:Nv \CreateTheorem { c_projlib_theorem_supported_clist } { parent counter = \l__projlib_theorem_theorem_numbering_tl, create starred version, quiet }
                  }
              }
          }

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

\newcounter { theorem-with-name }
\newcounter { proof }
\crthm_counter_alias:nn { theorem-with-name } { theorem }
% \crthm_counter_alias:nn { proof } { theorem }

\tl_new:N \l_projlib_theorem_name_of_theorem_with_name_tl
\CreateTheorem { theorem-with-name_inner }
  {
    , name = {
               , heading = { \l_projlib_theorem_name_of_theorem_with_name_tl }
               , crefname = {}{}
               , Crefname = {}{}
             }
    , create-starred-version
    , shared-counter = theorem-with-name
  }

\NewDocumentEnvironment { theorem-with-name } { m O{} }
  {
    \tl_set:Nn \l_projlib_theorem_name_of_theorem_with_name_tl { #1 }
    \begin { theorem-with-name_inner } [ #2 ]
  }
  {
    \end { theorem-with-name_inner }
  }
\NewDocumentEnvironment { theorem-with-name* } { m O{} }
  {
    \tl_set:Nn \l_projlib_theorem_name_of_theorem_with_name_tl { #1 }
    \begin { theorem-with-name_inner* } [ #2 ]
  }
  {
    \end { theorem-with-name_inner* }
  }

\SetTheoremBinding { theorem-with-name } { theorem-with-name_inner }
\SetTheoremBinding { theorem-with-name* } { theorem-with-name_inner* }

\tl_new:N \l_projlib_theorem_name_of_proof_tl
\CreateTheorem { proof_inner } { name = { heading = { \l_projlib_theorem_name_of_proof_tl } }, create-starred-version, qed, shared-counter = proof }

\cs_undefine:c { proof }
\cs_undefine:c { endproof }

\NewDocumentEnvironment { proof } { O{\proofname} }
  {
    \tl_set:Nn \l_projlib_theorem_name_of_proof_tl { #1 }
    \begin { proof_inner }
  }
  {
    \end { proof_inner }
  }
\NewDocumentEnvironment { proof* } { O{\proofname} }
  {
    \tl_set:Nn \l_projlib_theorem_name_of_proof_tl { #1 }
    \begin { proof_inner* }
  }
  {
    \end { proof_inner* }
  }

\SetTheoremBinding { proof } { proof_inner }
\SetTheoremBinding { proof* } { proof_inner* }

\cs_new_protected:Nn \projlib_theorem_disable_theorem_numbering:n
  {
    \clist_map_inline:nn { #1 }
      {
        \__projlib_theorem_disable_theorem_numbering_do:n { ##1 }
      }
  }
\cs_new_protected:Nn \__projlib_theorem_disable_theorem_numbering_do:n
  {
    \CreateTheorem { #1 } { copy-existed = #1* }
  }

\NewDocumentCommand \DisableTheoremNumbering { m }
  {
    \projlib_theorem_disable_theorem_numbering:n { #1 }
  }


\cs_new_protected:Nn \projlib_theorem_switch_theorem_numbering:n
  {
    \clist_map_inline:nn { #1 }
      {
        \__projlib_theorem_switch_theorem_numbering_do:n { ##1 }
      }
  }
\cs_new_protected:Nn \__projlib_theorem_switch_theorem_numbering_do:n
  {
    \CreateTheorem { #1_projlib_theorem_temp } { copy-existed = #1* }
    \CreateTheorem { #1* } { copy-existed = #1 }
    \CreateTheorem { #1 } { copy-existed = #1_projlib_theorem_temp }
  }

\NewDocumentCommand \SwitchTheoremNumbering { m }
  {
    \projlib_theorem_switch_theorem_numbering:n { #1 }
  }

\SwitchTheoremNumbering { theorem-with-name, proof }


\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 } { , ~ }
    \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 } { \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 } { , ~ }
    \tl_gset:Nn { \creflastconjunction } { \nobreakspace e \nobreakspace }
    \tl_gset:Nn { \crefpairgroupconjunction } { \nobreakspace e \nobreakspace }
    \tl_gset:Nn { \crefmiddlegroupconjunction } { , ~ }
    \tl_gset:Nn { \creflastgroupconjunction } { \nobreakspace e \nobreakspace }
    \tl_gset:Nn { \crefrangeconjunction } { \nobreakspace a \nobreakspace }
  }

\crefformat{equation}{#2\cref@equation@name\nobreakspace\textup{\tagform@{#1}}#3}
\Crefformat{equation}{#2\Cref@equation@name\nobreakspace\textup{\tagform@{#1}}#3}
\crefrangeformat{equation}{\cref@equation@name@plural\nobreakspace#3\textup{\tagform@{#1}}#4\crefrangeconjunction#5\textup{\tagform@{#2}}#6}
\Crefrangeformat{equation}{\Cref@equation@name@plural\nobreakspace#3\textup{\tagform@{#1}}#4\crefrangeconjunction#5\textup{\tagform@{#2}}#6}
\crefmultiformat{equation}{\cref@equation@name@plural\nobreakspace#2\textup{\tagform@{#1}}#3}{\crefpairconjunction#2\textup{\tagform@{#1}}#3}{\crefmiddleconjunction#2\textup{\tagform@{#1}}#3}{\creflastconjunction#2\textup{\tagform@{#1}}#3}
\Crefmultiformat{equation}{\Cref@equation@name@plural\nobreakspace#2\textup{\tagform@{#1}}#3}{\crefpairconjunction#2\textup{\tagform@{#1}}#3}{\crefmiddleconjunction#2\textup{\tagform@{#1}}#3}{\creflastconjunction#2\textup{\tagform@{#1}}#3}
\crefrangemultiformat{equation}{\cref@equation@name@plural\nobreakspace#2\textup{\tagform@{#1}}#3}{\crefpairgroupconjunction#2\textup{\tagform@{#1}}#3}{\crefmiddlegroupconjunction#2\textup{\tagform@{#1}}#3}{\creflastgroupconjunction#2\textup{\tagform@{#1}}#3}
\Crefrangemultiformat{equation}{\Cref@equation@name@plural\nobreakspace#2\textup{\tagform@{#1}}#3}{\crefpairgroupconjunction#2\textup{\tagform@{#1}}#3}{\crefmiddlegroupconjunction#2\textup{\tagform@{#1}}#3}{\creflastgroupconjunction#2\textup{\tagform@{#1}}#3}
\labelcrefformat{equation}{#2\textup{\tagform@{#1}}#3}
\labelcrefrangeformat{equation}{#3\textup{\tagform@{#1}}#4\crefrangeconjunction#5\textup{\tagform@{#2}}#6}
\labelcrefmultiformat{equation}{#2\textup{\tagform@{#1}}#3}{\crefpairconjunction#2\textup{\tagform@{#1}}#3}{\crefmiddleconjunction#2\textup{\tagform@{#1}}#3}{\creflastconjunction#2\textup{\tagform@{#1}}#3}
\labelcrefrangemultiformat{equation}{#2\textup{\tagform@{#1}}#3}{\crefpairgroupconjunction#2\textup{\tagform@{#1}}#3}{\crefmiddlegroupconjunction#2\textup{\tagform@{#1}}#3}{\creflastgroupconjunction#2\textup{\tagform@{#1}}#3}

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

\NameTheorem { application }
  {
    , heading =   {
                    , english     = Application
                    , french      = Application
                    , ngerman     = Anwendung
                    , italian     = Applicazione
                    , portuguese  = Aplicação
                    , brazilian   = Aplicação
                    , spanish     = Aplicación
                    , schinese    = 应用
                    , tchinese    = 應用
                    , japanese    = 応用
                    , russian     = Применение
                  }
    , crefname =  {
                    , english     = {Application}{Application}
                    , french      = [l']{Application}[les]{Application}
                    , ngerman     = {Anwendung}{Anwendung}
                    , italian     = [l']{Applicazione}[le]{Applicazione}
                    , portuguese  = [a]{Aplicação}[as]{Aplicação}
                    , brazilian   = [a]{Aplicação}[as]{Aplicação}
                    , spanish     = [la]{Aplicación}[las]{Aplicación}
                    , schinese    = {应用}{应用}
                    , tchinese    = {應用}{應用}
                    , japanese    = {応用}{応用}
                    , russian     = {Применение}{Применение}
                  }
    , Crefname =  {
                    , english     = {Application}{Application}
                    , french      = [L']{Application}[Les]{Application}
                    , ngerman     = {Anwendung}{Anwendung}
                    , italian     = [L']{Applicazione}[Le]{Applicazione}
                    , portuguese  = [A]{Aplicação}[As]{Aplicação}
                    , brazilian   = [A]{Aplicação}[As]{Aplicação}
                    , spanish     = [La]{Aplicación}[Las]{Aplicación}
                    , schinese    = {应用}{应用}
                    , tchinese    = {應用}{應用}
                    , japanese    = {応用}{応用}
                    , russian     = {Применение}{Применение}
                  }
  }

\NameTheorem { assertion }
  {
    , heading =   {
                    , english     = Assertion
                    , french      = Assertion
                    , ngerman     = Assertion
                    , 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     = {Assertion}{Assertionen}
                    , 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     = {Assertion}{Assertionen}
                    , 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 { claim }
  {
    , heading =   {
                    , english     = Claim
                    , french      = Affirmation
                    , ngerman     = Behauptung
                    , italian     = Affermazione
                    , portuguese  = Afirmação
                    , brazilian   = Afirmação
                    , spanish     = Afirmación
                    , schinese    = 断言
                    , tchinese    = 斷言
                    , japanese    = 断言
                    , russian     = Утверждение
                  }
    , crefname =  {
                    , english     = {Claim}{Claim}
                    , french      = [l']{Affirmation}[les]{Affirmation}
                    , ngerman     = {Behauptung}{Behauptungen}
                    , italian     = [l']{Affermazione}[le]{Affermazione}
                    , portuguese  = [a]{Afirmação}[as]{Afirmação}
                    , brazilian   = [a]{Afirmação}[as]{Afirmação}
                    , spanish     = [la]{Afirmación}[las]{Afirmación}
                    , schinese    = {断言}{断言}
                    , tchinese    = {斷言}{斷言}
                    , japanese    = {断言}{断言}
                    , russian     = {Утверждение}{Утверждение}
                  }
    , Crefname =  {
                    , english     = {Claim}{Claim}
                    , french      = [L']{Affirmation}[Les]{Affirmation}
                    , ngerman     = {Behauptung}{Behauptungen}
                    , italian     = [L']{Affermazione}[Le]{Affermazione}
                    , portuguese  = [A]{Afirmação}[As]{Afirmação}
                    , brazilian   = [A]{Afirmação}[As]{Afirmação}
                    , spanish     = [La]{Afirmación}[Las]{Afirmación}
                    , schinese    = {断言}{断言}
                    , tchinese    = {斷言}{斷言}
                    , japanese    = {断言}{断言}
                    , russian     = {Утверждение}{Утверждение}
                  }
  }

\NameTheorem { commentary }
  {
    , heading =   {
                    , english     = Commentary
                    , french      = Commentaire
                    , ngerman     = Kommentar
                    , italian     = Commento
                    , portuguese  = Comentário
                    , brazilian   = Comentário
                    , spanish     = Comentario
                    , schinese    = 解说
                    , tchinese    = 解說
                    , japanese    = 解説 % コメント
                    , russian     = Комментарий
                  }
    , crefname =  {
                    , english     = {Commentary}{Commentary}
                    , french      = [la]{Commentaire}[les]{Commentaire}
                    , ngerman     = {Kommentar}{Kommentar}
                    , 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     = {Commentary}{Commentary}
                    , french      = [La]{Commentaire}[Les]{Commentaire}
                    , ngerman     = {Kommentar}{Kommentar}
                    , 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 { 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 { construction }
  {
    , heading =   {
                    , english     = Construction
                    , french      = Construction
                    , ngerman     = Konstruktion
                    , italian     = Costruzione
                    , portuguese  = Construção
                    , brazilian   = Construção
                    , spanish     = Construcción
                    , schinese    = 构造
                    , tchinese    = 構造
                    , japanese    = 構造
                    , russian     = Конструкция
                  }
    , crefname =  {
                    , english     = {Construction}{Construction}
                    , french      = [la]{Construction}[les]{Construction}
                    , ngerman     = {Konstruktion}{Konstruktion}
                    , italian     = [la]{Costruzione}[le]{Costruzione}
                    , portuguese  = [a]{Construção}[as]{Construção}
                    , brazilian   = [a]{Construção}[as]{Construção}
                    , spanish     = [la]{Construcción}[las]{Construcción}
                    , schinese    = {构造}{构造}
                    , tchinese    = {構造}{構造}
                    , japanese    = {構造}{構造}
                    , russian     = {Конструкция}{Конструкция}
                  }
    , Crefname =  {
                    , english     = {Construction}{Construction}
                    , french      = [La]{Construction}[Les]{Construction}
                    , ngerman     = {Konstruktion}{Konstruktion}
                    , italian     = [La]{Costruzione}[Le]{Costruzione}
                    , portuguese  = [A]{Construção}[As]{Construção}
                    , brazilian   = [A]{Construção}[As]{Construção}
                    , spanish     = [La]{Construcción}[Las]{Construcción}
                    , 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']{Exemple}[les]{Exemple}
                    , 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']{Exemple}[Les]{Exemple}
                    , 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     = Tatsache
                    , italian     = Fatto
                    , portuguese  = Facto
                    , brazilian   = Fato
                    , spanish     = Hecho
                    , schinese    = 事实
                    , tchinese    = 事實
                    , japanese    = 事実
                    , russian     = Факт
                  }
    , crefname =  {
                    , english     = {Fact}{Fact}
                    , french      = [le]{Fait}[les]{Fait}
                    , ngerman     = {Tatsache}{Tatsachen}
                    , 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     = {Tatsache}{Tatsachen}
                    , 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 { motivation }
  {
    , heading =   {
                    , english     = Motivation
                    , french      = Motivation
                    , ngerman     = Motivation
                    , italian     = Motivazione
                    , portuguese  = Motivação
                    , brazilian   = Motivação
                    , spanish     = Motivacion
                    , schinese    = 动机
                    , tchinese    = 動機
                    , japanese    = 動機 % モチベーション
                    , russian     = Мотивация
                  }
    , crefname =  {
                    , english     = {Motivation}{Motivation}
                    , french      = [la]{Motivation}[les]{Motivation}
                    , ngerman     = {Motivation}{Motivation}
                    , italian     = [la]{Motivazione}[le]{Motivazione}
                    , portuguese  = [a]{Motivação}[as]{Motivação}
                    , brazilian   = [a]{Motivação}[as]{Motivação}
                    , spanish     = [la]{Motivacion}[las]{Motivacion}
                    , schinese    = {动机}{动机}
                    , tchinese    = {動機}{動機}
                    , japanese    = {動機}{動機}
                    , russian     = {Мотивация}{Мотивация}
                  }
    , Crefname =  {
                    , english     = {Motivation}{Motivation}
                    , french      = [La]{Motivation}[Les]{Motivation}
                    , ngerman     = {Motivation}{Motivation}
                    , italian     = [La]{Motivazione}[Le]{Motivazione}
                    , portuguese  = [A]{Motivação}[As]{Motivação}
                    , brazilian   = [A]{Motivação}[As]{Motivação}
                    , spanish     = [La]{Motivacion}[Las]{Motivacion}
                    , 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 { recall }
  {
    , heading =   {
                    , english     = Recall
                    , french      = Rappel
                    , ngerman     = Rückruf
                    , italian     = Richiamo
                    , portuguese  = Recordação
                    , brazilian   = Recordação
                    , spanish     = Recuerdo
                    , schinese    = 回顾
                    , tchinese    = 回顧
                    , japanese    = 回顧
                    , russian     = Напоминание
                  }
    , crefname =  {
                    , english     = {Recall}{Recall}
                    , french      = [le]{Rappel}[les]{Rappel}
                    , ngerman     = {Rückruf}{Rückruf}
                    , italian     = [il]{Richiamo}[i]{Richiamo}
                    , portuguese  = [a]{Recordação}[as]{Recordação}
                    , brazilian   = [a]{Recordação}[as]{Recordação}
                    , spanish     = [el]{Recuerdo}[los]{Recuerdo}
                    , schinese    = {回顾}{回顾}
                    , tchinese    = {回顧}{回顧}
                    , japanese    = {回顧}{回顧}
                    , russian     = {Напоминание}{Напоминание}
                  }
    , Crefname =  {
                    , english     = {Recall}{Recall}
                    , french      = [Le]{Rappel}[Les]{Rappel}
                    , ngerman     = {Rückruf}{Rückruf}
                    , italian     = [Il]{Richiamo}[I]{Richiamo}
                    , portuguese  = [A]{Recordação}[As]{Recordação}
                    , brazilian   = [A]{Recordação}[As]{Recordação}
                    , spanish     = [El]{Recuerdo}[Los]{Recuerdo}
                    , schinese    = {回顾}{回顾}
                    , tchinese    = {回顧}{回顧}
                    , japanese    = {回顧}{回顧}
                    , russian     = {Напоминание}{Напоминание}
                  }
  }

\NameTheorem { remark }
  {
    , heading =   {
                    , english     = Remark
                    , french      = Remarque
                    , ngerman     = Erinnerung
                    , italian     = Commento
                    , portuguese  = Comentário
                    , brazilian   = Comentário
                    , spanish     = Comentario
                    , schinese    = 备注
                    , tchinese    = 備註
                    , japanese    = 注釈
                    , russian     = Замечание
                  }
    , crefname =  {
                    , english     = {Remark}{Remark}
                    , french      = [la]{Remarque}[les]{Remarque}
                    , ngerman     = {Erinnerung}{Erinnerungen}
                    , 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     = {Erinnerung}{Erinnerungen}
                    , 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-corollary } { combined = { definition ; corollary } }
\NameTheorem { definition-proposition } { combined = { definition ; proposition } }
\NameTheorem { definition-theorem } { combined = { definition ; theorem } }

\NameTheorem { corollary-definition } { combined = { corollary ; definition } }
\NameTheorem { proposition-definition } { combined = { proposition ; definition } }
\NameTheorem { theorem-definition } { combined = { theorem ; definition } }

\NameTheorem { applications }
  {
    , heading =   {
                    , english     = Applications
                    , french      = Applications
                    , ngerman     = Anwendungen
                    , italian     = Applicazioni
                    , portuguese  = Aplicações
                    , brazilian   = Aplicações
                    , spanish     = Aplicaciones
                    , schinese    = 应用
                    , tchinese    = 應用
                    , japanese    = 応用
                    , russian     = Приложения
                  }
    , crefname =  {
                    , english     = {Applications}{Applications}
                    , french      = [les]{Applications}[les]{Applications}
                    , ngerman     = { {Anwendungen}{Anwendungen}
                                      , Nominativ = [die]{Anwendungen}[die]{Anwendungen}
                                      , Genitiv   = [der]{Anwendungen}[der]{Anwendungen}
                                      , Dativ     = [den]{Anwendungen}[den]{Anwendungen}
                                      , Akkusativ = [die]{Anwendungen}[die]{Anwendungen}
                                    }
                    , italian     = [le]{Applicazioni}[le]{Applicazioni}
                    , portuguese  = [as]{Aplicações}[as]{Aplicações}
                    , brazilian   = [as]{Aplicações}[as]{Aplicações}
                    , spanish     = [las]{Aplicaciones}[las]{Aplicaciones}
                    , schinese    = {应用}{应用}
                    , tchinese    = {應用}{應用}
                    , japanese    = {応用}{応用}
                    , russian     = {Приложения}{Приложения}
                  }
    , Crefname =  {
                    , english     = {Applications}{Applications}
                    , french      = [Les]{Applications}[Les]{Applications}
                    , ngerman     = { {Anwendungen}{Anwendungen}
                                      , Nominativ = [Die]{Anwendungen}[Die]{Anwendungen}
                                      , Genitiv   = [Der]{Anwendungen}[Der]{Anwendungen}
                                      , Dativ     = [Den]{Anwendungen}[Den]{Anwendungen}
                                      , Akkusativ = [Die]{Anwendungen}[Die]{Anwendungen}
                                    }
                    , italian     = [Le]{Applicazioni}[Le]{Applicazioni}
                    , portuguese  = [As]{Aplicações}[As]{Aplicações}
                    , brazilian   = [As]{Aplicações}[As]{Aplicações}
                    , spanish     = [Las]{Aplicaciones}[Las]{Aplicaciones}
                    , schinese    = {应用}{应用}
                    , tchinese    = {應用}{應用}
                    , japanese    = {応用}{応用}
                    , russian     = {Приложения}{Приложения}
                  }
  }

\NameTheorem { assertions }
  {
    , heading =   {
                    , english     = Assertions
                    , french      = Assertions
                    , ngerman     = Assertionen
                    , italian     = Asserzioni
                    , portuguese  = Asserções
                    , brazilian   = Asserções
                    , spanish     = Aserciones
                    , schinese    = 断言
                    , tchinese    = 斷言
                    , japanese    = 断言
                    , russian     = Утверждения
                  }
    , crefname =  {
                    , english     = {Assertions}{Assertions}
                    , french      = [les]{Assertions}[les]{Assertions}
                    , ngerman     = { {Assertionen}{Assertionen}
                                      , Nominativ = [die]{Assertionen}[die]{Assertionen}
                                      , Genitiv   = [der]{Assertionen}[der]{Assertionen}
                                      , Dativ     = [den]{Assertionen}[den]{Assertionen}
                                      , Akkusativ = [die]{Assertionen}[die]{Assertionen}
                                    }
                    , italian     = [le]{Asserzioni}[le]{Asserzioni}
                    , portuguese  = [as]{Asserções}[as]{Asserções}
                    , brazilian   = [as]{Asserções}[as]{Asserções}
                    , spanish     = [las]{Aserciones}[las]{Aserciones}
                    , schinese    = {断言}{断言}
                    , tchinese    = {斷言}{斷言}
                    , japanese    = {断言}{断言}
                    , russian     = {Утверждения}{Утверждения}
                  }
    , Crefname =  {
                    , english     = {Assertions}{Assertions}
                    , french      = [Les]{Assertions}[Les]{Assertions}
                    , ngerman     = { {Assertionen}{Assertionen}
                                      , Nominativ = [Die]{Assertionen}[Die]{Assertionen}
                                      , Genitiv   = [Der]{Assertionen}[Der]{Assertionen}
                                      , Dativ     = [Den]{Assertionen}[Den]{Assertionen}
                                      , Akkusativ = [Die]{Assertionen}[Die]{Assertionen}
                                    }
                    , italian     = [Le]{Asserzioni}[Le]{Asserzioni}
                    , portuguese  = [As]{Asserções}[As]{Asserções}
                    , brazilian   = [As]{Asserções}[As]{Asserções}
                    , spanish     = [Las]{Aserciones}[Las]{Aserciones}
                    , schinese    = {断言}{断言}
                    , tchinese    = {斷言}{斷言}
                    , japanese    = {断言}{断言}
                    , russian     = {Утверждения}{Утверждения}
                  }
  }

\NameTheorem { assumptions }
  {
    , heading =   {
                    , english     = Assumptions
                    , french      = Suppositions
                    , ngerman     = Annahmen
                    , italian     = Supposizioni
                    , portuguese  = Suposições
                    , brazilian   = Suposições
                    , spanish     = Suposiciones
                    , schinese    = 假定
                    , tchinese    = 假定
                    , japanese    = 仮定
                    , russian     = Предположения
                  }
    , crefname =  {
                    , english     = {Assumptions}{Assumptions}
                    , french      = [les]{Suppositions}[les]{Suppositions}
                    , ngerman     = { {Annahmen}{Annahmen}
                                      , Nominativ = [die]{Annahmen}[die]{Annahmen}
                                      , Genitiv   = [der]{Annahmen}[der]{Annahmen}
                                      , Dativ     = [den]{Annahmen}[den]{Annahmen}
                                      , Akkusativ = [die]{Annahmen}[die]{Annahmen}
                                    }
                    , italian     = [le]{Supposizioni}[le]{Supposizioni}
                    , portuguese  = [as]{Suposições}[as]{Suposições}
                    , brazilian   = [as]{Suposições}[as]{Suposições}
                    , spanish     = [las]{Suposiciones}[las]{Suposiciones}
                    , schinese    = {假定}{假定}
                    , tchinese    = {假定}{假定}
                    , japanese    = {仮定}{仮定}
                    , russian     = {Предположения}{Предположения}
                  }
    , Crefname =  {
                    , english     = {Assumptions}{Assumptions}
                    , french      = [Les]{Suppositions}[Les]{Suppositions}
                    , ngerman     = { {Annahmen}{Annahmen}
                                      , Nominativ = [Die]{Annahmen}[Die]{Annahmen}
                                      , Genitiv   = [Der]{Annahmen}[Der]{Annahmen}
                                      , Dativ     = [Den]{Annahmen}[Den]{Annahmen}
                                      , Akkusativ = [Die]{Annahmen}[Die]{Annahmen}
                                    }
                    , italian     = [le]{Supposizioni}[le]{Supposizioni}
                    , portuguese  = [As]{Suposições}[As]{Suposições}
                    , brazilian   = [As]{Suposições}[As]{Suposições}
                    , spanish     = [Las]{Suposiciones}[Las]{Suposiciones}
                    , schinese    = {假定}{假定}
                    , tchinese    = {假定}{假定}
                    , japanese    = {仮定}{仮定}
                    , russian     = {Предположения}{Предположения}
                  }
  }

\NameTheorem { axioms }
  {
    , heading =   {
                    , english     = Axioms
                    , french      = Axiomes
                    , ngerman     = Axiome
                    , italian     = Assiomi
                    , portuguese  = Axiomas
                    , brazilian   = Axiomas
                    , spanish     = Axiomas
                    , schinese    = 公理
                    , tchinese    = 公理
                    , japanese    = 公理
                    , russian     = Аксиомы
                  }
    , crefname =  {
                    , english     = {Axioms}{Axioms}
                    , french      = [les]{Axiomes}[les]{Axiomes}
                    , ngerman     = { {Axiome}{Axiome}
                                      , Nominativ = [die]{Axiome}[die]{Axiome}
                                      , Genitiv   = [der]{Axiome}[der]{Axiome}
                                      , Dativ     = [den]{Axiomen}[den]{Axiomen}
                                      , Akkusativ = [die]{Axiome}[die]{Axiome}
                                    }
                    , italian     = [gli]{Assiomi}[gli]{Assiomi}
                    , portuguese  = [os]{Axiomas}[os]{Axiomas}
                    , brazilian   = [os]{Axiomas}[os]{Axiomas}
                    , spanish     = [los]{Axiomas}[los]{Axiomas}
                    , schinese    = {公理}{公理}
                    , tchinese    = {公理}{公理}
                    , japanese    = {公理}{公理}
                    , russian     = {Аксиомы}{Аксиомы}
                  }
    , Crefname =  {
                    , english     = {Axioms}{Axioms}
                    , french      = [Les]{Axiomes}[Les]{Axiomes}
                    , ngerman     = { {Axiome}{Axiome}
                                      , Nominativ = [Die]{Axiome}[Die]{Axiome}
                                      , Genitiv   = [Der]{Axiome}[Der]{Axiome}
                                      , Dativ     = [Den]{Axiomen}[Den]{Axiomen}
                                      , Akkusativ = [Die]{Axiome}[Die]{Axiome}
                                    }
                    , italian     = [Gli]{Assiomi}[Gli]{Assiomi}
                    , portuguese  = [Os]{Axiomas}[Os]{Axiomas}
                    , brazilian   = [Os]{Axiomas}[Os]{Axiomas}
                    , spanish     = [Los]{Axiomas}[Los]{Axiomas}
                    , schinese    = {公理}{公理}
                    , tchinese    = {公理}{公理}
                    , japanese    = {公理}{公理}
                    , russian     = {Аксиомы}{Аксиомы}
                  }
  }

\NameTheorem { claims }
  {
    , heading =   {
                    , english     = Claims
                    , french      = Affirmations
                    , ngerman     = Behauptungen
                    , italian     = Affermazioni
                    , portuguese  = Afirmações
                    , brazilian   = Afirmações
                    , spanish     = Afirmaciones
                    , schinese    = 断言
                    , tchinese    = 斷言
                    , japanese    = 断言
                    , russian     = Утверждения
                  }
    , crefname =  {
                    , english     = {Claims}{Claims}
                    , french      = [les]{Affirmations}[les]{Affirmations}
                    , ngerman     = { {Behauptungen}{Behauptungen}
                                      , Nominativ = [die]{Behauptungen}[die]{Behauptungen}
                                      , Genitiv   = [der]{Behauptungen}[der]{Behauptungen}
                                      , Dativ     = [den]{Behauptungen}[den]{Behauptungen}
                                      , Akkusativ = [die]{Behauptungen}[die]{Behauptungen}
                                    }
                    , italian     = [le]{Affermazioni}[le]{Affermazioni}
                    , portuguese  = [as]{Afirmações}[as]{Afirmações}
                    , brazilian   = [as]{Afirmações}[as]{Afirmações}
                    , spanish     = [las]{Afirmaciones}[las]{Afirmaciones}
                    , schinese    = {断言}{断言}
                    , tchinese    = {斷言}{斷言}
                    , japanese    = {断言}{断言}
                    , russian     = {Утверждения}{Утверждения}
                  }
    , Crefname =  {
                    , english     = {Claims}{Claims}
                    , french      = [Les]{Affirmations}[Les]{Affirmations}
                    , ngerman     = { {Behauptungen}{Behauptungen}
                                      , Nominativ = [Die]{Behauptungen}[Die]{Behauptungen}
                                      , Genitiv   = [Der]{Behauptungen}[Der]{Behauptungen}
                                      , Dativ     = [Den]{Behauptungen}[Den]{Behauptungen}
                                      , Akkusativ = [Die]{Behauptungen}[Die]{Behauptungen}
                                    }
                    , italian     = [Le]{Affermazioni}[Le]{Affermazioni}
                    , portuguese  = [As]{Afirmações}[As]{Afirmações}
                    , brazilian   = [As]{Afirmações}[As]{Afirmações}
                    , spanish     = [Las]{Afirmaciones}[Las]{Afirmaciones}
                    , schinese    = {断言}{断言}
                    , tchinese    = {斷言}{斷言}
                    , japanese    = {断言}{断言}
                    , russian     = {Утверждения}{Утверждения}
                  }
  }

\NameTheorem { commentaries }
  {
    , heading =   {
                    , english     = Commentaries
                    , french      = Commentaires
                    , ngerman     = Kommentare
                    , italian     = Commenti
                    , portuguese  = Comentários
                    , brazilian   = Comentários
                    , spanish     = Comentarios
                    , schinese    = 解说
                    , tchinese    = 解說
                    , japanese    = 解説
                    , russian     = Комментарии
                  }
    , crefname =  {
                    , english     = {Commentaries}{Commentaries}
                    , french      = [les]{Commentaires}[les]{Commentaires}
                    , ngerman     = { {Kommentare}{Kommentare}
                                      , Nominativ = [die]{Kommentare}[die]{Kommentare}
                                      , Genitiv   = [der]{Kommentare}[der]{Kommentare}
                                      , Dativ     = [den]{Kommentaren}[den]{Kommentaren}
                                      , Akkusativ = [die]{Kommentare}[die]{Kommentare}
                                    }
                    , italian     = [i]{Commenti}[i]{Commenti}
                    , portuguese  = [os]{Comentários}[os]{Comentários}
                    , brazilian   = [os]{Comentários}[os]{Comentários}
                    , spanish     = [los]{Comentarios}[los]{Comentarios}
                    , schinese    = {解说}{解说}
                    , tchinese    = {解說}{解說}
                    , japanese    = {解説}{解説}
                    , russian     = {Комментарии}{Комментарии}
                  }
    , Crefname =  {
                    , english     = {Commentaries}{Commentaries}
                    , french      = [Les]{Commentaires}[Les]{Commentaires}
                    , ngerman     = { {Kommentare}{Kommentare}
                                      , Nominativ = [Die]{Kommentare}[Die]{Kommentare}
                                      , Genitiv   = [Der]{Kommentare}[Der]{Kommentare}
                                      , Dativ     = [Den]{Kommentaren}[Den]{Kommentaren}
                                      , Akkusativ = [Die]{Kommentare}[Die]{Kommentare}
                                    }
                    , italian     = [I]{Commenti}[I]{Commenti}
                    , portuguese  = [Os]{Comentários}[Os]{Comentários}
                    , brazilian   = [Os]{Comentários}[Os]{Comentários}
                    , spanish     = [Los]{Comentarios}[Los]{Comentarios}
                    , schinese    = {解说}{解说}
                    , tchinese    = {解說}{解說}
                    , japanese    = {解説}{解説}
                    , russian     = {Комментарии}{Комментарии}
                  }
  }

\NameTheorem { conclusions }
  {
    , heading =   {
                    , english     = Conclusions
                    , french      = Conclusions
                    , ngerman     = Schlussfolgerungen
                    , italian     = Conclusioni
                    , portuguese  = Conclusões
                    , brazilian   = Conclusões
                    , spanish     = Conclusiones
                    , schinese    = 结论
                    , tchinese    = 結論
                    , japanese    = 結論
                    , russian     = Выводы
                  }
    , crefname =  {
                    , english     = {Conclusions}{Conclusions}
                    , french      = [Les]{Conclusions}[Les]{Conclusions}
                    , ngerman     = { {Schlussfolgerungen}{Schlussfolgerungen}
                                      , Nominativ = [die]{Schlussfolgerungen}[die]{Schlussfolgerungen}
                                      , Genitiv   = [der]{Schlussfolgerungen}[der]{Schlussfolgerungen}
                                      , Dativ     = [den]{Schlussfolgerungen}[den]{Schlussfolgerungen}
                                      , Akkusativ = [die]{Schlussfolgerungen}[die]{Schlussfolgerungen}
                                    }
                    , italian     = [le]{Conclusioni}[le]{Conclusioni}
                    , portuguese  = [as]{Conclusões}[as]{Conclusões}
                    , brazilian   = [as]{Conclusões}[as]{Conclusões}
                    , spanish     = [las]{Conclusiones}[las]{Conclusiones}
                    , schinese    = {结论}{结论}
                    , tchinese    = {結論}{結論}
                    , japanese    = {結論}{結論}
                    , russian     = {Выводы}{Выводы}
                  }
    , Crefname =  {
                    , english     = {Conclusions}{Conclusions}
                    , french      = [Les]{Conclusions}[Les]{Conclusions}
                    , ngerman     = { {Schlussfolgerungen}{Schlussfolgerungen}
                                      , Nominativ = [Die]{Schlussfolgerungen}[Die]{Schlussfolgerungen}
                                      , Genitiv   = [Der]{Schlussfolgerungen}[Der]{Schlussfolgerungen}
                                      , Dativ     = [Den]{Schlussfolgerungen}[Den]{Schlussfolgerungen}
                                      , Akkusativ = [Die]{Schlussfolgerungen}[Die]{Schlussfolgerungen}
                                    }
                    , italian     = [Le]{Conclusioni}[Le]{Conclusioni}
                    , portuguese  = [As]{Conclusões}[As]{Conclusões}
                    , brazilian   = [As]{Conclusões}[As]{Conclusões}
                    , spanish     = [Las]{Conclusiones}[Las]{Conclusiones}
                    , schinese    = {结论}{结论}
                    , tchinese    = {結論}{結論}
                    , japanese    = {結論}{結論}
                    , russian     = {Выводы}{Выводы}
                  }
  }

\NameTheorem { conjectures }
  {
    , heading =   {
                    , english     = Conjectures
                    , french      = Conjectures
                    , ngerman     = Vermutungen
                    , italian     = Congetture
                    , portuguese  = Conjeturas
                    , brazilian   = Conjecturas
                    , spanish     = Conjeturas
                    , schinese    = 猜想
                    , tchinese    = 猜想
                    , japanese    = 予想
                    , russian     = Гипотезы
                  }
    , crefname =  {
                    , english     = {Conjectures}{Conjectures}
                    , french      = [les]{Conjectures}[les]{Conjectures}
                    , ngerman     = { {Vermutungen}{Vermutungen}
                                      , Nominativ = [die]{Vermutungen}[die]{Vermutungen}
                                      , Genitiv   = [der]{Vermutungen}[der]{Vermutungen}
                                      , Dativ     = [den]{Vermutungen}[den]{Vermutungen}
                                      , Akkusativ = [die]{Vermutungen}[die]{Vermutungen}
                                    }
                    , italian     = [le]{Congetture}[le]{Congetture}
                    , portuguese  = [as]{Conjeturas}[as]{Conjeturas}
                    , brazilian   = [as]{Conjecturas}[as]{Conjecturas}
                    , spanish     = [las]{Conjeturas}[las]{Conjeturas}
                    , schinese    = {猜想}{猜想}
                    , tchinese    = {猜想}{猜想}
                    , japanese    = {予想}{予想}
                    , russian     = {Гипотезы}{Гипотезы}
                  }
    , Crefname =  {
                    , english     = {Conjectures}{Conjectures}
                    , french      = [Les]{Conjectures}[Les]{Conjectures}
                    , ngerman     = { {Vermutungen}{Vermutungen}
                                      , Nominativ = [Die]{Vermutungen}[Die]{Vermutungen}
                                      , Genitiv   = [Der]{Vermutungen}[Der]{Vermutungen}
                                      , Dativ     = [Den]{Vermutungen}[Den]{Vermutungen}
                                      , Akkusativ = [Die]{Vermutungen}[Die]{Vermutungen}
                                    }
                    , italian     = [Le]{Congetture}[Le]{Congetture}
                    , portuguese  = [As]{Conjeturas}[As]{Conjeturas}
                    , brazilian   = [As]{Conjecturas}[As]{Conjecturas}
                    , spanish     = [Las]{Conjeturas}[Las]{Conjeturas}
                    , schinese    = {猜想}{猜想}
                    , tchinese    = {猜想}{猜想}
                    , japanese    = {予想}{予想}
                    , russian     = {Гипотезы}{Гипотезы}
                  }
  }

\NameTheorem { constructions }
  {
    , heading =   {
                    , english     = Constructions
                    , french      = Constructions
                    , ngerman     = Konstruktionen
                    , italian     = Costruzioni
                    , portuguese  = Construções
                    , brazilian   = Construções
                    , spanish     = Construcciones
                    , schinese    = 构造
                    , tchinese    = 構造
                    , japanese    = 構造
                    , russian     = Конструкции
                  }
    , crefname =  {
                    , english     = {Constructions}{Constructions}
                    , french      = [les]{Constructions}[les]{Constructions}
                    , ngerman     = { {Konstruktionen}{Konstruktionen}
                                      , Nominativ = [die]{Konstruktionen}[die]{Konstruktionen}
                                      , Genitiv   = [der]{Konstruktionen}[der]{Konstruktionen}
                                      , Dativ     = [den]{Konstruktionen}[den]{Konstruktionen}
                                      , Akkusativ = [die]{Konstruktionen}[die]{Konstruktionen}
                                    }
                    , italian     = [le]{Costruzioni}[le]{Costruzioni}
                    , portuguese  = [as]{Construções}[as]{Construções}
                    , brazilian   = [as]{Construções}[as]{Construções}
                    , spanish     = [las]{Construcciones}[las]{Construcciones}
                    , schinese    = {构造}{构造}
                    , tchinese    = {構造}{構造}
                    , japanese    = {構造}{構造}
                    , russian     = {Конструкции}{Конструкции}
                  }
    , Crefname =  {
                    , english     = {Constructions}{Constructions}
                    , french      = [Les]{Constructions}[Les]{Constructions}
                    , ngerman     = { {Konstruktionen}{Konstruktionen}
                                      , Nominativ = [Die]{Konstruktionen}[Die]{Konstruktionen}
                                      , Genitiv   = [Der]{Konstruktionen}[Der]{Konstruktionen}
                                      , Dativ     = [Den]{Konstruktionen}[Den]{Konstruktionen}
                                      , Akkusativ = [Die]{Konstruktionen}[Die]{Konstruktionen}
                                    }
                    , italian     = [Le]{Costruzioni}[Le]{Costruzioni}
                    , portuguese  = [As]{Construções}[As]{Construções}
                    , brazilian   = [As]{Construções}[As]{Construções}
                    , spanish     = [Las]{Construcciones}[Las]{Construcciones}
                    , schinese    = {构造}{构造}
                    , tchinese    = {構造}{構造}
                    , japanese    = {構造}{構造}
                    , russian     = {Конструкции}{Конструкции}
                  }
  }

\NameTheorem { conventions }
  {
    , heading =   {
                    , english     = Conventions
                    , french      = Conventions
                    , ngerman     = Konventionen
                    , italian     = Convenzioni
                    , portuguese  = Convenções
                    , brazilian   = Convenções
                    , spanish     = Convenciones
                    , schinese    = 约定
                    , tchinese    = 約定
                    , japanese    = 慣例
                    , russian     = Конвенции
                  }
    , crefname =  {
                    , english     = {Conventions}{Conventions}
                    , french      = [les]{Conventions}[les]{Conventions}
                    , ngerman     = { {Konventionen}{Konventionen}
                                      , Nominativ = [die]{Konventionen}[die]{Konventionen}
                                      , Genitiv   = [der]{Konventionen}[der]{Konventionen}
                                      , Dativ     = [den]{Konventionen}[den]{Konventionen}
                                      , Akkusativ = [die]{Konventionen}[die]{Konventionen}
                                    }
                    , italian     = [le]{Convenzioni}[le]{Convenzioni}
                    , portuguese  = [as]{Convenções}[as]{Convenções}
                    , brazilian   = [as]{Convenções}[as]{Convenções}
                    , spanish     = [las]{Convenciones}[las]{Convenciones}
                    , schinese    = {约定}{约定}
                    , tchinese    = {約定}{約定}
                    , japanese    = {慣例}{慣例}
                    , russian     = {Конвенции}{Конвенции}
                  }
    , Crefname =  {
                    , english     = {Conventions}{Conventions}
                    , french      = [Les]{Conventions}[Les]{Conventions}
                    , ngerman     = { {Konventionen}{Konventionen}
                                      , Nominativ = [Die]{Konventionen}[Die]{Konventionen}
                                      , Genitiv   = [Der]{Konventionen}[Der]{Konventionen}
                                      , Dativ     = [Den]{Konventionen}[Den]{Konventionen}
                                      , Akkusativ = [Die]{Konventionen}[Die]{Konventionen}
                                    }
                    , italian     = [Le]{Convenzioni}[Le]{Convenzioni}
                    , portuguese  = [As]{Convenções}[As]{Convenções}
                    , brazilian   = [As]{Convenções}[As]{Convenções}
                    , spanish     = [Las]{Convenciones}[Las]{Convenciones}
                    , schinese    = {约定}{约定}
                    , tchinese    = {約定}{約定}
                    , japanese    = {慣例}{慣例}
                    , russian     = {Конвенции}{Конвенции}
                  }
  }

\NameTheorem { corollaries }
  {
    , heading =   {
                    , english     = Corollaries
                    , french      = Corollaires
                    , ngerman     = Korollare
                    , italian     = Corollari
                    , portuguese  = Corolários
                    , brazilian   = Corolários
                    , spanish     = Corolarios
                    , schinese    = 推论
                    , tchinese    = 推論
                    , japanese    = 系
                    , russian     = Следствия
                  }
    , crefname =  {
                    , english     = {Corollaries}{Corollaries}
                    , french      = [les]{Corollaires}[les]{Corollaires}
                    , ngerman     = { {Korollare}{Korollare}
                                      , Nominativ = [die]{Korollare}[die]{Korollare}
                                      , Genitiv   = [der]{Korollare}[der]{Korollare}
                                      , Dativ     = [den]{Korollaren}[den]{Korollaren}
                                      , Akkusativ = [die]{Korollare}[die]{Korollare}
                                    }
                    , italian     = [i]{Corollari}[i]{Corollari}
                    , portuguese  = [os]{Corolários}[os]{Corolários}
                    , brazilian   = [os]{Corolários}[os]{Corolários}
                    , spanish     = [los]{Corolarios}[los]{Corolarios}
                    , schinese    = {推论}{推论}
                    , tchinese    = {推論}{推論}
                    , japanese    = {系}{系}
                    , russian     = {Следствия}{Следствия}
                  }
    , Crefname =  {
                    , english     = {Corollaries}{Corollaries}
                    , french      = [Les]{Corollaires}[Les]{Corollaires}
                    , ngerman     = { {Korollare}{Korollare}
                                      , Nominativ = [Die]{Korollare}[Die]{Korollare}
                                      , Genitiv   = [Der]{Korollare}[Der]{Korollare}
                                      , Dativ     = [Den]{Korollaren}[Den]{Korollaren}
                                      , Akkusativ = [Die]{Korollare}[Die]{Korollare}
                                    }
                    , italian     = [I]{Corollari}[I]{Corollari}
                    , portuguese  = [Os]{Corolários}[Os]{Corolários}
                    , brazilian   = [Os]{Corolários}[Os]{Corolários}
                    , spanish     = [Los]{Corolarios}[Los]{Corolarios}
                    , schinese    = {推论}{推论}
                    , tchinese    = {推論}{推論}
                    , japanese    = {系}{系}
                    , russian     = {Следствия}{Следствия}
                  }
  }

\NameTheorem { definitions }
  {
    , heading =   {
                    , english     = Definitions
                    , french      = Définitions
                    , ngerman     = Definitionen
                    , italian     = Definizioni
                    , portuguese  = Definições
                    , brazilian   = Definições
                    , spanish     = Definiciones
                    , schinese    = 定义
                    , tchinese    = 定義
                    , japanese    = 定義
                    , russian     = Определения
                  }
    , crefname =  {
                    , english     = {Definitions}{Definitions}
                    , french      = [les]{Définitions}[les]{Définitions}
                    , ngerman     = { {Definitionen}{Definitionen}
                                      , Nominativ = [die]{Definitionen}[die]{Definitionen}
                                      , Genitiv   = [der]{Definitionen}[der]{Definitionen}
                                      , Dativ     = [den]{Definitionen}[den]{Definitionen}
                                      , Akkusativ = [die]{Definitionen}[die]{Definitionen}
                                    }
                    , italian     = [le]{Definizioni}[le]{Definizioni}
                    , portuguese  = [as]{Definições}[as]{Definições}
                    , brazilian   = [as]{Definições}[as]{Definições}
                    , spanish     = [las]{Definiciones}[las]{Definiciones}
                    , schinese    = {定义}{定义}
                    , tchinese    = {定義}{定義}
                    , japanese    = {定義}{定義}
                    , russian     = {Определения}{Определения}
                  }
    , Crefname =  {
                    , english     = {Definitions}{Definitions}
                    , french      = [Les]{Définitions}[Les]{Définitions}
                    , ngerman     = { {Definitionen}{Definitionen}
                                      , Nominativ = [Die]{Definitionen}[Die]{Definitionen}
                                      , Genitiv   = [Der]{Definitionen}[Der]{Definitionen}
                                      , Dativ     = [Den]{Definitionen}[Den]{Definitionen}
                                      , Akkusativ = [Die]{Definitionen}[Die]{Definitionen}
                                    }
                    , italian     = [Le]{Definizioni}[Le]{Definizioni}
                    , portuguese  = [As]{Definições}[As]{Definições}
                    , brazilian   = [As]{Definições}[As]{Definições}
                    , spanish     = [Las]{Definiciones}[Las]{Definiciones}
                    , schinese    = {定义}{定义}
                    , tchinese    = {定義}{定義}
                    , japanese    = {定義}{定義}
                    , russian     = {Определения}{Определения}
                  }
  }

\NameTheorem { examples }
  {
    , heading =   {
                    , english     = Examples
                    , french      = Exemples
                    , ngerman     = Beispiele
                    , italian     = Esempi
                    , portuguese  = Exemplos
                    , brazilian   = Exemplos
                    , spanish     = Ejemplos
                    , schinese    = 例
                    , tchinese    = 例
                    , japanese    = 例
                    , russian     = Примеры
                  }
    , crefname =  {
                    , english     = {Examples}{Examples}
                    , french      = [les]{Exemples}[les]{Exemples}
                    , ngerman     = { {Beispiele}{Beispiele}
                                      , Nominativ = [die]{Beispiele}[die]{Beispiele}
                                      , Genitiv   = [der]{Beispiele}[der]{Beispiele}
                                      , Dativ     = [den]{Beispielen}[den]{Beispielen}
                                      , Akkusativ = [die]{Beispiele}[die]{Beispiele}
                                    }
                    , italian     = [gli]{Esempi}[gli]{Esempi}
                    , portuguese  = [os]{Exemplos}[os]{Exemplos}
                    , brazilian   = [os]{Exemplos}[os]{Exemplos}
                    , spanish     = [los]{Ejemplos}[los]{Ejemplos}
                    , schinese    = {例}{例}
                    , tchinese    = {例}{例}
                    , japanese    = {例}{例}
                    , russian     = {Примеры}{Примеры}
                  }
    , Crefname =  {
                    , english     = {Examples}{Examples}
                    , french      = [Les]{Exemples}[Les]{Exemples}
                    , ngerman     = { {Beispiele}{Beispiele}
                                      , Nominativ = [Die]{Beispiele}[Die]{Beispiele}
                                      , Genitiv   = [Der]{Beispiele}[Der]{Beispiele}
                                      , Dativ     = [Den]{Beispielen}[Den]{Beispielen}
                                      , Akkusativ = [Die]{Beispiele}[Die]{Beispiele}
                                    }
                    , italian     = [Gli]{Esempi}[Gli]{Esempi}
                    , portuguese  = [Os]{Exemplos}[Os]{Exemplos}
                    , brazilian   = [Os]{Exemplos}[Os]{Exemplos}
                    , spanish     = [Los]{Ejemplos}[Los]{Ejemplos}
                    , schinese    = {例}{例}
                    , tchinese    = {例}{例}
                    , japanese    = {例}{例}
                    , russian     = {Примеры}{Примеры}
                  }
  }

\NameTheorem { exercises }
  {
    , heading =   {
                    , english     = Exercises
                    , french      = Exercices
                    , ngerman     = ÜBungen
                    , italian     = Esercizi
                    , portuguese  = Exercícios
                    , brazilian   = Exercícios
                    , spanish     = Ejercicios
                    , schinese    = 习题
                    , tchinese    = 習題
                    , japanese    = 練習
                    , russian     = Упражнения
                  }
    , crefname =  {
                    , english     = {Exercises}{Exercises}
                    , french      = [les]{Exercices}[les]{Exercices}
                    , ngerman     = { {Übungen}{Übungen}
                                      , Nominativ = [die]{Übungen}[die]{Übungen}
                                      , Genitiv   = [der]{Übungen}[der]{Übungen}
                                      , Dativ     = [den]{Übungen}[den]{Übungen}
                                      , Akkusativ = [die]{Übungen}[die]{Übungen}
                                    }
                    , italian     = [gli]{Esercizi}[gli]{Esercizi}
                    , portuguese  = [os]{Exercícios}[os]{Exercícios}
                    , brazilian   = [os]{Exercícios}[os]{Exercícios}
                    , spanish     = [los]{Ejercicios}[los]{Ejercicios}
                    , schinese    = {习题}{习题}
                    , tchinese    = {習題}{習題}
                    , japanese    = {練習}{練習}
                    , russian     = {Упражнения}{Упражнения}
                  }
    , Crefname =  {
                    , english     = {Exercises}{Exercises}
                    , french      = [Les]{Exercices}[Les]{Exercices}
                    , ngerman     = { {Übungen}{Übungen}
                                      , Nominativ = [Die]{Übungen}[Die]{Übungen}
                                      , Genitiv   = [Der]{Übungen}[Der]{Übungen}
                                      , Dativ     = [Den]{Übungen}[Den]{Übungen}
                                      , Akkusativ = [Die]{Übungen}[Die]{Übungen}
                                    }
                    , italian     = [Gli]{Esercizi}[Gli]{Esercizi}
                    , portuguese  = [Os]{Exercícios}[Os]{Exercícios}
                    , brazilian   = [Os]{Exercícios}[Os]{Exercícios}
                    , spanish     = [Los]{Ejercicios}[Los]{Ejercicios}
                    , schinese    = {习题}{习题}
                    , tchinese    = {習題}{習題}
                    , japanese    = {練習}{練習}
                    , russian     = {Упражнения}{Упражнения}
                  }
  }

\NameTheorem { facts }
  {
    , heading =   {
                    , english     = Facts
                    , french      = Faits
                    , ngerman     = Tatsachen
                    , italian     = Fatti
                    , portuguese  = Factos
                    , brazilian   = Fatos
                    , spanish     = Hechos
                    , schinese    = 事实
                    , tchinese    = 事實
                    , japanese    = 事実
                    , russian     = Факты
                  }
    , crefname =  {
                    , english     = {Facts}{Facts}
                    , french      = [les]{Faits}[les]{Faits}
                    , ngerman     = { {Tatsachen}{Tatsachen}
                                      , Nominativ = [die]{Tatsachen}[die]{Tatsachen}
                                      , Genitiv   = [der]{Tatsachen}[der]{Tatsachen}
                                      , Dativ     = [den]{Tatsachen}[den]{Tatsachen}
                                      , Akkusativ = [die]{Tatsachen}[die]{Tatsachen}
                                    }
                    , italian     = [i]{Fatti}[i]{Fatti}
                    , portuguese  = [os]{Factos}[os]{Factos}
                    , brazilian   = [os]{Fatos}[os]{Fatos}
                    , spanish     = [los]{Hechos}[los]{Hechos}
                    , schinese    = {事实}{事实}
                    , tchinese    = {事實}{事實}
                    , japanese    = {事実}{事実}
                    , russian     = {Факты}{Факты}
                  }
    , Crefname =  {
                    , english     = {Facts}{Facts}
                    , french      = [Les]{Faits}[Les]{Faits}
                    , ngerman     = { {Tatsachen}{Tatsachen}
                                      , Nominativ = [Die]{Tatsachen}[Die]{Tatsachen}
                                      , Genitiv   = [Der]{Tatsachen}[Der]{Tatsachen}
                                      , Dativ     = [Den]{Tatsachen}[Den]{Tatsachen}
                                      , Akkusativ = [Die]{Tatsachen}[Die]{Tatsachen}
                                    }
                    , italian     = [I]{Fatti}[I]{Fatti}
                    , portuguese  = [Os]{Factos}[Os]{Factos}
                    , brazilian   = [Os]{Fatos}[Os]{Fatos}
                    , spanish     = [Los]{Hechos}[Los]{Hechos}
                    , schinese    = {事实}{事实}
                    , tchinese    = {事實}{事實}
                    , japanese    = {事実}{事実}
                    , russian     = {Факты}{Факты}
                  }
  }

\NameTheorem { hypotheses }
  {
    , heading =   {
                    , english     = Hypotheses
                    , french      = Hypothèses
                    , ngerman     = Hypothesen
                    , italian     = Ipotesi
                    , portuguese  = Hipóteses
                    , brazilian   = Hipóteses
                    , spanish     = Hipótesis
                    , schinese    = 假设
                    , tchinese    = 假設
                    , japanese    = 仮設
                    , russian     = Гипотезы
                  }
    , crefname =  {
                    , english     = {Hypotheses}{Hypotheses}
                    , french      = [les]{Hypothèses}[les]{Hypothèses}
                    , ngerman     = { {Hypothesen}{Hypothesen}
                                      , Nominativ = [die]{Hypothesen}[die]{Hypothesen}
                                      , Genitiv   = [der]{Hypothesen}[der]{Hypothesen}
                                      , Dativ     = [den]{Hypothesen}[den]{Hypothesen}
                                      , Akkusativ = [die]{Hypothesen}[die]{Hypothesen}
                                    }
                    , italian     = [le]{Ipotesi}[le]{Ipotesi}
                    , portuguese  = [as]{Hipóteses}[as]{Hipóteses}
                    , brazilian   = [as]{Hipóteses}[as]{Hipóteses}
                    , spanish     = [las]{Hipótesis}[las]{Hipótesis}
                    , schinese    = {假设}{假设}
                    , tchinese    = {假設}{假設}
                    , japanese    = {仮設}{仮設}
                    , russian     = {Гипотезы}{Гипотезы}
                  }
    , Crefname =  {
                    , english     = {Hypotheses}{Hypotheses}
                    , french      = [Les]{Hypothèses}[Les]{Hypothèses}
                    , ngerman     = { {Hypothesen}{Hypothesen}
                                      , Nominativ = [Die]{Hypothesen}[Die]{Hypothesen}
                                      , Genitiv   = [Der]{Hypothesen}[Der]{Hypothesen}
                                      , Dativ     = [Den]{Hypothesen}[Den]{Hypothesen}
                                      , Akkusativ = [Die]{Hypothesen}[Die]{Hypothesen}
                                    }
                    , italian     = [Le]{Ipotesi}[Le]{Ipotesi}
                    , portuguese  = [As]{Hipóteses}[As]{Hipóteses}
                    , brazilian   = [As]{Hipóteses}[As]{Hipóteses}
                    , spanish     = [Las]{Hipótesis}[Las]{Hipótesis}
                    , schinese    = {假设}{假设}
                    , tchinese    = {假設}{假設}
                    , japanese    = {仮設}{仮設}
                    , russian     = {Гипотезы}{Гипотезы}
                  }
  }

\NameTheorem { lemmas }
  {
    , heading   = {
                    , english     = Lemmas
                    , french      = Lemmes
                    , ngerman     = Lemmata
                    , italian     = Lemmi
                    , portuguese  = Lemas
                    , brazilian   = Lemas
                    , spanish     = Lemas
                    , schinese    = 引理
                    , tchinese    = 引理
                    , japanese    = 補題
                    , russian     = Леммы
                  }
    , crefname  = {
                    , english     = {Lemmas}{Lemmas}
                    , french      = [les]{Lemmes}[les]{Lemmes}
                    , ngerman     = { {Lemmata}{Lemmata}
                                      , Nominativ = [die]{Lemmata}[die]{Lemmata}
                                      , Genitiv   = [der]{Lemmata}[der]{Lemmata}
                                      , Dativ     = [den]{Lemmata}[den]{Lemmata}
                                      , Akkusativ = [die]{Lemmata}[die]{Lemmata}
                                    }
                    , italian     = [i]{Lemmi}[i]{Lemmi}
                    , portuguese  = [os]{Lemas}[os]{Lemas}
                    , brazilian   = [os]{Lemas}[os]{Lemas}
                    , spanish     = [las]{Lemas}[las]{Lemas}
                    , schinese    = {引理}{引理}
                    , tchinese    = {引理}{引理}
                    , japanese    = {補題}{補題}
                    , russian     = {Леммы}{Леммы}
                  }
    , Crefname  = {
                    , english     = {Lemmas}{Lemmas}
                    , french      = [Les]{Lemmes}[Les]{Lemmes}
                    , ngerman     = { {Lemmata}{Lemmata}
                                      , Nominativ = [Die]{Lemmata}[Die]{Lemmata}
                                      , Genitiv   = [Der]{Lemmata}[Der]{Lemmata}
                                      , Dativ     = [Den]{Lemmata}[Den]{Lemmata}
                                      , Akkusativ = [Die]{Lemmata}[Die]{Lemmata}
                                    }
                    , italian     = [I]{Lemmi}[I]{Lemmi}
                    , portuguese  = [Os]{Lemas}[Os]{Lemas}
                    , brazilian   = [Os]{Lemas}[Os]{Lemas}
                    , spanish     = [las]{Lemas}[las]{Lemas}
                    , schinese    = {引理}{引理}
                    , tchinese    = {引理}{引理}
                    , japanese    = {補題}{補題}
                    , russian     = {Леммы}{Леммы}
                  }
  }

\NameTheorem { motivations }
  {
    , heading =   {
                    , english     = Motivations
                    , french      = Motivations
                    , ngerman     = Motivationen
                    , italian     = Motivazioni
                    , portuguese  = Motivações
                    , brazilian   = Motivações
                    , spanish     = Motivaciones
                    , schinese    = 动机
                    , tchinese    = 動機
                    , japanese    = 動機
                    , russian     = Мотивации
                  }
    , crefname =  {
                    , english     = {Motivations}{Motivations}
                    , french      = [les]{Motivations}[les]{Motivations}
                    , ngerman     = { {Motivationen}{Motivationen}
                                      , Nominativ = [die]{Motivationen}[die]{Motivationen}
                                      , Genitiv   = [der]{Motivationen}[der]{Motivationen}
                                      , Dativ     = [den]{Motivationen}[den]{Motivationen}
                                      , Akkusativ = [die]{Motivationen}[die]{Motivationen}
                                    }
                    , italian     = [le]{Motivazioni}[le]{Motivazioni}
                    , portuguese  = [as]{Motivações}[as]{Motivações}
                    , brazilian   = [as]{Motivações}[as]{Motivações}
                    , spanish     = [las]{Motivaciones}[las]{Motivaciones}
                    , schinese    = {动机}{动机}
                    , tchinese    = {動機}{動機}
                    , japanese    = {動機}{動機}
                    , russian     = {Мотивации}{Мотивации}
                  }
    , Crefname =  {
                    , english     = {Motivations}{Motivations}
                    , french      = [Les]{Motivations}[Les]{Motivations}
                    , ngerman     = { {Motivationen}{Motivationen}
                                      , Nominativ = [Die]{Motivationen}[Die]{Motivationen}
                                      , Genitiv   = [Der]{Motivationen}[Der]{Motivationen}
                                      , Dativ     = [Den]{Motivationen}[Den]{Motivationen}
                                      , Akkusativ = [Die]{Motivationen}[Die]{Motivationen}
                                    }
                    , italian     = [Le]{Motivazioni}[Le]{Motivazioni}
                    , portuguese  = [As]{Motivações}[As]{Motivações}
                    , brazilian   = [As]{Motivações}[As]{Motivações}
                    , spanish     = [Las]{Motivaciones}[Las]{Motivaciones}
                    , schinese    = {动机}{动机}
                    , tchinese    = {動機}{動機}
                    , japanese    = {動機}{動機}
                    , russian     = {Мотивации}{Мотивации}
                  }
  }

\NameTheorem { notations }
  {
    , heading =   {
                    , english     = Notations
                    , french      = Notations
                    , ngerman     = Notationen
                    , italian     = Notazioni
                    , portuguese  = Notações
                    , brazilian   = Notações
                    , spanish     = Notaciones
                    , schinese    = 记号
                    , tchinese    = 記號
                    , japanese    = 記法
                    , russian     = Нотации
                  }
    , crefname =  {
                    , english     = {Notations}{Notations}
                    , french      = [les]{Notations}[les]{Notations}
                    , ngerman     = { {Notationen}{Notationen}
                                      , Nominativ = [die]{Notationen}[die]{Notationen}
                                      , Genitiv   = [der]{Notationen}[der]{Notationen}
                                      , Dativ     = [den]{Notationen}[den]{Notationen}
                                      , Akkusativ = [die]{Notationen}[die]{Notationen}
                                    }
                    , italian     = [le]{Notazioni}[le]{Notazioni}
                    , portuguese  = [as]{Notações}[as]{Notações}
                    , brazilian   = [as]{Notações}[as]{Notações}
                    , spanish     = [las]{Notaciones}[las]{Notaciones}
                    , schinese    = {记号}{记号}
                    , tchinese    = {記號}{記號}
                    , japanese    = {記法}{記法}
                    , russian     = {Нотации}{Нотации}
                  }
    , Crefname =  {
                    , english     = {Notations}{Notations}
                    , french      = [Les]{Notations}[Les]{Notations}
                    , ngerman     = { {Notationen}{Notationen}
                                      , Nominativ = [Die]{Notationen}[Die]{Notationen}
                                      , Genitiv   = [Der]{Notationen}[Der]{Notationen}
                                      , Dativ     = [Den]{Notationen}[Den]{Notationen}
                                      , Akkusativ = [Die]{Notationen}[Die]{Notationen}
                                    }
                    , italian     = [Le]{Notazioni}[Le]{Notazioni}
                    , portuguese  = [As]{Notações}[As]{Notações}
                    , brazilian   = [As]{Notações}[As]{Notações}
                    , spanish     = [Las]{Notaciones}[Las]{Notaciones}
                    , schinese    = {记号}{记号}
                    , tchinese    = {記號}{記號}
                    , japanese    = {記法}{記法}
                    , russian     = {Нотации}{Нотации}
                  }
  }

\NameTheorem { observations }
  {
    , heading =   {
                    , english     = Observations
                    , french      = Observations
                    , ngerman     = Beobachtungen
                    , italian     = Osservazioni
                    , portuguese  = Observações
                    , brazilian   = Observações
                    , spanish     = Observaciones
                    , schinese    = 观察
                    , tchinese    = 觀察
                    , japanese    = 観察
                    , russian     = Наблюдения
                  }
    , crefname =  {
                    , english     = {Observations}{Observations}
                    , french      = [les]{Observations}[les]{Observations}
                    , ngerman     = { {Beobachtungen}{Beobachtungen}
                                      , Nominativ = [die]{Beobachtungen}[die]{Beobachtungen}
                                      , Genitiv   = [der]{Beobachtungen}[der]{Beobachtungen}
                                      , Dativ     = [den]{Beobachtungen}[den]{Beobachtungen}
                                      , Akkusativ = [die]{Beobachtungen}[die]{Beobachtungen}
                                    }
                    , italian     = [le]{Osservazioni}[le]{Osservazioni}
                    , portuguese  = [as]{Observações}[as]{Observações}
                    , brazilian   = [as]{Observações}[as]{Observações}
                    , spanish     = [las]{Observaciones}[las]{Observaciones}
                    , schinese    = {观察}{观察}
                    , tchinese    = {觀察}{觀察}
                    , japanese    = {観察}{観察}
                    , russian     = {Наблюдения}{Наблюдения}
                  }
    , Crefname =  {
                    , english     = {Observations}{Observations}
                    , french      = [Les]{Observations}[Les]{Observations}
                    , ngerman     = { {Beobachtungen}{Beobachtungen}
                                      , Nominativ = [Die]{Beobachtungen}[Die]{Beobachtungen}
                                      , Genitiv   = [Der]{Beobachtungen}[Der]{Beobachtungen}
                                      , Dativ     = [Den]{Beobachtungen}[Den]{Beobachtungen}
                                      , Akkusativ = [Die]{Beobachtungen}[Die]{Beobachtungen}
                                    }
                    , italian     = [Le]{Osservazioni}[Le]{Osservazioni}
                    , portuguese  = [As]{Observações}[As]{Observações}
                    , brazilian   = [As]{Observações}[As]{Observações}
                    , spanish     = [Las]{Observaciones}[Las]{Observaciones}
                    , schinese    = {观察}{观察}
                    , tchinese    = {觀察}{觀察}
                    , japanese    = {観察}{観察}
                    , russian     = {Наблюдения}{Наблюдения}
                  }
  }

\NameTheorem { postulates }
  {
    , heading =   {
                    , english     = Postulates
                    , french      = Postulats
                    , ngerman     = Postulate
                    , italian     = Postulati
                    , portuguese  = Postulados
                    , brazilian   = Postulados
                    , spanish     = Postulados
                    , schinese    = 公设
                    , tchinese    = 公設
                    , japanese    = 公準
                    , russian     = Постулаты
                  }
    , crefname =  {
                    , english     = {Postulates}{Postulates}
                    , french      = [les]{Postulats}[les]{Postulats}
                    , ngerman     = { {Postulate}{Postulate}
                                      , Nominativ = [die]{Postulate}[die]{Postulate}
                                      , Genitiv   = [der]{Postulate}[der]{Postulate}
                                      , Dativ     = [den]{Postulaten}[den]{Postulaten}
                                      , Akkusativ = [die]{Postulate}[die]{Postulate}
                                    }
                    , italian     = [i]{Postulati}[i]{Postulati}
                    , portuguese  = [os]{Postulados}[os]{Postulados}
                    , brazilian   = [os]{Postulados}[os]{Postulados}
                    , spanish     = [los]{Postulados}[los]{Postulados}
                    , schinese    = {公设}{公设}
                    , tchinese    = {公設}{公設}
                    , japanese    = {公準}{公準}
                    , russian     = {Постулаты}{Постулаты}
                  }
    , Crefname =  {
                    , english     = {Postulates}{Postulates}
                    , french      = [Les]{Postulats}[Les]{Postulats}
                    , ngerman     = { {Postulate}{Postulate}
                                      , Nominativ = [Die]{Postulate}[Die]{Postulate}
                                      , Genitiv   = [Der]{Postulate}[Der]{Postulate}
                                      , Dativ     = [Den]{Postulaten}[Den]{Postulaten}
                                      , Akkusativ = [Die]{Postulate}[Die]{Postulate}
                                    }
                    , italian     = [I]{Postulati}[I]{Postulati}
                    , portuguese  = [Os]{Postulados}[Os]{Postulados}
                    , brazilian   = [Os]{Postulados}[Os]{Postulados}
                    , spanish     = [Los]{Postulados}[Los]{Postulados}
                    , schinese    = {公设}{公设}
                    , tchinese    = {公設}{公設}
                    , japanese    = {公準}{公準}
                    , russian     = {Постулаты}{Постулаты}
                  }
  }

\NameTheorem { problems }
  {
    , heading =   {
                    , english     = Problems
                    , french      = Problèmes
                    , ngerman     = Probleme
                    , italian     = Problemi
                    , portuguese  = Problemas
                    , brazilian   = Problemas
                    , spanish     = Problemas
                    , schinese    = 问题
                    , tchinese    = 問題
                    , japanese    = 問題
                    , russian     = Проблемы
                  }
    , crefname =  {
                    , english     = {Problems}{Problems}
                    , french      = [les]{Problèmes}[les]{Problèmes}
                    , ngerman     = { {Probleme}{Probleme}
                                      , Nominativ = [die]{Probleme}[die]{Probleme}
                                      , Genitiv   = [der]{Probleme}[der]{Probleme}
                                      , Dativ     = [den]{Problemen}[den]{Problemen}
                                      , Akkusativ = [die]{Probleme}[die]{Probleme}
                                    }
                    , italian     = [i]{Problemi}[i]{Problemi}
                    , portuguese  = [os]{Problemas}[os]{Problemas}
                    , brazilian   = [os]{Problemas}[os]{Problemas}
                    , spanish     = [los]{Problemas}[los]{Problemas}
                    , schinese    = {问题}{问题}
                    , tchinese    = {問題}{問題}
                    , japanese    = {問題}{問題}
                    , russian     = {Проблемы}{Проблемы}
                  }
    , Crefname =  {
                    , english     = {Problems}{Problems}
                    , french      = [Les]{Problèmes}[Les]{Problèmes}
                    , ngerman     = { {Probleme}{Probleme}
                                      , Nominativ = [Die]{Probleme}[Die]{Probleme}
                                      , Genitiv   = [Der]{Probleme}[Der]{Probleme}
                                      , Dativ     = [Den]{Problemen}[Den]{Problemen}
                                      , Akkusativ = [Die]{Probleme}[Die]{Probleme}
                                    }
                    , italian     = [I]{Problemi}[I]{Problemi}
                    , portuguese  = [Os]{Problemas}[Os]{Problemas}
                    , brazilian   = [Os]{Problemas}[Os]{Problemas}
                    , spanish     = [Los]{Problemas}[Los]{Problemas}
                    , schinese    = {问题}{问题}
                    , tchinese    = {問題}{問題}
                    , japanese    = {問題}{問題}
                    , russian     = {Проблемы}{Проблемы}
                  }
  }

\NameTheorem { properties }
  {
    , heading =   {
                    , english     = Properties
                    , french      = Propriétés
                    , ngerman     = Eigenschaften
                    , italian     = Proprietà
                    , portuguese  = Propriedades
                    , brazilian   = Propriedades
                    , spanish     = Propiedades
                    , schinese    = 性质
                    , tchinese    = 性質
                    , japanese    = 性質
                    , russian     = Имущества
                  }
    , crefname =  {
                    , english     = {Properties}{Properties}
                    , french      = [les]{Propriétés}[les]{Propriétés}
                    , ngerman     = { {Eigenschaften}{Eigenschaften}
                                      , Nominativ = [die]{Eigenschaften}[die]{Eigenschaften}
                                      , Genitiv   = [der]{Eigenschaften}[der]{Eigenschaften}
                                      , Dativ     = [den]{Eigenschaften}[den]{Eigenschaften}
                                      , Akkusativ = [die]{Eigenschaften}[die]{Eigenschaften}
                                    }
                    , italian     = [le]{Proprietà}[le]{Proprietà}
                    , portuguese  = [as]{Propriedades}[as]{Propriedades}
                    , brazilian   = [as]{Propriedades}[as]{Propriedades}
                    , spanish     = [las]{Propiedades}[las]{Propiedades}
                    , schinese    = {性质}{性质}
                    , tchinese    = {性質}{性質}
                    , japanese    = {性質}{性質}
                    , russian     = {Имущества}{Имущества}
                  }
    , Crefname =  {
                    , english     = {Properties}{Properties}
                    , french      = [Les]{Propriétés}[Les]{Propriétés}
                    , ngerman     = { {Eigenschaften}{Eigenschaften}
                                      , Nominativ = [Die]{Eigenschaften}[Die]{Eigenschaften}
                                      , Genitiv   = [Der]{Eigenschaften}[Der]{Eigenschaften}
                                      , Dativ     = [Den]{Eigenschaften}[Den]{Eigenschaften}
                                      , Akkusativ = [Die]{Eigenschaften}[Die]{Eigenschaften}
                                    }
                    , italian     = [Le]{Proprietà}[Le]{Proprietà}
                    , portuguese  = [As]{Propriedades}[As]{Propriedades}
                    , brazilian   = [As]{Propriedades}[As]{Propriedades}
                    , spanish     = [Las]{Propiedades}[Las]{Propiedades}
                    , schinese    = {性质}{性质}
                    , tchinese    = {性質}{性質}
                    , japanese    = {性質}{性質}
                    , russian     = {Имущества}{Имущества}
                  }
  }

\NameTheorem { propositions }
  {
    , heading =   {
                    , english     = Propositions
                    , french      = Propositions
                    , ngerman     = Propositionen
                    , italian     = Proposte
                    , portuguese  = Proposições
                    , brazilian   = Proposições
                    , spanish     = Proposiciones
                    , schinese    = 命题
                    , tchinese    = 命題
                    , japanese    = 命題
                    , russian     = Предложения
                  }
    , crefname =  {
                    , english     = {Propositions}{Propositions}
                    , french      = [les]{Propositions}[les]{Propositions}
                    , ngerman     = { {Propositionen}{Propositionen}
                                      , Nominativ = [die]{Propositionen}[die]{Propositionen}
                                      , Genitiv   = [der]{Propositionen}[der]{Propositionen}
                                      , Dativ     = [den]{Propositionen}[den]{Propositionen}
                                      , Akkusativ = [die]{Propositionen}[die]{Propositionen}
                                    }
                    , italian     = [le]{Proposte}[le]{Proposte}
                    , portuguese  = [as]{Proposições}[as]{Proposições}
                    , brazilian   = [as]{Proposições}[as]{Proposições}
                    , spanish     = [las]{Proposiciones}[las]{Proposiciones}
                    , schinese    = {命题}{命题}
                    , tchinese    = {命題}{命題}
                    , japanese    = {命題}{命題}
                    , russian     = {Предложения}{Предложения}
                  }
    , Crefname =  {
                    , english     = {Propositions}{Propositions}
                    , french      = [Les]{Propositions}[Les]{Propositions}
                    , ngerman     = { {Propositionen}{Propositionen}
                                      , Nominativ = [Die]{Propositionen}[Die]{Propositionen}
                                      , Genitiv   = [Der]{Propositionen}[Der]{Propositionen}
                                      , Dativ     = [Den]{Propositionen}[Den]{Propositionen}
                                      , Akkusativ = [Die]{Propositionen}[Die]{Propositionen}
                                    }
                    , italian     = [Le]{Proposte}[Le]{Proposte}
                    , portuguese  = [As]{Proposições}[As]{Proposições}
                    , brazilian   = [As]{Proposições}[As]{Proposições}
                    , spanish     = [Las]{Proposiciones}[Las]{Proposiciones}
                    , schinese    = {命题}{命题}
                    , tchinese    = {命題}{命題}
                    , japanese    = {命題}{命題}
                    , russian     = {Предложения}{Предложения}
                  }
  }

\NameTheorem { questions }
  {
    , heading =   {
                    , english     = Questions
                    , french      = Questions
                    , ngerman     = Fragen
                    , italian     = Domande
                    , portuguese  = Perguntas
                    , brazilian   = Perguntas
                    , spanish     = Preguntas
                    , schinese    = 问题
                    , tchinese    = 問題
                    , japanese    = 問題
                    , russian     = Вопросы
                  }
    , crefname =  {
                    , english     = {Questions}{Questions}
                    , french      = [les]{Questions}[les]{Questions}
                    , ngerman     = { {Fragen}{Fragen}
                                      , Nominativ = [die]{Fragen}[die]{Fragen}
                                      , Genitiv   = [der]{Fragen}[der]{Fragen}
                                      , Dativ     = [den]{Fragen}[den]{Fragen}
                                      , Akkusativ = [die]{Fragen}[die]{Fragen}
                                    }
                    , italian     = [le]{Domande}[le]{Domande}
                    , portuguese  = [as]{Perguntas}[as]{Perguntas}
                    , brazilian   = [as]{Perguntas}[as]{Perguntas}
                    , spanish     = [las]{Preguntas}[las]{Preguntas}
                    , schinese    = {问题}{问题}
                    , tchinese    = {問題}{問題}
                    , japanese    = {問題}{問題}
                    , russian     = {Вопросы}{Вопросы}
                  }
    , Crefname =  {
                    , english     = {Questions}{Questions}
                    , french      = [Les]{Questions}[Les]{Questions}
                    , ngerman     = { {Fragen}{Fragen}
                                      , Nominativ = [Die]{Fragen}[Die]{Fragen}
                                      , Genitiv   = [Der]{Fragen}[Der]{Fragen}
                                      , Dativ     = [Den]{Fragen}[Den]{Fragen}
                                      , Akkusativ = [Die]{Fragen}[Die]{Fragen}
                                    }
                    , italian     = [Le]{Domande}[Le]{Domande}
                    , portuguese  = [As]{Perguntas}[As]{Perguntas}
                    , brazilian   = [As]{Perguntas}[As]{Perguntas}
                    , spanish     = [Las]{Preguntas}[Las]{Preguntas}
                    , schinese    = {问题}{问题}
                    , tchinese    = {問題}{問題}
                    , japanese    = {問題}{問題}
                    , russian     = {Вопросы}{Вопросы}
                  }
  }

\NameTheorem { recalls }
  {
    , heading =   {
                    , english     = Recalls
                    , french      = Rappels
                    , ngerman     = Erinnerungen
                    , italian     = Richiami
                    , portuguese  = Recordações
                    , brazilian   = Recordações
                    , spanish     = Recuerdos
                    , schinese    = 回顾
                    , tchinese    = 回顧
                    , japanese    = 回顧
                    , russian     = Напоминания
                  }
    , crefname =  {
                    , english     = {Recalls}{Recalls}
                    , french      = [les]{Rappels}[les]{Rappels}
                    , ngerman     = { {Erinnerungen}{Erinnerungen}
                                      , Nominativ = [die]{Erinnerungen}[die]{Erinnerungen}
                                      , Genitiv   = [der]{Erinnerungen}[der]{Erinnerungen}
                                      , Dativ     = [den]{Erinnerungen}[den]{Erinnerungen}
                                      , Akkusativ = [die]{Erinnerungen}[die]{Erinnerungen}
                                    }
                    , italian     = [i]{Richiami}[i]{Richiami}
                    , portuguese  = [as]{Recordações}[as]{Recordações}
                    , brazilian   = [as]{Recordações}[as]{Recordações}
                    , spanish     = [los]{Recuerdos}[los]{Recuerdos}
                    , schinese    = {回顾}{回顾}
                    , tchinese    = {回顧}{回顧}
                    , japanese    = {回顧}{回顧}
                    , russian     = {Напоминания}{Напоминания}
                  }
    , Crefname =  {
                    , english     = {Recalls}{Recalls}
                    , french      = [Les]{Rappels}[Les]{Rappels}
                    , ngerman     = { {Erinnerungen}{Erinnerungen}
                                      , Nominativ = [Die]{Erinnerungen}[Die]{Erinnerungen}
                                      , Genitiv   = [Der]{Erinnerungen}[Der]{Erinnerungen}
                                      , Dativ     = [Den]{Erinnerungen}[Den]{Erinnerungen}
                                      , Akkusativ = [Die]{Erinnerungen}[Die]{Erinnerungen}
                                    }
                    , italian     = [I]{Richiami}[I]{Richiami}
                    , portuguese  = [As]{Recordações}[As]{Recordações}
                    , brazilian   = [As]{Recordações}[As]{Recordações}
                    , spanish     = [Los]{Recuerdos}[Los]{Recuerdos}
                    , schinese    = {回顾}{回顾}
                    , tchinese    = {回顧}{回顧}
                    , japanese    = {回顧}{回顧}
                    , russian     = {Напоминания}{Напоминания}
                  }
  }

\NameTheorem { remarks }
  {
    , heading =   {
                    , english     = Remarks
                    , french      = Remarques
                    , ngerman     = Bemerkungen
                    , italian     = Commenti
                    , portuguese  = Comentários
                    , brazilian   = Comentários
                    , spanish     = Comentarios
                    , schinese    = 备注
                    , tchinese    = 備註
                    , japanese    = 注釈
                    , russian     = Замечания
                  }
    , crefname =  {
                    , english     = {Remarks}{Remarks}
                    , french      = [les]{Remarques}[les]{Remarques}
                    , ngerman     = { {Bemerkungen}{Bemerkungen}
                                      , Nominativ = [die]{Bemerkungen}[die]{Bemerkungen}
                                      , Genitiv   = [der]{Bemerkungen}[der]{Bemerkungen}
                                      , Dativ     = [den]{Bemerkungen}[den]{Bemerkungen}
                                      , Akkusativ = [die]{Bemerkungen}[die]{Bemerkungen}
                                    }
                    , italian     = [i]{Commenti}[i]{Commenti}
                    , portuguese  = [os]{Comentários}[os]{Comentários}
                    , brazilian   = [os]{Comentários}[os]{Comentários}
                    , spanish     = [los]{Comentarios}[los]{Comentarios}
                    , schinese    = {备注}{备注}
                    , tchinese    = {備註}{備註}
                    , japanese    = {注釈}{注釈}
                    , russian     = {Замечания}{Замечания}
                  }
    , Crefname =  {
                    , english     = {Remarks}{Remarks}
                    , french      = [Les]{Remarques}[Les]{Remarques}
                    , ngerman     = { {Bemerkungen}{Bemerkungen}
                                      , Nominativ = [Die]{Bemerkungen}[Die]{Bemerkungen}
                                      , Genitiv   = [Der]{Bemerkungen}[Der]{Bemerkungen}
                                      , Dativ     = [Den]{Bemerkungen}[Den]{Bemerkungen}
                                      , Akkusativ = [Die]{Bemerkungen}[Die]{Bemerkungen}
                                    }
                    , italian     = [I]{Commenti}[I]{Commenti}
                    , portuguese  = [Os]{Comentários}[Os]{Comentários}
                    , brazilian   = [Os]{Comentários}[Os]{Comentários}
                    , spanish     = [Los]{Comentarios}[Los]{Comentarios}
                    , schinese    = {备注}{备注}
                    , tchinese    = {備註}{備註}
                    , japanese    = {注釈}{注釈}
                    , russian     = {Замечания}{Замечания}
                  }
  }

\NameTheorem { theorems }
  {
    , heading =   {
                    , english     = Theorems
                    , french      = Théorèmes
                    , ngerman     = Sätze
                    , italian     = Teoremi
                    , portuguese  = Teoremas
                    , brazilian   = Teoremas
                    , spanish     = Teoremas
                    , schinese    = 定理
                    , tchinese    = 定理
                    , japanese    = 定理
                    , russian     = Теоремы
                  }
    , crefname =  {
                    , english     = {Theorems}{Theorems}
                    , french      = [les]{Théorèmes}[les]{Théorèmes}
                    , ngerman     = { {Sätze}{Sätze}
                                      , Nominativ = [die]{Sätze}[die]{Sätze}
                                      , Genitiv   = [der]{Sätze}[der]{Sätze}
                                      , Dativ     = [den]{Sätzen}[den]{Sätzen}
                                      , Akkusativ = [die]{Sätze}[die]{Sätze}
                                    }
                    , italian     = [i]{Teoremi}[i]{Teoremi}
                    , portuguese  = [os]{Teoremas}[os]{Teoremas}
                    , brazilian   = [os]{Teoremas}[os]{Teoremas}
                    , spanish     = [los]{Teoremas}[los]{Teoremas}
                    , schinese    = {定理}{定理}
                    , tchinese    = {定理}{定理}
                    , japanese    = {定理}{定理}
                    , russian     = {Теоремы}{Теоремы}
                  }
    , Crefname =  {
                    , english     = {Theorems}{Theorems}
                    , french      = [Les]{Théorèmes}[Les]{Théorèmes}
                    , ngerman     = { {Sätze}{Sätze}
                                      , Nominativ = [Die]{Sätze}[Die]{Sätze}
                                      , Genitiv   = [Der]{Sätze}[Der]{Sätze}
                                      , Dativ     = [Den]{Sätzen}[Den]{Sätzen}
                                      , Akkusativ = [Die]{Sätze}[Die]{Sätze}
                                    }
                    , italian     = [I]{Teoremi}[I]{Teoremi}
                    , portuguese  = [Os]{Teoremas}[Os]{Teoremas}
                    , brazilian   = [Os]{Teoremas}[Os]{Teoremas}
                    , spanish     = [Los]{Teoremas}[Los]{Teoremas}
                    , schinese    = {定理}{定理}
                    , tchinese    = {定理}{定理}
                    , japanese    = {定理}{定理}
                    , russian     = {Теоремы}{Теоремы}
                  }
  }
%</projlib-theorem>
%
%<*projlib-titlepage>
\keys_define:nn { projlib-titlepage }
  {
    , unknown           .code:n             = {}
  }
\ProcessKeyOptions [ projlib-titlepage ]

\RequirePackage { projlib-logo }
\RequirePackage { projlib-paper }

\RequirePackage { tikz }
\ExplSyntaxOff
\usetikzlibrary { calc }
\ExplSyntaxOn

\tl_new:N \l_projlib_titlepage_title_page_name_tl
\tl_new:N \l_projlib_titlepage_license_page_name_tl
\tl_set:Nn \l_projlib_titlepage_title_page_name_tl   { Cover   }
\tl_set:Nn \l_projlib_titlepage_license_page_name_tl { License }

\tl_new:N \l_projlib_titlepage_logo_tl
\tl_new:N \l_projlib_titlepage_title_tl
\tl_new:N \l_projlib_titlepage_subtitle_tl
\tl_new:N \l_projlib_titlepage_author_tl
\tl_new:N \l_projlib_titlepage_info_tl
\tl_new:N \l_projlib_titlepage_license_tl
\tl_new:N \l_projlib_titlepage_date_tl
\tl_new:N \l_projlib_titlepage_style_tl

\NewDocumentCommand \ProjLibTitlePage { O{} m }
  {
    \keys_set:nn { projlib-titlepage-config } { #1 }
    \projlib_titlepage_render:n { #2 }
  }
\ProvideDocumentCommand \TitlePage { O{} m }
  {
    \ProjLibTitlePage [ #1 ] { #2 }
  }

\cs_new_protected:Nn \projlib_titlepage_set_color:nn
  {
    \colorlet { titlepage- #1 } { #2 }
  }

\keys_define:nn { projlib-titlepage-config }
  {
    , logo              .code:n             = { \tl_set:Nn \l_projlib_titlepage_logo_tl { \tl_trim_spaces:n { #1 } } }
    , logo              .initial:n          = { * }
    , title             .code:n             = { \tl_set:Nn \l_projlib_titlepage_title_tl { \tl_trim_spaces:n { #1 } } }
    , subtitle          .code:n             = { \tl_set:Nn \l_projlib_titlepage_subtitle_tl { \tl_trim_spaces:n { #1 } } }
    , author            .code:n             = { \tl_set:Nn \l_projlib_titlepage_author_tl { \tl_trim_spaces:n { #1 } } }
    , date              .code:n             = { \tl_set:Nn \l_projlib_titlepage_date_tl { \tl_trim_spaces:n { #1 } } }
    , title-page-name   .code:n             = { \tl_set:Nn \l_projlib_titlepage_title_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , title~page~name   .code:n             = { \tl_set:Nn \l_projlib_titlepage_title_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , title page name   .code:n             = { \tl_set:Nn \l_projlib_titlepage_title_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , license-page-name .code:n             = { \tl_set:Nn \l_projlib_titlepage_license_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , license~page~name .code:n             = { \tl_set:Nn \l_projlib_titlepage_license_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , license page name .code:n             = { \tl_set:Nn \l_projlib_titlepage_license_page_name_tl { \tl_trim_spaces:n { #1 } } }
    , info              .code:n             = { \tl_set:Nn \l_projlib_titlepage_info_tl { \tl_trim_spaces:n { #1 } } }
    , info              .initial:n          = { }
    , license           .code:n             = { \tl_set:Nn \l_projlib_titlepage_license_tl { \tl_trim_spaces:n { #1 } } }
    , license           .initial:n          = { }
    , style             .tl_set:N           = \l_projlib_titlepage_style_tl
    , style             .initial:n          = { default }
    , color             .code:n             = {
                                                \keyval_parse:nnn
                                                  { \use_none:n }
                                                  { \projlib_titlepage_set_color:nn }
                                                  { #1 }
                                              }
    , unknown           .code:n             = {}
  }

\colorlet { titlepage-main } { blue!50!cyan!50!black }
\colorlet { titlepage-back } { blue!50!cyan!15!yellow!25 }

\cs_new_protected:Nn \projlib_titlepage_show_logo:n
  {
    \tl_if_eq:NnTF \l_projlib_titlepage_logo_tl { \tl_trim_spaces:n { * } }
      {
        #1
      }
      {
        \tl_use:N \l_projlib_titlepage_logo_tl
      }
  }

\cs_new_protected:Nn \projlib_titlepage_render:n
  {
    \keys_set:nn { projlib-titlepage-config } { #1 }
    \tl_set_eq:NN \thepage \l_projlib_titlepage_title_page_name_tl
    \begin { titlepage }
      \cs_if_exist_use:c { projlib_titlepage_render_with_style_ \l_projlib_titlepage_style_tl : }
    \end   { titlepage }
    \tl_set_eq:NN \thepage \l_projlib_titlepage_license_page_name_tl
    \thispagestyle{empty}
    \null\vfill
    % \begin{flushleft}
    \group_begin:
      \noindent
      \tl_use:N \l_projlib_titlepage_info_tl
    \group_end:
    % \end{flushleft}
    \group_begin:
      \tl_use:N \l_projlib_titlepage_license_tl
    \group_end:
    \cleardoublepage
    \setcounter{page}{0}
    \pagenumbering{roman}
  }


\cs_new_protected:Nn \projlib_titlepage_render_with_style_default:
  {
    \begin{tikzpicture}[overlay,remember~picture]
      % \fill[color=white] ($(current~page.south~west)$) rectangle ($(current~page.north~east)$);
      \node[text~width=.3\paperwidth, text~height=.2\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.32\paperwidth,-.1\paperheight)$)
          {
            \projlib_titlepage_show_logo:n { \scalebox { 2 } { \ProjLib } }
          };
      \node[text~width=.8\paperwidth, text~height=.5\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.57\paperwidth,-.15\paperheight)$)
          {
            \sffamily
            \fontsize{24pt}{36pt}\selectfont
            \textsc{ \textbf{ \l_projlib_titlepage_title_tl } }\\[1.5em]
            \fontsize{18pt}{27pt}\selectfont
            \l_projlib_titlepage_subtitle_tl
          };
      % \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left]
        % at ($(current~page.south)+(.135\paperwidth,.35\paperheight)$)
      \node[text~width=.8\paperwidth, text~height=.4\paperheight, align=flush~left]
        at ($(current~page.south~west)+(.57\paperwidth,.45\paperheight)$)
          {
            % \color{.!50}
            % \begin{flushright}
              \fontsize{16pt}{24pt}\selectfont
              \textsc{ \l_projlib_titlepage_author_tl }\\[1em]
              \fontsize{12pt}{18pt}\selectfont
              \l_projlib_titlepage_date_tl
            % \end{flushright}
          };
    \end{tikzpicture}
  }

\cs_new_protected:Nn \projlib_titlepage_render_with_style_simple:
  {
    \begin{tikzpicture}[overlay,remember~picture]
      \fill[color=white] ($(current~page.south~west)$) rectangle ($(current~page.north~east)$);
      \fill[color=titlepage-main] ($(current~page.south~west)$) rectangle ($(current~page.north~east)+(0,-.3\paperheight)$);
      \node[text~width=.3\paperwidth, text~height=.2\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.28\paperwidth,-.15\paperheight)$)
          {
            \projlib_titlepage_show_logo:n { \scalebox { 2 } { \ProjLib } }
          };
      \node[text~width=.8\paperwidth, text~height=.5\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.53\paperwidth,-.28\paperheight)$)
          {
            \color{white}
            \sffamily
            \fontsize{24pt}{36pt}\selectfont
            \textsc{ \l_projlib_titlepage_title_tl }\\[1.5em]
            \fontsize{18pt}{27pt}\selectfont
            \l_projlib_titlepage_subtitle_tl
          };
      \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left]
        at ($(current~page.south)+(.135\paperwidth,.35\paperheight)$)
          {
            \color{white}
            \begin{flushright}
              \fontsize{16pt}{24pt}\selectfont
              \textsc{ \l_projlib_titlepage_author_tl }\\[1em]
              \fontsize{12pt}{18pt}\selectfont
              \l_projlib_titlepage_date_tl
            \end{flushright}
          };
    \end{tikzpicture}
  }

\cs_new_protected:Nn \projlib_titlepage_render_with_style_academic:
  {
    \begin{tikzpicture}[overlay,remember~picture]
      \fill[color=titlepage-main] ($(current~page.south~west)$) rectangle ($(current~page.north~east)$);
      \fill[color=white] ($(current~page.south~west)+(0,.3\paperheight)$) rectangle ($(current~page.north~east)+(0,-.3\paperheight)$);
      \node[text~width=.3\paperwidth, text~height=.2\paperheight, align=flush~center]
        at ($(current~page.north)+(0pt,-.15\paperheight)$)
          {
            \projlib_titlepage_show_logo:n { \color{white} \scalebox { 2 } { \ProjLibText } }
          };
      \node[text~width=.8\paperwidth, text~height=.5\paperheight, align=flush~center]
        at ($(current~page.north)+(0pt,-.25\paperheight)$)
          {
            \color{titlepage-main}
            \sffamily
            \fontsize{24pt}{36pt}\selectfont
            \textsc{ \l_projlib_titlepage_title_tl }\\[1.5em]
            \fontsize{18pt}{27pt}\selectfont
            \l_projlib_titlepage_subtitle_tl
          };
      \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~center]
        at ($(current~page.south)+(0pt,.36\paperheight)$)
          {
            \color{white}
            \fontsize{16pt}{24pt}\selectfont
            \textsc{ \l_projlib_titlepage_author_tl }\\[1em]
            \fontsize{12pt}{18pt}\selectfont
            \l_projlib_titlepage_date_tl
          };
    \end{tikzpicture}
  }

\cs_new_protected:Nn \projlib_titlepage_render_with_style_fancy:
  {
    \begin{tikzpicture}[overlay,remember~picture]
      \fill [color=titlepage-main] ($(current~page.south~west)$) rectangle ($(current~page.north~east)+(0,-.3\paperheight)$);
      \fill [color=titlepage-back] ($(current~page.south~west)$) rectangle ($(current~page.north~west)+(.125\paperwidth,-.3\paperheight)$);
      \fill [color=titlepage-main] ($(current~page.north~west)$) rectangle ($(current~page.north~west)+(.125\paperwidth,-.3\paperheight)$);
      \fill [color=titlepage-back] ($(current~page.north~east)$) rectangle ($(current~page.north~west)+(.125\paperwidth,-.3\paperheight)$);
      \node[text~width=.3\paperwidth, text~height=.2\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.333\paperwidth,-.17\paperheight)$)
          {
            \projlib_titlepage_show_logo:n { \scalebox { 2 } { \ProjLib } }
          };
      \node[text~width=.8\paperwidth, text~height=.5\paperheight, align=flush~left]
        at ($(current~page.north~west)+(.583\paperwidth,-.28\paperheight)$)
          {
            \color{titlepage-back}
            \sffamily
            \fontsize{24pt}{36pt}\selectfont
            \textsc{ \l_projlib_titlepage_title_tl }\\[1.5em]
            \fontsize{18pt}{27pt}\selectfont
            \l_projlib_titlepage_subtitle_tl
          };
      \node[text~width=.5\paperwidth, text~height=.4\paperheight, align=flush~left]
        at ($(current~page.south)+(.135\paperwidth,.35\paperheight)$)
          {
            \color{titlepage-back}
            \begin{flushright}
              \fontsize{16pt}{24pt}\selectfont
              \textsc{ \l_projlib_titlepage_author_tl }\\[1em]
              \fontsize{12pt}{18pt}\selectfont
              \l_projlib_titlepage_date_tl
            \end{flushright}
          };
    \end{tikzpicture}
  }
%</projlib-titlepage>

\endinput