├── examples ├── gridpapers.sty ├── .gitignore ├── dot-grid-10spi.tex ├── graph-paper.tex ├── hex-grid-large.tex ├── isometric-grid.tex ├── graph-paper-8spi.tex ├── quadrille-10spi.tex ├── quadrille-8spi.tex ├── triangular-grid.tex ├── template-default.notex ├── grid-with-light-cones.tex ├── dot-grid-5spi.tex ├── engineer-pad.tex ├── red-graph.tex ├── hex-grid-small.tex ├── plum-graph-paper.tex ├── precocious-young-engineer.tex ├── engineer-paper-8spi.tex ├── template-complex.notex ├── hex-engineer-letterpaper-fullpage.tex ├── custom-colors.tex ├── make-examples.sh └── Makefile ├── for-CTAN ├── gridpapers │ ├── gridpapers.dtx │ ├── gridpapers.ins │ ├── examples │ │ ├── red-graph.tex │ │ ├── graph-paper.tex │ │ ├── custom-colors.tex │ │ ├── dot-grid-10spi.tex │ │ ├── dot-grid-5spi.tex │ │ ├── engineer-pad.tex │ │ ├── hex-grid-large.tex │ │ ├── hex-grid-small.tex │ │ ├── isometric-grid.tex │ │ ├── quadrille-8spi.tex │ │ ├── graph-paper-8spi.tex │ │ ├── plum-graph-paper.tex │ │ ├── quadrille-10spi.tex │ │ ├── triangular-grid.tex │ │ ├── engineer-paper-8spi.tex │ │ ├── grid-with-light-cones.tex │ │ ├── precocious-young-engineer.tex │ │ └── hex-engineer-letterpaper-fullpage.tex │ └── README.md ├── .gitignore ├── make-CTAN-zip.sh ├── file-list └── building-for-CTAN.txt ├── graph paper.tex ├── LICENSE ├── .github └── workflows │ └── pdflatex-examples.yml ├── gridpapers.ins ├── .gitignore ├── README.md ├── gridpapers.sty └── gridpapers.dtx /examples/gridpapers.sty: -------------------------------------------------------------------------------- 1 | ../gridpapers.sty -------------------------------------------------------------------------------- /for-CTAN/gridpapers/gridpapers.dtx: -------------------------------------------------------------------------------- 1 | ../../gridpapers.dtx -------------------------------------------------------------------------------- /for-CTAN/gridpapers/gridpapers.ins: -------------------------------------------------------------------------------- 1 | ../../gridpapers.ins -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | *-*-*-fullpage.tex 2 | *-*-*-textarea.tex 3 | -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/red-graph.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/red-graph.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/graph-paper.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/graph-paper.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/custom-colors.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/custom-colors.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/dot-grid-10spi.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/dot-grid-10spi.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/dot-grid-5spi.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/dot-grid-5spi.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/engineer-pad.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/engineer-pad.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/hex-grid-large.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/hex-grid-large.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/hex-grid-small.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/hex-grid-small.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/isometric-grid.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/isometric-grid.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/quadrille-8spi.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/quadrille-8spi.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/graph-paper-8spi.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/graph-paper-8spi.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/plum-graph-paper.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/plum-graph-paper.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/quadrille-10spi.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/quadrille-10spi.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/triangular-grid.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/triangular-grid.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/engineer-paper-8spi.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/engineer-paper-8spi.tex -------------------------------------------------------------------------------- /for-CTAN/.gitignore: -------------------------------------------------------------------------------- 1 | gridpapers.zip 2 | gridpapers/gridpapers.pdf 3 | gridpapers/gridpapers.sty 4 | -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/grid-with-light-cones.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/grid-with-light-cones.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/precocious-young-engineer.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/precocious-young-engineer.tex -------------------------------------------------------------------------------- /for-CTAN/gridpapers/examples/hex-engineer-letterpaper-fullpage.tex: -------------------------------------------------------------------------------- 1 | ../../../examples/hex-engineer-letterpaper-fullpage.tex -------------------------------------------------------------------------------- /graph paper.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=std]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/dot-grid-10spi.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=dot]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/graph-paper.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=std]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/hex-grid-large.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=hex]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/isometric-grid.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=iso]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/graph-paper-8spi.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=majmin]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/quadrille-10spi.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=std]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/quadrille-8spi.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=stdeight]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/triangular-grid.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=tri]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/template-default.notex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=%PATTERN%]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/grid-with-light-cones.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=lightcone]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/dot-grid-5spi.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=dot, patternsize=0.2in]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/engineer-pad.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=majmin, colorset=engineer]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/red-graph.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=majmin, colorset=brickred]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/hex-grid-small.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=hex, patternsize=0.0833in]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/plum-graph-paper.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=majmin, colorset=plumpad]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/precocious-young-engineer.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=majmin, colorset=precocious]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/engineer-paper-8spi.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=majmin, colorset=engineer, bgcolor=white]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/template-complex.notex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=%PATTERN%, colorset=%COLORSET%, %AREA%, geometry={%PAPERSIZE%}]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /examples/hex-engineer-letterpaper-fullpage.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage[pattern=hex, colorset=engineer, fullpage, geometry={letterpaper}]{gridpapers} 4 | 5 | \begin{document} 6 | \thispagestyle{empty} 7 | ~ 8 | \end{document} 9 | -------------------------------------------------------------------------------- /for-CTAN/make-CTAN-zip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_PATH=${0%/*} 4 | if [ "$0" != "$SCRIPT_PATH" ] && [ "$SCRIPT_PATH" != "" ]; then 5 | cd $SCRIPT_PATH 6 | fi 7 | 8 | cd gridpapers 9 | 10 | yes | pdflatex gridpapers.ins 11 | 12 | pdflatex gridpapers.dtx 13 | makeindex -s gglo.ist -o gridpapers.gls gridpapers.glo 14 | pdflatex gridpapers.dtx 15 | pdflatex gridpapers.dtx 16 | 17 | cd .. 18 | 19 | cat file-list | xargs zip gridpapers.zip 20 | -------------------------------------------------------------------------------- /examples/custom-colors.tex: -------------------------------------------------------------------------------- 1 | \documentclass{article} 2 | 3 | \usepackage{xcolor} 4 | 5 | % See the documentation of the xcolor package to learn about different 6 | % color models for specifying colors 7 | \definecolor{mydeepgreen}{rgb}{0.07, 0.56, 0.04} 8 | 9 | % You can easily mix colors by using the ! syntax from xcolor. Here 10 | % we use it to mix 40% of our color with 60% white. 11 | \usepackage[pattern=majmin, 12 | majorcolor=mydeepgreen, 13 | minorcolor={mydeepgreen!40}]{gridpapers} 14 | 15 | \begin{document} 16 | \thispagestyle{empty} 17 | ~ 18 | \end{document} 19 | -------------------------------------------------------------------------------- /examples/make-examples.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for pat in `grep -A1 "Allowed values for pattern" gridpapers.sty | tail -n1 | cut -d\{ -f2 | cut -d\} -f1 | tr , ' '`; do 4 | for col in `grep -A1 "Allowed values for colorset" gridpapers.sty | tail -n1 | cut -d\{ -f2 | cut -d\} -f1 | tr , ' '`; do 5 | for paper in letterpaper a4paper; do 6 | for area in fullpage textarea; do 7 | sed -e "s/%PATTERN%/${pat}/" \ 8 | -e "s/%COLORSET%/${col}/" \ 9 | -e "s/%PAPERSIZE%/${paper}/" \ 10 | -e "s/%AREA%/${area}/" \ 11 | template-complex.notex > ${pat}-${col}-${paper}-${area}.tex 12 | done 13 | done 14 | done 15 | sed -e "s/%PATTERN%/${pat}/" \ 16 | template-default.notex > ${pat}-default.tex 17 | done 18 | -------------------------------------------------------------------------------- /for-CTAN/file-list: -------------------------------------------------------------------------------- 1 | gridpapers/README.md 2 | gridpapers/gridpapers.dtx 3 | gridpapers/gridpapers.ins 4 | gridpapers/gridpapers.pdf 5 | gridpapers/examples/custom-colors.tex 6 | gridpapers/examples/dot-grid-10spi.tex 7 | gridpapers/examples/dot-grid-5spi.tex 8 | gridpapers/examples/engineer-pad.tex 9 | gridpapers/examples/engineer-paper-8spi.tex 10 | gridpapers/examples/graph-paper-8spi.tex 11 | gridpapers/examples/graph-paper.tex 12 | gridpapers/examples/grid-with-light-cones.tex 13 | gridpapers/examples/hex-engineer-letterpaper-fullpage.tex 14 | gridpapers/examples/hex-grid-large.tex 15 | gridpapers/examples/hex-grid-small.tex 16 | gridpapers/examples/isometric-grid.tex 17 | gridpapers/examples/plum-graph-paper.tex 18 | gridpapers/examples/precocious-young-engineer.tex 19 | gridpapers/examples/quadrille-10spi.tex 20 | gridpapers/examples/quadrille-8spi.tex 21 | gridpapers/examples/red-graph.tex 22 | gridpapers/examples/triangular-grid.tex 23 | -------------------------------------------------------------------------------- /for-CTAN/building-for-CTAN.txt: -------------------------------------------------------------------------------- 1 | I first converted the original .sty to a .dtx using sty2dtx, as 2 | documented in the run_sty2dtx.sh shell script. That ran: 3 | 4 | sty2dtx --author="Robert McNees, Leo C. Stein" \ 5 | --email="rmcnees@luc.edu, leo.stein@gmail.com" \ 6 | --year=2021 --date="2021/03/13" \ 7 | --version=v1.0.0 \ 8 | --description="Graph paper backgrounds" \ 9 | -O -I gridpapers.sty gridpapers.dtx 10 | 11 | I then massaged some stuff in the generated .dtx and .ins files, 12 | because they had some stuff I didn't want. 13 | 14 | To generate the .sty from the .dtx, we run: 15 | pdflatex gridpapers.ins 16 | 17 | To generate the documentation from the .dtx, we run: 18 | pdflatex gridpapers.dtx 19 | makeindex -s gglo.ist -o gridpapers.gls gridpapers.glo (to make the glossary, i.e. the changelog) 20 | makeindex -s gind.ist -o gridpapers.ind gridpapers.idx (to make the index of commands BUT WE DON'T) 21 | pdflatex gridpapers.dtx 22 | pdflatex gridpapers.dtx 23 | 24 | TODO: What goes into the .tar.gz to upload to CTAN? 25 | -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | LATEX = pdflatex -interaction=nonstopmode 2 | 3 | SOURCES = $(wildcard *.tex) 4 | SOURCESDEFAULT = $(wildcard *-default.tex) 5 | 6 | PDFS = $(SOURCES:.tex=.pdf) 7 | PDFSDEFAULT = $(SOURCESDEFAULT:.tex=.pdf) 8 | 9 | JPGS = $(SOURCES:.tex=.jpg) 10 | 11 | .PHONY: warn all tex-examples default jpegs 12 | 13 | warn: 14 | @echo "My default action is just to emit this message." 15 | @echo "Are you sure you want to build _all_ PDFs?" 16 | @echo "If so, use 'make all' to build all *.tex files in this directory." 17 | @echo "Run 'make tex-examples' to make the *.tex files from a template." 18 | @echo "Run 'make default' to compile only the *-default.tex files." 19 | 20 | all: $(PDFS) 21 | 22 | default: $(PDFSDEFAULT) 23 | 24 | tex-examples: 25 | ./make-examples.sh 26 | 27 | %.pdf: %.tex 28 | $(LATEX) $< 29 | $(LATEX) $< 30 | 31 | jpegs: $(JPGS) 32 | 33 | %.jpg: %.pdf 34 | convert -density 144 $< -quality 90 -crop 320x320-32-32\! -background gray -flatten $@ 35 | 36 | .PHONY: clean reallyclean 37 | 38 | clean: 39 | rm -f *.aux *.log *.synctex.gz *~ 40 | 41 | reallyclean: clean 42 | rm -f *-*-*-*.tex 43 | rm -f *-*-*-*.pdf 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | LPPL License 1.3c 2 | 3 | Copyright (C) 2021 Robert McNees , Leo C. Stein 4 | 5 | This work may be distributed and/or modified under the 6 | conditions of the LaTeX Project Public License, either version 1.3 7 | of this license or (at your option) any later version. 8 | The latest version of this license is in 9 | http://www.latex-project.org/lppl.txt 10 | and version 1.3 or later is part of all distributions of LaTeX 11 | version 2005/12/01 or later. 12 | 13 | This work has the LPPL maintenance status `maintained'. 14 | 15 | The Current Maintainers of this work are Robert McNees and Leo C. Stein. 16 | 17 | This work consists of the files: 18 | gridpapers.dtx 19 | gridpapers.ins 20 | gridpapers.sty (the derived filebase) 21 | examples/ 22 | custom-colors.tex 23 | dot-grid-10spi.tex 24 | dot-grid-5spi.tex 25 | engineer-pad.tex 26 | engineer-paper-8spi.tex 27 | graph-paper-8spi.tex 28 | graph-paper.tex 29 | grid-with-light-cones.tex 30 | hex-engineer-letterpaper-fullpage.tex 31 | hex-grid-large.tex 32 | hex-grid-small.tex 33 | isometric-grid.tex 34 | plum-graph-paper.tex 35 | precocious-young-engineer.tex 36 | quadrille-10spi.tex 37 | quadrille-8spi.tex 38 | red-graph.tex 39 | triangular-grid.tex 40 | -------------------------------------------------------------------------------- /.github/workflows/pdflatex-examples.yml: -------------------------------------------------------------------------------- 1 | name: Build examples 2 | on: 3 | push: 4 | branches-ignore: 5 | - 'gh-action-result/examples' 6 | jobs: 7 | build_latex: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Set up Git repository 11 | uses: actions/checkout@v2 12 | - name: Compile LaTeX document 13 | uses: xu-cheng/latex-action@v2 14 | with: 15 | working_directory: examples 16 | root_file: | 17 | dot-grid-10spi.tex 18 | dot-grid-5spi.tex 19 | engineer-pad.tex 20 | engineer-paper-8spi.tex 21 | graph-paper-8spi.tex 22 | graph-paper.tex 23 | grid-with-light-cones.tex 24 | hex-grid-large.tex 25 | hex-grid-small.tex 26 | isometric-grid.tex 27 | plum-graph-paper.tex 28 | precocious-young-engineer.tex 29 | quadrille-10spi.tex 30 | quadrille-8spi.tex 31 | red-graph.tex 32 | triangular-grid.tex 33 | - name: Commit to orphan branch 34 | run: | 35 | git checkout --orphan gh-action-result/examples 36 | git rm -rf . 37 | zip pdfs.zip examples/*.pdf 38 | git add pdfs.zip 39 | git -c user.name='GitHub Action' -c user.email='action@github.com' commit -m "Built examples" 40 | - name: Push changes 41 | uses: ad-m/github-push-action@master 42 | with: 43 | github_token: ${{ secrets.GITHUB_TOKEN }} 44 | branch: gh-action-result/examples 45 | force: true 46 | -------------------------------------------------------------------------------- /gridpapers.ins: -------------------------------------------------------------------------------- 1 | %% Copyright (C) 2021 by Robert McNees , Leo C. Stein 2 | %% -------------------------------------------------------------------------- 3 | %% This work may be distributed and/or modified under the 4 | %% conditions of the LaTeX Project Public License, either version 1.3 5 | %% of this license or (at your option) any later version. 6 | %% The latest version of this license is in 7 | %% http://www.latex-project.org/lppl.txt 8 | %% and version 1.3 or later is part of all distributions of LaTeX 9 | %% version 2005/12/01 or later. 10 | %% 11 | %% This work has the LPPL maintenance status `maintained'. 12 | %% 13 | %% The Current Maintainers of this work are Robert McNees, Leo C. Stein. 14 | %% 15 | %% This work consists of the files gridpapers.dtx and gridpapers.ins 16 | %% and the derived filebase gridpapers.sty. 17 | %% 18 | 19 | \input docstrip.tex 20 | \keepsilent 21 | 22 | \usedir{tex/latex/gridpapers} 23 | 24 | \preamble 25 | 26 | This is a generated file. 27 | 28 | Copyright (C) 2021 by Robert McNees , Leo C. Stein 29 | -------------------------------------------------------------------------- 30 | This work may be distributed and/or modified under the 31 | conditions of the LaTeX Project Public License, either version 1.3 32 | of this license or (at your option) any later version. 33 | The latest version of this license is in 34 | http://www.latex-project.org/lppl.txt 35 | and version 1.3 or later is part of all distributions of LaTeX 36 | version 2005/12/01 or later. 37 | 38 | \endpreamble 39 | 40 | \generate{\file{gridpapers.sty}{\from{gridpapers.dtx}{package}}} 41 | 42 | \obeyspaces 43 | \Msg{*************************************************************} 44 | \Msg{* *} 45 | \Msg{* To finish the installation you have to move the following *} 46 | \Msg{* file into a directory searched by TeX: *} 47 | \Msg{* *} 48 | \Msg{* gridpapers.sty *} 49 | \Msg{* *} 50 | \Msg{* To produce the documentation run the file gridpapers.dtx *} 51 | \Msg{* through LaTeX. *} 52 | \Msg{* *} 53 | \Msg{* Happy TeXing! *} 54 | \Msg{* *} 55 | \Msg{*************************************************************} 56 | 57 | \endbatchfile 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## The PDF we are generating: 2 | graph paper.pdf 3 | 4 | ## Core latex/pdflatex auxiliary files: 5 | *.aux 6 | *.lof 7 | *.log 8 | *.lot 9 | *.fls 10 | *.out 11 | *.toc 12 | *.fmt 13 | *.fot 14 | *.cb 15 | *.cb2 16 | 17 | ## Intermediate documents: 18 | *.dvi 19 | *-converted-to.* 20 | # these rules might exclude image files for figures etc. 21 | # *.ps 22 | # *.eps 23 | # *.pdf 24 | 25 | ## Generated if empty string is given at "Please type another file name for output:" 26 | .pdf 27 | 28 | ## Bibliography auxiliary files (bibtex/biblatex/biber): 29 | *.bbl 30 | *.bcf 31 | *.blg 32 | *-blx.aux 33 | *-blx.bib 34 | *.brf 35 | *.run.xml 36 | 37 | ## Build tool auxiliary files: 38 | *.fdb_latexmk 39 | *.synctex 40 | *.synctex(busy) 41 | *.synctex.gz 42 | *.synctex.gz(busy) 43 | *.pdfsync 44 | 45 | ## Auxiliary and intermediate files from other packages: 46 | # algorithms 47 | *.alg 48 | *.loa 49 | 50 | # achemso 51 | acs-*.bib 52 | 53 | # amsthm 54 | *.thm 55 | 56 | # beamer 57 | *.nav 58 | *.pre 59 | *.snm 60 | *.vrb 61 | 62 | # changes 63 | *.soc 64 | 65 | # cprotect 66 | *.cpt 67 | 68 | # elsarticle (documentclass of Elsevier journals) 69 | *.spl 70 | 71 | # endnotes 72 | *.ent 73 | 74 | # fixme 75 | *.lox 76 | 77 | # feynmf/feynmp 78 | *.mf 79 | *.mp 80 | *.t[1-9] 81 | *.t[1-9][0-9] 82 | *.tfm 83 | *.[1-9] 84 | *.[1-9][0-9] 85 | 86 | #(r)(e)ledmac/(r)(e)ledpar 87 | *.end 88 | *.?end 89 | *.[1-9] 90 | *.[1-9][0-9] 91 | *.[1-9][0-9][0-9] 92 | *.[1-9]R 93 | *.[1-9][0-9]R 94 | *.[1-9][0-9][0-9]R 95 | *.eledsec[1-9] 96 | *.eledsec[1-9]R 97 | *.eledsec[1-9][0-9] 98 | *.eledsec[1-9][0-9]R 99 | *.eledsec[1-9][0-9][0-9] 100 | *.eledsec[1-9][0-9][0-9]R 101 | 102 | # glossaries 103 | *.acn 104 | *.acr 105 | *.glg 106 | *.glo 107 | *.gls 108 | *.glsdefs 109 | 110 | # gnuplottex 111 | *-gnuplottex-* 112 | 113 | # gregoriotex 114 | *.gaux 115 | *.gtex 116 | 117 | # hyperref 118 | *.brf 119 | 120 | # knitr 121 | *-concordance.tex 122 | # TODO Comment the next line if you want to keep your tikz graphics files 123 | *.tikz 124 | *-tikzDictionary 125 | 126 | # listings 127 | *.lol 128 | 129 | # makeidx 130 | *.idx 131 | *.ilg 132 | *.ind 133 | *.ist 134 | 135 | # minitoc 136 | *.maf 137 | *.mlf 138 | *.mlt 139 | *.mtc[0-9]* 140 | 141 | # minted 142 | _minted* 143 | *.pyg 144 | 145 | # morewrites 146 | *.mw 147 | 148 | # mylatexformat 149 | *.fmt 150 | 151 | # nomencl 152 | *.nlo 153 | 154 | # pax 155 | *.pax 156 | 157 | # sagetex 158 | *.sagetex.sage 159 | *.sagetex.py 160 | *.sagetex.scmd 161 | 162 | # scrwfile 163 | *.wrt 164 | 165 | # sympy 166 | *.sout 167 | *.sympy 168 | sympy-plots-for-*.tex/ 169 | 170 | # pdfcomment 171 | *.upa 172 | *.upb 173 | 174 | # pythontex 175 | *.pytxcode 176 | pythontex-files-*/ 177 | 178 | # thmtools 179 | *.loe 180 | 181 | # TikZ & PGF 182 | *.dpth 183 | *.md5 184 | *.auxlock 185 | 186 | # todonotes 187 | *.tdo 188 | 189 | # easy-todo 190 | *.lod 191 | 192 | # xindy 193 | *.xdy 194 | 195 | # xypic precompiled matrices 196 | *.xyc 197 | 198 | # endfloat 199 | *.ttt 200 | *.fff 201 | 202 | # Latexian 203 | TSWLatexianTemp* 204 | 205 | ## Editors: 206 | # WinEdt 207 | *.bak 208 | *.sav 209 | 210 | # Texpad 211 | .texpadtmp 212 | 213 | # Kile 214 | *.backup 215 | 216 | # KBibTeX 217 | *~[0-9]* 218 | 219 | # auto folder when using emacs and auctex 220 | /auto/* 221 | 222 | # expex forward references with \gathertags 223 | *-tags.tex 224 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Build examples](../../actions/workflows/pdflatex-examples.yml/badge.svg) 2 | [![Latest Zip of PDFs](https://img.shields.io/badge/Zip_of_PDFs-latest-orange.svg?style=flat)](../gh-action-result/examples/pdfs.zip?raw=true) 3 | 4 | # Graph papers in LaTeX: the *gridpapers* package 5 | Make your own quadrille, graph, hex, etc. paper! Uses the [PGF/TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) package for LaTeX, which should be part of any modern TeX installation. All colors and spacing are customizable. 6 | 7 | Once you clone or download the repo, simply run latex twice on the 8 | file "graph paper.tex" to produce a pdf. From the command line, type: 9 | 10 | pdflatex "graph paper.tex" 11 | 12 | There are more example .tex files in the [examples 13 | directory](./examples/) to help get you started with customization. 14 | Each tex file has an almost-empty body, with a `\usepackage` statement 15 | that you can customize. For example, 16 | [engineer-pad.tex](./examples/engineer-pad.tex) looks like this: 17 | ```latex 18 | \documentclass{article} 19 | \usepackage[pattern=majmin, colorset=engineer]{gridpapers} 20 | \begin{document} 21 | \thispagestyle{empty} 22 | ~ 23 | \end{document} 24 | ``` 25 | (The `~` in the body forces a non-empty body, or else latex wouldn't 26 | generate a PDF). 27 | 28 | Note: This package is distinct from a different package with a similar 29 | name, [graphpaper (on CTAN)](https://www.ctan.org/pkg/graphpaper). 30 | 31 | Usage 32 | ----- 33 | 34 | All the configuration happens via the `\usepackage` command. The 35 | current valid options are: 36 | 37 | * `pattern=`: 38 | Valid pattern names are: 39 | `std,stdeight,majmin,dot,hex,hexup,tri,iso,lightcone,ruled,doubleruled`. Default 40 | is `std`. Patterns come with default page geometry (size and margins; 41 | see `geometry`), and default 'fullness' (whether they fill the page or 42 | not; see options `fullpage` and `textarea`). 43 | * `colorset=`: 44 | Valid color preset names are: 45 | `std,precocious,ghostly,brickred,engineer,plumpad`. Default is `std`. A 46 | preset determines the `majorcolor`, `minorcolor`, and `bgcolor` all at 47 | once. But, you can start from a preset and then override some colors. 48 | * `majorcolor=`: Override the preset "major" color. This can 49 | be a named color, or using the syntax from xcolor to mix colors 50 | together. 51 | * `minorcolor=`: Override the preset "minor" color. As above. 52 | * `bgcolor=`: Override the preset background color. As above. 53 | * `patternsize=`: Override the preset pattern size. The 54 | meaning of this length argument is different for each pattern; see 55 | PDF documentation for full details.. 56 | * `dotsize=`: Controls the size of the dots themselves for 57 | `pattern=dot`. Default: `.7pt` 58 | * `fullpage`: Make the pattern fill the whole page. 59 | * `textarea`: Make the pattern fill only the text area of the 60 | document. At most one of the `fullpage` or `textarea` can be 61 | specified. If one is specified, it will override the default 62 | 'fullness' setting of the pattern. 63 | * `geometry={}`: Page geometry specification, using the 64 | syntax of the geometry package. If the geometry package was loaded 65 | before gridpapers, this option will be ignored. This specification 66 | will override the pattern's default page geometry. 67 | 68 | For example, let's say you want to use the `tri` pattern, which by 69 | default fills the page. But you want it to fill just the textarea of 70 | an A4 page with 2cm margins, and you want the triangles to be .75cm long. 71 | Finally, you like the colors of the `engineer` set, but want a white 72 | background. Then you would write: 73 | ```latex 74 | \usepackage[pattern=tri, 75 | patternsize=0.75cm, 76 | textarea, 77 | colorset=engineer, 78 | bgcolor=white, 79 | geometry={a4paper, margin=2cm}]{gridpapers} 80 | ``` 81 | 82 | Gallery 83 | ------- 84 | 85 | Some example styles: 86 | 87 | ![Standard](/../screenshots/std.jpg "Standard") 88 | 89 | ![Quad](/../screenshots/quad.jpg "Quadrille") 90 | 91 | ![Hex](/../screenshots/hex.jpg "Hex") 92 | 93 | ![Dots](/../screenshots/dot.jpg "Dots") 94 | 95 | ![Light cone](/../screenshots/lightcone.jpg "Light cone") 96 | 97 | ![Precocious Engineer](/../screenshots/rosie.png "Precocious Engineer color scheme") 98 | 99 | ![Hex Engineer](/../screenshots/hexengineer.png "Hex grid with Engineering Pad color scheme") 100 | 101 | Credits 102 | ------- 103 | 104 | This package was created by [Robert McNees](http://jacobi.luc.edu/) 105 | with additional contributions from [Leo 106 | C. Stein](http://duetosymmetry.com/), and is maintained by both. This 107 | material is subject to the [LaTeX Project Public License 108 | 1.3c](https://www.ctan.org/license/lppl1.3), (c) 2017-2021. The 109 | hexagon pattern code is [due to Philippe 110 | Goutet](https://tex.stackexchange.com/questions/6019/drawing-hexagons/6128#6128). 111 | -------------------------------------------------------------------------------- /for-CTAN/gridpapers/README.md: -------------------------------------------------------------------------------- 1 | # The *gridpapers* package 2 | Make your own quadrille, graph, hex, etc. paper! Uses the [PGF/TikZ](https://en.wikipedia.org/wiki/PGF/TikZ) package for LaTeX, which should be part of any modern TeX installation. All colors and spacing are customizable. 3 | 4 | There are .tex files in the examples/ 5 | directory to help get you started with customization. 6 | Each tex file has an almost-empty body, with a `\usepackage` statement 7 | that you can customize. For example, 8 | examples/engineer-pad.tex looks like this: 9 | ```latex 10 | \documentclass{article} 11 | \usepackage[pattern=majmin, colorset=engineer]{gridpapers} 12 | \begin{document} 13 | \thispagestyle{empty} 14 | ~ 15 | \end{document} 16 | ``` 17 | (The `~` in the body forces a non-empty body, or else latex wouldn't 18 | generate a PDF). 19 | 20 | Note: This package is distinct from a different package with a similar 21 | name, [graphpaper (on CTAN)](https://www.ctan.org/pkg/graphpaper). 22 | 23 | Installation 24 | ------------ 25 | If `gridpapers` is already provided in your TeX distribution, skip 26 | this section. You should be able to install `gridpapers` [from the 27 | CTAN](https://www.ctan.org/pkg/gridpapers) via your distribution's 28 | utility (e.g. the TeX Live Utility). Alternatively, you can get the 29 | package from the [source repository on 30 | GitHub](https://github.com/mcnees/LaTeX-Graph-Paper). If you do not 31 | want to do a "full" installation, just copy gridpapers.sty into the 32 | same directory as your LaTeX source. 33 | 34 | Usage 35 | ----- 36 | 37 | All the configuration happens via the `\usepackage` command. The 38 | current valid options are: 39 | 40 | * `pattern=`: 41 | Valid pattern names are: 42 | `std,stdeight,majmin,dot,hex,tri,iso,lightcone,ruled,doubleruled`. Default 43 | is `std`. Patterns come with default page geometry (size and margins; 44 | see `geometry`), and default 'fullness' (whether they fill the page or 45 | not; see options `fullpage` and `textarea`). 46 | * `colorset=`: 47 | Valid color preset names are: 48 | `std,precocious,brickred,engineer,plumpad`. Default is `std`. A 49 | preset determines the `majorcolor`, `minorcolor`, and `bgcolor` all at 50 | once. But, you can start from a preset and then override some colors. 51 | * `majorcolor=`: Override the preset "major" color. This can 52 | be a named color, or using the syntax from xcolor to mix colors 53 | together. 54 | * `minorcolor=`: Override the preset "minor" color. As above. 55 | * `bgcolor=`: Override the preset background color. As above. 56 | * `patternsize=`: Override the preset pattern size. The 57 | meaning of this length argument is different for each pattern; see 58 | PDF documentation for full details.. 59 | * `dotsize=`: Controls the size of the dots themselves for 60 | `pattern=dot`. Default: `.7pt` 61 | * `fullpage`: Make the pattern fill the whole page. 62 | * `textarea`: Make the pattern fill only the text area of the 63 | document. At most one of the `fullpage` or `textarea` can be 64 | specified. If one is specified, it will override the default 65 | 'fullness' setting of the pattern. 66 | * `geometry={}`: Page geometry specification, using the 67 | syntax of the geometry package. If the geometry package was loaded 68 | before gridpapers, this option will be ignored. This specification 69 | will override the pattern's default page geometry. 70 | 71 | For example, let's say you want to use the `tri` pattern, which by 72 | default fills the page. But you want it to fill just the textarea of 73 | an A4 page with 2cm margins, and you want the triangles to be .75cm long. 74 | Finally, you like the colors of the `engineer` set, but want a white 75 | background. Then you would write: 76 | ```latex 77 | \usepackage[pattern=tri, 78 | patternsize=0.75cm, 79 | textarea, 80 | colorset=engineer, 81 | bgcolor=white, 82 | geometry={a4paper, margin=2cm}]{gridpapers} 83 | ``` 84 | 85 | Gallery 86 | ------- 87 | 88 | Some example styles: 89 | 90 | ![Standard](https://raw.githubusercontent.com/mcnees/LaTeX-Graph-Paper/screenshots/std.jpg "Standard") 91 | 92 | ![Quad](https://raw.githubusercontent.com/mcnees/LaTeX-Graph-Paper/screenshots/quad.jpg "Quadrille") 93 | 94 | ![Hex](https://raw.githubusercontent.com/mcnees/LaTeX-Graph-Paper/screenshots/hex.jpg "Hex") 95 | 96 | ![Dots](https://raw.githubusercontent.com/mcnees/LaTeX-Graph-Paper/screenshots/dot.jpg "Dots") 97 | 98 | ![Light cone](https://raw.githubusercontent.com/mcnees/LaTeX-Graph-Paper/screenshots/lightcone.jpg "Light cone") 99 | 100 | ![Precocious Engineer](https://raw.githubusercontent.com/mcnees/LaTeX-Graph-Paper/screenshots/rosie.png "Precocious Engineer color scheme") 101 | 102 | ![Hex Engineer](https://raw.githubusercontent.com/mcnees/LaTeX-Graph-Paper/screenshots/hexengineer.png "Hex grid with Engineering Pad color scheme") 103 | 104 | Credits 105 | ------- 106 | 107 | This package was created by [Robert McNees](http://jacobi.luc.edu/) 108 | with additional contributions from [Leo 109 | C. Stein](http://duetosymmetry.com/), and is maintained by both. This 110 | material is subject to the [LaTeX Project Public License 111 | 1.3c](https://www.ctan.org/license/lppl1.3), (c) 2017-2021. The 112 | hexagon pattern code is [due to Philippe 113 | Goutet](https://tex.stackexchange.com/questions/6019/drawing-hexagons/6128#6128). 114 | -------------------------------------------------------------------------------- /gridpapers.sty: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file `gridpapers.sty', 3 | %% generated with the docstrip utility. 4 | %% 5 | %% The original source files were: 6 | %% 7 | %% gridpapers.dtx (with options: `package') 8 | %% 9 | %% This is a generated file. 10 | %% 11 | %% Copyright (C) 2021 by Robert McNees , Leo C. Stein 12 | %% -------------------------------------------------------------------------- 13 | %% This work may be distributed and/or modified under the 14 | %% conditions of the LaTeX Project Public License, either version 1.3 15 | %% of this license or (at your option) any later version. 16 | %% The latest version of this license is in 17 | %% http://www.latex-project.org/lppl.txt 18 | %% and version 1.3 or later is part of all distributions of LaTeX 19 | %% version 2005/12/01 or later. 20 | %% 21 | 22 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 23 | \ProvidesPackage{gridpapers} 24 | [2021/03/27 v1.0.2 Graph paper backgrounds] 25 | 26 | \RequirePackage{xkeyval} 27 | \RequirePackage{kvoptions} 28 | \RequirePackage{xcolor} 29 | \RequirePackage{tikz} 30 | \usetikzlibrary{patterns.meta,calc} 31 | \RequirePackage{tikzpagenodes} 32 | %% everypage has been superseded -- try to use the new builtin 33 | %% approach, but fall back to everypage-1x if needed 34 | %% This code is roughly taken from the new everypage code 35 | \@ifundefined{AddToHook}{% 36 | \IfFileExists{everypage-1x.sty}{% 37 | %% If everypage is new enough to complain, avoid the complaints 38 | \RequirePackage{everypage-1x} 39 | }{\RequirePackage{everypage}} 40 | }{% 41 | \newcommand*{\AddEverypageHook}[1]{% 42 | \AddToHook{shipout/background}{\put(1in,-1in){#1}}} 43 | } 44 | \RequirePackage{pagecolor} 45 | 46 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 47 | %% Option parsing 48 | %% Declare switches for processing the options. 49 | 50 | \newif\ifGP@geometrypreviouslyloaded 51 | \newif\ifGP@fullnessset 52 | \newif\ifGP@fullpage 53 | \newif\ifGP@textarea 54 | \GP@geometrypreviouslyloadedfalse 55 | \GP@fullnesssetfalse 56 | \GP@fullpagefalse 57 | \GP@textareafalse 58 | 59 | \SetupKeyvalOptions{% 60 | family=GP,% 61 | prefix=GPOpt@% 62 | } 63 | 64 | \DeclareStringOption[std]{pattern} 65 | \DeclareStringOption[std]{colorset} 66 | 67 | \DeclareStringOption{majorcolor} 68 | \DeclareStringOption{minorcolor} 69 | \DeclareStringOption{bgcolor} 70 | 71 | \DeclareStringOption{patternsize} 72 | \DeclareStringOption[.7pt]{dotsize} 73 | 74 | \DeclareVoidOption{fullpage}{\GP@fullpagetrue} 75 | \DeclareVoidOption{textarea}{\GP@textareatrue} 76 | 77 | \DeclareStringOption{geometry} 78 | 79 | \ProcessKeyvalOptions* 80 | 81 | %% Can only have one of fullpage or textarea 82 | \ifGP@fullpage 83 | \ifGP@textarea 84 | \PackageError{gridpapers}{% 85 | Can not specify both fullpage and textarea, please remove one option}{} 86 | \fi 87 | \GP@fullnesssettrue 88 | \fi 89 | 90 | \ifGP@textarea 91 | \GP@fullnesssettrue 92 | \fi 93 | 94 | %% We keep track of this to know whether or not we would be overriding 95 | %% a previously-set page geometry 96 | \@ifpackageloaded{geometry} 97 | {\GP@geometrypreviouslyloadedtrue} 98 | {\GP@geometrypreviouslyloadedfalse% 99 | \PassOptionsToPackage{\GPOpt@geometry}{geometry}% 100 | \RequirePackage{geometry}% 101 | } 102 | 103 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 104 | %% Actual package code 105 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 106 | 107 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 108 | %% Some nice colors. 109 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 110 | \definecolor{plum}{rgb}{0.36078, 0.20784, 0.4} 111 | \definecolor{chameleon}{rgb}{0.30588, 0.60392, 0.023529} 112 | \definecolor{cornflower}{rgb}{0.12549, 0.29020, 0.52941} 113 | \definecolor{scarlet}{rgb}{0.8, 0, 0} 114 | \definecolor{brick}{rgb}{0.64314, 0, 0} 115 | \definecolor{sunrise}{rgb}{0.80784, 0.36078, 0} 116 | \definecolor{rosiebg}{RGB}{250,247,232} 117 | \definecolor{rosiegrid}{RGB}{186,137,113} 118 | 119 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 120 | %% The color to use for the null directions when drawing lightcones. 121 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 122 | \colorlet{lightlines}{scarlet!30} 123 | 124 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 125 | %% Pre-defined Color schemes 126 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 127 | %% Here are some pre-defined color schemes for the paper background 128 | %% and the major and minor grid lines. These are switched by using 129 | %% the option colorset=. The allowed values for colorset are in 130 | %% the list below. 131 | \define@choicekey*{GP}{colorset}[\val\nr]% 132 | %% Allowed values for colorset: 133 | {std,precocious,ghostly,brickred,engineer,plumpad}[std]{% 134 | \ifcase\nr\relax 135 | %% std 136 | \colorlet{minorcolor}{cornflower!30} 137 | \colorlet{majorcolor}{cornflower!50} 138 | \colorlet{bgcolor}{white} 139 | \or 140 | %% precocious 141 | \colorlet{minorcolor}{rosiegrid!50} 142 | \colorlet{majorcolor}{rosiegrid} 143 | \colorlet{bgcolor}{rosiebg} 144 | \or 145 | %% ghostly 146 | \colorlet{minorcolor}{gray!15} 147 | \colorlet{majorcolor}{gray!20} 148 | \colorlet{bgcolor}{white} 149 | \or 150 | %% brickred 151 | \colorlet{minorcolor}{brick!35} 152 | \colorlet{majorcolor}{brick!60} 153 | \colorlet{bgcolor}{scarlet!8} 154 | \or 155 | %% engineer 156 | \colorlet{minorcolor}{chameleon!50} 157 | \colorlet{majorcolor}{chameleon!80} 158 | \colorlet{bgcolor}{chameleon!10} 159 | \or 160 | %% plumpad 161 | \colorlet{minorcolor}{cornflower!40} 162 | \colorlet{majorcolor}{cornflower!70} 163 | \colorlet{bgcolor}{plum!10} 164 | \fi 165 | } 166 | 167 | %% Get the specified color set from the options 168 | \def\@setkeyhelper#1#2{% 169 | \setkeys{GP}{#2=#1} 170 | } 171 | \expandafter\@setkeyhelper\expandafter{\GPOpt@colorset}{colorset} 172 | 173 | %% If the user further specified majorcolor, minorcolor, and/or 174 | %% bgcolor, we now override the selected colorset 175 | \ifx\GPOpt@majorcolor\@empty 176 | \else 177 | \colorlet{majorcolor}{\GPOpt@majorcolor} 178 | \fi 179 | \ifx\GPOpt@minorcolor\@empty 180 | \else 181 | \colorlet{minorcolor}{\GPOpt@minorcolor} 182 | \fi 183 | \ifx\GPOpt@bgcolor\@empty 184 | \else 185 | \colorlet{bgcolor}{\GPOpt@bgcolor} 186 | \fi 187 | 188 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 189 | %% The size parameter -- different meanings for different patterns 190 | %% Will be reset by pattern code 191 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 192 | \newcommand{\GP@patternsize}{0.1in} 193 | 194 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 195 | %% This section sets up a routine for filling a shape with 196 | %% hexagons. Uses code from: 197 | %% http://tex.stackexchange.com/questions/6019/drawing-hexagons/6128#6128 198 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 199 | 200 | %% We have to delay this definition until after \GP@patternsize is 201 | %% redefined (by the pattern selection and/or user override) 202 | \newcommand{\GP@declarehexpat}{ 203 | \tikzdeclarepattern{ 204 | name=hexagons, 205 | type=uncolored, 206 | bounding box={(0,0) and (3*\GP@patternsize,0.866025*2*\GP@patternsize)}, 207 | tile size={(3*\GP@patternsize,0.866025*2*\GP@patternsize)}, 208 | parameters={\tikzhexrotate}, 209 | tile transformation={rotate=\tikzhexrotate}, 210 | defaults={ 211 | rotate/.store in=\tikzhexrotate,rotate=0, 212 | }, 213 | code={ 214 | \pgfsetlinewidth{0.6pt} 215 | \pgftransformshift{\pgfpoint{0mm}{0.866025*\GP@patternsize}} 216 | \pgfpathmoveto{\pgfpoint{0mm}{0mm}} 217 | \pgfpathlineto{\pgfpoint{0.5*\GP@patternsize}{0mm}} 218 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{-0.866025*\GP@patternsize}} 219 | \pgfpathlineto{\pgfpoint{2*\GP@patternsize}{-0.866025*\GP@patternsize}} 220 | \pgfpathlineto{\pgfpoint{2.5*\GP@patternsize}{0mm}} 221 | \pgfpathlineto{\pgfpoint{3*\GP@patternsize}{0mm}} 222 | \pgfpathmoveto{\pgfpoint{0.5*\GP@patternsize}{0mm}} 223 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{0.866025*\GP@patternsize}} 224 | \pgfpathlineto{\pgfpoint{2*\GP@patternsize}{0.866025*\GP@patternsize}} 225 | \pgfpathlineto{\pgfpoint{2.5*\GP@patternsize}{0mm}} 226 | \pgfusepath{stroke} 227 | } 228 | } 229 | } 230 | 231 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 232 | %% This section sets up a routine for filling a shape with 233 | %% triangles. 234 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 235 | 236 | %% We have to delay this definition until after \GP@patternsize is 237 | %% redefined (by the pattern selection and/or user override) 238 | \newcommand{\GP@declaretripat}{ 239 | \tikzdeclarepattern{ 240 | name=triangles, 241 | type=uncolored, 242 | bounding box={(0,0) and (\GP@patternsize,2*0.866025*\GP@patternsize)}, 243 | tile size={(\GP@patternsize,2*0.866025*\GP@patternsize)}, 244 | parameters={\tikztrirotate}, 245 | tile transformation={rotate=\tikztrirotate}, 246 | defaults={ 247 | rotate/.store in=\tikztrirotate,rotate=0, 248 | }, 249 | code={ 250 | \pgfsetlinewidth{0.6pt} 251 | \pgfpathmoveto{\pgfpoint{0mm}{0mm}} 252 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{2*0.8660254*\GP@patternsize}} 253 | \pgfpathlineto{\pgfpoint{0mm}{2*0.8660254*\GP@patternsize}} 254 | \pgfpathmoveto{\pgfpoint{0mm}{0.8660254*\GP@patternsize}} 255 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{0.8660254*\GP@patternsize}} 256 | \pgfpathmoveto{\pgfpoint{0mm}{2*0.8660254*\GP@patternsize}} 257 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{0mm}} 258 | \pgfpathlineto{\pgfpoint{0mm}{0mm}} 259 | \pgfusepath{stroke} 260 | } 261 | } 262 | } 263 | 264 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 265 | %% This section sets up a routine for filling the squares in a 266 | %% grid with null lines. 267 | %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 268 | %% TODO Still can't figure out the correct pattern shift!! 269 | \newcommand{\GP@declarelightconepat}{ 270 | \pgfkeys{ 271 | /pgf/pattern keys/myshift/.store in=\myshift, 272 | /pgf/pattern keys/myshift/.initial={(0,0)}, 273 | } 274 | \tikzdeclarepattern{ 275 | name=lightcones, 276 | type=uncolored, 277 | parameters={\myshift}, 278 | bounding box={(0,0) and (\GP@patternsize,\GP@patternsize)}, 279 | tile size={(\GP@patternsize, \GP@patternsize)}, 280 | tile transformation={ 281 | shift=\myshift, 282 | }, 283 | defaults={ 284 | myshift/.store in=\myshift,myshift={(0,0)}, 285 | }, 286 | code={ 287 | %% TODO Make the dashing an option 288 | \tikzset{lightlines/.style={line width=0.4pt,dash=on 0.05cm off 0.05cm phase 0.025cm}} 289 | \draw [lightlines] (0,0) -- (\GP@patternsize,\GP@patternsize); 290 | \draw [lightlines] (0,\GP@patternsize) -- (\GP@patternsize,0); 291 | }, 292 | } 293 | } 294 | %% \pgfdeclarepatternformonly 295 | %% {lightcones}% name 296 | %% {\pgfpointorigin}% lower left 297 | %% {\pgfpoint{\GP@patternsize}{\GP@patternsize}}% upper right 298 | %% {\pgfpoint{\GP@patternsize}{\GP@patternsize}}% tile size 299 | %% {% shape description 300 | %% \pgfsetlinewidth{0.4pt} 301 | %% %% TODO Make an option 302 | %% %Comment out this line for solid lines on light cones, instead of dashes. 303 | %% \pgfsetdash{{0.05cm}{0.05cm}}{0.025cm} 304 | %% \pgfpathmoveto{\pgfpoint{0in}{0in}} 305 | %% \pgfpathlineto{\pgfpoint{\GP@patternsize}{\GP@patternsize}} 306 | %% \pgfpathmoveto{\pgfpoint{0in}{\GP@patternsize}} 307 | %% \pgfpathlineto{\pgfpoint{\GP@patternsize}{0in}} 308 | %% \pgfusepath{stroke} 309 | %% } 310 | 311 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 312 | %% This section sets up a routine for filling a region with dots 313 | %% Slightly modified version of code added by Leo 314 | %% Stein (@duetosymmetry on Twitter). 315 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 316 | %% We have to delay this definition until after \GP@patternsize is 317 | %% redefined (by the pattern selection and/or user override) 318 | \newcommand{\GP@declaredotpat}{ 319 | \pgfdeclarepatternformonly 320 | {dotgrid}%% name 321 | {\pgfpoint{-0.5*\GP@patternsize}{-0.5*\GP@patternsize}}%% lower left 322 | {\pgfpoint{0.5*\GP@patternsize}{0.5*\GP@patternsize}}%% upper right 323 | {\pgfpoint{\GP@patternsize}{\GP@patternsize}}%% tile size 324 | {%% shape description 325 | \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{\GPOpt@dotsize} 326 | \pgfusepath{fill} 327 | } 328 | } 329 | 330 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 331 | %% Begin pattern execution infrastructure 332 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 333 | 334 | %% This inner code will be set by the choicekey pattern=... 335 | \newcommand{\GP@innerpatterncode}{} 336 | %% This is the "outer" code to hook into every page 337 | \newcommand{\GP@patterncode}{% No blank lines in this code! 338 | \begin{tikzpicture}[remember picture, overlay] 339 | %% 340 | %% Change "thin" to "very thin" if the lines are too thick. 341 | \tikzset{ 342 | minorgrid/.style={minorcolor, thin}, 343 | majorgrid/.style={majorcolor, thin}, 344 | } 345 | \ifGP@fullpage% 346 | \coordinate (a) at (current page.south west); 347 | \coordinate (b) at (current page.north east); 348 | \else% 349 | \coordinate (a) at (current page text area.south west); 350 | \coordinate (b) at (current page text area.north east); 351 | \fi 352 | %% 353 | \GP@innerpatterncode% 354 | %% 355 | \end{tikzpicture} 356 | } 357 | 358 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 359 | %% Begin pattern definition code 360 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 361 | 362 | \define@boolkey{GP}{patterndefaultfullness}{} 363 | \newcommand{\GP@patterndefaultgeometry}{} 364 | \newcommand{\GP@patterndefaultsize}{} 365 | 366 | %% Pattern-definer-helper 367 | %% The interface is: 368 | %% \GP@setpattern 369 | %% {} 370 | %% {} 371 | %% {} %% NOTE, not tile length 372 | %% {} 373 | \newcommand{\GP@setpattern}[4]{% 374 | \setkeys{GP}{patterndefaultfullness=#1} 375 | \renewcommand{\GP@patterndefaultgeometry}{#2} 376 | \renewcommand{\GP@patterndefaultsize}{#3} 377 | \renewcommand{\GP@innerpatterncode}{#4} 378 | } 379 | 380 | \define@choicekey*{GP}{pattern}[\val\nr]% 381 | %% Allowed values for pattern: 382 | {std,stdeight,majmin,dot,hex,hexup,tri,iso,lightcone,ruled,doubleruled}{% 383 | \ifcase\nr\relax 384 | %% std 385 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 386 | %% Quadrille, ten squares per inch. 387 | %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 388 | \GP@setpattern{false}{letterpaper, margin=0.2in}{0.1in}{% 389 | %% Draw a grid with 10 squares per inch. 390 | \draw[style=minorgrid, shift={(a)}] (0,0) grid [step=\GP@patternsize] (b); 391 | %% 392 | %% Draw a frame around the grid. 393 | \draw[style=majorgrid] (a) rectangle (b); 394 | } 395 | \or 396 | %% stdeight 397 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 398 | %% Quadrille, eight squares per inch. 399 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 400 | \GP@setpattern{false}{letterpaper, margin=0.1875in}{0.125in}{% 401 | %% Draw a grid with 10 squares per inch. 402 | \draw[style=minorgrid, shift={(a)}] (0,0) grid [step=\GP@patternsize] (b); 403 | %% 404 | %% Draw a frame around the grid. 405 | \draw[style=majorgrid] (a) rectangle (b); 406 | } 407 | \or 408 | %% majmin 409 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 410 | %% Graph paper, eight squares per inch with a major grid 411 | %% every half-inch. 412 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 413 | \GP@setpattern{false}{letterpaper, margin=0.25in}{0.125in}{% 414 | %% Draw a grid with 10 squares per inch. 415 | \draw[style=minorgrid, shift={(a)}] (0,0) grid [step=\GP@patternsize] (b); 416 | %% 417 | \draw[style=majorgrid, shift={(a)}] (0,0) grid [step=4*\GP@patternsize] (b); 418 | %% 419 | %% Draw a frame around the grid. 420 | \draw[style=majorgrid] (a) rectangle (b); 421 | } 422 | \or 423 | %% dot 424 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 425 | %% Dot grid 426 | %% Slightly modified version of code added by Leo 427 | %% Stein (@duetosymmetry). 428 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 429 | \GP@setpattern{true}{}{0.1in}{% 430 | \fill [pattern=dotgrid,pattern color=minorcolor] (a) rectangle (b); 431 | } 432 | \or 433 | %% hex 434 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 435 | %% Hex grid 436 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 437 | \GP@setpattern{true}{}{0.1666in}{% 438 | \fill [pattern=hexagons,pattern color=minorcolor] (a) rectangle (b); 439 | } 440 | \or 441 | %% hexup 442 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 443 | %% Hex-up grid 444 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 445 | \GP@setpattern{true}{}{0.1666in}{% 446 | \fill [pattern={hexagons[rotate=90]},pattern color=minorcolor] (a) rectangle (b); 447 | } 448 | \or 449 | %% tri 450 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 451 | %% Triangle grid, adjust triangle size in the preamble 452 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 453 | \GP@setpattern{true}{}{0.25in}{% 454 | \fill [pattern=triangles,pattern color=minorcolor] (a) rectangle (b); 455 | } 456 | \or 457 | %% iso 458 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 459 | %% Isometric grid 460 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 461 | \GP@setpattern{true}{}{0.25in}{% 462 | \fill [pattern={triangles[rotate=90]}, pattern color=minorcolor] (a) rectangle (b); 463 | } 464 | \or 465 | %% lightcone 466 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 467 | %% A grid with light cones. 468 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 469 | \GP@setpattern{false}{letterpaper, margin=.125in}{0.25in}{% 470 | %% Draw a grid with 4 squares per inch. 471 | \draw[style=minorgrid, shift={(a)}] (0,0) coordinate grid [step=\GP@patternsize] (b); 472 | %% 473 | %% Draw a border around the grid. 474 | \draw[style=majorgrid, pattern={lightcones[myshift={(a)}]}, pattern color=lightlines] (a) rectangle (b); 475 | } 476 | \or 477 | %% ruled 478 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 479 | %% Ruled page with bold lines every 0.2in or 0.25in 480 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 481 | \GP@setpattern{false}{letterpaper, body={8in,10.8in}}{0.2in}{% 482 | %% Draw a ruled page with lines every 0.2in 483 | \draw[style=majorgrid, shift={(a)}] (0,0) grid [ystep=\GP@patternsize, xstep=\paperwidth] (b); 484 | %% Draw a frame around the grid. 485 | \draw[style=majorgrid] (a) rectangle (b); 486 | } 487 | \or 488 | %% doubleruled 489 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 490 | %% Ruled page with bold lines every 0.25in and light lines 491 | %% every 0.125 in. 492 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 493 | \GP@setpattern{false}{letterpaper, margin=.25in}{0.125in}{% 494 | %% Draw a ruled pattern with thin lines every 0.125 in and bold lines every 0.25 in. 495 | \draw[style=minorgrid, shift={(a)}] (0,0) grid [ystep=\GP@patternsize, xstep=\paperwidth] (b); 496 | %% 497 | \draw[style=majorgrid, shift={(a)}] (0,0) grid [ystep=2*\GP@patternsize, xstep=\paperwidth] (b); 498 | %% 499 | %% Draw a frame around the grid. 500 | \draw[style=majorgrid] (a) rectangle (b); 501 | } 502 | \fi 503 | } 504 | 505 | %% Use the passed package option to set the above key 506 | \expandafter\@setkeyhelper\expandafter{\GPOpt@pattern}{pattern} 507 | 508 | %% Determine whether or not to (re)set fullpage vs textarea 509 | \ifGP@fullnessset 510 | %% Respect their choice 511 | \else 512 | %% Reset the value of \GP@fullpage based on the pattern's default 513 | %% There's probably a more idiomatic way to do this but I can't 514 | %% figure it out 515 | \ifKV@GP@patterndefaultfullness 516 | \GP@fullpagetrue 517 | \else 518 | \GP@fullpagefalse 519 | \fi 520 | \fi 521 | 522 | %% Determine whether or not to fiddle with the page geometry 523 | \ifGP@geometrypreviouslyloaded 524 | %% Respect their previous choice 525 | \PackageWarning{gridpapers}{'geometry' package was previously loaded, will not use pattern defaults.} 526 | \else 527 | %% Use the pattern's defaults, 528 | \expandafter\geometry\expandafter{\GP@patterndefaultgeometry} 529 | %% And then override with any more specific settings passed by the user 530 | \expandafter\geometry\expandafter{\GPOpt@geometry} 531 | \fi 532 | 533 | %% Determine the correct pattern length 534 | \ifx\GPOpt@patternsize\@empty 535 | % Use the pattern's preferred length 536 | \renewcommand{\GP@patternsize}{\GP@patterndefaultsize} 537 | \else 538 | % Override with the user's choice 539 | \renewcommand{\GP@patternsize}{\GPOpt@patternsize} 540 | \fi 541 | 542 | %% Now that everything has been set up, we can finally define the 543 | %% patterns with the correct lengths. 544 | \GP@declarehexpat 545 | \GP@declaretripat 546 | \GP@declarelightconepat 547 | \GP@declaredotpat 548 | 549 | %% Set the background color. 550 | \AtBeginDocument{\pagecolor{bgcolor}} 551 | %% Actually hook it in! 552 | \AddEverypageHook{% 553 | \GP@patterncode% 554 | } 555 | 556 | \endinput 557 | %% 558 | %% End of file `gridpapers.sty'. 559 | -------------------------------------------------------------------------------- /gridpapers.dtx: -------------------------------------------------------------------------------- 1 | % \iffalse meta-comment 2 | % 3 | % Copyright (C) 2021 by Robert McNees , Leo C. Stein 4 | % --------------------------------------------------------------------------- 5 | % This work may be distributed and/or modified under the 6 | % conditions of the LaTeX Project Public License, either version 1.3 7 | % of this license or (at your option) any later version. 8 | % The latest version of this license is in 9 | % http://www.latex-project.org/lppl.txt 10 | % and version 1.3 or later is part of all distributions of LaTeX 11 | % version 2005/12/01 or later. 12 | % 13 | % This work has the LPPL maintenance status `maintained'. 14 | % 15 | % The Current Maintainers of this work are Robert McNees, Leo C. Stein. 16 | % 17 | % This work consists of the files gridpapers.dtx and gridpapers.ins 18 | % and the derived filebase gridpapers.sty. 19 | % 20 | % \fi 21 | % 22 | % \iffalse 23 | %<*driver> 24 | \ProvidesFile{gridpapers.dtx} 25 | % 26 | % 27 | %<*driver> 28 | \documentclass{ltxdoc} 29 | \usepackage[dvipsnames]{xcolor} 30 | \usepackage[pattern=stdeight, textarea, 31 | majorcolor=cornflower!30, minorcolor=cornflower!10, 32 | geometry={margin=1in, left=2in}]{gridpapers}[2021/03/14] 33 | \usepackage{hyperref} 34 | \hypersetup{colorlinks,urlcolor=NavyBlue,citecolor=NavyBlue,linkcolor=NavyBlue, 35 | pdfauthor={Robert McNees and Leo C. Stein}, 36 | pdftitle={The gridpapers package}} 37 | \usepackage{fontawesome} 38 | \definecolor{twitterblue}{RGB}{64,153,255} 39 | \newcommand{\email}[1]{$\langle$\href{mailto:#1}{#1}$\rangle$} 40 | \newcommand{\twitter}[1]{\href{https://twitter.com/#1}{\textcolor{twitterblue}{\faTwitter}\,\tt\textcolor{twitterblue}{@#1}}} 41 | \usepackage{dtxdescribe} 42 | \usepackage[columns=2]{idxlayout} 43 | \EnableCrossrefs 44 | \CodelineIndex 45 | \RecordChanges 46 | \begin{document} 47 | \DocInput{gridpapers.dtx} 48 | \PrintChanges 49 | \end{document} 50 | % 51 | % \fi 52 | % 53 | % \CheckSum{405} 54 | % 55 | % \CharacterTable 56 | % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z 57 | % Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z 58 | % Digits \0\1\2\3\4\5\6\7\8\9 59 | % Exclamation \! Double quote \" Hash (number) \# 60 | % Dollar \$ Percent \% Ampersand \& 61 | % Acute accent \' Left paren \( Right paren \) 62 | % Asterisk \* Plus \+ Comma \, 63 | % Minus \- Point \. Solidus \/ 64 | % Colon \: Semicolon \; Less than \< 65 | % Equals \= Greater than \> Question mark \? 66 | % Commercial at \@ Left bracket \[ Backslash \\ 67 | % Right bracket \] Circumflex \^ Underscore \_ 68 | % Grave accent \` Left brace \{ Vertical bar \| 69 | % Right brace \} Tilde \~} 70 | % 71 | % 72 | % \changes{v1.0.0}{2021/03/13}{Converted to DTX file} 73 | % \changes{v1.0.1}{2021/03/19}{Hotfix: old installs don't have 74 | % everypage-1x, use everypage} 75 | % \changes{v1.0.2}{2021/03/26}{Replace triangle and hexagon code 76 | % to allow rotated grids, add 'ghostly' colorset} 77 | % 78 | % \DoNotIndex{\newcommand,\newenvironment} 79 | % 80 | % \GetFileInfo{gridpapers.sty} 81 | % \title{The \textsf{gridpapers} package} 82 | % \author{Robert McNees\footnote{\email{rmcnees@luc.edu}; \twitter{mcnees}} 83 | % \ and 84 | % Leo C.\ Stein\footnote{\email{leo.stein@gmail.com}; \twitter{duetosymmetry}}} 85 | % \date{\fileversion~from \filedate} 86 | % 87 | % \maketitle 88 | % 89 | % All development happens at the repo: 90 | % \url{https://github.com/mcnees/LaTeX-Graph-Paper}. 91 | % 92 | % \section{Introduction} 93 | % 94 | % Make your own quadrille, graph, hex, etc.\ paper! Uses the PGF/TikZ 95 | % package for \LaTeX, which should be part of any modern \TeX{} 96 | % installation. Lots of preset defaults to get started with ease, yet 97 | % all colors and spacing are customizable. 98 | % 99 | % There are example .tex files in the |examples| directory to 100 | % help get you started with customization. Each tex file has an 101 | % almost-empty body, with a |\usepackage| statement that you can 102 | % customize. For example, engineer-pad.tex looks like this: 103 | % \VerbatimInput[frame=single, 104 | % numbers=left, 105 | % xleftmargin=2em, 106 | % label=engineer-pad.tex]{examples/engineer-pad.tex} 107 | % (The |~| in the body forces a non-empty body, or else latex wouldn't generate a PDF). 108 | % 109 | % \section{Usage} 110 | % 111 | % \subsection{Options} 112 | % 113 | % Your graph paper is configured through a number of key/value options 114 | % to the |\usepackage| command. Let's go through these options. 115 | % 116 | % \DescribeObject{pattern=\marg{name}}\DescribeDefault{std} Which of 117 | % the predefined patterns to use for the page or textarea background. 118 | % The current list of pattern names is: |std|, |stdeight|, |majmin|, 119 | % |dot|, |hex|, |hexup|, |tri|, |iso|, |lightcone|, |ruled|, |doubleruled|. We 120 | % describe each of these patterns in Sec.~\ref{sec:patterns}. 121 | % Patterns come with default page geometry (size and margins; see 122 | % |geometry|), and default `fullness' (whether they fill the page or 123 | % not; see options |fullpage| and |textarea|). 124 | % 125 | % \DescribeObject{colorset=\marg{name}}\DescribeDefault{std} Color 126 | % presets. Valid color preset names are: |std|, |precocious|, |ghostly|, 127 | % |brickred|, |engineer|, |plumpad|. A preset determines the 128 | % |majorcolor|, |minorcolor|, and |bgcolor| all at once. But, you can 129 | % start from a preset and then override some colors. 130 | % 131 | % \DescribeObject{majorcolor=\marg{color}} Override the preset 132 | % ``major'' color. This can be a named color, or using the syntax from 133 | % |xcolor| to mix colors together. 134 | % 135 | % \DescribeObject{minorcolor=\marg{color}} Override the preset 136 | % ``minor'' color. As above. 137 | % 138 | % \DescribeObject{bgcolor=\marg{color}} Override the preset background 139 | % color. As above. 140 | % 141 | % \DescribeObject{patternsize=\marg{length}} Override the preset 142 | % pattern size. The meaning of this length argument is different for 143 | % each pattern; see Sec.~\ref{sec:patterns} for more. 144 | % 145 | % \DescribeObject{dotsize=\marg{length}}\DescribeDefault{.7pt} 146 | % Controls the size of the dots themselves for |pattern=dot|. 147 | % 148 | % \DescribeObject{fullpage} Make the pattern fill the whole page. 149 | % 150 | % \DescribeObject{textarea} Make the pattern fill only the text area 151 | % of the document. At most one of the |fullpage| or |textarea| can be 152 | % specified. If one is specified, it will override the default 153 | % `fullness' setting of the pattern. 154 | % 155 | % \DescribeObject{geometry=\marg{geometry spec}} Page geometry 156 | % specification, using the syntax of the |geometry| package. This 157 | % specification will override the pattern's default page geometry. 158 | % However, if the |geometry| package was loaded before |gridpapers|, 159 | % this option will be ignored. 160 | % 161 | % \subsection{Patterns} 162 | % \label{sec:patterns} 163 | % 164 | % The current set of patterns: 165 | % 166 | % \DescribeObject{std} Quadrille, ten squares per inch. The 167 | % |patternsize| option controls the side of a square. Default is 168 | % |patternsize=0.1in|. 169 | % 170 | % \DescribeObject{stdeight} Quadrille, eight squares per inch. The 171 | % |patternsize| option controls the side of a square. Default is 172 | % |patternsize=0.125in|. 173 | % 174 | % \DescribeObject{majmin} Graph paper, eight squares per inch with a 175 | % major grid every half-inch. The |patternsize| option controls the 176 | % side of a small square (the larger squares are four times bigger). 177 | % Default is |patternsize=0.125in|. 178 | % 179 | % \DescribeObject{dot} Grid of dots. The size of an individual dot is 180 | % set by |dotsize|. The |patternsize| option controls the distance 181 | % between dots. Default is |patternsize=0.1in|. 182 | % 183 | % \DescribeObject{hex} Grid of hexagons. The |patternsize| option 184 | % controls the side length of a hexagon. Default is 185 | % |patternsize=0.1666in|. 186 | % 187 | % \DescribeObject{hexup} Grid of hexagons, rotated 90 degrees from the 188 | % default orientation. The |patternsize| option controls the side 189 | % length of a hexagon. Default is |patternsize=0.1666in|. 190 | % 191 | % \DescribeObject{tri} Triangle grid. The |patternsize| option 192 | % controls the side length of a triangle. Default is 193 | % |patternsize=0.25in|. 194 | % 195 | % \DescribeObject{iso} Isometric grid. The |patternsize| option 196 | % controls the side length of a triangle. Default is 197 | % |patternsize=0.25in|. 198 | % 199 | % \DescribeObject{lightcone} A grid with light cones (45° lines) on a 200 | % square grid. The |patternsize| option controls the side of a 201 | % horizontal square (not the tipped squared). Default is 202 | % |patternsize=0.25in|. 203 | % 204 | % \DescribeObject{ruled} Ruled page with bold lines. The 205 | % |patternsize| option controls the vertical distance between lines. 206 | % Default is |patternsize=0.2in|. 207 | % 208 | % \DescribeObject{doubleruled} Ruled page with bold lines alternating 209 | % with light lines. The |patternsize| option controls the vertical 210 | % distance between neighboring lines. Default is 211 | % |patternsize=0.125in|. 212 | % 213 | % \section{Examples} 214 | % 215 | % \subsection{Plenty of customization} 216 | % 217 | % Let's say you want to use the |tri| pattern, which by default fills 218 | % the page. But you want it to fill just the textarea of an A4 page 219 | % with 2cm margins, and you want the triangles to be .75cm 220 | % long. Finally, you like the colors of the engineer set, but want a 221 | % white background. Then you would write: 222 | % \begin{sourceverb}[frame=single] 223 | % \usepackage[pattern=tri, 224 | % patternsize=0.75cm, 225 | % textarea, 226 | % colorset=engineer, 227 | % bgcolor=white, 228 | % geometry={a4paper, margin=2cm}]{gridpapers} 229 | % \end{sourceverb} 230 | % 231 | % \subsection{Custom colors} 232 | % 233 | % Using named or blended custom colors is demonstrated in the example 234 | % file |custom-colors.tex|: 235 | % \VerbatimInput[frame=single, 236 | % numbers=left, 237 | % xleftmargin=2em, 238 | % label=custom-colors.tex]{examples/custom-colors.tex} 239 | % 240 | 241 | % 242 | % \StopEventually{} 243 | % 244 | % \section{Implementation} 245 | % 246 | % \iffalse 247 | %<*package> 248 | % \fi 249 | % 250 | % \begin{macrocode} 251 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 252 | \ProvidesPackage{gridpapers} 253 | [2021/03/27 v1.0.2 Graph paper backgrounds] 254 | 255 | \RequirePackage{xkeyval} 256 | \RequirePackage{kvoptions} 257 | \RequirePackage{xcolor} 258 | \RequirePackage{tikz} 259 | \usetikzlibrary{patterns.meta,calc} 260 | \RequirePackage{tikzpagenodes} 261 | %% everypage has been superseded -- try to use the new builtin 262 | %% approach, but fall back to everypage-1x if needed 263 | %% This code is roughly taken from the new everypage code 264 | \@ifundefined{AddToHook}{% 265 | \IfFileExists{everypage-1x.sty}{% 266 | %% If everypage is new enough to complain, avoid the complaints 267 | \RequirePackage{everypage-1x} 268 | }{\RequirePackage{everypage}} 269 | }{% 270 | \newcommand*{\AddEverypageHook}[1]{% 271 | \AddToHook{shipout/background}{\put(1in,-1in){#1}}} 272 | } 273 | \RequirePackage{pagecolor} 274 | 275 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 276 | %% Option parsing 277 | %% Declare switches for processing the options. 278 | 279 | \newif\ifGP@geometrypreviouslyloaded 280 | \newif\ifGP@fullnessset 281 | \newif\ifGP@fullpage 282 | \newif\ifGP@textarea 283 | \GP@geometrypreviouslyloadedfalse 284 | \GP@fullnesssetfalse 285 | \GP@fullpagefalse 286 | \GP@textareafalse 287 | 288 | \SetupKeyvalOptions{% 289 | family=GP,% 290 | prefix=GPOpt@% 291 | } 292 | 293 | \DeclareStringOption[std]{pattern} 294 | \DeclareStringOption[std]{colorset} 295 | 296 | \DeclareStringOption{majorcolor} 297 | \DeclareStringOption{minorcolor} 298 | \DeclareStringOption{bgcolor} 299 | 300 | \DeclareStringOption{patternsize} 301 | \DeclareStringOption[.7pt]{dotsize} 302 | 303 | \DeclareVoidOption{fullpage}{\GP@fullpagetrue} 304 | \DeclareVoidOption{textarea}{\GP@textareatrue} 305 | 306 | \DeclareStringOption{geometry} 307 | 308 | \ProcessKeyvalOptions* 309 | 310 | %% Can only have one of fullpage or textarea 311 | \ifGP@fullpage 312 | \ifGP@textarea 313 | \PackageError{gridpapers}{% 314 | Can not specify both fullpage and textarea, please remove one option}{} 315 | \fi 316 | \GP@fullnesssettrue 317 | \fi 318 | 319 | \ifGP@textarea 320 | \GP@fullnesssettrue 321 | \fi 322 | 323 | %% We keep track of this to know whether or not we would be overriding 324 | %% a previously-set page geometry 325 | \@ifpackageloaded{geometry} 326 | {\GP@geometrypreviouslyloadedtrue} 327 | {\GP@geometrypreviouslyloadedfalse% 328 | \PassOptionsToPackage{\GPOpt@geometry}{geometry}% 329 | \RequirePackage{geometry}% 330 | } 331 | 332 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 333 | %% Actual package code 334 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 335 | 336 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 337 | %% Some nice colors. 338 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 339 | \definecolor{plum}{rgb}{0.36078, 0.20784, 0.4} 340 | \definecolor{chameleon}{rgb}{0.30588, 0.60392, 0.023529} 341 | \definecolor{cornflower}{rgb}{0.12549, 0.29020, 0.52941} 342 | \definecolor{scarlet}{rgb}{0.8, 0, 0} 343 | \definecolor{brick}{rgb}{0.64314, 0, 0} 344 | \definecolor{sunrise}{rgb}{0.80784, 0.36078, 0} 345 | \definecolor{rosiebg}{RGB}{250,247,232} 346 | \definecolor{rosiegrid}{RGB}{186,137,113} 347 | 348 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 349 | %% The color to use for the null directions when drawing lightcones. 350 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 351 | \colorlet{lightlines}{scarlet!30} 352 | 353 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 354 | %% Pre-defined Color schemes 355 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 356 | %% Here are some pre-defined color schemes for the paper background 357 | %% and the major and minor grid lines. These are switched by using 358 | %% the option colorset=. The allowed values for colorset are in 359 | %% the list below. 360 | \define@choicekey*{GP}{colorset}[\val\nr]% 361 | %% Allowed values for colorset: 362 | {std,precocious,ghostly,brickred,engineer,plumpad}[std]{% 363 | \ifcase\nr\relax 364 | %% std 365 | \colorlet{minorcolor}{cornflower!30} 366 | \colorlet{majorcolor}{cornflower!50} 367 | \colorlet{bgcolor}{white} 368 | \or 369 | %% precocious 370 | \colorlet{minorcolor}{rosiegrid!50} 371 | \colorlet{majorcolor}{rosiegrid} 372 | \colorlet{bgcolor}{rosiebg} 373 | \or 374 | %% ghostly 375 | \colorlet{minorcolor}{gray!15} 376 | \colorlet{majorcolor}{gray!20} 377 | \colorlet{bgcolor}{white} 378 | \or 379 | %% brickred 380 | \colorlet{minorcolor}{brick!35} 381 | \colorlet{majorcolor}{brick!60} 382 | \colorlet{bgcolor}{scarlet!8} 383 | \or 384 | %% engineer 385 | \colorlet{minorcolor}{chameleon!50} 386 | \colorlet{majorcolor}{chameleon!80} 387 | \colorlet{bgcolor}{chameleon!10} 388 | \or 389 | %% plumpad 390 | \colorlet{minorcolor}{cornflower!40} 391 | \colorlet{majorcolor}{cornflower!70} 392 | \colorlet{bgcolor}{plum!10} 393 | \fi 394 | } 395 | 396 | %% Get the specified color set from the options 397 | \def\@setkeyhelper#1#2{% 398 | \setkeys{GP}{#2=#1} 399 | } 400 | \expandafter\@setkeyhelper\expandafter{\GPOpt@colorset}{colorset} 401 | 402 | %% If the user further specified majorcolor, minorcolor, and/or 403 | %% bgcolor, we now override the selected colorset 404 | \ifx\GPOpt@majorcolor\@empty 405 | \else 406 | \colorlet{majorcolor}{\GPOpt@majorcolor} 407 | \fi 408 | \ifx\GPOpt@minorcolor\@empty 409 | \else 410 | \colorlet{minorcolor}{\GPOpt@minorcolor} 411 | \fi 412 | \ifx\GPOpt@bgcolor\@empty 413 | \else 414 | \colorlet{bgcolor}{\GPOpt@bgcolor} 415 | \fi 416 | 417 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 418 | %% The size parameter -- different meanings for different patterns 419 | %% Will be reset by pattern code 420 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 421 | \newcommand{\GP@patternsize}{0.1in} 422 | 423 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 424 | %% This section sets up a routine for filling a shape with 425 | %% hexagons. Uses code from: 426 | %% http://tex.stackexchange.com/questions/6019/drawing-hexagons/6128#6128 427 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 428 | 429 | %% We have to delay this definition until after \GP@patternsize is 430 | %% redefined (by the pattern selection and/or user override) 431 | \newcommand{\GP@declarehexpat}{ 432 | \tikzdeclarepattern{ 433 | name=hexagons, 434 | type=uncolored, 435 | bounding box={(0,0) and (3*\GP@patternsize,0.866025*2*\GP@patternsize)}, 436 | tile size={(3*\GP@patternsize,0.866025*2*\GP@patternsize)}, 437 | parameters={\tikzhexrotate}, 438 | tile transformation={rotate=\tikzhexrotate}, 439 | defaults={ 440 | rotate/.store in=\tikzhexrotate,rotate=0, 441 | }, 442 | code={ 443 | \pgfsetlinewidth{0.6pt} 444 | \pgftransformshift{\pgfpoint{0mm}{0.866025*\GP@patternsize}} 445 | \pgfpathmoveto{\pgfpoint{0mm}{0mm}} 446 | \pgfpathlineto{\pgfpoint{0.5*\GP@patternsize}{0mm}} 447 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{-0.866025*\GP@patternsize}} 448 | \pgfpathlineto{\pgfpoint{2*\GP@patternsize}{-0.866025*\GP@patternsize}} 449 | \pgfpathlineto{\pgfpoint{2.5*\GP@patternsize}{0mm}} 450 | \pgfpathlineto{\pgfpoint{3*\GP@patternsize}{0mm}} 451 | \pgfpathmoveto{\pgfpoint{0.5*\GP@patternsize}{0mm}} 452 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{0.866025*\GP@patternsize}} 453 | \pgfpathlineto{\pgfpoint{2*\GP@patternsize}{0.866025*\GP@patternsize}} 454 | \pgfpathlineto{\pgfpoint{2.5*\GP@patternsize}{0mm}} 455 | \pgfusepath{stroke} 456 | } 457 | } 458 | } 459 | 460 | 461 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 462 | %% This section sets up a routine for filling a shape with 463 | %% triangles. 464 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 465 | 466 | %% We have to delay this definition until after \GP@patternsize is 467 | %% redefined (by the pattern selection and/or user override) 468 | \newcommand{\GP@declaretripat}{ 469 | \tikzdeclarepattern{ 470 | name=triangles, 471 | type=uncolored, 472 | bounding box={(0,0) and (\GP@patternsize,2*0.866025*\GP@patternsize)}, 473 | tile size={(\GP@patternsize,2*0.866025*\GP@patternsize)}, 474 | parameters={\tikztrirotate}, 475 | tile transformation={rotate=\tikztrirotate}, 476 | defaults={ 477 | rotate/.store in=\tikztrirotate,rotate=0, 478 | }, 479 | code={ 480 | \pgfsetlinewidth{0.6pt} 481 | \pgfpathmoveto{\pgfpoint{0mm}{0mm}} 482 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{2*0.8660254*\GP@patternsize}} 483 | \pgfpathlineto{\pgfpoint{0mm}{2*0.8660254*\GP@patternsize}} 484 | \pgfpathmoveto{\pgfpoint{0mm}{0.8660254*\GP@patternsize}} 485 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{0.8660254*\GP@patternsize}} 486 | \pgfpathmoveto{\pgfpoint{0mm}{2*0.8660254*\GP@patternsize}} 487 | \pgfpathlineto{\pgfpoint{\GP@patternsize}{0mm}} 488 | \pgfpathlineto{\pgfpoint{0mm}{0mm}} 489 | \pgfusepath{stroke} 490 | } 491 | } 492 | } 493 | 494 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 495 | %% This section sets up a routine for filling the squares in a 496 | %% grid with null lines. 497 | %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 498 | %% TODO Still can't figure out the correct pattern shift!! 499 | \newcommand{\GP@declarelightconepat}{ 500 | \pgfkeys{ 501 | /pgf/pattern keys/myshift/.store in=\myshift, 502 | /pgf/pattern keys/myshift/.initial={(0,0)}, 503 | } 504 | \tikzdeclarepattern{ 505 | name=lightcones, 506 | type=uncolored, 507 | parameters={\myshift}, 508 | bounding box={(0,0) and (\GP@patternsize,\GP@patternsize)}, 509 | tile size={(\GP@patternsize, \GP@patternsize)}, 510 | tile transformation={ 511 | shift=\myshift, 512 | }, 513 | defaults={ 514 | myshift/.store in=\myshift,myshift={(0,0)}, 515 | }, 516 | code={ 517 | %% TODO Make the dashing an option 518 | \tikzset{lightlines/.style={line width=0.4pt,dash=on 0.05cm off 0.05cm phase 0.025cm}} 519 | \draw [lightlines] (0,0) -- (\GP@patternsize,\GP@patternsize); 520 | \draw [lightlines] (0,\GP@patternsize) -- (\GP@patternsize,0); 521 | }, 522 | } 523 | } 524 | %% \pgfdeclarepatternformonly 525 | %% {lightcones}% name 526 | %% {\pgfpointorigin}% lower left 527 | %% {\pgfpoint{\GP@patternsize}{\GP@patternsize}}% upper right 528 | %% {\pgfpoint{\GP@patternsize}{\GP@patternsize}}% tile size 529 | %% {% shape description 530 | %% \pgfsetlinewidth{0.4pt} 531 | %% %% TODO Make an option 532 | %% %Comment out this line for solid lines on light cones, instead of dashes. 533 | %% \pgfsetdash{{0.05cm}{0.05cm}}{0.025cm} 534 | %% \pgfpathmoveto{\pgfpoint{0in}{0in}} 535 | %% \pgfpathlineto{\pgfpoint{\GP@patternsize}{\GP@patternsize}} 536 | %% \pgfpathmoveto{\pgfpoint{0in}{\GP@patternsize}} 537 | %% \pgfpathlineto{\pgfpoint{\GP@patternsize}{0in}} 538 | %% \pgfusepath{stroke} 539 | %% } 540 | 541 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 542 | %% This section sets up a routine for filling a region with dots 543 | %% Slightly modified version of code added by Leo 544 | %% Stein (@duetosymmetry on Twitter). 545 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 546 | %% We have to delay this definition until after \GP@patternsize is 547 | %% redefined (by the pattern selection and/or user override) 548 | \newcommand{\GP@declaredotpat}{ 549 | \pgfdeclarepatternformonly 550 | {dotgrid}%% name 551 | {\pgfpoint{-0.5*\GP@patternsize}{-0.5*\GP@patternsize}}%% lower left 552 | {\pgfpoint{0.5*\GP@patternsize}{0.5*\GP@patternsize}}%% upper right 553 | {\pgfpoint{\GP@patternsize}{\GP@patternsize}}%% tile size 554 | {%% shape description 555 | \pgfpathcircle{\pgfqpoint{0pt}{0pt}}{\GPOpt@dotsize} 556 | \pgfusepath{fill} 557 | } 558 | } 559 | 560 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 561 | %% Begin pattern execution infrastructure 562 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 563 | 564 | %% This inner code will be set by the choicekey pattern=... 565 | \newcommand{\GP@innerpatterncode}{} 566 | %% This is the "outer" code to hook into every page 567 | \newcommand{\GP@patterncode}{% No blank lines in this code! 568 | \begin{tikzpicture}[remember picture, overlay] 569 | %% 570 | %% Change "thin" to "very thin" if the lines are too thick. 571 | \tikzset{ 572 | minorgrid/.style={minorcolor, thin}, 573 | majorgrid/.style={majorcolor, thin}, 574 | } 575 | \ifGP@fullpage% 576 | \coordinate (a) at (current page.south west); 577 | \coordinate (b) at (current page.north east); 578 | \else% 579 | \coordinate (a) at (current page text area.south west); 580 | \coordinate (b) at (current page text area.north east); 581 | \fi 582 | %% 583 | \GP@innerpatterncode% 584 | %% 585 | \end{tikzpicture} 586 | } 587 | 588 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 589 | %% Begin pattern definition code 590 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 591 | 592 | \define@boolkey{GP}{patterndefaultfullness}{} 593 | \newcommand{\GP@patterndefaultgeometry}{} 594 | \newcommand{\GP@patterndefaultsize}{} 595 | 596 | %% Pattern-definer-helper 597 | %% The interface is: 598 | %% \GP@setpattern 599 | %% {} 600 | %% {} 601 | %% {} %% NOTE, not tile length 602 | %% {} 603 | \newcommand{\GP@setpattern}[4]{% 604 | \setkeys{GP}{patterndefaultfullness=#1} 605 | \renewcommand{\GP@patterndefaultgeometry}{#2} 606 | \renewcommand{\GP@patterndefaultsize}{#3} 607 | \renewcommand{\GP@innerpatterncode}{#4} 608 | } 609 | 610 | \define@choicekey*{GP}{pattern}[\val\nr]% 611 | %% Allowed values for pattern: 612 | {std,stdeight,majmin,dot,hex,hexup,tri,iso,lightcone,ruled,doubleruled}{% 613 | \ifcase\nr\relax 614 | %% std 615 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 616 | %% Quadrille, ten squares per inch. 617 | %% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 618 | \GP@setpattern{false}{letterpaper, margin=0.2in}{0.1in}{% 619 | %% Draw a grid with 10 squares per inch. 620 | \draw[style=minorgrid, shift={(a)}] (0,0) grid [step=\GP@patternsize] (b); 621 | %% 622 | %% Draw a frame around the grid. 623 | \draw[style=majorgrid] (a) rectangle (b); 624 | } 625 | \or 626 | %% stdeight 627 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 628 | %% Quadrille, eight squares per inch. 629 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 630 | \GP@setpattern{false}{letterpaper, margin=0.1875in}{0.125in}{% 631 | %% Draw a grid with 10 squares per inch. 632 | \draw[style=minorgrid, shift={(a)}] (0,0) grid [step=\GP@patternsize] (b); 633 | %% 634 | %% Draw a frame around the grid. 635 | \draw[style=majorgrid] (a) rectangle (b); 636 | } 637 | \or 638 | %% majmin 639 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 640 | %% Graph paper, eight squares per inch with a major grid 641 | %% every half-inch. 642 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 643 | \GP@setpattern{false}{letterpaper, margin=0.25in}{0.125in}{% 644 | %% Draw a grid with 10 squares per inch. 645 | \draw[style=minorgrid, shift={(a)}] (0,0) grid [step=\GP@patternsize] (b); 646 | %% 647 | \draw[style=majorgrid, shift={(a)}] (0,0) grid [step=4*\GP@patternsize] (b); 648 | %% 649 | %% Draw a frame around the grid. 650 | \draw[style=majorgrid] (a) rectangle (b); 651 | } 652 | \or 653 | %% dot 654 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 655 | %% Dot grid 656 | %% Slightly modified version of code added by Leo 657 | %% Stein (@duetosymmetry). 658 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 659 | \GP@setpattern{true}{}{0.1in}{% 660 | \fill [pattern=dotgrid,pattern color=minorcolor] (a) rectangle (b); 661 | } 662 | \or 663 | %% hex 664 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 665 | %% Hex grid 666 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 667 | \GP@setpattern{true}{}{0.1666in}{% 668 | \fill [pattern=hexagons,pattern color=minorcolor] (a) rectangle (b); 669 | } 670 | \or 671 | %% hexup 672 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 673 | %% Hex-up grid 674 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 675 | \GP@setpattern{true}{}{0.1666in}{% 676 | \fill [pattern={hexagons[rotate=90]},pattern color=minorcolor] (a) rectangle (b); 677 | } 678 | \or 679 | %% tri 680 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 681 | %% Triangle grid, adjust triangle size in the preamble 682 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 683 | \GP@setpattern{true}{}{0.25in}{% 684 | \fill [pattern=triangles,pattern color=minorcolor] (a) rectangle (b); 685 | } 686 | \or 687 | %% iso 688 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 689 | %% Isometric grid 690 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 691 | \GP@setpattern{true}{}{0.25in}{% 692 | \fill [pattern={triangles[rotate=90]}, pattern color=minorcolor] (a) rectangle (b); 693 | } 694 | \or 695 | %% lightcone 696 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 697 | %% A grid with light cones. 698 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 699 | \GP@setpattern{false}{letterpaper, margin=.125in}{0.25in}{% 700 | %% Draw a grid with 4 squares per inch. 701 | \draw[style=minorgrid, shift={(a)}] (0,0) coordinate grid [step=\GP@patternsize] (b); 702 | %% 703 | %% Draw a border around the grid. 704 | \draw[style=majorgrid, pattern={lightcones[myshift={(a)}]}, pattern color=lightlines] (a) rectangle (b); 705 | } 706 | \or 707 | %% ruled 708 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 709 | %% Ruled page with bold lines every 0.2in or 0.25in 710 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 711 | \GP@setpattern{false}{letterpaper, body={8in,10.8in}}{0.2in}{% 712 | %% Draw a ruled page with lines every 0.2in 713 | \draw[style=majorgrid, shift={(a)}] (0,0) grid [ystep=\GP@patternsize, xstep=\paperwidth] (b); 714 | %% Draw a frame around the grid. 715 | \draw[style=majorgrid] (a) rectangle (b); 716 | } 717 | \or 718 | %% doubleruled 719 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 720 | %% Ruled page with bold lines every 0.25in and light lines 721 | %% every 0.125 in. 722 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 723 | \GP@setpattern{false}{letterpaper, margin=.25in}{0.125in}{% 724 | %% Draw a ruled pattern with thin lines every 0.125 in and bold lines every 0.25 in. 725 | \draw[style=minorgrid, shift={(a)}] (0,0) grid [ystep=\GP@patternsize, xstep=\paperwidth] (b); 726 | %% 727 | \draw[style=majorgrid, shift={(a)}] (0,0) grid [ystep=2*\GP@patternsize, xstep=\paperwidth] (b); 728 | %% 729 | %% Draw a frame around the grid. 730 | \draw[style=majorgrid] (a) rectangle (b); 731 | } 732 | \fi 733 | } 734 | 735 | %% Use the passed package option to set the above key 736 | \expandafter\@setkeyhelper\expandafter{\GPOpt@pattern}{pattern} 737 | 738 | %% Determine whether or not to (re)set fullpage vs textarea 739 | \ifGP@fullnessset 740 | %% Respect their choice 741 | \else 742 | %% Reset the value of \GP@fullpage based on the pattern's default 743 | %% There's probably a more idiomatic way to do this but I can't 744 | %% figure it out 745 | \ifKV@GP@patterndefaultfullness 746 | \GP@fullpagetrue 747 | \else 748 | \GP@fullpagefalse 749 | \fi 750 | \fi 751 | 752 | %% Determine whether or not to fiddle with the page geometry 753 | \ifGP@geometrypreviouslyloaded 754 | %% Respect their previous choice 755 | \PackageWarning{gridpapers}{'geometry' package was previously loaded, will not use pattern defaults.} 756 | \else 757 | %% Use the pattern's defaults, 758 | \expandafter\geometry\expandafter{\GP@patterndefaultgeometry} 759 | %% And then override with any more specific settings passed by the user 760 | \expandafter\geometry\expandafter{\GPOpt@geometry} 761 | \fi 762 | 763 | %% Determine the correct pattern length 764 | \ifx\GPOpt@patternsize\@empty 765 | % Use the pattern's preferred length 766 | \renewcommand{\GP@patternsize}{\GP@patterndefaultsize} 767 | \else 768 | % Override with the user's choice 769 | \renewcommand{\GP@patternsize}{\GPOpt@patternsize} 770 | \fi 771 | 772 | %% Now that everything has been set up, we can finally define the 773 | %% patterns with the correct lengths. 774 | \GP@declarehexpat 775 | \GP@declaretripat 776 | \GP@declarelightconepat 777 | \GP@declaredotpat 778 | 779 | %% Set the background color. 780 | \AtBeginDocument{\pagecolor{bgcolor}} 781 | %% Actually hook it in! 782 | \AddEverypageHook{% 783 | \GP@patterncode% 784 | } 785 | 786 | \endinput 787 | % \end{macrocode} 788 | % 789 | % \iffalse 790 | % 791 | % \fi 792 | % 793 | % \Finale 794 | \endinput 795 | --------------------------------------------------------------------------------