# getting error while compiling and shading challenge

I have the following concerns:

1- I drew two pictures and I need them to be underneath each other. the first one presenting a Hass diagram and the second one a line poset. when I put them in a separate file, everything works well but not working once I combined them. Could you please advise me?

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{mynode/.style={draw,circle,inner sep=2pt,outer sep=2pt}
}

\begin{document}
\begin{center}
\begin{tikzpicture}

\node [mynode,label=above:u] (u) at (0,0) {};
\node [mynode,below left  = of u,label=left:e] (e)  {};
\node [mynode,below right = of u,label=right:f] (f) {};
\node [mynode,below right = of e,label=below:d] (d) {};
\node [mynode,above right = of u,label=right:r] (r) {};
\node [mynode,above left = of e,label=left:m] (m) {};
\node [mynode,below left = of e,label=left:n] (n) {};
\node [mynode,above right = of m,label=left:s] (s) {};
\node [mynode,above right = of s,label=left:w] (w) {};

\draw (u) -- (e)
(u) -- (f)
(e) -- (d)
(f) -- (d)
(r) -- (u)
(m) -- (e)
(e) -- (n)
(m) -- (s)
(w) -- (s)
(w) -- (r)
(s) -- (u);

\end{tikzpicture}
\end{center}

\definecolor{zzttqq}{rgb}{0.6,0.2,0.}
\definecolor{qqqqtt}{rgb}{0.,0.,0.2}
\begin{figure}[ht]

\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm,scale=1.3]
\draw(0.,0.) circle (0.2cm);
\draw(0.,1.3) circle (0.2cm);
\draw(0.,2.6) circle (0.2cm);
\draw(0.,4) circle (0.2cm);
\draw (0.,3.6)-- (0.,3.0)[dotted];
\draw (0.,2.4)-- (0.,1.5);
\draw (0.,1.1)-- (0.,0.2);
\draw (-1.6,5.7) node[anchor=north west] {$J_{(n)}$};
\draw (-1.6,4.4) node[anchor=north west] {$J_{(k)}$};
\draw (-1.6,3.) node[anchor=north west] {$J_{(2)}$};
\draw (-1.6,1.7) node[anchor=north west] {$J_{(1)}$};
\draw (-1.3,0.3) node[anchor=north west] {$J_{0}$};
\draw(0.,5.4) circle (0.2cm);
\draw (0.,5.0)-- (0.,4.4)[dotted];
\end{tikzpicture}
\end{figure}
\end{document}


• >=triangle 45 option is not working for me. – hpekristiansen Jul 3 '18 at 7:56

As mentioned by @hpekristiansen in the comments, the triangle 45 arrow tip is the cause of the compilation error. The tip is unknown because you do not include the arrows library. For your other problem I 'streamlined' your code a bit and added some patterned \filldraws. I assumed that the figures had to be centered below each other, if the lower figure must be aligned with the d node of the top figure, please let me know.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{positioning,arrows,patterns}
\tikzset{
mynode/.style={draw,circle,inner sep=2pt,outer sep=2pt,fill=white}
}

\definecolor{zzttqq}{rgb}{0.6,0.2,0.}
\definecolor{qqqqtt}{rgb}{0.,0.,0.2}

\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}

\node [mynode,label=above:u] (u) at (0,0) {};
\node [mynode,below left  = of u,label=below:e] (e)  {};
\node [mynode,below right = of u,label=right:f] (f) {};
\node [mynode,below right = of e,label=below:d] (d) {};
\node [mynode,above right = of u,label=right:r] (r) {};
\node [mynode,above left = of e,label=left:m] (m) {};
\node [mynode,below left = of e,label=left:n] (n) {};
\node [mynode,above right = of m,label=left:s] (s) {};
\node [mynode,above right = of s,label=left:w] (w) {};

\draw (u) -- (e)
(u) -- (f)
(e) -- (d)
(f) -- (d)
(r) -- (u)
(m) -- (e)
(e) -- (n)
(m) -- (s)
(w) -- (s)
(w) -- (r)
(s) -- (u);

\begin{scope}[shift={(e)}]
%\filldraw[domain=-45:45,pattern=crosshatch dots,pattern color=gray] plot ({\x/10},{14*(-cos(\x)+1)});
\filldraw[pattern=crosshatch dots,pattern color=gray] (-3.5,4) to[in=180,out=280] (0,0) to[in=260,out=0] (3.5,4);
\end{scope}

\end{tikzpicture}

\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,mycircle/.style={draw,circle,minimum size=5.2mm}]
\begin{scope}[scale=1.69]

\filldraw[pattern = crosshatch dots,pattern color=gray] (-0.75,5.5) -- (-0.75,3) arc (180:360:0.75) -- (0.75,5.5);
\filldraw[pattern = crosshatch dots,pattern color=gray] (-0.75,-0.5) -- (-0.75,1) arc (180:0:0.75) -- (0.75,-0.5);

\node[mycircle,label=left:$$J_{0}$$,label={[label distance=1cm]right:my additional label}] (J0) at (0,0) {};
\node[mycircle,label=left:$$J_{(1)}$$] (J1) at (0,1) {};
\node[mycircle,label=left:$$J_{(2)}$$] (J2) at (0,3) {};
\node[mycircle,label=left:$$J_{(k)}$$] (Jk) at (0,4) {};
\node[mycircle,label=left:$$J_{(n)}$$] (Jn) at (0,5) {};

\begin{scope}[shorten <=2mm,shorten >=2mm,dotted]
\draw (Jn) -- (Jk);
\draw (Jk) -- (J2);
\end{scope}
\draw (J0) -- (J1);
\draw (J1) -- (J2);

\end{scope}
\end{tikzpicture}
\end{figure}
\end{document}


Which results in

## Update:

Slightly decreased the size of the top figure pattern area and added an additional label to J0, as per requested in the comments.

• That is amazing. Thanks a lot Max you really made my day. In the case I want to add a small text right to J_{0} but out of the shading area what should I do? – Mal JA Jul 3 '18 at 8:24
• Got it thanks. Forgive me! One last question. How can I tie the first shaded area? make it a little bit smaller? – Mal JA Jul 3 '18 at 8:50
• See the edit :) – Max Jul 3 '18 at 9:03