add explicit subproof environment

Build branch master (f4d0797) from kesslermaximilian/LatexPackages
This commit is contained in:
Maximilian Keßler 2022-01-09 14:44:56 +00:00
parent 74edcd4b22
commit 425c68b027
4 changed files with 148 additions and 54 deletions

View file

@ -1,8 +1,8 @@
{
"build_time": "",
"source files": {
"version": "v2.4.3",
"commit": "bc072ff89192fb3de8f2e6799e2d34d122385334",
"version": "v2.4.4",
"commit": "f4d079796adaa242d653de943b548a88fe9047ec",
"dirty": false
},
"pytex": {
@ -44,9 +44,9 @@
{
"name": "mkessler-refproof.sty",
"source file": "refproof.pysty",
"build time": "2022/01/09 13:37",
"source version": "v2.4.3",
"source commit hash": "bc072ff89192fb3de8f2e6799e2d34d122385334",
"build time": "2022/01/09 14:44",
"source version": "v2.4.4",
"source commit hash": "f4d079796adaa242d653de943b548a88fe9047ec",
"pytex version": "v1.2.0-3-g5e077e7",
"pytex commit hash": "5e077e77d88ec6b71ac0d39e21572fad5938b0c6",
"dirty": false
@ -294,9 +294,9 @@
{
"name": "translator-proof-dictionary-{language}.dict",
"source file": "proof.pydict",
"build time": "2022/01/09 13:37",
"source version": "v2.4.3",
"source commit hash": "bc072ff89192fb3de8f2e6799e2d34d122385334",
"build time": "2022/01/09 14:44",
"source version": "v2.4.4",
"source commit hash": "f4d079796adaa242d653de943b548a88fe9047ec",
"pytex version": "v1.2.0-3-g5e077e7",
"pytex commit hash": "5e077e77d88ec6b71ac0d39e21572fad5938b0c6",
"dirty": false

View file

@ -27,7 +27,7 @@
%
% Build details:
% PyTeX version: v1.2.0-3-g5e077e7 (commit 5e077e7)
% Source code version: v2.4.3 (commit bc072ff)
% Source code version: v2.4.4 (commit f4d0797)
%
% This LaTeX package is free software and distributed under the MIT License. You
% may use it freely for your purposes. The latest version of the package can be
@ -70,56 +70,22 @@
\newtheorem*{claim*}{\translate{Claim}}
\AtBeginDocument{\def\claimautorefname{\translate{Claim}}}
\newif\ifmkessler@refproof@hyperref\mkessler@refproof@hyperreffalse
\AtBeginDocument{
\@ifpackageloaded{hyperref}{
\mkessler@refproof@hyperreftrue
\let\mkessler@refproof@autoref\autoref
}{
\mkessler@refproof@hyperreftrue
\let\mkessler@refproof@autoref\ref
}
}
\newcounter{mkessler@refproof@proofdepth}
\setcounter{mkessler@refproof@proofdepth}{0}
\newcounter{mkessler@refproof@save@claim}
\setcounter{mkessler@refproof@save@claim}{0}
\let\mkessler@refproof@saved@proof\proof
\let\mkessler@refproof@saved@endproof\endproof
\NewDocumentEnvironment{refproof}{s m o}
{
% Restore correct counter for claim
\ifcsdef{themkessler@refproof@#2@save@claim}{
\setcounter{claim}{\value{mkessler@refproof@#2@save@claim}}
\def\mkessler@refproof@proofprefix{\IfBooleanTF{#1}{\translate{Continuation of proof* of}}{\translate{Continuation of proof of}}}
}{
\newcounter{mkessler@refproof@#2@save@claim}
\setcounter{claim}{0}
\def\mkessler@refproof@proofprefix{\IfBooleanTF{#1}{\translate{Proof* of}}{\translate{Proof of}}}
}
% Set up counter number printing as subindexed by numbering of the reference
\let\mkessler@refproof@theoldclaim\theclaim
\def\theclaim{\getrefnumber{#2}.\mkessler@refproof@theoldclaim}
% Now, start the actual proof
\mkessler@refproof@saved@proof[\mkessler@refproof@proofprefix\space\mkessler@refproof@autoref{#2}\IfValueT{#3}{\space(#3)}]
}
{
\mkessler@refproof@saved@endproof % End proof
% Save current claim counter for later restoration
\setcounter{mkessler@refproof@#2@save@claim}{\value{claim}}
}
% Proof (with asterisk)
\AtBeginDocument{
\RenewDocumentEnvironment{proof}{s o}
{
\mkessler@refproof@saved@proof[\IfBooleanTF{#1}{\translate{Proof*}}{\translate{Proof}}\IfValueT{#2}{\space(#2)}]
}
{
\mkessler@refproof@saved@endproof
}
}
\NewDocumentEnvironment{oldproof}{}{\mkessler@refproof@saved@proof}{\mkessler@refproof@saved@endproof}
%%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\DeclareRobustCommand{\blackqed}{%
\ifmmode \mathqed
@ -129,7 +95,7 @@
\fi
}
\newenvironment{subproof}[1][\ifmkessler@refproof@english Subproof\else Unterbeweis\fi]{\par
\newenvironment{mkessler@refproof@saved@subproof}[1][\translate{Subproof}]{\par
\pushQED{\blackqed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
@ -140,8 +106,124 @@
\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}{}
{
\mkessler@refproof@saved@proof
}
{
\mkessler@refproof@saved@endproof
}
\NewDocumentEnvironment{oldsubproof}{}
{
\mkessler@refproof@saved@subproof
}
\endmkessler@refproof@saved@subproof
{
%%%% This might be dropped, but for now is collected here
\NewDocumentEnvironment{refproof}{s m o}
{
\stepcounter{mkessler@refproof@proofdepth}
%Save the current claim counter
\setcounter{mkessler@refproof@save@claim}{\value{claim}}
% Restore correct counter for claim
\ifcsdef{themkessler@refproof@#2@save@claim}{
\setcounter{claim}{\value{mkessler@refproof@#2@save@claim}}
\def\mkessler@refproof@proofprefix{
\IfBooleanTF{#1}{
\translate{Continuation of proof* of}
}{
\translate{Continuation of proof of}
}
}
}{
\newcounter{mkessler@refproof@#2@save@claim}
\setcounter{claim}{0}
\def\mkessler@refproof@proofprefix{
\IfBooleanTF{#1}{
\translate{Proof* of}
}{
\translate{Proof of}
}
}
}
% Set up counter number printing as subindexed by numbering of the reference
\let\mkessler@refproof@theoldclaim\theclaim
\def\theclaim{\getrefnumber{#2}.\mkessler@refproof@theoldclaim}
% Now, start the actual proof
\mkessler@refproof@saved@proof[
\mkessler@refproof@proofprefix\space\mkessler@refproof@autoref{#2}%
\IfValueT{#3}{\space(#3)}%
]
}
{
\mkessler@refproof@saved@endproof % End proof
% Save current claim counter for later restoration
\setcounter{mkessler@refproof@#2@save@claim}{\value{claim}}
%Restore previous claim counter
\setcounter{claim}{\value{mkessler@refproof@save@claim}}
\addtocounter{mkessler@refproof@proofdepth}{-1}
}
%%Solution (for exercises)
\newenvironment{solution}[1][]{\begin{proof}[\ifmkessler@refproof@english{}Solution\else{}Lösung\fi{}#1]}{\end{proof}}
\def\proofdepth{Depth:~\themkessler@refproof@proofdepth}
%%% A 'smart' proof environment
\AtBeginDocument{
\RenewDocumentEnvironment{proof}{s o}
{
\stepcounter{mkessler@refproof@proofdepth}
%Save the current claim counter
\setcounter{mkessler@refproof@save@claim}{\value{claim}}
\setcounter{claim}{0}
\def\theclaim{\arabic{claim}}
\ifnum\value{mkessler@refproof@proofdepth}>1%
\mkessler@refproof@saved@subproof[%
\IfBooleanTF{#1}{%
\translate{Subproof*}%
}{%
\translate{Subproof}%
}%
\IfValueT{#2}{\space(#2)}%
]
\else%
\mkessler@refproof@saved@proof[%
\IfBooleanTF{#1}{%
\translate{Proof*}%
}{%
\translate{Proof}%
}%
\IfValueT{#2}{\space(#2)}%
]
\fi
}
{
\mkessler@refproof@saved@endproof
%Restore previous claim counter
\setcounter{claim}{\value{mkessler@refproof@save@claim}}
\addtocounter{mkessler@refproof@proofdepth}{-1}
}
}
\NewDocumentEnvironment{subproof}{s o}
{
\stepcounter{mkessler@refproof@proofdepth}
%Save the current claim counter
\setcounter{mkessler@refproof@save@claim}{\value{claim}}
\setcounter{claim}{0}
\def\theclaim{\arabic{claim}}
\mkessler@refproof@saved@subproof[%
\IfBooleanTF{#1}{%
\translate{Subproof*}%
}{%
\translate{Subproof}%
}%
\IfValueT{#2}{\space(#2)}%
]
}
{
\mkessler@refproof@saved@endproof
%Restore previous claim counter
\setcounter{claim}{\value{mkessler@refproof@save@claim}}
\addtocounter{mkessler@refproof@proofdepth}{-1}
}

View file

@ -27,7 +27,7 @@
%
% Build details:
% PyTeX version: v1.2.0-3-g5e077e7 (commit 5e077e7)
% Source code version: v2.4.3 (commit bc072ff)
% Source code version: v2.4.4 (commit f4d0797)
%
% This LaTeX dictionary is free software and distributed under the MIT License. You
% may use it freely for your purposes. The latest version of the dictionary can be
@ -42,6 +42,8 @@
\providetranslation{Claim}{Claim}
\providetranslation{claim}{claim}
\providetranslation{Claim*}{Claim*}
\providetranslation{claim*}{claim*}
\providetranslation{Proof}{Proof}
\providetranslation{proof}{proof}
\providetranslation{Proof*}{Proof*}
@ -58,3 +60,7 @@
\providetranslation{continuation of proof*}{continuation of proof*}
\providetranslation{Continuation of proof* of}{Continuation of proof* of}
\providetranslation{continuation of proof* of}{continuation of proof* of}
\providetranslation{Subproof}{Subproof}
\providetranslation{subproof}{subproof}
\providetranslation{Subproof*}{Subproof*}
\providetranslation{subproof*}{subproof*}

View file

@ -27,7 +27,7 @@
%
% Build details:
% PyTeX version: v1.2.0-3-g5e077e7 (commit 5e077e7)
% Source code version: v2.4.3 (commit bc072ff)
% Source code version: v2.4.4 (commit f4d0797)
%
% This LaTeX dictionary is free software and distributed under the MIT License. You
% may use it freely for your purposes. The latest version of the dictionary can be
@ -42,6 +42,8 @@
\providetranslation{Claim}{Behauptung}
\providetranslation{claim}{Behauptung}
\providetranslation{Claim*}{Behauptung*}
\providetranslation{claim*}{Behauptung*}
\providetranslation{Proof}{Beweis}
\providetranslation{proof}{Beweis}
\providetranslation{Proof*}{Beweis*}
@ -58,3 +60,7 @@
\providetranslation{continuation of proof*}{Fortsetzung des Beweises*}
\providetranslation{Continuation of proof* of}{Fortsetzung des Beweises* zu}
\providetranslation{continuation of proof* of}{Fortsetzung des Beweises* zu}
\providetranslation{Subproof}{Unterbeweis}
\providetranslation{subproof}{Unterbeweis}
\providetranslation{Subproof*}{Unterbeweis*}
\providetranslation{subproof*}{Unterbeweis*}