SHARE
TWEET

Untitled

a guest Jun 17th, 2013 116 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. \documentclass[12pt,a4paper]{article}
  2.  
  3. \usepackage{tikz}
  4. \usetikzlibrary{lindenmayersystems}
  5.  
  6. \usepackage{caption,subcaption}
  7.  
  8. \renewcommand{\subfigurename}{Figur}
  9. \renewcommand{\thesubfigure}{\arabic{subfigure}}
  10.  
  11. \def\trianglewidth{2cm}%
  12. \pgfdeclarelindenmayersystem{Sierpinski triangle}{
  13.    \symbol{X}{\pgflsystemdrawforward}
  14.    \symbol{Y}{\pgflsystemdrawforward}
  15.    \rule{X -> X - Y + X + Y - X}
  16.    \rule{Y -> YY}
  17. }%
  18.  
  19. \newcommand{\Sierpinski}[1]{
  20. \begin{tikzpicture}[l-system={step=\trianglewidth/(2^#1), order=#1, angle=-120}]
  21.    \fill [black] (0,0) -- ++(0:\trianglewidth) -- ++(120:\trianglewidth) -- cycle;
  22.    \draw [draw=none] (0,0) l-system
  23.    [l-system={Sierpinski triangle, axiom=X},fill=white];
  24. \end{tikzpicture}}
  25.  
  26. \begin{document}%
  27.  
  28. \begin{figure}[!htbp]
  29.        \centering
  30.        \foreach \level in {0,...,4}
  31.         {%
  32.         \pgfmathtruncatemacro{\levelName}{1+\level}
  33.        \begin{subfigure}[b]{0.15\textwidth}
  34.                         \Sierpinski{\level}
  35.                         \caption{}
  36.            \label{fig:I.9.\levelName}
  37.                 \end{subfigure}
  38.                 }                              
  39. \end{figure}
  40.  
  41. \end{document}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top