Last active
February 16, 2024 08:34
-
-
Save mcnees/f82fae1a2a386045bcf6f98413658598 to your computer and use it in GitHub Desktop.
Make your own quadrille, graph, hex, etc paper! Uses the pgf/TikZ package for LaTeX, which should be part of any modern TeX installation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%----------------------------------------------------------------------- | |
%% Make your own quadrille, graph, hex, etc paper! | |
%% Uses the pgf/TikZ package for LaTeX, which should be part of | |
%% any modern TeX installation. | |
%% Email: [email protected] | |
%% Twitter: @mcnees | |
%%----------------------------------------------------------------------- | |
\documentclass[11pt]{article} | |
%%----------------------------------------------------------------------- | |
%% This package gives small margins so you use less | |
%% paper. | |
%%----------------------------------------------------------------------- | |
\usepackage[cm]{fullpage} | |
%%----------------------------------------------------------------------- | |
%% Packages needed for the drawing routines and for mixing custom | |
%% colors. | |
%%----------------------------------------------------------------------- | |
\usepackage{tikz} | |
\usetikzlibrary{patterns} | |
\usepackage{xcolor} | |
%%----------------------------------------------------------------------- | |
%% Some nice colors. | |
%%----------------------------------------------------------------------- | |
\definecolor{plum}{rgb}{0.36078, 0.20784, 0.4} | |
\definecolor{chameleon}{rgb}{0.30588, 0.60392, 0.023529} | |
\definecolor{cornflower}{rgb}{0.12549, 0.29020, 0.52941} | |
\definecolor{scarlet}{rgb}{0.8, 0, 0} | |
\definecolor{brick}{rgb}{0.64314, 0, 0} | |
\definecolor{sunrise}{rgb}{0.80784, 0.36078, 0} | |
%%----------------------------------------------------------------------- | |
%% Colors used for the minor and major grids. | |
%%----------------------------------------------------------------------- | |
%% A light blue color for the minor grid. | |
\colorlet{minorcolor}{cornflower!35} | |
%% A darker blue color for the major grid and/or frame. | |
\colorlet{majorcolor}{cornflower!60} | |
%% You can make either one darker by changing the number after the "!". | |
%% For instance, cornflower!75 would be much darker. | |
%%----------------------------------------------------------------------- | |
%% Comment out the previous lines and uncomment the following lines for | |
%% graph paper with a light green color, like on an engineering pad. | |
%%----------------------------------------------------------------------- | |
% \colorlet{minorcolor}{chameleon!30} | |
% \colorlet{majorcolor}{chameleon!50} | |
%%----------------------------------------------------------------------- | |
%% This section sets up a routine for filling a shape with | |
%% hexagons. Uses code from: | |
%% http://tex.stackexchange.com/questions/6019/drawing-hexagons/6128#6128 | |
%%----------------------------------------------------------------------- | |
% Big hexagons | |
%\def\hexagonsize{0.1666in} | |
% Small hexagons | |
\def\hexagonsize{0.0833in} | |
\pgfdeclarepatternformonly | |
{hexagons}% name | |
{\pgfpointorigin}% lower left | |
{\pgfpoint{3*\hexagonsize}{0.866025*2*\hexagonsize}} | |
{\pgfpoint{3*\hexagonsize}{0.866025*2*\hexagonsize}} | |
{ | |
\pgfsetlinewidth{0.6pt} | |
\pgftransformshift{\pgfpoint{0mm}{0.866025*\hexagonsize}} | |
\pgfpathmoveto{\pgfpoint{0mm}{0mm}} | |
\pgfpathlineto{\pgfpoint{0.5*\hexagonsize}{0mm}} | |
\pgfpathlineto{\pgfpoint{\hexagonsize}{-0.866025*\hexagonsize}} | |
\pgfpathlineto{\pgfpoint{2*\hexagonsize}{-0.866025*\hexagonsize}} | |
\pgfpathlineto{\pgfpoint{2.5*\hexagonsize}{0mm}} | |
\pgfpathlineto{\pgfpoint{3*\hexagonsize+0.2mm}{0mm}} | |
\pgfpathmoveto{\pgfpoint{0.5*\hexagonsize}{0mm}} | |
\pgfpathlineto{\pgfpoint{\hexagonsize}{0.866025*\hexagonsize}} | |
\pgfpathlineto{\pgfpoint{2*\hexagonsize}{0.866025*\hexagonsize}} | |
\pgfpathlineto{\pgfpoint{2.5*\hexagonsize}{0mm}} | |
\pgfusepath{stroke} | |
} | |
%%----------------------------------------------------------------------- | |
%% This section sets up a routine for filling the squares in a | |
%% grid with null lines. | |
%%----------------------------------------------------------------------- | |
\def\squaresize{0.25in} | |
\pgfdeclarepatternformonly | |
{lightcones}% name | |
{\pgfpointorigin}% lower left | |
{\pgfpoint{\squaresize}{\squaresize}}% upper right | |
{\pgfpoint{\squaresize}{\squaresize}}% tile size | |
{% shape description | |
\pgfsetlinewidth{0.4pt} | |
%Comment out this line for solid lines on light cones, instead of dashes. | |
\pgfsetdash{{0.05cm}{0.05cm}}{0.025cm} | |
\pgfpathmoveto{\pgfpoint{0in}{0in}} | |
\pgfpathlineto{\pgfpoint{\squaresize}{\squaresize}} | |
\pgfpathmoveto{\pgfpoint{0in}{\squaresize}} | |
\pgfpathlineto{\pgfpoint{\squaresize}{0in}} | |
\pgfusepath{stroke} | |
} | |
%%----------------------------------------------------------------------- | |
%% This section sets up a routine for filling a region with dots | |
%% Slightly modified version of code added by Leo | |
%% Stein (@duetosymmetry on Twitter). | |
%%----------------------------------------------------------------------- | |
% Big squares | |
% \def\dotgridsquaresize{0.2in} | |
% Small squares | |
\def\dotgridsquaresize{0.1in} | |
\def\dotsize{.7pt} | |
\pgfdeclarepatternformonly | |
{dotgrid}% name | |
{\pgfpoint{-0.5*\dotgridsquaresize}{-0.5*\dotgridsquaresize}}% lower left | |
{\pgfpoint{0.5*\dotgridsquaresize}{0.5*\dotgridsquaresize}}% upper right | |
{\pgfpoint{\dotgridsquaresize}{\dotgridsquaresize}}% tile size | |
{% shape description | |
\pgfpathcircle{\pgfqpoint{0pt}{0pt}}{\dotsize} | |
\pgfusepath{fill} | |
} | |
\begin{document} | |
% No page numbers! | |
\thispagestyle{empty} | |
%%-(Section)------------------------------------------------------------- | |
%%----------------------------------------------------------------------- | |
%% Use this section for quadrille, ten squares per inch. | |
%%----------------------------------------------------------------------- | |
\begin{tikzpicture}[remember picture, overlay] | |
% Change "very thin" to "thin" if the lines are too thin. | |
\tikzset{ | |
minorgrid/.style={minorcolor, thin}, | |
majorgrid/.style={majorcolor, thin}, | |
} | |
% Draw a grid with 10 squares per inch. | |
\draw[style=minorgrid, shift={(current page.south west)},shift={(0.2in,0.2in)}] (0,0) coordinate (a) grid | |
[step=0.1in] (8.1in,10.6in) coordinate (b); | |
% Draw a frame around the grid. | |
\draw[style=majorgrid] (a) rectangle (b); | |
\end{tikzpicture} | |
%%-(Section)------------------------------------------------------------- | |
%%----------------------------------------------------------------------- | |
%% Use this section for quadrille, eight squares per inch. | |
%%----------------------------------------------------------------------- | |
% \begin{tikzpicture}[remember picture, overlay] | |
% | |
% % Change "very thin" to "thin" if the lines are too thin. | |
% \tikzset{ | |
% minorgrid/.style={minorcolor, thin}, | |
% majorgrid/.style={majorcolor, thin}, | |
% } | |
% | |
% % Draw a grid with 10 squares per inch. | |
% \draw[style=minorgrid, shift={(current page.south west)},shift={(0.1875in,0.1875in)}] (0,0) coordinate (a) | |
% grid [step=0.125in] (8.125in,10.625in) coordinate (b); | |
% | |
% % Draw a frame around the grid. | |
% \draw[style=majorgrid] (a) rectangle (b); | |
% | |
% \end{tikzpicture} | |
%%-(Section)------------------------------------------------------------- | |
%%----------------------------------------------------------------------- | |
%% Use this part for graph, eight squares per inch with a major grid | |
%% every half-inch. | |
%%----------------------------------------------------------------------- | |
% \begin{tikzpicture}[remember picture, overlay] | |
% | |
% % Change "very thin" to "thin" if the lines are too thin. | |
% \tikzset{ | |
% minorgrid/.style={minorcolor, thin}, | |
% majorgrid/.style={majorcolor, thin}, | |
% } | |
% | |
% % Draw a grid with 10 squares per inch. | |
% \draw[style=minorgrid, shift={(current page.south west)},shift={(0.225in,0.25in)}] (0,0) coordinate (a) grid [step=0.125in] (8in,10.5in) coordinate (b); | |
% | |
% \draw[style=majorgrid, shift={(current page.south west)},shift={(0.225in,0.25in)}] (0,0) coordinate (a) grid [step=0.5in] (8in,10.5in) coordinate (b); | |
% | |
% % Draw a frame around the grid. | |
% \draw[style=majorgrid] (a) rectangle (b); | |
% | |
% \end{tikzpicture} | |
%%-(Section)------------------------------------------------------------- | |
%%----------------------------------------------------------------------- | |
%% Use this section to draw a dot grid on the page. | |
%% Slightly modified version of code added by Leo | |
%% Stein (@duetosymmetry). | |
%%----------------------------------------------------------------------- | |
% \begin{tikzpicture}[remember picture,overlay]% | |
% \node at (current page.north west) [anchor=north west, inner sep=0pt, outer sep=0.18in]{ | |
% \tikz{ | |
% \fill [pattern=dotgrid,pattern color=minorcolor] (0.02,0) rectangle (8.14in,10.64in); | |
% } | |
% }; | |
% \end{tikzpicture} | |
%%-(Section)------------------------------------------------------------- | |
%%----------------------------------------------------------------------- | |
%% Use this section to draw a hex grid on the page. | |
%%----------------------------------------------------------------------- | |
% \begin{tikzpicture}[remember picture,overlay]% | |
% \node at (current page.north west) [anchor=north west, inner sep=0pt, outer sep=0.0in]{ | |
% \tikz{ | |
% \fill [pattern=hexagons,pattern color=minorcolor] (0,0) rectangle (8.5in,11in); | |
% } | |
% }; | |
% \end{tikzpicture} | |
%%-(Section)------------------------------------------------------------- | |
% %%----------------------------------------------------------------------- | |
% %% Use this section to draw a grid with light cones. | |
% %%----------------------------------------------------------------------- | |
% | |
% % The color to use for the null directions. | |
% \colorlet{lightlines}{scarlet!30} | |
% | |
% % Colors and line style for the squares and the border. | |
% \tikzset{ | |
% minorgrid/.style={cornflower!30, thin}, | |
% majorgrid/.style={cornflower!50, thick}, | |
% } | |
% | |
% \begin{tikzpicture}[remember picture, overlay] | |
% % Draw a grid with 4 squares per inch. | |
% \draw[style=minorgrid, shift={(current page.south west)}] (0.25in,0.25in) coordinate (a) grid | |
% [step=0.25in] (8.25in,10.75in) coordinate (b); | |
% | |
% % Draw a border around the grid. | |
% \draw[style=majorgrid] (a) rectangle (b); | |
% | |
% % Now fill the grid with 45 degree lines in the color defined for null directions. | |
% \node at (current page.south west) [anchor=south west, inner sep=0, style=majorgrid, shift={(a)}]{ | |
% \tikz{ | |
% \fill [pattern=lightcones,pattern color=lightlines] (0.25in,0.25in) rectangle (8.25in,10.75in); | |
% } | |
% }; | |
% | |
% \end{tikzpicture} | |
%%-(End)------------------------------------------------------------- | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment