From 4f930a03eef78c2ebf00b861223616ec4b93b15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Tue, 11 Jan 2022 21:24:20 +0100 Subject: [PATCH] rename and move symbindex package. remove category specific stuff --- .../symbindex.pysty3} | 55 ++++++------------- 1 file changed, 18 insertions(+), 37 deletions(-) rename src/{math/mathsymbindex.pysty3 => utils/symbindex.pysty3} (71%) diff --git a/src/math/mathsymbindex.pysty3 b/src/utils/symbindex.pysty3 similarity index 71% rename from src/math/mathsymbindex.pysty3 rename to src/utils/symbindex.pysty3 index fb3c753..128f729 100644 --- a/src/math/mathsymbindex.pysty3 +++ b/src/utils/symbindex.pysty3 @@ -1,10 +1,8 @@ __HEADER__(Declaring of math symbols with automatic indexing) \RequirePackage{imakeidx} -\RequirePackage{amsmath} \RequirePackage{xparse} - % Keys used for declaring symbols \keys_define:nn { symbol } { @@ -17,17 +15,20 @@ __HEADER__(Declaring of math symbols with automatic indexing) description .tl_set:N = \l_symbol_description_tl, description .default:n = \c_novalue_tl, group .tl_set:N = \l_symbol_group_tl, - group .default:n = \c_novalue_tl + group .default:n = \c_novalue_tl, + defaultargs .tl_set:N = \l_symbol_defaultargs_tl, + defaultargs .default:n = \c_novalue_tl } -% Core macro not be used publicly directly. Usage: +% Core macro not to be used publicly directly. Usage: % #1 = indexname / group % #2 = symbolname, % #3 = description % #4 = operator to apply (one argument) - can be \use:n for identity % #5 = substitution when called - % #6 = ordering in index -\cs_new_protected:Nn\symbol_define:nnnnnn + % #6 = default appendices to macro in index (e.g. _R) + % #7 = ordering in index +\cs_new_protected:Nn\symbol_define:nnnnnnn { \bool_new:c { used_#2 } \cs_new_protected:cn { symbol_#2: } @@ -37,9 +38,9 @@ __HEADER__(Declaring of math symbols with automatic indexing) { \index[#1] { - #6 + #7 @ - $#4{#5}$ + $#4{#5}#6$ #3 } \bool_gset_true:c { used_#2 } @@ -50,7 +51,7 @@ __HEADER__(Declaring of math symbols with automatic indexing) \use:c { symbol_#2: } } } -\cs_generate_variant:Nn\symbol_define:nnnnnn { V n V V V V } +\cs_generate_variant:Nn\symbol_define:nnnnnnn { V n V V V V V} % Main package interface @@ -62,7 +63,8 @@ __HEADER__(Declaring of math symbols with automatic indexing) formula, ordered, description, - group + group, + defaultargs } \keys_set:nn{ symbol }{#1} \tl_if_eq:NnTF\l_symbol_description_tl{\c_novalue_tl} @@ -80,7 +82,11 @@ __HEADER__(Declaring of math symbols with automatic indexing) { \tl_set:Nn\l_symbol_ordered_tl {#2} } - \symbol_define:VnVVVV + \tl_if_eq:NnT\l_symbol_defaultargs_tl{\c_novalue_tl} + { + \tl_clear:N\l_symbol_defaultargs_tl + } + \symbol_define:VnVVVVV \l_symbol_group_tl { #2 @@ -88,31 +94,6 @@ __HEADER__(Declaring of math symbols with automatic indexing) \l_symbol_description_tl \l_symbol_operator_tl \l_symbol_formula_tl + \l_symbol_defaultargs_tl \l_symbol_ordered_tl } - - -%% Wrapper commands specific for defining categories - -\NewDocumentCommand{\category}{ m } - { - \operatorname{\textbf{#1}} - } - - -\NewDocumentCommand{\DeclareCategory}{ O{} m } - { - \DeclareSymbol[group = categories, #1]{#2} - } - - -\NewDocumentCommand{\DeclareSimpleCategory}{ o m } - { - \IfValueTF{#1} - { - \DeclareCategory[operator = \category, description = #1]{#2} - } - { - \DeclareCategory[operator = \category]{#2} - } - }