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'}} \DeclareOption*{\PackageWarning{mkessler-proof}{Unknown '\CurrentOption'}}
\ProcessOptions\relax \ProcessOptions\relax
\RequirePackage{amssymb}
\RequirePackage{amsthm} \RequirePackage{amsthm}
\RequirePackage{etoolbox} \RequirePackage{etoolbox}
\RequirePackage{xparse} \RequirePackage{xparse}
@ -22,9 +23,6 @@
\newtheorem*{claim*}{\ifmkessler@proof@english Claim\else Behauptung\fi} \newtheorem*{claim*}{\ifmkessler@proof@english Claim\else Behauptung\fi}
\AtBeginDocument{\def\claimautorefname{\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 \newif\ifhyperref
\AtBeginDocument{ \AtBeginDocument{
\@ifpackageloaded{hyperref}{ \@ifpackageloaded{hyperref}{
@ -36,43 +34,36 @@
\hyperreffalse \hyperreffalse
\let\mkessler@proof@blankref\ref \let\mkessler@proof@blankref\ref
\let\mkessler@proof@autoref\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 % Restore correct counter for claim
\ifcsdef{themkessler@proof@#1@save@claim}{ \ifcsdef{themkessler@proof@#1@save@claim}{
\setcounter{claim}{\value{mkessler@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}} \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@save@claim}
\newcounter{mkessler@proof@#1@part}
\setcounter{claim}{0} \setcounter{claim}{0}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Proof of\else Beweis von\fi} \def\mkessler@proof@proofprefix{\ifmkessler@proof@english Proof\mkessler@proof@aster\space of\else Beweis\mkessler@proof@aster\space von\fi}
% \let\previous@\relax
} }
% Set up counter number printing as subindexed by numbering of the reference % Set up counter number printing as subindexed by numbering of the reference
\let\mkessler@proof@theoldclaim\theclaim \let\mkessler@proof@theoldclaim\theclaim
\def\theclaim{\mkessler@proof@blankref{#1}.\mkessler@proof@theoldclaim} \def\theclaim{\mkessler@proof@blankref{#1}.\mkessler@proof@theoldclaim}
% Now, start the actual proof % Now, start the actual proof
\begin{proof}[\mkessler@proof@proofprefix\space\mkessler@proof@autoref{#1}] \begin{proof}[\mkessler@proof@proofprefix\space\mkessler@proof@autoref{#1}\if\relax\detokenize{#2}\relax\else\space(#2)\fi]
% \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
} }
{ {
\end{proof} % End proof \end{proof} % End proof
% Save current claim counter for later restoration % Save current claim counter for later restoration
\setcounter{mkessler@proof@#1@save@claim}{\value{claim}} \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 %%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\DeclareRobustCommand{\blackqed}{% \DeclareRobustCommand{\blackqed}{%
\ifmmode \mathqed \ifmmode \mathqed
@ -98,4 +89,3 @@
%%Solution (for exercises) %%Solution (for exercises)
\newenvironment{solution}[1][]{\begin{proof}[\ifmkessler@proof@english{}Solution\else{}Lösung\fi{}#1]}{\end{proof}} \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}}