While using the datatool-package I encountered something strange. I have a loop, and each iteration it defines some variables that are later used by the command \DTLforeach from the datatool-package. The command has an optional argument, those are conditions which are different for each iteration and thus need to be declared using a command (instead of copying the table 14 times).
I'll use the package ifthen instead of the datatool-package because it's more commonly used.
\documentclass{article}
\usepackage{ifthen}
\def\One{abc}
\def\Two{cde}
\def\condition{\equal{\One}{\One} \AND \equal{\Two}{\Two}}
\begin{document}
\ifthenelse{\condition}{% if condition returns true
True.
}{% if condition returns false
False.
}
\end{document}
This results in an error:
! Undefined control sequence
<argument> \AND
l.11 \ifthenelse{\condition}
{% if condition returns true
However, it works if you copy-paste the contents of \condition into the first argument of \ifthenelse. Replacing \AND with its lowercase version \and doesn't work either. The error message just gets more complex, but it's still an undefined control sequence.
A possible solution is to define 2 separate conditions. This is however not a preferred way of doing it because the number of conditions is not always limited to 2, I'll not always use \AND, I'd have to iterate through them inside the \ifthenelse (which I don't know if possible), and so on. Also, it would make the code less clear, so if there is a possible way of defining several conditions in one variable that would be great.
(I also tried the \setboolean, but it only accepts the strings true or false and no real conditions)