6

Is it possible to have graph paper as an underlay and then run the usual latex commands?

For instance, instead of having a latex document written on a blank page, is it possible for the page to be graph paper instead?

I'm a tikz novice, but I'm proficient enough to do what I need to do, but grids and tikz and enumerated lists, don't play nicely together. If the paper was graph paper to begin with at least one of my problems would be solved.

I've found partial workarounds, although nothing definitive: one that allows me to have graph paper but only on the first page, and it overlays my title anyway - I use maketitle for that.

Any suggestions?

  • you mean blank instead of black [page], right? Your question is not clear for me: do you want to have a background for all the pages of your document? Or a background for all the tikz images? – ebosi May 25 '16 at 12:27
  • 1
    Create an image of a grid and use that as a background? (either for the total page or the area of your drawing) – Bort May 25 '16 at 12:29
  • Blank indeed, sorry about that. I'd like the background to be graph paper for all my pages, most work arounds do one page only, and they overlay everything, it needs to be an underlay, like a blank page, except it's graph paper, and everything on top of the graph paper. – Lino Vari May 25 '16 at 13:05
  • what about making the graph paper a separate image, then treating it as a watermark? see Watermark image – barbara beeton May 25 '16 at 13:51

1 Answers1

10

Here is a solution (needs several compilations):

\documentclass[a4paper]{article}

\def\mygraphpaper{%
  \begin{tikzpicture}
    \draw[line width=.4pt,draw=black!30] (0,0) grid[step=1mm] (\paperwidth,\paperheight);
    \draw[line width=.4pt,draw=red!50] (0,0) grid[step=1cm] (\paperwidth,\paperheight);
  \end{tikzpicture}%
}
\usepackage{tikz}
\usepackage{background}
\backgroundsetup{
  angle=0,
  contents=\mygraphpaper,
  color=black,
  scale=1,
}

\usepackage{lipsum}

\begin{document}
\lipsum
\end{document}

enter image description here

Paul Gaborit
  • 70,770
  • 10
  • 176
  • 283
  • Thanks for your suggestion, but it doesn't do what I want, I have a lists and tikz grids within the document, the code above doesn't draw the nice graph paper below the top few cm of every page. I'll see if I can adapt it to my needs. – Lino Vari May 25 '16 at 13:14
  • @LinoVari My code draws the grids on every page of the document. I don't understand your requirements... – Paul Gaborit May 25 '16 at 13:26
  • Sorry, but your solution is in fact perfect, I was indisposed and so couldn't add to my initial comment. My apologies, and thank you for your indulgence. – Lino Vari May 26 '16 at 07:34
  • Exactly what I needed. Took two builds. First build only drew on the top couple cms of the page. Second build worked perfect! – AgilePro Dec 06 '18 at 07:12