# How to debug the “Argument of \XC@definec@lor has an extra }” error in Foreach statement? [duplicate]

First, I draw three nodes each of which has three parts. Everything is OK. The code and the image are as follows.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[]{tikz}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture}[]
\foreach  \placement in {(0,0),(3.5,0),(1.75,2.5)}
\node [rectangle split, rectangle split parts = 3, rounded corners,
draw, inner ysep = 0.2cm, inner xsep = 1.5pt,
rectangle split part fill = {blue!40, lightgray!80, red!40},
rectangle split every empty part={},
rectangle split empty part height = 0pt]
at \placement
{\texttt{Client} \nodepart{two} \nodepart{three} \texttt{Server}};
\end{tikzpicture}
\end{document}


client_server_onenode http://i1.tietuku.com/cf947fb25d21a591.png

Then I want to assign names to the nodes by adding another parameter \name in the \foreach statement.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[]{tikz}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture}[]
\foreach  \name/\placement in {box0/(0,0),box1/(3.5,0), box2/(1.75,2.5)}
\node [rectangle split, rectangle split parts = 3, rounded corners, draw,
inner ysep = 0.2cm, inner xsep = 1.5pt,
rectangle split part fill = {blue!40, lightgray!80, red!40},
rectangle split every empty part={},
rectangle split empty part height = 0pt]
(\name)
at \placement
{\texttt{Client} \nodepart{two} \nodepart{three} \texttt{Server}};
\end{tikzpicture}
\end{document}


This time I get the following errors:

Argument of \XC@definec@lor has an extra }; I've run across a "}" that doesn't seem to match anything.

I am confused about the debug information because I have not added any extra }'s to the code. Any suggestion to handle with this problem?

NOTE: You can find the read-only source code and debug information at ShareLaTex: Foreach with two arguments.

The related post : How do I debug the message “Argument of \XC@definec@lor has an extra }” has been closed without an MWE.

• Usually it is better to protect within braces the set of coordinates, i.e. box0/{(0,0)},...`. – Claudio Fiandrino May 28 '14 at 8:57
• @ClaudioFiandrino Yes, it works! Would you mind posting your comment as an answer? Thanks. – hengxin May 28 '14 at 9:00
• If you don't mind, I would propose to close the question as duplicate of Nested lists in \foreach loop in TikZ where the issue is explained in detail. Do you agree? – Claudio Fiandrino May 28 '14 at 9:08
• @ClaudioFiandrino Oh, I did not find this post when I was searching for solutions. And yes, you are free to close my post as duplication. After all it is the rule of this site. Thank you all the same (for solving my problem and saving my time). – hengxin May 28 '14 at 9:14