4

My minimal working example is as follows.

\documentclass{article}

\usepackage{xcolor}
\usepackage{tikz}
\usepackage{graphicx}
\usepackage{pgfplots}
\usetikzlibrary{spy}
%\usepackage[font=normal,caption=false]{subfig}
%\usepackage{float}
\usetikzlibrary{lindenmayersystems}
\usetikzlibrary[shadings]

\pgfplotsset{compat=1.11}
\definecolor{bblue}{HTML}{4F81BD}
\definecolor{rred}{HTML}{C0504D}
\definecolor{ggreen}{HTML}{9BBB59}
\definecolor{ppurple}{HTML}{9F4C7C}

\begin{document}

\pgfdeclarelindenmayersystem{Koch curve}{
  \rule{F -> F-F++F-F}}
\pgfdeclarelindenmayersystem{Sierpinski triangle}{
  \rule{F -> G-F-G}
  \rule{G -> F+G+F}}
\pgfdeclarelindenmayersystem{Fractal plant}{
  \rule{X -> F-[[X]+X]+F[+FX]-X}
  \rule{F -> FF}}
\pgfdeclarelindenmayersystem{Hilbert curve}{
  \rule{L -> +RF-LFL-FR+}
  \rule{R -> -LF+RFR+FL-}}

\resizebox{\textwidth}{!}{
\begin{tabular}{cccc}

\begin{tikzpicture}[spy using outlines={circle,yellow,magnification=2,size=4cm, connect spies}]
 \draw [green!50!black, rotate=90]
    [l-system={Fractal plant, axiom=X, order=6, step=2pt, angle=25}]
    lindenmayer system;
    \spy on (2.4,8) in node [right] at (2,1.25);
\end{tikzpicture}
&
\begin{tikzpicture}[spy using outlines={circle,black,magnification=2,size=4.5cm, connect spies}]
    \shadedraw [bottom color=white, top color=red!80, draw=red!80!black]
    [l-system={Hilbert curve, axiom=L, order=5, step=8pt, angle=90}]
    lindenmayer system;
    \spy on (5.9,1.3) in node [right] at (9,7);
\end{tikzpicture}

\\
\\

\begin{tikzpicture}[spy using outlines={circle,black,magnification=3.5,size=4.5cm, connect spies}]
\shadedraw [top color=white, bottom color=blue!80, draw=blue!80!black]
[l-system={Sierpinski triangle, step=2pt, angle=60, axiom=F, order=8}]
lindenmayer system -- cycle;
\spy on (5.7,1.3) in node [right] at (6,6);
\end{tikzpicture}
&

\begin{tikzpicture}
\shadedraw[shading=color wheel][spy using outlines={circle,black,magnification=3.5,size=4.5cm, connect spies}]
[l-system={Koch curve, step=2pt, angle=60, axiom=F++F++F, order=4}]
lindenmayer system -- cycle;
\spy on (4,6) in node [left] at (1,7);
\end{tikzpicture}

 \end{tabular}}
\end{document} 

The error I am getting is as follows.

! Undefined control sequence.
<argument> ...] lindenmayer system -- cycle; \spy 
                                                  on (4,6) in node [left] at...
l.68  \end{tabular}}

? 
Missing character: There is no o in font nullfont!
Missing character: There is no n in font nullfont!
Missing character: There is no ( in font nullfont!
Missing character: There is no 4 in font nullfont!
  • Could you please minimize the code as much as possible! I am getting an undefined control sequence \end{tabular} here. – LaRiFaRi Apr 17 '15 at 7:42
  • The error can at least be reduced to just the last of your four tikzpictures, though i can't see yet why that does not work. The others produce nice spies here. Please reduce your MWE. You could of course provide a spythat works - and the last one that does not; though - interestingly - i can't figure out why. – Ronny Apr 17 '15 at 8:01
3

enter image description here

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{spy,decorations.fractals}
\usetikzlibrary{lindenmayersystems}
\usetikzlibrary{shadings}

\pgfdeclarelindenmayersystem{Koch curve}{
  \rule{F -> F-F++F-F}}
\pgfdeclarelindenmayersystem{Sierpinski triangle}{
  \rule{F -> G-F-G}
  \rule{G -> F+G+F}}
\pgfdeclarelindenmayersystem{Fractal plant}{
  \rule{X -> F-[[X]+X]+F[+FX]-X}
  \rule{F -> FF}}
\pgfdeclarelindenmayersystem{Hilbert curve}{
  \rule{L -> +RF-LFL-FR+}
  \rule{R -> -LF+RFR+FL-}}
\begin{document}

\resizebox{\textwidth}{!}{\begin{tabular}{cccc}

\begin{tikzpicture}[spy using outlines={circle,yellow,magnification=2,size=4cm, connect spies}]
 \draw [green!50!black, rotate=90]
    [l-system={Fractal plant, axiom=X, order=6, step=2pt, angle=25}]
    lindenmayer system;
    \spy on (2.4,8) in node [right] at (2,1.25);
\end{tikzpicture}
&
\begin{tikzpicture}[spy using outlines={circle,black,magnification=2,size=4.5cm, connect spies}]
    \shadedraw [bottom color=white, top color=red!80, draw=red!80!black]
    [l-system={Hilbert curve, axiom=L, order=5, step=8pt, angle=90}]
    lindenmayer system;
    \spy on (5.9,1.3) in node [right] at (9,7);
\end{tikzpicture}

\\
\\

\begin{tikzpicture}[spy using outlines={circle,black,magnification=3.5,size=4.5cm, connect spies}]
\shadedraw [top color=white, bottom color=blue!80, draw=blue!80!black]
[l-system={Sierpinski triangle, step=2pt, angle=60, axiom=F, order=8}]
lindenmayer system -- cycle;
\spy on (5.7,1.3) in node [right] at (6,6);
\end{tikzpicture}
&

\begin{tikzpicture}[
  spy using outlines={circle,black,magnification=3.5,size=4.5cm, connect spies}]
\shadedraw[shading=color wheel]
[l-system={Koch curve, step=2pt, angle=60, axiom=F++F++F, order=4}]
lindenmayer system -- cycle;
\spy on (4,6) in node [left] at (1,7);
\end{tikzpicture}

\end{tabular}}



\end{document} 
2

For me, your compat=1.11 did not work (MacTeX 2015), but nevertheless If you look at your last tikzpicture you accidentally put the spy-introduction needed for the spy command after your shadedraw. Changing these yields

\begin{tikzpicture}[spy using outlines={circle,black,magnification=3.5,size=4.5cm, connect spies}]
\shadedraw[shading=color wheel]
[l-system={Koch curve, step=2pt, angle=60, axiom=F++F++F, order=4}]
lindenmayer system -- cycle;
\spy on (4,6) in node [left] at (1,7);
\end{tikzpicture}

which compiles on my side (nevertheless, the spy is off and just magnifies white).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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