From 274ce257d6dff6b9688780499738decb4459c248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 16 Jan 2022 12:12:12 +0100 Subject: [PATCH] start development of groupthm package --- src/environments/groupthm.pysty3 | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/environments/groupthm.pysty3 diff --git a/src/environments/groupthm.pysty3 b/src/environments/groupthm.pysty3 new file mode 100644 index 0000000..82dc19a --- /dev/null +++ b/src/environments/groupthm.pysty3 @@ -0,0 +1,80 @@ +__HEADER__(Grouping theorems for easier customization.) + + +\ExplSyntaxOn + +\RequirePackage{amsthm} +\RequirePackage{thmtools} + + + +\cs_new:Nn \declaretheorem:nn +{ + \declaretheorem [ #1 ] { #2 } +} + +\cs_generate_variant:Nn \declaretheorem:nn {V V} + + +\keys_define:nn { groupthm / theoremgroup } + { + postname .tl_set:N = \l_groupthm_postname_tl, + prename .tl_set:N = \l_groupthm_prename_tl, + mapname .tl_set:N = \l_groupthm_mapname_tl, + thmtools .tl_set:N = \l_groupthm_thmtools_tl + } + + +\clist_new:N __PACKAGE_MACRO__(thmtools_args) + +\keys_define:nn { groupthm / groupedtheorem } +{ + thmtools .clist_set:N = __PACKAGE_MACRO__(thmtools_args_clist), + group .clist_set:N = __PACKAGE_MACRO__(groups_clist), + name .tl_set:N = __PACKAGE_MACRO__(theorem_name_tl), + name .default:n = \q_no_value +} + +\NewDocumentCommand{\NewGroupedTheorem}{o m} +{ + \keys_set:nn { groupthm / groupedtheorem } { #1 } + \RemoveFromHook + \UseHook + + + % Construct name + \str_new:N \__name_str + \str_set:Nx \__name_str + { + \quark_if_no_value:NTF __PACKAGE_MACRO__(theorem_name_tl) + { + \text_titlecase_first:n {#2} + } + { + \tl_use:N __PACKAGE_MACRO__(theorem_name_tl) + } + } + + % Process groups here, adding to the hooks for prename, postname, mapname, thmtools + % mapname currently not implemented + +% \clist_new:N __PACKAGE_MACRO__(mapname_clist) +% \clist_set:N + + \str_put_left:Nx \__name_str + { + \UseHook { groupthm / prename } + } + \str_put_right:Nx \__name_str + { + \UseHook { groupthm / postname } + } + + \declaretheorem:VV + { + __PACKAGE_MACRO__(thmtools_args_clist) + } + { \__name_str } +} + +\cs_new: