make plain proof and subproof available

This commit is contained in:
Maximilian Keßler 2022-01-09 15:30:06 +01:00
parent bc072ff891
commit 23d4b92367
3 changed files with 172 additions and 49 deletions

View file

@ -1,6 +1,8 @@
key,English,German
Claim,Claim,Behauptung
claim,claim,Behauptung
Claim*,Claim*,Behauptung*
claim*,claim*,Behauptung*
Proof,Proof,Beweis
proof,proof,Beweis
Proof*,Proof*,Beweis*
@ -17,4 +19,7 @@ Continuation of proof*,Continuation of proof*,Fortsetzung des Beweises*
continuation of proof*,continuation of proof*,Fortsetzung des Beweises*
Continuation of proof* of,Continuation of proof* of,Fortsetzung des Beweises* zu
continuation of proof* of,continuation of proof* of,Fortsetzung des Beweises* zu
Subproof,Subproof,Unterbeweis
subproof,subproof,Unterbeweis
Subproof*,Subproof*,Unterbeweis*
subproof*,subproof*,Unterbeweis*

View file

@ -22,56 +22,22 @@ __END_OPTIONS_X__
\newtheorem*{claim*}{\translate{Claim}}
\AtBeginDocument{\def\claimautorefname{\translate{Claim}}}
__NEW_IF__(hyperref,false)
\AtBeginDocument{
\@ifpackageloaded{hyperref}{
__SET_IF__(hyperref,true)
\let__PACKAGE_MACRO__(autoref)\autoref
}{
__SET_IF__(hyperref,true)
\let__PACKAGE_MACRO__(autoref)\ref
}
}
\newcounter{__PACKAGE_PREFIX__proofdepth}
\setcounter{__PACKAGE_PREFIX__proofdepth}{0}
\newcounter{__PACKAGE_PREFIX__save@claim}
\setcounter{__PACKAGE_PREFIX__save@claim}{0}
\let__PACKAGE_MACRO__(saved@proof)\proof
\let__PACKAGE_MACRO__(saved@endproof)\endproof
\NewDocumentEnvironment{refproof}{s m o}
{
% Restore correct counter for claim
\ifcsdef{the__PACKAGE_PREFIX__#2@save@claim}{
\setcounter{claim}{\value{__PACKAGE_PREFIX__#2@save@claim}}
\def__PACKAGE_MACRO__(proofprefix){\IfBooleanTF{#1}{\translate{Continuation of proof* of}}{\translate{Continuation of proof of}}}
}{
\newcounter{__PACKAGE_PREFIX__#2@save@claim}
\setcounter{claim}{0}
\def__PACKAGE_MACRO__(proofprefix){\IfBooleanTF{#1}{\translate{Proof* of}}{\translate{Proof of}}}
}
% Set up counter number printing as subindexed by numbering of the reference
\let__PACKAGE_MACRO__(theoldclaim)\theclaim
\def\theclaim{\getrefnumber{#2}.__PACKAGE_MACRO__(theoldclaim)}
% Now, start the actual proof
__PACKAGE_MACRO__(saved@proof)[__PACKAGE_MACRO__(proofprefix)\space__PACKAGE_MACRO__(autoref){#2}\IfValueT{#3}{\space(#3)}]
}
{
__PACKAGE_MACRO__(saved@endproof) % End proof
% Save current claim counter for later restoration
\setcounter{__PACKAGE_PREFIX__#2@save@claim}{\value{claim}}
}
% Proof (with asterisk)
\AtBeginDocument{
\RenewDocumentEnvironment{proof}{s o}
{
__PACKAGE_MACRO__(saved@proof)[\IfBooleanTF{#1}{\translate{Proof*}}{\translate{Proof}}\IfValueT{#2}{\space(#2)}]
}
{
__PACKAGE_MACRO__(saved@endproof)
}
}
\NewDocumentEnvironment{oldproof}{}{__PACKAGE_MACRO__(saved@proof)}{__PACKAGE_MACRO__(saved@endproof)}
%%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\DeclareRobustCommand{\blackqed}{%
\ifmmode \mathqed
@ -81,7 +47,7 @@ __NEW_IF__(hyperref,false)
\fi
}
\newenvironment{subproof}[1][__IF__(english) Subproof\else Unterbeweis\fi]{\par
\newenvironment{__PACKAGE_PREFIX__saved@subproof}[1][\translate{Subproof}]{\par
\pushQED{\blackqed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
@ -92,8 +58,104 @@ __NEW_IF__(hyperref,false)
\popQED\endtrivlist\@endpefalse
}
%%%Now, we internally got a proof and a subproof environment
%%%Make them available as 'old' variants, with their defautl behaviour
\NewDocumentEnvironment{oldproof}{}
{
__PACKAGE_MACRO__(saved@proof)
}
{
__PACKAGE_MACRO__(saved@endproof)
}
\NewDocumentEnvironment{oldsubproof}{}
{
\__PACKAGE_PREFIX__saved@subproof
}
\end__PACKAGE_PREFIX__saved@subproof
{
%%%% This might be dropped, but for now is collected here
%%Solution (for exercises)
\newenvironment{solution}[1][]{\begin{proof}[__IF__(english){}Solution\else{}Lösung\fi{}#1]}{\end{proof}}
\NewDocumentEnvironment{refproof}{s m o}
{
\stepcounter{__PACKAGE_PREFIX__proofdepth}
%Save the current claim counter
\setcounter{__PACKAGE_PREFIX__save@claim}{\value{claim}}
% Restore correct counter for claim
\ifcsdef{the__PACKAGE_PREFIX__#2@save@claim}{
\setcounter{claim}{\value{__PACKAGE_PREFIX__#2@save@claim}}
\def__PACKAGE_MACRO__(proofprefix){
\IfBooleanTF{#1}{
\translate{Continuation of proof* of}
}{
\translate{Continuation of proof of}
}
}
}{
\newcounter{__PACKAGE_PREFIX__#2@save@claim}
\setcounter{claim}{0}
\def__PACKAGE_MACRO__(proofprefix){
\IfBooleanTF{#1}{
\translate{Proof* of}
}{
\translate{Proof of}
}
}
}
% Set up counter number printing as subindexed by numbering of the reference
\let__PACKAGE_MACRO__(theoldclaim)\theclaim
\def\theclaim{\getrefnumber{#2}.__PACKAGE_MACRO__(theoldclaim)}
% Now, start the actual proof
__PACKAGE_MACRO__(saved@proof)[
__PACKAGE_MACRO__(proofprefix)\space__PACKAGE_MACRO__(autoref){#2}%
\IfValueT{#3}{\space(#3)}%
]
}
{
__PACKAGE_MACRO__(saved@endproof) % End proof
% Save current claim counter for later restoration
\setcounter{__PACKAGE_PREFIX__#2@save@claim}{\value{claim}}
%Restore previous claim counter
\setcounter{claim}{\value{__PACKAGE_PREFIX__save@claim}}
\addtocounter{__PACKAGE_PREFIX__proofdepth}{-1}
}
\def\proofdepth{Depth:~\the__PACKAGE_PREFIX__proofdepth}
\AtBeginDocument{
\RenewDocumentEnvironment{proof}{s o}
{
\stepcounter{__PACKAGE_PREFIX__proofdepth}
%Save the current claim counter
\setcounter{__PACKAGE_PREFIX__save@claim}{\value{claim}}
\setcounter{claim}{0}
\def\theclaim{\arabic{claim}}
__PACKAGE_MACRO__(saved@proof)[%
\ifnum\value{__PACKAGE_PREFIX__proofdepth}>1%
\IfBooleanTF{#1}{%
\translate{Subproof*}%
}{%
\translate{Subproof}%
}%
\IfValueT{#2}{\space(#2)}%
\else%
\IfBooleanTF{#1}{%
\translate{Proof*}%
}{%
\translate{Proof}%
}%
\IfValueT{#2}{\space(#2)}%
\fi
]
\ifnum\value{__PACKAGE_PREFIX__proofdepth}>1
% \let\mathqed{\blackqed}
\fi
}
{
__PACKAGE_MACRO__(saved@endproof)
%Restore previous claim counter
\setcounter{claim}{\value{__PACKAGE_PREFIX__save@claim}}
\addtocounter{__PACKAGE_PREFIX__proofdepth}{-1}
}
}

View file

@ -1,7 +1,7 @@
\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage{mkessler-proof}
\usepackage{mkessler-refproof}
\usepackage{mkessler-fancythm}
\usepackage{mkessler-hypersetup}
\usepackage{parskip}
@ -9,17 +9,61 @@
\begin{document}
\section{test}
\begin{proof}
Beginn des Beweises:
\begin{proof}
Ein unterbeweis
\end{proof}
Jetzt sind wir fertig.
\end{proof}
\begin{theorem}\label{thm:krass}
Man sollte nach Würzburg fahren.
\end{theorem}
\begin{claim}
test
\end{claim}
\begin{proof}
\proofdepth
\begin{claim}
hi
\end{claim}
\begin{proof}
\proofdepth
\end{proof}
\proofdepth
\begin{claim}
\end{claim}
\end{proof}
\begin{claim}
test
\end{claim}
\begin{refproof}*{thm:krass}[hi]
\begin{claim}\label{cl:qed}
Der QED ist toll.
\end{claim}
Um \autoref{cl:qed} zu beweisen, brauchen wir zunächst ein Lemma.
\begin{proof}
\begin{claim}
test
\end{claim}
hi
\proofdepth
\end{proof}
\begin{claim}
hi
\end{claim}
\end{refproof}
\begin{claim}
next
\end{claim}
\begin{lemma}\label{lm:krass}
Mathevereine sind krass.
\end{lemma}
@ -28,9 +72,9 @@
\begin{claim}
Mathe ist cool.
\end{claim}
\begin{subproof}
\begin{oldsubproof}
trivial.
\end{subproof}
\end{oldsubproof}
Damit folgt nun das Lemma.
\end{refproof}
@ -40,9 +84,9 @@ Nun kommen wir wieder zurück zum eigentlichen Beweis:
\begin{claim}\label{cl:würzburg}
Der QED macht ein Seminar in Würzburg
\end{claim}
\begin{subproof}
\begin{oldsubproof}
Zu prüfen in der DB. Fakt!
\end{subproof}
\end{oldsubproof}
Aus \autoref{cl:qed} und \autoref{cl:würzburg} folgt nun die Aussage.
\end{refproof}
@ -63,4 +107,16 @@ Aus \autoref{cl:qed} und \autoref{cl:würzburg} folgt nun die Aussage.
test
\end{oldproof}
\def\four{4}
\def\foo{1}
{\def\foo{2}\foo}
{\let\foo\four\foo}
\foo
\begin{proof}
\def\foo{5}\foo
\end{proof}
\foo
\end{document}