implement theorem group rules

This commit is contained in:
Maximilian Keßler 2022-01-18 00:15:02 +01:00
parent d5372859c0
commit 7b136e0a65
2 changed files with 63 additions and 4 deletions

View file

@ -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

View file

@ -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}