Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Yes, it's that time of the month again. It's time for somebody to ask how we can draw X in LaTeX. This time I'm asking the question and X is a bird.

The reason why I'm interested in this question is that drawing "non-geometrical" shapes is difficult. Addign symmetry makes it even more difficult and I'd like to see the different solutions that are used.

I welcome any answers but I'm especially keen on birds with symmetry. All solutions have to be original.

The following is a possible example of what I'm looking for.

First the design, which is inspired by Escher, but based on an original idea:

bird design Next the LaTeX output:

LaTeX output

Following the suggestion of @Hooked, I provide a possible solution below.

share|improve this question
14  
And the question is ... what, exactly? Seriously, you appear to have already drawn a bird. So before I try to better it, I'd like to know a bit more: why are you doing this, and what's wrong with what you've already done? –  Loop Space Mar 4 '12 at 21:50
1  
Thanks for this ! –  projetmbc Mar 4 '12 at 22:02
1  
Andrew: While this really isn't a question and might not really belong here, I found it nice and don't mind. –  Ben Mar 4 '12 at 23:01
2  
To keep it a proper question - why not erase your solution and write it as an answer? That way the upvotes will help determine the "best" bird to answer the question. –  Hooked Mar 9 '12 at 19:23
4  
@MarcvanDongen presumably the site is structured to allow answering ones own question, there's even a badge for it! tex.stackexchange.com/badges/14/self-learner If you do it this way, it allows us to upvote the question for it's merits separately from the answer you may give (of which we may have a different criteria for). –  Hooked Mar 11 '12 at 3:58

5 Answers 5

up vote 30 down vote accepted

No symmetry no Escher's style but ... that look like birds. First you need to save the next code in a file names bird1.pgf. It's not exactly the code given by Inkscape. I export the code with LaTeX and PSTricks then I transform the code to get something lighter.

%%Creator: inkscape 0.48.2
%%Please note this file requires PSTricks extensions

\m 294.2539  630.192
\c 402.19387 856.17313262 487.970 847.918 488.203 848.384
\c 418.76941 793.96220262 351.3144 706.885 294.253 630.191
\o

\m 492.937 872.945
\c 561.627 1035.579 624.256 909.310 624.256 909.310
\c 624.256 909.310 553.546 979.011 492.9373 872.945
\o

\m 594.269 881.372
\c 594.269 875.794 589.746  871.271  584.167  871.2714
\c 578.588 871.271 574.066 875.794 574.066  881.3729
\c 574.066 886.951 578.588 891.474 584.167 891.4744
\c 589.746 891.474 594.269 886.951 594.269 881.3729
\o

\m 612.533  855.021
\c 615.077  835.925  686.994  862.510 675.314 862.510
\c 684.625  869.475  622.031  865.087 612.533 855.021
\o

\m 527.722 809.837
\c 535.020 790.648 629.957 829.080 622.287 821.021
\c 566.611 762.5112 513.586 794.030 527.722 809.837
\o

\m 459.507 512.230
\c 583.604 590.988 648.910 788.7036 647.107 803.656
\c 647.107 803.656 651.605 695.9141 619.59 643.544
\c 568.314 559.659 472.752 504.8105 459.507 512.230
\o

\m 277.499 613.928
\l 241.428 601.428
\c 241.428 601.428 181.071 587.857 116.78571 534.642
\c  52.500 481.428 53.5714 481.428 53.571432 481.428
\c 53.5714 481.428 113.207 513.232 157.14286 540.357
\c 196.708 564.784 182.094 558.488 277.49999 613.928
\o

\m 361.508 504.392                   
\c 361.508 504.392 352.922  525.605 280.69625  530.151
\c 208.470 534.697  52.928  455.760  53.411917 455.905
\c 129.959 478.800 152.115  489.060 251.40183  503.887
\c 346.187 518.043 361.508  504.392 361.50845  504.392
\o

\m 487.803 503.150                                    
\c 487.803 503.150 463.304 478.906 479.994 446.076
\c 496.684 413.247 496.684 414.762 496.684 414.762
\c 487.619 437.921 482.945 448.602 487.803 503.150
\o                                          

\m 441.374 498.150                                  
\c 441.374 498.150 416.876 473.906 433.566 441.076
\c 450.255 408.247 450.255 409.762 450.255 409.762
\c 441.191 432.921 436.516 443.602 441.374 498.150
\o

\m 521.785 414.642
\c 573.214 417.857 572.5 380.000 572.5 380.000
\c 572.5 380.000 560 401.785 521.785 414.642
\o

\m 494.64285 393.214
\c 546.07142 396.428 545.357 358.571 545.357 358.571
\c 545.35714 358.571 532.857 380.357 494.642 393.214
\o                                               

\m 468.928 374.285                                
\c 520.357 377.499 519.642 339.642 519.642 339.642
\c 519.642 339.642 507.142 361.428 468.928 374.285
\o                                 

\m 458.427 389.0716                  
\c 395.702 393.445 396.573 341.929 396.573 341.929
\c 396.573 341.929 411.819 371.575 458.427 389.071
\o

\m 308.571 610.000
\c 385.714 548.571 530     741.42  530 741.428
\c 530     741.428 495.714 645.714 414.28 601.428
\c 339.269 560.630 310     602.857 308.57 610.000
\o\s
\endinput 

It's the first time, I created a vector object with Inkscape. I take an example (.png) and with a bezier tool (pen) I draw the bird. If someone know how to transform a file.png in a file.eps I will be happy. I think it's possible with Inkscape to vectorize a bipmap but I don't know how to do.

For the first birds,I use TikZ so if you don't want to download tikzrput and pgfornament you can comment the last pictures. Then I try with \rput pgf version and the last I try with pgfornament.

\documentclass[11pt]{scrartcl} 
\PassOptionsToPackage{dvipsnames,svgnames}{xcolor}    
\usepackage{tikz,tikzrput} % altermundus.com/pages/tkz/tikzrput/
\usepackage{pgfornament}   % altermundus.com/pages/tkz/ornament/ 
\makeatletter  
\newcommand{\callornament}[1]{%
\begingroup
\def\i{\pgfusepath{clip}}%
\let\o\pgfpathclose
\let\s\pgfusepathqfillstroke
\def\p ##1##2{\pgfqpoint{##1bp}{##2bp}}%
\def\m ##1 ##2 {\pgfpathmoveto{\p{##1}{##2}}}%
\def\l ##1 ##2 {\pgfpathlineto{\p{##1}{##2}}}%
\def\r ##1 ##2 ##3 ##4 {\pgfpathrectangle{\p{##1}{##2}}{\p{##3}{##4}}}%
\def\c ##1 ##2 ##3 ##4 ##5 ##6 {%
\pgfpathcurveto{\p{##1}{##2}}{\p{##3}{##4}}{\p{##5}{##6}}}%   
\@@input #1\relax
\endgroup}  

\makeatother
\begin{document}

\begin{tikzpicture}[scale=.2,fill=MidnightBlue,draw=black]
\callornament{bird1.pgf}
\begin{scope}[fill=yellow,draw=black,cm={-1,0,0,1,(50,10)}]
\callornament{bird1.pgf}  
\end{scope}
\end{tikzpicture} 

\rput{-30}(7,-2){\tikz[scale=.2,fill=SpringGreen] \callornament{bird1.pgf} ; }

\gdef\OrnamentsFamily{bird}
\tikzset{pgfornamentstyle/.style={fill=Goldenrod}}%    
\rput(0,-2){\pgfornament[scale=.3]{1}}     
\end{document}  

enter image description here

share|improve this answer
    
The process of turning a raster image into vector form is called tracing, I believe, for which there exists at least the programs AutoTrace and Potrace. But often I find, especially with relatively simple graphics, that just writing it out in SVG produces the most compact code. –  morbusg Mar 6 '12 at 21:50
    
@morbusg Inkscape also has some auto tracing tools, see e.g. inkscape.org/doc/tracing/tutorial-tracing.html –  Torbjørn T. Mar 19 '12 at 7:40
    
@TorbjørnT. Thanks for the information. I never used Inskape but this is a soft very interesting –  Alain Matthes Mar 19 '12 at 7:47

For PSTricks fans:

\documentclass{minimal}
\usepackage{pst-fun}
\begin{document}
\pspicture[showgrid](6,5)
\rput(0,2){\psBird}
\rput{-30}(2,2){\psBird}
\endpspicture
\end{document}

enter image description here

Note: Compile it with xelatex or latex-dvips-ps2pdf sequence.

share|improve this answer
3  
\newcounter{\Terrorist} :P –  percusse Mar 6 '12 at 12:25
3  
@percusse:\newcommand{\nickname}{Counter Terrorist}\renewcommand{\nickname}{Damien Walters}. –  In PSTricks we trust Mar 6 '12 at 12:31
2  
@YiannisLazarides: Pixels have been repeated and tiled here. :-) –  In PSTricks we trust Mar 6 '12 at 12:34
4  
@Yiannis: AFAIS, the question asks for drawing a bird, OP just himself drew a symmetric bird. So this answer is just fine in every respect (+1). –  morbusg Mar 6 '12 at 12:43
5  
@YiannisLazarides “I'm especially keen” != “requirement”;) –  morbusg Mar 6 '12 at 13:17

I made a bird. It is butt ugly, but it flies. -and it tessellates the plane.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=0.01]

\newcommand\bird[1]{%
\begin{scope}[#1]
  \filldraw (0,0) --%
  (10,-5) -- (19,8) -- (35,7) -- (38,-12) -- (60,0) --%
  (75,23) -- (80,40) -- (52,37) -- (74,50) -- (52,50) -- (60,60)--%
  (38,48) -- (35,67) -- (19,68) -- (10,55) -- (0,60) --%
  (-8,50) -- (14,50) -- (-8,37) -- (20,40) -- (15,23) -- cycle;
\begin{scope}[draw=gray]
  \draw (35,15) -- +(-25:25) (40,20) -- +(-20:25) (42,25) -- +(-15:25) (40,30) -- +(-10:30);
  \draw (1,55) circle (1);
  \draw[clip] (24,55) circle (4);
  \filldraw[gray] (27,52) circle (4);
\end{scope}
\end{scope}
}

\bird{shift={(0,0)}, fill=white};
\bird{shift={(60,0)}, fill=black};
\bird{shift={(120,0)}, fill=white};
\bird{shift={(180,0)}, fill=black};
\bird{shift={(240,0)}, fill=white};

\bird{shift={(0,60)}, fill=black};
\bird{shift={(60,60)}, fill=white};
\bird{shift={(120,60)}, fill=black};
\bird{shift={(180,60)}, fill=white};
\bird{shift={(240,60)}, fill=black};

\end{tikzpicture}
\end{document}

birds

I do not know if I passes the arguments in a smart way!?, and my short attempt to use a foreach loop failed.

share|improve this answer
1  
Sweet! Here is rough for loop. \foreach[count=\xi] \x in {0,60,...,240}{ \pgfmathparse{int(mod(\xi,2))} \ifnum \pgfmathresult>0 \bird{shift={(\x,0)}, fill=white}; \bird{shift={(\x,60)}, fill=black}; \else \bird{shift={(\x,60)}, fill=white}; \bird{shift={(\x,0)}, fill=black}; \fi } –  percusse Mar 18 '12 at 4:19
    
Utterly hideous! +1 –  qubyte Mar 23 '12 at 1:47

Update

The model for the birds comes from here but I draw myself my new ugly birds with a simple drawing. It's possible to make a code shorter. Now the code with the foreach is ugly. I was not able to find something elegant.

enter image description here

\documentclass[border=6pt]{standalone}    
\usepackage{tikz}
\begin{document}

\newcommand\myuglybird[2]{%http://www.tess-elation.co.uk/birds---an-introduction/birds-1-1    
\begin{scope}[rotate=45,#1]
\draw[#2] (0,0) -- ++(0, 1)   -- ++( .5,.5)  -- ++( .5,-.5) 
                -- ++(0, 1)   -- ++( .5,.5)  -- ++( .5,-.5)
                -- ++(0,-1)   -- ++( .5,.5)  -- ++( .5,-.5) 
                -- ++(0,-1)   -- ++(-.5,.5)  -- ++(-.5,-.5)
                -- ++(0,-1)   -- ++(-.5,.5)  -- ++(-.5,-.5) 
                -- ++(0, 1)   -- ++(-.5,.5)  --   cycle;                     
\draw ( .2, .2)  -- ( .2, .6) 
      ( .4, .4)  -- ( .4, .8) 
      ( .6, .4)  -- ( .6, .8) 
      ( .8, .2)  -- ( .8, .6) 
      (1.2,-.8)  -- (1.2, .2) 
      (1.4,-.6)  -- (1.4, .4) 
      (1.6,-.6)  -- (1.6, .4) 
      (1.8,-.8)  -- (1.8, .2)
      (2.2, .2)  -- (2.2, .6) 
      (2.4, .4)  -- (2.4, .8) 
      (2.6, .4)  -- (2.6, .8) 
      (2.8, .2)  -- (2.8, .6)
      (1.3,2.3)  -- (1.5,2.1) -- (1.7,2.3) 
      (1.5,2.5)  -- (1.5,2.1)
      (1.7,2.0) circle (2pt)
      (1,0) -- ++(.5,.5) --++(.5,-.5) ; 
\end{scope}
}%     

\begin{tikzpicture}
  \draw[thick] (-3,5) rectangle (12,11);  
  \clip (-3,5) rectangle (12,11); 
  \foreach \y in {0,1,...,5}{%   
  \foreach \x in {0,1,...,9}{% 
   \pgfmathsetmacro{\z}{mod(\x+\y,4)}
   \ifcase\z
    \def\col{blue}
    \or
    \def\col{red}
    \or
    \def\col{green}
    \or
    \def\col{yellow} 
    \fi
   \pgfmathsetmacro{\xx}{2*\x-mod(\y,2)-1} 
   \pgfmathsetmacro{\yy}{-\x+3*\y}
   \ifnum 2=\y  \pgfmathsetmacro{\yy}{-\x+3*\y-1}   \fi 
   \ifnum 3=\y  \pgfmathsetmacro{\yy}{-\x+3*\y-1}   \fi 
   \ifnum 4=\y  \pgfmathsetmacro{\yy}{-\x+3*\y-2}   \fi  
   \ifnum 5=\y  \pgfmathsetmacro{\yy}{-\x+3*\y-2}   \fi 
   \ifnum 6=\y  \pgfmathsetmacro{\yy}{-\x+3*\y-2}   \fi 
  \myuglybird{shift={(\xx cm,\yy cm)}}{shade, top color=\col!30}
   } } 
\end{tikzpicture}
\end{document} 

I keep my first ugly bird. An ugly bird with tesselation

enter image description here

\documentclass[border=6pt]{standalone}
\usepackage{tikz}
\begin{document}

\newcommand\myuglybird[1]{%
\draw[#1] (1.7,2.5) circle (2pt) (0,0) --++(0.25,-3)--++(0.75,0)--++(-0.25,0.5)--++(0,1.75)--++(1.75,0.75)
--++(-1,+2)--++(1,1)--++(-1.75,-0.75)--++(-0,-1.75)--++(+0.25,-0.5)--++(-0.75,0)--++(-0.25,+3)--++(-1,-1)--++(1,-2)--cycle;
}%     

\begin{tikzpicture} 
\draw[thick] (0,0) rectangle (12,15);  
  \clip (0,0) rectangle (12,15);
  \foreach \y in {0,1,...,6}{%   
  \foreach \x in {0,1,...,5}{% 
  \pgfmathsetmacro{\z}{\x+\y}
 \ifodd \z \def\col{lightgray} \else \def\col{gray}\fi
 \myuglybird{fill=\col,xshift=2.5*\x cm,yshift=3*\y cm}
 } }
\end{tikzpicture}
\end{document} 
share|improve this answer
4  
It's not ugly it's just a taek won do bird :) –  percusse Mar 18 '12 at 18:40
    
Is the ugly bird based on "Escher's design 128" (melusine.eu.org/syracuse/var/syracuse/metapost/galeries/escher/…)? –  Marc van Dongen Mar 19 '12 at 8:34
    
@MarcvanDongen Yes and no : I've some books with a lot of pictures from Escher and I took my bad inspiration in one of these books but you are right it's a really bad version of "Escher's design 128". Now I need to find a personal design but this will take time ! –  Alain Matthes Mar 19 '12 at 8:46
    
@MarcvanDongen The best pictures for me are the pictures with birds and fishes at the same time. Really awesome ! The ugly bird is very similar to Bip Bip fr.wikipedia.org/wiki/Bip_Bip_et_Coyote –  Alain Matthes Mar 19 '12 at 8:51
    
Thanks for the explanation. –  Marc van Dongen Mar 19 '12 at 9:45

As promised in the question, I decided to separate the question and a possible solution.

Here is a possible solution.

LaTeX output

\documentclass{article}

\usepackage{graphicx}
\usepackage{tikz}    
\usetikzlibrary{calc}
\usetikzlibrary{intersections}

\newcommand*\BirdWidth[0]{1.7}
\newcommand*\BirdHeight[0]{1.0}

\newcommand\DrawBird[1]{%
    \path (#1)           
          coordinate (b) 
          let \n{w}={\BirdWidth},
              \n{h}={\BirdHeight},
              \n{r}={1.5*\n{w}},  
              \n{a2}={atan2(0.5*\n{w},\n{h})},
              \n{ang}={\n{a2}-90},            
              \n{xdiff}={0.25*\n{w}+\n{r}*cos(\n{ang})},
              \n{ydiff}={0.5*\n{h}+\n{r}*sin(\n{ang})}, 
              \n{rx}={sqrt(\n{ydiff}*\n{ydiff}+\n{xdiff}*\n{xdiff})} in
         (b) + (+0.5*\n{w},\n{h}) coordinate (r)                       
             + (\n{xdiff},\n{ydiff})    coordinate (c b r)             
               ($(b)!0.5!(r)$)          coordinate (m b r)             
               ($(c b r)!\n{rx}cm!(m b r)$) coordinate (m r)           
         (r)++ (-\n{w},0) coordinate (l)                               
             + (\n{xdiff},-\n{ydiff})   coordinate (c b l)             
               ($(b)!0.5!(l)$)          coordinate (m b l)             
               ($(c b l)!\n{rx}cm!(m b l)$) coordinate (m l)           
         \foreach \label/\angle in {0/-10,1/-6,2/-3,3/12,4/8,5/6,6/0} {
               ($(c b r)!1!\angle:(m r)$) coordinate (r\label)         
               ($(c b l)!1!-\angle:(m l)$) coordinate (l\label)        
         }                                                             
         \foreach \label\angle/\rat in {0/-2.5/1.075,1/1/1.086,2/3.5/1.094,3/6.5/1.1} {
               ($(c b r)!\rat!\angle:(m r)$) coordinate (ri\label)                     
               ($(c b l)!\rat!-\angle:(m l)$) coordinate (li\label)                    
         }                                                                             
         \foreach \label\angle\rat in {0/6.50/1.03,1/6.55/1.06,3/5.45/1.17,4/3.95/1.21,5/-2.4/1.035} {                                                                                
               ($(c b r)!\rat!\angle:(m r)$) coordinate (ro\label)                       
               ($(c b l)!\rat!-\angle:(m l)$) coordinate (lo\label)                      
         }                                                                               
         ($(ro1)!1.6!(ri3)$) coordinate (ro2)                                            
         ($(lo1)!1.6!(li3)$) coordinate (lo2)                                            
         (r) ++ (-0.40,+0.000) coordinate (t1)                                           
              + (+0.13,+0.120) coordinate (t2)                                           
              + (+0.30,+0.300) coordinate (t3)                                           
              + (-0.15,+0.300) coordinate (t4)                                           
              + (-0.20,+0.120) coordinate (t5)                                           
             ++ (-0.25,+0.000) coordinate (t6)                                           
              + (-0.35,-0.070) coordinate (t7)                                           
             ++ (-0.67,+0.000) coordinate (t8)                                           
              + (+0.04,+0.190) coordinate (t9)                                           
             ++ (+0.13,+0.420) coordinate (t10)                                          
              + (-0.40,+0.030) coordinate (t11)                                          
             ++ (-0.79,-0.060) coordinate (t12)                                          
              + (+0.08,-0.015) coordinate (t13)                                          
             ++ (+0.17,-0.050) coordinate (t14)                                          
              + (-0.07,+0.002) coordinate (t15)                                          
             ++ (-0.14,-0.005) coordinate (t16)                                          
              + (+0.12,-0.060) coordinate (t17)                                          
              + (+0.20,-0.160) coordinate (t18)                                          
    ;                                                                                    
    \filldraw (b) .. controls (r3) and (r4) .. (r5)                                      
                  .. controls (ro1) .. (ri3)                                             
                  .. controls (ri2) and (ri1) .. (ri0)                                   
                  .. controls (ro5) .. (r2)                                              
                  .. controls (r1) and (r0) .. (r)                                       
                  -- (t1) .. controls (t2) .. (t3)                                       
                  -- (t4) .. controls (t5) .. (t6)                                       
                  .. controls (t7) .. (t8)                                               
                  .. controls (t9) .. (t10)                                              
                  .. controls (t11) .. (t12)                                             
                  .. controls (t13) .. (t14)                                             
                  .. controls (t15) .. (t16)                                             
                  .. controls (t17) and (t18) .. (l)                                     
                  .. controls (l3) and (l4) .. (l5)                                      
                  .. controls (lo1) .. (li3)                                             
                  .. controls (li2) and (li1) .. (li0)                                   
                  .. controls (lo5) .. (l2)
                  .. controls (l1) and (l0) .. (b)
                  (l5) .. controls (l6) .. (l2);
    \draw (ri3) .. controls (ro2) and (ro3) .. (ro4);
    \filldraw (l) ++ (+0.16,+0.33) circle (0.8pt);
}

\begin{document}
\begin{tikzpicture}[scale=4,fill=yellow!70!gray,draw=yellow!50!gray,line width=2pt]
    \foreach \shift in {0,1} {
        \DrawBird{\shift*\BirdWidth,0}
    }
    \begin{scope}[rotate=180,xscale=-1]
        \DrawBird{0.5*\BirdWidth,-\BirdHeight}
    \end{scope}
\end{tikzpicture}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.