implement option interface for groupthm.
This commit is contained in:
parent
4bda829518
commit
b041d8c990
2 changed files with 75 additions and 3 deletions
|
@ -836,6 +836,7 @@
|
|||
% \begin{macrocode}
|
||||
\RequirePackage{amsthm}
|
||||
\RequirePackage{thmtools}
|
||||
\RequirePackage{l3keys2e}
|
||||
% \end{macrocode}
|
||||
%
|
||||
% \begin{macro}{\@@_thmtools_declare_theorem:nn, \@@_thmtools_declare_theorem:Vn}
|
||||
|
@ -965,6 +966,9 @@
|
|||
\hook_new:n { @@/thmtools }
|
||||
% \end{macrocode}
|
||||
% \begin{macrocode}
|
||||
\hook_new:n { @@/definelazy }
|
||||
% \end{macrocode}
|
||||
% \begin{macrocode}
|
||||
\hook_new:n { @@/groupsort }
|
||||
% \end{macrocode}
|
||||
%
|
||||
|
@ -1047,6 +1051,10 @@
|
|||
\bool_new:N \l_@@_in_family_options_environment_bool
|
||||
% \end{macrocode}
|
||||
% \end{variable}
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% \begin{variable}{\g_@@_append_groups_int}
|
||||
%
|
||||
% This counts the number of times we appended to a group.
|
||||
|
@ -1057,6 +1065,33 @@
|
|||
% \end{variable}
|
||||
%
|
||||
%
|
||||
%
|
||||
%
|
||||
% \begin{variable}{\g_@@_cache_bool}
|
||||
%
|
||||
% This stores whether we cache definitions in the aux file.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\bool_new:N \g_@@_cache_bool
|
||||
% \end{macrocode}
|
||||
% \end{variable}
|
||||
%
|
||||
%
|
||||
%
|
||||
% \begin{variable}{\g_@@_cache_version_aux_int, \g_@@_cache_version_document_int}
|
||||
%
|
||||
% The version of the cached theorems in the aux file
|
||||
% and the version the package has been loaded with.
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\int_new:N \g_@@_cache_version_aux_int
|
||||
\int_new:N \g_@@_cache_version_document_int
|
||||
\int_set:Nn \g_@@_cache_version_aux_int { -1 }
|
||||
% \end{macrocode}
|
||||
% \end{variable}
|
||||
%
|
||||
%
|
||||
%
|
||||
% \subsection{Key interface}
|
||||
% As mentioned, all keys will set their corresponding local variables
|
||||
% (containing \enquote{\texttt{_key_}} in their name) and store the
|
||||
|
@ -1068,6 +1103,14 @@
|
|||
%
|
||||
%
|
||||
% \begin{macrocode}
|
||||
\keys_define:nn { groupthm }
|
||||
{
|
||||
cache .bool_set:N = \g_@@_cache_bool,
|
||||
cache .default:n = { true },
|
||||
__cache version__ .int_set:N = \g_@@_cache_version_document_int,
|
||||
cache version .meta:nn = { groupthm } { cache = true, __cache version__ = #1 },
|
||||
cache version .default:n = { 0 },
|
||||
}
|
||||
\keys_define:nn { groupthm / theorem ~ group }
|
||||
{
|
||||
prefix .tl_set:N = \l_@@_key_prefix_tl,
|
||||
|
@ -1119,6 +1162,13 @@
|
|||
% \end{macrocode}
|
||||
%
|
||||
%
|
||||
%
|
||||
% Process package options:
|
||||
% \begin{macrocode}
|
||||
\ProcessKeysOptions { groupthm }
|
||||
% \end{macrocode}
|
||||
%
|
||||
%
|
||||
% The only key whose default requires such handling is the \enquote{\texttt{name}} key,
|
||||
% which will be set to a capitalized version of the environment name
|
||||
% when not specified.
|
||||
|
@ -1918,11 +1968,13 @@
|
|||
%
|
||||
% 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}
|
||||
% For generating the different variants of a theorem family,
|
||||
|
@ -2224,10 +2276,27 @@
|
|||
{ \@@_Declarator: GroupedTheorem }
|
||||
{ s O{} m }
|
||||
{
|
||||
\use:c { groupthm_#1_theorem:nnn }
|
||||
\bool_if:nTF
|
||||
{
|
||||
\g_@@_cache_bool
|
||||
&&
|
||||
\int_compare_p:n
|
||||
{
|
||||
\g_@@_cache_version_aux_int < \g_@@_cache_version_document_int
|
||||
}
|
||||
}
|
||||
{
|
||||
\hook_gput_code:nnn {@@/lazy} { groupthm }
|
||||
}
|
||||
{
|
||||
\use:n
|
||||
}
|
||||
{
|
||||
\use:c { groupthm_#1_theorem:nnn }
|
||||
{ ##2 }
|
||||
{ ##3 }
|
||||
{ ##1 }
|
||||
}
|
||||
}
|
||||
% \end{macrocode}
|
||||
% \end{macro}
|
||||
|
@ -2589,6 +2658,9 @@
|
|||
%
|
||||
%
|
||||
%
|
||||
% \subsection{Caching}
|
||||
%
|
||||
%
|
||||
%
|
||||
% \begin{macrocode}
|
||||
%</package>
|
||||
|
|
0
src/environments/groupthm/groupthm.synctex(busy)
Normal file
0
src/environments/groupthm/groupthm.synctex(busy)
Normal file
Loading…
Reference in a new issue