From 7b136e0a65814d8bfd93bedbef2096efb9af1213 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Tue, 18 Jan 2022 00:15:02 +0100 Subject: [PATCH] implement theorem group rules --- doc/environments/groupthm/groupthm.dtx | 65 ++++++++++++++++++++++++-- doc/environments/groupthm/groupthm.sty | 2 +- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/doc/environments/groupthm/groupthm.dtx b/doc/environments/groupthm/groupthm.dtx index 9d0ecb6..e20cdf9 100644 --- a/doc/environments/groupthm/groupthm.dtx +++ b/doc/environments/groupthm/groupthm.dtx @@ -785,6 +785,15 @@ % % % +% \begin{function}{\groupthm_declare_theorem_group_rule:nnnn} +% \begin{syntax} +% \cs{groupthm_declare_theorem_group_rule:nnnn}\ma{keyname}\ma{theorem group 1} +% \ma{relation}\ma{theorem group 2} +% \end{syntax} +% +% \LaTeX3 version of \cs{DeclareTheoremGroupRule} +% +% \end{function} % % % @@ -1492,8 +1501,59 @@ % \end{macrocode} % \end{macro} % -% -% +% We also provide the interface for declaring the precedence rules for theorem groups. +% +% +% \begin{macro}{\groupthm_declare_theorem_group_rule:nnnn} +% \begin{syntax} +% \cs{groupthm_declare_theorem_group_rule:nnnn}\ma{keyname}\ma{theorem group 1} +% \ma{relation}\ma{theorem group 2} +% \end{syntax} +% +% We have to normalize the arguments a little bit, namely replacing \texttt{higher} +% and \texttt{lower} with \texttt{before} \texttt{after} respectively, +% and prefix the \meta{keyname} with \texttt{__groupthm} +% in case it is not the general hook \enquote{\texttt{??}}. +% +% \begin{macrocode} +\cs_new:Npn \groupthm_declare_theorem_group_rule:nnnn #1 #2 #3 #4 + { + \str_set:Nx \l_tmpa_str { \tl_trim_spaces:n { #3 } } + + \str_if_eq:VnT \l_tmpa_str { higher } + { + \str_set:Nn \l_tmpa_tl { after } + } + + \str_if_eq:VnT \l_tmpa_str { lower } + { + \str_set:Nn \l_tmpa_tl { before } + } + + \str_if_eq:nnTF { #1 } { ?? } + { + \hook_gset_rule:nnVn {??} {#2} \l_tmpa_tl {#4} + } + { + \hook_gset_rule:nnVn { @@ / #1 } {#2} \l_tmpa_tl {#4} + } + } +% \end{macrocode} +% \end{macro} + +% \begin{macro}{\DeclareTheoremGroupRule} +% \begin{syntax} +% \cs{DeclareTheoremGroupRule}[\meta{keyname}]% +% \{\meta{theorem group 1}\}\{\meta{relation}\}\{\meta{theorem group 2}\} +% \end{syntax} +% +% \begin{macrocode} +\NewDocumentCommand { \DeclareTheoremGroupRule } { O{??} m m m } + { + \groupthm_declare_theorem_group_rule:nnnn {#1} {#2} {#3} {#4} + } +% \end{macrocode} +% \end{macro} % % % \subsection{Grouped Theorems} @@ -1509,4 +1569,3 @@ % \end{implementation} % \end{documentation} % \newpage -% \PrintIndex diff --git a/doc/environments/groupthm/groupthm.sty b/doc/environments/groupthm/groupthm.sty index 6126871..6f6defb 100644 --- a/doc/environments/groupthm/groupthm.sty +++ b/doc/environments/groupthm/groupthm.sty @@ -20,7 +20,7 @@ %% original source files, as listed above, are part of the %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) -%% File: l3prop.dtx +%% File: groupthm.dtx \ProvidesExplPackage{groupthm}{2022/01/17}{0.0.1}{Grouped theorems.} \RequirePackage{amsthm} \RequirePackage{thmtools}