%%
%% This is file `standardsectioning.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% standardsectioning.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from standardsectioning.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file standardsectioning.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
\ProvidesExplPackage{standardsectioning}
  {2024-06-06}{0.9}
  {%
    forcing standard class sectioning definitions%
  }
\msg_new:nnnn { standardsectioning } { wrong-package-order }
  {
    wrong~package~order~detected.
  }
  {
    You've~loaded~this~package~after~package~#1.\iow_newline:
    But~this~cannot~work.\iow_newline:
    Loading aborted!
  }

\msg_new:nnn { standardsectioning } { deactivate-extended-section-commands }
  {
    extended~sectioning~option~handling~deactivated.
  }

\msg_new:nnn { standardsectioning } { no-force-with-KOMA-Script-class }
  {
    package~option~`#1'~is~ignored~due~to~usage~of~KOMA-Script~class~\KOMAClassName.
  }
\@ifpackageloaded { hyperref }
  {
    \msg_critical:nnn { standardsectioning } { wrong-package-order }
                      { hyperref }
  } { }
\@ifpackageloaded { titlesec }
  {
    \msg_critical:nnn { standardsectioning } { wrong-package-order }
                      { titlesec }
  } { }
\@ifpackageloaded { sectsty }
  {
    \msg_critical:nnnn { standardsectioning } { wrong-package-order }
                       { sectsty }
  } { }
\cs_new:Nn \__standardsectioning_common_komascript_deactivation_code:
  {
    \RenewCommandCopy \@startsection \scr@saved@startsection
    \RenewCommandCopy\@sect\scr@latex@sect
    \RenewCommandCopy\@ssect\scr@latex@ssect
    \RenewCommandCopy\@xsect\scr@latex@xsect
    \cs_undefine:N \DeclareSectionCommand
    \cs_undefine:N \DeclareSectionCommands
    \cs_undefine:N \RedeclareSectionCommand
    \cs_undefine:N \RedeclareSectionCommands
    \cs_undefine:N \DeclareNewSectionCommand
    \cs_undefine:N \DeclareNewSectionCommands
    \cs_undefine:N \ProvideSectionCommand
    \cs_undefine:N \ProvideSectionCommands
    \cs_undefine:N \minisec
    \cs_gset_eq:NN \scr@chapter@before@hyperref@patch \relax
    \cs_gset_eq:NN \scr@chapter@after@hyperref@patch \relax
    \int_if_zero:nF { \scr@osectarg }
      {
        \msg_warning:nn { standardsectioning }
                        { deactivate-extended-section-commands }
        \cs_gset_eq:NN \scr@osectarg \c_zero_int
      }
    \renewcommand*{\scr@activate@xsection}[1]{%
      \int_if_zero:nF { ##1 }
        {
          \msg_warning:nn { standardsectioning }
                          { deactivate-extended-section-commands }
          \cs_gset_eq:NN \scr@osectarg \c_zero_int
        }
    }%
    \cs_undefine:N \partlineswithprefixformat
    \cs_undefine:N \sectionlinesformat
    \cs_undefine:N \sectioncatchphraseformat
    \RelaxFamilyKey[.\KOMAClassFileName]{KOMA}{headings}%
    \KOMA@kav@removekey{\KOMAClassFileName}{headings}%
    \cs_undefine:N \scr@class@titlesec@warning
  }
\cs_new:Nn \__standardsectioning_article_sectioning_code:
  {
    \def\part{%
      \if@noskipsec \leavevmode \fi
      \par
      \addvspace{4ex}%
      \@afterindentfalse
      \secdef\@part\@spart}%
    \def\@part[##1]##2{%
      \ifnum \c@secnumdepth >\m@ne
        \refstepcounter{part}%
        \addcontentsline{toc}{part}{\thepart\hspace{1em}##1}%
      \else
        \addcontentsline{toc}{part}{##1}%
      \fi
      {\parindent \z@ \raggedright
       \interlinepenalty \@M
       \normalfont
       \ifnum \c@secnumdepth >\m@ne
         \Large\bfseries \partname\nobreakspace\thepart
         \par\nobreak
       \fi
       \huge \bfseries ##2%
       \markboth{}{}\par}%
      \nobreak
      \vskip 3ex
      \@afterheading}%
    \def\@spart##1{%
      {\parindent \z@ \raggedright
        \interlinepenalty \@M
        \normalfont
        \huge \bfseries ##1\par}%
      \nobreak
      \vskip 3ex
      \@afterheading}%

    \def\section{\@startsection {section}{1}{\z@}%
                                       {-3.5ex \@plus -1ex \@minus -.2ex}%
                                       {2.3ex \@plus.2ex}%
                                       {\normalfont\Large\bfseries}}%
    \def\subsection{\@startsection{subsection}{2}{\z@}%
                                         {-3.25ex\@plus -1ex \@minus -.2ex}%
                                         {1.5ex \@plus .2ex}%
                                         {\normalfont\large\bfseries}}%
    \def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                         {-3.25ex\@plus -1ex \@minus -.2ex}%
                                         {1.5ex \@plus .2ex}%
                                         {\normalfont\normalsize\bfseries}}%
    \def\paragraph{\@startsection{paragraph}{4}{\z@}%
                                        {3.25ex \@plus1ex \@minus.2ex}%
                                        {-1em}%
                                        {\normalfont\normalsize\bfseries}}%
    \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                           {3.25ex \@plus1ex \@minus .2ex}%
                                           {-1em}%
                                          {\normalfont\normalsize\bfseries}}%
  }

\cs_new:Nn \__standardsectioning_report_sectioning_code:
  {
    \def\part{%
      \if@openright
        \cleardoublepage
      \else
        \clearpage
      \fi
      \thispagestyle{plain}%
      \if@twocolumn
        \onecolumn
        \@tempswatrue
      \else
        \@tempswafalse
      \fi
      \null\vfil
      \secdef\@part\@spart}

    \def\@part[##1]##2{%
        \ifnum \c@secnumdepth >-2\relax
          \refstepcounter{part}%
          \addcontentsline{toc}{part}{\thepart\hspace{1em}##1}%
        \else
          \addcontentsline{toc}{part}{##1}%
        \fi
        \markboth{}{}%
        {\centering
         \interlinepenalty \@M
         \normalfont
         \ifnum \c@secnumdepth >-2\relax
           \huge\bfseries \partname\nobreakspace\thepart
           \par
           \vskip 20\p@
         \fi
         \Huge \bfseries ##2\par}%
        \@endpart}
    \def\@spart##1{%
        {\centering
         \interlinepenalty \@M
         \normalfont
         \Huge \bfseries ##1\par}%
        \@endpart}
    \def\@endpart{\vfil\newpage
                  \if@twoside
                   \if@openright
                    \null
                    \thispagestyle{empty}%
                    \newpage
                   \fi
                  \fi
                  \if@tempswa
                    \twocolumn
                  \fi}
    \def\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                        \thispagestyle{plain}%
                        \global\@topnum\z@
                        \@afterindentfalse
                        \secdef\@chapter\@schapter}
    \def\@chapter[##1]##2{\ifnum \c@secnumdepth >\m@ne
                             \refstepcounter{chapter}%
                             \typeout{\@chapapp\space\thechapter.}%
                             \addcontentsline{toc}{chapter}%
                                       {\protect\numberline{\thechapter}##1}%
                        \else
                          \addcontentsline{toc}{chapter}{##1}%
                        \fi
                        \chaptermark{##1}%
                        \addtocontents{lof}{\protect\addvspace{10\p@}}%
                        \addtocontents{lot}{\protect\addvspace{10\p@}}%
                        \if@twocolumn
                          \@topnewpage[\@makechapterhead{##2}]%
                        \else
                          \@makechapterhead{##2}%
                          \@afterheading
                        \fi}
    \def\@makechapterhead##1{%
      \vspace*{50\p@}%
      {\parindent \z@ \raggedright \normalfont
        \ifnum \c@secnumdepth >\m@ne
            \huge\bfseries \@chapapp\space \thechapter
            \par\nobreak
            \vskip 20\p@
        \fi
        \interlinepenalty\@M
        \Huge \bfseries ##1\par\nobreak
        \vskip 40\p@
      }}
    \def\@schapter##1{\if@twocolumn
                       \@topnewpage[\@makeschapterhead{##1}]%
                     \else
                       \@makeschapterhead{##1}%
                       \@afterheading
                     \fi}
    \def\@makeschapterhead##1{%
      \vspace*{50\p@}%
      {\parindent \z@ \raggedright
        \normalfont
        \interlinepenalty\@M
        \Huge \bfseries  ##1\par\nobreak
        \vskip 40\p@
      }}
    \def\section{\@startsection {section}{1}{\z@}%
                                       {-3.5ex \@plus -1ex \@minus -.2ex}%
                                       {2.3ex \@plus.2ex}%
                                       {\normalfont\Large\bfseries}}
    \def\subsection{\@startsection{subsection}{2}{\z@}%
                                         {-3.25ex\@plus -1ex \@minus -.2ex}%
                                         {1.5ex \@plus .2ex}%
                                         {\normalfont\large\bfseries}}
    \def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                         {-3.25ex\@plus -1ex \@minus -.2ex}%
                                         {1.5ex \@plus .2ex}%
                                         {\normalfont\normalsize\bfseries}}
    \def\paragraph{\@startsection{paragraph}{4}{\z@}%
                                        {3.25ex \@plus1ex \@minus.2ex}%
                                        {-1em}%
                                        {\normalfont\normalsize\bfseries}}
    \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                           {3.25ex \@plus1ex \@minus .2ex}%
                                           {-1em}%
                                          {\normalfont\normalsize\bfseries}}
  }

\cs_new:Nn \__standardsectioning_book_sectioning_code:
  {
    \def\part{%
      \if@openright
        \cleardoublepage
      \else
        \clearpage
      \fi
      \thispagestyle{plain}%
      \if@twocolumn
        \onecolumn
        \@tempswatrue
      \else
        \@tempswafalse
      \fi
      \null\vfil
      \secdef\@part\@spart}

    \def\@part[##1]##2{%
        \ifnum \c@secnumdepth >-2\relax
          \refstepcounter{part}%
          \addcontentsline{toc}{part}{\thepart\hspace{1em}##1}%
        \else
          \addcontentsline{toc}{part}{##1}%
        \fi
        \markboth{}{}%
        {\centering
         \interlinepenalty \@M
         \normalfont
         \ifnum \c@secnumdepth >-2\relax
           \huge\bfseries \partname\nobreakspace\thepart
           \par
           \vskip 20\p@
         \fi
         \Huge \bfseries ##2\par}%
        \@endpart}
    \def\@spart##1{%
        {\centering
         \interlinepenalty \@M
         \normalfont
         \Huge \bfseries ##1\par}%
        \@endpart}
    \def\@endpart{\vfil\newpage
                  \if@twoside
                   \if@openright
                    \null
                    \thispagestyle{empty}%
                    \newpage
                   \fi
                  \fi
                  \if@tempswa
                    \twocolumn
                  \fi}
    \def\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                        \thispagestyle{plain}%
                        \global\@topnum\z@
                        \@afterindentfalse
                        \secdef\@chapter\@schapter}
    \def\@chapter[##1]##2{\ifnum \c@secnumdepth >\m@ne
                           \if@mainmatter
                             \refstepcounter{chapter}%
                             \typeout{\@chapapp\space\thechapter.}%
                             \addcontentsline{toc}{chapter}%
                                       {\protect\numberline{\thechapter}##1}%
                           \else
                             \addcontentsline{toc}{chapter}{##1}%
                           \fi
                        \else
                          \addcontentsline{toc}{chapter}{##1}%
                        \fi
                        \chaptermark{##1}%
                        \addtocontents{lof}{\protect\addvspace{10\p@}}%
                        \addtocontents{lot}{\protect\addvspace{10\p@}}%
                        \if@twocolumn
                          \@topnewpage[\@makechapterhead{##2}]%
                        \else
                          \@makechapterhead{##2}%
                          \@afterheading
                        \fi}
    \def\@makechapterhead##1{%
      \vspace*{50\p@}%
      {\parindent \z@ \raggedright \normalfont
        \ifnum \c@secnumdepth >\m@ne
          \if@mainmatter
            \huge\bfseries \@chapapp\space \thechapter
            \par\nobreak
            \vskip 20\p@
          \fi
        \fi
        \interlinepenalty\@M
        \Huge \bfseries ##1\par\nobreak
        \vskip 40\p@
      }}
    \def\@schapter##1{\if@twocolumn
                       \@topnewpage[\@makeschapterhead{##1}]%
                     \else
                       \@makeschapterhead{##1}%
                       \@afterheading
                     \fi}
    \def\@makeschapterhead##1{%
      \vspace*{50\p@}%
      {\parindent \z@ \raggedright
        \normalfont
        \interlinepenalty\@M
        \Huge \bfseries  ##1\par\nobreak
        \vskip 40\p@
      }}
    \def\section{\@startsection {section}{1}{\z@}%
                                       {-3.5ex \@plus -1ex \@minus -.2ex}%
                                       {2.3ex \@plus.2ex}%
                                       {\normalfont\Large\bfseries}}
    \def\subsection{\@startsection{subsection}{2}{\z@}%
                                         {-3.25ex\@plus -1ex \@minus -.2ex}%
                                         {1.5ex \@plus .2ex}%
                                         {\normalfont\large\bfseries}}
    \def\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                         {-3.25ex\@plus -1ex \@minus -.2ex}%
                                         {1.5ex \@plus .2ex}%
                                         {\normalfont\normalsize\bfseries}}
    \def\paragraph{\@startsection{paragraph}{4}{\z@}%
                                        {3.25ex \@plus1ex \@minus.2ex}%
                                        {-1em}%
                                        {\normalfont\normalsize\bfseries}}
    \def\subparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                           {3.25ex \@plus1ex \@minus .2ex}%
                                           {-1em}%
                                          {\normalfont\normalsize\bfseries}}
  }
\cs_new:Nn \__standardsectioning_activation_code:
  {
    \@ifclassloaded { scrartcl }
      {
        \__standardsectioning_common_komascript_deactivation_code:
        \__standardsectioning_article_sectioning_code:
      }
      {
        \@ifclassloaded { scrbook }
          {
            \__standardsectioning_common_komascript_deactivation_code:
            \cs_undefine:N \chapterlineswithprefixformat
            \cs_undefine:N \chapterlinesformat
            \__standardsectioning_book_sectioning_code:
          }
          {
            \@ifclassloaded { scrreprt }
              {
                \__standardsectioning_common_komascript_deactivation_code:
                \cs_undefine:N \chapterlineswithprefixformat
                \cs_undefine:N \chapterlinesformat
                \__standardsectioning_report_sectioning_code:
              }
              {
                \cs_if_exist:NTF \chapter
                  {
                    \cs_if_exist:cTF { frontmatter }
                      {
                        \__standardsectioning_book_sectioning_code:
                      }
                      {
                        \__standardsectioning_report_sectioning_code:
                      }
                  }
                  {
                    \__standardsectioning_article_sectioning_code:
                  }
              }
          }
       }
  }
\DeclareKeys
  {
    article .meta:nn = { __standardsectioning/internal } { force=article },
    article .usage   = load,
    book    .meta:nn = { __standardsectioning/internal } { force=book },
    book    .usage   = load,
    report  .meta:nn = { __standardsectioning/internal } { force=report },
    report  .usage   = load,
  }
\keys_define:nn { __standardsectioning/internal }
  {
     force .code =
      {
        \cs_if_exist:NTF \KOMAClassName
          {
            \msg_warning:nnn { standardsectioning }
                             { no-force-with-KOMA-Script-class }
                             { #1 }
          }
          {
            \cs_set_eq:Nc \__standardsectioning_activation_code: { __standardsectioning_#1_sectioning_code: }
          }
      }
  }
\ProcessKeyOptions
\__standardsectioning_activation_code:
\endinput
%%
%% End of file `standardsectioning.sty'.
