rework proof package: refproof and proof environments functional

Build branch master (c592a7f) from kesslermaximilian/LatexPackages
This commit is contained in:
Maximilian Keßler 2022-01-08 22:43:15 +00:00
parent cb4a57019f
commit 2a1386dc01
4 changed files with 58 additions and 48 deletions

View file

@ -1,8 +1,8 @@
{
"build_time": "",
"source files": {
"version": "v2.4.0-beta-4",
"commit": "a643415558f11073368644b7906b0130077ab003",
"version": "v2.4.0-beta-8",
"commit": "c592a7f8acca783756365029cf2d643b35e2b62f",
"dirty": false
},
"pytex": {
@ -74,10 +74,10 @@
{
"name": "mkessler-proof.sty",
"source file": "proof.pysty",
"build time": "2021/10/29 09:41",
"source version": "v2.4.0-beta",
"source commit hash": "0aefd5fd7183f41ae0576febd7068f2ed9c6fefb",
"pytex version": "v1.2.0",
"build time": "2022/01/08 22:43",
"source version": "v2.4.0-beta-8",
"source commit hash": "c592a7f8acca783756365029cf2d643b35e2b62f",
"pytex version": "v1.0.0-18",
"pytex commit hash": "126d420b7a6ed2d4b2a42d534ab2e12344869643",
"dirty": false
},
@ -144,9 +144,9 @@
{
"name": "mkessler-mathop.sty",
"source file": "mathop.pysty",
"build time": "2021/12/12 20:08",
"source version": "v2.4.0-beta-4",
"source commit hash": "a643415558f11073368644b7906b0130077ab003",
"build time": "2022/01/08 22:43",
"source version": "v2.4.0-beta-8",
"source commit hash": "c592a7f8acca783756365029cf2d643b35e2b62f",
"pytex version": "v1.0.0-18",
"pytex commit hash": "126d420b7a6ed2d4b2a42d534ab2e12344869643",
"dirty": false
@ -274,10 +274,10 @@
{
"name": "mkessler-script.cls",
"source file": "script.pycls",
"build time": "2021/10/29 09:41",
"source version": "v2.4.0-beta",
"source commit hash": "0aefd5fd7183f41ae0576febd7068f2ed9c6fefb",
"pytex version": "v1.2.0",
"build time": "2022/01/08 22:43",
"source version": "v2.4.0-beta-8",
"source commit hash": "c592a7f8acca783756365029cf2d643b35e2b62f",
"pytex version": "v1.0.0-18",
"pytex commit hash": "126d420b7a6ed2d4b2a42d534ab2e12344869643",
"dirty": false
},

View file

@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright © 2021 Maximilian Keßler
% Copyright © 2022 Maximilian Keßler
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the Software), to deal
@ -26,8 +26,8 @@
% edit the source file and build the class again.
%
% Build details:
% PyTeX version: v1.2.0 (commit 126d420)
% Source code version: v2.4.0-beta (commit 0aefd5f)
% PyTeX version: v1.0.0-18 (commit 126d420)
% Source code version: v2.4.0-beta-8 (commit c592a7f)
%
% This LaTeX class is free software and distributed under the MIT License. You
% may use it freely for your purposes. The latest version of the class can be
@ -39,7 +39,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mkessler-script}[2021/10/29 - Write up lecture notes as script]
\ProvidesClass{mkessler-script}[2022/01/08 - Write up lecture notes as script]
@ -59,7 +59,7 @@
\newif\ifmkessler@script@gitversion\mkessler@script@gitversionfalse
\DeclareOption{git}{\mkessler@script@gitversiontrue}
\DeclareOptionX{git}{\mkessler@script@gitversiontrue}
\DeclareOptionX*{\ClassWarning{mkessler-script}{Unknown '\CurrentOption'}}
\ProcessOptionsX*\relax

View file

@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright © 2021 Maximilian Keßler
% Copyright © 2022 Maximilian Keßler
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the “Software”), to deal
@ -27,7 +27,7 @@
%
% Build details:
% PyTeX version: v1.0.0-18 (commit 126d420)
% Source code version: v2.4.0-beta-4 (commit a643415)
% Source code version: v2.4.0-beta-8 (commit c592a7f)
%
% 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
@ -39,7 +39,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-mathop}[2021/12/12 - Math Operator Package]
\ProvidesPackage{mkessler-mathop}[2022/01/08 - Math Operator Package]
%Provides some commonly used Operators used in the write-ups of my lecture notes
@ -175,6 +175,7 @@
\def\twedge{\vee} % Semantically correct macros for wedge product
\def\tsmash{\wedge} % Semantically correct macro for smash product
\DeclareSimpleMathOperator{sing}
\DeclareSimpleMathOperator{cell}
%Category Theory
\DeclareSimpleMathOperator{Ob}
@ -200,6 +201,7 @@
\DeclareCategory{AffVar}
\DeclareCategory{Alg}
\DeclareCategory{Field}
\DeclareCategory{GrAb}
\DeclareCategory{Sch}
%Set theory

View file

@ -1,5 +1,5 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright © 2021 Maximilian Keßler
% Copyright © 2022 Maximilian Keßler
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the “Software”), to deal
@ -26,8 +26,8 @@
% edit the source file and build the package again.
%
% Build details:
% PyTeX version: v1.2.0 (commit 126d420)
% Source code version: v2.4.0-beta (commit 0aefd5f)
% PyTeX version: v1.0.0-18 (commit 126d420)
% Source code version: v2.4.0-beta-8 (commit c592a7f)
%
% 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
@ -39,11 +39,12 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mkessler-proof}[2021/10/29 - Automatic references to theorems in proofs. Claim counters within proofs]
\ProvidesPackage{mkessler-proof}[2022/01/08 - Automatic references to theorems in proofs. Claim counters within proofs]
\RequirePackage{xkeyval}
\RequirePackage{refcount}
\newif\ifmkessler@proof@english\mkessler@proof@englishtrue
\DeclareOptionX{german}{\mkessler@proof@englishfalse}
@ -70,52 +71,59 @@
\AtBeginDocument{
\@ifpackageloaded{hyperref}{
\mkessler@proof@hyperreftrue
\def\grab#1{\expandafter\@firstoffive#1}
\def\mkessler@proof@blankref#1{\expandafter\grab\csname r@#1\endcsname}
\let\mkessler@proof@autoref\autoref
}{
\mkessler@proof@hyperreftrue
\let\mkessler@proof@blankref\ref
\let\mkessler@proof@autoref\ref
}
}
\NewDocumentEnvironment{rproof}{m O{}}{\def\mkessler@proof@aster{\relax}\begin{mkessler@proof@rproof@impl}{#1}[#2]}{\end{mkessler@proof@rproof@impl}}
\NewDocumentEnvironment{rproof*}{m O{}}{\def\mkessler@proof@aster{*}\begin{mkessler@proof@rproof@impl}{#1}[#2]}{\end{mkessler@proof@rproof@impl}}
\let\mkessler@proof@saved@proof\proof
\let\mkessler@proof@saved@endproof\endproof
\NewDocumentEnvironment{mkessler@proof@rproof@impl}{m O{}}
\NewDocumentEnvironment{refproof}{s 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\mkessler@proof@aster\space of\else Fortsetzung des Beweises\mkessler@proof@aster\space zu\fi}
\edef\haha{\value{mkessler@proof@#1@part}}
\ifcsdef{themkessler@proof@#2@save@claim}{
\setcounter{claim}{\value{mkessler@proof@#2@save@claim}}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Continuation of proof\IfBooleanT{#1}{*}\space of\else Fortsetzung des Beweises\IfBooleanT{#1}{*}\space zu\fi}
}{
\newcounter{mkessler@proof@#1@save@claim}
\newcounter{mkessler@proof@#2@save@claim}
\setcounter{claim}{0}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Proof\mkessler@proof@aster\space of\else Beweis\mkessler@proof@aster\space von\fi}
\def\mkessler@proof@proofprefix{\ifmkessler@proof@english Proof\ifBooleanT{#1}{*}\space of\else Beweis\IfBooleanT{#1}{*}\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}
\def\theclaim{\getrefnumber{#2}.\mkessler@proof@theoldclaim}
% Now, start the actual proof
\begin{proof}[\mkessler@proof@proofprefix\space\mkessler@proof@autoref{#1}\if\relax\detokenize{#2}\relax\else\space(#2)\fi]
\mkessler@proof@saved@proof[\mkessler@proof@proofprefix\space\mkessler@proof@autoref{#2}\IfValueT{#3}{\space(#3)}]
}
{
\end{proof} % End proof
\mkessler@proof@saved@endproof % End proof
% Save current claim counter for later restoration
\setcounter{mkessler@proof@#1@save@claim}{\value{claim}}
\setcounter{mkessler@proof@#2@save@claim}{\value{claim}}
}
% Proof (with asterisk)
\NewDocumentEnvironment{proof*}{O{}}
\AtBeginDocument{
\RenewDocumentEnvironment{proof}{s o}
{
\if\relax\detokenize{#1}\relax\begin{proof}[\ifmkessler@proof@english Proof\emph{*}\else Beweis\emph{*}\fi]\else\begin{proof}[#1\emph{*}]\fi
\IfNoValueTF{#2}{
\mkessler@proof@saved@proof[
\ifmkessler@proof@english
Proof\IfBooleanT{#1}{\emph{*}}
\else
Beweis\IfBooleanT{#1}{\emph{*}}
\fi
]
}{
\mkessler@proof@saved@proof[\ifmkessler@proof@english Proof\else Beweis\fi\IfBooleanT{#1}{\emph{*}}\space(#2)]
}
}
{
\end{proof}
\mkessler@proof@saved@endproof
}
}
%%subproof environment - essentially copied proof environment from amsthm and modified its name + symbol
\DeclareRobustCommand{\blackqed}{%