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