I'm trying to test whether an element in a defined list (array) is "empty." I tried using the \empty macro, or putting white spaces inside the quote, but nothing seems to work. I'm testing the emptiness of each element using the etoolbox \ifboolexpr construct with test (also, I tested \notblank with the same results), although I'm not sure if the fault lies in the conditional evaluation or in the \pgfmathparse that retrieves the element from the array.
Thus, what is the correct way of checking if the element is empty and branching into the else part of the conditional.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{etoolbox}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\def\n{5}
\def\weights{{"1","2","3","4","","n"}}
\foreach \i [count=\c] in {0,...,\n}{
\pgfmathparse{\weights[\i]} \let\label\pgfmathresult
\ifboolexpr{ not test{\ifstrempty{\label}} }{%
\node at (0,\c) {$l_{\label}$};
}{ %
\node at (0,\c) {empty};
}
}
\end{tikzpicture}
\end{document}


\weights(I don't know the name of that thing) I read that you have to put in quotes the elements that are not numbers, that's the reason for the quotes in the definition. Then, I need to define empty elements, and treat them differently. – adn Jan 03 '13 at 06:41xstringIfStrEqworks to test whether the element is empty or not. – adn Jan 03 '13 at 07:37