% \iffalse meta-comment
% ======================================================================
% contract.dtx
% Copyright (c) 2007–2026 Markus Kohm
%
% This file is part of the LaTeX package `contract'.
%
% This work may be distributed and/or modified under the conditions of
% the LaTeX Project Public License, version 1.3c of the license.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later and of this work.
%
% This work has the LPPL maintenance status "maintained".
%
% The Current Maintainer and author of this work is Markus Kohm.
%
% This work consists of the files listed in MANIFEST.md.
% ======================================================================
%<identify>%%% --- docstrip run: identify ---
%<doc>%%% --- docstrip run: doc ---
%<init>%%% --- docstrip run: init ---
%<options>%%% --- docstrip run: options ---
%<postoptions>%%% --- docstrip run: postoptions ---
%<body>%%% --- docstrip run: body ---
%<final>%%% --- docstrip run: final ---
%<*dtx>
\expandafter\ifx\csname ProvidesFile\endcsname\relax
  \def\ProvidesFile#1[#2]{}
\fi
\ProvidesFile{contract.dtx}[%
%</dtx>
%<package&identify>\NeedsTeXFormat{LaTeX2e}[2020/10/01]
%<package&identify>\providecommand*\DeclareRelease[3]{}
%<package&identify>\providecommand*\DeclareCurrentRelease[2]{}
%<package&identify>\DeclareCurrentRelease{v0.9}{2024-02-02}
%<package&identify>\ProvidesPackage{contract}[%
%<*dtx|(package&identify)>
  2026-04-23 v0.92
%<*dtx>
  source of
%</dtx>
  package for jurists
]
%</dtx|(package&identify)>
%<*dtx>
\ifx\documentclass\undefined
%</dtx>
%<*ins>
  \input docstrip.tex
  \generate{\usepreamble\defaultpreamble
%    \file{contract.ins}{%
%      \from{contract.dtx}{ins}%
%    }%
    \file{contract.sty}{%
      \from{contract.dtx}{package,identify}%
      \from{contract.dtx}{package,init}%
      \from{contract.dtx}{package,options}%
      \from{contract.dtx}{package,postoptions}%
      \from{contract.dtx}{package,body}%
      \from{contract.dtx}{package,final}%
    }%
  }%
%</ins>
%<*dtx>
\else
  \let\endbatchfile\relax
\fi
%</dtx>
%<*ins>
\endbatchfile
%</ins>
%<*dtx>
\documentclass[USenglish]{koma-script-source-doc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman,main=USenglish]{babel}
\usepackage{hvlogos}
\usepackage{tabularx}
\usepackage{graphicx}

% Note: The scrguide-… packages may currently not be available in any TeX
%       distribution.
\usepackage[colorize]{scrguide-listings}
\usepackage{scrguide-doclink}
\usepackage{scrguide-index}

\usepackage{booktabs}
\usepackage{csquotes}
\usepackage[style=alphabetic,autolang=other]{biblatex}
\begin{filecontents}{\jobname.bib}
@online{pkg:babel,
  author={Bezos López, Javier and Braams, Johannes L.},
  version={24.1},
  date={2024-01-07},
  title={\pkg*{babel} --- Multilingual support for \LaTeX, Lua\LaTeX,
         \XeLaTeX{} and Plain \TeX},
  url={https://ctan.org/pkg/babel},
  urldate={2024-01-08},
  note={This package manages culturally-determined typographical (and other)
        rules for a wide range of languages. A document may select a single
        language to be supported, or it may select several, in which case the
        document may switch from one language to another in a variety of ways.
        
        Babel uses contributed configuration files that provide the detail of
        what has to be done for each language, as well as \file{.ini} files
        for about 300 languages from around the World, including many written
        in non-Latin and RTL scripts. Many of them work with pdf\LaTeX, as
        well as with \XeLaTeX{} and Lua\LaTeX, out of the box. A few even
        work with plain formats.},
}
@online{pkg:koma-script,
  author={Markus Kohm},
  version={3.41},
  date={2023-07-07},
  title={{\KOMAScript} --- A bundle of versatile classes and packages},
  url={https://ctan.org/pkg/koma-script},
  urldate={2023-07-14},
  note={The \KOMAScript{} bundle provides replacements for the \cls*{article},
        \cls*{report}, and \cls*{book} classes with emphasis on typography and
        versatility. There is also a letter class.},
}
@manual{pkg:koma-script:manual:de,
  langid={ngerman},
  author={Markus Kohm},
  date={2023-06-16},
  title={{\KOMAScript}},
  subtitle={Die Anleitung},
  url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-de.pdf}
,
  urldate={2023-07-04},
}
@manual{pkg:koma-script:manual:en,
  author={Markus Kohm},
  date={2023-06-16},
  title={{\KOMAScript}},
  subtitle={The Guide},
  url={http://mirrors.ctan.org/macros/latex/contrib/koma-script/scrguide-en.pdf},
  urldate={2023-07-14},
}
@book{bk:koma-script,
  langid   ={ngerman},
  author   ={Kohm, Markus},
  title    ={{\KOMAScript}},
  subtitle ={Eine Sammlung von Klassen und Paketen für {\LaTeXe}},
  year     =2020,
  edition  =7,
  publisher={Lehmanns Media},
  address  ={Berlin},
  series   ={Edition DANTE},
  isbn     ={978-3-96543-097-6},
  note     ={Print-Ausgabe},
}
@book{ebk:koma-script,
  langid   ={ngerman},
  author   ={Kohm, Markus},
  title    ={{\KOMAScript}},
  subtitle ={Eine Sammlung von Klassen und Paketen für {\LaTeXe}},
  year     =2020,
  edition  =7,
  publisher={Lehmanns Media},
  address  ={Berlin},
  series   ={Edition DANTE},
  isbn     ={978-3-96543-103-4},
  note     ={eBook-Ausgabe},
}
\@online{pkg:parskip,
  author    ={Frank Mittelbach and Robin Fairbairns and H. Partl},
  version   ={2.0h},
  date      ={2021-03-14},
  title     ={\pkg*{parskip} --- Layout with zero \len{parindent}, non-zero \len{parskip}},
  url       ={https://www.ctan.org/pkg/parskip},
  urldate   ={2024-01-19},
  note      ={Simply changing \len{parskip} and \len{parindent} leaves a
              layout that is untidy; this package (though it is no
              substitute for a properly-designed class) helps alleviate this
              untidiness.},
}
@manual{pkg:parskip:manual,
  author    ={Frank Mittelbach},
  title     ={The \pkg*{parskip} package},
  date      ={2021-03-14},
  abstract  ={The \pkg*{parskip} package helps in implementing paragraph
              layouts where the paragraphs are separated by a vertical space
              instead of (or in addition to) indenting them.

              The package can be used with any document class at any size.
              By default it produces the following paragraph layout: Zero
              \len{parindent} and non-zero \len{parskip}. The stretchable
              glue in \len{parskip} helps \LaTeX{} in finding the best place
              for page breaks},
  url       ={http://mirrors.ctan.org/macros/latex/contrib/parskip/parskip.pdf},
  urldate   ={2024-01-19},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\setcounter{StandardModuleDepth}{2}
\setcounter{IndexColumns}{2}
\setcounter{GlossaryColumns}{2}
\providecommand*\targ[1]{\texttt{\char`\{#1\char`\}}}
\providecommand*\toarg[1]{\texttt{[#1]}}
\newenvironment{syntax}{%
  \list{}{%
    \listparindent -\leftmargin
    \rightmargin \leftmargin
    \leftmargin 2\leftmargin
    \itemindent \listparindent
    \parsep     0pt plus 1pt
  }%
  \def\obeyedlinedline{\item\relax}%
  \obeylines
  \obeyedlinedline
  \MacroFont
}{%
  \endlist
}
\makeatletter
\newenvironment{desctabular}{%
  \renewcommand*{\arraystretch}{1.25}%
  \newcommand{\entry}[2]{%
    \l@addto@macro\desctab@content{%
      \relax
      \renewcommand*\arraystretch{1}\begin{tabular}[t]{@{}l@{}}##1\end{tabular}
      & ##2\tabularnewline
    }%
  }
  \newcommand\desctab@content{\begin{tabularx}{\linewidth}{@{}lX@{}}\toprule}%
}{%
    \desctab@content
    \bottomrule
  \end{tabularx}
}
\makeatother
\newenvironment{desclist}{%
  \newcommand*{\desccaption}[2]{%
    \par
    \vspace{5\baselineskip}\pagebreak[2]\vspace{-5\baselineskip}\nopagebreak
    \captionof{table}{##1}\nopagebreak
    \begin{desctabular}
  }%
}{%
  \end{desctabular}
}
\newenvironment{Example}{%
  \lstset{belowskip=0pt plus 1pt minus .5pt}%
  \labeling{{\usekomafont{disposition}\Examplename:}}
  \item[{\usekomafont{disposition}\Examplename:}]%
}{%
  \endlabeling
}
\newcaptionname{USenglish}{\Examplename}{Example}

\DeclareTOCStyleEntry[dynnumwidth,dynindent]{section}{section}
\DeclareTOCStyleEntries[dynnumwidth,dynindent]{subsection}
  {subsection,subsubsection}

\DeclareLinkFallback{Counter}{tocdepth}
  {https://en.wikibooks.org/wiki/LaTeX/Tables_of_Contents_and_Lists_of_Figures}  
\DeclareLinkFallback{Macro}{arabic}
  {https://en.wikibooks.org/wiki/LaTeX/Counters#Counter_style}
\DeclareLinkFallback{Macro}{begin}
  {https://en.wikibooks.org/wiki/LaTeX/Basics#LaTeX_environments}
\DeclareLinkFallback{Macro}{bfseries}
  {https://en.wikibooks.org/wiki/LaTeX/Fonts#Font_styles}
\DeclareLinkFallback{Macro}{end}
  {https://en.wikibooks.org/wiki/LaTeX/Basics#LaTeX_environments}
\DeclareLinkFallback{Macro}{refstepcounter}
  {https://en.wikibooks.org/wiki/LaTeX/Counters#Counter_manipulation}
\DeclareLinkFallback{Macro}{sffamily}
  {https://en.wikibooks.org/wiki/LaTeX/Fonts#Font_styles}

\DeclareLinkFallback{Macro}{newcommand}
  {https://mirrors.ctan.org/macros/latex/base/usrguide-historic.pdf#subsection.3.4}  
\DeclareLinkFallback{Macro}{renewcommand}
  {https://mirrors.ctan.org/macros/latex/base/usrguide-historic.pdf#subsection.3.4}  
  
\DeclareLinkFallback{Macro}{defineshorthand}
  {http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf#subsection.1.10}  
\DeclareLinkFallback{Macro}{useshorthands}
  {http://mirrors.ctan.org/macros/latex/required/babel/base/babel.pdf#subsection.1.10}  
  
\DeclareLinkFallback{Macro}{setkeys}
  {https://mirrors.ctan.org/macros/latex/required/graphics/keyval.pdf#section.3}

\DeclareLinkFallback{Macro}{documentclass}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#12}
\DeclareLinkFallback{Macro}{dots}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#a7}
\DeclareLinkFallback{Macro}{label}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#2b}
\DeclareLinkFallback{Macro}{large}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#b3}
\DeclareLinkFallback{Macro}{pageref}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#2b}
\DeclareLinkFallback{Macro}{paragraph}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#2a}
\DeclareLinkFallback{Macro}{ref}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#2b}
\DeclareLinkFallback{Macro}{section}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#2a}
\DeclareLinkFallback{Macro}{subparagraph}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#2a}
\DeclareLinkFallback{Macro}{usepackage}
  {http://mirrors.ctan.org/info/lshort/english/lshort.pdf#13}

\DeclareLinkFallback{Macro}{addsec}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:maincls.cmd.addsec}
\DeclareLinkFallback{Macro}{markboth}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:maincls.cmd.markboth}
\DeclareLinkFallback{Macro}{markright}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:maincls.cmd.markright}

\DeclareLinkFallback{Macro}{newkomafont}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:maincls-experts.cmd.newkomafont}

\DeclareLinkFallback{Macro}{providecaptionname}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:scrbase.cmd.providecaptionname}

\DeclareLinkFallback{Macro}{KOMAoption}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:scrextend.cmd.KOMAoption}
\DeclareLinkFallback{Macro}{KOMAoptions}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:scrextend.cmd.KOMAoptions}
\DeclareLinkFallback{Macro}{addtokomafont}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:scrextend.cmd.addtokomafont}
\DeclareLinkFallback{Macro}{setkomafont}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:scrextend.cmd.setkomafont}
\DeclareLinkFallback{Macro}{usekomafont}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:scrextend.cmd.usekomafont}
\DeclareLinkFallback{Macro}{usekomafont}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:maincls-experts.cmd.newkomafont}

\DeclareLinkFallback{Macro}{DeclareTOCStyleEntry}
  {http://mirrors.ctan.org/macros/latex/contrib/koma-script/doc/scrguide-en.pdf#desc:tocbasic.cmd.DeclareTOCStyleEntry}
\begin{document}
  \nocite{pkg:koma-script}
  \DocInput{contract.dtx}
\end{document}
%</dtx>
% \fi
%
% \changes{v0.0.1}{2023-10-10}{new \KOMAScript{} spin-off}
% \changes{v0.9}{2024-02-02}{first release as standalone package}
%
% \GetFileInfo{contract.dtx}
% \title{%^^A
%   \LaTeX{} Package \pkg*{contract}%^^A
%   \thanks{%^^A
%     The repository of this package can be found at
%     \url{https://codeberg.org/komascript/latex-contract.git}
%     where you also should report issues.%^^A
%   }%^^A
% }
% \date{Version \fileversion{} of \filedate}
% \author{\href{mailto:komascript@gmx.info}{Markus Kohm}}
% \maketitle
% \begin{abstract}
%   The \pkg*{contract} package is intended for cautelar jurisprudence.  It is
%   intended to provide flexible help for lawyers and notaries in drafting
%   contracts, statutes and legal commentaries.  It has been developed in
%   cooperation with Dr~Alexander Willand, and is still in the process of
%   development.
%
%   Package \pkg*{contract} is a
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} spin-off. It has
%   been released from 2011 till 2023 as \pkg*{scrjura}. With
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} 3.42
%   \pkg*{scrjura} is removed from
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} and released as
%   new package \pkg*{contract}.
% \end{abstract}
%
% \tableofcontents
% \listoftables
% \listoffigures
%
% \addpart{User Manual}
%
% If you want to write a contract\Index{contract}, the articles of association
% for a company or an association, a law, or a legal commentary, the package
% \pkg*{contract} will provide typographical support. Although \pkg*{contract}
% is intended to provide general help for legal documents, the contract is the
% central element of the package. Particular attention is paid to
% clauses\Index{clause}, titles, and numbered provisions\,---\,if there are
% several of them in a clause\,---, numbered sentences, entries in the table
% of contents, and cross references according to German standards.
%
% The package has been developed in cooperation with Dr Alexander Willand of
% Karls\-ruhe. Many of its features go back to constructive inquiries from
% Prof Heiner Richter of the Hochschule Stralsund University of Applied
% Sciences.
%
% Some of you may search for the German user manual formally available in
% \cite{pkg:koma-script:manual:de}. The author's acute overload has resulted
% in this no longer being freely available. However, the corresponding chapter
% in \cite{bk:koma-script} and \cite{ebk:koma-script} is still accessible and
% applicable with appropriate adjustments to the package name.
%
%
% \section{Package Loading and Option Setting}
%
% You can load the package as common using:
% \begin{syntax}
%  \cs{usepackage}\oarg{options}|{contract}|\quad.
% \end{syntax}
% In case of package \pkg*{contract} the \meta{options} are
% \meta{key}|=|\meta{value} options.
% \begin{description}
% \item[Note:] In case of using package \pkg*{contract} with package
%   \pkg{hyperref} you should load \pkg{hyperref} always after
%   \pkg*{contract}.
% \end{description}
%
% \DescribeCommand\contractSetup
% To change options after loading the package, you should use:
% \begin{syntax}
%   \cs{contractSetup}\marg{options}
% \end{syntax}
% with \meta{options} is a comma separated list of \meta{key}=\meta{value}
% options as explained before.
% \begin{description}
% \item[Note:] Currently the options are still implemented using the internal
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} package
%   \href{https://www.ctan.org/pkg/koma-script}{\pkg*{scrkbase}}\footnote{You
%     need at least \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}
%     v3.39 to have \pkg*{scrkbase} and all other \KOMAScript{} packages
%     required by \pkg*{scrkbase} and \pkg*{contract} installed. If you use
%     the recommended installation with the package manager of your
%     \TeX{} distribution this version requirement should be fulfilled by
%     installing the \KOMAScript{} package or by updating an already
%     installed \KOMAScript.}. Therefore
%   you could also setup \meta{options} using the
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} commands
%   \cs{KOMAoptions} or \cs{KOMAoption}, which are described in
%   \cite{pkg:koma-script:manual:en}. Moreover, because of the implementation,
%   currently \cs{contractSetup} could also be used to setup other
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} options not
%   related to package \pkg*{contract}. However, you should avoid this,
%   because it will fail, when the implementation will be changed.
% \end{description}
%
% \section{Changing the Fonts of Elements}
% \label{sec:textmarkup}
%
% Currently package \pkg*{contract} still uses the font selection features of
% the internal \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}
% package \pkg{scrkbase}. So the commands \cs{setkomafont},
% \cs{addtokomafont}, and \cs{usekomafont}, which are described in
% \cite{pkg:koma-script:manual:en}, can be used to change the fonts of the
% following elements:
% \begin{description}\setkomafont{descriptionlabel}{}
% \item[{\fnt{Clause}:}] \hfill\\
%   Alias for \fnt{\meta{environment}.Clause} within any contract environment,
%   e.\,g., \fnt{contract.Clause} within environment \env{contract}. If no
%   corresponding element is defined, \fnt{contract.Clause} is used.
% \item[{\fnt{contract.Clause}:}]
%   \hfill\mbox{(Default: \cs{sffamily}\cs{bfseries}\cs{large})}\\
%   The heading of a \cs{Clause} within the environment \env{contract}.
% \item[{\fnt{\meta{environment}.Clause}:}]
%   \hfill\mbox{(Default: \emph{none})}\\
%   The heading of a \cs{Clause} within environment \meta{environment}, which
%   has been defined using \cs{DeclareNewJuraEnvironment}, if the font has
%   been setup using property |ClauseFont| or the element has been defined
%   explicitly.
% \item[{\fnt{parnumber}:}]
%   \hfill\mbox{(Default: \emph{empty})}\\
%   The paragraph number within a contract environment.
% \item[{\fnt{sentencenumber}:}]
%   \hfill\mbox{(Default: \emph{empty})}\\
%   The sentence number printed by \cs{Sentence}.
% \end{description}
%
% \begin{description}
% \item[Note:] There are plans to no longer use package \pkg*{scrkbase}, but
%   maybe package \pkg{scrextend} instead, if \pkg*{scrjura} is used with a
%   non-\KOMAScript{} class. So the commands \cs{setkomafont},
%   \cs{addtokomafont} and \cs{usekomafont} would still be available in
%   future.
% \end{description}
%
% \section{Clauses in the Table of Contents}
% \label{sec:toc}
%
% The headings of clauses can also be added automatically to the table of
% contents, if desired. For this the package uses command
% \cs{DeclareTOCStyleEntry} of
% \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} package
% \pkg{tocbasic} to define an entry level named |cpar|. Usage of package
% \pkg{tocbasic} also means, that you should not use another package to
% configure the Table of Contents, e.g., \pkg{tocloft}, \pkg{tocstyle} etc.
%
% \DescribeOption{juratotoc}
% \SpecialOptionIndex{juratotoc\quotechar=\meta{boolean}}
% \SpecialOptionIndex{juratotoc\quotechar=\meta{integer}}
% Clauses\Index{clause} are shown in the table of contents only if their
% level number is less than or equal to the
% \cnt{tocdepth} counter.  By default, the level
%   number is \len{maxdimen}, which is also used if the option is switched
% off using \opt[element=juratotoc]{juratotoc=false}. Because the
% \cnt{tocdepth} counter usually has a one-digit value,
% clause entries are therefore not normally displayed in the table of contents.
%
% If you switch on the option using the
% \opt[element=juratotoc]{juratotoc=true}, the level number 2 is used so that
% clauses are shown in the table of contents on the same level as
% subsections. For the default setting of \cnt{tocdepth}, clauses are then
% shown in all \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}
% classes or standard classes.
%
% You can also use \opt[element=juratotoc]{juratotoc=\meta{integer}} to use
% \meta{integer} instead of \len{maxdimen} or 2 as level number.
%
% Internally usage of this option results in a call of
% \begin{syntax}
%   \cs{DeclareTOCStyleEntry}\toarg{level=\meta{integer}}\targ{default}\targ{cpar}
% \end{syntax}
% respectively
% \begin{syntax}
%   \cs{DeclareTOCStyleEntry}\toarg{level=2}\targ{default}\targ{cpar}
% \end{syntax}
% respectively
% \begin{syntax}
%   \cs{DeclareTOCStyleEntry}\toarg{level=\cs{maxdimen}}\targ{default}\targ{cpar}\quad.
% \end{syntax}
%
% \DescribeOption[noindex]{juratocindent}
% \SpecialOptionIndex{juratocindent\quotechar=\meta{length}}
% \DescribeOption[noindex]{juratocnumberwidth}
% \SpecialOptionIndex{juratocnumberwidth\quotechar=\meta{length}}
% These options determine the indentation and spacing for clause entries in
% the table of contents. Any valid \meta{length} can be assigned. The defaults
% are the same as for subsection entries in \cls{scrartcl}.
%
% Internally, usage of these options results in calls to:
% \begin{syntax}
%   \cs{DeclareTOCStyleEntry}\toarg{indent=\meta{length}}\targ{default}\targ{cpar}
% \end{syntax}
% respective
% \begin{syntax}
%   \cs{DeclareTOCStyleEntry}\toarg{numwidth=\meta{length}}\targ{default}\targ{cpar}\quad.
% \end{syntax}
%
% \section{Environment for Contracts}
% \label{sec:contract}
%
% The essential mechanisms of package \pkg*{contract} are available only
% inside contract environments, either the predefined \env{contract} or any
% other environment defined with command \cs{DeclareNewJuraEnvironment}.
%
% \DescribeEnv{contract}^^A
% Currently, this is the one and only predefined environment for
% \pkg*{contract}. Using it activates automatic numbering of paragraphs and
% the \cs{Clause} and \cs{SubClause} commands, which will be documented below,
% are given concrete form.
%
% The \env{contract} environment must
% not be nested within itself. Within a document, however, you can use the
% environment several times. The clauses within these environments are treated
% as if they were within a single environment. As a result, ending the
% environment really only temporarily interrupts it, and the old environment is
% continued by the beginning of a new environment. However, you cannot end the
% environment within a clause. If you want instead print several contracts,
% you would need to define several contract environments using command
% \cs{DeclareNewJuraEnvironment}.
%
% \DescribeOption{contract}
% The whole document becomes a contract\Index{contract} if you use this option
% while loading the package with:
% \begin{syntax}
%   \cs{usepackage}\toarg{\opt{contract}}\targ{contract}
% \end{syntax}
% or as a global option with \cs{documentclass}. The document then behaves
% exactly as if it would contain one \env{contract} environment.
%
%
% \subsection{Clauses}
% \label{sec:clause}
%
% Clauses^^A
% \Index[see{clause}]{section}^^A
% \Index[see{clause}]{paragraph}^^A
% \Index[indexmain]{clause}^^A
% \footnote{%^^A
%   In English, a ``clause'' in a legal document is a section, paragraph, or
%   phrase that relates to a particular point. Although it is common in English
%   to also use the terms ``article'' or ``section'' for what we here call a
%   ``clause'', we use the latter term throughout to avoid confusion with the
%   \cls{article} class and the \cs{section} and
%   \cs{paragraph} sectioning divisions of most document
%   classes.} in a legal sense are defined in package \pkg*{contract} only
% within contracts\Index{contract}, that is inside the
% \env{contract} environment or other environments declared
% with \cs{DeclareNewJuraEnvironment}.
%
% \DescribeCommand{\Clause}
% \DescribeCommand{\SubClause}
% Each clause starts either with \cs{Clause}\oarg{property list} or
% \cs{SubClause}\oarg{property list}.  The optional argument \meta{property
% list} is a comma separated list of \meta{key}|=|\meta{value}.
%
% These are the most important commands inside of a contract. Without using
% any additional \meta{key}, \cs{Clause} creates the heading of a clause,
% which consists of the sign ``\S'', followed by its number. In contrast,
% \cs{SubClause} creates the heading of a clause with the last number used by
% \cs{Clause} and adds a lower-case letter. \cs{SubClause} is mainly intended
% for cases where an act or a contract is amended and not only are clauses
% changed or deleted but new clauses are inserted between existing ones
% without completely changing the numbering.
%
% Both commands accept a comma-separated list of \meta{key}|=|\meta{value}
% properties and also some \meta{key}s without value. An overview
% of the available properties is shown in \autoref{tab:Clause.options}.
% The most important of them will be discussed in more detail.
%
% \begin{table}
%   \captionabove{Available properties for the optional argument of
%     \cs{Clause} and \cs{SubClause}}%^^A
%   \label{tab:Clause.options}
%   \begin{desctabular}
%     \entry{|dummy|}{%^^A
%       The heading will not be printed but is counted in the automatic
%       numbering.%^^A
%     }%^^A
%     \entry{|head=|\meta{running head}}{%^^A
%       If running heads are active, this \meta{running head} is used instead
%       of the clause \meta{title}.%^^A
%     }%^^A
%     \entry{|nohead|}{%^^A
%       The running head stays unchanged.%^^A
%     }%^^A
%     \entry{|notocentry|}{%^^A
%       Does not make an entry into the table of contents.%^^A
%     }%^^A
%     \entry{|number=|\meta{number}}{%^^A
%       Uses \meta{number} for the output of the clause number.%^^A
%     }%^^A
%     \entry{|preskip=|\meta{skip}}{%^^A
%       Changes the vertical \meta{skip} before the clause heading.%^^A
%     }%^^A
%     \entry{|postskip=|\meta{skip}}{%^^A
%       Changes the vertical \meta{skip} after the clause heading.%^^A
%     }%^^A
%     \entry{|title=|\meta{title}}{%^^A
%       The clause \meta{title} will be printed in addition to the clause
%       number. This is also used as the default for the \meta{running head}
%       and the \meta{entry} in the table of contents.%^^A
%     }%^^A
%     \entry{|tocentry=|\meta{entry}}{%^^A
%       Regardless of the clause \meta{title}, an \meta{entry} into the
%       table of contents will be made, if such entries are activated (see
%       option \opt{juratotoc}).%^^A
%     }%^^A
%   \end{desctabular} 
% \end{table}
%
% By default, a skip of two lines is inserted before the heading and a skip of
% one line afterwards. You can change the size of these skips with the
% |preskip| and |postskip| properties. The new values apply not only
% to the current clause but from the current clause until the end of the
% current contract environment. You can also make the appropriate settings in
% advance with
% \begin{syntax}
%   \cs{setkeys}\targ{\env{contract}}%^^A
%   \targ{preskip=\meta{skip},postskip=\meta{skip}}
% \end{syntax}
% regardless of the specific clause and outside of a contract environment. You
% can also set these options inside the preamble after loading
% \pkg*{contract}, but you cannot set them while loading the package or by
% using \cs{contractSetup}.
%
% By default, clause headings use the font style
% \cs{sffamily}\cs{bfseries}\cs{large}. See \autoref{sec:textmarkup} for
% information about how to change the font for element \fnt{contract.Clause}.
%
% With the |title|, |head|, and |tocentry| property, you can title a clause in
% addition to the number. You should enclose the \meta{value} of each property
% inside curly brackets. Otherwise, for example, commas which are meant to be
% part of the \meta{value} will be confused with the delimiters between
% different properties of the \meta{property list}. Empty values for |head|
% and |tocentry| cause empty entries. If you want to avoid an entry, use the
% |nohead| resp. |notocentry| property.
%
% Instead of consecutive numbers, you can also set a clause number manually
% with the |number| property. However, this does not affect the numbers of
% the subsequent clauses. Empty numbers are not possible.  Fragile commands
% inside |number| have to be protected with \cs{protect}. You should use
% only numbers and letters as a |number|.
%
% With the |dummy| property, you can suppress the output of the whole heading
% of a clause. The automatic numbering, however, will still count this
% clause. In this way, you can skip an automatically numbered clause with
%\begin{syntax}
%  \cs{Clause}\toarg{dummy}
%\end{syntax}
% in case the clause corresponding clause has been deleted in a later version
% of a contract.
%
% Note that the |dummy| property only accepts the \meta{value}s |true| and
% |false|. All other \meta{value}s are usually ignored, but can lead to an
% error message in the worst case scenario.
%
% \DescribeCommand{\Clauseformat}
% As already mentioned, clauses and subclauses are normally numbered. The
% number is formatted with the help of the \cs{Clauseformat} command, which
% expects the \meta{number} as the only argument. The default is the
% following:
%\begin{syntax}
%  \cs{newcommand*}\targ{\cs{Clauseformat}}\toarg{1}\targ{\cs{S}~\#1}
%\end{syntax}
% This produces the section mark, \cs{S} (\S), followed by a non-breaking
% space and the number. If you redefine this command, be sure it remains
% expandable.
%
% \DescribeOption{juratitlepagebreak}^^A
% \SpecialOptionIndex{juratitlepagebreak\quotechar=\meta{boolean}}^^A
% Usually, page breaks are prohibited within heading of all kinds. However,
% some lawyers require page breaks within clause headings. You can allow such
% a break by using option \opt{juratitlepagebreak} or
% \opt[element=juratitlepagebreak]{juratitlepagebreak=\meta{boolean}}. Boolean
% values of \texttt{true} or \texttt{false} can be used to toggle the option
% on or off. Using the option without a value is the same as using
% \texttt{true}. The option can be used as an optional argument of
% \cs{documentclass}, \cs{usepackage} when loading package \pkg*{contract}, or
% as an argument of \cs{contractSetup}.
%
% \DescribeOption[noindex]{clausemark}
% \SpecialOptionIndex{clausemark\quotechar=\meta{value}}
% Since clauses are a subordinate structure with independent numbering, they
% do not produce running heads by default. You can, however, create running
% heads with various settings using:
% \begin{syntax}
%   \opt{clausemark}=\meta{value}
% \end{syntax}
% as an optional argument of \cs{documentclass}, \cs{usepackage} when loading
% package \pkg*{contract}, or as an argument of \cs{contractSetup}. You can
% find the available \meta{value}s and their meanings in
% \autoref{tab:clausemark}.
% \begin{table}
%   \captionabove{Available values for the \opt{clausemark} option to
%     activate running heads}%^^A
%   \label{tab:clausemark}%^^A
%   \begin{desctabular}
%     \entry{\optvalue{both}}{%^^A
%       Clauses generate left and right marks for running heads, if the
%       document provides automatic running heads.%^^A
%       \SpecialOptionIndex{clausemark\quotechar=both}%^^A
%     }%^^A
%     \entry{\optvalue{false}, \optvalue{off}, \optvalue{no}}{%^^A
%       Clauses do not generate marks for running heads and therefore do not
%       change running heads.%^^A
%       \SpecialOptionIndex{clausemark\quotechar=false}%^^A
%     }%^^A
%     \entry{\optvalue{forceboth}}{%^^A
%       Clauses use \cs{markboth} to generate left and right
%       marks for running heads even if the document does not provide
%       automatic running heads for the current page style.%^^A
%       \SpecialOptionIndex{clausemark\quotechar=forceboth}%^^A
%     }%^^A
%     \entry{\optvalue{forceright}}{%^^A
%       Clauses use \cs{markright} to generate right marks for
%       running heads even if the document does not provide automatic running
%       heads for the current page style.%^^A
%       \SpecialOptionIndex{clausemark\quotechar=forceright}%^^A
%     }%^^A
%     \entry{\optvalue{right}}{%^^A
%       Clauses generate right marks for running heads, if the document
%       provides automatic running heads.%^^A
%       \SpecialOptionIndex{clausemark\quotechar=right}%^^A
%     }%^^A
%   \end{desctabular}
% \end{table}
%^^A
%
%
% \subsection{Paragraphs}
% \label{sec:par}
% \Index{paragraph>numbering}%^^A
% Within clauses, \pkg*{contract} usually numbers paragraphs automatically.
% With this, the paragraphs provide a powerful structuring element, similar to
% \cs{paragraph} or \cs{subparagraph} in
% normal documents. For this reason, contracts usually use a vertical skip
% between paragraphs. The \pkg*{contract} package does not provide its own
% mechanism for this. Instead, you should uses the
% \opt{parskip}\SpecialOptionIndex{parskip} option of the
% \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}
% classes. If you do not use a
% \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} class, see the
% documentation of the used class or package \pkg{parskip}
% \nocite{pkg:parskip}\cite{pkg:parskip:manual}.
%
%
% \DescribeOption{parnumber}
% \SpecialOptionIndex{parnumber\quotechar=\meta{value}}
% The option can be used as an optional argument of \cs{documentclass},
% \cs{usepackage} when loading package \pkg*{contract}, or as an argument of
% \cs{contractSetup}.
%
% The default numbering of paragraphs is
% \opt[element=parnumber]{parnumber=auto}\SpecialOptionIndex{parnumber\quotechar=auto}
% and
% \opt[element=parnumber]{parnumber=true}\SpecialOptionIndex{parnumber\quotechar=true}. Sometimes
% you may need to disable the automatic numbering. You can do this with
% \opt[element=parnumber]{parnumber=false}\SpecialOptionIndex{parnumber\quotechar=false}.
% In this case, only the sentence numbering is reset.
%
% To implement this option, it has been necessary to hook into the
% paragraph-building mechanism of \LaTeX. In some rare cases, this can have a
% negative effect. If so, you can undo the change with
% \opt[element=parnumber]{parnumber=manual}\SpecialOptionIndex{parnumber\quotechar=manual}.
% On the other hand, \LaTeX{} itself sometimes undoes the change. In those
% cases you can activate it again with
% \opt[element=parnumber]{parnumber=auto}\SpecialOptionIndex{parnumber\quotechar=auto}.
%
% Clauses that consist of a single paragraph do not automatically receive a
% paragraph number. For this to work, there must not be two clauses with an
% identical number in a document. However should you ever need such numbering,
% you should switch to another contract environment (see
% \cs{DeclareNewJuraEnvironment}). Note that the number of
% paragraphs in a clause is not available before the end of the
% clause. Therefore you need a least two \LaTeX{} runs before the automatic
% paragraph numbering is correct.
%
%
% \DescribeCounter{par}
% \DescribeCommand{\thepar}
% \DescribeCommand{\parformat}
% \DescribeCommand{\parformatseparation}
% For numbering the paragraphs inside a clause we use the \cnt{par} counter.
% The output of \cs{thepar} will display an Arabic number, because the
% default is \cs{arabic}\targ{par}. \cs{parformat} provides the
% format, which is \cs{thepar} in rounded brackets. When numbering a
% paragraph manually, you should also use \cs{parformat}. It makes sense to
% call \cs{parformat} with a subsequent \cs{parformatseparation}, or at
% least a \cs{nobreakspace} or tilde.
%
% With automatic numbering, \cs{parformat} is followed by
% \cs{parformatseparation}, which currently consists of
% \cs{nonbreakspace}, the non-breakable space.
%
% The paragraph number is usually printed using the currently active font.
% See \autoref{sec:textmarkup} for information how to change the font of the
% \fnt{parnumber} element.
%
% \begin{description}
% \item{Note:} \pkg*{contract} currently assumes internally that
%   \cs{thepar} is an Arabic number. Therefore you should definitely not
%   redefine it!
% \end{description}
%
%
% \DescribeCommand{\withoutparnumber}
% If the paragraph number is not printed, \pkg*{contract} executes the
% \cs{withoutparnumber} command at the beginning of the new paragraph. The
% initial definition of this command is empty. This means it is a kind of
% dummy command that does nothing. It has been implemented because of a user
% request. Most users can ignore this command.
%
%
% \DescribeCommand{\ellipsispar}
% \DescribeCommand{\parellipsis}
% Sometimes\,---\,particularly in comparative commentaries\,---\,it is
% desirable to omit paragraphs but to mark the omission. Those omitted
% paragraphs\Index{paragraph>omission} should be taken into account by the
% paragraph counter. The package \pkg*{contract} provides the command
% \cs{ellipsispar} to do this.
%
% By default, \cs{ellipsispar} omits precisely one paragraph. Using the
% optional argument of
% \begin{syntax}
%   \cs{ellipsispar}\oarg{number}
% \end{syntax}
% you can omit multiple paragraphs. In any case, the output shows just one
% unnumbered paragraph, which consists only of the ellipsis defined by
% \cs{parellipsis}. The automatic numbering of paragraphs takes the
% \meta{number} of omitted paragraphs into account.
% \begin{Example}
%   Suppose you are writing a comment on the German\footnote{Please remember,
%   this translation does not refer to an existing law but is only an example
%   of how you might realise such a commentary with \pkg*{contract}.} penal
%   code, but only on paragraph 3 of \S~2. Nevertheless, you'd like to
%   indicate the omission indirectly. You can do this with:
%\begin{lstcode}[gobble=1]
%  \documentclass[parskip=half]{scrartcl}
%  \usepackage{contract}
%  \begin{document}
%  \begin{contract}
%    \Clause{title={Temporal application},number=2}
%    \ellipsispar[2]
%
%    If the law that applies at the time the criminal act is
%    committed is changed before the verdict, then the most
%    lenient law shall be applicable.
%
%    \ellipsispar[3]
%  \end{contract}
%  \end{document}
%\end{lstcode}
%   To see the result, just give it a try.
% \end{Example}
%
% The ellipsis is by default \cs{textellipsis}, if such a command is
% defined. If not, \cs{dots} is used. You can redefine \cs{parellipsis} at any
% time with \cs{renewcommand}.
%
%
% \subsection{Sentences}
% \label{sec:sentence}
%
% \Index{sentence>number}%^^A
% Paragraphs in contracts consist of one or more sentences, some of which may
% also be numbered. However, as automatic numbering is cumbersome and
% error-prone, it has not yet been implemented in
% \pkg*{contract}. Semi-automatic numbering, however, is supported.
%
% \DescribeCounter{sentence}
% \DescribeCommand{\thesentence}
% \DescribeCommand{\sentencenumberformat}
% \DescribeCommand{\Sentence}
% Manual numbering of sentences is done with the \cs{Sentence} command. It
% adds one to the \cnt{sentence} counter. By default,
% \cs{sentencenumberformat} prints \cs{thesentence} as an Arabic number in
% superscript.
%
% The sentence number is usually printed using the currently active font.
% See \autoref{sec:textmarkup} for information how to change the font of the
% \fnt{sentencenumber} element.
%
% Using \pkg{babel} offers an easy way to define a shorthand for
% \cs{Sentence}:%^^A
% \phantomsection\label{sec:shorthandexample}%^^A
%\begin{lstcode}[moretexcs={useshorthands,defineshorthand},gobble=1]
%  \useshorthands{'}
%  \defineshorthand{'S}{\Sentence\ignorespaces}
%\end{lstcode}
% With this definition, any space after \lstinline|'S| will be ignored. You
% can even use the dot as an abbreviation for a dot and a new sentence number:
%\begin{lstcode}[moretexcs={useshorthands,defineshorthand},gobble=1]
%  \defineshorthand{'.}{. \Sentence\ignorespaces}
%\end{lstcode}
% For details regarding \cs{useshorthands} and \cs{defineshorthand},
% please consult the manual of the \pkg{babel} package (see
% \cite{pkg:babel}). You can find an example of their application in
% \autoref{sec:example}, \autopageref{sec:example}.%^^A
%
%
% \section{Cross References}
% \label{sec:ref}
%
% The conventional mechanism to set cross references using \cs{label},
% \cs{ref}, and \cs{pageref} does not suffice for clauses, paragraphs, and
% sentences.  Therefore \pkg*{contract} provides additional commands.
%
% \DescribeCommand{\ref}
% \DescribeCommand{\refL}
% \DescribeCommand{\refS}
% \DescribeCommand{\refN}
% The commands
% \begin{syntax}
%   \cs{ref}\marg{label}
%   \cs{refL}\marg{label}
%   \cs{refS}\marg{label}
%   \cs{refN}\marg{label}
% \end{syntax}
% give a full reference to clause, paragraph and sentence. \cs{refL} is a long
% text, \cs{refS} a short text, and \cs{refN} an abbreviated, numeric form.
% \cs{ref} defaults to \cs{refL}.
%
%
% \DescribeCommand{\refClause}
% \DescribeCommand{\refClauseN}
% The commands
% \begin{syntax}
%   \cs{refClause}\marg{label}
%   \cs{refClauseN}\marg{label}
% \end{syntax}
% reference a clause without displaying the paragraph or
% sentences. \cs{refClause} puts a section mark (\S) in front of the
% reference, while \cs{refClauseN} does not.
%
%
% \DescribeCommand{\refPar}
% \DescribeCommand{\refParL}
% \DescribeCommand{\refParS}
% \DescribeCommand{\refParN}
% The commands
% \begin{syntax}
%   \cs{refPar}\marg{label}
%   \cs{refParL}\marg{label}
%   \cs{refParS}\marg{label}
%   \cs{refParN}\oarg{number format}\marg{label}
% \end{syntax}
% reference a paragraph of a clause. The differences between the forms
% correspond to the differences between \cs{refL}, \cs{refN} and \cs{refS}. A
% feature worth noting is the optional argument of \cs{refParN}. Usually the
% numeric reference to a paragraph uses a Roman number. You can, however,
% specify a different \meta{number format} in the optional argument. This
% option primarily makes sense to use Arabic numbers. By default, \cs{refPar}
% is \cs{refParL}.
%
%
% \DescribeCommand{\refSentence}
% \DescribeCommand{\refSentenceL}
% \DescribeCommand{\refSentenceS}
% \DescribeCommand{\refSentenceN}
% The commands
% \begin{syntax}
%   \cs{refSentence}\marg{label}
%   \cs{refSentenceL}\marg{label}
%   \cs{refSentenceS}\marg{label}
%   \cs{refSentenceN}\marg{label}
% \end{syntax}
% reference a sentence of a paragraph. Again, there is a long text form, a
% short text form, and a numerical form. By default, \cs{refSentence} is
% \cs{refSentenceL}.%^^A
%
%
% \DescribeOption[noindex]{ref}
% \SpecialOptionIndex{ref\quotechar=\meta{value}}
% The results of \cs{ref}, \cs{refPar}, and \cs{refSentence} depend on the
% option
% \begin{syntax}
%   \opt{ref}|=|\meta{value}
% \end{syntax}
% that can be used as an optional argument of \cs{documentclass},
% \cs{usepackage} when loading package \pkg*{contract}, or as an argument of
% \cs{contractSetup}.  The default is \opt[element=ref]{ref=long} and
% therefore \cs{refL}, \cs{refParL} and \cs{refSentenceL}.  You can find the
% available \meta{value}s for his option and their meaning in
% \autoref{tab:ref}.%^^A
% %^^A
% \begin{table}
%   \captionabove[{%^^A
%     Available values for the \opt{ref} option to configure the
%     cross reference format%^^A
%   }]{%^^A
%     Available values for the \opt{ref} option to configure the
%     cross reference format of \cs{ref},
%     \cs{refPar}, and \cs{refSentence}%^^A
%     \label{tab:ref}%^^A
%   }%^^A
%   \begin{desctabular}
%     \entry{\optvalue{long}}{%^^A
%       A combination of \optvalue{parlong} and \optvalue{sentencelong}.%^^A
%       \SpecialOptionIndex{ref\quotechar=long}%^^A
%     }%^^A
%     \entry{\optvalue{numeric}}{%^^A
%       A combination of \optvalue{parnumeric} and
%       \optvalue{sentencenumeric}.%^^A
%       \SpecialOptionIndex{ref\quotechar=numeric}%^^A
%     }%^^A
%     \entry{\optvalue{clauseonly}, \optvalue{onlyclause},\\
%            \optvalue{ClauseOnly}, \optvalue{OnlyClause}}{%^^A
%       A combination of \optvalue{paroff} and \optvalue{sentenceoff}. Note
%       that \cs{refPar} and \cs{refSentence}
%       produce empty results!%^^A
%       \SpecialOptionIndex{ref\quotechar=long}%^^A
%     }%^^A
%     \entry{\optvalue{parlong}, \optvalue{longpar},\\
%            \optvalue{ParL}}{%^^A
%       Paragraphs are referenced in long textual form.%^^A
%       \SpecialOptionIndex{ref\quotechar=parlong}%^^A
%     }%^^A
%     \entry{\optvalue{parnumeric}, \optvalue{numericpar}, \optvalue{ParN}}{%^^A
%       Paragraphs are referenced in simple numerical form.%^^A
%       \SpecialOptionIndex{ref\quotechar=parnumeric}%^^A
%     }%^^A
%     \entry{\optvalue{paroff}, \optvalue{nopar}}{%^^A
%       Paragraphs have no reference. Note that \cs{refPar}
%       produces an empty result!%^^A
%       \SpecialOptionIndex{ref\quotechar=paroff}%^^A
%     }%^^A
%     \entry{\optvalue{parshort}, \optvalue{shortpar}, \optvalue{ParS}}{%^^A
%       Paragraphs are referenced in short textual form.%^^A
%       \SpecialOptionIndex{ref\quotechar=parshort}%^^A
%     }%^^A
%     \entry{\optvalue{sentencelong}, \optvalue{longsentence}, \\
%            \optvalue{SentenceL}}{%^^A
%       Sentences are referenced in long textual form.%^^A
%       \SpecialOptionIndex{ref\quotechar=parlong}%^^A
%     }%^^A
%     \entry{\optvalue{sentencenumeric}, \optvalue{numericsentence},\\
%            \optvalue{SentenceN}}{%^^A
%       Sentences are referenced in simple numeric form.%^^A
%       \SpecialOptionIndex{ref\quotechar=sentencenumeric}%^^A
%     }%^^A
%     \entry{\optvalue{sentenceoff}, \optvalue{nosentence}}{%^^A
%       Sentences have no reference. Note that
%       \cs{refSentence} produces an empty result!%^^A
%       \SpecialOptionIndex{ref\quotechar=sentenceoff}%^^A
%     }%^^A
%     \entry{\optvalue{sentenceshort}, \optvalue{shortsentence},\\
%            \optvalue{SentenceS}}{%^^A
%       Sentences are referenced in short textual form.%^^A
%       \SpecialOptionIndex{ref\quotechar=sentenceshort}%^^A
%     }%^^A
%     \entry{\optvalue{short}}{%^^A
%       A combination of \optvalue{parshort} and \optvalue{sentenceshort}.%^^A
%       \SpecialOptionIndex{ref\quotechar=value}%^^A
%     }%^^A
% \end{desctabular}
% \end{table}
%
% \begin{Example}
%   Suppose you always want to reference paragraphs in the form ``paragraph 1
%   in clause 1''. As there is no predefined command for this, you have to
%   create your own definition from the available options. You can achieve
%   this easily with:%^^A
%\begin{lstcode}[gobble=1]
%  \newcommand*{\refParM}[1]{%
%    paragraph~\refParN[arabic]{#1} 
%    in clause~\refClauseN{#1}%
%  }
%\end{lstcode}
%   This new command can be used in the same way as
%   \cs{refParL}.%^^A
% \end{Example}%^^A
%
% You can find examples of results of the basic commands\,---\,this means the
% commands, that are independent from option \opt{ref}\,---\,in
% \autoref{tab:refexamples}.%^^A
% %^^A
% \begin{table}
%   \KOMAoptions{captions=topbeside}%^^A
%   \setcapindent{0pt}%^^A
%   \begin{captionbeside}{Example outputs of the \opt{ref}-independent 
%     cross reference commands}[l]
%     \begin{tabular}[t]{ll}
%       \toprule
%       Command                               & Example output \\
%       \midrule
%       \cs{refL}\marg{label}           & \S{} 1 paragraph 1 sentence 1 \\
%       \cs{refS}\marg{label}           & \S{} 1 par. 1 sent. 1 \\
%       \cs{refN}\marg{label}           & \S{} 1 I 1. \\
%       \cs{refClause}\marg{label}   & \S{} 1 \\
%       \cs{refClauseN}\marg{label}  & 1 \\
%       \cs{refParL}\marg{label}        & paragraph 1 \\
%       \cs{refParS}\marg{label}        & par. 1 \\
%       \cs{refParN}\marg{label}        & I \\
%       \cs{refParN}\toarg{arabic}\marg{label} & 1 \\
%       \cs{refParN}\toarg{roman}\marg{label} & i \\
%       \cs{refSentenceL}\marg{label}   & sentence 1 \\
%       \cs{refSentenceS}\marg{label}   & sent. 1 \\
%       \cs{refSentenceN}\marg{label}   & 1. \\
%       \bottomrule
%    \end{tabular}
%   \end{captionbeside}
%   \label{tab:refexamples}
% \end{table}
%
%
% \section{Additional Contract Environments}
% \label{sec:newenv}
%
% Some users do not use \pkg*{contract} to draft contracts or commentaries on
% individual laws but to examine different types of laws, which may not
% necessarily use the section prefix (\S) before the title of each clause but
% perhaps something like ``Art.'' or ``IAS'', and so forth. An independent
% counter is also required for each of these different clause types.
%
% \DescribeCommand{\DeclareNewJuraEnvironment}
% You can use:
% \begin{syntax}
%   \cs{DeclareNewJuraEnvironment}\marg{environment}\oarg{property list}\\%^^A
%   \marg{start commands}\marg{end commands}
% \end{syntax}
% to define new and independent environments for contracts or other legal
% texts. The argument \meta{environment} is the name of the new environment,
% of course. The \meta{start commands} are commands which will be executed at
% the beginning of the environment, as if they were added directly after
% \cs{begin}\marg{environment}. Correspondingly \meta{end commands} will be
% executed at the end of the environment, as if added directly before
% \cs{end}\marg{environment}. Without a \meta{property list} the new
% environment behaves like the \env{contract} environment, but with its own
% counters. You can use several \meta{key}|=|\meta{value} properties as a
% comma-separated \meta{property list}.  See
% \autoref{tab:DeclareNewJuraEnvironment} for the currently supported
% \meta{options}.
%
% \begin{table}
%   \captionabove{Properties provided by \cs{DeclareNewJuraEnvironment} for
%     new contract environments}\label{tab:DeclareNewJuraEnvironment}%^^A
%   \begin{desctabular}
%   \entry{|Clause=|\meta{command}}{%^^A
%     Defines the \meta{command} to which the \cs{Clause}
%     command is mapped within the environment. This \meta{command}, like the
%     one documented for \env{contract}, expects exactly one
%     argument. To use it correctly requires advanced knowledge of the
%     \pkg*{contract}'s internal functioning. Furthermore, the requirements
%     for the \meta{command} may change in future versions. Therefore it is
%     recommended not to use this option!%^^A
%   }%^^A
%   \entry{|ClauseFont=|\meta{commands}}{%^^A
%     If this property is used, a new \fnt{\meta{environment}.Clause}
%     element is defined with the
%     \meta{commands} used as its default setting. If the element was
%     previously defined as an alias, it will become an independent element
%     instead. If it has already been defined as an independent element, the
%     \meta{commands} are used as new font settings. Please note the
%     limitations for font settings in \autoref{sec:textmarkup}.%^^A
%   }%^^A
%   \entry{|SubClause=|\meta{command}}{%^^A
%     Defines the \meta{command} to which the
%     \cs{SubClause} command is mapped within the
%     environment. This \meta{command}, like the one documented for
%     \env{contract}, expects exactly one argument. To use it
%     correctly requires advanced knowledge of the \pkg*{contract}'s internal
%     functioning. Furthermore, the requirements for the \meta{command} may
%     change in future versions. Therefore it is recommended not to use this
%     property!%^^A
%   }%^^A
%   \entry{|Sentence=|\meta{command}}{%^^A
%     Defines the \meta{command} to which the \cs{Sentence}
%     is mapped within the environment. This \meta{command} must not have an
%     argument. Typically it should add one to the
%     \cnt{sentence} (using \cs{refstepcounter}) counter and display it
%     appropriately. It is particularly important to avoid adding unwanted
%     spaces.%^^A
%   }%^^A
%   \entry{|ClauseNumberFormat=|\meta{command}}{%^^A
%     Formats the numbers of clauses within the environment. The
%     \meta{command} should expect exactly one argument: the number of the
%     clause. If the \meta{command} implements a series of commands and the
%     number is the last argument of a that series, you can directly use the
%     series of commands as \meta{command}.%^^A
%   }
%   \end{desctabular}
% \end{table}
% \begin{Example}
%   To define the environment for articles we mentioned in the preface of this
%   section, it is sufficient to write:
%\begin{lstcode}[gobble=1]
%  \DeclareNewJuraEnvironment{Article}[ClauseNumberFormat=Art.~]{}{}
%\end{lstcode}
%   If we are using a \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}
%   class and want to separate the paragraphs in this environment with space
%   instead of using paragraph indentation, we can use:
%\begin{lstcode}[gobble=1]
%  \DeclareNewJuraEnvironment{Article}[ClauseNumberFormat=Art.~]
%                            {\KOMAoptions{parskip}}{}
%\end{lstcode}
%   In cross references, ``Art.'' will  of course be used instead of ``\S''.%^^A
%
%   The new environment is used like \env{contract}:
%\begin{lstcode}[gobble=1]
%  \begin{Article}
%    \Clause{}
%    Human dignity is inviolable. To respect and protect people is a
%    duty of all state authority.
%  \end{Article}
%\end{lstcode}
% \end{Example}
%
%
% \section{Support for Different Languages}
% \label{sec:babel}
%
% The \pkg*{contract} package has been developed in cooperation with a German
% lawyer. Therefore it initially supported only the languages |german|,
% |ngerman|, |austrian|, and |naustrian|. Nevertheless, it has been designed
% to support common language packages like \pkg{babel}. Users can easily make
% changes by using \cs{providecaptionname}. If you have definitive information
% about the correct legal terms and conventions of a language, please contact
% the \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} author. Support
% for English has been added in this way, and so \pkg*{contract} now also
% provides terms for the languages |english|, |american|, |british|,
% |canadian|, |USenglish|, and |UKenglish|.
%
% \DescribeCommand{\parname}
% \DescribeCommand{\partshortname}
% \DescribeCommand{\sentencename}
% \DescribeCommand{\sentenceshortname}
% These are the language-dependent terms used by \pkg*{contract}. The meaning
% of the terms and their English defaults are shown in
% \autoref{tab:captionnames}. The package itself defines them by
% using \cs{providecaptionname} inside
% \cs{begin}\targ{document} only if other requirements have not already
% been met. If you use \pkg*{contract} with an unsupported language, the
% package will throw an error.%^^A
% %^^A
% \begin{table}
%   \KOMAoptions{captions=topbeside}%^^A
%   \setcapindent{0pt}%^^A
%   \begin{captionbeside}
%     [{%^^A
%       Meanings and English defaults of language-dependent terms%^^A
%     }]{%^^A
%       Meanings and English defaults of language-dependent terms, if not
%       already defined%^^A
%     } [l]
%     \begin{tabular}[t]{lll}
%       \toprule
%       Command                   & Meaning                   & Default \\
%       \midrule
%       \cs{parname}           & long form ``paragraph''   & paragraph \\
%       \cs{parshortname}      & short form ``paragraph''  & par. \\
%       \cs{sentencename}      & long form ``sentence''    & sentence \\
%       \cs{sentenceshortname} & short form ``sentence''   & sent. \\
%       \bottomrule
%     \end{tabular}
%   \end{captionbeside}
%   \label{tab:captionnames}
% \end{table}
% 
%
%
% \section{A Detailed Example}
% \label{sec:example}
%
% You may remember the letter from the \cls{scrlttr2} chapter of the
% \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} manual
% \cite{pkg:koma-script:manual:en}, in which a club member wanted to remind
% the board about an overdue meeting that was prescribed by the club's
% by-laws. Such club by-laws are a kind of contract, and you can create them
% using \pkg*{contract}.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=1-2}]{contract-example-en.tex}%^^A
% We use class \cls{scrartcl}. Because paragraph distance instead of paragraph
% indentation is usual in club by-laws, we load the class with option
% \opt[element=parskip]{parskip=half}.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=4-4}]{contract-example-en.tex}%^^A
% The club rules are in British English. Therefore we load the \pkg{babel}
% package with the \opt{british} option too.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange={6-6,8-8}}]{contract-example-en.tex}%^^A
% We make some default font settings. Earlier versions of the example also
% loaded the \pkg{textcomp} package here for an improved section mark
% (\S). Since \LaTeX{} 2020/02/01, however, the desired functionality is
% directly integrated in the \LaTeX{} kernel.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=11-11}]{contract-example-en.tex}%^^A
% Later in the document, we want lists numbered not with Arabic numbers but with
% lower-case letters. We can do this easily with the \pkg{enumerate}
% package. Alternatively, we could have used the \pkg{enumitem} package.
%
% \lstinputcode[{moretexcs={useshorthands,defineshorthand},%^^A
%   xleftmargin=2em,%^^A
%   linerange=13-21}]{contract-example-en.tex}%^^A
% Now it is time for \pkg*{contract}. The
% \opt[element=clausemark]{clausemark=forceboth}\SpecialOptionIndex{clausemark=forceboth}
% option forces clauses to create left and right marks for the running
% head. On the other hand, we do not want \cs{section} to change the marks for
% the running head.  Therefore we use the \pstyle{myheadings} page style. This
% page style generally does not provide automatic running heads.
%
% Later, we also want a table of contents with the clauses. This can be
% achieved with the \opt{juratotoc} option. Doing so we will see that the
% default width for these numbers is insufficient for the clause numbers in
% the table of contents. With
% \opt[element=juratocnumberwidth]{juratocnumberwidth=2.5em}\SpecialOptionIndex{juratocnumberwidth\quotechar=\meta{length}},
% we reserve more space.
%
% The definition of shorthands has already been explained in
% \autoref{sec:shorthandexample}. In this example we do the same thing
% to simplify the input.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=23-23}]{contract-example-en.tex}%^^A
% It is time to begin the actual document.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=25-29}]{contract-example-en.tex}%^^A
% Like other documents, the by-laws have a title. We created it with the usual
% \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} commands%\iffalse
% (see \autoref{sec:maincls.titlepage}, starting on
% \autopageref{sec:maincls.titlepage})%\fi
% .
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=31-31}]{contract-example-en.tex}%^^A
% As already mentioned, we want to create a table of contents.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=33-37}]{contract-example-en.tex}%^^A
% Preambles are not unusual in club by-laws. Here we use
% \cs{addsec} to create one because we want it to have an entry
% in the table of contents.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=39-39}]{contract-example-en.tex}%^^A
% Here we use a small trick. The articles of the club by-laws should be numbered
% with upper-case letters instead of Arabic numbers, just as 
% the appendix sections of an article using \cls{scrartcl} are.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=41-43}]{contract-example-en.tex}%^^A
% We begin the contract with the first article.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=44-54}]{contract-example-en.tex}%^^A
% The first clause has a number and a title. We will do the same with all
% following clauses.
%
% The first paragraph of the clause contains nothing unusual. Because it is not
% the only paragraph, every paragraph will be automatically preceded by a
% paragraph number. Note that the numbering the first paragraph requires at
% least two \LaTeX{} runs. Since this is the case for the table of contents as
% well, this does not create any additional problems.
%
% In the second paragraph we have two sentences. Here we can see the shorthands
% \texttt{'S} and \texttt{'.} in action. The first one only generates the
% sentence number. The second one generates not only the full stop but also the
% sentence number. With this, both sentences are numbered.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=55-70}]{contract-example-en.tex}%^^A
% The second clause: again this contains several paragraphs, some of which
% include several sentences. The second paragraph also has a numbered list. In
% the last paragraph, we set a label, because we want to reference it later.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=72-78}]{contract-example-en.tex}%^^A
% The third clause contains something special: a cross reference. Here we use
% the long form with clause, paragraph, and sentence. If we decided later that
% sentences should not be included in the reference, we could use the
% \opt{ref=nosentence} option to set this globally.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=80-81}]{contract-example-en.tex}%^^A
% Here we have a special kind of clause. In earlier versions of the club
% by-laws, 
% this was a real clause, but it was later removed. However, the
% numbering of the following clauses should not be changed by removing this
% one. Therefore the \cs{Clause} statement has not been
% removed but supplemented by |dummy| property. With this, we also can set
% a label even though the clause will not be printed.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=82-86}]{contract-example-en.tex}%^^A
% Another article begins. To avoid problems with the paragraph numbering, we
% interrupt the \env{contract} environment.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=87-87}]{contract-example-en.tex}%^^A
% The first clause of the next article also has been deleted.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=89-98}]{contract-example-en.tex}%^^A
% Here we have a real clause again. We cross reference one of the deleted
% clauses and also set a label.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=100-104}]{contract-example-en.tex}%^^A
% Once more, this is a special kind of clause. This time we have not removed a
% clause but added one without renumbering the following clauses. To do so,
% we use \cs{SubClause}. Therefore the clause number is the
% same like the previous one but with an appended ``a''.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=106-126}]{contract-example-en.tex}%^^A
% The other clauses of this article are very usual. You already know all the
% features used for them.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=128-141}]{contract-example-en.tex}%^^A
% There follows another article no special features.
%
% \lstinputcode[{xleftmargin=2em,%^^A
%   linerange=143-143}]{contract-example-en.tex}%^^A
% Then the \LaTeX{} document ends. You can see first three pages in
% \autoref{fig:example}.%^^A
% %^^A
% \begin{figure}
%   \centering
%   \frame{\includegraphics[page=1,width=.482\textwidth,%^^A
%   height=.49\textheight,keepaspectratio]{contract-example-en}}\enskip
%   \frame{\includegraphics[page=2,width=.482\textwidth,%^^A
%   height=.49\textheight,keepaspectratio]{contract-example-en}}\par
%   \smallskip
%   \frame{\includegraphics[page=3,width=.482\textwidth,%^^A
%   height=.49\textheight,keepaspectratio]{contract-example-en}}\enskip
%   \frame{\includegraphics[page=4,width=.482\textwidth,%^^A
%   height=.49\textheight,keepaspectratio]{contract-example-en}}\par
%   \caption{The four pages of the CfCH example of
%     \protect\autoref{sec:example}}
%   \label{fig:example}
% \end{figure}
%
% \section{From \pkg*{scrjura} to \pkg*{contract}}
% \label{sec:switchpackage}
%
% If you have been using the \pkg*{scrjura} package and are now switching to
% the \pkg*{contract} package, there are a few things you need to be aware of:
% \begin{itemize}
% \item Instead of
%   \begin{syntax}
%     \cs{usepackage}\oarg{options}\targ{scrjura}\quad,
%   \end{syntax}
%   should now use
%   \begin{syntax}
%     \cs{usepackage}\oarg{options}\targ{contract}\quad.
%   \end{syntax}
%   The same \meta{options} are allowed as the \pkg*{scrjura} package
%   understands.
% \item Instead of using \cs{KOMAoptions} or \cs{KOMAoption} to set
%   \meta{options} for the \pkg*{contract} package, use \cs{contractSetup}.
% \item The \cs{Clause} and \cs{SubClause} commands now have an optional
%   argument instead of a mandatory argument. This makes more sense because it
%   is allowed to use \cs{Clause} or \cs{SubClause} without an
%   argument. Instead of braces, the list of properties must be given
%   in square brackets, for example:
%\begin{lstcode}[gobble=1]
%   \Clause[title={title of clause}]
%\end{lstcode}
%   Therefore, even more care should be taken to ensure that the values of
%   each property are enclosed in braces. Otherwise, there may be problems not
%   only with commas, but also with square brackets in the values.
% \item Check your code if you have used or redefined any internal macros as
%   several of them have been renamed.
% \end{itemize}
%
% \section{State of Development}
% \label{sec:draft}
%
% Since \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}~3.24, the
% \pkg*{scrjura} package has shared the version number of the classes and
% other important packages of
% \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}. Package
% \pkg*{contract} on the other hand now has a new version number independent
% from \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript}.
%
% Independent from the version number you should note that so far, the
% interaction of the \env{contract} environment with the many different
% settings possible with other \LaTeX{} environments, packages, or classes has
% not been tested. The main reason for this is that \pkg*{contract} is very
% specialized and far beyond the author's ordinary practice. So the author
% mostly relies on detailed user feedback.
%
%
% \MaybeStop{%
%   \printbibliography[heading=bibintoc]
%   \PrintChanges
%   \PrintIndex
% }
%
% \addpart{Implementation}
%
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% \changes{scrjura-v0.7b}{2014/11/11}{General renaming of ``Paragraph'' into
%   ``Clause''}
%
% \section{Cooperation with \pkg{hyperref}}
%
% If \pkg{hyperref} has already loaded before \pkg*{contract} the package cannot
% work correctly. So we throw an error. Maybe it would be a good idea to make
% this error fatal. But currently it is only an error.
%    \begin{macrocode}
%<*init>
\@ifpackageloaded{hyperref}{%
  \PackageError{contract}{Package hyperref already loaded}{%
    If you want to use package contract with package hyperref, you have
    to\MessageBreak
    load package contract before package hyperref.\MessageBreak
    To solve the problem, you just should move the loading of package
    hyperref\MessageBreak
    behind the loading of package contract.}%
}
%</init>
%    \end{macrocode}
%
% \section{Prerequisites}
%
% \changes{v0.92}{2024/06/07}{need at least \pkg*{scrkbase} v3.39}
% We need package \pkg{scrkbase}. We could load this also together with
% \pkg{tocbasic}, which is loaded later. But loading it on its own, we can
% require a minimum version. At least the version of 2022/11/11 would be
% needed, but the release was 2023/04/17 v3.39. So this is the version we
% request.
% \begin{description}
% \item[Todo:] Package \pkg*{contract} is no longer a
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} package. So it
%   should not use the internal
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} package
%   \pkg{scrkbase}. For keys of contract environments we can just load
%   \pkg{scrbase}. For package options we should either also switch to
%   \pkg{scrbase} or use native key-value options of \LaTeX. After doing so we
%   would be able to replace \pkg*{scrkbase} at least by \pkg{scrextend}. With
%   this package we still could use commands like
%   \cs{setkomafont}. Theoretically we would also be able to still use
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} options, but this
%   would still not be recommended.
% \end{description}
%    \begin{macrocode}
%<*init>
\RequirePackage{scrkbase}[2023/04/17]
%</init>
%    \end{macrocode}
%
% And now, \pkg{tocbasic}.
%    \begin{macrocode}
%<*init>
\RequirePackage{tocbasic}
%</init>
%    \end{macrocode}
%
% \section{Options}%
% \begin{option}{contract}
% \begin{macro}{\if@documentcontract,
%               \@documentcontractfalse,\@documentcontracttrue}
% \changes{scrjura-v3.36}{2022/01/25}{switched to a
% \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} option} Option
% \opt{contract} can be used to make the whole document to be a 
% contract. But in this case you are not allowed to reuse the \env{contract}
% environment in the document. Nor is it allowed to stop or restart the
% contract. With older \LaTeX{} this is done by adding \cs{contract} to the
% end of \cs{document}. With an up to date \LaTeX{} we us a hook.
%    \begin{macrocode}
%<*options>
\KOMA@ifkey{contract}{@documentcontract}
\IfLTXAtLeastTF{2020/10/01}{%
  \AddToHook{begindocument/end}{%
    \RelaxFamilyKey[.contract.sty]{KOMA}{contract}%
    \if@documentcontract\expandafter\contract\fi
  }%
}{%
  \g@addto@macro\document{%
    \RelaxFamilyKey[.contract.sty]{KOMA}{contract}%
    \if@documentcontract\expandafter\contract\fi
  }%
}
%</options>
%    \end{macrocode}
% \end{macro}
% \end{option}
%
% \begin{option}{juratotoc}
% \changes{scrjura-v3.39}{2022/11/11}{initial dot in member argument of
%   option storage commands removed}
% Allow to set the toc level of the entries. Value \optvalue{true} is
% the same like \optvalue{2}, value \optvalue{false} is the same like
% \cs{maxdimen}.  \changes{scrjura-v0.7}{2013/11/04}{usage of renewed
% interface with \cs{FamilyKeyState}}
% \changes{scrjura-v0.9a}{2015/03/09}{internal value storage}
% \begin{macro}{\if@juratotoc}
% \changes{scrjura-v0.6}{2011/09/29}{replaced by counter}
% \begin{counter}{juratoclevel}
% \changes{scrjura-v0.6}{2011/09/29}{definition moved}
% \changes{scrjura-v3.27}{2019/02/25}{removed}
% \begin{macro}{\toclevel@cpar}
% \changes{scrjura-v0.7}{2013/06/09}{new, because of \pkg{hyperref}}
% \changes{scrjura-v3.27}{2019/02/25}{handled by \pkg{tocbasic}}
%    \begin{macrocode}
%<*options>
\KOMA@key{juratotoc}[true]{%
  \KOMA@set@ifkey{juratotoc}{@tempswa}{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \if@tempswa
      \DeclareTOCStyleEntry[level=2]{default}{cpar}%
    \else
      \DeclareTOCStyleEntry[level=\maxdimen]{default}{cpar}%
    \fi
  \else
    \DeclareTOCStyleEntry[level=#1]{default}{cpar}%
  \fi
  \KOMA@kav@xreplacevalue{contract.sty}{juratotoc}{\cpartocdepth}%
}
\KOMA@kav@xadd{contract.sty}{juratotoc}{\cpartocdepth}%
%</options>
%    \end{macrocode}
% \end{macro}
% \end{counter}
% \end{macro}
% \end{option}
%
% \begin{option}{juratocnumberwidth,juratocindent}
% \changes{scrjura-v0.6}{2011/09/29}{new}
% \changes{scrjura-v0.7}{2013/11/04}{usage of renewed interface with
%   \cs{FamilyKeyState}}
% \changes{scrjura-v0.9a}{2015/03/09}{internal value storage}
% \changes{scrjura-v3.39}{2022/11/11}{initial dot in member argument of option storage
%   commands removed}
% \begin{ilength}{\cpar@numberwidth,\cpar@indent}
% \changes{scrjura-v0.6}{2011/09/29}{new}
% \changes{scrjura-v3.27}{2019/02/25}{replaced by usage of \cs{DeclareTOCStyleEntry}}
% Indent and number width of the toc entries.
% \begin{description}
% \item[Todo:] Since we are using package \pkg{tocbasic} for the ToC entries
%   these options (and lengths) are not needed any longer, but users should
%   use \cs{DeclareTOCStyleEntry} to setup the number width and indent of the
%   entries.
% \end{description}
%    \begin{macrocode}
%<*options>
\KOMA@key{juratocnumberwidth}{%
  \DeclareTOCStyleEntry[numwidth=#1]{default}{cpar}%
  \FamilyKeyStateProcessed
  \KOMA@kav@replacevalue{contract.sty}{juratocnumberwidth}{#1}%
}
\KOMA@kav@add{contract.sty}{juratocnumberwidth}{2em}
\KOMA@key{juratocindent}{%
  \DeclareTOCStyleEntry[indent=#1]{default}{cpar}%
  \FamilyKeyStateProcessed
  \KOMA@kav@replacevalue{contract.sty}{juratocindent}{#1}%
}
\KOMA@kav@add{contract.sty}{juratocindent}{1.5em}%
%</options>
%    \end{macrocode}
% \end{ilength}
% \end{option}
%
% \begin{option}{juratitlepagebreak}
% \changes{scrjura-v0.5b}{2010/04/05}{new}
% The options sets the boolean \cs{if@juratitlepagebreak}.
% \begin{macro}{\if@juratitlepagebreak,
%               \@juratitlepagebreaktrue,\@juratitlepagebreakfalse}
% If the boolean is \cs{iftrue} page breaks inside clause headings are
% allowed (which is not recommended).
% \begin{description}
% \item[Todo:] Re-implementation either using a native key-value option (easy)
%   or a new \pkg{scrbase} family.
% \end{description}
%    \begin{macrocode}
%<*options>
\KOMA@ifkey{juratitlepagebreak}{@juratitlepagebreak}
%</options>
%    \end{macrocode}
% \end{macro}
% \end{option}
%
% \begin{option}{parnumber}
% \changes{scrjura-v0.6}{2011/09/29}{new}
% \changes{scrjura-v0.6a}{2012/10/15}{value mistake message changed}
% \changes{scrjura-v0.7}{2013/11/04}{usage of renewed interface with
%   \cs{FamilyKeyState}}
% \changes{scrjura-v0.9a}{2015/03/09}{internal value storage}
% \changes{scrjura-v3.28}{2019/11/18}{\cs{ifstr} renamed into \cs{Ifstr}}
% \changes{scrjura-v3.39}{2022/11/11}{initial dot in member argument of option storage
%   commands removed}
% The options switches the (automatic) paragraph numbering.
% \begin{description}
% \item[Todo:] Re-implementation either using a native key-value option (easy)
%   or a new \pkg{scrbase} family.
% \end{description}
%    \begin{macrocode}
%<*options>
\newif\ifparnumber
\KOMA@key{parnumber}[true]{%
  \Ifstr{#1}{auto}{%
    \AutoPar
    \FamilyKeyStateProcessed
    \KOMA@kav@remove{contract.sty}{parnumber}{manual}%
    \KOMA@kav@remove{contract.sty}{parnumber}{auto}%
    \KOMA@kav@add{contract.sty}{parnumber}{auto}%
  }{%
    \Ifstr{#1}{manual}{%
      \ManualPar
      \FamilyKeyStateProcessed
      \KOMA@kav@remove{contract.sty}{parnumber}{manual}%
      \KOMA@kav@remove{contract.sty}{parnumber}{auto}%
      \KOMA@kav@add{contract.sty}{parnumber}{manual}%
    }{%
      \KOMA@set@ifkey{parnumber}{parnumber}{#1}%
      \KOMA@kav@replacebool{contract.sty}{parnumber}{parnumber}%
    }%
  }%
}
\KOMA@kav@add{contract.sty}{parnumber}{true}
\KOMA@kav@add{contract.sty}{parnumber}{auto}
%</options>
%    \end{macrocode}
% \end{option}
%
% \begin{option}{paragraphmark,clausemark}
% \changes{scrjura-v0.9h}{2016/04/11}{\opt{paragraphmark} renamed to
%   \opt{clausemark}}
% \changes{scrjura-v0.7}{2013/11/04}{usage of renewed interface with
%   \cs{FamilyKeyState}}
% \changes{scrjura-v0.9a}{2015/03/09}{internal value storage}
% \changes{scrjura-v3.39}{2022/11/11}{initial dot in member argument of option
%   storage commands removed}
% \begin{description}
% \item[Todo:] Re-implementation either using a native key-value option
%   or a new \pkg{scrbase} family (easy).
% \end{description}
%   \begin{option}{markright,markboth}
% \changes{scrjura-v0.7}{2013/11/04}{deprecated}
% \changes{scrjura-v3.39}{2022/11/16}{only with \KOMAScript~3}
% \begin{description}
% \item[Todo:] Remove deprecated options, because they need an internal
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} macro.
% \end{description}
% \begin{command}{\Clausemark}
% \changes{scrjura-v0.5e}{2011/08/31}{support for \cs{MakeMarkcase}}
% The options are used to activate either \cs{markright} or \cs{markboth} for
% clauses. \cs{Clausemark} expects not only the title but also the
% number. So it differs from, e.g., \cs{chaptermark}, which uses the counter
% automatically. But maybe I will change this some time.
%    \begin{macrocode}
%<*options>
\newcommand*{\Clausemark}[1]{}
\KOMA@key{clausemark}{%
  \begingroup
    \KOMA@set@ncmdkey{clausemark}{@tempa}{%
      {false}{0},{off}{0},{no}{0},%
      {forceright}{1},%
      {forceboth}{2},%
      {right}{3},%
      {both}{4}%
    }{#1}%
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \ifcase\number\@tempa
      \endgroup
      \let\Clausemark\@gobble
    \or
      \endgroup
      \renewcommand*{\Clausemark}[1]{%
        \markright{\csname MakeMarkcase\endcsname{##1}}}%
    \or
      \endgroup
      \renewcommand*{\Clausemark}[1]{%
        \markboth{\csname MakeMarkcase\endcsname{##1}}%
                 {\csname MakeMarkcase\endcsname{##1}}}%
    \or
      \endgroup
      \renewcommand*{\Clausemark}[1]{%
        \ifx
          \@mkboth\@gobbletwo
        \else
          \markright{\csname MakeMarkcase\endcsname{##1}}%
        \fi}%
    \or
      \endgroup
      \renewcommand*{\Clausemark}[1]{%
        \@mkboth{\csname MakeMarkcase\endcsname{##1}}%
                {\csname MakeMarkcase\endcsname{##1}}}%
    \else
      \endgroup
    \fi
    \FamilyKeyStateProcessed
  \else
    \endgroup
    \FamilyKeyStateUnknownValue
  \fi
  \KOMA@kav@xreplacevalue{contract.sty}{clausemark}{#1}%
}
\KOMA@kav@add{contract.sty}{clausemark}{false}
\@ifundefined{KOMA@DeclareDeprecatedOption}{}{%
  \KOMA@DeclareDeprecatedOption[contract]{markright}{clausemark=forceright}%
  \KOMA@DeclareDeprecatedOption[contract]{markboth}{clausemark=forceboth}%
}
\KOMA@key{paragraphmark}{%
  \PackageWarningNoLine{contract}{%
    You've used obsolete option `paragraphmark'.\MessageBreak
    Usage of this option is deprecated.\MessageBreak
    You should simply replace `paragraphmark'\MessageBreak
    by `clausemark'%
  }%
  \KOMAExecuteOptions[.contract.sty]{clausemark=#1}%
}
%</options>
%    \end{macrocode}
% \end{command}
% \end{option}
% \end{option}
%
% \begin{option}{ref}
% \changes{scrjura-v0.5d}{2010/06/07}{new values \optvalue{nopar},
%   \optvalue{nosentence}, \optvalue{OnlyParagraph}}
% \changes{scrjura-v0.7}{2013/11/04}{usage of renewed interface with
%   \cs{FamilyKeyState}}
% \changes{scrjura-v0.9a}{2015/03/09}{internal value storage}
% \changes{scrjura-v3.39}{2022/11/11}{initial dot in member argument of option
%   storage commands removed}
% \begin{description}
% \item[Todo:] Re-implementation either using a native key-value option
%   or a new \pkg{scrbase} family (easy).
% \end{description}
% \begin{option}{parcitename,sentencecitename}
% \changes{scrjura-v0.5d}{2010/06/07}{deprecated}
% \changes{scrjura-v3.39}{2022/11/16}{only with \KOMAScript~3}
% The formatting of the references of paragraphs and sentences. There are a
% long a short and a numeric form.
% \begin{description}
% \item[Todo:] Remove deprecated options, because they need an internal
%   \href{https://www.ctan.org/pkg/koma-script}{\KOMAScript} macro.
% \end{description}
% \begin{macro}{\parcite@format,\sentencecite@format}
% Default is the long form. Corresponding values of the two helper macros are:
% 0 = long, 1 = short, 2 = numerical, -1 = nothing.
%    \begin{macrocode}
%<*options>
\newcommand*{\parcite@format}{0}
\newcommand*{\sentencecite@format}{0}
%    \end{macrocode}
% \end{macro}
% The options can be used to change the default.
%    \begin{macrocode}
\KOMA@key{ref}{%
  \begingroup
    \KOMA@set@ncmdkey{ref}{@tempa}{%
      {parlong}{1},{longpar}{1},{ParL}{1},%
      {parshort}{2},{shortpar}{2},{ParS}{2},%
      {parnumeric}{3},{numericpar}{3},{ParN}{3},%
      {paroff}{4},{nopar}{4},%
      {sentencelong}{10},{longsentence}{10},{SentenceL}{10},%
      {sentenceshort}{20},{shortsentence}{20},{SentenceS}{20},%
      {sentencenumeric}{30},{numericsentence}{30},{SentenceN}{30},%
      {sentenceoff}{40},{nosentence}{40},%
      {long}{11},%
      {short}{22},%
      {numeric}{33},%
      {paragraphonly}{44},{onlyparagraph}{44},%
      {ParagraphOnly}{44},{OnlyParagraph}{44}%
    }{#1}%
    \ifx\FamilyKeyState\FamilyKeyStateProcessed
      \aftergroup\FamilyKeyStateProcessed
      \@tempcnta=\@tempa\relax
      \@tempcntb=\z@
      \@whilenum \@tempcnta>9 \do{%
        \advance\@tempcnta -10\relax
        \advance\@tempcntb \@ne\relax
      }%
      \ifcase \@tempcnta
      \or
        \aftergroup\def\aftergroup\parcite@format
        \aftergroup{\aftergroup0\aftergroup}%
      \or
        \aftergroup\def\aftergroup\parcite@format
        \aftergroup{\aftergroup1\aftergroup}%
      \or
        \aftergroup\def\aftergroup\parcite@format
        \aftergroup{\aftergroup2\aftergroup}%
      \or
        \aftergroup\def\aftergroup\parcite@format
        \aftergroup{\aftergroup-\aftergroup1\aftergroup}%
      \fi
      \ifcase \@tempcntb
      \or
        \aftergroup\def\aftergroup\sentencecite@format
        \aftergroup{\aftergroup0\aftergroup}%
      \or
        \aftergroup\def\aftergroup\sentencecite@format
        \aftergroup{\aftergroup1\aftergroup}%
      \or
        \aftergroup\def\aftergroup\sentencecite@format
        \aftergroup{\aftergroup2\aftergroup}%
      \or
        \aftergroup\def\aftergroup\sentencecite@format
        \aftergroup{\aftergroup-\aftergroup1\aftergroup}%
      \fi
    \else
      \aftergroup\FamilyKeyStateUnknownValue
    \fi
  \endgroup
  \ifx\FamilyKeyState\FamilyKeyStateProcessed
    \KOMA@kav@removekey{contract.sty}{ref}%
    \ifcase\parcite@format
      \KOMA@kav@add{contract.sty}{ref}{parlong}%
    \or
      \KOMA@kav@add{contract.sty}{ref}{parshort}%
    \or
      \KOMA@kav@add{contract.sty}{ref}{parnumeric}%
    \or
      \KOMA@kav@add{contract.sty}{ref}{paroff}%
    \fi
    \ifcase\sentencecite@format
      \KOMA@kav@add{contract.sty}{ref}{sentencelong}%
    \or
      \KOMA@kav@add{contract.sty}{ref}{sentenceshort}%
    \or
      \KOMA@kav@add{contract.sty}{ref}{sentencenumeric}%
    \or
      \KOMA@kav@add{contract.sty}{ref}{sentenceoff}%
    \fi
  \fi
}
\KOMA@kav@add{contract.sty}{ref}{parlong}%
\KOMA@kav@add{contract.sty}{ref}{sentencelong}%
\@ifundefined{KOMA@DeclareDeprecatedOption}{}{%
  \KOMA@DeclareDeprecatedOption[contract]{parcitename}{ref=parlong}
  \KOMA@DeclareDeprecatedOption[contract]{sentencecitename}{ref=sentencelong}
}
%</options> 
%    \end{macrocode}
% \end{option}
% \end{option}
%
% Execute the options.
%    \begin{macrocode}
%<*postoptions>
\KOMAProcessOptions\relax
%</postoptions>
%    \end{macrocode}
%
% \changes{v0.92}{2025/11/12}{deprecated \pkg{scrjura} commands removed}
%
% \section{Contracts, Clauses, Paragraphs and Sentences}
%
% \begin{macro}{\contract@env@type}
% \changes{scrjura-v0.5d}{2010/04/28}{new}
% \changes{scrjura-v0.7b}{2014/11/03}{\cs{jura@env@type} renamed}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@env@type} renamed}
% This macro shows the currently active \pkg*{contract} environment.
%    \begin{macrocode}
%<*body>
\newcommand*{\contract@env@type}{}
%</body>
%    \end{macrocode}
% \end{macro}
%
%
% \begin{command}{\ellipsispar}
% \changes{scrjura-v0.7}{2013/05/02}{new}
% \changes{scrjura-v0.7b}{2014/11/03}{\cs{thecontractAbsoluteClause} made more
%   flexible}
% \changes{scrjura-v0.9g}{2016/03/25}{write to \file{aux}-file only \cs{if@filesw}}
% \begin{command}{\parellipsis}
% \changes{scrjura-v0.7}{2013/05/02}{new}
% Count one or more paragraphs given by the optional argument but print
% \cs{parellipsis} instead of a real paragraph. The default is either
% \cs{dots} or \cs{textellipsis} if available.
% \changes{scrjura-v0.7}{2013/05/02}{new}
%    \begin{macrocode}
%<*body>
\newcommand*{\ellipsispar}[1][1]{%
  \begingroup
    \KOMAoptions{parnumber=manual}\parellipsis\par
    \addtocounter{par}{#1}%
    \if@filesw
      \protected@write\@auxout{}{%
        \string\newmaxpar{\contract@env@type}%
                         {\csname the\contract@env@type 
                           AbsoluteClause\endcsname}%
                         {\thepar}%
      }%
    \fi
  \endgroup
  \addtocounter{par}{-1}\refstepcounter{par}%
  \ignorespaces
}
\newcommand*{\parellipsis}{%
  \scr@ifundefinedorrelax{textellipsis}{\dots}{\textellipsis}%
}
%</body>
%    \end{macrocode}
% \end{command}
% \end{command}
%
% \begin{environment}{contract}
% \changes{scrjura-v0.5d}{2010/04/28}{missing error message added}
% \changes{scrjura-v0.5d}{2010/04/28}{not self-redefining any more}
% \changes{scrjura-v0.5d}{2010/04/28}{defining \cs{jura@env@type}}
% \changes{scrjura-v3.36}{2022/01/25}{defining an environment (because of hooks)}
% \begin{macro}{\if@contract@skiphyperref}
% \changes{v0.0.1}{2023-10-10}{\cs{if@scrjura@skiphyperref} renamed}
% \begin{counter}{contractClause}
% \begin{command}{\thecontractClause}
% \changes{scrjura-v0.9b}{2015/05/01}{must use counter \cnt{Clause} instead of
%   \cnt{contractClause}}
% \begin{macro}{\contract@Clauseformat}
% \begin{command}{\Clauseformat,\paragraphformat}
% \changes{scrjura-v0.6b}{2013/04/16}{redefinition of \cs{paragraphformat}}
% \begin{counter}{contractSubClause}
% \changes{scrjura-v0.9b}{2015/05/01}{must use counter \cnt{SubClause} instead of
%   \cnt{contractSubClause}}
% \begin{command}{\thecontractSubClause}
% \begin{counter}{contractAbsoluteClause}
% \changes{scrjura-v0.7}{2013/04/18}{new (internal) counter for all clauses to make
%   it possible to reset the users clause counter}
% It is not allowed to nest the \env{contract} environments, but you can end
% them and start them new. But this would not end the contract and start a new
% contract but only delay it for some other code.
%    \begin{macrocode}
%<*body>
\newenvironment{contract}{%
  \ifx\contract@env@type\@empty
    \let\@doendpe\contract@doendpe
    \let\Clause\contract@paragraph
    \let\c@Clause\c@contractClause
    \edef\cl@Clause{\cl@Clause\cl@contractClause}%
    \let\SubClause\contract@subparagraph
    \let\c@SubClause\c@contractSubClause
    \edef\cl@SubClause{\cl@SubClause\cl@contractSubClause}%
    \let\Sentence\contract@sentence
    \renewcommand*{\contract@env@type}{contract}%
    \aliaskomafont{Clause}{contract.Clause}%
  \else
    \PackageError{contract}{nested `contract` detected}{%
      You may not use a `contract' environment inside\MessageBreak
      a `\contract@env@type' environment or after loading\MessageBreak
      package `contract' with option `\contract@env@type'!}%
  \fi
}{}
\let\if@contract@skiphyperref\iftrue
\let\cl@Clause\@empty
\let\cl@SubClause\@empty
\newcounter{contractClause}
\renewcommand*{\thecontractClause}{%
  {\contract@Clauseformat{\arabic{Clause}}}}
\DeclareRobustCommand*{\contract@Clauseformat}[1]{\Clauseformat{#1}}
\newcommand*{\Clauseformat}[1]{\S~#1}
\newcounter{contractSubClause}
\@addtoreset{SubClause}{Clause}
\renewcommand*{\thecontractSubClause}{%
  {\theClause\alph{SubClause}}}
\newcounter{contractAbsoluteClause}
%</body>
%    \end{macrocode}
% \end{counter}
% \end{command}
% \end{counter}
% \end{command}
% \end{macro}
% \end{command}
% \end{counter}
% \end{macro}
% \end{environment}
%
% \begin{command}{\DeclareNewJuraEnvironment}
% \changes{scrjura-v0.9}{2014/11/12}{new}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% Using \cs{@defjuraenvironment} to define a new juristic environment. This
% can be done only in document preamble.
%    \begin{macrocode}
%<*body>
\newcommand*{\DeclareNewJuraEnvironment}[1]{%
  \@ifundefined{#1}{\expandafter\let\csname #1\expandafter\endcsname
    \csname end#1\endcsname}{}%
  \@ifundefined{#1}{\let\reserved@defjuraenvironment\@defjuraenvironment}{%
    \PackageError{contract}{ignorring declaration of `#1'}{%
      You've tried to declare jura environment `#1', but
      environment\MessageBreak
      `#1' or command
      \expandafter\string\csname #1\endcsname\space or
      \expandafter\string\csname end#1\endcsname\MessageBreak
      already exists.\MessageBreak
      Declaration will be ignored}%
    \long\def\reserved@defjuraenvironment##1[##2]##3##4{}%
  }%
  \kernel@ifnextchar [%]
    {\reserved@defjuraenvironment{#1}}{\reserved@defjuraenvironment{#1}[]}%
}
\@onlypreamble\DeclareNewJuraEnvironment
%    \end{macrocode}
% \begin{macro}{\@defjuraenvironment}
% \changes{scrjura-v0.9}{2014/11/04}{new}
% \changes{scrjura-v3.25}{2017/12/08}{new command options \texttt{ClauseFont}}
% \changes{scrjura-v3.25}{2017/12/08}{\cs{reserved@defjuraenvironment} set
%   back to \cs{relax}}
% \changes{scrjura-v3.25}{2017/12/08}{using local instead of global command
%   options}
% This command is used to define a new \pkg*{contract} environment like
% \env{contract}. Several options are provided (see the user manual for
% details).
%    \begin{macrocode}
\DefineFamily{KOMAarg}
\DefineFamilyMember{KOMAarg}
\newcommand{\@defjuraenvironment}{}
\long\def\@defjuraenvironment#1[#2]#3#4{%
  \let\reserved@defjuraenvironment\relax
%    \end{macrocode}
% The counters:
%    \begin{macrocode}
  \newcounter{#1Clause}%
  \newcounter{#1AbsoluteClause}%
  \newcounter{#1SubClause}%
  \FamilyCSKey[.contract.sty]{KOMAarg}{Clause}{#1@Clause}%
  \FamilyCSKey[.contract.sty]{KOMAarg}{SubClause}{#1@SubClause}%
  \FamilyCSKey[.contract.sty]{KOMAarg}{Sentence}{#1@Sentence}%
  \DefineFamilyKey[.contract.sty]{KOMAarg}{ClauseNumberFormat}{%
    \expandafter\def\csname #1@Clauseformat \endcsname####1{##1{####1}}%
    \expandafter\edef\csname #1@Clauseformat\endcsname{%
      \noexpand\protect\expandafter\noexpand\csname #1@Clauseformat \endcsname
    }%
    \FamilyKeyStateProcessed
  }
  \DefineFamilyKey[.contract.sty]{KOMAarg}{ClauseFont}{%
    \IfExistskomafont{#1.Clause}{%
      \IfIsAliaskomafont{#1.Clause}{%
        \expandafter\let\csname scr@fnt@instead@#1.Clause\endcsname\relax
        \newkomafont{#1.Clause}{##1}%
      }{\setkomafont{#1.Clause}{##1}}%
    }{%
      \newkomafont{#1.Clause}{##1}%
    }%
  }
  \FamilyExecuteOptions[.contract.sty]{KOMAarg}{#2}%
  \RelaxFamilyKey[.contract.sty]{KOMAarg}{ClauseFont}%
  \RelaxFamilyKey[.contract.sty]{KOMAarg}{ClauseNumberFormat}%
  \RelaxFamilyKey[.contract.sty]{KOMAarg}{Sentence}%
  \RelaxFamilyKey[.contract.sty]{KOMAarg}{SubClause}%
  \RelaxFamilyKey[.contract.sty]{KOMAarg}{Clause}%
  \@ifundefined{#1@Clauseformat}{%
    \expandafter\DeclareRobustCommand\expandafter*%
    \csname #1@Clauseformat\endcsname[1]{\Clauseformat{##1}}%
  }{}%
%    \end{macrocode}
% \changes{scrjura-v0.9c}{2015/05/13}{defining \cs{the\dots Clause}}
% \changes{scrjura-v0.9f}{2016/02/24}{\cs{protect}\cs{@nameuse} instead of
%   \cs{csname}\dots\cs{endcsname}}
% \changes{v0.92}{2026-04-23}{missing group added to \cs{the\dots Clause}}
%    \begin{macrocode}
  \expandafter\renewcommand\expandafter*\csname the#1Clause\endcsname{%
    {\protect\@nameuse{#1@Clauseformat}{\arabic{#1Clause}}}}%
%    \end{macrocode}
% Environment:
%    \begin{macrocode}
  \newenvironment{#1}{%
    \par
    \ifx\contract@env@type\@empty
      \edef\contract@env@type{#1}%
      \let\@doendpe\contract@doendpe
      \expandafter\let\expandafter\c@Clause\csname c@#1Clause\endcsname
      \edef\cl@Clause{\cl@Clause\csname cl@#1Clause\endcsname}%
      \expandafter\let\expandafter\c@SubClause
        \csname c@#1SubClause\endcsname
      \edef\cl@SubClause{\cl@SubClause
        \csname cl@#1SubClause\endcsname}%
      \@ifundefined{#1@Clause}{%
        \let\Clause\contract@paragraph
      }{%
        \expandafter\let\expandafter\Clause
        \csname #1@Clause\endcsname
      }%
      \@ifundefined{#1@SubClause}{%
        \let\SubClause\contract@subparagraph
      }{%
        \expandafter\let\expandafter\SubClause
        \csname #1@SubClause\endcsname
      }%
      \@ifundefined{#1@Sentence}{%
        \let\Sentence\contract@sentence
      }{%
        \expandafter\let\expandafter\Sentence\csname #1@Sentence\endcsname
      }%
      \@ifundefined{\contract@env@type @everypar}{%
        \expandafter\let
        \csname \contract@env@type @everypar\endcsname
        \contract@everypar
      }{}%
%    \end{macrocode}
% Font alias for \fnt{Clause}. If neither a font not an alias is defined for
% the new environment \fnt{contract.Clause} is used.
% \changes{scrjura-v3.25}{2017/12/08}{Font alias fixed}
%    \begin{macrocode}
      \IfExistskomafont{#1.Clause}{%
        \IfIsAliaskomafont{#1.Clause}{%
          \aliaskomafont{Clause}{\csname scr@fnt@instead@#1.Clause\endcsname}%
        }{%
          \aliaskomafont{Clause}{#1.Clause}%
        }%
      }{%
        \aliaskomafont{Clause}{contract.Clause}%
      }%
      #3%
    \else
      \PackageError{contract}{nested contract environments detected}{%
        You must not use a `#1' environment inside\MessageBreak
        a `\contract@env@type' environment or after loading\MessageBreak
        package `contract' with option `\contract@env@type'!}%
    \fi
  }{%
    #4%
    \par
  }%
}
%</body>
%    \end{macrocode}
% \end{macro}%^^A \@dewjuraenvironment
% \end{command}%^^A \DeclareNewJuraEnvironment
%
% \begin{macro}{\contract@paragraph}
% This is the \cs{Clause} used by contracts. A contract consists (usually) of
% several clauses. Each clause has optional elements managed by
% \meta{key}=\meta{value} pairs handled by \pkg{scrkbase} and last but not
% least by \pkg{keyval}.
% \begin{option}{title,head,nohead}
% \begin{option}{entry,noentry}
% \changes{scrjura-v0.6}{2011/09/30}{deprecated}
% \begin{option}{tocentry,notocentry}
% \changes{scrjura-v0.6}{2011/09/30}{new}
% Title, running head and toc entry of the clause. The title is the default
% for running head and toc entry. But you can also use an empty value for
% each of them or use the \texttt{no\dots} options to switch them off.
%    \begin{macrocode}
%<*body>
\define@key{contract}{title}{%
  \def\contract@title{#1}%
  \ifx\contract@entry\relax\def\contract@entry{\contract@title}\fi
  \ifx\contract@head\relax\def\contract@head{\contract@title}\fi
}
\define@key{contract}{entry}{%
  \PackageWarning{contract}{deprecated option `entry'.\MessageBreak
    You should use option `tocentry' instead of\MessageBreak
    option `entry'%
  }%
  \def\contract@entry{#1}}
\define@key{contract}{tocentry}{\def\contract@entry{#1}}
\define@key{contract}{noentry}[]{%
  \PackageWarning{contract}{deprecated option `noentry'.\MessageBreak
    You should use option `notocentry' instead of\MessageBreak
    option `noentry'%
  }%
  \let\contract@entry\relax}
\define@key{contract}{notocentry}[]{\let\contract@entry\relax}
\define@key{contract}{head}{\def\contract@head{#1}}
\define@key{contract}{nohead}[]{\let\contract@head\relax}
%    \end{macrocode}
% \end{option}
% \end{option}
% \end{option}
% \begin{option}{number}
% The number can be changed manually. But clauses without numbers are not
% allowed. So if you use an empty value, the number is automatically set.
%    \begin{macrocode}
\define@key{contract}{number}{\def\contract@number{#1}}
%    \end{macrocode}
% \end{option}
% \begin{macro}{\contract@preskip,\contract@postskip}
% \begin{option}{preskip,postskip}
% The options are used to specify the distance before and after the
% clause. The preset value of these options are the global settings done by
% |\setkeys{contract}{…}|.
%    \begin{macrocode}
\newcommand*{\contract@preskip}{2\baselineskip}
\newcommand*{\contract@postskip}{\baselineskip}
\define@key{contract}{preskip}{\def\contract@preskip{#1}}
\define@key{contract}{postskip}{\def\contract@postskip{#1}}
%    \end{macrocode}
% \end{option}
% \end{macro}
% \begin{option}{dummy}
% The option switches the boolean \cs{ifcontract@dummy}.
% \begin{macro}{\ifcontract@dummy}
% If the boolean is \cs{iftrue} the clause will not be printed. But note: you
% cannot use this to remove the paragraphs or sentences of the clause. But you
% can use this option to generate holes in the numbering without manually
% manipulating the counters.
%    \begin{macrocode}
\newif\ifcontract@dummy
\define@key{contract}{dummy}[true]{\csname contract@dummy#1\endcsname}
%    \end{macrocode}
% \end{macro}
% \end{option}
% \begin{fontelement}{contract.Clause}
% \begin{macro}{\contract@paragraph@font}
% \changes{scrjura-v3.25}{2017/12/08}{using element \fnt{Clause} instead of
%   \fnt{contract.Clause}}
% Correctly this macro should be named \cs{contract@paragraph@format}. But it
% is already used by some users for ugly tricks. So I will not rename it to
% avoid problems for existing documents. Additionally it would be better to
% use a new macro per environment. However the same reason not to change this.
%    \begin{macrocode}
\newkomafont{contract.Clause}{\sffamily\bfseries\large}
\newcommand*{\contract@paragraph@font}{\usekomafont{Clause}%
  \@hangfrom}
%    \end{macrocode}
% \end{macro}
% \end{fontelement}
% \begin{counter}{@AbsClause}
% \begin{macro}{\theH@AbsClause}
% \changes{scrjura-v3.41}{2023/06/24}{Ulrike Fischer requested to use \cs{def} instead
%   of \cs{newcommand*}}
% \begin{command}{\theHClause,\theHSubClause}
% \changes{scrjura-v3.41}{2023/06/24}{Ulrike Fischer requested to use \cs{def} instead
%   of \cs{newcommand*}}
%    \begin{macrocode}
% Here we have some not good tested code for \pkg{hyperref}.
\newcounter{@AbsClause}
\def\theH@AbsClause{P-\arabic{@AbsClause}}
\def\theHClause{\theH@AbsClause}
\def\theHSubClause{\theH@AbsClause}
%    \end{macrocode}
% \end{command}
% \end{macro}
% \end{counter}
% For the headings we use manual paragraph numbering, because we don't want
% any paragraph numbering inside the heading. After initializing the options
% they are processed.
% \changes{scrjura-v0.7}{2013/04/18}{increase counter
%   \cnt{contractAbsoluteClause}}
% \changes{scrjura-v0.7b}{2014/11/03}{more flexible
%   \cnt{\meta{environment}AbsoluteClause}}
% \changes{v0.0.2}{2024/01/23}{the argument is optional}
%    \begin{macrocode}
\NewDocumentCommand\contract@paragraph {o} {%
  \stepcounter{\contract@env@type AbsoluteClause}%
  \ManualPar\parnumbertrue
  \let\contract@title\relax
  \let\contract@entry\relax
  \let\contract@head\relax
  \let\contract@number\relax
  \contract@dummyfalse
  \IfValueT{#1}{\setkeys{contract}{#1}}%
%    \end{macrocode}
% Unless this is a dummy clause, the headings will be initialized and vertical
% skips will be done.
% \changes{scrjura-v0.6a}{2012/10/08}{missing \cs{par} added}
%    \begin{macrocode}
  \ifcontract@dummy\else
    \par
    \@afterindentfalse
    \addvspace{\contract@preskip}%
  \fi
%    \end{macrocode}
% If there isn't a manual number, we use the next number. If there is a manual
% number, this number is printed and we take care that labels and
% \pkg{hyperref} also use the manual number.
% \changes{scrjura-v0.6b}{2013/04/16}{using \cs{contract@Clauseformat} for manual
%   numbers too}
% \changes{scrjura-v0.9c}{2015/05/13}{\cs{thecontractClause} replaced by
%   environment-dependent macro}
%    \begin{macrocode}
  \ifx\contract@number\relax
    \let\p@Clause\@empty
    \expandafter\let\expandafter\theClause
      \csname the\contract@env@type Clause\endcsname
    \refstepcounter{Clause}%
  \else
    \begingroup
      \let\@elt\@stpelt
      \cl@Clause
    \endgroup
%    \end{macrocode}
% \changes{scrjura-v0.9f}{2016/02/24}{\cs{protect}\cs{@nameuse} instead of
%   \cs{csname}\dots\cs{endcsname}}
% \changes{scrjura-v3.41}{2023/06/24}{update of \cs{@currentcounter} added}
%    \begin{macrocode}
    \protected@edef\theClause{%
      \protect\@nameuse{\contract@env@type @Clauseformat}{\contract@number}%
    }%
    \protected@edef\@currentlabel{\theClause}%
    \def\@currentcounter{Clause}%
  \fi
  \stepcounter{@AbsClause}%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname if@skiphyperref\endcsname\relax
  \else
    \expandafter\let\csname if@contract@skiphyperref\expandafter\endcsname
    \csname if@skiphyperref\endcsname
  \fi
  \if@contract@skiphyperref\else
    \hyper@refstepcounter{@AbsClause}%
%<+trace>    \typeout{absolute Number: \the@AbsClause^^JLabel: `\@currentHref'}%
  \fi
%    \end{macrocode}
% For simplification we use the code of clauses for sub-clauses.
%    \begin{macrocode}
  \let\theSubClause\theClause
%    \end{macrocode}
% Unless for dummy clauses, the heading is printed, the toc entry is done
% and also the running head.
% \changes{scrjura-v0.7}{2013/04/28}{distance behind the number is part of the number}
% \changes{scrjura-v0.9i}{2017/02/23}{usage of \cs{ext@toc}}
%    \begin{macrocode}
  \ifcontract@dummy\else
    \begingroup
      \if@juratitlepagebreak\else\interlinepenalty\@M\fi
      \contract@paragraph@font{\theClause
        \ifx\contract@title\relax\else\enskip\fi}%
      \contract@title
      \ifx\contract@entry\relax\else
        \expandafter\addxcontentsline\expandafter{\ext@toc}%
        {cpar}[\theClause]\contract@entry
        \addxcontentsline{cpa}{cpar}[\theClause]\contract@entry
      \fi
      \ifx\contract@head\relax\else
        \expandafter\Clausemark\expandafter{%
          \expandafter\theSubClause\expandafter\enskip\contract@head}%
      \fi
      \par
    \endgroup\nobreak\vskip\contract@postskip
%    \end{macrocode}
% Last but not least paragraph numbering is initialized.
%    \begin{macrocode}
    \contract@afterheading
  \fi
}
%</body>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\contract@subparagraph}
% \changes{scrjura-v0.6a}{2012/10/08}{missing \cs{par} added}
% \changes{scrjura-v0.7}{2013/04/18}{increasing counter
%    \cnt{contractAbsoluteClause}}
% \changes{scrjura-v0.7}{2013/04/28}{distance after number}
% \changes{scrjura-v0.9i}{2017/02/23}{usage of \cs{ext@toc}}
% \changes{scrjura-v3.41}{2023/06/24}{update of \cs{@currentcounter} added}
% \changes{v0.0.2}{2024/01/23}{the argument is optional}
% This is almost the same like \cs{contract@paragraph}.
%    \begin{macrocode}
%<*body>
\NewDocumentCommand \contract@subparagraph {o}{%
  \stepcounter{\contract@env@type AbsoluteClause}%
  \ManualPar\parnumbertrue
  \let\contract@title\relax
  \let\contract@entry\relax
  \let\contract@head\relax
  \let\contract@number\relax
  \contract@dummyfalse
  \IfValueT{#1}{\setkeys{contract}{#1}}%
  \ifcontract@dummy\else
    \par
    \@afterindentfalse
    \vskip\contract@preskip
  \fi
  \ifx\contract@number\relax
    \let\p@SubClause\@empty
    \let\theSubClause\thecontractSubClause
    \refstepcounter{SubClause}%
  \else
    \begingroup
      \let\@elt\@stpelt
      \cl@SubClause
    \endgroup
    \protected@edef\theSubClause{\theClause\contract@number}%
    \protected@edef\@currentlabel{\theSubClause}%
    \def\@currentcounter{SubClause}%
  \fi
  \stepcounter{@AbsClause}%
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname if@skiphyperref\endcsname\relax
  \else
    \expandafter\let\csname if@contract@skiphyperref\expandafter\endcsname
    \csname if@skiphyperref\endcsname
  \fi
  \if@contract@skiphyperref\else
    \hyper@refstepcounter{@AbsClause}%
%<+trace>    \typeout{absolute Number: \the@AbsClause^^JLabel: `\@currentHref'}%
  \fi
  \ifcontract@dummy\else
    \begingroup
      \if@juratitlepagebreak\else\interlinepenalty\@M\fi
      \contract@paragraph@font{\theSubClause
        \ifx\contract@title\relax\else\enskip\fi}%
      \contract@title
      \ifx\contract@entry\relax\else
        \expandafter\addxcontentsline\expandafter{\ext@toc}%
        {cpar}[\theSubClause]\contract@entry
        \addxcontentsline{cpa}{cpar}[\theSubClause]\contract@entry
      \fi
      \ifx\contract@head\relax\else
        \expandafter\Clausemark\expandafter{%
          \expandafter\theSubClause\expandafter\enskip\contract@head}%
      \fi
      \par
    \endgroup
    \nobreak\vskip\contract@postskip
    \contract@afterheading
  \fi
}
%</body>
%    \end{macrocode}
% \end{macro}
%
% \begin{command}{\AutoPar,\ManualPar}
% Switching between automatic or manual paragraph numbers for all
% \pkg*{contract} environments.
%    \begin{macrocode}
%<*body>
\newcommand*{\AutoPar}{%
  \expandafter\let\expandafter\contract@used@everypar
  \csname \contract@env@type @everypar\endcsname
}
\newcommand*{\ManualPar}{%
  \let\contract@used@everypar\relax
}
%</body>
%    \end{macrocode}
% \end{command}
%
% \begin{macro}{\contract@afterheading}
% \changes{scrjura-v0.7b}{2014/11/03}{\cs{jura@afterheading} renamed}
% \changes{scrjura-v0.7b}{2014/11/03}{no argument}
% \changes{scrjura-v3.27}{2019/02/25}{\cs{CheckCommand} for \cs{@afterheading}}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@afterheading} renamed}
% Similar to \cs{afterheading} but with automatic paragraph numbers.
% \begin{description}
% \item[ToDo:] Test if this can be done using \LaTeX{} hooks, depending on the
%   \LaTeX{} release.
% \end{description}
%    \begin{macrocode}
%<*body>
\CheckCommand*{\@afterheading}{%
  \@nobreaktrue
  \everypar{%
    \if@nobreak
      \@nobreakfalse
      \clubpenalty \@M
      \if@afterindent \else
        {\setbox\z@\lastbox}%
      \fi
    \else
      \clubpenalty \@clubpenalty
      \everypar{}%
    \fi}%
}
\newcommand*{\contract@afterheading}{%
  \@nobreaktrue
  \everypar{%
    \if@nobreak
      \@nobreakfalse
      \clubpenalty \@M
      \if@afterindent \else
        {\setbox\z@\lastbox}%
      \fi
    \else
      \clubpenalty \@clubpenalty
      \everypar{%
        \contract@used@everypar
      }%
    \fi
    \contract@used@everypar
  }%
  \AutoPar
}
%    \end{macrocode}
% \begin{macro}{\contract@used@everypar}
% \changes{scrjura-v0.7b}{2014/11/03}{\cs{jura@everypar} renamed}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@everypar} renamed}
% The macro to be used at the very beginning of every paragraph to add the
% number. To be used only inside \pkg*{contract} environments, so empty
% outside.
%    \begin{macrocode}
\newcommand*{\contract@used@everypar}{}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@doendpe}
% \LaTeX{} used this macro, to reset all paragraph actions at the end of
% environments. To avoid unwanted switching-off of the paragraph number it
% will be reinitialized.
% \begin{macro}{\contract@doendpe}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@doendpe} renamed}
% \begin{macro}{\IncludeInRelease}
% \changes{scrjura-v0.9e}{2015/11/03}{used temporary}
% \changes{scrjura-v3.28}{2019/11/18}{\cs{ifstr} renamed into \cs{Ifstr}}
% \begin{macro}{\@gobble@IncludeInRelease}
% \changes{scrjura-v0.9e}{2015/11/03}{used temporary}
% \begin{macro}{\EndIncludeInRelease}
% \changes{scrjura-v0.9e}{2015/11/03}{used temporary}
% From \LaTeX{} 2015/01/01 a different definition of \cs{@doendpe} is used. So
% we also have to use different versions depending on the release. We do so
% with some tricks. Maybe this should be replaced by usage of
% \cs{IfLTXAtLeastTF} from already loaded \pkg{scrbase}.
% \begin{description}
% \item[Todo:] Using \cs{everypar} is evil and should be replaced by using a
%   generic paragraph hook.
% \end{description}
%    \begin{macrocode}
\providecommand*{\IncludeInRelease}[3]{%
  \PackageInfo{contract}{temporary definition of \string\IncludeInRelease}%
  \Ifstr{#1}{0000/00/00}{%
    \let\IncludeInRelease\@undefined
    \def\EndIncludeInRelease{\let\EndIncludeInRelease\@undefined}%
  }{%
    \let\EndIncludeInRelease\relax
    \long\def\@gobble@IncludeInRelease##1\EndIncludeInRelease{%
      \let\@gobble@IncludeInRelease\@undefined
    }%
    \expandafter\@gobble@IncludeInRelease
  }%
}
\IncludeInRelease{2015/01/01}{\@doendpe}{clubpenalty fix}
\CheckCommand*\@doendpe{\@endpetrue
     \def\par{\@restorepar
              \clubpenalty\@clubpenalty
              \everypar{}\par\@endpefalse}\everypar
               {{\setbox\z@\lastbox}%
                \everypar{}\@endpefalse}}
\newcommand*{\contract@doendpe}{%
  \@endpetrue
  \def\par{%
    \@restorepar
    \clubpenalty\@clubpenalty
    \everypar{%
      \csname contract@used@everypar\endcsname
    }%
    \par\@endpefalse
  }%
  \everypar{%
    {\setbox\z@\lastbox}\everypar{%
      \csname contract@used@everypar\endcsname
    }%
    \@endpefalse
  }%
}
\EndIncludeInRelease
\IncludeInRelease{0000/00/00}{\@doendpe}{clubpenalty fix}
\CheckCommand*\@doendpe{\@endpetrue
  \def\par{\@restorepar\everypar{}\par\@endpefalse}\everypar
  {{\setbox\z@\lastbox}\everypar{}\@endpefalse}}
\newcommand*{\contract@doendpe}{%
  \@endpetrue
  \def\par{%
    \@restorepar\everypar{%
      \csname contract@used@everypar\endcsname
    }%
    \par\@endpefalse
  }%
  \everypar{%
    {\setbox\z@\lastbox}\everypar{%
      \csname contract@used@everypar\endcsname
    }%
    \@endpefalse
  }%
}
\EndIncludeInRelease
%</body>
%    \end{macrocode}
% \end{macro}%^^A \EndIncludeInRelease
% \end{macro}%^^A \@gobble@IncludeInRelease
% \end{macro}%^^A \IncludeInRelease
% \end{macro}%^^A \contract@doendpe
% \end{macro}%^^A \@doendpe
% \end{macro}%^^A \contract@used@everypar
%
% \section{Entry to Table of Contents}
% \begin{macro}{\l@cpar}
% Toc entry of contract clauses.
% \changes{scrjura-v3.27}{2019/02/25}{usage of \pkg{tocbasic}}
% This is done using \pkg{tocbasic}. The definition has to be part of the
% initialization of the package, otherwise package options wouldn't be able to
% change the setting.
%    \begin{macrocode}
%<*init>
\DeclareTOCStyleEntry[%
  indent=1.5em,
  numwidth=2em,
  level=\maxdimen
]{default}{cpar}
%</init>
%    \end{macrocode}
% \end{macro}
%
% \section{Numbering of Paragraphs and Sentences}
%
% \begin{macro}{\contract@separator}
% \changes{scrjura-v0.7b}{2014/11/03}{\cs{jura@separator} renamed}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@separator} renamed}
% Used to make it possible to remove white spaces at the beginning or end.
%    \begin{macrocode}
%<*body>
\DeclareRobustCommand*{\contract@separator}[1]{#1}
%</body>
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\contract@usetype}
% \changes{scrjura-v0.5d}{2010/04/28}{new}
% \changes{scrjura-v0.7b}{2014/11/03}{\cs{jura@usetype} renamed}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@usetype} renamed}
% By default it is robust but does only call \cs{contract@@usetype} with the
% only argument.
% \begin{macro}{\contract@@usetype}
% \changes{scrjura-v0.5d}{2010/04/28}{new}
% \changes{scrjura-v0.7b}{2014/11/03}{\cs{jura@@usetype} renamed}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@@usetype} renamed}
% This second command is not robust and can easily be redefined. But by
% default it also does nothing but eating the argument.
%    \begin{macrocode}
%<*body>
\DeclareRobustCommand*{\contract@usetype}[1]{\contract@@usetype{#1}}
\newcommand*{\contract@@usetype}[1]{}
%</body>
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\contract@everypar}
% The \cs{contract@everpar} used by contracts.
% \begin{macro}{\ifparnumber,\parnumbertrue,\parnumberfalse}
% \changes{scrjura-v0.6}{2011/09/29}{moved the definition into the definition of the
%   option}
% \begin{counter}{par}
% \begin{command}{\thepar,\theHpar}
% \changes{scrjura-v3.41}{2023/06/24}{Ulrike Fischer requested to use \cs{def} instead
%   of \cs{newcommand*}}
% \begin{command}{\parformat}
% \changes{scrjura-v0.7}{2013/06/07}{new font element \fnt{parnumber}}
% \begin{command}{\parformatseparation}
% \changes{scrjura-v0.9f}{2016/02/06}{new}
% \begin{macro}{\p@par}
% \changes{scrjura-v0.5d}{2010/04/28}{added \cs{jura@usetype} with argument
%   \cs{jura@env@type}}
% \begin{command}{\withoutparnumber}
% \changes{scrjura-v3.25}{2017/12/19}{new}
% The boolean defines if paragraph numbers have to be used. If they are
% deactivated also manual paragraph numbers are deactivated and the paragraphs
% are not counted. Otherwise the paragraphs are numbered using \cs{thepar}. It
% is important to reset the paragraph counter with every clause and
% sub-clause. And for labels the parent object the clause has to be used.
%    \begin{macrocode}
%<*body>
\newcounter{par}
\renewcommand*{\thepar}{\arabic{par}}
\def\theHpar{\theH@AbsClause-\Roman{par}}
\newcommand*{\parformat}{(\thepar)}
\newcommand*{\parformatseparation}{\nobreakspace}
\newkomafont{parnumber}{}
\renewcommand*\p@par{{\contract@usetype{\contract@env@type}\theSubClause\contract@separator{\nobreakspace}}}
\@addtoreset{par}{Clause}
\@addtoreset{par}{SubClause}
\newcommand*{\withoutparnumber}{}
%</body>
%    \end{macrocode}
% \end{command}
% \end{macro}
% \end{command}
% \end{command}
% \end{command}
% \end{counter}
% \end{macro}
% \changes{scrjura-v0.5c}{2010/04/26}{first argument of \cs{newmaxpar} and second
%   argument of \cs{getmaxpar} is \meta{contract} not \meta{contractpars}}
% \changes{scrjura-v0.5c}{2010/04/26}{\cs{contract@Clauseformat} expands while writing
%   to its own argument}
% \changes{scrjura-v0.7}{2013/04/18}{using counter \cnt{contractAbsoluteClause}}
% \changes{scrjura-v0.7}{2013/05/23}{initializing sentence number for manually
%   numbered paragraphs to 0 instead of 1, because first action of
%   \cs{Sentence} is increasing the number}
% \changes{scrjura-v0.7}{2013/05/23}{recognize paragraph number of \cs{thisparnumber}}
% \changes{scrjura-v0.7}{2013/06/06}{if paragraph numbers are not completely numerical
%   always set the number}
% \changes{scrjura-v0.7b}{2014/11/03}{more flexible replacement of
%   \cnt{contractAbsoluteClause}}
% \changes{scrjura-v0.9f}{2016/02/06}{\cs{nobreakspace} replaced by
%     \cs{parformatseparation}}
% \changes{scrjura-v0.9g}{2016/03/25}{writing to \file{aux}-file \cs{if@filesw}}
%    \begin{macrocode}
%<*body>
\newcommand*{\contract@everypar}{%
  \ifparnumber
    \ifx\contract@special@par\relax
      \ifx\contract@special@reset@par\relax\else
        \global\let\thepar\contract@special@reset@par
        \global\let\contract@special@reset@par\relax
      \fi
      \refstepcounter{par}%
      \refstepcounter{sentence}%
    \else
      \ifx\contract@special@reset@par\relax
        \global\let\contract@special@reset@par\thepar
      \fi
      \global\let\thepar\contract@special@par
      \global\let\contract@special@par\relax
      \setcounter{sentence}{0}\refstepcounter{sentence}%
    \fi
    \begingroup
      \if@filesw
        \protected@write\@auxout{%
          \expandafter\let\csname \contract@env@type @Clauseformat\endcsname
          \@firstofone
        }{%
          \string\newmaxpar{\contract@env@type}%
                           {\csname the\contract@env@type 
                             AbsoluteClause\endcsname}%
                           {\thepar}%
        }%
      \fi
      \getmaxpar\@tempa{\contract@env@type}%
                       {\csname the\contract@env@type AbsoluteClause\endcsname}%
%<+trace>      \typeout{Stored max is \@tempa}%
      \def\reserved@a##1\@nnil{\def\@tempa{##1}}%
      \afterassignment\reserved@a\@tempcnta=0\@tempa\relax\@nnil
      \ifnum \@tempcnta>\@ne
        {\usekomafont{parnumber}{\parformat\parformatseparation}}%
      \else
        \def\reserved@a{\relax}%
        \ifx\@tempa\reserved@a
          \withoutparnumber
        \else
          {\usekomafont{parnumber}{\parformat\parformatseparation}}%
        \fi
      \fi
    \endgroup
  \else
    \begingroup\withoutparnumber\endgroup
    \setcounter{sentence}{-1}\refstepcounter{sentence}%
  \fi
}
%</body>
%    \end{macrocode}
% \end{macro}
%
% \begin{command}{\thisparnumber}
% \changes{scrjura-v0.7}{2013/05/23}{new}
% \begin{macro}{\contract@special@par,\contract@special@reset@par}
% \changes{scrjura-v0.7}{2013/05/23}{new}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@special@par} renamed}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@special@reset@par} renamed}
% You can use this for manual paragraph numbering. But the number has to be
% fully expandable!
%    \begin{macrocode}
%<*body>
\newcommand*{\thisparnumber}[1]{%
  \def\contract@special@par{#1}%
}
\newcommand*{\contract@special@par}{}
\let\contract@special@par\relax
\newcommand*{\contract@special@reset@par}{}
\let\contract@special@reset@par\relax
%</body>
%    \end{macrocode}
% \end{macro}%^^A \contract@special@par
% \end{command}%^^A\thisparnumber
%
%
% \section{Referencing}
%
% \begin{command}{\refL}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@L}
% Similar to \cs{ref} but always the long form.
%    \begin{macrocode}
%<*body>
\newcommand*{\refL}{\kernel@ifstar {\ref@L*}{\ref@L{}}}
\newcommand*{\ref@L}[2]{%
  \begingroup
    \def\parcite@format{0}%
    \let\sentencecite@format\parcite@format
    \ref#1{#2}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refS}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@S}
% Similar to \cs{ref} but always the short form.
%    \begin{macrocode}
\newcommand*{\refS}{\kernel@ifstar {\ref@S*}{\ref@S{}}}
\newcommand*{\ref@S}[2]{%
  \begingroup
    \def\parcite@format{1}%
    \let\sentencecite@format\parcite@format
    \ref#1{#2}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refN}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@N}
% Similar to \cs{ref} but always the numerical form.
%    \begin{macrocode}
\newcommand*{\refN}{\kernel@ifstar {\ref@N*}{\ref@N{}}}
\newcommand*{\ref@N}[2]{%
  \begingroup
    \def\parcite@format{2}%
    \let\sentencecite@format\parcite@format
    \ref#1{#2}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refClause}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@Clause}
% Reference only the clause of a clause, paragraph or sentence. For better
% compatibility with \pkg{hyperref} there is also a star version if
% \pkg{hyperref} is used. Without \pkg{hyperref} the star version is nonsense.
%    \begin{macrocode}
\newcommand*{\refClause}{%
  \kernel@ifstar {\ref@Clause*}{\ref@Clause{}}
}
\newcommand*{\ref@Clause}[2]{%
  \expandafter\ifx\csname r@#2\endcsname\relax
    \ref#1{#2}%
  \else
    \begingroup
%    \end{macrocode}
% Copy all parts of the reference but the first one to \cs{@tempb}.
%    \begin{macrocode}
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\def
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\@tempb
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter{%
        \expandafter\expandafter\expandafter\@gobble\csname r@#2\endcsname}%
%    \end{macrocode}
% Copy the first part of the reference to \cs{@tempa}.
%    \begin{macrocode}
      \def\@tempc##1##2\@nil{##1}%
      \let\contract@separator\@gobble
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \csname r@#2\endcsname\noexpand\@nil}%
%    \end{macrocode}
% Copy the first part of \cs{@tempa} to \cs{@tempb}.
%    \begin{macrocode}
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \@tempa\@nil}%
      \let\@@protect\protect
      \let\protect\noexpand
      \expandafter\edef\csname r@#2\endcsname{{\@tempa}\@tempb}%
      \let\protect\@@protect
      \ref#1{#2}%
    \endgroup
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refClauseN}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@ClauseN}
% Reference only the clause number of a clause, a paragraph or a sentence.
% For improved compatibility with \pkg{hyperref} there is also a star version
% if \pkg{hyperref} is used. Without \pkg{hyperref} the star version is
% nonsense.
%    \begin{macrocode} 
\newcommand*{\refClauseN}{%
  \kernel@ifstar {\ref@ClauseN*}{\ref@ClauseN{}}
}
\newcommand*{\ref@ClauseN}[2]{%
  \begingroup
    \let\Clauseformat\relax
    \ref@Clause{#1}{#2}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refPar}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@Par}
% References only the paragraph of a paragraph or sentence.
% For improved compatibility with \pkg{hyperref} there is also a star version
% if \pkg{hyperref} is used. Without \pkg{hyperref} the star version is
% nonsense.
%    \begin{macrocode}
\newcommand*{\refPar}{%
  \kernel@ifstar {\ref@Par*}{\ref@Par{}}
}
\newcommand*{\ref@Par}[2]{%
  \expandafter\ifx\csname r@#2\endcsname\relax
    \ref#1{#2}%
  \else
    \begingroup
%    \end{macrocode}
% Copy all parts of the reference but the first one to \cs{@tempb}.
%    \begin{macrocode}
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\def
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\@tempb
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter{%
        \expandafter\expandafter\expandafter\@gobble\csname r@#2\endcsname}%
%    \end{macrocode}
% Copy the first part of the reference to \cs{@tempa}.
%    \begin{macrocode}
      \def\@tempc##1##2\@nil{##1}%
      \let\contract@separator\@gobble
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \csname r@#2\endcsname\noexpand\@nil}%
%    \end{macrocode}
% Copy the second part of \cs{@tempa} to \cs{@tempa} ablegen.
%    \begin{macrocode}
      \def\@tempc##1##2##3\@nil{##2}%
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \@tempa{%
          \protect\G@refundefinedtrue
          \nfss@text{\reset@font\bfseries ??}%
          \@latex@warning{Reference `#2' on page \thepage \space
            with undefined par number}%
        }\noexpand\@nil}%
      \let\@@protect\protect
      \let\protect\noexpand
      \expandafter\edef\csname r@#2\endcsname{{\@tempa}\@tempb}%
      \let\protect\@@protect
      \ref#1{#2}%
    \endgroup
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refParL}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@ParX}
% The same but long.
%    \begin{macrocode}
\newcommand*{\refParL}{%
  \kernel@ifstar {\ref@ParX0*}{\ref@ParX0{}}
}
\newcommand*{\ref@ParX}[3]{%
  \begingroup
    \def\parcite@format{#1}%
    \let\sentencecite@format\parcite@format
    \ref@Par{#2}{#3}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refParS}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% The same but short.
%    \begin{macrocode}
\newcommand*{\refParS}{%
  \kernel@ifstar {\ref@ParX1*}{\ref@ParX1{}}
}
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\refParN}
% \begin{macro}{\ref@ParN}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifnextchar} replaced by
%   \cs{kernel@ifnextchar}}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@@ParN}
% The same but numerical.
%    \begin{macrocode}
\newcommand*{\refParN}{%
  \kernel@ifstar {\ref@ParN2*}{\ref@ParN2{}}
}
\newcommand*{\ref@ParN}[2]{%
  \kernel@ifnextchar [%]
    {\ref@@ParN{#1}{#2}}%
    {\ref@ParX{#1}{#2}}%
}
\newcommand*{\ref@@ParN}{}
\def\ref@@ParN#1#2[#3]#4{%
  \begingroup
    \renewcommand*{\parnumericformat}[1]{%
      \csname @#3\endcsname{\number ##1\relax}%
    }%
    \ref@ParX{#1}{#2}{#4}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{command}
%
% \begin{command}{\refSentence}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@Sentence}
% Reference only the sentence of a sentence.
% For improved compatibility with \pkg{hyperref} there is also a star version
% if \pkg{hyperref} is used. Without \pkg{hyperref} the star version is
% nonsense.
%    \begin{macrocode}
\newcommand*{\refSentence}{%
  \kernel@ifstar {\ref@Sentence*}{\ref@Sentence{}}
}
\newcommand*{\ref@Sentence}[2]{%
  \expandafter\ifx\csname r@#2\endcsname\relax
    \ref#1{#2}%
  \else
    \begingroup
%    \end{macrocode}
% Copy all parts of the reference to \cs{@tempb}.
%    \begin{macrocode}
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\def
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter\@tempb
      \expandafter\expandafter\expandafter\expandafter
      \expandafter\expandafter\expandafter{%
        \expandafter\expandafter\expandafter\@gobble\csname r@#2\endcsname}%
%    \end{macrocode}
% Copy the first part of the reference to \cs{@tempa}.
%    \begin{macrocode}
      \def\@tempc##1##2\@nil{##1}%
      \let\contract@separator\@gobble
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \csname r@#2\endcsname\noexpand\@nil}%
%    \end{macrocode}
% Copy the third part of \cs{@tempa} to \cs{@tempa}.
%    \begin{macrocode}
      \def\@tempc##1##2##3##4\@nil{##3}%
      \protected@edef\@tempa{\expandafter\expandafter\expandafter\@tempc
        \@tempa{}{%
          \protect\G@refundefinedtrue
          \nfss@text{\reset@font\bfseries ??}%
          \@latex@warning{Reference `#2' on page \thepage \space
            with undefined sentence number}%
        }\noexpand\@nil}%
      \let\@@protect\protect
      \let\protect\noexpand
      \expandafter\edef\csname r@#2\endcsname{{\@tempa}\@tempb}%
      \let\protect\@@protect
      \ref#1{#2}%
    \endgroup
  \fi
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refSentenceL}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% \begin{macro}{\ref@SentenceX}
% The same but long.
%    \begin{macrocode}
\newcommand*{\refSentenceL}{%
  \kernel@ifstar {\ref@SentenceX0*}{\ref@SentenceX0{}}
}
\newcommand*{\ref@SentenceX}[3]{%
  \begingroup
    \def\parcite@format{#1}%
    \let\sentencecite@format\parcite@format
    \ref@Sentence{#2}{#3}%
  \endgroup
}
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \begin{command}{\refSentenceS}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% The same but short.
%    \begin{macrocode}
\newcommand*{\refSentenceS}{%
  \kernel@ifstar {\ref@SentenceX1*}{\ref@SentenceX1{}}
}
%    \end{macrocode}
% \end{command}
%
% \begin{command}{\refSentenceN}
% \changes{scrjura-v0.9h}{2016/04/12}{\cs{@ifstar} replaced by \cs{kernel@ifstar}}
% The same but numeric.
%    \begin{macrocode}
\newcommand*{\refSentenceN}{%
  \kernel@ifstar {\ref@SentenceX2*}{\ref@SentenceX2{}}
}
%</body>
%    \end{macrocode}
% \end{command}
%
% \begin{macro}{\contract@sentence}
% \changes{scrjura-v0.7a}{2014/01/28}{using \cs{textsuperscript}}
% \changes{scrjura-v0.7a}{2014/01/28}{\cs{nobreak}\cs{hskip}\cs{z@} added to allow
%   hyphenation of the first word after the sentence mark}
% Numbering of sentences.
% \begin{counter}{sentence}
% \begin{command}{\thesentence,\theHsentence}
% \changes{scrjura-v3.41}{2023/06/24}{Ulrike Fischer requested to use \cs{def} instead
%   of \cs{newcommand*}}
% \begin{macro}{\p@sentence}
% \changes{scrjura-v3.27}{2019/10/09}{adaption for \LaTeX{} 2019-10-01}
% The counter is used for numbering the sentences. It is important to add the
% paragraph as parent object to labels. The original method to make it
% possible to use \cs{thesentence} as an argument of \cs{p@sentence} does not
% work any longer using \LaTeX{} 2019-10-01 or newer. It would result in an
% error message. So the code has to be adapted to the new definition of
% \cs{refstepcounter} in \LaTeX{} 2019-10-01. From this version it uses
% \cs{labelformat}. Don't ask me, what I think about the fact, that every new
% versions of \LaTeX{} can break existing packages and package authors have to
% find out such incompatibilities on their own.
%    \begin{macrocode}
%<*body>
\newcounter{sentence}[par]
\renewcommand*{\thesentence}{\arabic{sentence}}
\def\theHsentence{\theHpar-\arabic{sentence}}
\scr@ifundefinedorrelax{labelformat}{%
  \renewcommand*{\p@sentence}{\expandafter\p@@sentence}
  \newcommand*{\p@@sentence}[1]{\p@par{{\par@cite{\thepar}}%
      \contract@separator{\nobreakspace}}{\sentence@cite{#1}}}%
}{%
  \labelformat{sentence}{\p@par{{\par@cite{\thepar}}%
      \contract@separator{\nobreakspace}}{\sentence@cite{#1}}}%
}
\newcommand*{\contract@sentence}{%
%    \end{macrocode}
% \changes{scrjura-v0.9e}{2015/11/04}{first start the paragraph then print the number}
% \changes{scrjura-v3.26}{2018/07/20}{new font element \fnt{sentencenumber}}
% \changes{scrjura-v3.26}{2018/07/20}{new formatting \cs{sentencenumberformat}}
% For the numbering it is important not to increase the paragraph number at
% the very beginning, because the paragraph already does so. To make this
% work, the paragraph has to start before we print the number. But immediately
% after a \env{minipage}, a list or a \cs{parbox} we should behave as not
% being at the beginning of a paragraph.
%    \begin{macrocode}
  \ifvmode
    \if@endpe
      \refstepcounter{sentence}%
    \else
      \leavevmode
    \fi
  \else
    \refstepcounter{sentence}%
  \fi
  {\usekomafont{sentencenumber}{\sentencenumberformat}}%
  \nobreak\hskip\z@
}
%    \end{macrocode}
% \begin{fontelement}{sentencenumber}
% \begin{command}{\sentencenumberformat}
% \changes{scrjura-v3.26}{2018/07/20}{new}
% Formatting an font can be changed using font element \fnt{sentencenumber}
% and command \cs{sentencenumberformat}. The last has the preset
% \cs{textsuperscript}.
%    \begin{macrocode}
\newkomafont{sentencenumber}{}
\newcommand*{\sentencenumberformat}{\textsuperscript{\thesentence}}
%</body>
%    \end{macrocode}
% \end{command}
% \end{fontelement}
% \end{macro}
% \end{command}
% \end{counter}
% \end{macro}
%
% \begin{macro}{\par@cite}
% \begin{command}{\parciteformat}
% \changes{scrjura-v0.5d}{2010/04/28}{argument moved}
% Reference style for paragraphs.
%    \begin{macrocode}
%<*body>
\DeclareRobustCommand*{\par@cite}[1]{\parciteformat{#1}}
\newcommand*{\parciteformat}[1]{%
  \ifcase \parcite@format
    \expandafter\parlongformat
  \or
    \expandafter\parshortformat
  \or
    \expandafter\parnumericformat
  \else
    \unskip\expandafter\@gobble
  \fi
  {#1}%
}
%    \end{macrocode}
% \end{command}
% \end{macro}
%
% \begin{macro}{\sentence@cite}
% \begin{command}{\sentenceciteformat}
% \changes{scrjura-v0.5d}{2010/04/28}{argument moved}
% Reference style for sentences. Preset is \cs{@arabic}.
%    \begin{macrocode}
\DeclareRobustCommand*{\sentence@cite}[1]{\sentenceciteformat{#1}}
\newcommand*{\sentenceciteformat}[1]{%
  \ifcase \sentencecite@format
    \expandafter\sentencelongformat
  \or
    \expandafter\sentenceshortformat
  \or
    \expandafter\sentencenumericformat
  \else
    \unskip\expandafter\@gobble
  \fi
  {#1}%
}
%    \end{macrocode}
% \end{command}
% \end{macro}
%
% \begin{command}{\parlongformat,\parshortformat,\parnumericformat,
%                 \sentencelongformat,\sentenceshortformat,
%                 \sentencenumericformat}
% The six formattings.
%    \begin{macrocode}
\newcommand*{\parlongformat}[1]{\parname~#1}
\newcommand*{\parshortformat}[1]{\parshortname~#1}
\newcommand*{\parnumericformat}[1]{\@Roman{\number #1\relax}}
\newcommand*{\sentencelongformat}[1]{\sentencename~#1}
\newcommand*{\sentenceshortformat}[1]{\sentenceshortname~#1}
\newcommand*{\sentencenumericformat}[1]{\@arabic{\number #1\relax}.}
%</body>
%    \end{macrocode}
% \end{command}
%
% \section{Language Dependent Names}
%
% \begin{command}{\parname,\parshortname,\sentencename,\sentenceshortname}
% \begin{macro}{\contract@lang@error}
% \changes{scrjura-v0.7}{2013/09/19}{Usage of \cs{PackageError} instead of
%   \cs{PackageErrorNoLine}}
% \changes{scrjura-v3.24}{2017/05/29}{adaption for language name bug in
%   \pkg{babel}~3.10}
% \changes{v0.0.1}{2023-10-10}{\cs{scrjura@lang@error} renamed}
% The names of paragraphs and sentences and their short versions. The English
% names are donated by ``m.eik''.
%    \begin{macrocode}
%<*body>
\newcommand*{\parname}{Paragraph}
\AtBeginDocument{%
  \providecaptionname{german,ngerman,austrian,naustrian}\parname{Absatz}%
  \providecaptionname{german,ngerman,austrian,naustrian}\parshortname{Abs.}%
  \providecaptionname{german,ngerman,austrian,naustrian}\sentencename{Satz}%
  \providecaptionname{german,ngerman,austrian,naustrian}\sentenceshortname{S.}%
  \providecaptionname{english,american,british,canadian,%
    USenglish,UKenglish,usenglish,ukenglish}\parname{paragraph}%
  \providecaptionname{english,american,british,canadian,%
    USenglish,UKenglish,usenglish,ukenglish}\parshortname{par.}%
  \providecaptionname{english,american,british,canadian,%
    USenglish,UKenglish,usenglish,ukenglish}\sentencename{sentence}%
  \providecaptionname{english,american,british,canadian,%
    USenglish,UKenglish,usenglish,ukenglish}\sentenceshortname{sent.}%
}
\providecommand*{\parname}{\contract@lang@error{\parname}}
\providecommand*{\parshortname}{\contract@lang@error{\parshortname}}
\providecommand*{\sentencename}{\contract@lang@error{\sentencename}}
\providecommand*{\sentenceshortname}{\contract@lang@error{\sentenceshortname}}
\newcommand*{\contract@lang@error}[1]{%
  \PackageError{contract}{%
    current language not supported%
  }{%
    Currently contract only supports languages `german', `ngerman',
    `austrian',\MessageBreak
    `naustrian', `english', `american', `british', `canadian',
    `USenglish',\MessageBreak
    `UKenglish', `usenglish`, and `ukenglish'.\MessageBreak
    It seems, that you are using another language (maybe `\languagename') or
    that\MessageBreak
    your language selection isn't compatible to package `babel'.\MessageBreak
    Because of this you have to define `\string#1' by yourself!\MessageBreak
    It would be nice if you'll send your definitions to the author.%
  }%
  \textbf{??}%
}
%</body>
%    \end{macrocode}
% \end{macro}
% \end{command}
%
% \section{Using Values from last \LaTeX{} Run}
%
% \begin{command}{\newmaxpar}
% \changes{scrjura-v0.6b}{2013/04/16}{\cs{\#1@Clauseformat} expands to its argument}
% \begin{command}{\getmaxpar}
% \changes{scrjura-v0.6}{2011/09/30}{argument no 3 is expanded using
%   \cs{protected@edef}}
% \changes{scrjura-v0.5c}{2010/04/26}{\cs{protected@edef} replaced by \cs{edef}}
% \changes{scrjura-v0.5c}{2010/04/26}{\cs{\#2@Clauseformat} expands to its argument}
% Two helper macros, to save a counter in a \file{aux}-file and get the value
% back or another value of it is not in the \file{aux}-file.
%    \begin{macrocode}
%<*body>
\newcommand*{\newmaxpar}[3]{%
  \begingroup
    \expandafter\let\csname #1@Clauseformat\endcsname\@firstofone
    \protected@edef\@tempa{#2}\@onelevel@sanitize\@tempa
    \expandafter\xdef\csname max@#1@\@tempa\endcsname{#3}%
  \endgroup
}
\newcommand*{\getmaxpar}[3]{%
  \begingroup
    \expandafter\let\csname #2@Clauseformat\endcsname\@firstofone
    \protected@edef\@tempa{#3}%
    \@onelevel@sanitize\@tempa
    \expandafter\ifx \csname max@#2@\@tempa\endcsname\relax
      \edef\@tempa{\endgroup\edef\noexpand#1{\expandafter\the\value{par}}}%
    \else
      \edef\@tempa{\endgroup
        \edef\noexpand#1{\csname max@#2@\@tempa\endcsname}}%
    \fi
  \@tempa
}
%    \end{macrocode}
% \changes{scrjura-v0.7b}{2014/11/10}{added fallback code to \file{aux}-file}
% \changes{scrjura-v0.9g}{2015/03/25}{write to \file{aux}-file \cs{if@filesw}}
% Because some users remove \pkg*{contract} from their documents without
% deleting the \file{aux}-file, we add a fallback definition of \cs{newmaxpar}
% to the \file{aux}-file. This avoids error messages because of undefined
% \cs{newmaxpar}.
%    \begin{macrocode}
\AtBeginDocument{%
  \if@filesw
    \immediate\write\@auxout{%
      \string\providecommand*\string\newmaxpar[3]{}
    }%
  \fi
}
%</body>
%    \end{macrocode}
% \end{command}
% \end{command}
%
% \iffalse
%</package>
% \fi
%
% \Finale
%
\endinput
% Local Variables:
% mode: doctex
% ispell-local-dictionary: "en_US"
% eval: (flyspell-mode 1)
% TeX-master: t
% TeX-engine: luatex-dev
% eval: (setcar (or (cl-member "Index" (setq-local TeX-command-list (copy-alist TeX-command-list)) :key #'car :test #'string-equal) (setq-local TeX-command-list (cons nil TeX-command-list))) '("Index" "mkindex %s" TeX-run-index nil t :help "makeindex for dtx"))
% End:
%
% LocalWords:  cautelar
