I have some problem with the if condition in LateX. Is anyone can tell me why it never print "OK" ?
\def \scaleGraphX{0,20,30,40,50,60,70,80,100}
\foreach \x [count=\xi] in \scaleGraphX{
\if \x = 0
{OK}
\else
{PAS OK}
\fi
}
Normally I should find at least 1 "OK"
CodePudding user response:
You can use \ifnum
for numerical if tests:
\documentclass{article}
\usepackage{pgffor}
\begin{document}
\def\scaleGraphX{0,20,30,40,50,60,70,80,100}
\foreach \x [count=\xi] in \scaleGraphX{
\ifnum\x=0
{OK}
\else
{PAS OK}
\fi
}
\end{document}