I was trying to implement this method (How to import ASCII coordinates to TikZ) to import coordinates and draw them, but I am having this problem
Undefined control sequence \end{tikzpicture}
Extra }, or forgotten \endgroup \end{tikzpicture}
Extra \endgroup \end{tikzpicture}
Extra \endgroup \end{tikzpicture}
Too many }'s \end{tikzpicture}
Extra \endgroup \end{tikzpicture}
\begin{document} ended by \end{tikzpicture}. \end{tikzpicture}
Extra \endgroup \end{tikzpicture}
Too many }'s \end{tikzpicture}
Extra \fi \end{tikzpicture}
My code is simply
\documentclass{book}
\usepackage{tikz}
%Defining loops for tikz
\def\myloop#1#2#3\repeat{\def\filenm{#2}\def\body{#1#2#3}\iterate}
\def\iterate{\body\ifeof\filenm\let\next\relax\else\let\next\iterate\fi\next}
\usepackage{pgfplots}
\usetikzlibrary{shapes,arrows, calc}
\usepgfplotslibrary{external}
\tikzexternalize[prefix=tikz/]
\pgfplotsset{compat=1.9}
\begin{document}
\newread\bar
\openin\bar=borrar.tex
\begin{tikzpicture}
\myloop\read\bar to\res\shade[ball color=blue]\res;\repeat
\end{tikzpicture}
\end{document}
It works whenever I do not include the package pgfplots
, but I need this package for some plots. Is there any other way to make it work? Thanks in advance.
Edit:
sorry I forgot to include this. File borrar.tex is just the coordinates for two lines
(0.000000,0.000000) -- (0.000000,2.000000)
(0.000000,0.000000) -- (2.000000,2.000000)
Error in the logfile
\bar=\read2
! Undefined control sequence.
\endtikzpicture ...r@layerlist@globally \endscope
\let \pgf@baseline =\pgf@s...
l.17 \end{tikzpicture}
\endscope
. Another thing: we don't haveborrar.tex
and can't guess its contents.\readline
instead of\read
.