fixed bugs, working version again

This commit is contained in:
Maximilian Keßler 2022-01-16 17:39:02 +01:00
parent 0e1a802995
commit e3d3d9ba0f

View File

@ -23,6 +23,7 @@ __HEADER__(Grouping theorems for easier customization.)
{
\declaretheorem [ #2 ] { #1 }
}
\cs_generate_variant:Nn \declaretheorem:nn { n V }
@ -30,12 +31,12 @@ __HEADER__(Grouping theorems for easier customization.)
\msg_new:nnn { groupthm } { unknown ~ key }
{
\msg_error_text:n { groupthm } Unknown key #1 supplied \msg_line_context:
Unknown ~ key ~ #1 ~ supplied ~ \msg_line_context:
}
\msg_new:nnn { groupthm } { unknown ~ group }
{
\msg_error_text:n { groupthm} Unknown group #1 supplied \msg_line_context:
Unknown ~ group ~ #1 ~ supplied ~ \msg_line_context:
}
%%% Variables
@ -68,13 +69,13 @@ __HEADER__(Grouping theorems for easier customization.)
postname .default:n = \c_empty_tl,
postname .groups:n = { theoremgroup },
group .clist_set:N = \l_groupthm_key_group_clist,
group .default:n = \c_empty_clist,
group .default:n = {},
group .groups:n = { groupedtheorem },
mapname .clist_set:N = \l_groupthm_mapname_clist,
mapname .default:n = \c_empty_clist,
mapname .default:n = {},
mapname .groups:n = { theoremgroup },
thmtools .clist_set:N = \l_groupthm_thmtools_clist,
thmtools .default:n = \c_empty_clist,
thmtools .default:n = {},
thmtools .groups:n = { theoremgroup, groupedtheorem, theoremvariants }
}
@ -100,7 +101,7 @@ __HEADER__(Grouping theorems for easier customization.)
}
\AddToHook { groupthm / thmtools } [ #1 ]
{
\clist_put_right:Nn \l_groupthm_thmtools_clist) { #5 }
\clist_put_right:Nn \l_groupthm_thmtools_clist { #5 }
}
}
}
@ -130,7 +131,7 @@ __HEADER__(Grouping theorems for easier customization.)
{
\cs_if_exist_use:cF { group_use_#1: }
{
\msg_error:nnn { groupthm } { unknown ~ group }
\msg_error:nnn { groupthm } { unknown ~ group } { #1 }
}
}
@ -149,40 +150,40 @@ __HEADER__(Grouping theorems for easier customization.)
\RemoveFromHook { groupthm / mapname }[*]
\RemoveFromHook { groupthm / thmtools }[*]
\clist_map_function:nN { #1 } \group_use:n
\clist_map_function:nN { #2 } \group_use:n
\hook_use:n { groupthm / prename }
\hook_use:n { groupthm / postname }
\hook_use:n { groupthm / mapname }
%% this next line fails somehow
\hook_use:n { groupthm / thmtools }
\clist_put_right:Nx \l_groupthm_thmtools_tl
\clist_put_right:Nx \l_groupthm_thmtools_clist
{
name = \tl_use:N \l_groupthm_prename_tl
\tl_use:N \l_groupthm_name_tl
\tl_use:N \l_groupthm_postname_tl
}
\declaretheorem:Vn
{
\declaretheorem:nV
{ #1 }
\l_groupthm_thmtools_clist
}
{ #2 }
}
\cs_generate_variant:Nn \new_grouped_theorem:nnnn { n V V V }
% envname, keys
\cs_new:Npn \new_grouped_theorem_from_keys:nn #1 #2
{
\keys_set_groups:nnn { groupthm } { groupedtheorem } { name, group, thmtools }
\keys_set_groups:nnn { groupthm } { groupedtheorem } { #1 }
\keys_set_groups:nnn { groupthm } { groupedtheorem } { #2 }
% Construct name
\tl_if_eq:NnTF \l_groupthm_key_name_tl { \c_novalue_tl }
{
\tl_set:Nx \l_groupthm_name_tl
{
\text_titlecase_first:n {#2}
\text_titlecase_first:n {#1}
}
}
{
@ -203,28 +204,33 @@ __HEADER__(Grouping theorems for easier customization.)
%%% Default groups available
\NewTheoremGroup { all }
\NewTheoremGroup
[
]
]{ all }
\NewTheoremGroup { big }
\NewTheoremGroup
[
thmtools = { sibling = insection }
]
] { big }
\NewTheoremGroup { dagger }
\NewTheoremGroup
[
postname = { $\dagger$ },
thmtools = { sibling = insubsection }
]
] { dagger }
\NewTheoremGroup { small }
\NewTheoremGroup
[
thmtools = { sibling = insubsection }
]
] { small }
\NewTheoremGroup { star }
\NewTheoremGroup
[
thmtools = { sibling = insubsection },
postname = { * }
]
] { star }
\NewTheoremGroup
[
thmtools = { numbered = no }
] { starred }