Skip to content

Commit e01e606

Browse files
committed
do not modify $string when trying eval in PGF math parser
1 parent 0865eee commit e01e606

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/LaTeXML/Package/pgfmath.code.tex.ltxml

+3-3
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,13 @@ sub pgfmathparse {
361361
# \def\e{1260}\pgfmathparse{cos \e/5} to -0.2 - i.e. "cos" binds stronger than "/"
362362
&& ($string !~ /\b(?:a?(sin|cos|tan2?)h?)|bin|add|array|tan|cot|sec|(?:co)?sec|
363363
deg|depth|dim|div|divide|(?:(?:not)?(?:equal|greater|less))|oct|pi|pow|multiply|
364-
rand|scalar|sign|vec|width|hex|frac/x)) { {
364+
rand|scalar|sign|vec|width|hex|frac|ifthenelse|\\/x)) { {
365365
# special case! the ^ in tikz is used for power, but NOT so in perl.
366-
$string =~ s/\^/**/g;
366+
my $perlstring = $string =~ s/\^/**/gr;
367367
local $LaTeXML::IGNORE_ERRORS = 1;
368368
local $@;
369369
no warnings;
370-
$result = eval $string;
370+
$result = eval $perlstring;
371371
if (!$@) {
372372
# need to erase string when perl eval works, to keep it consistent with recdescent
373373
$string = ''; }

0 commit comments

Comments
 (0)