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"
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}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With