# -*- CPERL -*-
package LaTeXML::Package::Pool;
use strict;
use LaTeXML::Package;
# return: unique ID for variable
sub cvar_id {
my ($id) = @_;
$id = ToString($id);
if (!$id) {
$id=LookupValue('cvar_id') || 0;
AssignValue('cvar_id', $id + 1, 'global'); }
"cvar.$id"; }#$
DefConstructor('\vname[]{}',
"#2",
requireMath=>1);
# \vnref{}
DefMacro('\vnref{}','\@XMRef{cvar.#1}');
# variants for declaring variables
DefMacro('\uivar[]{}{}', '\vname[#1]{{#2}^{#3}}');
DefMacro('\livar[]{}{}', '\vname[#1]{{#2}_{#3}}');
DefMacro('\ulivar[]{}{}{}', '\vname[#1]{{#2}^{#3}_{#4}}');
DefMacro('\primvar[]{}', '\vname[#1]{#2^\prime}');
DefMacro('\pprimvar[]{}', '\vname[#1]{#2^{\prime\prime}}');
# \nappa{}{<(const)(,\1)*>}
# @#1(#2)
DefConstructor('\nappa{}{}',
""
.""
."#2"
."");
# \@napp@seq{}{start }{end }
# @#1(@sequence(#2,sequencefromto,#3))
DefConstructor('\@napp@seq{}{}{}',
""
.""
.""
.""
.""
."#2"
.""
."#3"
.""
.""
."");
DefMacro('\nappe{}{}{}', '\@napp@seq{#1}{#2}{#3}');
DefMacro('\nappf{}{}{}{}', '\@napp@seq{#1}{#2{#3}}{#2{#4}}');
DefMacro('\nappli{}{}{}{}', '\@napp@seq{#1}{#2_{#3}}{#2_{#4}}');
DefMacro('\nappui{}{}{}{}', '\@napp@seq{#1}{#2^{#3}}{#2^{#4}}');
1;