From 386f07a6d65dbe2a270183612c4bdcbf76ea83a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 16 Jan 2022 14:35:24 +0100 Subject: [PATCH] prename, postname and thmtools keys for groups and grouped theorems working --- src/environments/groupthm.pysty3 | 84 ++++++++++++++++++++++++++------ 1 file changed, 68 insertions(+), 16 deletions(-) diff --git a/src/environments/groupthm.pysty3 b/src/environments/groupthm.pysty3 index b9e3dd0..1b5c55b 100644 --- a/src/environments/groupthm.pysty3 +++ b/src/environments/groupthm.pysty3 @@ -8,30 +8,46 @@ __HEADER__(Grouping theorems for easier customization.) \NewHook { groupthm / prename } \NewHook { groupthm / postname } +\NewHook { groupthm / mapname } +\NewHook { groupthm / thmtools } + + +\newcounter{indocument} +\newcounter{insection}[section] +\newcounter{insubsection}[subsection] + +\tl_new:N \__name_tl +\str_new:N \__name_str \cs_new:Nn \declaretheorem:nn { - \tl_show:n { #1 } \declaretheorem [ #1 ] { #2 } } \cs_generate_variant:Nn \declaretheorem:nn {V V, V n} - +% groupname, prename, postname, mapname, thmtools \cs_new:Npn \store_group:nnnnn #1#2#3#4#5 { \cs_new:cpn { retrieve_group_#1: } { \AddToHook { groupthm / prename } [ #1 ] - { - \tl_put_right:Nx \__name_str { #2 } - } + { + \tl_put_left:Nx \__name_tl { #2 } + } \AddToHook { groupthm / postname } [ #1 ] - { - \tl_put_right:Nx \__name_str { #3 } - } - % TODO: handle thmtools and mapname + { + \tl_put_right:Nx \__name_tl { #3 } + } + \AddToHook { groupthm / mapname } [ #1 ] + { + \clist_put_right:Nn \l_groupthm_mapname_clist { #4 } + } + \AddToHook { groupthm / thmtools } [ #1 ] + { + \clist_put_right:Nn __PACKAGE_MACRO__(thmtools_args_clist) { #5 } + } } } @@ -89,7 +105,6 @@ __HEADER__(Grouping theorems for easier customization.) } % Construct name - \str_new:N \__name_str \tl_if_eq:NnTF __PACKAGE_MACRO__(theorem_name_tl) { \c_novalue_tl } { \str_set:Nx \__name_str @@ -104,22 +119,25 @@ __HEADER__(Grouping theorems for easier customization.) } } - \tl_new:N \__name_tl \tl_set:NV \__name_tl \__name_str % Process groups here, adding to the hooks for prename, postname, mapname, thmtools % mapname currently not implemented + \RemoveFromHook { groupthm / prename }[ * ] + \RemoveFromHook { groupthm / postname }[*] + \RemoveFromHook { groupthm / mapname }[*] + \RemoveFromHook { groupthm / thmtools }[*] + \clist_map_function:NN __PACKAGE_MACRO__(groups_clist) \retrieve_group:n - -% \clist_new:N __PACKAGE_MACRO__(mapname_clist) -% \clist_set:N - + %\clist_show:N __PACKAGE_MACRO__(groups_clist) \hook_use:n { groupthm / prename } \hook_use:n { groupthm / postname } + \hook_use:n { groupthm / mapname } + \hook_use:n { groupthm / thmtools } \clist_put_right:Nx __PACKAGE_MACRO__(thmtools_args_clist) { - name = \str_use:N \__name_str + name = \str_use:N \__name_tl } \declaretheorem:Vn { @@ -127,3 +145,37 @@ __HEADER__(Grouping theorems for easier customization.) } { #2 } } + + +%%% Default groups available + +\NewTheoremGroup { all } +[ +] + +\NewTheoremGroup { big } +[ + thmtools = { sibling = insection } +] + +\NewTheoremGroup { dagger } +[ + postname = { $\dagger$ }, + thmtools = { sibling = insubsection } +] + +\NewTheoremGroup { small } +[ + thmtools = { sibling = insubsection } +] + +\NewTheoremGroup { star } +[ + thmtools = { sibling = insubsection }, + postname = { * } +] + +\NewTheoremGroup { starred } +[ + thmtools = { numbered = no } +]