provide proper proofdepth macro. fix subproof

This commit is contained in:
Maximilian Keßler 2022-01-10 00:31:26 +01:00
parent 0011cb2270
commit eb06eb8fbc
2 changed files with 9 additions and 8 deletions

View file

@ -75,7 +75,7 @@ __END_OPTIONS_X__
\end__PACKAGE_PREFIX__saved@subproof \end__PACKAGE_PREFIX__saved@subproof
{ {
\NewDocumentEnvironment{refproof}{s m o} \NewDocumentEnvironment{refproof}{s m !o}
{ {
\stepcounter{__PACKAGE_PREFIX__proofdepth} \stepcounter{__PACKAGE_PREFIX__proofdepth}
%Save the current claim counter %Save the current claim counter
@ -124,7 +124,7 @@ __END_OPTIONS_X__
%%% A 'smart' proof environment %%% A 'smart' proof environment
\AtBeginDocument{ \AtBeginDocument{
\RenewDocumentEnvironment{proof}{s o} \RenewDocumentEnvironment{proof}{!s !o}
{ {
\stepcounter{__PACKAGE_PREFIX__proofdepth} \stepcounter{__PACKAGE_PREFIX__proofdepth}
%Save the current claim counter %Save the current claim counter
@ -160,11 +160,12 @@ __END_OPTIONS_X__
} }
} }
\NewDocumentEnvironment{subproof}{s o} \NewDocumentEnvironment{subproof}{!s !o}
{ {
\stepcounter{__PACKAGE_PREFIX__proofdepth} \stepcounter{__PACKAGE_PREFIX__proofdepth}
%Save the current claim counter %Save the current claim counter
\setcounter{__PACKAGE_PREFIX__save@claim}{\value{claim}} \protected@edef__PACKAGE_MACRO__(dummy@expand){\arabic{claim}}
\FSPush{__PACKAGE_PREFIX__save@claim}{__PACKAGE_MACRO__(dummy@expand)}
\setcounter{claim}{0} \setcounter{claim}{0}
\def\theclaim{\arabic{claim}} \def\theclaim{\arabic{claim}}
__PACKAGE_MACRO__(saved@subproof)[% __PACKAGE_MACRO__(saved@subproof)[%
@ -179,6 +180,9 @@ __END_OPTIONS_X__
{ {
__PACKAGE_MACRO__(saved@endproof) __PACKAGE_MACRO__(saved@endproof)
%Restore previous claim counter %Restore previous claim counter
\setcounter{claim}{\value{__PACKAGE_PREFIX__save@claim}} \setcounter{claim}{\FSTop{__PACKAGE_PREFIX__save@claim}}
\FSPop{__PACKAGE_PREFIX__save@claim}
\addtocounter{__PACKAGE_PREFIX__proofdepth}{-1} \addtocounter{__PACKAGE_PREFIX__proofdepth}{-1}
} }
\newcommand\proofdepth{\arabic{__PACKAGE_PREFIX__proofdepth}}

View file

@ -35,14 +35,11 @@
\end{claim} \end{claim}
\begin{proof} \begin{proof}
\proofdepth
\begin{claim} \begin{claim}
hi hi
\end{claim} \end{claim}
\begin{proof} \begin{proof}
\proofdepth
\end{proof} \end{proof}
\proofdepth
\begin{claim} \begin{claim}
\end{claim} \end{claim}