4

Consider the following code (which originates from this post):

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{
  hobby,
  shapes.geometric,
  decorations,
  decorations.shapes,
  shapes.geometric,
  patterns
}

% Original code by Paul Gaborit:
% tex.stackexchange.com/questions/72784/arrow-with-two-colors-with-tikz/#72793
\tikzset{
  double path/.style args={#1 colored by #2 and #3}{
    -,line join=round,line cap=rect,
    shorten >=0.1cm,
    shorten <=0.1cm,
    line width=#1,#2,% First path
    postaction={draw,-,#3,line width=(#1)/1.5,  
                shorten <=(#1)/3,shorten >=(#1)/3,
    }% Second path
  }
}

\tikzset{easter decoration 1/.style={
    decorate,
    decoration={
      shape backgrounds,
      shape=star,shape size=7pt,
      shape sep={0.5cm, between center},      
    },
    inner color=yellow,
    outer color=yellow!50!orange,
    draw=red!20!orange,
  }
}

\pgfdeclarepatternformonly{fivepointed stars easter 2}{\pgfpointorigin}{\pgfpoint{10mm}{10mm}}{\pgfqpoint{10mm}{8mm}}%
{
  \pgftransformshift{\pgfqpoint{1mm}{1mm}}
  \pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{162}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{306}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{90}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{234}{1mm}}
  \pgfpathclose%
  \pgfusepath{fill}
}

\tikzset{easter decoration 3/.style={
    draw=green!17!yellow,
    line width=2pt,
    star
  }
}

\pgfdeclarepatternformonly{fivepointed stars easter 3}{\pgfpointorigin}{\pgfpoint{12mm}{12mm}}{\pgfqpoint{12mm}{11mm}}%
{
  \pgftransformshift{\pgfqpoint{1mm}{1mm}}
  \pgfpathmoveto{\pgfqpointpolar{18}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{162}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{306}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{90}{1mm}}
  \pgfpathlineto{\pgfqpointpolar{234}{1mm}}
  \pgfpathclose%
  \pgfusepath{fill}
}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[use Hobby shortcut]
  \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Påskeæg~1};
  % Path clipping.
  \clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
  % Shading.
  \shade[easter bg color=orange,scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) -- cycle;
  % Colored paths.
  \draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.775,0.35) .. (0.735,0.35)  .. (0.65,0.3) .. (0.45,0.4) .. (0.235,0.355) .. (0.225,0.35);
  \draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.9,0.5) .. (0.775,0.55)  .. (0.55,0.5) .. (0.45,0.6) .. (0.235,0.55) .. (0.1,0.5);
  \draw[double path=5pt colored by orange!80!yellow and yellow,scale=-6] (0.9,0.7) .. (0.775,0.75)  .. (0.55,0.7) .. (0.45,0.8) .. (0.235,0.75) .. (0.1,0.7);
  % Stars.
  \draw[easter decoration 1,scale=-6] (0.775,0.25) .. (0.735,0.25)  .. (0.65,0.2) .. (0.45,0.3) .. (0.235,0.255) .. (0.225,0.25);
  \draw[easter decoration 1,scale=-6] (0.9,0.4) .. (0.775,0.45)  .. (0.55,0.4) .. (0.45,0.5) .. (0.235,0.45) .. (0.1,0.4);
  \draw[easter decoration 1,scale=-6] (0.9,0.6) .. (0.775,0.65)  .. (0.55,0.6) .. (0.45,0.7) .. (0.235,0.65) .. (0.1,0.6);
  \draw[easter decoration 1,scale=-6] (0.9,0.8) .. (0.775,0.85)  .. (0.55,0.8) .. (0.45,0.9) .. (0.235,0.85) .. (0.1,0.8);
  % Draw the border again.
  \draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) -- cycle;
\end{tikzpicture}
% Easter Egg 2.
\begin{tikzpicture}[use Hobby shortcut]
  \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Påskeæg~2};
  % Path clipping.
  \clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
  % Shading.
  \draw[easter bg color=blue!65!cyan,scale=-6,postaction={pattern=fivepointed stars easter 2,pattern color=blue}](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
  \begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
   \node[star,scale=2.25,easter star=2bp and 10bp, easter star color=cyan!65!blue] at (0.35,0.75){};
   \node[star,scale=1.5,easter star=-2bp and 15bp, easter star color=cyan!85!blue,rotate=10] at (1.45,1.45){};
   \node[star,scale=1.5,easter star=5bp and 10bp, easter star color=cyan!75!blue,rotate=-10] at (-0.5,1.95){};
   \node[star,scale=1.65,easter star=5bp and 15bp, easter star color=cyan!45!blue,rotate=-5] at (-0.75,-0.85){};
   \node[star,scale=1.7,easter star=5bp and 15bp, easter star color=cyan!37!blue,rotate=-3] at (0,-1.65){};
   \node[star,scale=1.5,easter star=5bp and 10bp, easter star color=cyan!60!blue,rotate=2] at (0.85,-0.65){};
   \node[star,scale=1.75,easter star=-2bp and 2bp, easter star color=cyan!60!blue,rotate=14] at (2,0){};     
  \end{scope}
   % Draw the border again.
   \draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
% Easter Egg 3.
\begin{tikzpicture}[use Hobby shortcut]
  \node[above,xshift=-3.5cm,yshift=-1.5cm] at (0.5,1){Påskeæg~3};
  % Path clipping.
  \clip[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
  % Shading.
  \draw[easter bg color=green!77!blue,scale=-6,postaction={pattern=fivepointed stars easter 3,pattern color=green!20!yellow}](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
  \begin{scope}[transform canvas={shift={(-3.5,-3.5)}}]
   \node[easter decoration 3,scale=2.25] at (0.55,0.65){};
   \node[easter decoration 3,scale=1.5,rotate=10] at (1.45,1.45){};
   \node[easter decoration 3,scale=1.5,rotate=-10] at (-0.5,1.95){};
   \node[easter decoration 3,scale=1.65,rotate=-5] at (-0.75,-0.70){};
   \node[easter decoration 3,scale=1.7,rotate=-3] at (0,-1.65){};
   \node[easter decoration 3,scale=1.5,rotate=2] at (0.85,-0.65){};
   \node[easter decoration 3,scale=1.75,rotate=14] at (2,0){};     
  \end{scope}
  % Draw the border again.
  \draw[scale=-6](0.5,0.1) .. (0.775,0.35) .. (0.5,1) .. (0.225,0.35) .. (0.5,0.1) .. cycle;
\end{tikzpicture}
\end{figure}

\end{document}

The code above used to compile just fine, but now it doesn't anymore; how do I make it compilable again?

P.S. I use an up-to-date TeX Live 2013 distribution.

6
  • This depends on the distribution you have at the moment: if it is TeX Live 2012, then you might have a look to Error message with hobby package (also notice that I used that fix in the answer). With TeXLive 2013 it should be already fixed. Furthermore: just having a test I noticed that the code miss the shading easter bg. :) – Claudio Fiandrino Jul 8 '13 at 18:38
  • @ClaudioFiandrino I use an up-to-date TL2013 distribution; sorry for not mentioning that. Can I make you write an answer with the complete compilable code? – Svend Tveskæg Jul 8 '13 at 18:42
  • Actually, the correct question to link to is tex.stackexchange.com/q/121286/86 since this is also about the .. cycle syntax. In short, on paths with .. cycle then remove the .. cycle and put [closed=true] on one of the coordinates. Then it compiles. – Andrew Stacey Jul 8 '13 at 21:49
  • Oh, and I recommend a more precise title. I almost didn't look at this one. – Andrew Stacey Jul 8 '13 at 21:50
  • @AndrewStacey Okay about the title. If you would be so kind as to write an answer so that I can accept. Furthermore, I don't know TikZ at all and I figure out how to change the code as you described (even though it sounds simpel). – Svend Tveskæg Jul 8 '13 at 22:13

Browse other questions tagged or ask your own question.