-
Notifications
You must be signed in to change notification settings - Fork 16
/
dot-grid.sty
106 lines (93 loc) · 2.35 KB
/
dot-grid.sty
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
% dot-grid.sty
\ProvidesPackage{dot-grid}[2017/08/11 Dot Grid Paper]
% Load packages
\RequirePackage{geometry}
\RequirePackage{tikz}
\RequirePackage{xcolor}
%% Global landscape option
\newif\if@dotlandscape\@dotlandscapefalse
\DeclareOption{landscape}{\@dotlandscapetrue}
%% Global DIN A4 option
\newif\if@dotdinafour\@dotdinafourfalse
\DeclareOption{a4paper}{\@dotdinafourtrue}
%% Global DIN A6 option
\newif\if@dotdinasix\@dotdinasixfalse
\DeclareOption{a6paper}{\@dotdinasixtrue}
%% 'dotmargin' option
\newif\if@dotmargin\@dotmarginfalse
\DeclareOption{dotmargin}{\@dotmargintrue}
%% 'dotfull' option
\DeclareOption{dotfull}{\@dotmarginfalse}
\ProcessOptions\relax
% Set fixed margins
\geometry{right=0in, bottom=0in, left=0.24in, nohead, nofoot}
% Calculate margins and number of dots based on options and orientation
\if@dotlandscape
\if@dotmargin
% landscape with margin
\geometry{top=0.74in}
\def\@dotnumx{43}
\def\@dotnumy{31}
\else
% landscape without margin
\geometry{top=0.24in}
\def\@dotnumx{43}
\def\@dotnumy{33}
\fi
\else
\if@dotdinafour
\if@dotmargin
% A4 with margin
\geometry{top=0.74in}
\def\@dotnumx{32}
\def\@dotnumy{43}
\else
% A4 without margin
\geometry{top=0.24in}
\def\@dotnumx{32}
\def\@dotnumy{46}
\fi
\else
\if@dotdinasix
\if@dotmargin
% A6 with margin
\geometry{top=0.74in}
\def\@dotnumx{15}
\def\@dotnumy{20}
\else
% A6 without margin
\geometry{top=0.24in}
\def\@dotnumx{15}
\def\@dotnumy{22}
\fi
\else
\if@dotmargin
% portrait with margin
\geometry{top=0.74in}
\def\@dotnumx{33}
\def\@dotnumy{41}
\else
% portrait without margin
\geometry{top=0.24in}
\def\@dotnumx{33}
\def\@dotnumy{43}
\fi
\fi
\fi
\fi
% Avoid initial horizontal space
\setlength\parindent{0pt}
% No page numbers
\pagestyle{empty}
% Colors
\definecolor{white}{RGB}{255,255,255}
\definecolor{antique}{RGB}{255,255,244}
\definecolor{dotcolor}{RGB}{204,204,198}
% Define dot grid macro
\newcommand{\dotgrid}{\begin{tikzpicture}[x=0.25in, y=0.25in]
\foreach \x in {1, ..., \@dotnumx}{
\foreach \y in {1, ..., \@dotnumy}{
\fill[dotcolor] (\x,\y) circle[radius=0.01in];
}
}
\end{tikzpicture}}