topology-3.tex 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. \documentclass[varwidth=true, border=2pt]{standalone}
  2. \usepackage{tikz}
  3. \usepackage{tkz-euclide}
  4. \usetikzlibrary{calc,shadings}
  5. \usepackage{pgfplots}
  6. \begin{document}
  7. \usetkzobj{all}
  8. \newenvironment{customlegend}[1][]{%
  9. \begingroup
  10. % inits/clears the lists (which might be populated from previous
  11. % axes):
  12. \csname pgfplots@init@cleared@structures\endcsname
  13. \pgfplotsset{#1}%
  14. }{%
  15. % draws the legend:
  16. \csname pgfplots@createlegend\endcsname
  17. \endgroup
  18. }%
  19. % makes \addlegendimage available (typically only available within an
  20. % axis environment):
  21. \def\addlegendimage{\csname pgfplots@addlegendimage\endcsname}
  22. %%--------------------------------
  23. % definition to insert numbers
  24. \pgfkeys{/pgfplots/number in legend/.style={%
  25. /pgfplots/legend image code/.code={%
  26. \node at (0.295,-0.0225){#1};
  27. },%
  28. },
  29. }
  30. \pgfdeclarelayer{background}
  31. \pgfdeclarelayer{foreground}
  32. \pgfsetlayers{background,main,foreground}
  33. \begin{tikzpicture}
  34. \tkzSetUpPoint[shape=circle,size=10,color=black,fill=black]
  35. \tkzDefPoints{0/0/A, 2/0/B, 3/0.5/C, 0/3/D, 2/3/E, 3/1.5/F, 2/2/G, 1/1.5/H}
  36. \begin{pgfonlayer}{foreground}
  37. %Get intersections
  38. \tkzInterLL(B,H)(A,C) \tkzGetPoint{I}
  39. \tkzInterLL(B,F)(A,C) \tkzGetPoint{J}
  40. \tkzInterLL(A,G)(B,H) \tkzGetPoint{K}
  41. \tkzInterLL(A,G)(H,F) \tkzGetPoint{L}
  42. \tkzInterLL(C,G)(B,F) \tkzGetPoint{M}
  43. \tkzInterLL(C,G)(H,F) \tkzGetPoint{N}
  44. \tkzInterLL(G,D)(H,E) \tkzGetPoint{O}
  45. \tkzDrawPoints[color=green,fill=green](A,C,G,D)
  46. \tkzDrawPoints[color=blue,fill=blue](B,F,E,H)
  47. \tkzDrawPoints[color=red,fill=red](I,J,K,L,M,N,O)
  48. \end{pgfonlayer}
  49. \tkzDrawPolygon[blue,very thick](H,E,F,B)
  50. \tkzDrawSegment[blue,very thick](H,F)
  51. \tkzDrawPolygon[green,very thick](A,D,G,C)
  52. \tkzDrawSegment[green,very thick](A,G)
  53. \tkzDrawSegments[red,very thick](I,M I,N I,L A,H H,D L,O N,E G,E)
  54. % \tkzLabelPoint(A){A}
  55. % \tkzLabelPoint(B){B}
  56. % \tkzLabelPoint(C){C}
  57. % \tkzLabelPoint(D){D}
  58. % \tkzLabelPoint(E){E}
  59. % \tkzLabelPoint(F){F}
  60. % \tkzLabelPoint(G){G}
  61. % \tkzLabelPoint(H){H}
  62. % \tkzLabelPoint(I){I}
  63. % \tkzLabelPoint(J){J}
  64. % \tkzLabelPoint(K){K}
  65. % \tkzLabelPoint(L){L}
  66. % \tkzLabelPoint(M){M}
  67. % \tkzLabelPoint(N){N}
  68. % \tkzLabelPoint(O){O}
  69. \begin{customlegend}[
  70. legend entries={
  71. $T_1$,
  72. $T_2$,
  73. $T$
  74. },
  75. legend style={at={(4.5,3.5)},font=\footnotesize}] % <= to define position and font legend
  76. % the following are the "images" and numbers in the legend
  77. \addlegendimage{blue,very thick}
  78. \addlegendimage{green,very thick}
  79. \addlegendimage{red,very thick}
  80. \end{customlegend}
  81. \end{tikzpicture}
  82. \end{document}