write all definitions of theorems to aux file at end of document

This commit is contained in:
Maximilian Keßler 2022-01-31 19:55:03 +01:00
parent 32daab8d20
commit f878e66cdf

View file

@ -851,6 +851,16 @@
{
\tl_log:n { Declaring ~ thmtools ~ theorem ~ #2 }
\declaretheorem [ #1 ] { #2 }
\bool_if:NT \g_@@_cache_bool
{
\hook_gput_code:nnn { enddocument / afterlastpage } { groupthm }
{
\iow_now:cn { @auxout }
{
\declaretheorem [ #1 ] { #2 }
}
}
}
}
\cs_generate_variant:Nn \@@_thmtools_declare_theorem:nn { V n }
% \end{macrocode}
@ -858,6 +868,7 @@
%
%
%
%
% It also comes in handy to have a stronger version of the
% hook role setting mechanism:
% \begin{macro}{\@@_hook_gset_rule_foreach:nNnn}
@ -2657,28 +2668,52 @@
%
% \begin{macrocode}
\hook_gput_code:nnn { begindocument } { groupthm }
{
\bool_if:nTF
{
\g_@@_cache_bool
&&
\int_compare_p:n
{
\g_@@_cache_version_aux_int < \g_@@_cache_version_document_int
}
}
{
\hook_use_once:n { @@ / define lazy }
}
{
}
}
{
\bool_if:nTF
{
\g_@@_cache_bool
&&
\int_compare_p:n
{
\g_@@_cache_version_aux_int < \g_@@_cache_version_document_int
}
}
{
\hook_use_once:n { @@ / define lazy }
}
{
}
}
% \end{macrocode}
%
%
% \begin{macro}{\@@_fake_declare_theorem:w}
% \begin{syntax}
%
% \end{syntax}
%
% This is a fake version of the \cs{declaretheorem} macro
% that accepts the arguments but does nothing.
%
% \begin{macrocode}
\NewDocumentCommand { \@@_fake_declare_theorem:w }{ o m }
{
\relax
}
% \end{macrocode}
% \end{macro}
%
%
%
% \begin{macrocode}
\hook_gput_code:nnn { enddocument / afterlastpage } { groupthm }
{
\let \declaretheorem \@@_fake_declare_theorem:w
}
% \end{macrocode}
%
%
% \begin{macrocode}
%</package>
% \end{macrocode}
%