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 draw some repeated with PGF/Tikz, and I'm using a foreach. Problem: each line has, on the right, a description, which is a string of text - which may be somewhat long and contain commas or math expressions.

How can I create a list of strings, iterating over it and use each string as node text?

share|improve this question
1  
Welcome to TeX.SE. It is always best to compose a MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. This will also help to clarify the question. –  Peter Grill Nov 16 '11 at 18:15
2  
Without a MWE, all I suggest is enclosing the strings within a curly braces: {} –  Peter Grill Nov 16 '11 at 18:16
    
Thanks for the reply... Actually the curly braces was exactly what I was looking for! - Sorry, but using LyX I'm pretty untrained about LaTeX. –  AkiRoss Nov 16 '11 at 18:17
add comment

1 Answer 1

up vote 4 down vote accepted

To solve this problem was sufficient to use curly braces around the strings, as Peter Grill suggested:

\begin{tikzpicture}
    \foreach \c [count=\x from 0] in {{a,f},{b,o},{c,o},{d,b},{e,a},{f,r}} 
        \node at (0,\x) {\c};
\end{tikzpicture}

Thanks Peter!

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.