0

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

  • 12
    Please post some code showing your efforts so far. Then others can help with the parts that are causing problems. – Ian Thompson Aug 12 '14 at 9:06
  • 4
    related: tex.stackexchange.com/questions/55943/… – jub0bs Aug 12 '14 at 10:00
  • 2
    Also, please choose more informative titles for your questions. At the moment, you have "How to draw this pictures with TikZ?" and "How can I draw these pictures in LaTeX (with TikZ)?", which sounds like it's the same question. – Jake Aug 12 '14 at 14:28
  • 2
    Do you really need to draw with tikZ these images? You could just add this image on a Latex text... I have some experience with tikZ, and that would take you a lot of time if you dont have a lot of experience...! I let you a manual of tikZ thats explains you all about tikZ from the basis... But you will see that what you are asking for its quite complicate... Tikz Manual Buena Suerte! – Gemma Prieto Aguilar Aug 12 '14 at 20:31
  • 2
    Why a -2 as downvote? I thought it was agreed that a -1 would 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
8

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}

Test-Tubes

  • 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 7:46
  • 1
    @AlirezaAlipour You need TikZ v3.00 – percusse Aug 15 '14 at 8:02
  • 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 6: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: pstricks etc.; 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

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.