diff --git a/doc/environments/groupthm/groupthm.dtx b/doc/environments/groupthm/groupthm.dtx index c31e1e2..cb89430 100644 --- a/doc/environments/groupthm/groupthm.dtx +++ b/doc/environments/groupthm/groupthm.dtx @@ -2159,7 +2159,7 @@ % { % \groupthm_new_theorem:nnnn, % \groupthm_new_theorem:nVVV, -% \groupthm_new_theorem:xVnn +% \groupthm_new_theorem:xVnn, % \groupthm_provide_theorem:nnnn, % \groupthm_provide_theorem:nVVV, % \groupthm_provide_theorem:xVnn @@ -2260,7 +2260,6 @@ % % % -% % \subsection{Theorem families} % % @@ -2269,10 +2268,10 @@ % As a backend, we use the following auxiliary function % % -% \begin{macro}{\@@_declare_grouped_theorem_family_aux:nnnnnn} +% \begin{macro}{\@@_define_family:nnnnnn} % \begin{syntax} -% \cs{@@_declare_grouped_theorem_family_aux:nnnnnn}\marg{family name}\marg{groups clist} -% \marg{name}\marg{name}\marg{thmtools clist}\marg{extra groups clist}\marg{generation type} +% \cs{@@_define_family:nnnnnn}\marg{family name}\marg{groups clist} +% \marg{name}\marg{thmtools clist}\marg{extra groups clist} % \end{syntax} % % This will generate a new grouped theorem for each union of a subset of \mymeta{groups clist} @@ -2282,10 +2281,8 @@ % the \mymeta{family name} and the list of groups of this variant, that will be generated % in a unique manner to later retrieve the generated theorems when parsing theorem families. % -% The \mymeta{generation type} can be either \texttt{new} or \texttt{provide}, -% depending on which backend for grouped theorem generation to use % \begin{macrocode} -\cs_new:Npn \@@_declare_grouped_theorem_family_aux:nnnnnn #1 #2 #3 #4 #5 #6 +\cs_new:Npn \@@_define_family:nnnnn #1 #2 #3 #4 #5 { % \end{macrocode} % Make a local copy of the \mymeta{groups clist} argument, @@ -2306,361 +2303,80 @@ % \begin{macrocode} \@@_sort_group_names: % \end{macrocode} -% Now just declare the grouped theorem, passing the corresponding arguments and using -% specified \texttt{\#6} as backend. +% Now just declare the grouped theorem, passing the corresponding arguments % \begin{macrocode} - \use:c{groupthm_#6_grouped_theorem:xVnn} + \use:c{groupthm_new_theorem:xVnn} {__#1__groups_\clist_use:Nn \l_@@_group_clist {_}} \l_@@_group_clist { #3 } { #4 } } +% \end{macrocode} +% We save the set of variants we generated for later error checking: +% \begin{macrocode} + \clist_new:c { @@_family__#1__group_clist } + \clist_set_eq:cN {@@_family__#1__group_clist } \l_tmpa_clist + \clist_new:c { @@_family__#1__always_group_clist } + \clist_set:cn {@@_family__#1__always_group_clist } { #5 } } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\groupthm_new_grouped_theorem_family:nnnn,\groupthm_new_grouped_theorem_family:nVVV} +% \begin{macro}{\groupthm_new_family:nnnnn,\groupthm_new_family:nVVVV} % \begin{syntax} -% \cs{groupthm_new_grouped_theorem_family:nnnn}\marg{family name} -% \marg{groups}\marg{name}\marg{thmtools clist} +% \cs{groupthm_new_theorem_family:nnnnn}\marg{theorem family} +% \marg{groups_1}\marg{name}\marg{thmtools clist}\marg{groups_2} % \end{syntax} % -% Just pass the arguments to the auxiliary function, with no additional groups -% and the \texttt{new} backend. % % \begin{macrocode} -\cs_new:Npn \groupthm_new_grouped_theorem_family:nnnn #1 #2 #3 #4 - { - \@@_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2 } { #3 } { #4 } { } { new } - } -\cs_generate_variant:Nn \groupthm_new_grouped_theorem_family:nnnn { n V V V } +\@@_define_multiple:nnnNNnn + { new, provide } + { theorem ~ family } + { @@_family__##1__group_clist } + \@@_error: + \@@_define_family:nnnnn + { groupthm_#1_family:nnnnn } + { { ##1 } { ##2 } { ##3 } { ##4 } { ##5 }} +\cs_generate_variant:Nn \groupthm_new_family:nnnnn { n V V V V } +\cs_generate_variant:Nn \groupthm_provide_family:nnnnn { n V V V V } % \end{macrocode} % \end{macro} % -% % -% \begin{macro}{\groupthm_provide_grouped_theorem_family:nnnn,\groupthm_provide_grouped_theorem_family:nVVV} +% \begin{macro}{\groupthm_new_family:nnn} % \begin{syntax} -% \cs{groupthm_provide_grouped_theorem_family:nnnn}\marg{family name} -% \marg{groups}\marg{name}\marg{thmtools clist} +% \cs{groupthm_new_family:nnn}\marg{key=value list}\marg{theorem family}\marg{bool} % \end{syntax} % -% Just pass the arguments to the auxiliary function, with no additional groups -% and the \texttt{provide} backend. +% The third argument indicates whether the generated theorem(s) will all be added to the +% \texttt{unnumbered} group. % % \begin{macrocode} -\cs_new:Npn \groupthm_provide_grouped_theorem_family:nnnn #1 #2 #3 #4 - { - \@@_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2 } { #3 } { #4 } { } { provide } - } -\cs_generate_variant:Nn \groupthm_provide_grouped_theorem_family:nnnn { n V V V } -% \end{macrocode} -% \end{macro} -% -% -% The starred variants that add the \texttt{unnumbered} group are straightforward: -% -% -% -% \begin{macro}{\groupthm_new_grouped_theorem_family_star:nnnn,\groupthm_new_grouped_theorem_family_star:nVVV} -% \begin{syntax} -% \cs{groupthm_new_grouped_theorem_family_star:nnnn}\marg{family name} -% \marg{groups}\marg{name}\marg{thmtools clist} -% \end{syntax} -% -% Just pass the arguments to the auxiliary function, with the additional -% \texttt{unnumbered group} and the \texttt{new} backend. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_new_grouped_theorem_family_star:nnnn #1 #2 #3 #4 - { - \@@_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2 } { #3 } { #4 } { unnumbered } { new } - } -\cs_generate_variant:Nn \groupthm_new_grouped_theorem_family_star:nnnn { n V V V } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_provide_grouped_theorem_family_star:nnnn,\groupthm_provide_grouped_theorem_family_star:nVVV} -% \begin{syntax} -% \cs{groupthm_provide_grouped_theorem_family_star:nnnn}\marg{family name} -% \marg{groups}\marg{name}\marg{thmtools clist} -% \end{syntax} -% -% Just pass the arguments to the auxiliary function, with the additional -% \texttt{unnumbered group} and the \texttt{provide} backend. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_provide_grouped_theorem_family_star:nnnn #1 #2 #3 #4 - { - \@@_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2 } { #3 } { #4 } { } { provide } - } -\cs_generate_variant:Nn \groupthm_provide_grouped_theorem_family_star:nnnn { n V V V } -% \end{macrocode} -% \end{macro} -% -% -% Now define the variants that also generate the starred and unstarred family versions. -% -% -% \begin{macro}{\groupthm_new_theorem_family:nnnn,\groupthm_new_theorem_family:nVVV} -% \begin{syntax} -% \cs{groupthm_new_theorem_family:nnnn}\marg{family name} -% \marg{groups}\marg{name}\marg{thmtools clist} -% \end{syntax} -% -% -% \begin{macrocode} -\cs_new:Npn \groupthm_new_theorem_family:nnnn #1 #2 #3 #4 - { - \@@_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2, starred } { #3 } { #4 } { } { new } - } -\cs_generate_variant:Nn \groupthm_new_theorem_family:nnnn { n V V V } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_provide_theorem_family:nnnn,\groupthm_provide_theorem_family:nVVV} -% \begin{syntax} -% \cs{groupthm_provide_theorem_family:nnnn}\marg{family name} -% \marg{groups}\marg{name}\marg{thmtools clist} -% \end{syntax} -% -% -% \begin{macrocode} -\cs_new:Npn \groupthm_provide_theorem_family:nnnn #1 #2 #3 #4 - { - \@@_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2, starred } { #3 } { #4 } { } { provide } - } -\cs_generate_variant:Nn \groupthm_provide_theorem_family:nnnn { n V V V } -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\groupthm_new_theorem_family_star:nnnn,\groupthm_new_theorem_family_star:nVVV} -% \begin{syntax} -% \cs{groupthm_new_theorem_family_star:nnnn}\marg{family name} -% \marg{groups}\marg{name}\marg{thmtools clist} -% \end{syntax} -% -% -% \begin{macrocode} -\cs_new:Npn \groupthm_new_theorem_family_star:nnnn #1 #2 #3 #4 - { - \@@_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2, starred } { #3 } { #4 } { unnumbered } { new } - } -\cs_generate_variant:Nn \groupthm_new_theorem_family_star:nnnn { n V V V } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_provide_theorem_family_star:nnnn,\groupthm_provide_theorem_family_star:nVVV} -% \begin{syntax} -% \cs{groupthm_provide_theorem_family_star:nnnn}\marg{family name} -% \marg{groups}\marg{name}\marg{thmtools clist} -% \end{syntax} -% -% -% \begin{macrocode} -\cs_new:Npn \groupthm_provide_theorem_family_star:nnnn #1 #2 #3 #4 - { - \@@_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2, starred } { #3 } { #4 } { } { provide } - } -\cs_generate_variant:Nn \groupthm_provide_theorem_family_star:nnnn { n V V V } -% \end{macrocode} -% \end{macro} -% -% -% -% We now make the key variants available of these, all of the work in the same way -% as we just have to set the normalized keys and pass to our non-key-value versions. -% -% -% -% -% \begin{macro}{\groupthm_new_grouped_theorem_family_from_keys:nn} -% \begin{syntax} -% \cs{groupthm_new_grouped_theorem_family_from_keys:nn}\marg{keys}\marg{family name} -% \end{syntax} -% -% Just retrieve the normalized keys and pass on arguments. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_new_grouped_theorem_family_from_keys:nn #1 #2 - { - \@@_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_new_grouped_theorem_family:nVVV - { #2 } - \l_@@_group_clist - \l_@@_name_tl - \l_@@_thmtools_clist - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_provide_grouped_theorem_family_from_keys:nn} -% \begin{syntax} -% \cs{groupthm_provide_grouped_theorem_family_from_keys:nn}\marg{keys}\marg{family name} -% \end{syntax} -% -% Just retrieve the normalized keys and pass on arguments. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_provide_grouped_theorem_family_from_keys:nn #1 #2 - { - \@@_set_normalized_keys:nnn { #1 } {grouped ~ theorem} { #2 } - \groupthm_provide_grouped_theorem_family:nVVV - { #2 } - \l_@@_group_clist - \l_@@_name_tl - \l_@@_thmtools_clist - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_new_grouped_theorem_family_star_from_keys:nn} -% \begin{syntax} -% \cs{groupthm_new_grouped_theorem_family_star_from_keys:nn}\marg{keys}\marg{family name} -% \end{syntax} -% -% Just retrieve the normalized keys and pass on arguments. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_new_grouped_theorem_family_star_from_keys:nn #1 #2 - { - \@@_set_normalized_keys:nnn { #1 } { grouped ~ theorem }{ #2 } - \groupthm_new_grouped_theorem_family_star:nVVV - { #2 } - \l_@@_group_clist - \l_@@_name_tl - \l_@@_thmtools_clist - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_provide_grouped_theorem_family_star_from_keys:nn} -% \begin{syntax} -% \cs{groupthm_provide_grouped_theorem_family_star_from_keys:nn}\marg{keys}\marg{family name} -% \end{syntax} -% -% Just retrieve the normalized keys and pass on arguments. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_provide_grouped_theorem_family_star_from_keys:nn #1 #2 - { - \@@_set_normalized_keys:nnn { #1 } { grouped ~ theorem }{ #2 } - \groupthm_provide_grouped_theorem_family_star:nVVV - { #2 } - \l_@@_group_clist - \l_@@_name_tl - \l_@@_thmtools_clist - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_new_theorem_family_from_keys:nn} -% \begin{syntax} -% \cs{groupthm_new_theorem_family_from_keys:nn}\marg{keys}\marg{family name} -% \end{syntax} -% -% Just retrieve the normalized keys and pass on arguments. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_new_theorem_family_from_keys:nn #1 #2 - { - \@@_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_new_theorem_family:nVVV - { #2 } - \l_@@_group_clist - \l_@@_name_tl - \l_@@_thmtools_clist - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_provide_theorem_family_from_keys:nn} -% \begin{syntax} -% \cs{groupthm_provide_theorem_family_from_keys:nn}\marg{keys}\marg{family name} -% \end{syntax} -% -% Just retrieve the normalized keys and pass on arguments. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_provide_theorem_family_from_keys:nn #1 #2 - { - \@@_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_provide_theorem_family:nVVV - { #2 } - \l_@@_group_clist - \l_@@_name_tl - \l_@@_thmtools_clist - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_new_theorem_family_star_from_keys:nn} -% \begin{syntax} -% \cs{groupthm_new_theorem_family_star_from_keys:nn}\marg{keys}\marg{family name} -% \end{syntax} -% -% Just retrieve the normalized keys and pass on arguments. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_new_theorem_family_star_from_keys:nn #1 #2 - { - \@@_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_new_theorem_family_star:nVVV - { #2 } - \l_@@_group_clist - \l_@@_name_tl - \l_@@_thmtools_clist - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\groupthm_provide_theorem_family_star_from_keys:nn} -% \begin{syntax} -% \cs{groupthm_provide_theorem_family_star_from_keys:nn}\marg{keys}\marg{family name} -% \end{syntax} -% -% Just retrieve the normalized keys and pass on arguments. -% -% \begin{macrocode} -\cs_new:Npn \groupthm_provide_theorem_family_star_from_keys:nn #1 #2 - { - \@@_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_provide_theorem_family_star:nVVV - { #2 } - \l_@@_group_clist - \l_@@_name_tl - \l_@@_thmtools_clist - } +\@@_wrap_multiple:nnn +{ new, provide } +{ groupthm_#1_family:nnn } +{ + \@@_set_normalized_keys:nnn { ##1 } { theorem ~ family } { ##2 } + \bool_if:nTF { ##3} + { + \clist_set:Nn \l_tmpa_clist { unnumbered } + } + { + \clist_clear:N \l_tmpa_clist + } + \bool_if:NT \l_@@_starred_version_bool + { + \clist_put_left:Nn \l_@@_group_clist { starred } + } + \use:c { groupthm_#1_family:nVVVV } + { ##2 } + \l_@@_group_clist + \l_@@_name_tl + \l_@@_thmtools_clist + \l_tmpa_clist +} % \end{macrocode} % \end{macro} % @@ -2669,94 +2385,29 @@ % Finally, we can provide document commands that make these available. % % -% \begin{macro}{\NewGroupedTheoremFamily,\NewGroupedTheoremFamily*} +% \begin{macro} +% { +% \NewGroupedTheoremFamily,\NewGroupedTheoremFamily*, +% \ProvideGroupedTheoremFamily, \ProvideGroupedTheoremFamily* +% } % \begin{syntax} % \cs{NewGroupedTheoremFamily}\oarg{keys}\marg{family name} % \end{syntax} -% -% % % \begin{macrocode} -\NewDocumentCommand{\NewGroupedTheoremFamily}{s O{} m} +\@@_wrap_multiple_document:nnnn + { new, provide } + { \Declarator GroupedTheoremFamily } + { s O{} m } { - \IfBooleanTF { #1 } - { - \groupthm_new_grouped_theorem_family_star_from_keys:nn { #2 } { #3 } - } - { - \groupthm_new_grouped_theorem_family_from_keys:nn { #2 } { #3 } - } + \use:c { groupthm_#1_family:nnn } + { ##2 } + { ##3 } + { ##1 } } % \end{macrocode} % \end{macro} -% -% % -% \begin{macro}{\ProvideGroupedTheoremFamily,\ProvideGroupedTheoremFamily*} -% \begin{syntax} -% \cs{ProvideGroupedTheoremFamily}\oarg{keys}\marg{family name} -% \end{syntax} -% -% -% -% \begin{macrocode} -\NewDocumentCommand{\ProvideGroupedTheoremFamily}{s O{} m} - { - \IfBooleanTF { #1 } - { - \groupthm_provide_grouped_theorem_family_star_from_keys:nn { #2 } { #3 } - } - { - \groupthm_provide_grouped_theorem_family_from_keys:nn { #2 } { #3 } - } - } -% \end{macrocode} -% \end{macro} -% -% -% \begin{macro}{\NewTheoremFamily,\NewTheoremFamily*} -% \begin{syntax} -% \cs{NewTheoremFamily}\oarg{keys}\marg{family name} -% \end{syntax} -% -% -% -% \begin{macrocode} -\NewDocumentCommand{\NewTheoremFamily}{s O{} m} - { - \IfBooleanTF { #1 } - { - \groupthm_new_theorem_family_star_from_keys:nn { #2 } { #3 } - } - { - \groupthm_new_theorem_family_from_keys:nn { #2 } { #3 } - } - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\ProvideTheoremFamily,\ProvideTheoremFamily*} -% \begin{syntax} -% \cs{ProvideTheoremFamily}\oarg{keys}\marg{family name} -% \end{syntax} -% -% -% -% \begin{macrocode} -\NewDocumentCommand{\ProvideTheoremFamily}{s O{} m} - { - \IfBooleanTF { #1 } - { - \groupthm_provide_theorem_family_star_from_keys:nn { #2 } { #3 } - } - { - \groupthm_provide_theorem_family_from_keys:nn { #2 } { #3 } - } - } -% \end{macrocode} -% \end{macro} % % % \subsection{Theorem family options} diff --git a/doc/environments/groupthm/groupthm.sty b/doc/environments/groupthm/groupthm.sty index a40daa1..4dd736a 100644 --- a/doc/environments/groupthm/groupthm.sty +++ b/doc/environments/groupthm/groupthm.sty @@ -559,7 +559,7 @@ { ##3 } { ##1 } } -\cs_new:Npn \__groupthm_declare_grouped_theorem_family_aux:nnnnnn #1 #2 #3 #4 #5 #6 +\cs_new:Npn \__groupthm_define_family:nnnnn #1 #2 #3 #4 #5 { \clist_set:Nn \l_tmpa_clist { #2 } \powerset_clist_foreach:Nn \l_tmpa_clist @@ -567,172 +567,59 @@ \clist_set_eq:NN \l__groupthm_group_clist \l_tmpa_clist \clist_put_right:Nn \l__groupthm_group_clist { #5 } \__groupthm_sort_group_names: - \use:c{groupthm_#6_grouped_theorem:xVnn} + \use:c{groupthm_new_theorem:xVnn} {__#1__groups_\clist_use:Nn \l__groupthm_group_clist {_}} \l__groupthm_group_clist { #3 } { #4 } } + \clist_new:c { __groupthm_family__#1__group_clist } + \clist_set_eq:cN {__groupthm_family__#1__group_clist } \l_tmpa_clist + \clist_new:c { __groupthm_family__#1__always_group_clist } + \clist_set:cn {__groupthm_family__#1__always_group_clist } { #5 } } -\cs_new:Npn \groupthm_new_grouped_theorem_family:nnnn #1 #2 #3 #4 +\__groupthm_define_multiple:nnnNNnn + { new, provide } + { theorem ~ family } + { __groupthm_family__##1__group_clist } + \__groupthm_error: + \__groupthm_define_family:nnnnn + { groupthm_#1_family:nnnnn } + { { ##1 } { ##2 } { ##3 } { ##4 } { ##5 }} +\cs_generate_variant:Nn \groupthm_new_family:nnnnn { n V V V V } +\cs_generate_variant:Nn \groupthm_provide_family:nnnnn { n V V V V } +\__groupthm_wrap_multiple:nnn +{ new, provide } +{ groupthm_#1_family:nnn } +{ + \__groupthm_set_normalized_keys:nnn { ##1 } { theorem ~ family } { ##2 } + \bool_if:nTF { ##3} + { + \clist_set:Nn \l_tmpa_clist { unnumbered } + } + { + \clist_clear:N \l_tmpa_clist + } + \bool_if:NT \l__groupthm_starred_version_bool + { + \clist_put_left:Nn \l__groupthm_group_clist { starred } + } + \use:c { groupthm_#1_family:nVVVV } + { ##2 } + \l__groupthm_group_clist + \l__groupthm_name_tl + \l__groupthm_thmtools_clist + \l_tmpa_clist +} +\__groupthm_wrap_multiple_document:nnnn + { new, provide } + { \Declarator GroupedTheoremFamily } + { s O{} m } { - \__groupthm_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2 } { #3 } { #4 } { } { new } - } -\cs_generate_variant:Nn \groupthm_new_grouped_theorem_family:nnnn { n V V V } -\cs_new:Npn \groupthm_provide_grouped_theorem_family:nnnn #1 #2 #3 #4 - { - \__groupthm_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2 } { #3 } { #4 } { } { provide } - } -\cs_generate_variant:Nn \groupthm_provide_grouped_theorem_family:nnnn { n V V V } -\cs_new:Npn \groupthm_new_grouped_theorem_family_star:nnnn #1 #2 #3 #4 - { - \__groupthm_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2 } { #3 } { #4 } { unnumbered } { new } - } -\cs_generate_variant:Nn \groupthm_new_grouped_theorem_family_star:nnnn { n V V V } -\cs_new:Npn \groupthm_provide_grouped_theorem_family_star:nnnn #1 #2 #3 #4 - { - \__groupthm_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2 } { #3 } { #4 } { } { provide } - } -\cs_generate_variant:Nn \groupthm_provide_grouped_theorem_family_star:nnnn { n V V V } -\cs_new:Npn \groupthm_new_theorem_family:nnnn #1 #2 #3 #4 - { - \__groupthm_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2, starred } { #3 } { #4 } { } { new } - } -\cs_generate_variant:Nn \groupthm_new_theorem_family:nnnn { n V V V } -\cs_new:Npn \groupthm_provide_theorem_family:nnnn #1 #2 #3 #4 - { - \__groupthm_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2, starred } { #3 } { #4 } { } { provide } - } -\cs_generate_variant:Nn \groupthm_provide_theorem_family:nnnn { n V V V } -\cs_new:Npn \groupthm_new_theorem_family_star:nnnn #1 #2 #3 #4 - { - \__groupthm_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2, starred } { #3 } { #4 } { unnumbered } { new } - } -\cs_generate_variant:Nn \groupthm_new_theorem_family_star:nnnn { n V V V } -\cs_new:Npn \groupthm_provide_theorem_family_star:nnnn #1 #2 #3 #4 - { - \__groupthm_declare_grouped_theorem_family_aux:nnnnnn - { #1 } { #2, starred } { #3 } { #4 } { } { provide } - } -\cs_generate_variant:Nn \groupthm_provide_theorem_family_star:nnnn { n V V V } -\cs_new:Npn \groupthm_new_grouped_theorem_family_from_keys:nn #1 #2 - { - \__groupthm_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_new_grouped_theorem_family:nVVV - { #2 } - \l__groupthm_group_clist - \l__groupthm_name_tl - \l__groupthm_thmtools_clist - } -\cs_new:Npn \groupthm_provide_grouped_theorem_family_from_keys:nn #1 #2 - { - \__groupthm_set_normalized_keys:nnn { #1 } {grouped ~ theorem} { #2 } - \groupthm_provide_grouped_theorem_family:nVVV - { #2 } - \l__groupthm_group_clist - \l__groupthm_name_tl - \l__groupthm_thmtools_clist - } -\cs_new:Npn \groupthm_new_grouped_theorem_family_star_from_keys:nn #1 #2 - { - \__groupthm_set_normalized_keys:nnn { #1 } { grouped ~ theorem }{ #2 } - \groupthm_new_grouped_theorem_family_star:nVVV - { #2 } - \l__groupthm_group_clist - \l__groupthm_name_tl - \l__groupthm_thmtools_clist - } -\cs_new:Npn \groupthm_provide_grouped_theorem_family_star_from_keys:nn #1 #2 - { - \__groupthm_set_normalized_keys:nnn { #1 } { grouped ~ theorem }{ #2 } - \groupthm_provide_grouped_theorem_family_star:nVVV - { #2 } - \l__groupthm_group_clist - \l__groupthm_name_tl - \l__groupthm_thmtools_clist - } -\cs_new:Npn \groupthm_new_theorem_family_from_keys:nn #1 #2 - { - \__groupthm_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_new_theorem_family:nVVV - { #2 } - \l__groupthm_group_clist - \l__groupthm_name_tl - \l__groupthm_thmtools_clist - } -\cs_new:Npn \groupthm_provide_theorem_family_from_keys:nn #1 #2 - { - \__groupthm_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_provide_theorem_family:nVVV - { #2 } - \l__groupthm_group_clist - \l__groupthm_name_tl - \l__groupthm_thmtools_clist - } -\cs_new:Npn \groupthm_new_theorem_family_star_from_keys:nn #1 #2 - { - \__groupthm_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_new_theorem_family_star:nVVV - { #2 } - \l__groupthm_group_clist - \l__groupthm_name_tl - \l__groupthm_thmtools_clist - } -\cs_new:Npn \groupthm_provide_theorem_family_star_from_keys:nn #1 #2 - { - \__groupthm_set_normalized_keys:nnn { #1 } { grouped ~ theorem } { #2 } - \groupthm_provide_theorem_family_star:nVVV - { #2 } - \l__groupthm_group_clist - \l__groupthm_name_tl - \l__groupthm_thmtools_clist - } -\NewDocumentCommand{\NewGroupedTheoremFamily}{s O{} m} - { - \IfBooleanTF { #1 } - { - \groupthm_new_grouped_theorem_family_star_from_keys:nn { #2 } { #3 } - } - { - \groupthm_new_grouped_theorem_family_from_keys:nn { #2 } { #3 } - } - } -\NewDocumentCommand{\ProvideGroupedTheoremFamily}{s O{} m} - { - \IfBooleanTF { #1 } - { - \groupthm_provide_grouped_theorem_family_star_from_keys:nn { #2 } { #3 } - } - { - \groupthm_provide_grouped_theorem_family_from_keys:nn { #2 } { #3 } - } - } -\NewDocumentCommand{\NewTheoremFamily}{s O{} m} - { - \IfBooleanTF { #1 } - { - \groupthm_new_theorem_family_star_from_keys:nn { #2 } { #3 } - } - { - \groupthm_new_theorem_family_from_keys:nn { #2 } { #3 } - } - } -\NewDocumentCommand{\ProvideTheoremFamily}{s O{} m} - { - \IfBooleanTF { #1 } - { - \groupthm_provide_theorem_family_star_from_keys:nn { #2 } { #3 } - } - { - \groupthm_provide_theorem_family_from_keys:nn { #2 } { #3 } - } + \use:c { groupthm_#1_family:nnn } + { ##2 } + { ##3 } + { ##1 } } \cs_new:Npn \groupthm_add_theorem_to_group:n #1 { diff --git a/doc/environments/groupthm/groupthm.tdo b/doc/environments/groupthm/groupthm.tdo index b0b3298..944bf21 100644 --- a/doc/environments/groupthm/groupthm.tdo +++ b/doc/environments/groupthm/groupthm.tdo @@ -1,8 +1,8 @@ -\contentsline {todo}{\color@fb@x {}{black}{}{orange}{\leavevmode {\color {orange}o}}\ insert code example output}{3}{section*.3}% -\contentsline {todo}{\color@fb@x {}{black}{}{orange}{\leavevmode {\color {orange}o}}\ code}{4}{section*.4}% -\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{6}{section*.5}% -\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{6}{section*.6}% -\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{7}{section*.7}% -\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{8}{section*.8}% -\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{9}{section*.9}% +\contentsline {todo}{\color@fb@x {}{black}{}{orange}{\leavevmode {\color {orange}o}}\ insert code example output}{4}{section*.3}% +\contentsline {todo}{\color@fb@x {}{black}{}{orange}{\leavevmode {\color {orange}o}}\ code}{5}{section*.4}% +\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{7}{section*.5}% +\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{7}{section*.6}% +\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{8}{section*.7}% +\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{9}{section*.8}% +\contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{10}{section*.9}% \contentsline {todo}{\color@fb@x {}{black}{}{red!40}{\leavevmode {\color {red!40}o}}\ Add reference.}{18}{section*.10}%