6

I have gone through the comprehensive symbols in LaTeX that provides some animals icons but not enough for fun documents. One of my math questions requires the illustration as follows, which is a repeated list of ducks and turtles:

enter image description here

Could you help to draw these animals using Tikz?

Epa
  • 3,449
  • 4
    There isn't a question yet. – Johannes_B Oct 16 '15 at 13:02
  • 9
    Why do you want to use tikz for this? If you have images of a duck and a turtle, you can include these in your document. You can define a macro \duck to include the image of the duck, and even use that as part of a tikz drawing, via \node {\duck}; so you can put them where you want, use loops, etc. – JLDiaz Oct 16 '15 at 13:24
  • Do you know tikzlings and tikzducks? – Alexander Wittmann Jan 10 '23 at 17:15

3 Answers3

22
\documentclass{standalone}
\usepackage{tikz}
\usepackage{graphicx}
\def\D{\includegraphics[width=3ex]{duck}}
\def\T{\includegraphics[width=4ex]{turtle}}

\tikzset{
 D/.style = {inner sep=2pt, font={\D}, anchor=south},
 T/.style = {inner sep=2pt, font={\T}, anchor=south}
}
\begin{document}
\tikz{
\foreach \animal  [count=\x] in {D,T,D,T,D,T,T,D,T,D,D}
   \node[\animal] at (4*\x ex,0) {};
}
\end{document}

Result

JLDiaz
  • 55,732
13

There's already code on the site for drawing ducks. Hence, only the turtle remains to be done. I hope turtles are sufficiently like tortoises for a tortoise to pass muster:

crwbanod

Adjust the colours to your taste.

crwbanod lliwiol

\documentclass[border=10pt,tikz,svgnames]{standalone}
\usetikzlibrary{calc}
\colorlet{lliw symbolau cefndir}{DarkSlateBlue}
\tikzset{
  pics/crwban/.style n args={2}{
    code={
      \path [fill=#1, draw=#1, double=lliw symbolau cefndir, line width=.025*#2, double distance=.01*#2, pic actions]
      (-.5*#2,-.2*#2)
      [out=-20, in=-160] to coordinate [pos=.15] (troed1a) coordinate [pos=.2] (troed1b)  coordinate [pos=.3] (troed1d) coordinate [pos=.65] (troed2a) coordinate [pos=.7] (troed2b) coordinate [pos=.8] (troed2e) coordinate [pos=.85] (troed2d) coordinate [pos=.9] (crwb4) (.25*#2,-.2*#2)
      [out=20, in=-90] to (.3*#2,-.15*#2) coordinate (crwb3)
      [out=90, in=20] to coordinate [pos=.5] (crwb5) (.25*#2,-.1*#2) coordinate (crwb2)
      [out=-160, in=-20] to (-.5*#2,-.1*#2) coordinate (crwb1)
      [out=160, in=90] to (-.55*#2,-.15*#2)
      [out=-90, in=160] to cycle
      (crwb1)
      [out=75, in=180] to coordinate (crwb6) (-.125*#2,.25*#2)
      [out=0, in=105] to (crwb2)
      [out=-160, in=-20] to cycle
      (crwb4)
      [out=-15, in=-70] to (.55*#2,.1*#2)
      [out=110, in=0] to (.5*#2,.125*#2)
      [out=180, in=75] to (.45*#2,.1*#2)
      [out=-105, in=15] to (crwb5)
      (troed1a)
      [out=-135, in=-170] to ++(.125*#2,-.1*#2)
      [out=10, in=-20] to coordinate (troed1c) ++(-.05*#2,.05*#2)
      [out=160, in=-80] to (troed1b)
      (troed1d)
      [out=-135, in=10] to ++(.05*#2,-.05*#2)
      [out=-170, in=-20] to (troed1c)
      (troed2a)
      [out=-135, in=-170] to ++(.125*#2,-.1*#2)
      [out=10, in=-20] to  ++(-.05*#2,.05*#2)
      [out=160, in=-80] to (troed2b)
      (troed2e)
      [out=-135, in=-170] to ++(.105*#2,-.09*#2)
      [out=10, in=-20] to  ++(-.05*#2,.05*#2)
      [out=160, in=-80] to (troed2d)
      ;
      \path [draw=lliw symbolau cefndir, line cap=round, line join=round, line width=.01*#2]
      (crwb6) ++(0,-.025*#2)
      [out=-100, in=80] to coordinate (crwb13) ($(crwb1)!1/2!(crwb2) - (0,.04*#2)$)
      (crwb6) ++(.01*#2,-.025*#2)
      [out=-35, in=120] to coordinate (crwb11) ($(crwb1)!3/4!(crwb2) - (0,.02*#2)$)
      (crwb6) ++(-.01*#2,-.025*#2)
      [out=-145, in=60] to coordinate (crwb12) ($(crwb1)!1/4!(crwb2) - (0,.02*#2)$)
      (crwb6) ++(-.02*#2,-.015*#2)
      [out=-175, in=45] to coordinate [pos=.5] (crwb7) coordinate (crwb8) ($(crwb1)!1/9!(crwb2) + (0,.1*#2)$)
      (crwb6) ++(.02*#2,-.015*#2)
      [out=-5, in=135] to  coordinate [pos=.5] (crwb9) coordinate (crwb10) ($(crwb1)!8/9!(crwb2) + (0,.1*#2)$)
      (crwb7) ++(-.015*#2,.025*#2) [out=-35, in=170] to ($(crwb9) + (.05*#2,-.025*#2)$)
      (crwb8) ++(-.01*#2,-.005*#2) [out=15, in=-170] to ($(crwb10) + (.005*#2,0)$)
      (crwb8)
      [out=-100, in=-160] to (crwb12)
      [out=20, in=170] to (crwb13)
      [out=-10, in=170] to (crwb11)
      [out=-10, in=-80] to (crwb10)
      ;
    }
  },
}
\begin{document}
\begin{tikzpicture}
  \pic at (3.1,0) {crwban={DarkSlateGrey}{10pt}};
  \pic at (2.5,0) {crwban={DarkSlateGrey}{20pt}};
  \pic at (1.55,0) {crwban={DarkSlateGrey}{30pt}};
  \pic at (.25,0) {crwban={DarkSlateGrey}{40pt}};
  \pic at (-1.5,0) {crwban={DarkSlateGrey}{50pt}};
\end{tikzpicture}
\colorlet{lliw symbolau cefndir}{white}
\begin{tikzpicture}
  \pic at (4,0) {crwban={Crimson}{25pt}};
  \pic at (3,0) {crwban={Gold}{25pt}};
  \pic at (2,0) {crwban={MediumTurquoise}{25pt}};
  \pic at (0,0) {crwban={Green}{25pt}};
  \pic at (1,0) {crwban={DodgerBlue}{25pt}};
\end{tikzpicture}
\end{document}
cfr
  • 198,882
  • Could you show the link for the duck codes? – Epa Oct 18 '15 at 04:28
  • @Thumbolt See http://tex.stackexchange.com/questions/63732/cute-child-friendly-document-in-latex/63759#63759 ;). – cfr Oct 18 '15 at 14:34
  • I like your drawing very much and wish to draw dogs, cats, rabbits, monkey, elephants, ... in this style. What softwares do you use to aid such drawing with a lot of numbers? – Epa Dec 09 '17 at 06:52
  • @Thumbolt It is just TikZ. I used Kile to edit it, I think, but that's just preference. If you mean a fancy GUI to generate the code, I didn't use one. I just wrote the code as you see it. (After some revisions, obviously.) – cfr Dec 09 '17 at 16:40
  • @Thumbolt There is code for cats around somewhere. There are also some donkeys, pigs and fish. I don't think we have dogs, monkeys or elephants yet. At least, not that I'm aware of. Styles vary somewhat, though. – cfr Dec 09 '17 at 16:44
7

Only partial solution, as the turtle is missing, but for the duck I have the perfect package for you:

\documentclass{standalone}
\usepackage{tikzducks}

\begin{document}      

\begin{tikzpicture}
\duck
\end{tikzpicture}   

\end{document}

enter image description here


With the development version of the tikzducks package, you could "turtlefy" the ducks:

\documentclass{standalone}
\usepackage{tikzducks}

\begin{document}

\begin{tikzpicture}
\duck[mask=purple!50!blue!70!white,body=green!50!brown,jacket=brown!80!yellow,bill=green!20!brown]
\end{tikzpicture}
\begin{tikzpicture}
\duck[mask=blue!70!white,body=green!50!brown,jacket=brown!80!yellow,bill=green!20!brown]
\end{tikzpicture}
\begin{tikzpicture}
\duck[mask=orange,body=green!50!brown,jacket=brown!80!yellow,bill=green!20!brown]
\end{tikzpicture}
\begin{tikzpicture}
\duck[mask=red,body=green!50!brown,jacket=brown!80!yellow,bill=green!20!brown]
\end{tikzpicture}


\end{document}

enter image description here