I want to print some calculations into a graph paper (just some easy calculations like adding some numbers...).
An (ugly) example with a tabular:
\begin{tabular}{|*{10}{r|}}\hline
& & & & & & & & & \\\hline
& & 1 & + & & 1 & = & & & 2\\\hline
& 1 & 1 & + & & 1 & = & & 1 & 2\\\hline
& 1 & 1 & + & 1& 1 & = & & 2 & 2\\\hline
& & & & & & & & & \\\hline
\end{tabular}

There are some solutions to print a graph paper/squared paper:
- http://texwelt.de/wissen/fragen/2639/wie-kann-ich-kastchenpapier-zeichnen
- http://www.texample.net/tikz/examples/graph-paper/
- A package to help with layout generation? Graph paper in the background?
- http://www.ctan.org/pkg/graphpap
So I tried to find a solution with a graph paper, but I have problems to write the text into the squared boxes.
My solution up to now:
\documentclass[12pt,a6paper]{scrartcl}
\usepackage{tikz}
\usepackage{ifthen}
\newcounter{gridypos}
\newenvironment{squaredpaper}[2][0.5cm]{%
\setcounter{gridypos}{#2}
\newcommand\gridtext[2][\relax]{
\ifthenelse{\equal{##1}{\relax}}{}{
\setcounter{gridypos}{#2}
\addtocounter{gridypos}{-##1}
\addtocounter{gridypos}{1}
}
\node[anchor=west] at (0,0) [yshift=\value{gridypos}*#1-.5*#1]{##2}; %fixme one box per character(including spaces)
\addtocounter{gridypos}{-1}%Next \gridtext one line lower
}
%Make the grid
%Source: http://texwelt.de/wissen/fragen/2639/wie-kann-ich-kastchenpapier-zeichnen
\begin{tikzpicture}[gray,step=#1]
\pgfmathtruncatemacro\anzahl{(\linewidth-\pgflinewidth)/#1} % maximale Anzahl Kaestchen pro Zeile
\draw (0,0) rectangle (\anzahl*#1,#2*#1) (0,0) grid (\anzahl*#1,#2*#1);
}{
\end{tikzpicture}
}
\begin{document}
\begin{squaredpaper}{20}
%Start on top line and go down.
\gridtext{ 1+ 1= 2}
\gridtext{ 1+ 2= 3}
\gridtext{ 1+ 3= 4}
\gridtext{ 1+10=11}
%Make fix positions
\gridtext[10]{10+10=20} %Start in line 10
\gridtext[15]{15+10=25} %Start in line 15
\gridtext[18]{18+10=28} %Start in line 18
\end{squaredpaper}
\end{document}
The result:

There are two missing things:
- The macro \gridtext should get a 2nd parameter to define the x-pos (I think that's something I can make on my own if my other problem is solved)
- The text does not fit into the squared boxes (one character (number, operator or space) per box)
There are some ideas how I can do it, but I have no idea, how to do it:
- parse the parameter and position character by character into its box.
- Use a monospace font with the exact length of the optional parameter of my squaredpaper-environment.
Remarks:
- The spaces in the \gridtext parameter should be respected (and if this is to difficult I could use ~ as placeholder.)
- Up to now I don't want to add a text, but maybe a *-variant of \gridtext to add text would be fine (but I think, that's something I could do on my own if I need it).


