# [OS X TeX] Trouble with Tikz and Edit -> Experiment...

Herbert Schulz herbs at wideopenwest.com
Fri Mar 11 08:11:50 EST 2016

> On Mar 10, 2016, at 11:36 PM, Don Green Dragon <fergdc at Shaw.ca> wrote:
>
> Hi,
>
> Perhaps this should be sent to a different list, but I’ll try here first. I cannot get the \foreach command to work properly while using Edit -> Experiment….  For example, the code
>
> \begin{tikzpicture}
> \foreach \n in {1,2,3,4,5}
> 	\fill [red] (\n, 0) circle (2pt);
> \end{tikzpicture}
>
> executes properly and shows the expected five red discs whether I typeset from the source file with the Typeset button at the upper-left of the TeXShop window or whether I open «Edit -> Experiment…»  and then hit the Typeset key at lower-right of the «Edit -> Experiment» window.
>
> However, if the code is
>
> \begin{tikzpicture}
> \foreach \n in {1,...,5}
> 	\fill [red] (\n, 0) circle (2pt);
> \end{tikzpicture}
>
> then it typesets properly from TeXShop’s upper-left Typeset button but NOT when the code is typeset from the «Edit -> Experiment…»  window. It certainly would be useful (to me) if it worked properly when working with Edit -> Experiment as I use {tikzpicture} a great deal.
>
> In other words, Edit -> Experiment… requires (it seems) that the list of values’ be explicit not implied. For example,
>
> \foreach \n \in {1,2,3,4,5}
>
> is explicit whereas
>
> \foreach \n  in {1,…,5}
>
> is implicit. I don’t know whether the problem lies with the Tikz code or the coding related to the functioning of Edit -> Experiment….
>
> I have found Edit -> Experiment… to be  amazingly useful. Wonderful! Splendid!
>
>
> don green dragon
> fergdc at shaw.ca

Howdy,

Hmmm... I'm not having a problem. I put

\begin{tikzpicture}
\foreach \n in {1,2,3,4,5}
\fill [red] (\n, 0) circle (2pt);
\end{tikzpicture}

into a document and it typesets fine. I Copy/Paste into the Edit->Experiment… window and press its typeset button and all is fine. I then change the \foreach range to {1,...,5} and press the Edit->Experiment… window's typeset button and all is fine.

I'm using a fully up to date TeX Live 2015 (although that shouldn't matter) and TeXShop 3.61.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)

`