TeX - LaTeX Asked on October 19, 2020
Seems with tikz package version 3.1.1 evaluating if
-expressions within tikzmath
leads to attempts of carrying out an undefined control-sequence ifpgfmathfloatparseactive
.
The example
errorcontextlines=10000
documentclass[a4paper]{article}
usepackage{tikz}
usetikzlibrary{math}
begin{document}
makeatletter
showtikz@math@if@@doifelse
showtikz@math@if@@doif
makeatother
defk{3}%
tikzmath{%
if k < 3.14 then {{smaller};} else {{not smaller};};
}
end{document}
delivers the following output to the screen/console:
> tikz@math@if@@doifelse=macro:
->pgfmathparse {tikz@math@if@condition }ifpgfmathfloatparseactive pgfmathfl
oattofixed {pgfmathresult }fi let tikz@math@if@falseaction =tikz@math@coll
ected ifdim pgfmathresult pt=0ptrelax expandafter tikz@math expandafter {
tikz@math@if@falseaction }else expandafter tikz@math expandafter {tikz@ma
th@if@trueaction }fi tikz@math@parse .
l.8 showtikz@math@if@@doifelse
?
> tikz@math@if@@doif=macro:
->pgfmathparse {tikz@math@if@condition }ifpgfmathfloatparseactive pgfmathfl
oattofixed {pgfmathresult }fi ifdim pgfmathresult pt=0ptrelax else expan
dafter tikz@math expandafter {tikz@math@if@trueaction }fi tikz@math@parse
.
l.10 showtikz@math@if@@doif
?
! Undefined control sequence.
tikz@math@if@@doifelse ...gfmathfloatparseactive
pgfmathfloattofixed {pgf...
tikz@math@marshal ...er};} else {{not smaller};};
tikz@math@stop ->
@
tikz@math@semicolon ->
;
l.16 }
?
The error-message after the show
-outputs reveals that a command tikz@math@if@@doifelse
is carried out which triggers complaints about a control-sequence whose name contains the phrase gfmathfloatparseactive
not being defined.
The output of the second show
(showtikz@math@if@@doifelse
) reveals that this must be the control-sequence ifpgfmathfloatparseactive
.
If you manually add a definition for ifpgfmathfloatparseactive
and initialize it to iffalse
, then problems seem to go away:
errorcontextlines=10000
documentclass[a4paper]{article}
usepackage{tikz}
usetikzlibrary{math}
newififpgfmathfloatparseactive
pgfmathfloatparseactivefalse
begin{document}
defk{3}%
tikzmath{%
if k < 3.14 then {{smaller};} else {{not smaller};};
}
end{document}
If you initialize ifpgfmathfloatparseactive
to iftrue
and don’t convert k
to a floating-point-number
errorcontextlines=10000
documentclass[a4paper]{article}
usepackage{tikz}
usetikzlibrary{math}
newififpgfmathfloatparseactive
pgfmathfloatparseactivetrue
begin{document}
defk{3}%
tikzmath{%
if k < 3.14 then {{smaller};} else {{not smaller};};
}
end{document}
, you get
! Package PGF Math Error: Sorry, an internal routine of the floating point unit
got an ill-formatted floating point number `1'. The unreadable part was near '
1'..
See the PGF Math package documentation for explanation.
Type H <return> for immediate help.
...
GenericError ...
If you initialize ifpgfmathfloatparseactive
to iftrue
and do convert k
to a floating-point-number,
errorcontextlines=10000
documentclass[a4paper]{article}
usepackage{tikz}
usetikzlibrary{math}
newififpgfmathfloatparseactive
pgfmathfloatparseactivetrue
begin{document}
defk{3}%
pgfmathfloatparsenumber{k}%
letk=pgfmathresult
pgfmathfloattofixed{k}%
letk=pgfmathresult
tikzmath{%
if k < 3.14 then {{smaller};} else {{not smaller};};
}
end{document}
then you get instead
! Package PGF Math Error: Unknown operator `Y' or `Y3' (in ' 1Y3.0e0]< 3.14 ').
See the PGF Math package documentation for explanation.
Type H <return> for immediate help.
If again you convert to fixed-point
errorcontextlines=10000
documentclass[a4paper]{article}
usepackage{tikz}
usetikzlibrary{math}
newififpgfmathfloatparseactive
pgfmathfloatparseactivetrue
begin{document}
defk{3}%
pgfmathfloatparsenumber{k}%
letk=pgfmathresult
pgfmathfloattofixed{k}%
letk=pgfmathresult
tikzmath{%
if k < 3.14 then {{smaller};} else {{not smaller};};
}
end{document}
, then you get
! Package PGF Math Error: Sorry, an internal routine of the floating point unit
got an ill-formatted floating point number `1'. The unreadable part was near '
1'..
See the PGF Math package documentation for explanation.
Type H <return> for immediate help.
...
GenericError ...
My questions are:
if
-expressions within tikzmath
works out?Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP