missing-square-fibonacci.tex 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. \documentclass{article}
  2. \usepackage[pdftex,active,tightpage]{preview}
  3. \setlength\PreviewBorder{2mm}
  4. \usepackage{tikz}
  5. \usetikzlibrary{shapes, calc, snakes}
  6. \usepackage{amsmath,amssymb}
  7. \begin{document}
  8. \begin{preview}
  9. \begin{tikzpicture}[thick]
  10. % Draw the triangle
  11. \fill[fill=gray!40] (0, 0) coordinate (A)
  12. -- (5,0) coordinate (B)
  13. -- (0,2) coordinate (C) -- cycle;
  14. \fill[fill=blue!40] (B)
  15. -- (C)
  16. -- (2,2) coordinate (D)
  17. -- (5,2) coordinate (E) -- cycle;
  18. \fill[fill=red!40] (C)
  19. -- (D)
  20. -- (3,5) coordinate (G)
  21. -- (0,5) coordinate (F);
  22. \fill[fill=green!40] (D)
  23. -- (E)
  24. -- (5,5) coordinate (H)
  25. -- (G);
  26. \fill[fill=green!40] (6,1) coordinate (I)
  27. -- (9,1) coordinate (J)
  28. -- (9,2.9) coordinate (O)
  29. -- (6,4) coordinate (L);
  30. \fill[fill=gray!40] (J)
  31. -- (14,1) coordinate (K)
  32. -- (O);
  33. \fill[fill=blue!40] (L)
  34. -- (11,2.14) coordinate (P)
  35. -- (11,4) coordinate (M);
  36. \fill[fill=red!40] (M)
  37. -- (14,4) coordinate (N)
  38. -- (K)
  39. -- (P);
  40. % Draw edge text
  41. \node (a) at ($(A)!0.5!(B)$) [below] {$f_n$};
  42. \node (b) at ($(A)!0.5!(C)$) [left] {$f_{n-2}$};
  43. \node (c) at ($(C)!0.5!(F)$) [left] {$f_{n-1}$};
  44. \node (d) at ($(C)!0.5!(D)$) [above] {$f_{n-2}$};
  45. \node (e) at ($(D)!0.5!(E)$) [above] {$f_{n-1}$};
  46. \node (f) at ($(F)!0.5!(G)$) [above] {$f_{n-1}$};
  47. \node (g) at ($(G)!0.5!(H)$) [above] {$f_{n-2}$};
  48. \node (h) at ($(N)!0.5!(K)$) [right] {$f_{n-1}$};
  49. \node (i) at ($(I)!0.5!(J)$) [below] {$f_{n-1}$};
  50. \node (j) at ($(J)!0.5!(K)$) [below] {$f_{n}$};
  51. \draw [
  52. thick,
  53. decoration={
  54. brace,
  55. mirror,
  56. raise=0.5cm
  57. },
  58. decorate
  59. ] (I) -- (K)
  60. node [pos=0.5,anchor=north,yshift=-0.55cm] {$f_{n+1}$};
  61. \end{tikzpicture}
  62. \end{preview}
  63. \end{document}