I am using TeXShop v 2.47 on a MAC (OSX 10.6.8) and trying to learn TikZ; which is very powerful but not the easiest package to get to master. I have been getting very strange behaviour with the \foreach command; in that it works sometimes and then does not, with what looks as identical code. I have tried to track the problem down and get the error in its simplest form; stripping the LaTeX document right down. I have used a simple example from p37 of pgfmanualCVS2012-11-04. Which works fine
\documentclass[11pt, oneside]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[]
\tikz \foreach \x in {1,...,10}
\draw (\x,0) circle (0.4cm);
\end{tikzpicture}
\end{document}
and produces 10 circles as expected. However if I try to edit this it very often fails. If for example I replace the 0 in the {1,...,10} by a 0 [by either highlighting the 0 and typing 0 or by deleting 0 and typing 0] the code fails and I get an error: .\error.tex:6 Package PGF Math Error: Unknown operator '...' or '...@' (in '...') see PGF Math Package documentation. Possibly the TeXShop editor is adding some control characters?
Edit added 12:59 GMT
Here is the failing code. With the TeXShop editor they look identical. However I notice here that the ... spacing looks different? Possibly TexShop is doing something with the ...?
\documentclass[11pt, oneside]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[]
\tikz \foreach \x in {1,…,10}
\draw (\x,0) circle (0.4cm);
\end{tikzpicture}
\end{document}
,...,is important. If you miss say,then it won't work. – Sep 06 '14 at 11:50\tikzin\tikz \foreach \x in {1,...,10}is not needed and wrong, delete it. – Sep 06 '14 at 11:56\tikzis a shorthand for the environment. If it has one command it understands it otherwise it stops in the first occurence of;. So you don't need it if yo uare already inside a TikZ environment. – percusse Sep 06 '14 at 12:33\tikz- this is very helpful. I as still stuck with the very erratic behaviour of,...,with respect to minor edits (or what I think is no change at all!). If I simply enumerate as in{1,2,3,4,5,6,7,8,9,10}there is no problem. – Sean Danaher Sep 06 '14 at 12:54...is not preceded or followed by a comma so it is taken as a literal instruction. See also how sensitive it is to being literally the same http://tex.stackexchange.com/a/114288/3235 – percusse Sep 06 '14 at 12:57