diff --git a/src/environments/groupthm.pysty3 b/src/environments/groupthm.pysty3 index 0e8c392..7f86396 100644 --- a/src/environments/groupthm.pysty3 +++ b/src/environments/groupthm.pysty3 @@ -264,12 +264,10 @@ __HEADER__(Grouping theorems for easier customization.) -%%% Theorem variants declaration -\ExplSyntaxOn +%%% Hacks for sorting groupnames - -\cs_new:Npn \add_to_sort_hook:n #1 +\cs_new:Npn \__add_to_sort_hook:n #1 { \hook_gput_code:nnn { groupthm / groupsort } { #1 } @@ -278,21 +276,26 @@ __HEADER__(Grouping theorems for easier customization.) } } -\cs_new:Npn \sort_group_names: +\cs_new:Npn \__sort_group_names: { \hook_gremove_code:nn { groupthm / groupsort }{*} - \clist_map_function:NN \l_groupthm_groups_clist \add_to_sort_hook:n + \clist_map_function:NN \l_groupthm_groups_clist \__add_to_sort_hook:n \clist_clear:N \l_groupthm_groups_clist \hook_use:n { groupthm / groupsort } } + +%%% Theorem variants declaration + +\ExplSyntaxOn + % envname, name, thmtools, list of groups \cs_new:Npn \generate_theorem_variants:nnnn #1 #2 #3 #4 { \clist_set:Nn \l_groupthm_groups_clist { #4 } \powerset_clist_foreach:Nn \l_groupthm_groups_clist { - \sort_group_names: + \__sort_group_names: \new_grouped_theorem:xVnn {__#1__groups_\clist_use:Nn \l_groupthm_groups_clist {_}} \l_groupthm_groups_clist @@ -323,7 +326,7 @@ __HEADER__(Grouping theorems for easier customization.) { \clist_put_left:Nn \l_groupthm_groups_clist { starred } } - \sort_group_names: + \__sort_group_names: \begin{__#1__groups_\clist_use:Nn \l_groupthm_groups_clist{_}} } { @@ -340,7 +343,7 @@ __HEADER__(Grouping theorems for easier customization.) { \clist_put_left:Nn \l_groupthm_groups_clist { starred } } - \sort_group_names: + \__sort_group_names: \end{__#1__groups_\clist_use:Nn \l_groupthm_groups_clist{_}} } }