Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. documentclass{article}
  2.  
  3. usepackage{tikz}
  4. usepackage{pgf-pie}
  5.  
  6. begin{document}
  7.  
  8. begin{tabular}{|p{4cm}|p{4cm}|p{4cm}|}
  9.  
  10. $frac{1}{2}$ & $frac{2}{2}$ \
  11.  
  12. % 1/2
  13. begin{tikzpicture}
  14.  
  15. pie[rotate=90, radius=2, sum=auto, color={white,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1 }
  16.  
  17. end{tikzpicture}
  18.  
  19. &
  20.  
  21. % 2/2
  22. begin{tikzpicture}
  23.  
  24. pie[rotate=90, radius=2, sum=auto, color={blue,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1 }
  25.  
  26. end{tikzpicture}
  27.  
  28. \
  29.  
  30. $frac{1}{3}$ & $frac{2}{3}$ & $frac{3}{3}$ \
  31.  
  32.  
  33. % 1/3
  34. begin{tikzpicture}
  35.  
  36. pie[rotate=90, radius=2, sum=auto, color={white,white,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1, 1 }
  37.  
  38. end{tikzpicture}
  39.  
  40. &
  41.  
  42. % 2/3
  43. begin{tikzpicture}
  44.  
  45. pie[rotate=90, radius=2, sum=auto, color={white,blue,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1, 1 }
  46.  
  47. end{tikzpicture}
  48.  
  49. &
  50.  
  51. % 3/3
  52. begin{tikzpicture}
  53.  
  54. pie[rotate=90, radius=2, sum=auto, color={blue,blue,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1, 1 }
  55.  
  56. end{tikzpicture}
  57.  
  58.  
  59. end{tabular}
  60.  
  61. end{document}
  62.  
  63. newcommand{rationalpie}[2]{
  64. begin{tikzpicture}
  65.  
  66. pie[rotate=90, radius=2, sum=auto, color={white,blue,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1, 1 }
  67.  
  68. end{tikzpicture}
  69. }
  70.  
  71. rationalpie{2}{3}
  72.  
  73. documentclass{article}
  74. usepackage{pgf-pie}
  75. usepackage{forloop}
  76. newtokscolors
  77. newtoksparts
  78. newcounter{parts}
  79. newcommandrationalpiex[2]%
  80. {begin{tikzpicture}
  81. pie[rotate=90, radius=2, sum=auto, color={#1}, /tikz/nodes={opacity=0,overlay}] {#2}
  82. end{tikzpicture}%
  83. }
  84. newcommandrationalpie[2]%
  85. {colors{}parts{}%
  86. forloop[-1]{parts}{#2}{value{parts} > 0}%
  87. {partsexpandafter{theparts1}%
  88. ifthenelse{value{parts} > #1}%
  89. {colorsexpandafter{thecolors white}}%
  90. {colorsexpandafter{thecolors blue}}%
  91. ifthenelse{value{parts} > 1}%
  92. {partsexpandafter{theparts,}%
  93. colorsexpandafter{thecolors,}%
  94. }%
  95. {}%
  96. }%
  97. edefrationalpiexx{noexpandrationalpiex{thecolors}{theparts}}%
  98. rationalpiexx
  99. }
  100.  
  101. begin{document}
  102. begin{tabular}{|p{4cm}|p{4cm}|p{4cm}|}
  103. $frac12$ & $frac22$ \
  104. rationalpie12 & rationalpie22 \
  105. $frac13$ & $frac23$ & $frac33$ \
  106. rationalpie13 & rationalpie23 & rationalpie33
  107. end{tabular}
  108. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement