Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to compile a picture with the following formula in the label

\begin{tikzpicture}
\node[label=left:$f_{23}(r(x_2,\tau)) $] (F012) at (0,2) {};
\end{tikzpicture}

However, every time I put a comma inside the formula, TeX writes me an error message:

Missing \endcsname inserted.
<to be read again>
\tau
l.207 \node[label=left:$f_{23}(r(x_2,\tau)) $]

I understand that this comma violates some internal rule of tikz, but how can I overcome this problem?

share|improve this question
4  
Have you tried enclosing it with braces? \node[label=left:{$f_{23}(r(x_2,\tau)) $}] –  cgnieder Jul 29 '12 at 9:14
add comment

1 Answer

up vote 14 down vote accepted

Almost everywhere in tikz where commas are part of a value, you must enclose that value in braces. The following should work:

\begin{tikzpicture}
\node[label=left:{$f_{23}(r(x_2,\tau)) $}] (F012) at (0,2) {};
\end{tikzpicture}

You can find it in the section »Setting Keys« of chapter V (Utilities) in the pgfmanual (emphasis added):

\pgfkeys{ key list }
The key list should be a list of key–value pairs, separated by commas. A key–value pair can have the following two forms: key = value or just key . Any spaces around the key or around the value are removed. It is permissible to surround both the key or the value in curly braces, which are also removed. Especially putting the value in curly braces needs to be done quite often, namely whenever the value contains an equal-sign or a comma.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.