implement hook rules for theorem groups

This commit is contained in:
Maximilian Keßler 2022-01-16 18:35:07 +01:00
parent a8cca1cbc6
commit 886e562574

View file

@ -54,6 +54,8 @@ __HEADER__(Grouping theorems for easier customization.)
\tl_new:N \l_groupthm_mapname_clist
\tl_new:N \l_groupthm_thmtools_clist
\tl_new:N \l_groupthm_relation_tl
%%% Keys
@ -160,6 +162,8 @@ __HEADER__(Grouping theorems for easier customization.)
\hook_gremove_code:nn { groupthm / thmtools }{*}
\clist_map_function:nN { #2 } \group_use:n
% \ShowHook{ groupthm / postname }
\hook_use:n { groupthm / prename }
\hook_use:n { groupthm / postname }
\hook_use:n { groupthm / mapname }
@ -211,6 +215,32 @@ __HEADER__(Grouping theorems for easier customization.)
}
\cs_generate_variant:Nn \hook_gset_rule:nnnn { n n V n }
% hook group1 relation group2
\cs_new:Npn \declare_theorem_group_rule:nnnn #1 #2 #3 #4
{
\tl_set:Nx \l_groupthm_relation_tl { \tl_trim_spaces:n { #3 } }
\tl_if_eq:nnT { higher } { #3 }
{
\tl_set:Nn \l_groupthm_relation_tl { after }
}
\tl_if_eq:nnT { lower } { #3 }
{
\tl_set:Nn \l_groupthm_relation_tl { before }
}
\hook_gset_rule:nnVn {#1} {#2} \l_groupthm_relation_tl {#4}
}
% hook, group1, relation, group2
\NewDocumentCommand { \DeclareTheoremGroupRule } { O{??} m m m }
{
\declare_theorem_group_rule:nnnn {#1} {#2} {#3} {#4}
}
%%% Default groups available
@ -237,7 +267,7 @@ __HEADER__(Grouping theorems for easier customization.)
\NewTheoremGroup
[
thmtools = { sibling = insubsection },
postname = { * }
postname = { * },
] { star }
\NewTheoremGroup