From f4d079796adaa242d653de943b548a88fe9047ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 9 Jan 2022 15:38:26 +0100 Subject: [PATCH] add explicit subproof environment --- src/wip/refproof.pysty | 23 +++++++++++++++++++++++ tests/wip/proof/test.tex | 11 ++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/wip/refproof.pysty b/src/wip/refproof.pysty index 14c6a1d..9fefbde 100644 --- a/src/wip/refproof.pysty +++ b/src/wip/refproof.pysty @@ -120,6 +120,7 @@ __END_OPTIONS_X__ \def\proofdepth{Depth:~\the__PACKAGE_PREFIX__proofdepth} +%%% A 'smart' proof environment \AtBeginDocument{ \RenewDocumentEnvironment{proof}{s o} { @@ -156,3 +157,25 @@ __END_OPTIONS_X__ } } +\NewDocumentEnvironment{subproof}{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@subproof)[% + \IfBooleanTF{#1}{% + \translate{Subproof*}% + }{% + \translate{Subproof}% + }% + \IfValueT{#2}{\space(#2)}% + ] +} +{ + __PACKAGE_MACRO__(saved@endproof) + %Restore previous claim counter + \setcounter{claim}{\value{__PACKAGE_PREFIX__save@claim}} + \addtocounter{__PACKAGE_PREFIX__proofdepth}{-1} +} diff --git a/tests/wip/proof/test.tex b/tests/wip/proof/test.tex index 7af634f..ac7be22 100644 --- a/tests/wip/proof/test.tex +++ b/tests/wip/proof/test.tex @@ -9,9 +9,18 @@ \begin{document} \section{test} + +\begin{subproof} + test +\end{subproof} + +\begin{subproof}*[hi] + test +\end{subproof} + \begin{proof} Beginn des Beweises: - \begin{proof} + \begin{proof}* Ein unterbeweis \end{proof} Jetzt sind wir fertig.