make everythin lazy to integrate with fancythm

This commit is contained in:
Maximilian Keßler 2022-02-03 12:30:47 +01:00
parent 0070d2aa66
commit a68ac2fdaa

View file

@ -1657,14 +1657,17 @@
{ {
\cs_new:cn { #6 } \cs_new:cn { #6 }
{ {
\@@_define:nnncNNn \@@_lazy:n
{ ##1 } {
{ #2 } \@@_define:nnncNNn
{ ####1 } { ##1 }
{ #3 } { #2 }
#4 { ####1 }
#5 { #3 }
{ #7 } #4
#5
{ #7 }
}
} }
} }
\clist_map_function:nN { #1 } \@@_map_aux:n \clist_map_function:nN { #1 } \@@_map_aux:n
@ -1842,21 +1845,24 @@
% \begin{macrocode} % \begin{macrocode}
\cs_new:Npn \groupthm_declare_group_rule:nnnn #1 #2 #3 #4 \cs_new:Npn \groupthm_declare_group_rule:nnnn #1 #2 #3 #4
{ {
\str_set:Nx \l_tmpa_str { \tl_trim_spaces:n { #3 } } \@@_lazy:n
\str_if_eq:VnT \l_tmpa_str { higher }
{ {
\str_set:Nn \l_tmpa_str { after } \str_set:Nx \l_tmpa_str { \tl_trim_spaces:n { #3 } }
} \str_if_eq:VnT \l_tmpa_str { higher }
\str_if_eq:VnT \l_tmpa_str { lower } {
{ \str_set:Nn \l_tmpa_str { after }
\str_set:Nn \l_tmpa_str { before } }
} \str_if_eq:VnT \l_tmpa_str { lower }
\str_if_eq:nnTF { #1 } { ?? } {
{ \str_set:Nn \l_tmpa_str { before }
\hook_gset_rule:nnVn {??} {#2} \l_tmpa_str {#4} }
} \str_if_eq:nnTF { #1 } { ?? }
{ {
\hook_gset_rule:nnVn { @@ / #1 } {#2} \l_tmpa_str {#4} \hook_gset_rule:nnVn {??} {#2} \l_tmpa_str {#4}
}
{
\hook_gset_rule:nnVn { @@ / #1 } {#2} \l_tmpa_str {#4}
}
} }
} }
\cs_generate_variant:Nn \groupthm_declare_group_rule:nnnn { n n n x } \cs_generate_variant:Nn \groupthm_declare_group_rule:nnnn { n n n x }
@ -1894,9 +1900,12 @@
% \begin{macrocode} % \begin{macrocode}
\cs_new:Npn \groupthm_add_parent:nn #1 #2 \cs_new:Npn \groupthm_add_parent:nn #1 #2
{ {
\@@_ensure_group_exists:n { #1 } \@@_lazy:n
\@@_ensure_group_exists:n { #2 } {
\clist_gput_left:cn { g_@@_parents_group__#1__clist } { #2 } \@@_ensure_group_exists:n { #1 }
\@@_ensure_group_exists:n { #2 }
\clist_gput_left:cn { g_@@_parents_group__#1__clist } { #2 }
}
} }
\cs_generate_variant:Nn \groupthm_add_parent:nn { n x } \cs_generate_variant:Nn \groupthm_add_parent:nn { n x }
% \end{macrocode} % \end{macrocode}
@ -1982,11 +1991,14 @@
% \begin{macrocode} % \begin{macrocode}
\cs_new:Npn \groupthm_append_to_group:nn #1 #2 \cs_new:Npn \groupthm_append_to_group:nn #1 #2
{ {
\groupthm_new_group:nx { #1 } { __append__ \int_use:N \g_@@_append_groups_int } \@@_lazy:n
\groupthm_add_parent:nx { #2 } { __append__ \int_use:N \g_@@_append_groups_int } {
\groupthm_declare_group_rule:nnnx \groupthm_new_group:nx { #1 } { __append__ \int_use:N \g_@@_append_groups_int }
{ ?? } { #2 } { before } { __append__ \int_use:N \g_@@_append_groups_int } \groupthm_add_parent:nx { #2 } { __append__ \int_use:N \g_@@_append_groups_int }
\int_gincr:N \g_@@_append_groups_int \groupthm_declare_group_rule:nnnx
{ ?? } { #2 } { before } { __append__ \int_use:N \g_@@_append_groups_int }
\int_gincr:N \g_@@_append_groups_int
}
} }
% \end{macrocodel} % \end{macrocodel}
% \end{macro} % \end{macro}
@ -2012,15 +2024,6 @@
% \end{macro} % \end{macro}
% %
% %
% We also provide the three default groups:
%
% \begin{variable}{all, starred, unnumbered}
% \begin{macrocode}
\groupthm_new_group:nnnnn { all } { } { } { } { }
\groupthm_new_group:nnnnn { starred } { } { } { } { numbered = no }
\groupthm_new_group:nnnnn { unnumbered } { } { } { } { numbered = no }
% \end{macrocode}
% \end{variable}
% %
% \subsection{Iterating over powersets} % \subsection{Iterating over powersets}
% For generating the different variants of a theorem family, % For generating the different variants of a theorem family,
@ -2276,24 +2279,27 @@
{ new, provide } { new, provide }
{ groupthm_#1_theorem:nnn } { groupthm_#1_theorem:nnn }
{ {
\@@_set_normalized_keys:nnn { ##1 } { grouped ~ theorem } { ##2 } \@@_lazy:n
\bool_if:nT { ##3 }
{ {
\clist_put_left:Nn \l_@@_group_clist { unnumbered } \@@_set_normalized_keys:nnn { ##1 } { grouped ~ theorem } { ##2 }
} \bool_if:nT { ##3 }
\use:c { groupthm_#1_theorem:nVVV } {
{ ##2 } \clist_put_left:Nn \l_@@_group_clist { unnumbered }
\l_@@_group_clist }
\l_@@_name_tl
\l_@@_thmtools_clist
\bool_if:NT \l_@@_starred_version_bool
{
\clist_put_left:Nn \l_@@_group_clist { starred }
\use:c { groupthm_#1_theorem:nVVV } \use:c { groupthm_#1_theorem:nVVV }
{ ##2* } { ##2 }
\l_@@_group_clist \l_@@_group_clist
\l_@@_name_tl \l_@@_name_tl
\l_@@_thmtools_clist \l_@@_thmtools_clist
\bool_if:NT \l_@@_starred_version_bool
{
\clist_put_left:Nn \l_@@_group_clist { starred }
\use:c { groupthm_#1_theorem:nVVV }
{ ##2* }
\l_@@_group_clist
\l_@@_name_tl
\l_@@_thmtools_clist
}
} }
} }
% \end{macrocode} % \end{macrocode}
@ -2433,24 +2439,27 @@
{ new, provide } { new, provide }
{ groupthm_#1_family:nnn } { groupthm_#1_family:nnn }
{ {
\@@_set_normalized_keys:nnn { ##1 } { theorem ~ family } { ##2 } \@@_lazy:n
\bool_if:nTF { ##3}
{ {
\clist_set:Nn \l_tmpa_clist { unnumbered } \@@_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
} }
{
\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{macrocode}
% \end{macro} % \end{macro}
@ -2506,12 +2515,15 @@
% executing a \meta{selection body} from some family options. % executing a \meta{selection body} from some family options.
% If used outside, we emit an error message. % If used outside, we emit an error message.
% \begin{macrocode} % \begin{macrocode}
\bool_if:NTF \l_@@_in_family_options_environment_bool \@@_lazy:n
{ {
\clist_put_left:Nn \l_@@_group_clist { #1 } \bool_if:NTF \l_@@_in_family_options_environment_bool
} {
{ \clist_put_left:Nn \l_@@_group_clist { #1 }
\msg_error:nn { groupthm } { misuse ~ add ~ theorem ~ to ~ group } }
{
\msg_error:nn { groupthm } { misuse ~ add ~ theorem ~ to ~ group }
}
} }
} }
% \end{macrocode} % \end{macrocode}
@ -2870,14 +2882,19 @@
% \begin{macrocode} % \begin{macrocode}
\hook_gput_code:nnn { begindocument } { groupthm } \hook_gput_code:nnn { begindocument } { groupthm }
{ {
\cs_set_eq:NN \@@_lazy:n \use:n
\int_compare:nNnTF \int_compare:nNnTF
\g_@@_cache_version_aux_int < \g_@@_cache_version_document_int \g_@@_cache_version_aux_int < \g_@@_cache_version_document_int
{ {
\tl_use:N \g_@@_lazy_document_tl \tl_use:N \g_@@_lazy_document_tl
} }
{ {
\tl_use:N \g_@@_lazy_auxfile_tl \cs_show:N \g_@@_lazy_auxfile_tl
} \benchmark_once:n
{
\tl_use:N \g_@@_lazy_auxfile_tl
}
}
} }
% \end{macrocode} % \end{macrocode}
% %
@ -2922,6 +2939,23 @@
% %
% %
% %
% We also provide the three default groups:
%
% \begin{variable}{all, starred, unnumbered}
% \begin{macrocode}
\groupthm_new_group:nnnnn { all } { } { } { } { }
\groupthm_new_group:nnnnn { starred } { } { } { } { numbered = no }
\groupthm_new_group:nnnnn { unnumbered } { } { } { } { numbered = no }
% \end{macrocode}
% \end{variable}
%
%
%
%
%
% \begin{macrocode}
%
% \end{macrocode}
% %
% %
% \begin{macrocode} % \begin{macrocode}