prename, postname and thmtools keys for groups and grouped theorems working
This commit is contained in:
parent
e92f1da165
commit
386f07a6d6
1 changed files with 68 additions and 16 deletions
|
@ -8,30 +8,46 @@ __HEADER__(Grouping theorems for easier customization.)
|
|||
|
||||
\NewHook { groupthm / prename }
|
||||
\NewHook { groupthm / postname }
|
||||
\NewHook { groupthm / mapname }
|
||||
\NewHook { groupthm / thmtools }
|
||||
|
||||
|
||||
\newcounter{indocument}
|
||||
\newcounter{insection}[section]
|
||||
\newcounter{insubsection}[subsection]
|
||||
|
||||
\tl_new:N \__name_tl
|
||||
\str_new:N \__name_str
|
||||
|
||||
|
||||
\cs_new:Nn \declaretheorem:nn
|
||||
{
|
||||
\tl_show:n { #1 }
|
||||
\declaretheorem [ #1 ] { #2 }
|
||||
}
|
||||
|
||||
\cs_generate_variant:Nn \declaretheorem:nn {V V, V n}
|
||||
|
||||
|
||||
% groupname, prename, postname, mapname, thmtools
|
||||
\cs_new:Npn \store_group:nnnnn #1#2#3#4#5
|
||||
{
|
||||
\cs_new:cpn { retrieve_group_#1: }
|
||||
{
|
||||
\AddToHook { groupthm / prename } [ #1 ]
|
||||
{
|
||||
\tl_put_right:Nx \__name_str { #2 }
|
||||
\tl_put_left:Nx \__name_tl { #2 }
|
||||
}
|
||||
\AddToHook { groupthm / postname } [ #1 ]
|
||||
{
|
||||
\tl_put_right:Nx \__name_str { #3 }
|
||||
\tl_put_right:Nx \__name_tl { #3 }
|
||||
}
|
||||
\AddToHook { groupthm / mapname } [ #1 ]
|
||||
{
|
||||
\clist_put_right:Nn \l_groupthm_mapname_clist { #4 }
|
||||
}
|
||||
\AddToHook { groupthm / thmtools } [ #1 ]
|
||||
{
|
||||
\clist_put_right:Nn __PACKAGE_MACRO__(thmtools_args_clist) { #5 }
|
||||
}
|
||||
% TODO: handle thmtools and mapname
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +105,6 @@ __HEADER__(Grouping theorems for easier customization.)
|
|||
}
|
||||
|
||||
% Construct name
|
||||
\str_new:N \__name_str
|
||||
\tl_if_eq:NnTF __PACKAGE_MACRO__(theorem_name_tl) { \c_novalue_tl }
|
||||
{
|
||||
\str_set:Nx \__name_str
|
||||
|
@ -104,22 +119,25 @@ __HEADER__(Grouping theorems for easier customization.)
|
|||
}
|
||||
}
|
||||
|
||||
\tl_new:N \__name_tl
|
||||
\tl_set:NV \__name_tl \__name_str
|
||||
|
||||
% Process groups here, adding to the hooks for prename, postname, mapname, thmtools
|
||||
% mapname currently not implemented
|
||||
\RemoveFromHook { groupthm / prename }[ * ]
|
||||
\RemoveFromHook { groupthm / postname }[*]
|
||||
\RemoveFromHook { groupthm / mapname }[*]
|
||||
\RemoveFromHook { groupthm / thmtools }[*]
|
||||
|
||||
\clist_map_function:NN __PACKAGE_MACRO__(groups_clist) \retrieve_group:n
|
||||
|
||||
% \clist_new:N __PACKAGE_MACRO__(mapname_clist)
|
||||
% \clist_set:N
|
||||
|
||||
%\clist_show:N __PACKAGE_MACRO__(groups_clist)
|
||||
\hook_use:n { groupthm / prename }
|
||||
\hook_use:n { groupthm / postname }
|
||||
\hook_use:n { groupthm / mapname }
|
||||
\hook_use:n { groupthm / thmtools }
|
||||
|
||||
\clist_put_right:Nx __PACKAGE_MACRO__(thmtools_args_clist)
|
||||
{
|
||||
name = \str_use:N \__name_str
|
||||
name = \str_use:N \__name_tl
|
||||
}
|
||||
\declaretheorem:Vn
|
||||
{
|
||||
|
@ -127,3 +145,37 @@ __HEADER__(Grouping theorems for easier customization.)
|
|||
}
|
||||
{ #2 }
|
||||
}
|
||||
|
||||
|
||||
%%% Default groups available
|
||||
|
||||
\NewTheoremGroup { all }
|
||||
[
|
||||
]
|
||||
|
||||
\NewTheoremGroup { big }
|
||||
[
|
||||
thmtools = { sibling = insection }
|
||||
]
|
||||
|
||||
\NewTheoremGroup { dagger }
|
||||
[
|
||||
postname = { $\dagger$ },
|
||||
thmtools = { sibling = insubsection }
|
||||
]
|
||||
|
||||
\NewTheoremGroup { small }
|
||||
[
|
||||
thmtools = { sibling = insubsection }
|
||||
]
|
||||
|
||||
\NewTheoremGroup { star }
|
||||
[
|
||||
thmtools = { sibling = insubsection },
|
||||
postname = { * }
|
||||
]
|
||||
|
||||
\NewTheoremGroup { starred }
|
||||
[
|
||||
thmtools = { numbered = no }
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue