0

How do I have to implement the following comparison?

\documentclass{scrartcl}
\usepackage{etoolbox}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
 \pgfmathparse{sin(60)}
 \let\x=\pgfmathresult
 \ifnumgreater{\x}{0}{}{}
\end{tikzpicture}
\end{document}
Jürgen
  • 2,160

1 Answers1

2

\ifnum which is called does only work with whole numbers (no fractions). Therefore you need another test:

\documentclass{scrartcl}
\usepackage{xparse}
\usepackage{tikz}

\ExplSyntaxOn
\NewDocumentCommand { \xifnum } { }
    {
        \fp_compare:nTF
    }
\ExplSyntaxOff

\begin{document}
\begin{tikzpicture}
 \xifnum{sin(60) > 0}{
    \node {x};
 }{
    \node {y};
 }
\end{tikzpicture}
\end{document}
TeXnician
  • 33,589