From 1b13e14750d355b301dc3904702268687216608c Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Thu, 4 May 2017 19:16:34 +0000 Subject: Initial commit --- figs/libs/shapes.sty | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 figs/libs/shapes.sty (limited to 'figs/libs/shapes.sty') diff --git a/figs/libs/shapes.sty b/figs/libs/shapes.sty new file mode 100644 index 0000000..9e4633b --- /dev/null +++ b/figs/libs/shapes.sty @@ -0,0 +1,35 @@ +% square lattice (width #1, height #2, origin #3) +\def\grid#1#2#3{ + \foreach\i in {0,...,#2}{ + \draw#3++(0,\i)--++(#1,0); + } + \foreach\i in {0,...,#1}{ + \draw#3++(\i,0)--++(0,#2); + } +} + + +% cross (color #1, position #2) +\def\cross#1#2{ + \fill[color=#1]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); + \draw[color=black]#2++(0.5,0.5)--++(0,1)--++(-1,0)--++(0,-1)--++(-1,0)--++(0,-1)--++(1,0)--++(0,-1)--++(1,0)--++(0,1)--++(1,0)--++(0,1)--++(-1,0); +} + + +% 1x1 square (color #1, position #2) +\def\square#1#2{ + \fill[color=#1]#2++(-0.5,-0.5)--++(0,1)--++(1,0)--++(0,-1)--cycle; + \draw[color=black]#2++(-0.5,-0.5)--++(0,1)--++(1,0)--++(0,-1)--cycle; +} + +% 2x2 square (color #1, position #2) +\def\ttsquare#1#2{ + \fill[color=#1]#2++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle; + \draw[color=black]#2++(-1,-1)--++(0,2)--++(2,0)--++(0,-2)--cycle; +} + +% diamond (color #1, position #2) +\def\diamond#1#2{ + \fill[color=#1]#2++(0,-1)--++(1,1)--++(-1,1)--++(-1,-1)--cycle; + \draw[color=black]#2++(0,-1)--++(1,1)--++(-1,1)--++(-1,-1)--cycle; +} -- cgit v1.2.3-70-g09d2