summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/stex/cmath/cmath.sty.ltxml
blob: d972c961de7a9e456e612e5ca48d668736b2dba8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- 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[]{}',
  "<ltx:XMWrap role='ID' xml:id='&cvar_id(#1)'>#2</ltx:XMWrap>",
  requireMath=>1);
# \vnref{<reference>}
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{<function>}{<(const)(,\1)*>}
# @#1(#2)
DefConstructor('\nappa{}{}',
  "<ltx:XMApp>"
    ."<ltx:XMTok meaning='#1' />"
    ."<ltx:XMArg>#2</ltx:XMArg>"
  ."</ltx:XMApp>");

# \@napp@seq{<function>}{start <const>}{end <const>}
# @#1(@sequence(#2,sequencefromto,#3))
DefConstructor('\@napp@seq{}{}{}',
  "<ltx:XMApp>"
  ."<ltx:XMTok meaning='#1' />"
  ."<ltx:XMArg>"
    ."<ltx:XMApp>"
      ."<ltx:XMTok meaning='sequence' />"
      ."<ltx:XMArg>#2</ltx:XMArg>"
      ."<ltx:XMArg><ltx:XMTok meaning='sequencefromto' /></ltx:XMArg>"
      ."<ltx:XMArg>#3</ltx:XMArg>"
    ."</ltx:XMApp>"
  ."</ltx:XMArg>"
  ."</ltx:XMApp>");

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;