Guest User

Untitled

a guest
Sep 17th, 2018
160
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. \documentclass{standalone}
  2. \usepackage{xcolor}
  3. \usepackage{tikz}
  4. \usetikzlibrary{matrix}
  5. \usetikzlibrary{shapes}
  6. \tikzset{%
  7. dot hidden/.style={},
  8. line hidden/.style={},
  9. dot colour/.style={dot hidden/.append style={color=#1}},
  10. dot colour/.default=black,
  11. line colour/.style={line hidden/.append style={color=#1}},
  12. line colour/.default=black,
  13. }%
  14. \usepackage{xparse}
  15. \NewDocumentCommand{\drawdie}{O{}m}{%
  16. \begin{tikzpicture}[x=1cm,y=1cm,radius=0.1,#1]
  17. \draw[rounded corners=1,line hidden] (0,0) rectangle (1,1);
  18. \ifodd#2
  19. \fill[dot hidden] (0.5,0.5) circle;
  20. \fi
  21. \ifnum#2>1
  22. \fill[dot hidden] (0.2,0.2) circle;
  23. \fill[dot hidden] (0.8,0.8) circle;
  24. \ifnum#2>3
  25. \fill[dot hidden] (0.2,0.8) circle;
  26. \fill[dot hidden] (0.8,0.2) circle;
  27. \ifnum#2>5
  28. \fill[dot hidden] (0.8,0.5) circle;
  29. \fill[dot hidden] (0.2,0.5) circle;
  30. \ifnum#2>7
  31. \fill[dot hidden] (0.5,0.8) circle;
  32. \fill[dot hidden] (0.5,0.2) circle;
  33. \fi
  34. \fi
  35. \fi
  36. \fi
  37. \end{tikzpicture}%
  38. }%
  39.  
  40. \newcommand{\dieA}[1]{%
  41. \drawdie[color=black, line hidden/.append style={fill=red!70}]{#1}}
  42.  
  43. \newcommand{\dieB}[1]{%
  44. \drawdie[color=black, line hidden/.append style={fill=blue!50}]{#1}}
  45.  
  46. \begin{document}
  47. \begin{tikzpicture}
  48. \matrix[matrix of nodes,nodes={rectangle,align=center}]{%
  49. & \dieA{1} & \\
  50. \dieA{2} & \dieA{2} & \dieA{3} \\
  51. & \dieA{4} & \\
  52. & \dieA{3} & \\
  53. };
  54. \end{tikzpicture}
  55. \begin{tikzpicture}
  56. \matrix[matrix of nodes,nodes={rectangle,align=center}]{%
  57. & \dieB{1} & \\
  58. \dieB{6} & \dieB{4} & \dieB{3} \\
  59. & \dieB{8} & \\
  60. & \dieB{5} & \\
  61. };
  62. \end{tikzpicture}
  63. \end{document}
RAW Paste Data