also provide families lazily

This commit is contained in:
Maximilian Keßler 2022-01-31 21:26:41 +01:00
parent 48651b4919
commit 5b7e93e76a

View file

@ -1795,7 +1795,7 @@
{ \@@_Declarator: TheoremGroup }
{ O{} m }
{
\@@_lazy:n
\groupthm_do_cached:n
{
\use:c { groupthm_#1 _group:nn } { ##1 } { ##2 }
}
@ -1853,7 +1853,7 @@
% \begin{macrocode}
\NewDocumentCommand { \DeclareTheoremGroupRule } { O{??} m m m }
{
\@@_lazy:n
\groupthm_do_cached:n
{
\groupthm_declare_group_rule:nnnn {#1} {#2} {#3} {#4}
}
@ -1892,7 +1892,7 @@
% \begin{macrocode}
\NewDocumentCommand { \AddTheoremGroupParent } { m m }
{
\@@_lazy:n
\groupthm_do_cached:n
{
\groupthm_add_parent:nn { #1 } { #2 }
}
@ -1982,7 +1982,7 @@
% \begin{macrocode}
\NewDocumentCommand { \AppendToTheoremGroup } { O{} m }
{
\@@_lazy:n {
\groupthm_do_cached:n {
\groupthm_append_to_group:nn { #1 } { #2 }
}
}
@ -2300,7 +2300,7 @@
{ \@@_Declarator: GroupedTheorem }
{ s O{} m }
{
\@@_lazy:n
\groupthm_do_cached:n
{
\use:c { groupthm_#1_theorem:nnn }
{ ##2 }
@ -2453,7 +2453,7 @@
{ \@@_Declarator: GroupedTheoremFamily }
{ s O{} m }
{
\@@_lazy:n
\groupthm_do_cached:n
{
\use:c { groupthm_#1_family:nnn }
{ ##2 }
@ -2506,10 +2506,7 @@
% \begin{macrocode}
\NewDocumentCommand { \AddTheoremToGroup } { m }
{
\@@_lazy:n
{
\groupthm_add_theorem_to_group:n { #1 }
}
\groupthm_add_theorem_to_group:n { #1 }
}
% \end{macrocode}
% \end{macro}
@ -2580,6 +2577,15 @@
\@@_sort_group_names:
\end { __#1__groups_ \clist_use:Nn \l_@@_group_clist { _ } }
}
\hook_gput_code:nnn { enddocument / afterlastpage } { groupthm }
{
\iow_now:cx { @auxout }
{
\token_to_str:N \ExplSyntaxOn
\exp_not:N \@@_define_family_options:nnnn { #1 } { #2 } { #3 } { #4 }
\token_to_str:N \ExplSyntaxOff
}
}
}
% \end{macrocode}
% \end{macro}
@ -2642,30 +2648,33 @@
{ \@@_Declarator: GroupedTheoremFamilyOptions }
{ s O{} m m m }
{
\keys_set:nn { groupthm / theorem ~ family ~ options } { starred ~ version }
\keys_set:nn { groupthm / theorem ~ family ~ options } { ##2 }
\bool_if:nTF { ##1 }
\groupthm_do_cached:n
{
\clist_set:Nn \l_tmpa_clist { unnumbered }
}
{
\clist_clear:N \l_tmpa_clist
}
\use:c { groupthm_#1_family_options:nnnV }
{ ##3 }
{ ##4 }
{ ##5 }
\l_tmpa_clist
\bool_if:NT \l_@@_starred_version_bool
{
\keys_set:nn { groupthm / theorem ~ family ~ options } { starred ~ version }
\keys_set:nn { groupthm / theorem ~ family ~ options } { ##2 }
\bool_if:nTF { ##1 }
{
\clist_set:Nn \l_tmpa_clist { unnumbered }
}
{
\clist_clear:N \l_tmpa_clist
}
\use:c { groupthm_#1_family_options:nnnV }
{ ##3* }
{ ##3 }
{ ##4 }
{
##5
\groupthm_add_theorem_to_group:n { starred }
}
{ ##5 }
\l_tmpa_clist
\bool_if:NT \l_@@_starred_version_bool
{
\use:c { groupthm_#1_family_options:nnnV }
{ ##3* }
{ ##4 }
{
##5
\groupthm_add_theorem_to_group:n { starred }
}
\l_tmpa_clist
}
}
}
% \end{macrocode}
@ -2680,9 +2689,9 @@
%
%
%
% \begin{macro}{\@@_lazy:n}
% \begin{macro}{\groupthm_do_cached:n}
% \begin{syntax}
% \cs{@@_lazy:n}\marg{code}
% \cs{groupthm_do_cached:n}\marg{code}
% \end{syntax}
%
% Executes this code lazy at beginning of the document,
@ -2692,7 +2701,7 @@
% if the aux file version was too old, otherwise dropped.
%
% \begin{macrocode}
\cs_new:Npn \@@_lazy:n
\cs_new:Npn \groupthm_do_cached:n
{
\bool_if:NTF \g_@@_cache_bool
{