Compare commits
No commits in common. "master" and "v2.8-build" have entirely different histories.
master
...
v2.8-build
39 changed files with 5035 additions and 8 deletions
|
@ -1,8 +0,0 @@
|
|||
# LatexPackagesBuild
|
||||
Ready to use builds of my LaTeX packages.
|
||||
|
||||
These are mirrored builds of the main [latex-packages](https://git.abstractnonsen.se/latex/latex-packages) repository.
|
||||
|
||||
Branches named `${BRANCH}` in the main repository will be built and made available here as `${BRANCH}-build`. So feel free to clone these branches here to easily update your packages when the main package repo updates - without having to build the packages yourself!
|
||||
|
||||
For further information about these packages, visit the LatexPackages repository.
|
384
environments/fancythm/fancythm.sty
Normal file
384
environments/fancythm/fancythm.sty
Normal file
|
@ -0,0 +1,384 @@
|
|||
%%
|
||||
%% This is file `fancythm.sty',
|
||||
%% generated with the docstrip utility.
|
||||
%%
|
||||
%% The original source files were:
|
||||
%%
|
||||
%% fancythm.dtx (with options: `package')
|
||||
%%
|
||||
%% IMPORTANT NOTICE:
|
||||
%%
|
||||
%% For the copyright see the source file.
|
||||
%%
|
||||
%% Any modified versions of this file must be renamed
|
||||
%% with new filenames distinct from fancythm.sty.
|
||||
%%
|
||||
%% For distribution of the original source see the terms
|
||||
%% for copying and modification in the file fancythm.dtx.
|
||||
%%
|
||||
%% This generated file may be distributed as long as the
|
||||
%% original source files, as listed above, are part of the
|
||||
%% same distribution. (The sources need not necessarily be
|
||||
%% in the same archive or directory.)
|
||||
%% File: fancytm.dtx
|
||||
\ProvidesExplPackage{fancythm}{2022/01/17}{0.0.1}{Grouped theorems.}
|
||||
\RequirePackage{l3keys2e}
|
||||
\RequirePackage{groupthm}
|
||||
\RequirePackage[default styles]{mkessler-thmstyle}
|
||||
\cs_set_eq:NN \arabic:n \arabic
|
||||
\cs_set_eq:NN \counter_new:n \newcounter
|
||||
\cs_set_eq:NN \counter_within:nn \counterwithin
|
||||
\cs_new:Npn \counter_new:nn #1 #2
|
||||
{
|
||||
\counter_new:n { #1 }
|
||||
\counter_within:nn { #1 } { #2 }
|
||||
}
|
||||
\cs_new:Npn \counter_if_exist_p:n #1
|
||||
{
|
||||
\cs_if_exist_p:c { c@ #1 }
|
||||
}
|
||||
\cs_new:Npn \counter_if_exist:nT #1
|
||||
{
|
||||
\cs_if_exist:cT { c@ #1 }
|
||||
}
|
||||
\cs_new:Npn \counter_if_exist:nF #1
|
||||
{
|
||||
\cs_if_exist:cF { c@ #1 }
|
||||
}
|
||||
\cs_new:Npn \counter_if_exist:nTF #1
|
||||
{
|
||||
\cs_if_exist:cTF { c@ #1 }
|
||||
}
|
||||
\cs_set_eq:Nc \counter_undefined_error:n { @nocounterr }
|
||||
\cs_new:Npn \counter_ensure_exist:n #1
|
||||
{
|
||||
\counter_if_exist:nF { #1 }
|
||||
{
|
||||
\counter_undefined_error:n { #1 }
|
||||
}
|
||||
}
|
||||
\cs_new:Npn \counter_the:n #1
|
||||
{
|
||||
\use:c { the #1 }
|
||||
}
|
||||
\cs_new:Npn \counter_set_the:nn #1 #2
|
||||
{
|
||||
\counter_ensure_exist:n { #1 }
|
||||
\exp_args:Nc \renewcommand { the #1 } { #2 }
|
||||
}
|
||||
\cs_new:Npn \counter_sub:nn #1 #2
|
||||
{
|
||||
\counter_within:nn { #1 } { #2 }
|
||||
\counter_set_the:nn { #1 }
|
||||
{
|
||||
\counter_the:n { #2 } . \arabic:n { #1 }
|
||||
}
|
||||
}
|
||||
\cs_new:Npn \counter_new_sub:nn #1 #2
|
||||
{
|
||||
\counter_new:n { #1 }
|
||||
\counter_sub:nn { #1 } { #2 }
|
||||
}
|
||||
|
||||
\cs_new:Npn \__fancythm_counter_sub_if_exist:n #1
|
||||
{
|
||||
\counter_if_exist:nT { #1 }
|
||||
{
|
||||
\counter_new_sub:nn { in #1 } { #1 }
|
||||
}
|
||||
}
|
||||
\cs_set_eq:Nc \counter_alias:nn { @counteralias }
|
||||
\cs_generate_variant:Nn \counter_alias:nn { n x }
|
||||
\counter_new:n { indocument }
|
||||
\__fancythm_counter_sub_if_exist:n { section }
|
||||
\__fancythm_counter_sub_if_exist:n { subsection }
|
||||
\__fancythm_counter_sub_if_exist:n { chapter }
|
||||
\__fancythm_counter_sub_if_exist:n { part }
|
||||
\counter_alias:nn { toplevel } { indocument }
|
||||
\counter_new_sub:nn { sublevel } { toplevel }
|
||||
\counter_new_sub:nn { subsublevel } { sublevel }
|
||||
\counter_new_sub:nn { subsubsublevel } { subsublevel }
|
||||
\str_new:N \g__fancythm_style_str
|
||||
\bool_new:N \g__fancythm_translator_bool
|
||||
\bool_new:N \g__fancythm_generate_defaults_bool
|
||||
\tl_new:N \l__fancythm_key_name_tl
|
||||
\tl_new:N \l__fancythm_key_mdframed_tl
|
||||
\tl_new:N \l__fancythm_key_style_tl
|
||||
\clist_new:N \l__fancythm_key_group_clist
|
||||
\clist_new:N \l__fancythm_key_thmtools_clist
|
||||
\tl_new:N \l__fancythm_name_tl
|
||||
\clist_new:N \l__fancythm_thmtools_clist
|
||||
\clist_new:N \l__fancythm_group_clist
|
||||
\keys_define:nn { fancythm }
|
||||
{
|
||||
translator .bool_set:N = \g__fancythm_translator_bool ,
|
||||
translator .default:n = { true } ,
|
||||
generate defaults .bool_set:N = \g__fancythm_generate_defaults_bool ,
|
||||
generate defaults .default:n = { true } ,
|
||||
number in .choices:nn =
|
||||
{ document, section, subsection, chapter, part }
|
||||
{
|
||||
\counter_alias:nx { toplevel } { in \tl_use:N \l_keys_choice_tl }
|
||||
} ,
|
||||
number in .default:n = { document } ,
|
||||
style .choices:nn =
|
||||
{ fancy, plain, classic }
|
||||
{
|
||||
\str_set:Nn \g__fancythm_style_str { \tl_use:N \l_keys_choice_tl }
|
||||
} ,
|
||||
style .default:n = { fancy } ,
|
||||
}
|
||||
\keys_define:nn { fancythm / fancytheorem }
|
||||
{
|
||||
name .tl_set:N = \l__fancythm_key_name_tl ,
|
||||
name .default:n = \c_novalue_tl ,
|
||||
mdframed .tl_set:N = \l__fancythm_key_mdframed_tl ,
|
||||
mdframed .default:n = \c_novalue_tl ,
|
||||
style .tl_set:N = \l__fancythm_key_style_tl ,
|
||||
style .default:n = \c_novalue_tl ,
|
||||
group .clist_set:N = \l__fancythm_key_group_clist ,
|
||||
group .default:n = {} ,
|
||||
thmtools .clist_set:N = \l__fancythm_key_thmtools_clist ,
|
||||
thmtools .default:n = {} ,
|
||||
}
|
||||
\keys_set:nn { fancythm } { translator, generate defaults, number in, style }
|
||||
\ProcessKeysOptions{ fancythm }
|
||||
\bool_if:NTF \g__fancythm_translator_bool
|
||||
{
|
||||
\RequirePackage{translator}
|
||||
\usedictionary{translator-environment-names}
|
||||
\cs_set_eq:NN \__fancythm_translate:n \translate
|
||||
}
|
||||
{
|
||||
\cs_set_eq:NN \__fancythm_translate:n \use:n
|
||||
}
|
||||
\cs_new:Npn \__fancythm_set_normalized_keys:nn #1 #2
|
||||
{
|
||||
\keys_set:nn { fancythm / fancytheorem } { name, mdframed, style, group, thmtools }
|
||||
\keys_set:nn { fancythm / fancytheorem } { #1 }
|
||||
\clist_set_eq:NN \l__fancythm_group_clist \l__fancythm_key_group_clist
|
||||
\clist_set_eq:NN \l__fancythm_thmtools_clist \l__fancythm_key_thmtools_clist
|
||||
\tl_if_eq:NnF \l__fancythm_key_mdframed_tl { \c_novalue_tl }
|
||||
{
|
||||
\clist_put_right:Nx \l__fancythm_thmtools_clist
|
||||
{
|
||||
mdframed = { style = \tl_use:N \l__fancythm_key_mdframed_tl }
|
||||
}
|
||||
}
|
||||
\tl_if_eq:NnF \l__fancythm_key_style_tl { \c_novalue_tl }
|
||||
{
|
||||
\clist_put_right:Nx \l__fancythm_thmtools_clist
|
||||
{
|
||||
style = \tl_use:N \l__fancythm_key_style_tl
|
||||
}
|
||||
}
|
||||
\tl_if_eq:NnTF \l__fancythm_key_name_tl { \c_novalue_tl }
|
||||
{
|
||||
\tl_set:Nx \l__fancythm_name_tl
|
||||
{
|
||||
\text_titlecase_first:n { \tl_trim_spaces:n { #2 } }
|
||||
}
|
||||
}
|
||||
{
|
||||
\tl_set_eq:NN \l__fancythm_name_tl \l__fancythm_key_name_tl
|
||||
}
|
||||
\tl_set:Nx \l__fancythm_name_tl
|
||||
{
|
||||
\exp_not:N \__fancythm_translate:n { \tl_use:N \l__fancythm_name_tl }
|
||||
}
|
||||
}
|
||||
\cs_new:Npn \__fancythm_wrap_multiple:nnn #1 #2 #3
|
||||
{
|
||||
\cs_set:Npn \__fancythm_map_aux:n ##1
|
||||
{
|
||||
\cs_new:cn { #2 }
|
||||
{
|
||||
#3
|
||||
}
|
||||
}
|
||||
\clist_map_function:nN { #1 } \__fancythm_map_aux:n
|
||||
}
|
||||
\__fancythm_wrap_multiple:nnn
|
||||
{ new, provide }
|
||||
{ fancythm_#1_theorem:nnnn }
|
||||
{
|
||||
\use:c { groupthm_#1_family:nnnnn } { ##1 } { dagger, star } { ##3 } { ##4 } { ##2 }
|
||||
\use:c { groupthm_#1_family_options:nnnn }
|
||||
{ ##1 }
|
||||
{ !s !t+ }
|
||||
{
|
||||
\IfBooleanT { ####1 }
|
||||
{
|
||||
\groupthm_add_theorem_to_group:n { star }
|
||||
}
|
||||
\IfBooleanT { ####2 }
|
||||
{
|
||||
\groupthm_add_theorem_to_group:n { dagger }
|
||||
}
|
||||
}
|
||||
{ ##2 }
|
||||
}
|
||||
\cs_generate_variant:Nn \fancythm_new_theorem:nnnn { n V V V }
|
||||
\cs_generate_variant:Nn \fancythm_provide_theorem:nnnn { n V V V }
|
||||
\__fancythm_wrap_multiple:nnn
|
||||
{ new, provide }
|
||||
{ fancythm_#1_theorem:nn }
|
||||
{
|
||||
\__fancythm_set_normalized_keys:nn { ##1 } { ##2 }
|
||||
\use:c { fancythm_#1_theorem:nVVV }
|
||||
{ ##2 }
|
||||
\l__fancythm_group_clist
|
||||
\l__fancythm_name_tl
|
||||
\l__fancythm_thmtools_clist
|
||||
}
|
||||
\cs_new:Npn \__fancythm_new_document_command:Nnn #1 #2 #3
|
||||
{
|
||||
\NewDocumentCommand { #1 } { #2 } { #3 }
|
||||
}
|
||||
\cs_generate_variant:Nn \__fancythm_new_document_command:Nnn { c n n }
|
||||
\cs_new:Npn \__fancythm_wrap_multiple_document:nnnn #1 #2 #3 #4
|
||||
{
|
||||
\cs_set:Npn \__fancythm_map_aux:n ##1
|
||||
{
|
||||
\cs_set:Nn \__fancythm_Declarator: { \text_titlecase_first:n { ##1 } }
|
||||
\__fancythm_new_document_command:cnn { #2 } { #3 } { #4 }
|
||||
}
|
||||
\clist_map_function:nN { #1 } \__fancythm_map_aux:n
|
||||
}
|
||||
\__fancythm_wrap_multiple_document:nnnn
|
||||
{ new, provide }
|
||||
{ \__fancythm_Declarator: FancyTheorem }
|
||||
{ O{} m }
|
||||
{
|
||||
\use:c { fancythm_#1_theorem:nn } { ##1 } { ##2 }
|
||||
}
|
||||
\groupthm_new_group:nnnnn { star } { } { * } { } { }
|
||||
\groupthm_new_group:nnnnn { dagger } { } { $^{\dagger}$ } { } { }
|
||||
\groupthm_new_group:nnnnn { big } { } { } { } { sibling = toplevel }
|
||||
\groupthm_new_group:nnnnn { small } { } { } { } { sibling = sublevel }
|
||||
\groupthm_new_group:nnnnn { tiny } { } { } { } { numbered = no }
|
||||
\groupthm_new_group:nnnnn { custom } { } { } { } { sibling = sublevel }
|
||||
\groupthm_add_parent:nn { star } { custom }
|
||||
\groupthm_add_parent:nn { dagger } { custom }
|
||||
\DeclareTheoremGroupRule [ suffix ] { dagger } { higher } { star }
|
||||
\DeclareTheoremGroupRule { tiny } { higher } { small }
|
||||
\DeclareTheoremGroupRule { tiny } { higher } { big }
|
||||
\DeclareTheoremGroupRule { tiny } { higher } { custom }
|
||||
\DeclareTheoremGroupRule { small } { higher } { big }
|
||||
\DeclareTheoremGroupRule { custom } { higher } { big }
|
||||
\cs_new:Npn \fancythm_add_provided_theorem_to_group:nn #1 #2
|
||||
{
|
||||
\cs_if_exist:cF { __fancythm_provided_theorem__#1__group_clist }
|
||||
{
|
||||
\clist_new:c { __fancythm_provided_theorem__#1__group_clist }
|
||||
}
|
||||
\clist_put_left:cn { __fancythm_provided_theorem__#1__group_clist } { #2 }
|
||||
}
|
||||
\NewDocumentCommand { \AddProvidedFancyTheoremToGroup } { m m }
|
||||
{
|
||||
\fancythm_add_provided_theorem_to_group:nn { #1 } { #2 }
|
||||
}
|
||||
\cs_new:Npn \__fancythm_provide_package_theorem:nnn #1 #2 #3
|
||||
{
|
||||
\__fancythm_set_normalized_keys:nn { #1 } { #2 }
|
||||
\cs_if_exist:cT { __fancythm_provided_theorem__#2__group_clist }
|
||||
{
|
||||
\clist_concat:ccc
|
||||
{ l__fancythm_group_clist }
|
||||
{ __fancythm_provided_theorem__#2__group_clist }
|
||||
{ l__fancythm_group_clist }
|
||||
}
|
||||
\clist_if_in:NnF \l__fancythm_group_clist { big }
|
||||
{
|
||||
\clist_if_in:NnF \l__fancythm_group_clist { small }
|
||||
{
|
||||
\clist_if_in:NnF \l__fancythm_group_clist { tiny }
|
||||
{
|
||||
\clist_put_right:Nn \l__fancythm_group_clist { #3 }
|
||||
}
|
||||
}
|
||||
}
|
||||
\fancythm_provide_theorem:nVVV
|
||||
{ #2 }
|
||||
\l__fancythm_group_clist
|
||||
\l__fancythm_name_tl
|
||||
\l__fancythm_thmtools_clist
|
||||
}
|
||||
\cs_new:Npn \fancythm_provide_big_theorem:nn #1 #2
|
||||
{
|
||||
\__fancythm_provide_package_theorem:nnn { #1 } { #2 } { big }
|
||||
}
|
||||
\cs_new:Npn \fancythm_provide_small_theorem:nn #1 #2
|
||||
{
|
||||
\__fancythm_provide_package_theorem:nnn { #1 } { #2 } { small }
|
||||
}
|
||||
\cs_new:Npn \fancythm_provide_tiny_theorem:nn #1 #2
|
||||
{
|
||||
\__fancythm_provide_package_theorem:nnn { #1 } { #2 } { tiny }
|
||||
}
|
||||
\bool_if:NT \g__fancythm_generate_defaults_bool
|
||||
{
|
||||
\AddToHook { begindocument / before } [ fancythm ]
|
||||
{
|
||||
\fancythm_provide_big_theorem:nn { style = thmredmarginandfill } { theorem }
|
||||
\fancythm_provide_big_theorem:nn { style = thmredmarginandfill } { proposition }
|
||||
\fancythm_provide_big_theorem:nn { style = thmredmarginandfill } { corollary }
|
||||
\fancythm_provide_big_theorem:nn { style = thmbluemarginandfill } { definition }
|
||||
\fancythm_provide_big_theorem:nn { style = thmorangemarginandfill} { lemma }
|
||||
\fancythm_provide_big_theorem:nn { style = thmgreenmargin } { example }
|
||||
\fancythm_provide_big_theorem:nn
|
||||
{
|
||||
style = thmredmarginbluefill,
|
||||
name = Theorem ~ and ~ Definition
|
||||
} { theoremdef }
|
||||
\fancythm_provide_big_theorem:nn
|
||||
{
|
||||
style = thmredmarginbluefill,
|
||||
name = Proposition ~ and ~ Definition
|
||||
} { propositiondef }
|
||||
\fancythm_provide_big_theorem:nn
|
||||
{
|
||||
style = thmorangemarginbluefill,
|
||||
name = Lemma ~ and ~ Definition
|
||||
} { propositiondef }
|
||||
\fancythm_provide_small_theorem:nn { style = thmvioletmargin } { notation }
|
||||
\fancythm_provide_small_theorem:nn { style = thmyellowmargin } { remark }
|
||||
\fancythm_provide_small_theorem:nn { style = thmgoldmargin } { praise }
|
||||
\fancythm_provide_small_theorem:nn { style = thmblackmarginandfill } { question }
|
||||
\fancythm_provide_small_theorem:nn { style = thmblackmargin } { orga }
|
||||
\fancythm_provide_small_theorem:nn { style = thmredmargin } { fact }
|
||||
\fancythm_provide_small_theorem:nn
|
||||
{
|
||||
style = thmyellowmargin,
|
||||
name = Trivial ~ Nonsense
|
||||
} { trivial }
|
||||
\fancythm_provide_small_theorem:nn
|
||||
{
|
||||
style = thmvioletmargin,
|
||||
name = Abuse ~ of ~ Notation
|
||||
} { abuse }
|
||||
\fancythm_provide_small_theorem:nn
|
||||
{
|
||||
style = thmyellowmargin,
|
||||
name = Oral ~ remark
|
||||
} { oral }
|
||||
\fancythm_provide_tiny_theorem:nn { } { variant }
|
||||
\fancythm_provide_tiny_theorem:nn { } { assumption }
|
||||
\fancythm_provide_tiny_theorem:nn { } { note }
|
||||
\fancythm_provide_tiny_theorem:nn { } { warning }
|
||||
\fancythm_provide_tiny_theorem:nn { } { goal }
|
||||
\fancythm_provide_tiny_theorem:nn { } { strategy }
|
||||
\fancythm_provide_tiny_theorem:nn { } { problem }
|
||||
\fancythm_provide_tiny_theorem:nn { } { info }
|
||||
\fancythm_provide_tiny_theorem:nn { } { observe }
|
||||
\fancythm_provide_tiny_theorem:nn { } { property }
|
||||
\fancythm_provide_tiny_theorem:nn { } { intuition }
|
||||
\fancythm_provide_tiny_theorem:nn { } { recall }
|
||||
\fancythm_provide_tiny_theorem:nn { } { idea }
|
||||
\fancythm_provide_tiny_theorem:nn { } { exercise }
|
||||
\fancythm_provide_tiny_theorem:nn { } { reminder }
|
||||
}
|
||||
}
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `fancythm.sty'.
|
742
environments/groupthm/groupthm.sty
Normal file
742
environments/groupthm/groupthm.sty
Normal file
|
@ -0,0 +1,742 @@
|
|||
%%
|
||||
%% This is file `groupthm.sty',
|
||||
%% generated with the docstrip utility.
|
||||
%%
|
||||
%% The original source files were:
|
||||
%%
|
||||
%% groupthm.dtx (with options: `package')
|
||||
%%
|
||||
%% IMPORTANT NOTICE:
|
||||
%%
|
||||
%% For the copyright see the source file.
|
||||
%%
|
||||
%% Any modified versions of this file must be renamed
|
||||
%% with new filenames distinct from groupthm.sty.
|
||||
%%
|
||||
%% For distribution of the original source see the terms
|
||||
%% for copying and modification in the file groupthm.dtx.
|
||||
%%
|
||||
%% This generated file may be distributed as long as the
|
||||
%% original source files, as listed above, are part of the
|
||||
%% same distribution. (The sources need not necessarily be
|
||||
%% in the same archive or directory.)
|
||||
%% File: groupthm.dtx
|
||||
\ProvidesExplPackage{groupthm}{2022/01/17}{0.0.1}{Grouped theorems.}
|
||||
\RequirePackage{amsthm}
|
||||
\RequirePackage{thmtools}
|
||||
\cs_new:Npn \__groupthm_thmtools_declare_theorem:nn #1 #2
|
||||
{
|
||||
\tl_log:n { Declaring ~ thmtools ~ theorem ~ #2 }
|
||||
\declaretheorem [ #1 ] { #2 }
|
||||
}
|
||||
\cs_generate_variant:Nn \__groupthm_thmtools_declare_theorem:nn { V n }
|
||||
\cs_new:Npn \__groupthm_hook_gset_rule_foreach:nNnn #1 #2 #3 #4
|
||||
{
|
||||
\cs_set:Npn \__groupthm_map_aux:n ##1
|
||||
{
|
||||
\hook_gset_rule:nnnn { #1 } { ##1 } { #3 } { #4 }
|
||||
}
|
||||
\clist_map_function:NN #2 \__groupthm_map_aux:n
|
||||
}
|
||||
\msg_new:nnn { groupthm } { unknown ~ group }
|
||||
{
|
||||
Unknown ~ group ~ '#1' ~ supplied ~ \msg_line_context:
|
||||
}
|
||||
\msg_new:nnn { groupthm } { unknown ~ key }
|
||||
{
|
||||
Unknown ~ key ~ '#1' ~ supplied ~ \msg_line_context:
|
||||
}
|
||||
\msg_new:nnn { groupthm } { wrong ~ definition }
|
||||
{
|
||||
Bad ~ definition ~ of ~ #1 ~ '#2' ~ \msg_line_context:, ~ #1 ~ is ~ #3 ~ defined.
|
||||
}
|
||||
\msg_new:nnn { groupthm } { misuse ~ add ~ theorem ~ to ~ group }
|
||||
{
|
||||
Bad ~ usage ~ of ~ 'AddTheoremToGroup' ~ macro ~ outside ~ theorem ~
|
||||
family ~ options ~ \msg_line_context:
|
||||
}
|
||||
\msg_new:nnnn { groupthm } { undefined ~ theorem ~ variant }
|
||||
{
|
||||
Bad ~ call ~ of ~ theorem ~ variant ~ of ~ '#1' ~ \msg_line_context:
|
||||
}
|
||||
{
|
||||
You ~ wanted ~ to ~ call ~ the ~ variant ~ with ~ group(s) ~
|
||||
'#2' ~ of ~ theorem ~ family ~ '#1', ~ but ~ it ~ has ~ not ~ been ~
|
||||
generated ~ yet. ~
|
||||
Probably ~ you ~ forgot ~ this. ~
|
||||
\msg_see_documentation_text:n { groupthm }
|
||||
}
|
||||
\hook_new:n { __groupthm/prefix }
|
||||
\hook_new:n { __groupthm/suffix }
|
||||
\hook_new:n { __groupthm/mapname }
|
||||
\hook_new:n { __groupthm/thmtools }
|
||||
\hook_new:n { __groupthm/groupsort }
|
||||
\cs_generate_variant:Nn \hook_gset_rule:nnnn { n n V n }
|
||||
\bool_new:N \l__groupthm_key_starred_version_bool
|
||||
\tl_new:N \l__groupthm_key_prefix_tl
|
||||
\tl_new:N \l__groupthm_key_name_tl
|
||||
\tl_new:N \l__groupthm_key_suffix_tl
|
||||
\clist_new:N \l__groupthm_key_group_clist
|
||||
\clist_new:N \l__groupthm_key_mapname_clist
|
||||
\clist_new:N \l__groupthm_key_thmtools_clist
|
||||
\tl_new:N \l__groupthm_prefix_tl
|
||||
\tl_new:N \l__groupthm_name_tl
|
||||
\tl_new:N \l__groupthm_suffix_tl
|
||||
\clist_new:N \l__groupthm_mapname_clist
|
||||
\clist_new:N \l__groupthm_thmtools_clist
|
||||
\clist_new:N \l__groupthm_group_clist
|
||||
\clist_new:N \g__groupthm_defined_groups_clist
|
||||
\bool_new:N \l__groupthm_in_family_options_environment_bool
|
||||
\int_new:N \g__groupthm_append_groups_int
|
||||
\keys_define:nn { groupthm / theorem ~ group }
|
||||
{
|
||||
prefix .tl_set:N = \l__groupthm_key_prefix_tl,
|
||||
prefix .default:n = \c_empty_tl,
|
||||
suffix .tl_set:N = \l__groupthm_key_suffix_tl,
|
||||
suffix .default:n = \c_empty_tl,
|
||||
suffix .groups:n = { theoremgroup },
|
||||
map ~ name .clist_set:N = \l__groupthm_mapname_clist,
|
||||
map ~ name .default:n = {},
|
||||
map ~ name .groups:n = { theoremgroup },
|
||||
thmtools .clist_set:N = \l__groupthm_key_thmtools_clist,
|
||||
thmtools .default:n = {},
|
||||
unknown .code:n =
|
||||
\msg_error:nnx { groupthm } { unknown ~ key } { \str_use:N \l_keys_key_str }
|
||||
}
|
||||
\keys_define:nn { groupthm / grouped ~ theorem }
|
||||
{
|
||||
name .tl_set:N = \l__groupthm_key_name_tl,
|
||||
name .default:n = \c_novalue_tl,
|
||||
group .clist_set:N = \l__groupthm_key_group_clist,
|
||||
group .default:n = {},
|
||||
thmtools .clist_set:N = \l__groupthm_key_thmtools_clist,
|
||||
thmtools .default:n = {},
|
||||
starred ~ version .bool_set:N = \l__groupthm_key_starred_version_bool,
|
||||
starred ~ version .default:n = { true },
|
||||
unknown .code:n =
|
||||
\msg_error:nnx { groupthm } { unknown ~ key } { \str_use:N \l_keys_key_str }
|
||||
}
|
||||
\keys_define:nn { groupthm / theorem ~ family }
|
||||
{
|
||||
name .tl_set:N = \l__groupthm_key_name_tl,
|
||||
name .default:n = \c_novalue_tl,
|
||||
group .clist_set:N = \l__groupthm_key_group_clist,
|
||||
group .default:n = {},
|
||||
thmtools .clist_set:N = \l__groupthm_key_thmtools_clist,
|
||||
thmtools .default:n = {},
|
||||
starred ~ version .bool_set:N = \l__groupthm_key_starred_version_bool,
|
||||
starred ~ version .default:n = { true },
|
||||
unknown .code:n =
|
||||
\msg_error:nnx { groupthm } { unknown ~ key } { \str_use:N \l_keys_key_str }
|
||||
}
|
||||
\keys_define:nn { groupthm / theorem ~ family ~ options }
|
||||
{
|
||||
starred ~ version .bool_set:N = \l__groupthm_key_starred_version_bool,
|
||||
starred ~ version .default:n = { true },
|
||||
unknown .code:n =
|
||||
\msg_error:nnx { groupthm } { unknown ~ key } { \str_use:N \l_keys_key_str }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_set_normalized_keys:nnn #1 #2 #3
|
||||
{
|
||||
\keys_set:nn { groupthm / theorem ~ group }
|
||||
{ prefix, suffix, thmtools, map ~ name }
|
||||
\keys_set:nn { groupthm / grouped ~ theorem }
|
||||
{ name, group, thmtools, starred ~ version }
|
||||
\keys_set:nn { groupthm / theorem ~ family }
|
||||
{ name, group, thmtools, starred ~ version }
|
||||
\keys_set:nn { groupthm / #2 } { #1 }
|
||||
\tl_if_eq:NnTF \l__groupthm_key_name_tl { \c_novalue_tl }
|
||||
{
|
||||
\tl_set:Nx \l__groupthm_name_tl
|
||||
{
|
||||
\text_titlecase_first:n {#3}
|
||||
}
|
||||
}
|
||||
{
|
||||
\tl_set_eq:NN \l__groupthm_name_tl \l__groupthm_key_name_tl
|
||||
}
|
||||
\bool_set_eq:NN \l__groupthm_starred_version_bool \l__groupthm_key_starred_version_bool
|
||||
\tl_set_eq:NN \l__groupthm_prefix_tl \l__groupthm_key_prefix_tl
|
||||
\tl_set_eq:NN \l__groupthm_suffix_tl \l__groupthm_key_suffix_tl
|
||||
\clist_set_eq:NN \l__groupthm_group_clist \l__groupthm_key_group_clist
|
||||
\clist_set_eq:NN \l__groupthm_mapname_clist \l__groupthm_key_mapname_clist
|
||||
\clist_set_eq:NN \l__groupthm_thmtools_clist \l__groupthm_key_thmtools_clist
|
||||
}
|
||||
\cs_new:Npn \__groupthm_add_to_group_ordering:n #1
|
||||
{
|
||||
\__groupthm_hook_gset_rule_foreach:nNnn
|
||||
{ __groupthm/groupsort }
|
||||
\g__groupthm_defined_groups_clist
|
||||
{ before }
|
||||
{ #1 }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_remove_from_group_ordering:n #1
|
||||
{
|
||||
\__groupthm_hook_gset_rule_foreach:nNnn
|
||||
{ __groupthm/groupsort }
|
||||
\g__groupthm_defined_groups_clist
|
||||
{ unrelated }
|
||||
{ #1 }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_add_to_sort_hook:n #1
|
||||
{
|
||||
\hook_gput_code:nnn { __groupthm/groupsort }
|
||||
{ #1 }
|
||||
{
|
||||
\clist_put_left:Nn \l__groupthm_group_clist { #1 }
|
||||
}
|
||||
}
|
||||
\cs_new:Npn \__groupthm_sort_group_names:
|
||||
{
|
||||
\hook_gremove_code:nn { __groupthm/groupsort }{*}
|
||||
\clist_map_function:NN \l__groupthm_group_clist \__groupthm_add_to_sort_hook:n
|
||||
\clist_clear:N \l__groupthm_group_clist
|
||||
\hook_use:n { __groupthm/groupsort }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_define_group:nnnnn #1#2#3#4#5
|
||||
{
|
||||
\cs_new:cpn { __groupthm_use_group__#1: }
|
||||
{
|
||||
\hook_gput_code:nnn { __groupthm/prefix } { #1 }
|
||||
{
|
||||
\tl_put_left:Nx \l__groupthm_prefix_tl { #2 }
|
||||
}
|
||||
\hook_gput_code:nnn { __groupthm/suffix } { #1 }
|
||||
{
|
||||
\tl_put_right:Nx \l__groupthm_suffix_tl { #3 }
|
||||
}
|
||||
\hook_gput_code:nnn { __groupthm/mapname } { #1 }
|
||||
{
|
||||
\clist_put_right:Nn \l__groupthm_mapname_clist { #4 }
|
||||
}
|
||||
\hook_gput_code:nnn { __groupthm/thmtools } { #1 }
|
||||
{
|
||||
\clist_put_right:Nn \l__groupthm_thmtools_clist { #5 }
|
||||
}
|
||||
}
|
||||
\__groupthm_add_to_group_ordering:n { #1 }
|
||||
\clist_new:c { g__groupthm_parents_group__#1__clist }
|
||||
\hook_gset_rule:nnnn { ?? } { all } { before } { #1 }
|
||||
\hook_gset_rule:nnnn { ?? } { unnumbered } { after } { #1 }
|
||||
\hook_gset_rule:nnnn { ?? } { starred } { after } { #1 }
|
||||
\clist_gput_left:Nn \g__groupthm_defined_groups_clist { #1 }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_undefine_group:n #1
|
||||
{
|
||||
\tl_log:n { Undefining ~ theorem ~ group ~ '#1' }
|
||||
\cs_undefine:c { __groupthm_use_group__#1: }
|
||||
\hook_gremove_code:nn { __groupthm/prefix } { #1 }
|
||||
\hook_gremove_code:nn { __groupthm/suffix } { #1 }
|
||||
\hook_gremove_code:nn { __groupthm/mapname } { #1 }
|
||||
\hook_gremove_code:nn { __groupthm/thmtools } { #1 }
|
||||
\clist_gremove_all:Nn \g__groupthm_defined_groups_clist { #1 }
|
||||
\cs_undefine:c { g__groupthm_parents_group__#1__clist }
|
||||
\__groupthm_hook_gset_rule_foreach:nNnn
|
||||
{ ?? }
|
||||
\g__groupthm_defined_groups_clist
|
||||
{ unrelated }
|
||||
{ #1 }
|
||||
\__groupthm_hook_gset_rule_foreach:nNnn
|
||||
{ __groupthm/prefix }
|
||||
\g__groupthm_defined_groups_clist
|
||||
{ unrelated }
|
||||
{ #1 }
|
||||
\__groupthm_hook_gset_rule_foreach:nNnn
|
||||
{ __groupthm/suffix }
|
||||
\g__groupthm_defined_groups_clist
|
||||
{ unrelated }
|
||||
{ #1 }
|
||||
\__groupthm_hook_gset_rule_foreach:nNnn
|
||||
{ __groupthm/mapname }
|
||||
\g__groupthm_defined_groups_clist
|
||||
{ unrelated }
|
||||
{ #1 }
|
||||
\__groupthm_hook_gset_rule_foreach:nNnn
|
||||
{ __groupthm/thmtools }
|
||||
\g__groupthm_defined_groups_clist
|
||||
{ unrelated }
|
||||
{ #1 }
|
||||
\__groupthm_remove_from_group_ordering:n { #1 }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_define:nnnNNNn #1 #2 #3 #4 #5 #6 #7
|
||||
{
|
||||
\bool_if:nT
|
||||
{
|
||||
\str_if_eq_p:nn { #1 } { new }
|
||||
&&
|
||||
\cs_if_exist_p:N #4
|
||||
}
|
||||
{
|
||||
\tl_log:n { Wrong ~ 'new' ~ definition ~ of ~ #2 ~ '#3' ~ detected. }
|
||||
\msg_error:nnnnn { groupthm } { wrong ~ definition }
|
||||
{ #2 } { #3 } { already }
|
||||
}
|
||||
\bool_if:nT
|
||||
{
|
||||
\str_if_eq_p:nn { #1 } { renew }
|
||||
&&
|
||||
! \cs_if_exist_p:N #4
|
||||
}
|
||||
{
|
||||
\tl_log:n { Wrong ~ 'renew' ~ definition ~ of ~ #2 ~ '#3' ~ detected. }
|
||||
\msg_error:nnnnn { groupthm } { wrong ~ definition }
|
||||
{ #2 } { #3 } { not }
|
||||
}
|
||||
\bool_if:nT
|
||||
{
|
||||
(
|
||||
\str_if_eq_p:nn { #1 } { declare } ||
|
||||
\str_if_eq_p:nn { #1 } { renew }
|
||||
) &&
|
||||
\cs_if_exist_p:N #4
|
||||
}
|
||||
{
|
||||
\tl_log:n { Removing ~ definition ~ of ~ #2 ~ '#3'. }
|
||||
\tl_log:n { Declarator ~ was ~ #1. }
|
||||
#5 { #3 }
|
||||
}
|
||||
\bool_if:nTF
|
||||
{
|
||||
\cs_if_exist_p:N #4
|
||||
&&
|
||||
\str_if_eq_p:nn { #1 } { provide }
|
||||
}
|
||||
{
|
||||
\tl_log:n { Providing ~ #2 ~ '#3' ~ skipped: ~ '#3' ~ already ~ defined. }
|
||||
}
|
||||
{
|
||||
\tl_log:n { Defining ~ #2 ~ '#3'. }
|
||||
#6 #7
|
||||
}
|
||||
}
|
||||
\cs_generate_variant:Nn \__groupthm_define:nnnNNNn { n n n c N N n }
|
||||
\cs_new:Npn \__groupthm_define_multiple:nnnNNnn #1 #2 #3 #4 #5 #6 #7
|
||||
{
|
||||
\cs_set:Npn \__groupthm_map_aux:n ##1
|
||||
{
|
||||
\cs_new:cn { #6 }
|
||||
{
|
||||
\__groupthm_define:nnncNNn
|
||||
{ ##1 }
|
||||
{ #2 }
|
||||
{ ####1 }
|
||||
{ #3 }
|
||||
#4
|
||||
#5
|
||||
{ #7 }
|
||||
}
|
||||
}
|
||||
\clist_map_function:nN { #1 } \__groupthm_map_aux:n
|
||||
}
|
||||
\__groupthm_define_multiple:nnnNNnn
|
||||
{ new, renew, provide, declare }
|
||||
{ theorem group }
|
||||
{ __groupthm_use_group__##1: }
|
||||
\__groupthm_undefine_group:n
|
||||
\__groupthm_define_group:nnnnn
|
||||
{ groupthm_#1_group:nnnnn }
|
||||
{ { ##1 } { ##2 } { ##3 } { ##4 } { ##5 } }
|
||||
\cs_generate_variant:Nn \groupthm_new_group:nnnnn { n V V V V }
|
||||
\cs_generate_variant:Nn \groupthm_renew_group:nnnnn { n V V V V }
|
||||
\cs_generate_variant:Nn \groupthm_provide_group:nnnnn { n V V V V }
|
||||
\cs_generate_variant:Nn \groupthm_declare_group:nnnnn { n V V V V }
|
||||
\cs_new:Npn \__groupthm_wrap_multiple:nnn #1 #2 #3
|
||||
{
|
||||
\cs_set:Npn \__groupthm_map_aux:n ##1
|
||||
{
|
||||
\cs_new:cn { #2 }
|
||||
{
|
||||
#3
|
||||
}
|
||||
}
|
||||
\clist_map_function:nN { #1 } \__groupthm_map_aux:n
|
||||
}
|
||||
\__groupthm_wrap_multiple:nnn
|
||||
{ new, renew, provide, declare }
|
||||
{ groupthm_#1_group:nn }
|
||||
{
|
||||
\__groupthm_set_normalized_keys:nnn { ##1 } { theorem ~ group } { ##2 }
|
||||
\use:c { groupthm_#1_group:nVVVV }
|
||||
{ ##2 }
|
||||
\l__groupthm_prefix_tl
|
||||
\l__groupthm_suffix_tl
|
||||
\l__groupthm_mapname_clist
|
||||
\l__groupthm_thmtools_clist
|
||||
}
|
||||
\cs_generate_variant:Nn \groupthm_new_group:nn { n x }
|
||||
\cs_new:Npn \__groupthm_new_document_command:Nnn #1 #2 #3
|
||||
{
|
||||
\NewDocumentCommand { #1 } { #2 } { #3 }
|
||||
}
|
||||
\cs_generate_variant:Nn \__groupthm_new_document_command:Nnn { c n n }
|
||||
\cs_new:Npn \__groupthm_wrap_multiple_document:nnnn #1 #2 #3 #4
|
||||
{
|
||||
\cs_set:Npn \__groupthm_map_aux:n ##1
|
||||
{
|
||||
\cs_set:Nn \__groupthm_Declarator: { \text_titlecase_first:n { ##1 } }
|
||||
\__groupthm_new_document_command:cnn { #2 } { #3 } { #4 }
|
||||
}
|
||||
\clist_map_function:nN { #1 } \__groupthm_map_aux:n
|
||||
}
|
||||
\__groupthm_wrap_multiple_document:nnnn
|
||||
{ new, renew, provide, declare }
|
||||
{ \__groupthm_Declarator: TheoremGroup }
|
||||
{ O{} m }
|
||||
{
|
||||
\use:c { groupthm_#1 _group:nn } { ##1 } { ##2 }
|
||||
}
|
||||
\cs_new:Npn \groupthm_declare_group_rule:nnnn #1 #2 #3 #4
|
||||
{
|
||||
\str_set:Nx \l_tmpa_str { \tl_trim_spaces:n { #3 } }
|
||||
\str_if_eq:VnT \l_tmpa_str { higher }
|
||||
{
|
||||
\str_set:Nn \l_tmpa_str { after }
|
||||
}
|
||||
\str_if_eq:VnT \l_tmpa_str { lower }
|
||||
{
|
||||
\str_set:Nn \l_tmpa_str { before }
|
||||
}
|
||||
\str_if_eq:nnTF { #1 } { ?? }
|
||||
{
|
||||
\hook_gset_rule:nnVn {??} {#2} \l_tmpa_str {#4}
|
||||
}
|
||||
{
|
||||
\hook_gset_rule:nnVn { __groupthm / #1 } {#2} \l_tmpa_str {#4}
|
||||
}
|
||||
}
|
||||
\cs_generate_variant:Nn \groupthm_declare_group_rule:nnnn { n n n x }
|
||||
\NewDocumentCommand { \DeclareTheoremGroupRule } { O{??} m m m }
|
||||
{
|
||||
\groupthm_declare_group_rule:nnnn {#1} {#2} {#3} {#4}
|
||||
}
|
||||
\cs_new:Npn \groupthm_add_parent:nn #1 #2
|
||||
{
|
||||
\__groupthm_ensure_group_exists:n { #1 }
|
||||
\__groupthm_ensure_group_exists:n { #2 }
|
||||
\clist_gput_left:cn { g__groupthm_parents_group__#1__clist } { #2 }
|
||||
}
|
||||
\cs_generate_variant:Nn \groupthm_add_parent:nn { n x }
|
||||
\NewDocumentCommand { \AddTheoremGroupParent } { m m }
|
||||
{
|
||||
\groupthm_add_parent:nn { #1 } { #2 }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_push_tmpa_seq:n #1
|
||||
{
|
||||
\seq_push:Nn \l_tmpa_seq { #1 }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_flatten_groups_hierarchy:nN #1 #2
|
||||
{
|
||||
\clist_clear:N #2
|
||||
\seq_set_from_clist:Nn \l_tmpa_seq { #1 }
|
||||
\bool_until_do:nn
|
||||
{
|
||||
\seq_if_empty_p:N \l_tmpa_seq
|
||||
}
|
||||
{
|
||||
\seq_pop:NN \l_tmpa_seq \l_tmpa_tl
|
||||
\__groupthm_ensure_group_exists:V \l_tmpa_tl
|
||||
\clist_if_in:NVF #2 \l_tmpa_tl
|
||||
{
|
||||
\clist_put_left:NV #2 \l_tmpa_tl
|
||||
\clist_map_function:cN
|
||||
{ g__groupthm_parents_group__ \l_tmpa_tl __clist }
|
||||
\__groupthm_push_tmpa_seq:n
|
||||
}
|
||||
}
|
||||
}
|
||||
\cs_new:Npn \groupthm_append_to_group:nn #1 #2
|
||||
{
|
||||
\groupthm_new_group:nx { #1 } { __append__ \int_use:N \g__groupthm_append_groups_int }
|
||||
\groupthm_add_parent:nx { #2 } { __append__ \int_use:N \g__groupthm_append_groups_int }
|
||||
\groupthm_declare_group_rule:nnnx
|
||||
{ ?? } { #2 } { before } { __append__ \int_use:N \g__groupthm_append_groups_int }
|
||||
\int_gincr:N \g__groupthm_append_groups_int
|
||||
}
|
||||
\NewDocumentCommand { \AppendToTheoremGroup } { O{} m }
|
||||
{
|
||||
\groupthm_append_to_group:nn { #1 } { #2 }
|
||||
}
|
||||
\groupthm_new_group:nnnnn { all } { } { } { } { }
|
||||
\groupthm_new_group:nnnnn { starred } { } { } { } { numbered = no }
|
||||
\groupthm_new_group:nnnnn { unnumbered } { } { } { } { numbered = no }
|
||||
\clist_new:N \l__powerset_copied_clist
|
||||
\seq_new:N \l__powerset_saved_seq
|
||||
\cs_generate_variant:Nn \clist_remove_all:Nn { N V }
|
||||
\cs_new:Npn \__powerset_clist_foreach_aux:Nn #1 #2
|
||||
{
|
||||
\clist_if_empty:NTF \l__powerset_copied_clist
|
||||
{
|
||||
#2
|
||||
}
|
||||
{
|
||||
\clist_get:NN \l__powerset_copied_clist \l_tmpa_tl
|
||||
\seq_push:NV \l__powerset_saved_seq \l_tmpa_tl
|
||||
\clist_pop:NN \l__powerset_copied_clist { \l_tmpa_tl }
|
||||
\__powerset_clist_foreach_aux:Nn #1 {#2}
|
||||
\seq_get:NN \l__powerset_saved_seq \l_tmpa_tl
|
||||
\clist_put_left:NV #1 \l_tmpa_tl
|
||||
\__powerset_clist_foreach_aux:Nn #1 {#2}
|
||||
\seq_get:NN \l__powerset_saved_seq \l_tmpa_tl
|
||||
\clist_remove_all:NV #1 \l_tmpa_tl
|
||||
\clist_push:NV \l__powerset_copied_clist \l_tmpa_tl
|
||||
\seq_pop:NN \l__powerset_saved_seq \l_tmpa_tl
|
||||
}
|
||||
}
|
||||
\cs_new:Npn \powerset_clist_foreach:Nn #1 #2
|
||||
{
|
||||
\clist_set_eq:NN \l__powerset_copied_clist #1
|
||||
\clist_clear:N #1
|
||||
\clist_remove_duplicates:N \l__powerset_copied_clist
|
||||
\__powerset_clist_foreach_aux:Nn #1 {#2}
|
||||
\clist_set_eq:NN #1 \l__powerset_copied_clist
|
||||
}
|
||||
\cs_new:Npn \__groupthm_ensure_group_exists:n #1
|
||||
{
|
||||
\cs_if_exist:cF { __groupthm_use_group__#1: }
|
||||
{
|
||||
\msg_error:nnn { groupthm } { unknown ~ group } { #1 }
|
||||
}
|
||||
}
|
||||
\cs_generate_variant:Nn \__groupthm_ensure_group_exists:n { V }
|
||||
\cs_new:Npn \__groupthm_use_group:n #1
|
||||
{
|
||||
\__groupthm_ensure_group_exists:n { #1 }
|
||||
\use:c { __groupthm_use_group__#1: }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_use_function_on_name:n #1
|
||||
{
|
||||
\tl_set:Nx \l__groupthm_name_tl
|
||||
{
|
||||
#1 { \tl_use:N \l__groupthm_name_tl }
|
||||
}
|
||||
}
|
||||
\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 }
|
||||
\tl_clear:N \l__groupthm_suffix_tl
|
||||
\clist_clear:N \l__groupthm_mapname_clist
|
||||
\clist_clear:N \l__groupthm_thmtools_clist
|
||||
\hook_gremove_code:nn { __groupthm/prefix }{*}
|
||||
\hook_gremove_code:nn { __groupthm/suffix }{*}
|
||||
\hook_gremove_code:nn { __groupthm/mapname }{*}
|
||||
\hook_gremove_code:nn { __groupthm/thmtools }{*}
|
||||
\__groupthm_flatten_groups_hierarchy:nN { #2, all } \l__groupthm_group_clist
|
||||
\clist_map_function:NN \l__groupthm_group_clist \__groupthm_use_group:n
|
||||
\tl_log:x { Flattened ~ groups ~ '#2' ~ to ~ '\clist_use:Nn \l__groupthm_group_clist {,}' ~ when ~
|
||||
defining ~ theorem ~ '#1' }
|
||||
\hook_use:n { __groupthm/prefix }
|
||||
\hook_use:n { __groupthm/suffix }
|
||||
\hook_use:n { __groupthm/mapname }
|
||||
\hook_use:n { __groupthm/thmtools }
|
||||
\clist_map_function:NN \l__groupthm_mapname_clist \map_use_on_name:n
|
||||
\tl_set:Nn \l_tmpa_tl { name = }
|
||||
\tl_put_right:NV \l_tmpa_tl \l__groupthm_prefix_tl
|
||||
\tl_put_right:NV \l_tmpa_tl \l__groupthm_name_tl
|
||||
\tl_put_right:NV \l_tmpa_tl \l__groupthm_suffix_tl
|
||||
\clist_put_right:NV \l__groupthm_thmtools_clist \l_tmpa_tl
|
||||
\clist_put_right:Nn \l__groupthm_thmtools_clist { #4 }
|
||||
\__groupthm_thmtools_declare_theorem:Vn
|
||||
\l__groupthm_thmtools_clist
|
||||
{ #1 }
|
||||
}
|
||||
\__groupthm_define_multiple:nnnNNnn
|
||||
{ new, provide }
|
||||
{ grouped ~ theorem }
|
||||
{ ##1 }
|
||||
\__groupthm_error:
|
||||
\__groupthm_define_theorem:nnnn
|
||||
{ groupthm_#1_theorem:nnnn }
|
||||
{ { ##1 } { ##2 } { ##3 } { ##4 } }
|
||||
\cs_generate_variant:Nn \groupthm_new_theorem:nnnn { n V V V }
|
||||
\cs_generate_variant:Nn \groupthm_provide_theorem:nnnn { n V V V }
|
||||
\cs_generate_variant:Nn \groupthm_new_theorem:nnnn { x V n n }
|
||||
\cs_generate_variant:Nn \groupthm_provide_theorem:nnnn { x V n n }
|
||||
\__groupthm_wrap_multiple:nnn
|
||||
{ new, provide }
|
||||
{ groupthm_#1_theorem:nnn }
|
||||
{
|
||||
\__groupthm_set_normalized_keys:nnn { ##1 } { grouped ~ theorem } { ##2 }
|
||||
\bool_if:nT { ##3 }
|
||||
{
|
||||
\clist_put_left:Nn \l__groupthm_group_clist { unnumbered }
|
||||
}
|
||||
\use:c { groupthm_#1_theorem:nVVV }
|
||||
{ ##2 }
|
||||
\l__groupthm_group_clist
|
||||
\l__groupthm_name_tl
|
||||
\l__groupthm_thmtools_clist
|
||||
\bool_if:NT \l__groupthm_starred_version_bool
|
||||
{
|
||||
\clist_put_left:Nn \l__groupthm_group_clist { starred }
|
||||
\use:c { groupthm_#1_theorem:nVVV }
|
||||
{ ##2* }
|
||||
\l__groupthm_group_clist
|
||||
\l__groupthm_name_tl
|
||||
\l__groupthm_thmtools_clist
|
||||
}
|
||||
}
|
||||
\__groupthm_wrap_multiple_document:nnnn
|
||||
{ new, provide }
|
||||
{ \__groupthm_Declarator: GroupedTheorem }
|
||||
{ s O{} m }
|
||||
{
|
||||
\use:c { groupthm_#1_theorem:nnn }
|
||||
{ ##2 }
|
||||
{ ##3 }
|
||||
{ ##1 }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_define_family:nnnnn #1 #2 #3 #4 #5
|
||||
{
|
||||
\clist_set:Nn \l_tmpa_clist { #2 }
|
||||
\powerset_clist_foreach:Nn \l_tmpa_clist
|
||||
{
|
||||
\clist_set_eq:NN \l__groupthm_group_clist \l_tmpa_clist
|
||||
\clist_put_right:Nn \l__groupthm_group_clist { #5 }
|
||||
\__groupthm_sort_group_names:
|
||||
\use:c{groupthm_new_theorem:xVnn}
|
||||
{__#1__groups_\clist_use:Nn \l__groupthm_group_clist {_}}
|
||||
\l__groupthm_group_clist
|
||||
{ #3 }
|
||||
{ #4 }
|
||||
}
|
||||
\clist_new:c { __groupthm_family__#1__group_clist }
|
||||
\clist_set_eq:cN {__groupthm_family__#1__group_clist } \l_tmpa_clist
|
||||
\clist_new:c { __groupthm_family__#1__always_group_clist }
|
||||
\clist_set:cn {__groupthm_family__#1__always_group_clist } { #5 }
|
||||
}
|
||||
\__groupthm_define_multiple:nnnNNnn
|
||||
{ new, provide }
|
||||
{ theorem ~ family }
|
||||
{ __groupthm_family__##1__group_clist }
|
||||
\__groupthm_error:
|
||||
\__groupthm_define_family:nnnnn
|
||||
{ groupthm_#1_family:nnnnn }
|
||||
{ { ##1 } { ##2 } { ##3 } { ##4 } { ##5 }}
|
||||
\cs_generate_variant:Nn \groupthm_new_family:nnnnn { n V V V V }
|
||||
\cs_generate_variant:Nn \groupthm_provide_family:nnnnn { n V V V V }
|
||||
\__groupthm_wrap_multiple:nnn
|
||||
{ new, provide }
|
||||
{ groupthm_#1_family:nnn }
|
||||
{
|
||||
\__groupthm_set_normalized_keys:nnn { ##1 } { theorem ~ family } { ##2 }
|
||||
\bool_if:nTF { ##3}
|
||||
{
|
||||
\clist_set:Nn \l_tmpa_clist { unnumbered }
|
||||
}
|
||||
{
|
||||
\clist_clear:N \l_tmpa_clist
|
||||
}
|
||||
\bool_if:NT \l__groupthm_starred_version_bool
|
||||
{
|
||||
\clist_put_left:Nn \l__groupthm_group_clist { starred }
|
||||
}
|
||||
\use:c { groupthm_#1_family:nVVVV }
|
||||
{ ##2 }
|
||||
\l__groupthm_group_clist
|
||||
\l__groupthm_name_tl
|
||||
\l__groupthm_thmtools_clist
|
||||
\l_tmpa_clist
|
||||
}
|
||||
\__groupthm_wrap_multiple_document:nnnn
|
||||
{ new, provide }
|
||||
{ \__groupthm_Declarator: GroupedTheoremFamily }
|
||||
{ s O{} m }
|
||||
{
|
||||
\use:c { groupthm_#1_family:nnn }
|
||||
{ ##2 }
|
||||
{ ##3 }
|
||||
{ ##1 }
|
||||
}
|
||||
\cs_new:Npn \groupthm_add_theorem_to_group:n #1
|
||||
{
|
||||
\bool_if:NTF \l__groupthm_in_family_options_environment_bool
|
||||
{
|
||||
\clist_put_left:Nn \l__groupthm_group_clist { #1 }
|
||||
}
|
||||
{
|
||||
\msg_error:nn { groupthm } { misuse ~ add ~ theorem ~ to ~ group }
|
||||
}
|
||||
}
|
||||
\NewDocumentCommand { \AddTheoremToGroup } { m }
|
||||
{
|
||||
\groupthm_add_theorem_to_group:n { #1 }
|
||||
}
|
||||
\cs_new:Npn \__groupthm_define_family_options:nnnn #1 #2 #3 #4
|
||||
{
|
||||
\DeclareDocumentEnvironment
|
||||
{ #1 }
|
||||
{ #2 }
|
||||
{
|
||||
\clist_clear:N \l__groupthm_group_clist
|
||||
\bool_set_true:N \l__groupthm_in_family_options_environment_bool
|
||||
#3
|
||||
\bool_set_false:N \l__groupthm_in_family_options_environment_bool
|
||||
\clist_put_right:Nn \l__groupthm_group_clist { #4 }
|
||||
\__groupthm_sort_group_names:
|
||||
\cs_if_exist:cTF { __#1__groups_ \clist_use:Nn \l__groupthm_group_clist { _ } }
|
||||
{
|
||||
\begin { __#1__groups_ \clist_use:Nn \l__groupthm_group_clist { _ } }
|
||||
}
|
||||
{
|
||||
\msg_error:nnxx { groupthm } { undefined ~ theorem ~ variant }
|
||||
{ #1 }
|
||||
{ \clist_use:Nnnn \l__groupthm_group_clist { ~ and ~ } {, ~} { , ~ and ~ } }
|
||||
}
|
||||
}
|
||||
{
|
||||
\clist_clear:N \l__groupthm_group_clist
|
||||
\bool_set_true:N \l__groupthm_in_family_options_environment_bool
|
||||
#3
|
||||
\bool_set_false:N \l__groupthm_in_family_options_environment_bool
|
||||
\clist_put_right:Nn \l__groupthm_group_clist { #4 }
|
||||
\__groupthm_sort_group_names:
|
||||
\end { __#1__groups_ \clist_use:Nn \l__groupthm_group_clist { _ } }
|
||||
}
|
||||
}
|
||||
\__groupthm_define_multiple:nnnNNnn
|
||||
{ new, renew, provide, declare }
|
||||
{ theorem ~ family ~ options }
|
||||
{ ##1 }
|
||||
\use_none:n
|
||||
\__groupthm_define_family_options:nnnn
|
||||
{ groupthm_#1_family_options:nnnn }
|
||||
{ { ##1 } { ##2 } { ##3 } { ##4 } }
|
||||
\cs_generate_variant:Nn \groupthm_new_family_options:nnnn { n n n V }
|
||||
\cs_generate_variant:Nn \groupthm_renew_family_options:nnnn { n n n V }
|
||||
\cs_generate_variant:Nn \groupthm_provide_family_options:nnnn { n n n V }
|
||||
\cs_generate_variant:Nn \groupthm_declare_family_options:nnnn { n n n V }
|
||||
\__groupthm_wrap_multiple_document:nnnn
|
||||
{ new, renew, provide, declare }
|
||||
{ \__groupthm_Declarator: GroupedTheoremFamilyOptions }
|
||||
{ s O{} m m m }
|
||||
{
|
||||
\keys_set:nn { groupthm / theorem ~ family ~ options } { starred ~ version }
|
||||
\keys_set:nn { groupthm / theorem ~ family ~ options } { ##2 }
|
||||
\bool_if:nTF { ##1 }
|
||||
{
|
||||
\clist_set:Nn \l_tmpa_clist { unnumbered }
|
||||
}
|
||||
{
|
||||
\clist_clear:N \l_tmpa_clist
|
||||
}
|
||||
\use:c { groupthm_#1_family_options:nnnV }
|
||||
{ ##3 }
|
||||
{ ##4 }
|
||||
{ ##5 }
|
||||
\l_tmpa_clist
|
||||
\bool_if:NT \l__groupthm_starred_version_bool
|
||||
{
|
||||
\use:c { groupthm_#1_family_options:nnnV }
|
||||
{ ##3* }
|
||||
{ ##4 }
|
||||
{
|
||||
##5
|
||||
\groupthm_add_theorem_to_group:n { starred }
|
||||
}
|
||||
\l_tmpa_clist
|
||||
}
|
||||
}
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `groupthm.sty'.
|
145
environments/mkessler-thmstyle.sty
Normal file
145
environments/mkessler-thmstyle.sty
Normal file
|
@ -0,0 +1,145 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Copyright © 2022 Maximilian Keßler
|
||||
%
|
||||
% This work may be distributed and/or modified
|
||||
%
|
||||
% 1. under the LaTeX Project Public License and/or
|
||||
% 2. under the GNU General Public License
|
||||
%
|
||||
% Distribution under conditions of the LaTeX Project Public License,
|
||||
% requires either version 1.3 of this license or (at your option)
|
||||
% any later version.
|
||||
% The latest version of this license is in
|
||||
% http://www.latex-project.org/lppl.txt
|
||||
% and version 1.3 or later is part of all distributions of LaTeX
|
||||
% version 2005/12/01 or later.
|
||||
%
|
||||
% This work has the LPPL maintenance status \`maintained'.
|
||||
%
|
||||
% The Current Maintainer of this work is Maximilian Keßler.
|
||||
%
|
||||
%
|
||||
% Distribution under the GNU General Public License requires either
|
||||
% version 3 or (at your opinion) any later version.
|
||||
%
|
||||
% This package has been generated by PyTeX, available at
|
||||
% https://github.com/kesslermaximilian/PyTeX
|
||||
% and built from source file 'thmstyle.pysty'.
|
||||
% It is STRONGLY DISCOURAGED to edit this source file directly, since local
|
||||
% changes will not be versioned by Git and overwritten by the next build. Always
|
||||
% edit the source file and build the package again.
|
||||
%
|
||||
% Build details:
|
||||
% PyTeX version: v1.2.0-28-ge661cee (commit e661cee)
|
||||
% Source code version: v2.8 (commit 1d48178)
|
||||
%
|
||||
% This LaTeX package is free software and is dual-licensed
|
||||
% under the LPPLv1.3c and the GPLv3 licenses.
|
||||
% You may use it freely for your purposes.
|
||||
% The latest version of the package sources can be obtained
|
||||
% via GitLab under
|
||||
% https://gitlab.com/latexci/packages/LatexPackages
|
||||
% The latest version of the built packages can be obtained via GitLab under
|
||||
% https://gitlab.com/latexci/packages/LatexPackagesBuild
|
||||
% For further information see the urls above.
|
||||
% Reportings of bugs, suggestions and improvements are welcome, see the README
|
||||
% at the Git repository for further information.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{mkessler-thmstyle}[2022/01/24 - Mdframed Styles used for fancythm package]
|
||||
|
||||
|
||||
%%%%% This provides easy-to-use styles, especially for use with the
|
||||
|
||||
\RequirePackage{xkeyval}
|
||||
|
||||
% A simple option wether to define some default styles
|
||||
\newif\ifmkessler@thmstyle@defaultstyles\mkessler@thmstyle@defaultstylesfalse
|
||||
\DeclareOptionX{defaultstyles}{\mkessler@thmstyle@defaultstylestrue}
|
||||
|
||||
\DeclareOptionX*{\PackageWarning{mkessler-thmstyle}{Unknown '\CurrentOption'}}
|
||||
\ProcessOptionsX*\relax
|
||||
|
||||
|
||||
\RequirePackage{amsthm}
|
||||
\RequirePackage{thmtools}
|
||||
\RequirePackage{mdframed}
|
||||
\RequirePackage{xcolor}
|
||||
\RequirePackage{xparse}
|
||||
\definecolor{gold}{RGB}{218,165,32}
|
||||
|
||||
\mdfsetup{skipabove=8pt,skipbelow=\topskip}
|
||||
|
||||
\NewDocumentCommand{\declarefancymdfstyle}{O{} m O{} }{
|
||||
\if\relax\detokenize{#1}\relax
|
||||
\mdfdefinestyle{\if\relax\detokenize{#3}\relax md#2margin\else #3\fi}{%
|
||||
linecolor=#2,
|
||||
linewidth = 2pt,
|
||||
leftmargin = 0cm,
|
||||
rightmargin=0cm,
|
||||
rightline=false,
|
||||
topline=false,
|
||||
bottomline=false
|
||||
}
|
||||
\else
|
||||
\mdfdefinestyle{\if\relax\detokenize{#3}\relax md#2marginand#1fill\else #3\fi}{%
|
||||
linecolor=#2,
|
||||
linewidth = 2pt,
|
||||
leftmargin = 0cm,
|
||||
rightmargin=0cm,
|
||||
backgroundcolor=#1,
|
||||
rightline=false,
|
||||
topline=false,
|
||||
bottomline=false
|
||||
}
|
||||
\fi
|
||||
}
|
||||
|
||||
\NewDocumentCommand{\declarefancythmstyle}{O{} m O{} }{
|
||||
\declarefancymdfstyle[#1]{#2}
|
||||
\if\relax\detokenize{#3}\relax
|
||||
\if\relax\detokenize{#1}\relax
|
||||
\declaretheoremstyle[
|
||||
mdframed={style=
|
||||
\if\relax\detokenize{#1}\relax md#2margin\else md#2marginand#1fill\fi
|
||||
},
|
||||
postheadspace={0.3em},
|
||||
notefont=\mdseries
|
||||
]{thm#2margin}
|
||||
\else
|
||||
\declaretheoremstyle[
|
||||
mdframed={style=
|
||||
\if\relax\detokenize{#1}\relax md#2margin\else md#2marginand#1fill\fi
|
||||
},
|
||||
postheadspace={0.3em},
|
||||
notefont=\mdseries
|
||||
]{thm#2marginand#1fill}
|
||||
\fi
|
||||
\else
|
||||
\declaretheoremstyle[
|
||||
mdframed={style=
|
||||
\if\relax\detokenize{#1}\relax md#2margin\else md#2marginand#1fill\fi
|
||||
},
|
||||
postheadspace={0.3em},
|
||||
notefont=\mdseries
|
||||
]{#3}
|
||||
\fi
|
||||
}
|
||||
|
||||
\ifmkessler@thmstyle@defaultstyles
|
||||
\declarefancythmstyle[red!8]{red}[thmredmarginandfill]
|
||||
\declarefancythmstyle[orange!10]{orange}[thmorangemarginandfill]
|
||||
\declarefancythmstyle[blue!7]{blue}[thmbluemarginandfill]
|
||||
\declarefancythmstyle{green!70!black}[thmgreenmargin]
|
||||
\declarefancythmstyle{gold}[thmgoldmargin]
|
||||
\declarefancythmstyle{yellow!80!orange}[thmyellowmargin]
|
||||
\declarefancythmstyle{gray}[thmgraymargin]
|
||||
\declarefancythmstyle[violet!7]{violet}[thmvioletmarginandfill]
|
||||
\declarefancythmstyle{violet}[thmvioletmargin]
|
||||
\declarefancythmstyle[blue!7]{red}[thmredmarginbluefill]
|
||||
\declarefancythmstyle{red}[thmredmargin]
|
||||
\declarefancythmstyle[blue!7]{orange}[thmorangemarginbluefill]
|
||||
\declarefancythmstyle[violet!20!gray!20]{black}[thmblackmarginandfill]
|
||||
\declarefancythmstyle{black}[thmblackmargin]
|
||||
\fi
|
131
exercises/mkessler-sheet.cls
Normal file
131
exercises/mkessler-sheet.cls
Normal file
|
@ -0,0 +1,131 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Copyright © 2022 Maximilian Keßler
|
||||
%
|
||||
% This work may be distributed and/or modified
|
||||
%
|
||||
% 1. under the LaTeX Project Public License and/or
|
||||
% 2. under the GNU General Public License
|
||||
%
|
||||
% Distribution under conditions of the LaTeX Project Public License,
|
||||
% requires either version 1.3 of this license or (at your option)
|
||||
% any later version.
|
||||
% The latest version of this license is in
|
||||
% http://www.latex-project.org/lppl.txt
|
||||
% and version 1.3 or later is part of all distributions of LaTeX
|
||||
% version 2005/12/01 or later.
|
||||
%
|
||||
% This work has the LPPL maintenance status \`maintained'.
|
||||
%
|
||||
% The Current Maintainer of this work is Maximilian Keßler.
|
||||
%
|
||||
%
|
||||
% Distribution under the GNU General Public License requires either
|
||||
% version 3 or (at your opinion) any later version.
|
||||
%
|
||||
% This class has been generated by PyTeX, available at
|
||||
% https://github.com/kesslermaximilian/PyTeX
|
||||
% and built from source file 'sheet.pycls'.
|
||||
% It is STRONGLY DISCOURAGED to edit this source file directly, since local
|
||||
% changes will not be versioned by Git and overwritten by the next build. Always
|
||||
% edit the source file and build the class again.
|
||||
%
|
||||
% Build details:
|
||||
% PyTeX version: v1.2.0-28-ge661cee (commit e661cee)
|
||||
% Source code version: v2.8 (commit 1d48178)
|
||||
%
|
||||
% This LaTeX class is free software and is dual-licensed
|
||||
% under the LPPLv1.3c and the GPLv3 licenses.
|
||||
% You may use it freely for your purposes.
|
||||
% The latest version of the class sources can be obtained
|
||||
% via GitLab under
|
||||
% https://gitlab.com/latexci/packages/LatexPackages
|
||||
% The latest version of the built packages can be obtained via GitLab under
|
||||
% https://gitlab.com/latexci/packages/LatexPackagesBuild
|
||||
% For further information see the urls above.
|
||||
% Reportings of bugs, suggestions and improvements are welcome, see the README
|
||||
% at the Git repository for further information.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesClass{mkessler-sheet}[2022/01/24 - Write up university exercise sheets]
|
||||
|
||||
|
||||
|
||||
% This is meant as a layouting class for easily writing up exercise sheets.
|
||||
% Use \course \sheetnumber and \author to set metadata of the document
|
||||
% Use option [largename] if the author(s) is/are too long and collide in the fancy header
|
||||
% Use option [german|ngerman|english] to control language appearance
|
||||
|
||||
\RequirePackage{scrbase}
|
||||
|
||||
\newif\ifmkessler@sheet@english\mkessler@sheet@englishtrue
|
||||
\DeclareOption{german}{\mkessler@sheet@englishfalse}
|
||||
\DeclareOption{ngerman}{\mkessler@sheet@englishfalse}
|
||||
\DeclareOption{english}{\mkessler@sheet@englishtrue}
|
||||
|
||||
\newif\ifmkessler@sheet@largename\mkessler@sheet@largenamefalse
|
||||
\DeclareOption{large-name}{\mkessler@sheet@largenametrue}
|
||||
|
||||
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrartcl}}
|
||||
\ProcessOptions\relax
|
||||
|
||||
\LoadClass{scrartcl}
|
||||
|
||||
\KOMAoption{fontsize}{12pt}
|
||||
\KOMAoption{parskip}{half-}
|
||||
\KOMAoption{DIV}{12}
|
||||
\KOMAoption{headings}{normal}
|
||||
|
||||
\RequirePackage{scrlayer-scrpage}
|
||||
\KOMAoption{headsepline}{:}
|
||||
|
||||
\def\@course{\ClassError{mkessler-sheet}{No \noexpand\course given}{Use \noexpand\course{<coursename>} to set the course.}}%
|
||||
\DeclareRobustCommand*{\course}[1]{\gdef\@course{#1}}
|
||||
\def\@sheetnumber{\ClassError{mkessler-sheet}{No \noexpand\sheetnumber given}{Use \noexpand\sheetnumber{<num>} to set the current sheetnumber.}}%
|
||||
\DeclareRobustCommand*{\sheetnumber}[1]{\gdef\@sheetnumber{\ifmkessler@sheet@english Sheet #1 \else Übungsblatt #1\fi}}
|
||||
|
||||
\renewcommand*{\@date}{\today}
|
||||
|
||||
\renewcommand*{\maketitle}{
|
||||
\thispagestyle{plain}
|
||||
{\makebox[0pt][l]{\usekomafont{myauthor}\@author}\hfill\makebox[0pt][r]{\usekomafont{date}\@date}\par}
|
||||
\vspace{0.5em}
|
||||
{\centering\usekomafont{title}\@course\par}
|
||||
{\centering\usekomafont{subtitle}\@sheetnumber \par}
|
||||
\vspace{2em}
|
||||
\hrule
|
||||
\addvspace{2em}
|
||||
}
|
||||
|
||||
\setkomafont{title}{\LARGE\bfseries}
|
||||
\setkomafont{subtitle}{}
|
||||
\newkomafont{myauthor}{}
|
||||
\setkomafont{date}{}
|
||||
\newkomafont{headtitle}{\itshape}
|
||||
\setkomafont{pageheadfoot}{\footnotesize}
|
||||
\setkomafont{descriptionlabel}{\bfseries}
|
||||
\setkomafont{pagenumber}{\normalsize}
|
||||
|
||||
\pagestyle{scrheadings}
|
||||
\ihead[]{\ifmkessler@sheet@largename \usekomafont{myauthor}\@author \\ \@course\;- \@sheetnumber\else \usekomafont{myauthor}\@author\fi }
|
||||
\chead[]{\ifmkessler@sheet@largename \else \usekomafont{subtitle}\@course\;- \@sheetnumber\fi}
|
||||
\ohead[]{\usekomafont{date}\@date}
|
||||
|
||||
% Page layout
|
||||
\setlength{\parindent}{0pt}
|
||||
|
||||
\RequirePackage[a4paper, left=2cm, right=2cm, top=3cm, bottom=3cm, head=15.0pt, headsep=10pt]{geometry}
|
||||
|
||||
\setlength{\skip\footins}{15pt}
|
||||
|
||||
\setlength{\abovecaptionskip}{0cm}
|
||||
\setlength{\belowcaptionskip}{0cm}
|
||||
|
||||
%Für Zeilenabstand 1,5
|
||||
\RequirePackage[onehalfspacing]{setspace}
|
||||
\RequirePackage[super]{nth}
|
||||
|
||||
\newcommand\nr[1]{
|
||||
\section*{\ifmkessler@sheet@english\nth{#1} exercise\else #1. Aufgabe\fi}
|
||||
\setcounter{equation}{0}
|
||||
}
|
162
lecture-notes/mkessler-lectures.sty
Normal file
162
lecture-notes/mkessler-lectures.sty
Normal file
|
@ -0,0 +1,162 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Copyright © 2022 Maximilian Keßler
|
||||
%
|
||||
% This work may be distributed and/or modified
|
||||
%
|
||||
% 1. under the LaTeX Project Public License and/or
|
||||
% 2. under the GNU General Public License
|
||||
%
|
||||
% Distribution under conditions of the LaTeX Project Public License,
|
||||
% requires either version 1.3 of this license or (at your option)
|
||||
% any later version.
|
||||
% The latest version of this license is in
|
||||
% http://www.latex-project.org/lppl.txt
|
||||
% and version 1.3 or later is part of all distributions of LaTeX
|
||||
% version 2005/12/01 or later.
|
||||
%
|
||||
% This work has the LPPL maintenance status \`maintained'.
|
||||
%
|
||||
% The Current Maintainer of this work is Maximilian Keßler.
|
||||
%
|
||||
%
|
||||
% Distribution under the GNU General Public License requires either
|
||||
% version 3 or (at your opinion) any later version.
|
||||
%
|
||||
% This package has been generated by PyTeX, available at
|
||||
% https://github.com/kesslermaximilian/PyTeX
|
||||
% and built from source file 'lectures.pysty'.
|
||||
% It is STRONGLY DISCOURAGED to edit this source file directly, since local
|
||||
% changes will not be versioned by Git and overwritten by the next build. Always
|
||||
% edit the source file and build the package again.
|
||||
%
|
||||
% Build details:
|
||||
% PyTeX version: v1.2.0-28-ge661cee (commit e661cee)
|
||||
% Source code version: v2.8 (commit 1d48178)
|
||||
%
|
||||
% This LaTeX package is free software and is dual-licensed
|
||||
% under the LPPLv1.3c and the GPLv3 licenses.
|
||||
% You may use it freely for your purposes.
|
||||
% The latest version of the package sources can be obtained
|
||||
% via GitLab under
|
||||
% https://gitlab.com/latexci/packages/LatexPackages
|
||||
% The latest version of the built packages can be obtained via GitLab under
|
||||
% https://gitlab.com/latexci/packages/LatexPackagesBuild
|
||||
% For further information see the urls above.
|
||||
% Reportings of bugs, suggestions and improvements are welcome, see the README
|
||||
% at the Git repository for further information.
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{mkessler-lectures}[2022/01/24 - Package for managing different lectures within a document]
|
||||
|
||||
|
||||
% The core of the lecture command this package provides has been taken from the preamble in
|
||||
% https://github.com/gillescastel/university-setup
|
||||
% which is licensed under
|
||||
|
||||
%MIT License
|
||||
|
||||
%Copyright (c) 2019 Gilles Castel
|
||||
|
||||
%Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
%of this software and associated documentation files (the "Software"), to deal
|
||||
%in the Software without restriction, including without limitation the rights
|
||||
%to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
%copies of the Software, and to permit persons to whom the Software is
|
||||
%furnished to do so, subject to the following conditions:
|
||||
%
|
||||
%The above copyright notice and this permission notice shall be included in all
|
||||
%copies or substantial portions of the Software.
|
||||
%
|
||||
%THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
%IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
%FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
%AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
%LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
%OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
%SOFTWARE.
|
||||
% This package extends the lecture command to make a summary of lectures at the beginning of a document, and has thus modified this command.
|
||||
|
||||
\RequirePackage{xkeyval}
|
||||
|
||||
\newif\ifmkessler@lectures@english\mkessler@lectures@englishtrue
|
||||
\DeclareOptionX{german}{\mkessler@lectures@englishfalse}
|
||||
\DeclareOptionX{ngerman}{\mkessler@lectures@englishfalse}
|
||||
\DeclareOptionX{english}{\mkessler@lectures@englishtrue}
|
||||
|
||||
\newif\ifmkessler@lectures@fancyhead\mkessler@lectures@fancyheadfalse
|
||||
\DeclareOptionX{fancyhead}{\mkessler@lectures@fancyheadtrue}
|
||||
|
||||
\DeclareOptionX*{\PackageWarning{mkessler-lectures}{Unknown '\CurrentOption'}}
|
||||
\ProcessOptionsX*\relax
|
||||
|
||||
|
||||
%Tocloft package for making a list of lectures
|
||||
\RequirePackage{tocloft}
|
||||
%Store name of the summary in a command to use it multiple times
|
||||
\newcommand\mkessler@lectures@listlecturename{\ifmkessler@lectures@english Summary of lectures\else Übersicht der Vorlesungen\fi}
|
||||
\newlistof{lecture}{lec}{\mkessler@lectures@listlecturename} % Declare new list of lectures
|
||||
%Settings how to print the summary
|
||||
\renewcommand{\cftdot}{}
|
||||
\renewcommand\cftlecturefont{\normalfont\bfseries}
|
||||
\renewcommand\cftlecturepagefont{\normalfont\bfseries}
|
||||
\renewcommand\cftlectitlefont{\Large\bfseries}
|
||||
\renewcommand\cftbeforelectureskip{1em}
|
||||
|
||||
%Command to parse the date
|
||||
\RequirePackage{xifthen}
|
||||
\def\testdateparts#1{\dateparts#1\relax}
|
||||
\def\dateparts#1 #2 #3 #4 #5\relax{
|
||||
\marginpar{\small\textsf{\mbox{#1 #2 #3 #5}}}
|
||||
}
|
||||
|
||||
%Define the main lecture command to start a new lecture
|
||||
\def\mkessler@lectures@lectureprefix{\ifmkessler@lectures@english Lecture\else Vorlesung\fi}
|
||||
\def\@lecture{}%
|
||||
|
||||
\RequirePackage{xparse}
|
||||
|
||||
% \lecture[keywords]{date}[number]{title}[margin note]
|
||||
\NewDocumentCommand{\lecture}{ O{} m O{} m O{}}{
|
||||
\ifthenelse{\isempty{#3}}{\refstepcounter{lecture}}{\setcounter{lecture}{#3}}
|
||||
%Store lecture name in the macro \@lecture
|
||||
\ifthenelse{\isempty{#4}}{%
|
||||
\def\@lecture{\mkessler@lectures@lectureprefix\, \thelecture}%
|
||||
}{%
|
||||
\def\@lecture{\mkessler@lectures@lectureprefix\, \thelecture: #4}%
|
||||
}%
|
||||
\marginpar{\small\textsf{\parbox{10em}{\mkessler@lectures@lectureprefix\, \thelecture \\#2}}}
|
||||
%Add lecture as an entry to the lectures file
|
||||
\addcontentsline{lec}{lecture}{\mkessler@lectures@lectureprefix\,\thelecture\,(#2)}
|
||||
%If key words are provided, add the key words of the lecture below the entry
|
||||
\ifthenelse{\isempty{#1}}{}{\addtocontents{lec}{\smallskip\hspace{1.5em}\protect\parbox{\dimexpr\textwidth-\@pnumwidth - 2em}{#1}}}
|
||||
}
|
||||
|
||||
%Provide a command to show the summary of lectures
|
||||
\DeclareRobustCommand*{\summaryoflectures}{
|
||||
\phantomsection
|
||||
\addcontentsline{toc}{section}{\mkessler@lectures@listlecturename}
|
||||
\thispagestyle{plain}
|
||||
\listoflecture
|
||||
}
|
||||
|
||||
|
||||
\ifmkessler@lectures@fancyhead
|
||||
\RequirePackage{fancyhdr}
|
||||
\pagestyle{fancy}
|
||||
|
||||
% LE: left even
|
||||
% RO: right odd
|
||||
% CE, CO: center even, center odd
|
||||
|
||||
\fancyhead[RO,LE]{\@lecture} % Right odd, Left even
|
||||
\fancyhead[RE,LO]{} % Right even, Left odd
|
||||
|
||||
%%No fancy headers in the appendix (as there is no lecture)
|
||||
\let\mkessler@lectures@stored@appendix\appendix
|
||||
\renewcommand\appendix{
|
||||
\mkessler@lectures@stored@appendix
|
||||
\fancyhead[RO,LE]{}
|
||||
\renewcommand{\headrulewidth}{0pt}
|
||||
}
|
||||
\fi
|
219
lecture-notes/mkessler-script.cls
Normal file
219
lecture-notes/mkessler-script.cls
Normal file
|
@ -0,0 +1,219 @@
|
|||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Copyright © 2022 Maximilian Keßler
|
||||
%
|
||||
% This work may be distributed and/or modified
|
||||
%
|
||||
% 1. under the LaTeX Project Public License and/or
|
||||
% 2. under the GNU General Public License
|
||||
%
|
||||
% Distribution under conditions of the LaTeX Project Public License,
|
||||
% requires either version 1.3 of this license or (at your option)
|
||||
% any later version.
|
||||
% The latest version of this license is in
|
||||
% http://www.latex-project.org/lppl.txt
|
||||
% and version 1.3 or later is part of all distributions of LaTeX
|
||||
% version 2005/12/01 or later.
|
||||
%
|
||||
% This work has the LPPL maintenance status \`maintained'.
|
||||
%
|
||||
% The Current Maintainer of this work is Maximilian Keßler.
|
||||
%
|
||||
%
|
||||
% Distribution under the GNU General Public License requires either
|
||||
% version 3 or (at your opinion) any later version.
|
||||
%
|
||||
% This class has been generated by PyTeX, available at
|
||||
% https://github.com/kesslermaximilian/PyTeX
|
||||
% and built from source file 'script.pycls'.
|
||||
% It |