Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{tikz}
- usepackage{pgf-pie}
- begin{document}
- begin{tabular}{|p{4cm}|p{4cm}|p{4cm}|}
- $frac{1}{2}$ & $frac{2}{2}$ \
- % 1/2
- begin{tikzpicture}
- pie[rotate=90, radius=2, sum=auto, color={white,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1 }
- end{tikzpicture}
- &
- % 2/2
- begin{tikzpicture}
- pie[rotate=90, radius=2, sum=auto, color={blue,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1 }
- end{tikzpicture}
- \
- $frac{1}{3}$ & $frac{2}{3}$ & $frac{3}{3}$ \
- % 1/3
- begin{tikzpicture}
- pie[rotate=90, radius=2, sum=auto, color={white,white,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1, 1 }
- end{tikzpicture}
- &
- % 2/3
- begin{tikzpicture}
- pie[rotate=90, radius=2, sum=auto, color={white,blue,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1, 1 }
- end{tikzpicture}
- &
- % 3/3
- begin{tikzpicture}
- pie[rotate=90, radius=2, sum=auto, color={blue,blue,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1, 1 }
- end{tikzpicture}
- end{tabular}
- end{document}
- newcommand{rationalpie}[2]{
- begin{tikzpicture}
- pie[rotate=90, radius=2, sum=auto, color={white,blue,blue}, /tikz/nodes={opacity=0,overlay}] {1 , 1, 1 }
- end{tikzpicture}
- }
- rationalpie{2}{3}
- documentclass{article}
- usepackage{pgf-pie}
- usepackage{forloop}
- newtokscolors
- newtoksparts
- newcounter{parts}
- newcommandrationalpiex[2]%
- {begin{tikzpicture}
- pie[rotate=90, radius=2, sum=auto, color={#1}, /tikz/nodes={opacity=0,overlay}] {#2}
- end{tikzpicture}%
- }
- newcommandrationalpie[2]%
- {colors{}parts{}%
- forloop[-1]{parts}{#2}{value{parts} > 0}%
- {partsexpandafter{theparts1}%
- ifthenelse{value{parts} > #1}%
- {colorsexpandafter{thecolors white}}%
- {colorsexpandafter{thecolors blue}}%
- ifthenelse{value{parts} > 1}%
- {partsexpandafter{theparts,}%
- colorsexpandafter{thecolors,}%
- }%
- {}%
- }%
- edefrationalpiexx{noexpandrationalpiex{thecolors}{theparts}}%
- rationalpiexx
- }
- begin{document}
- begin{tabular}{|p{4cm}|p{4cm}|p{4cm}|}
- $frac12$ & $frac22$ \
- rationalpie12 & rationalpie22 \
- $frac13$ & $frac23$ & $frac33$ \
- rationalpie13 & rationalpie23 & rationalpie33
- end{tabular}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement