%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 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 'symbindex.pysty3'. % 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-30-g7542838 (commit 7542838) % Source code version: v2.8.1 (commit e2d4d57) % % 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. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ProvidesExplPackage{mkessler-symbindex}{2022/01/30}{2.8.1}{Declaring of math symbols with automatic indexing} \RequirePackage{imakeidx} \RequirePackage{xparse} % Keys used for declaring symbols \keys_define:nn { symbol } { operator .tl_set:N = \l_symbol_operator_tl, operator .default:n = \use:n, formula .tl_set:N = \l_symbol_formula_tl, formula .default:n = \c_novalue_tl, ordered .tl_set:N = \l_symbol_ordered_tl, ordered .default:n = \c_novalue_tl, 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, defaultargs .tl_set:N = \l_symbol_defaultargs_tl, defaultargs .default:n = \c_novalue_tl } % 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 = 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: } { \bool_if:cF { used_#2 } { \index[#1] { #7 @ $#4{#5}#6$ #3 } \bool_gset_true:c { used_#2 } } #4{#5} } \expandafter\protected\expandafter\gdef\csname#2\endcsname { \use:c { symbol_#2: } } } \cs_generate_variant:Nn\symbol_define:nnnnnnn { V n V V V V V} % Main package interface \NewDocumentCommand{\DeclareSymbol}{ O{} m} { \keys_set:nn{ symbol } { operator, formula, ordered, description, group, defaultargs } \keys_set:nn{ symbol }{#1} \tl_if_eq:NnTF\l_symbol_description_tl{\c_novalue_tl} { \tl_set:Nn\l_symbol_description_tl { \c_empty_tl } } { \tl_put_left:Nn\l_symbol_description_tl { ,\c_space_tl } } \tl_if_eq:NnT\l_symbol_formula_tl{\c_novalue_tl} { \tl_set:Nn\l_symbol_formula_tl {#2} } \tl_if_eq:NnT\l_symbol_ordered_tl{\c_novalue_tl} { \tl_set:Nn\l_symbol_ordered_tl {#2} } \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 } \l_symbol_description_tl \l_symbol_operator_tl \l_symbol_formula_tl \l_symbol_defaultargs_tl \l_symbol_ordered_tl }