Hi and many thanks in advance!
I'm trying to perfom an \ifthenelse check on an element, which was extracted out of a list using a macro found here. Unfortunately I cannot figure out how to do it: Undefined control sequence is thrown when trying to do the check. Probably expansion is the problem, but this exceeds my knowledge. MWE:
\documentclass{minimal}
\usepackage{ifthen,tikz,xstring}
\usetikzlibrary{calc}
% define check
\newcommand{\checkValue}[1]{\ifthenelse{\equal{#1}{1}}{#1: true}{#1: false}}
% routine to extract list member
\newcommand*{\getListMember}[2]{%
\edef\dotheloop{%
\noexpand\foreach \noexpand\a [count=\noexpand\i] in {#1} {%
\noexpand\IfEq{\noexpand\i}{#2}{\noexpand\a\noexpand\breakforeach}{}%
}}%
\dotheloop
}
\begin{document}
\noindent
\checkValue{0}\\ % works
\checkValue{1}\\ % works
\noindent
\def\theItem{\getListMember{0,1}{1}}%
Member to check: \theItem\\
Do check: %\checkValue{\theItem} % fails: Undefined control sequence.
\end{document}

