diff options
author | Ian Jauslin <jauslin@ias.edu> | 2018-05-18 22:53:34 +0000 |
---|---|---|
committer | Ian Jauslin <jauslin@ias.edu> | 2018-05-18 22:53:34 +0000 |
commit | 06e19c0db24d4c527f82ed934ecb56228ea0aee8 (patch) | |
tree | ff988087ebcbe1815c1fc2b7cb7faf026c770baa /libs/constants.sty |
Initial commitv0.0
Diffstat (limited to 'libs/constants.sty')
-rw-r--r-- | libs/constants.sty | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libs/constants.sty b/libs/constants.sty new file mode 100644 index 0000000..d15deb5 --- /dev/null +++ b/libs/constants.sty @@ -0,0 +1,32 @@ +%% +%% constants package: +%% automatically numbered constants +%% + +%% TeX format +\NeedsTeXFormat{LaTeX2e}[1995/12/01] + +%% package name +\ProvidesPackage{constants}[2016/11/19] + +%% declare new constant +\def\cst#1#2{% + % check whether the constant was defined + \ifcsname cst@#1@#2\endcsname% + #1_{\csname cst@#1@#2\endcsname}% + \else% + % check whether this character has a counter associated to it + \ifcsname thecst@#1@@count\endcsname% + \else% + \newcounter{cst@#1@@count}% + \fi% + % increment counter + \stepcounter{cst@#1@@count}% + \expandafter\xdef\csname cst@#1@#2\endcsname{\csname thecst@#1@@count\endcsname}#1_{\csname thecst@#1@@count\endcsname}% + \fi +} + + +%% end +\endinput + |