Is there a way to add arithmetic operations to \ifthenelse statements? Here is a minimal (non)example:
\documentclass{amsart} \usepackage{tikz, ifthen} \begin{document} \begin{tikzpicture} \foreach \a in {-6,...,6} { \foreach \b in {-6,...,6} { \ifthenelse{ (\a + \b) < 4 } { \node at ( (\a, \b ) {(\a, \b)}; } {} } } \end{tikzpicture} \end{document} It is not working because \ifthenelse does not allow \a+\b.
Bonus question: Is there a way to e.g. define \c = \a + \b in advance so I can use \c elsewhere, in \ifthenelse and subsequence \draw commands?
EDIT:
Actually what I needed is \a + 1.414*\b < 4 AND \a - 1.414*\b > 0. I thought I could handle the rest once I know how to insert arithmetic operations into \ifthenelse, but apparently it's more complicated than that. Apologies for the mixup and thanks for your help.
\cto\a + \b, just use\pgfmathtruncatemacro{\c}{\a+\b}(or\pgfmathsetmacro{\c}{\a+\b}if you need floating numbers instead of integers).