fix refproof bugs: correct restoring of counter values and claim style numberings in stacked proofs

Build branch master (c0e4705) from kesslermaximilian/LatexPackages
This commit is contained in:
Maximilian Keßler 2022-01-09 21:23:03 +00:00
parent 264898f2ae
commit 558b903005
2 changed files with 20 additions and 14 deletions

View File

@ -1,8 +1,8 @@
{ {
"build_time": "", "build_time": "",
"source files": { "source files": {
"version": "v2.4.4-1-g47449c5", "version": "v2.4.4-2-gc0e4705",
"commit": "47449c57cba8fb88e34a93f1427d697895039fdc", "commit": "c0e4705c6360fb42045b8826f7b0b810ee4be134",
"dirty": false "dirty": false
}, },
"pytex": { "pytex": {
@ -44,9 +44,9 @@
{ {
"name": "mkessler-refproof.sty", "name": "mkessler-refproof.sty",
"source file": "refproof.pysty", "source file": "refproof.pysty",
"build time": "2022/01/09 19:21", "build time": "2022/01/09 21:23",
"source version": "v2.4.4-1-g47449c5", "source version": "v2.4.4-2-gc0e4705",
"source commit hash": "47449c57cba8fb88e34a93f1427d697895039fdc", "source commit hash": "c0e4705c6360fb42045b8826f7b0b810ee4be134",
"pytex version": "v1.2.0-3-g5e077e7", "pytex version": "v1.2.0-3-g5e077e7",
"pytex commit hash": "5e077e77d88ec6b71ac0d39e21572fad5938b0c6", "pytex commit hash": "5e077e77d88ec6b71ac0d39e21572fad5938b0c6",
"dirty": false "dirty": false

View File

@ -27,7 +27,7 @@
% %
% Build details: % Build details:
% PyTeX version: v1.2.0-3-g5e077e7 (commit 5e077e7) % PyTeX version: v1.2.0-3-g5e077e7 (commit 5e077e7)
% Source code version: v2.4.4-1-g47449c5 (commit 47449c5) % Source code version: v2.4.4-2-gc0e4705 (commit c0e4705)
% %
% This LaTeX package is free software and distributed under the MIT License. You % 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 % may use it freely for your purposes. The latest version of the package can be
@ -60,6 +60,7 @@
\RequirePackage{xparse} \RequirePackage{xparse}
\RequirePackage{refcount} \RequirePackage{refcount}
\RequirePackage{translator} \RequirePackage{translator}
\RequirePackage{fifo-stack}
\usedictionary{translator-proof-dictionary} \usedictionary{translator-proof-dictionary}
@ -80,12 +81,12 @@
\newcounter{mkessler@refproof@proofdepth} \newcounter{mkessler@refproof@proofdepth}
\setcounter{mkessler@refproof@proofdepth}{0} \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@proof\proof
\let\mkessler@refproof@saved@endproof\endproof \let\mkessler@refproof@saved@endproof\endproof
\FSCreate{mkessler@refproof@save@claim}{-1}
%%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
@ -126,8 +127,9 @@
{ {
\stepcounter{mkessler@refproof@proofdepth} \stepcounter{mkessler@refproof@proofdepth}
%Save the current claim counter %Save the current claim counter
\setcounter{mkessler@refproof@save@claim}{\value{claim}} \protected@edef\mkessler@refproof@dummy@expand{\arabic{claim}}
% Restore correct counter for claim \FSPush{mkessler@refproof@save@claim}{\mkessler@refproof@dummy@expand}
% Restore correct counter for claims in this refproof
\ifcsdef{themkessler@refproof@#2@save@claim}{ \ifcsdef{themkessler@refproof@#2@save@claim}{
\setcounter{claim}{\value{mkessler@refproof@#2@save@claim}} \setcounter{claim}{\value{mkessler@refproof@#2@save@claim}}
\def\mkessler@refproof@proofprefix{ \def\mkessler@refproof@proofprefix{
@ -149,6 +151,7 @@
} }
} }
% 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@refproof@saved@theclaim\theclaim
\def\theclaim{\getrefnumber{#2}.\arabic{claim}} \def\theclaim{\getrefnumber{#2}.\arabic{claim}}
% Now, start the actual proof % Now, start the actual proof
\mkessler@refproof@saved@proof[% \mkessler@refproof@saved@proof[%
@ -161,8 +164,10 @@
% Save current claim counter for later restoration % Save current claim counter for later restoration
\setcounter{mkessler@refproof@#2@save@claim}{\value{claim}} \setcounter{mkessler@refproof@#2@save@claim}{\value{claim}}
%Restore previous claim counter %Restore previous claim counter
\setcounter{claim}{\value{mkessler@refproof@save@claim}} \setcounter{claim}{\FSTop{mkessler@refproof@save@claim}}
\FSPop{mkessler@refproof@save@claim}
\addtocounter{mkessler@refproof@proofdepth}{-1} \addtocounter{mkessler@refproof@proofdepth}{-1}
\let\theclaim\mkessler@refproof@saved@theclaim
} }
\def\proofdepth{Depth:~\themkessler@refproof@proofdepth} \def\proofdepth{Depth:~\themkessler@refproof@proofdepth}
@ -173,7 +178,8 @@
{ {
\stepcounter{mkessler@refproof@proofdepth} \stepcounter{mkessler@refproof@proofdepth}
%Save the current claim counter %Save the current claim counter
\setcounter{mkessler@refproof@save@claim}{\value{claim}} \protected@edef\mkessler@refproof@dummy@expand{\arabic{claim}}
\FSPush{mkessler@refproof@save@claim}{\mkessler@refproof@dummy@expand}
\setcounter{claim}{0} \setcounter{claim}{0}
\def\theclaim{\arabic{claim}} \def\theclaim{\arabic{claim}}
\ifnum\value{mkessler@refproof@proofdepth}>1% \ifnum\value{mkessler@refproof@proofdepth}>1%
@ -199,8 +205,8 @@
{ {
\mkessler@refproof@saved@endproof \mkessler@refproof@saved@endproof
%Restore previous claim counter %Restore previous claim counter
\setcounter{claim}{\value{mkessler@refproof@save@claim}} \setcounter{claim}{\FSTop{mkessler@refproof@save@claim}}
\addtocounter{mkessler@refproof@proofdepth}{-1} \FSPop{mkessler@refproof@save@claim}
} }
} }