use wrapper for grouped theorem generation

This commit is contained in:
Maximilian Keßler 2022-01-21 13:39:06 +01:00
parent 7996b7b537
commit 10458e55ed
2 changed files with 24 additions and 64 deletions

View file

@ -1936,9 +1936,9 @@
%
%
%
% \begin{macro}{\@@_declare_grouped_theorem_aux:nnnn}
% \begin{macro}{\@@_define_theorem:nnnn}
% \begin{syntax}
% \cs{@@_declare_grouped_theorem_aux:nnnn}\marg{environment name}
% \cs{@@_define_theorem:nnnn}\marg{environment name}
% \marg{groups clist}\marg{theorem name}\marg{thmtools keys}
% \end{syntax}
%
@ -1947,7 +1947,7 @@
% command of \pkg{thmtools}.
%
% \begin{macrocode}
\cs_new:Npn \@@_declare_grouped_theorem_aux:nnnn #1 #2 #3 #4
\cs_new:Npn \@@_define_theorem:nnnn #1 #2 #3 #4
{
% \end{macrocode}
% First, set local variables to default values and store current name.
@ -2018,6 +2018,9 @@
% \groupthm_new_grouped_theorem:nnnn,
% \groupthm_new_grouped_theorem:nVVV,
% \groupthm_new_grouped_theorem:xVnn
% \groupthm_provide_grouped_theorem:nnnn,
% \groupthm_provide_grouped_theorem:nVVV,
% \groupthm_provide_grouped_theorem:xVnn
% }
% \begin{syntax}
% \cs{groupthm_new_grouped_theorem:nnnn}\marg{environment name}
@ -2025,23 +2028,14 @@
% \end{syntax}
%
% \begin{macrocode}
\cs_new:Npn \groupthm_new_grouped_theorem:nnnn #1 #2 #3 #4
{
% \end{macrocode}
% Note that the next comparison depends on \pkg{thmtools} declaring
% environments, and that \LaTeX\ handles environments called with the
% |\begin{environment}| syntax by calling |\environment| subsequently.
% \begin{macrocode}
\cs_if_exist:cTF { #1 }
{
\msg_error:nnnnn { groupthm } { wrong ~ definition }
{ grouped ~ theorem } { #1 } { already }
}
{
\@@_declare_grouped_theorem_aux:nnnn
{ #1 } { #2 } { #3 } { #4 }
}
}
\@@_define_multiple:nnnNNnn
{ new, provide }
{ grouped ~ theorem }
{ ##1 }
\error
\@@_define_theorem:nnnn
{ groupthm_#1_grouped_theorem:nnnn }
{ { ##1 } { ##2 } { ##3 } { ##4 } }
\cs_generate_variant:Nn \groupthm_new_grouped_theorem:nnnn { n V V V }
% \end{macrocode}
% We need this extra variant here for the generation of theorem families later:
@ -2051,26 +2045,6 @@
% \end{macro}
%
%
% \begin{macro}{\groupthm_provide_grouped_theorem:nnnn,\groupthm_provide_grouped_theorem:nVVV}
%
% \begin{macrocode}
\cs_new:Npn \groupthm_provide_grouped_theorem:nnnn #1 #2 #3 #4
{
% \end{macrocode}
% Note that the next comparison depends on \pkg{thmtools} declaring
% environments, and that \LaTeX\ handles environments called with the
% |\begin{environment}| syntax by calling |\environment| subsequently.
% \begin{macrocode}
\cs_if_exist:cF { #1 }
{
\@@_declare_grouped_theorem_aux:nnnn
{ #1 } { #2 } { #3 } { #4 }
}
}
\cs_generate_variant:Nn \groupthm_provide_grouped_theorem:nnnn { n V V V }
% \end{macrocode}
% \end{macro}
%
%
% The star variants of these that add the \texttt{unnumbered} group
% are straightforward:

View file

@ -367,7 +367,6 @@
{
\groupthm_declare_group_rule:nnnn {#1} {#2} {#3} {#4}
}
% \subsection{Iterating over powersets}
\clist_new:N \l__powerset_copied_clist
\seq_new:N \l__powerset_saved_seq
\cs_generate_variant:Nn \clist_remove_all:Nn { N V }
@ -417,7 +416,7 @@
#1 { \tl_use:N \l__groupthm_name_tl }
}
}
\cs_new:Npn \__groupthm_declare_grouped_theorem_aux:nnnn #1 #2 #3 #4
\cs_new:Npn \__groupthm_define_theorem:nnnn #1 #2 #3 #4
{
\tl_clear:N \l__groupthm_prefix_tl
\tl_set:Nn \l__groupthm_name_tl { #3 }
@ -445,29 +444,16 @@
\l__groupthm_thmtools_clist
{ #1 }
}
\cs_new:Npn \groupthm_new_grouped_theorem:nnnn #1 #2 #3 #4
{
\cs_if_exist:cTF { #1 }
{
\msg_error:nnnnn { groupthm } { wrong ~ definition }
{ grouped ~ theorem } { #1 } { already }
}
{
\__groupthm_declare_grouped_theorem_aux:nnnn
{ #1 } { #2 } { #3 } { #4 }
}
}
\__groupthm_define_multiple:nnnNNnn
{ new, provide }
{ grouped ~ theorem }
{ ##1 }
\error
\__groupthm_define_theorem:nnnn
{ groupthm_#1_grouped_theorem:nnnn }
{ { ##1 } { ##2 } { ##3 } { ##4 } }
\cs_generate_variant:Nn \groupthm_new_grouped_theorem:nnnn { n V V V }
\cs_generate_variant:Nn \groupthm_new_grouped_theorem:nnnn { x V n n }
\cs_new:Npn \groupthm_provide_grouped_theorem:nnnn #1 #2 #3 #4
{
\cs_if_exist:cF { #1 }
{
\__groupthm_declare_grouped_theorem_aux:nnnn
{ #1 } { #2 } { #3 } { #4 }
}
}
\cs_generate_variant:Nn \groupthm_provide_grouped_theorem:nnnn { n V V V }
\cs_new:Npn \groupthm_new_grouped_theorem_star:nnnn #1 #2 #3 #4
{
\groupthm_new_grouped_theorem:nnnn