From 06e19c0db24d4c527f82ed934ecb56228ea0aee8 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Fri, 18 May 2018 22:53:34 +0000 Subject: Initial commit --- figs/libs/Makefile | 27 +++++++++++++++++++++++++++ figs/libs/grid.sty | 24 ++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 figs/libs/Makefile create mode 100644 figs/libs/grid.sty (limited to 'figs/libs') diff --git a/figs/libs/Makefile b/figs/libs/Makefile new file mode 100644 index 0000000..4cabe06 --- /dev/null +++ b/figs/libs/Makefile @@ -0,0 +1,27 @@ +PROJECTNAME=$(basename $(basename $(wildcard *.tikz.tex))) +LIBS=$(notdir $(wildcard libs/*)) + +PDFS=$(addsuffix .pdf, $(PROJECTNAME)) + +all: $(PDFS) + +$(PDFS): $(LIBS) + pdflatex -jobname $(basename $@) -file-line-error $(patsubst %.pdf, %.tikz.tex, $@) + +install: $(PDFS) + cp $^ $(INSTALLDIR)/ + +$(LIBS): + ln -fs libs/$@ ./ + +clean-libs: + rm -f $(LIBS) + +clean-aux: + rm -f $(addsuffix .aux, $(PROJECTNAME)) + rm -f $(addsuffix .log, $(PROJECTNAME)) + +clean-tex: + rm -f $(PDFS) + +clean: clean-libs clean-aux clean-tex diff --git a/figs/libs/grid.sty b/figs/libs/grid.sty new file mode 100644 index 0000000..495bc80 --- /dev/null +++ b/figs/libs/grid.sty @@ -0,0 +1,24 @@ +% light gray color +\definecolor{lightgray}{gray}{0.7} + +% a grid with starting from #1 mesh #2 of width #3*#2 and height #4*#2 +\def\grid#1#2#3#4{ + % vertical lines + \foreach\i in{0,...,#3}{ + \draw[color=lightgray]#1++(\i*#2,0)--++(0,#4*#2); + } + % horizontal lines + \foreach\j in{0,...,#4}{ + \draw[color=lightgray]#1++(0,\j*#2)--++(#3*#2,0); + } +} + +% a square centered at #1 of side #2 +\def\square#1#2{ + \draw#1++(-0.5*#2,-0.5*#2)--++(#2,0)--++(0,#2)--++(-#2,0)--cycle; +} + +% fill a square centered at #1 of side #2 and color #3 +\def\fillsquare#1#2#3{ + \fill[color=#3]#1++(-0.5*#2,-0.5*#2)--++(#2,0)--++(0,#2)--++(-#2,0)--cycle; +} -- cgit v1.2.3-54-g00ecf