7

I am a beginner in this. I am trying to prepare some exercises to my students in Latex. My main problem is the use of Tikz. In this case, I am trying to draw the icon of a man/woman running. I attach the picture of one quite simple.

Can you help me? Is there any way of converting a picture in other format to Tikz code?

enter image description here

  • 4
    Welcome to TeX.SE! Do you know you can simply include an image as node text? – CarLaTeX Nov 18 '18 at 9:26
  • Sorry , I do not know. How can I do this? – Eduardo Nov 18 '18 at 9:35
  • 1
    In your tikzpicture: \node {\includegraphics{your-image}};. – CarLaTeX Nov 18 '18 at 9:39
  • 1
    Is this question about Tikz or pstricks, can you please clarify and either adjust the tags or the body of the question? – Polygnome Nov 18 '18 at 17:23
  • 1
    @Polygnome the question was about Tikz. pstricks was not added by OP. – Schism Nov 19 '18 at 9:31
28

An attempt with tikz rectangles.

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \tikzstyle{body}= [fill=black,rounded corners=14pt]
    \draw[body,rotate around={35:(1.2,0)}] (1.2,0) rectangle ++(3.5,1) ;
    \draw[body,rotate around={75:(3.8,2)}] (3.8,2) rectangle ++(3,1) ;
    \draw[body,rotate around={-90:(6.25,6)},rounded corners=10pt] (6.25,6) rectangle ++(2,0.7) ;
    \draw[body,rotate around={-30:(6.2,4.2)},rounded corners=10pt] (6.2,4.2) rectangle ++(2.5,0.7) ;
    \draw[body,rotate around={7:(2.2,1.7)},draw=white,line width=4pt] (2.2,1.7) rectangle ++(3.7,1);
    \draw[body,rotate around={-52:(3.1,4.7)},draw=white,line width=2pt] (3.1,4.7) rectangle ++(3.5,1);
    \draw[body,rotate around={7:(2.2,1.7)}] (2.2,1.7) rectangle ++(3.7,1);
    \draw[body,rotate around={25:(3.7,3.7)},rounded corners=24pt] (3.7,3.7) rectangle ++(3.9,1.7);
    \draw[body,rotate around={145:(6.7,5.8)},rounded corners=10pt,draw=white,line width=2pt] (6.7,5.8) rectangle ++(2.3,0.7) ;
    \draw[body,rotate around={190:(5,7.1)},rounded corners=10pt] (5,7.1) rectangle ++(2.5,0.7);
    \draw[body] (8.2,6) circle (1cm);

    \draw[line width=2pt] (4.8,1) -- ++(2,0);
    \draw[line width=2pt] (6,1.3) -- ++(1.6,0);
    \draw[line width=2pt] (5.6,0.7) -- ++(1.6,0);

    \draw[line width=2pt] (0.5,5) -- ++(2,0);
    \draw[line width=2pt] (1.2,5.3) -- ++(1.6,0);
    \draw[line width=2pt] (1.1,4.7) -- ++(1.6,0);
\end{tikzpicture}
\end{document}

EDIT:

In order to properly scale this picture, use [transform canvas={scale=0.2}] with tikzpicture or scope. Read this answer also:Correctly scaling a tikzpicture.

  • 6
    Should be the accepted answer. The other answers use pstricks, while the question was about TikZ. – clocktown Nov 18 '18 at 12:36
  • 2
    @clocktown: That is a problem with the questian but but not with the answers. And what answer will be accepted is a decision of the one who asked! – user2478 Nov 18 '18 at 14:38
  • 1
    @Herbert you are right, however, I get the impression that the person asking the question really is a beginner, so he might not actually realise the difference. That is why I am writing this. He may not look back, and maybe he does know that it is not TikZ, but just in case he didn't know and comes back here, my comments could clear it up. – clocktown Nov 18 '18 at 16:29
  • 4
    (+1) I like this one best too! It is the only one farting to increase speed. ;) – mickep Nov 18 '18 at 18:11
  • 3
    @nidhin There is indeed the [pstricks] tag in the question, but if you see this edit you will notice that the tag is not tagged by the questian. At first the question is "Man running icon in Tikz"! So your answer is the best of course! (and I don't know why the edit is approved) – user156344 Nov 19 '18 at 7:28
11
\documentclass[pstricks,border=12pt]{standalone}
\def\wind{%
    \psline[linewidth=0.2](8,-9)(11,-9)
    \psline[linewidth=0.2](5,-9.4)(10,-9.4)
    \psline[linewidth=0.2](7,-9.8)(10.5,-9.8)}
\begin{document}
\begin{pspicture}[linecap=1,linejoin=1](-1,-12)(13,3)
    \psframe[fillstyle=vlines,hatchangle=-45,hatchsep=.3,hatchcolor=lightgray](-1,-12)(13,3)
    \qdisk(11,-0.5){1.5}
    \psline[linewidth=1.5](4,-4)(3,-7)(1,-10)
    \psline[linewidth=1.75,linecolor=white](3.5,-4)(6,-7)(1,-7)
    \psline[linewidth=1.5](3.5,-4)(6,-7)(1,-7)
    \psline[linewidth=2.5](8,-1)(4.1,-3.8)
    \psline[linewidth=1](8,-1)(8,-4)(11,-5)
    \psline[linewidth=1.25,linecolor=white](8,-1)(6,2)(3,1)
    \psline[linewidth=1](8,-1)(6,2)(3,1)
    \wind
    \rput(-5.5,9){\wind}
\end{pspicture}
\end{document}

enter image description here

  • 2
    Nice picture! Sadly pstricks is not what the OP wants :( – user156344 Nov 19 '18 at 9:56
  • 2
    ...nevertheless not a reason to downvote imho (+1), all the more the OP didn't even provide a MWE to fix or complete. – c.p. Nov 19 '18 at 10:23
  • 2
    @DũngVũ Please have a look at tex.meta.stackexchange.com/a/3458/36296 Even if pstricks is not asked for in the question, seeing a variate of answers will benefit future users of this site – user36296 Nov 19 '18 at 10:30
9
\documentclass[pstricks,border=12pt]{standalone}
\def\wind{%
    \psline[linewidth=0.2](8,-9)(11,-9)
    \psline[linewidth=0.2](5,-9.4)(10,-9.4)
    \psline[linewidth=0.2](7,-9.8)(10.5,-9.8)}
\begin{document}
\begin{pspicture}[linecap=1,linejoin=1](-1,-12)(13,3)
    \psframe[fillstyle=vlines,hatchangle=-45,hatchsep=.3,hatchcolor=lightgray](-1,-12)(13,3)
    \qdisk(11,-0.5){1.5}
    \psline[linewidth=2.5](8,-1)(4,-4)
    \psline[linewidth=1.5](4,-4)(3,-7)(1,-10)
    \psline[linewidth=1.5](3.75,-4.25)(6,-7)(1,-7)
    \psline[linewidth=1](8,-1)(8,-4)(11,-5)
    \psline[linewidth=1](8,-1)(6,2)(3,1)
    \wind
    \rput(-5.5,9){\wind}
\end{pspicture}
\end{document}

enter image description here

  • 2
    This is pstricks. He asked for TikZ. – clocktown Nov 18 '18 at 12:35
  • 2
    @clocktown: But he loves PSTricks answer. – Money Oriented Programmer Nov 18 '18 at 12:36
  • 1
    Yes, but it's technically not a correct answer. Although I love it too (its shorter compared to the TikZ answer). But as he says he is teaching, when he teaches TikZ, he shouldn't come up with pstricks. Could be confusing. – clocktown Nov 18 '18 at 12:37
  • 6
    but always no need vor downvoting! – user2478 Nov 18 '18 at 14:34
  • 3
    @clocktown: This site is not meant for just one person to get an answer to a particular problem. If someone comes across this need, but in pstricks, should they post another question? Just because it is not directly helpful to the OP, this a perfectly valid answer. IMHO, a downvote should be reserved for answers which do not address the question, or for ones in which the answer may have other major issues (even if they don't show up in code provided). – Peter Grill Nov 19 '18 at 4:30
8

Similar to nidhin's one but drawn with thick lines with round caps instead of rectangles:

\documentclass[tikz, border=2mm]{standalone}
%\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
    myline/.style={%
        line cap=round, 
        line join=round,
        line width=#1}]
    \draw[myline=10mm] (1.2,0.65) -- (3.25,2)--(3.9,4.5);
    \draw[preaction={draw, myline=12mm, white}, myline=11mm] (3.95,4.6) -- (5.25,2.5)--(2.5,2.25);
    \draw[myline=7mm] (6.6,5.7) -- (6.6,4.35)--(8.25,3.35);
    \draw[myline=18mm] (4.2,4.85)--(6.1,5.75);
    \draw[preaction={draw, myline=8mm, white}, myline=7mm] (6.2,5.8) -- (4.8,6.75)--(3,6.4);
    \fill (8.1,6) circle(1cm);
    \draw[myline=2pt] (4.8,1) -- ++(2,0);
    \draw[myline=2pt] (6,1.3) -- ++(1.6,0);
    \draw[myline=2pt] (5.6,0.7) -- ++(1.6,0);

    \draw[myline=2pt] (0.5,5) -- ++(2,0);
    \draw[myline=2pt] (1.2,5.3) -- ++(1.6,0);
    \draw[myline=2pt] (1.1,4.7) -- ++(1.6,0);

\end{tikzpicture}
\end{document}

enter image description here

2

A similar pictogram to the one you show in your question is available as vector image from https://upload.wikimedia.org/wikipedia/commons/b/b0/Running_icon_-_Noun_Project_17825.svg

This opens a couple of possibilities:

  1. use the svg package to include the graphic (needs shell-escape to compile and inkscape installed)

  2. Use and external program like inkscape to convert the graphic to pdf, which then can be included with \includegraphics in your document

  3. Convert the .svg to tikz, which can for example be done with inkscape:


\documentclass{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\fill (2.7298,2.9966) .. controls (2.6046,2.9966) and (2.5032,2.8951) .. (2.5032,2.7702) .. controls (2.5032,2.6453) and (2.6046,2.5438) .. (2.7298,2.5438) .. controls (2.8547,2.5438) and (2.9560,2.6453) .. (2.9560,2.7702) .. controls (2.9560,2.8952) and (2.8547,2.9966) .. (2.7298,2.9966) -- cycle(1.8120,2.9130) .. controls (1.7960,2.9125) and (1.7807,2.9106) .. (1.7674,2.9074) -- (1.3128,2.7960) .. controls (1.2596,2.7830) and (1.2161,2.7320) .. (1.2161,2.6827) .. controls (1.2161,2.6333) and (1.2596,2.6035) .. (1.3129,2.6163) -- (1.7107,2.7116) .. controls (1.7640,2.7244) and (1.8460,2.7118) .. (1.8930,2.6837) -- (2.0218,2.6065) .. controls (2.0689,2.5784) and (2.0689,2.5322) .. (2.0221,2.5037) -- (1.6233,2.2623) .. controls (1.5764,2.2339) and (1.5162,2.1788) .. (1.4894,2.1396) .. controls (1.4626,2.1006) and (1.5647,1.8858) .. (1.5882,1.8363) -- (1.7125,1.5730) .. controls (1.7360,1.5235) and (1.7103,1.4815) .. (1.6555,1.4815) -- (1.1510,1.4815) .. controls (1.0962,1.4815) and (1.0551,1.4383) .. (1.0596,1.3837) -- (1.0660,1.3196) .. controls (1.0704,1.2650) and (1.1189,1.2345) .. (1.1738,1.2345) -- (2.0524,1.2345) .. controls (2.1071,1.2345) and (2.1361,1.2629) .. (2.1166,1.3142) -- (1.9628,1.7126) .. controls (1.9433,1.7638) and (1.9151,1.8455) .. (1.9002,1.8982) -- (1.8951,1.9147) .. controls (1.8801,1.9674) and (1.9066,2.0323) .. (1.9539,2.0599) -- (2.2306,2.2209) .. controls (2.2779,2.2485) and (2.3414,2.2829) .. (2.3717,2.2977) .. controls (2.4020,2.3125) and (2.4391,2.2815) .. (2.4541,2.2287) -- (2.5489,1.8960) .. controls (2.5638,1.8433) and (2.6199,1.8096) .. (2.6734,1.8212) -- (3.2002,1.9352) .. controls (3.2537,1.9468) and (3.2975,1.9933) .. (3.2975,2.0386) .. controls (3.2975,2.0839) and (3.2531,2.1140) .. (3.1990,2.1056) -- (2.8194,2.0463) .. controls (2.7653,2.0379) and (2.7083,2.0740) .. (2.6930,2.1265) -- (2.5884,2.4840) .. controls (2.5730,2.5365) and (2.5205,2.5997) .. (2.4716,2.6244) -- (1.9532,2.8861) .. controls (1.9165,2.9046) and (1.8603,2.9147) .. (1.8120,2.9130) -- cycle(0.4593,2.4347) .. controls (0.4045,2.4347) and (0.3596,2.4167) .. (0.3596,2.3994) .. controls (0.3596,2.3821) and (0.4045,2.3641) .. (0.4593,2.3641) -- (1.5070,2.3641) .. controls (1.5618,2.3641) and (1.6067,2.3821) .. (1.6067,2.3994) .. controls (1.6067,2.4167) and (1.5618,2.4347) .. (1.5070,2.4347) -- cycle(0.5811,2.2935) .. controls (0.5263,2.2935) and (0.4815,2.2755) .. (0.4815,2.2582) .. controls (0.4815,2.2409) and (0.5263,2.2229) .. (0.5811,2.2229) -- (1.3545,2.2229) .. controls (1.4092,2.2229) and (1.4542,2.2409) .. (1.4542,2.2582) .. controls (1.4542,2.2755) and (1.4093,2.2935) .. (1.3545,2.2935) -- cycle(0.6622,2.1523) .. controls (0.6074,2.1523) and (0.5626,2.1342) .. (0.5626,2.1170) .. controls (0.5626,2.0997) and (0.6075,2.0817) .. (0.6622,2.0817) -- (1.3041,2.0817) .. controls (1.3588,2.0817) and (1.4037,2.0997) .. (1.4037,2.1170) .. controls (1.4037,2.1342) and (1.3588,2.1523) .. (1.3041,2.1523) -- cycle(1.5539,1.1639) .. controls (1.4991,1.1639) and (1.4177,1.1442) .. (1.3730,1.1125) -- (1.1237,0.9389) .. controls (1.0790,0.9072) and (1.0684,0.8463) .. (1.1001,0.8016) -- (1.1495,0.7328) .. controls (1.1812,0.6881) and (1.2422,0.6799) .. (1.2851,0.7140) -- (1.7881,1.1079) .. controls (1.8309,1.1420) and (1.8211,1.1639) .. (1.7663,1.1639) -- cycle;
\end{tikzpicture}
\end{document}

enter image description here

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.