# Compilation error when string testing using csvsimple

Consider this minimal working example:

    \documentclass{beamer}
\usepackage{csvsimple,filecontents}

\begin{document}

\begin{filecontents*}{data.csv}
id,type
1,a
2,b
\end{filecontents*}

\begin{frame}
\csvreader{data.csv}{1=\id,2=\type}{
\ifcsvstrcmp{\type}{a}{
%do something
}{
%do something else
}
}
\end{frame}

\end{document}


The above code does not compile unless the \ifcsvstrcmp{}{}{}{} is commented out.

Here's the error message:

pdflatex> ! Undefined control sequence.
pdflatex> \csv@@body -> \ifcsvstrcmp
pdflatex> --------------------------------------{\type }{a}{}{}
pdflatex> l.14 }

Appreciating any hints on what I might be doing wrong here...

Thx!

• I do not get an error message.. May 22 '19 at 9:53
• @steven Thanks for the info. What is your TeX version? I am using pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016/W32TeX). May 22 '19 at 10:20
• I have 3.14159265-2.6-1.40.19, though I more strongly suspect it may be a package date that is the issue. May 22 '19 at 10:24
• @steven Bullseye! The above code compiles after I did a tlmgr update --all. So, cause was presumably an outdated csvsimple package. Feel free to copy your comment into an answer, and I'll accept it. Thanks a bunch! May 22 '19 at 12:02

## 1 Answer

Debugging can be difficult. Often, the problem isn't a bug, but the user misunderstanding the macro's syntax or limitations. Often, it is just a simple typo on your input, misspelling a macro name or mismatching your braces. As KJO noted, a really annoying problem is when non-printing characters slip into your input. These can be maddening to find and eliminate.

When all those avenues come up dry, another avenue to check is whether your packages are out of date or mismatched with each other. This is what I suggested to the OP by way of comment.

Upon updating all of his packages, the problem went away, therefore confirming that an outdated package was the source of the issue.