TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a math work, and I'd like to create a background which looks like a math notebook. Any idea how to do it ?

I found this solution, but I don't know how to put it in a mini-page ...

%%% quarre Kaestchenmuster

setlength{\unitlength}{.01\textwidth}% Einheit_1/100_Textweite
\multiput(2,0)(2,0){49}{\line(0,1){110}}% 110-VER
\multiput(0,2)(0,2){54}{\line(1,0){100}}% 54-HOR

would be great to combine it with this: Background image for minipage

share|improve this question
The background must be for the whole page or just for the text area? – Gonzalo Medina Dec 5 '11 at 19:52
for the text area, and also, how can i put it in a mini-page ? – Oz123 Dec 5 '11 at 20:02
For the text area, change \paperwith and \paperheight to \textwidth and \textheight, respectively, in my example. For a minipage, another approach will be needed, but you can use PGF/TikZ in that case. – Gonzalo Medina Dec 5 '11 at 20:10
up vote 11 down vote accepted

Here's one possible solution using the background package:



\SetBgContents{\tikz{\draw[step=\mylen] (-.5\paperwidth,-.5\paperheight) grid (.5\paperwidth,.5\paperheight);}}


enter image description here

And here's an adaptation for TikZ of the code found here, for the case of minipages; the main environment is gridmp with an optional argument (the color for the rules) and a mandatory argument (the width of the minipage):


  \begin{tikzpicture}[remember picture,overlay]
    \draw[step=3mm,color=#1] (0,0) grid (#3,#2);
    \draw[color=#1] (0,#2) --  (#3,#2);








enter image description here

share|improve this answer
this is great, but i need to break my head how to make it work on debian squeeze, i am missing some latex packages (pause.sty, background.sty)... – Oz123 Dec 5 '11 at 20:03
@Oz123 You can get background.dtx and background.ins from CTAN: ctan.org/tex-archive/macros/latex/contrib/background. Run latex background.ins to generate the .sty file that you can now place somewhere TeX can find it (your current working directory, for example). However, background uses PGF/TikZ, so if your system also lacks this package (or uses an old version), the problem will persists. Did you install your LaTeX system from the Debian repos? If so, it would be better to uninstall it and install TeX Live 2011 from TUG: tug.org/texlive. – Gonzalo Medina Dec 5 '11 at 20:08
Hmm... I appreciate your hint, but I rather not mess around with texlive. It might break other codes I need. So, I'll wait for debian. Can I somehow combine my partial solution with that link ??? – Oz123 Dec 5 '11 at 20:12
@Oz123: waiting for Debian repositories to get an updated LaTeX system could mean waiting for years (they still use TeX Live2009!). Anyway, download background.dtx and background.ins and proceed as I say in my previous comment, and keep your fingers crossed ;-) – Gonzalo Medina Dec 5 '11 at 20:21
I found this solution tug.org/PSTricks/Grids/overlay0.tex, but it won't compile , telling me "Undefined Control Sequence \end{dogrid}... any idea why? – Oz123 Dec 5 '11 at 20:31

From a German website a nice solution which does work with the old tex-live.

   \draw[step=0.5cm,color=gray] (0,0) grid (#1 cm ,#2 cm);

 \karos{15}{4} % Karos der Breite 15cm und Höhe 4cm

%mini page ohne 
\karos{8}{3} % Karos der Breite 8cm und Höhe 3cm
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.