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

@ -1656,6 +1656,8 @@
\cs_set:Npn \@@_map_aux:n ##1 \cs_set:Npn \@@_map_aux:n ##1
{ {
\cs_new:cn { #6 } \cs_new:cn { #6 }
{
\@@_lazy:n
{ {
\@@_define:nnncNNn \@@_define:nnncNNn
{ ##1 } { ##1 }
@ -1667,6 +1669,7 @@
{ #7 } { #7 }
} }
} }
}
\clist_map_function:nN { #1 } \@@_map_aux:n \clist_map_function:nN { #1 } \@@_map_aux:n
} }
% \end{macrocode} % \end{macrocode}
@ -1841,6 +1844,8 @@
% %
% \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
{
\@@_lazy:n
{ {
\str_set:Nx \l_tmpa_str { \tl_trim_spaces:n { #3 } } \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 { higher }
@ -1859,6 +1864,7 @@
\hook_gset_rule:nnVn { @@ / #1 } {#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 }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
@ -1893,11 +1899,14 @@
% %
% \begin{macrocode} % \begin{macrocode}
\cs_new:Npn \groupthm_add_parent:nn #1 #2 \cs_new:Npn \groupthm_add_parent:nn #1 #2
{
\@@_lazy:n
{ {
\@@_ensure_group_exists:n { #1 } \@@_ensure_group_exists:n { #1 }
\@@_ensure_group_exists:n { #2 } \@@_ensure_group_exists:n { #2 }
\clist_gput_left:cn { g_@@_parents_group__#1__clist } { #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}
% \end{macro} % \end{macro}
@ -1981,6 +1990,8 @@
% %
% \begin{macrocode} % \begin{macrocode}
\cs_new:Npn \groupthm_append_to_group:nn #1 #2 \cs_new:Npn \groupthm_append_to_group:nn #1 #2
{
\@@_lazy:n
{ {
\groupthm_new_group:nx { #1 } { __append__ \int_use:N \g_@@_append_groups_int } \groupthm_new_group:nx { #1 } { __append__ \int_use:N \g_@@_append_groups_int }
\groupthm_add_parent:nx { #2 } { __append__ \int_use:N \g_@@_append_groups_int } \groupthm_add_parent:nx { #2 } { __append__ \int_use:N \g_@@_append_groups_int }
@ -1988,6 +1999,7 @@
{ ?? } { #2 } { before } { __append__ \int_use:N \g_@@_append_groups_int } { ?? } { #2 } { before } { __append__ \int_use:N \g_@@_append_groups_int }
\int_gincr: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,
@ -2275,6 +2278,8 @@
\@@_wrap_multiple:nnn \@@_wrap_multiple:nnn
{ new, provide } { new, provide }
{ groupthm_#1_theorem:nnn } { groupthm_#1_theorem:nnn }
{
\@@_lazy:n
{ {
\@@_set_normalized_keys:nnn { ##1 } { grouped ~ theorem } { ##2 } \@@_set_normalized_keys:nnn { ##1 } { grouped ~ theorem } { ##2 }
\bool_if:nT { ##3 } \bool_if:nT { ##3 }
@ -2296,6 +2301,7 @@
\l_@@_thmtools_clist \l_@@_thmtools_clist
} }
} }
}
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
@ -2432,6 +2438,8 @@
\@@_wrap_multiple:nnn \@@_wrap_multiple:nnn
{ new, provide } { new, provide }
{ groupthm_#1_family:nnn } { groupthm_#1_family:nnn }
{
\@@_lazy:n
{ {
\@@_set_normalized_keys:nnn { ##1 } { theorem ~ family } { ##2 } \@@_set_normalized_keys:nnn { ##1 } { theorem ~ family } { ##2 }
\bool_if:nTF { ##3} \bool_if:nTF { ##3}
@ -2452,6 +2460,7 @@
\l_@@_thmtools_clist \l_@@_thmtools_clist
\l_tmpa_clist \l_tmpa_clist
} }
}
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
@ -2506,6 +2515,8 @@
% 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}
\@@_lazy:n
{
\bool_if:NTF \l_@@_in_family_options_environment_bool \bool_if:NTF \l_@@_in_family_options_environment_bool
{ {
\clist_put_left:Nn \l_@@_group_clist { #1 } \clist_put_left:Nn \l_@@_group_clist { #1 }
@ -2514,6 +2525,7 @@
\msg_error:nn { groupthm } { misuse ~ add ~ theorem ~ to ~ group } \msg_error:nn { groupthm } { misuse ~ add ~ theorem ~ to ~ group }
} }
} }
}
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
@ -2870,15 +2882,20 @@
% \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
} }
{
\cs_show:N \g_@@_lazy_auxfile_tl
\benchmark_once:n
{ {
\tl_use:N \g_@@_lazy_auxfile_tl \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}