Ian Jauslin
summaryrefslogtreecommitdiff
blob: dd4baae450f7db1507bc1e80750371ad341d5007 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
%%
%% Various shapes and lattices
%%

%% TeX format
\NeedsTeXFormat{LaTeX2e}[1995/12/01]

%% class name
\ProvidesPackage{shapes}[2017/06/24]


% 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);
}

% thick cross (color #1, position #2, size #3)
\def\thickcross#1#2#3{
  \fill[color=#1]#2++(#3*0.5,0.5*#3)--++(#3*0,1*#3)--++(#3*-1,0*#3)--++(#3*0,-1*#3)--++(#3*-1,0*#3)--++(#3*0,-1*#3)--++(#3*1,0*#3)--++(#3*0,-1*#3)--++(#3*1,0*#3)--++(#3*0,1*#3)--++(#3*1,0*#3)--++(#3*0,1*#3)--++(#3*-1,0*#3);
  \draw[color=black]#2++(#3*0.5,0.5*#3)--++(#3*0,1*#3)--++(#3*-1,0*#3)--++(#3*0,-1*#3)--++(#3*-1,0*#3)--++(#3*0,-1*#3)--++(#3*1,0*#3)--++(#3*0,-1*#3)--++(#3*1,0*#3)--++(#3*0,1*#3)--++(#3*1,0*#3)--++(#3*0,1*#3)--++(#3*-1,0*#3);
}


% 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;
}
\def\ttsquareempty#1{
  \draw[color=black]#1++(-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;
}


\endinput