File: pgfmathcalc.code.tex.ltxml

package info (click to toggle)
latexml 0.8.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 29,128 kB
  • sloc: xml: 98,982; perl: 29,706; sh: 179; javascript: 28; makefile: 15
file content (35 lines) | stat: -rw-r--r-- 1,587 bytes parent folder | download | duplicates (3)
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
# -*- mode: Perl -*-
# /=====================================================================\ #
# |  pgfmathcalc.code.tex                                               | #
# | Implementation for LaTeXML                                          | #
# |---------------------------------------------------------------------| #
# | Part of LaTeXML:                                                    | #
# |  Public domain software, produced as part of work done by the       | #
# |  United States Government & not subject to copyright in the US.     | #
# |---------------------------------------------------------------------| #
# | Bruce Miller <bruce.miller@nist.gov>                        #_#     | #
# | http://dlmf.nist.gov/LaTeXML/                              (o o)    | #
# \=========================================================ooo==U==ooo=/ #
package LaTeXML::Package::Pool;
use strict;
use warnings;
use LaTeXML::Package;

#======================================================================
# Load pgf's TeX code for math, first
InputDefinitions('pgfmathcalc.code', type => 'tex', noltxml => 1);

# \pgfmathsetmacro
# \edef#1 as the result of evaluating #2.
DefPrimitive('\pgfmathsetmacro{}{}', sub {
    my ($stomach, $cs, $expression) = @_;
    $stomach->begingroup;
    my $parse_result = Tokens(Explode(pgfmathparse($stomach->getGullet, $expression)));
    $stomach->endgroup;
    # We can simply endgroup immediately,
    # Perl can jump around the trick of \pgfmath@smuggleone{#1}
    DefMacroI($cs, undef, $parse_result, scope => 'local');
    return; });

1;