first version of mkessler-proof

This commit is contained in:
Maximilian Keßler 2021-09-12 19:59:25 +02:00
parent 11e623bc06
commit 0b24fe2188

View file

@ -11,6 +11,7 @@
\DeclareOption*{\PackageWarning{mkessler-proof}{Unknown '\CurrentOption'}}
\ProcessOptions\relax
\RequirePackage{amssymb}
\RequirePackage{amsthm}
\RequirePackage{etoolbox}
\RequirePackage{xparse}
@ -22,9 +23,6 @@
\newtheorem*{claim*}{\ifmkessler@proof@english Claim\else Behauptung\fi}
\AtBeginDocument{\def\claimautorefname{\ifmkessler@proof@english Claim\else Behauptung\fi}}
\let\mkessler@fancythm@saved@proof\proof
\let\mkessler@fancythm@saved@endproof\endproof
\newif\ifhyperref
\AtBeginDocument{
\@ifpackageloaded{hyperref}{
@ -36,43 +34,36 @@
\hyperreffalse
\let\mkessler@proof@blankref\ref
\let\mkessler@proof@autoref\ref
\providecommand\phantomsection{}
}
}
\NewDocumentEnvironment{rproof}{m}
\NewDocumentEnvironment{rproof}{m O{}}{\def\mkessler@proof@aster{\relax}\begin{rproof@impl}{#1}[#2]}{\end{rproof@impl}}
\NewDocumentEnvironment{rproof*}{m O{}}{\def\mkessler@proof@aster{*}\begin{rproof@impl}{#1}[#2]}{\end{rproof@impl}}
\NewDocumentEnvironment{rproof@impl}{m O{}}
{
% Restore correct counter for claim
\ifcsdef{themkessler@proof@#1@save@claim}{
\setcounter{claim}{\value{mkessler@proof@#1@save@claim}}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Continuation of proof of\else Fortsetzung des Beweises zu\fi}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Continuation of proof\mkessler@proof@aster\space of\else Fortsetzung des Beweises\mkessler@proof@aster\space zu\fi}
\edef\haha{\value{mkessler@proof@#1@part}}
% \def\previous@{Siehe Seite \ref{mkessler@proof@#1@part@1} für den vorherigen Teil.}
}{
\newcounter{mkessler@proof@#1@save@claim}
\newcounter{mkessler@proof@#1@part}
\setcounter{claim}{0}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Proof of\else Beweis von\fi}
% \let\previous@\relax
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Proof\mkessler@proof@aster\space of\else Beweis\mkessler@proof@aster\space von\fi}
}
% Set up counter number printing as subindexed by numbering of the reference
\let\mkessler@proof@theoldclaim\theclaim
\def\theclaim{\mkessler@proof@blankref{#1}.\mkessler@proof@theoldclaim}
% Now, start the actual proof
\begin{proof}[\mkessler@proof@proofprefix\space\mkessler@proof@autoref{#1}]
% \refstepcounter{mkessler@proof@#1@part}
% \label{mkessler@proof@#1@part@\csname themkessler@proof@#1@part\endcsname}
% \previous@
% \ifnumexpr1<\value{mkessler@proof@#1@part} Siehe Seite \ref{mkessler@proof@#1@part@\numexpr{\value{mkessler@proof@#1@part}-1}}\fi
\begin{proof}[\mkessler@proof@proofprefix\space\mkessler@proof@autoref{#1}\if\relax\detokenize{#2}\relax\else\space(#2)\fi]
}
{
\end{proof} % End proof
% Save current claim counter for later restoration
\setcounter{mkessler@proof@#1@save@claim}{\value{claim}}
\stepcounter{mkessler@proof@#1@part}
}
%%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\DeclareRobustCommand{\blackqed}{%
\ifmmode \mathqed
@ -98,4 +89,3 @@
%%Solution (for exercises)
\newenvironment{solution}[1][]{\begin{proof}[\ifmkessler@proof@english{}Solution\else{}Lösung\fi{}#1]}{\end{proof}}
\newenvironment{additionproof}[1][]{\begin{proof}[\ifmkessler@proof@english{}Additional proof\else{}zuBeweis\fi{}#1]}{\end{proof}}