I want to draw these pictures with TikZ. But I can not.
Please guide me in this regard.

Asked
Active
Viewed 1,524 times
0
Stefan Kottwitz
- 231,401
1 Answers
11
A modified version of something I did the other day just as a start:
\documentclass[tikz]{standalone}
\usetikzlibrary{calc,decorations.pathmorphing}
\begin{document}
\tikzset{
pics/profdiwb/.style n args={2}{
code={
\path [draw, line cap=round, #1, pic actions] (0,0) arc (180:0:#2/15) coordinate (tiwb1) -- +(0,-#2) coordinate (tiwb2) arc (-180:0:#2/6) coordinate (tiwb3) -- + (0,#2) coordinate (tiwb4) arc (180:0:#2/15);
\coordinate (tiwb5) at ($(tiwb1)!1/3!(tiwb2)$);
\coordinate (tiwb12) at ($(tiwb3)!2/3!(tiwb4)$);
\begin{scope}[fill=#1!50, draw=#1]
\clip (tiwb1) -- (tiwb2) arc (-180:0:#2/6) -- (tiwb4);
\path [fill=#1!50, draw=#1, decoration={snake, amplitude=#2/50}, segment length=#2/5, decorate, pic actions] ($(tiwb2) - (#2/5,#2/5)$) -| ($(tiwb12) + (#2/5,0)$) -- ($(tiwb5) - (#2/5,0)$) -- cycle;
\end{scope}
\path [draw, line cap=round, #1, pic actions] (0,0) arc (180:0:#2/15) coordinate (tiwb1) -- +(0,-#2) coordinate (tiwb2) arc (-180:0:#2/6) coordinate (tiwb3) -- + (0,#2) coordinate (tiwb4) arc (180:0:#2/15);
\path [fill=white, draw=#1, line width=.0075*#2]
($(tiwb1)!3/4!(tiwb3)$) coordinate (tiwb7) circle (.0275*#2)
($(tiwb7)!1/3!(tiwb2)$) coordinate (tiwb8) circle (.02*#2)
($(tiwb4)!5/7!(tiwb2)$) coordinate (tiwb11) circle (.025*#2)
($(tiwb1)!5/6!(tiwb7)$) circle (.03*#2)
($(tiwb2)!1/2!(tiwb4)$) coordinate (tiwb6) circle (.035*#2)
($(tiwb2)!1/2!(tiwb3) + (.025*#2,0)$) coordinate (tiwb9) circle (.015*#2)
($(tiwb9)!1/2!(tiwb8) - (.025*#2,0)$) circle (.0175*#2)
($(tiwb9) - (.01*#2,.075*#2)$) circle (.01*#2)
($(tiwb1)!1/3!(tiwb3)$) coordinate (tiwb10) circle (.04*#2)
($(tiwb1)!1/2!(tiwb4)!1/3!(tiwb6)$) circle (.05*#2)
($(tiwb1)!1/2!(tiwb4)!1/7!(tiwb10)$) circle (.035*#2)
($(tiwb1)!1/2!(tiwb4)!0.001!(tiwb11) + (.05*#2,.05*#2)$) circle (.02*#2)
;
\draw [black, thin, <->] ($(tiwb3) + (2.5pt,0)$) -- ($(tiwb5 -| tiwb4) + (2.5pt,0)$);
}
},
}
\begin{tikzpicture}
\draw pic {profdiwb={magenta}{20pt}};
\draw pic at (15pt,0) {profdiwb={red}{20pt}};
\draw pic at (30pt,0) {profdiwb={orange}{20pt}};
\end{tikzpicture}
\end{document}

cfr
- 198,882
-
Thank you for your answer. I use this code but figure does not appear. I show errors: line 35: Use of \tikz@parabola doesn't match its definition. \draw pi line 36: Use of \tikz@parabola doesn't match its definition. \draw pi line 37: Use of \tikz@parabola doesn't match its definition. \draw pi line 38: Extra }, or forgotten \endgroup. \end{tikzpicture} line 38: Extra }, or forgotten \endgroup. \end{tikzpicture} line 38: Missing \endgroup inserted. \end{tikzpicture} line 38: Missing } inserted. \end{tikzpicture} line 38: Missing \endgroup inserted. \end{tikzpicture} line 38: Missing \endgroup – Alireza Alipour Aug 15 '14 at 07:46
-
1
-
As @percusse says, you need TikZ 3 for this in order to get the support for
pics. – cfr Aug 15 '14 at 14:15 -
Thank you for your answer. I want to draw this pictures with pspicture. I include some packages, for example: \usepackage[pdf]{pstricks}, \usepackage{pstricks-add}, \usepackage{pdftricks}, \usepackage{pst-labo}. Addition, I include some file in my folder that included main.tex. This files are: pst-labo.sty, pst-labo.tex, pst-laboObj.tex and xkeyval.dtx.
MY TeX Live version is 2014 and compile with Xelatex. but figure does not appear.
– Alireza Alipour Aug 17 '14 at 06:19 -
1@AlirezaAlipour You said you wanted to use TikZ in the question! In any case, I don't understand the point of your comment: those packages have nothing to do with TikZ. You need to update to TikZ 3 to use this code. Of course, you could draw the picture with
pspicture(I assume) but that would have nothing to do with any version of TikZ. These are different packages for producing diagrams:pstricksetc.;pgf/tikz;metapost; and so on. They each work differently in terms of environments, commands and so on, and you cannot expect the commands for one to do anything for the others. – cfr Aug 17 '14 at 12:39 -
@AlirezaAlipour If you are using TeX Live 2014, you should have TikZ 3, at least if your installation is up to date. Please update and then run my code again exactly as it is. Also, you shouldn't need to add those files in your working directory even if you are using
pstricksas they are part of the standard distribution, and.dtxis not something you can use directly without processing it to produce the relevant.styand/or.texfiles in any case. – cfr Aug 17 '14 at 12:44
-2as downvote? I thought it was agreed that a-1would suffice to indicate to the OP that her/his question needs improvement and that is why there are comments. – azetina Aug 15 '14 at 14:14