diff --git a/doc/environments/groupthm/groupthm.dtx b/doc/environments/groupthm/groupthm.dtx index 97b9bf9..ced8cfd 100644 --- a/doc/environments/groupthm/groupthm.dtx +++ b/doc/environments/groupthm/groupthm.dtx @@ -1382,13 +1382,13 @@ { % \end{macrocode} % -% \begin{macro}{\@@_use_group_\meta{theorem group}:} +% \begin{macro}{\@@_use_group__\meta{theorem group}:} % % This is the internal macro that will be called when retrieving contents of a group. % We define this here to store the properties of the group. % % \begin{macrocode} - \cs_new:cpn { @@_use_group_#1: } + \cs_new:cpn { @@_use_group__#1: } { \hook_gput_code:nnn { @@/prefix } { #1 } { @@ -1442,7 +1442,7 @@ \cs_new:Npn \@@_undefine_group:n #1 { \tl_log:n { Undefining ~ theorem ~ group ~ '#1' } - \cs_undefine:c { @@_use_group_#1: } + \cs_undefine:c { @@_use_group__#1: } % \end{macrocode} % % Remove properties from hooks @@ -1661,7 +1661,7 @@ \@@_define_multiple:nnnNNnn { new, renew, provide, declare } { theorem group } - { @@_use_group_##1: } + { @@_use_group__##1: } \@@_undefine_group:n \@@_define_group:nnnnn { groupthm_#1_group:nnnnn } @@ -1892,6 +1892,26 @@ % % \subsection{Grouped Theorems} % +% +% +% \begin{macro}{\@@_ensure_group_exists:n} +% \begin{syntax} +% \cs{@@_ensure_group_exists:n}\meta{theorem group} +% \end{syntax} +% +% Checks if this group exists. +% If not, produces an error message. +% +% \begin{macrocode} +\cs_new:Npn \@@_ensure_group_exists:n #1 + { + \cs_if_exist:cF { @@_use_group__#1: } + { + \msg_error:nnn { groupthm } { unknown ~ group } { #1 } + } + } +% \end{macrocode} +% \end{macro} % % \begin{macro}{\@@_use_group:n} % \begin{syntax} @@ -1905,10 +1925,8 @@ % \begin{macrocode} \cs_new:Npn \@@_use_group:n #1 { - \cs_if_exist_use:cF { @@_use_group_#1: } - { - \msg_error:nnn { groupthm } { unknown ~ group } { #1 } - } + \@@_ensure_group_exists:n { #1 } + \use:c { @@_use_group__#1: } } % \end{macrocode} % \end{macro} diff --git a/doc/environments/groupthm/groupthm.sty b/doc/environments/groupthm/groupthm.sty index 865a70c..324416f 100644 --- a/doc/environments/groupthm/groupthm.sty +++ b/doc/environments/groupthm/groupthm.sty @@ -163,7 +163,7 @@ } \cs_new:Npn \__groupthm_define_group:nnnnn #1#2#3#4#5 { - \cs_new:cpn { __groupthm_use_group_#1: } + \cs_new:cpn { __groupthm_use_group__#1: } { \hook_gput_code:nnn { __groupthm/prefix } { #1 } { @@ -188,7 +188,7 @@ \cs_new:Npn \__groupthm_undefine_group:n #1 { \tl_log:n { Undefining ~ theorem ~ group ~ '#1' } - \cs_undefine:c { __groupthm_use_group_#1: } + \cs_undefine:c { __groupthm_use_group__#1: } \hook_gremove_code:nn { __groupthm/prefix } { #1 } \hook_gremove_code:nn { __groupthm/suffix } { #1 } \hook_gremove_code:nn { __groupthm/mapname } { #1 } @@ -288,7 +288,7 @@ \__groupthm_define_multiple:nnnNNnn { new, renew, provide, declare } { theorem group } - { __groupthm_use_group_##1: } + { __groupthm_use_group__##1: } \__groupthm_undefine_group:n \__groupthm_define_group:nnnnn { groupthm_#1_group:nnnnn } @@ -402,13 +402,18 @@ \__powerset_clist_foreach_aux:Nn #1 {#2} \clist_set_eq:NN #1 \l__powerset_copied_clist } -\cs_new:Npn \__groupthm_use_group:n #1 +\cs_new:Npn \__groupthm_ensure_group_exists:n #1 { - \cs_if_exist_use:cF { __groupthm_use_group_#1: } + \cs_if_exist:cF { __groupthm_use_group__#1: } { \msg_error:nnn { groupthm } { unknown ~ group } { #1 } } } +\cs_new:Npn \__groupthm_use_group:n #1 + { + \__groupthm_ensure_group_exists:n { #1 } + \use:c { __groupthm_use_group__#1: } + } \cs_new:Npn \__groupthm_use_function_on_name:n #1 { \tl_set:Nx \l__groupthm_name_tl