groupthm: handle theorem family options cache
also use an aux file hook to collect definitions from aux file
This commit is contained in:
parent
5b7e93e76a
commit
a3211f8a8f
1 changed files with 50 additions and 47 deletions
|
@ -855,11 +855,14 @@
|
||||||
{
|
{
|
||||||
\hook_gput_code:nnn { enddocument / afterlastpage } { groupthm }
|
\hook_gput_code:nnn { enddocument / afterlastpage } { groupthm }
|
||||||
{
|
{
|
||||||
\iow_now:cx { @auxout }
|
\iow_now:cn { @auxout }
|
||||||
{
|
{
|
||||||
\token_to_str:N \ExplSyntaxOn
|
\ExplSyntaxOn
|
||||||
\exp_not:N \@@_thmtools_declare_theorem:nn { #1 } { #2 }
|
\hook_gput_code:nnn { @@ / auxfile define cached } { groupthm }
|
||||||
\token_to_str:N \ExplSyntaxOff
|
{
|
||||||
|
\@@_thmtools_declare_theorem:nn { #1 } { #2 }
|
||||||
|
}
|
||||||
|
\ExplSyntaxOff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -979,7 +982,8 @@
|
||||||
\hook_new:n { @@/thmtools }
|
\hook_new:n { @@/thmtools }
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\hook_new:n { @@/definelazy }
|
\hook_new:n { @@/document define cached }
|
||||||
|
\hook_new:n { @@/auxfile define cached }
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\hook_new:n { @@/groupsort }
|
\hook_new:n { @@/groupsort }
|
||||||
|
@ -2526,7 +2530,7 @@
|
||||||
% The \meta{extra groups} will be added regardless of the arguments given
|
% The \meta{extra groups} will be added regardless of the arguments given
|
||||||
% to the \meta{theorem family}
|
% to the \meta{theorem family}
|
||||||
% The \meta{declaring backend} is one of \texttt{New}, \texttt{Renew}, \texttt{Provide}
|
% The \meta{declaring backend} is one of \texttt{New}, \texttt{Renew}, \texttt{Provide}
|
||||||
% and \texttt{Declare} and is given to the \texttt{DocumentEnvironment} command from \pkg{xpars}.
|
% and \texttt{Declare} and is given to the \texttt{DocumentEnvironment} command from \pkg{xparse}.
|
||||||
%
|
%
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\cs_new:Npn \@@_define_family_options:nnnn #1 #2 #3 #4
|
\cs_new:Npn \@@_define_family_options:nnnn #1 #2 #3 #4
|
||||||
|
@ -2579,11 +2583,14 @@
|
||||||
}
|
}
|
||||||
\hook_gput_code:nnn { enddocument / afterlastpage } { groupthm }
|
\hook_gput_code:nnn { enddocument / afterlastpage } { groupthm }
|
||||||
{
|
{
|
||||||
\iow_now:cx { @auxout }
|
\iow_now:cn { @auxout }
|
||||||
{
|
{
|
||||||
\token_to_str:N \ExplSyntaxOn
|
\ExplSyntaxOn
|
||||||
\exp_not:N \@@_define_family_options:nnnn { #1 } { #2 } { #3 } { #4 }
|
\hook_gput_code:nnn { @@ / auxfile define cached } { groupthm }
|
||||||
\token_to_str:N \ExplSyntaxOff
|
{
|
||||||
|
\@@_define_family_options:nnnn { #1 } { #2 } { #3 } { #4 }
|
||||||
|
}
|
||||||
|
\ExplSyntaxOff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2705,7 +2712,7 @@
|
||||||
{
|
{
|
||||||
\bool_if:NTF \g_@@_cache_bool
|
\bool_if:NTF \g_@@_cache_bool
|
||||||
{
|
{
|
||||||
\hook_gput_code:nnn {@@/definelazy} { groupthm }
|
\hook_gput_code:nnn {@@/document define cached} { groupthm }
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
\use:n
|
\use:n
|
||||||
|
@ -2716,10 +2723,20 @@
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
|
% This makes sure that at the beginning of the document, after reading
|
||||||
|
% in the aux file with possible precomputed definitions of the last run,
|
||||||
|
% we will execute either the definitions of the auxfile or all the
|
||||||
|
% lazy computation from the current run that we collected.
|
||||||
|
%
|
||||||
|
% These hooks should actually be one-time hooks, but this would cause
|
||||||
|
% problems when \LaTeX rereads the aux file a second time at the end
|
||||||
|
% of the document, since we want no declarations there
|
||||||
|
%
|
||||||
|
%
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\hook_gput_code:nnn { begindocument } { groupthm }
|
\hook_gput_code:nnn { begindocument } { groupthm }
|
||||||
{
|
{
|
||||||
\bool_if:nT
|
\bool_if:nTF
|
||||||
{
|
{
|
||||||
\g_@@_cache_bool
|
\g_@@_cache_bool
|
||||||
&&
|
&&
|
||||||
|
@ -2729,42 +2746,28 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
\hook_use_once:n { @@ / define lazy }
|
\hook_use:n { @@ / document define cached }
|
||||||
|
}
|
||||||
|
{
|
||||||
|
\hook_use:n { @@ / auxfile define cached }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
% \end{macrocode}
|
% \end{macrocode}
|
||||||
%
|
%
|
||||||
%
|
%
|
||||||
%
|
% This code makes sure that in the next run of \LaTeX, when reading in the aux-file,
|
||||||
%
|
% before processing the rest of the groupthm aux file macros,
|
||||||
|
% we set the depth of the document cache version available so that we can
|
||||||
|
% query this value in the next run as soon as possible.
|
||||||
%
|
%
|
||||||
% \begin{macrocode}
|
% \begin{macrocode}
|
||||||
\hook_gput_code:nnn { enddocument / afterlastpage } { before-groupthm }
|
\hook_gput_code:nnn { enddocument / afterlastpage } { before-groupthm }
|
||||||
{
|
{
|
||||||
\cs_set_eq:NN \@@_thmtools_declare_theorem:nn \use_none:nn
|
|
||||||
\iow_now:cx { @auxout }
|
\iow_now:cx { @auxout }
|
||||||
{
|
{
|
||||||
\token_to_str:N \ExplSyntaxOn
|
\token_to_str:N \ExplSyntaxOn
|
||||||
\int_gset:Nn \g_@@_cache_version_aux_int
|
\int_gset:Nn \g_@@_cache_version_aux_int
|
||||||
{ \int_use:N \g_@@_cache_version_document_int }
|
{ \int_use:N \g_@@_cache_version_document_int }
|
||||||
}
|
|
||||||
\iow_now:cn { @auxout }
|
|
||||||
{
|
|
||||||
\bool_if:nT
|
|
||||||
{
|
|
||||||
\g_@@_cache_bool
|
|
||||||
&&
|
|
||||||
\int_compare_p:n
|
|
||||||
{
|
|
||||||
\g_@@_cache_version_aux_int < \g_@@_cache_version_document_int
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
\cs_set_eq:NN \@@_thmtools_declare_theorem:nn \use_none:nn
|
|
||||||
}
|
|
||||||
}
|
|
||||||
\iow_now:cx { @auxout }
|
|
||||||
{
|
|
||||||
\token_to_str:N \ExplSyntaxOff
|
\token_to_str:N \ExplSyntaxOff
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue