# Auto Generate Table with Tons of + and -

i want to create a table containing lots of "+","-" and "0", which depend on the column and row number by (quite simple) mathematical formulas which are known to me. I could enter the signs by hand but i think it would be better to generate them automatically somehow, i.e. to implement the logic which determines the entrys, for two reasons:

• My formulas may turn out to be wrong some day...
• It is in the spirit of dividing layout and content.

To give you an impression, i have scanned a sketch on paper.

As you can see, there are actually four entrys for each row and column. I'd like to know if anyone here has some hints on how to realize something like that.

-
see this answer to merge columns. This should also help with multirows. As for the generation of the +,-,0 this could be easly done in an external program like Excel or DoE software and then using excel2latex get the start of a table in LaTeX –  Leeser Aug 2 '12 at 15:04
Where is the problem? If you can calculate the value then do it. –  Ulrike Fischer Aug 2 '12 at 15:04
Ok, with the multirow and multicol package it is quite nice to format the table and enter the entrys by hand. How can i automate the process of entering the values? –  Robert Rauch Aug 2 '12 at 16:19
With pgfplotstable you typeset tables from data files or mathematical expressions. –  Ignasi Aug 2 '12 at 16:21

You don't really need any extra packages for this, picture mode is quite useful here. I made up a random formula to decide between 0, +, -, and also to aid debugging have an additional output of the two integers being used (twice the label, more or less).

\documentclass{article}

\newcount\ci
\newcount\cj

\begin{document}

\fbox{\boldmath
\begin{picture}(300,300)

\linethickness{2pt}

\multiput(30,30)(30,0){9}{\line(0,1){240}}
\multiput(30,30)(0,30){9}{\line(1,0){240}}

\thinlines

\multiput(30,30)(15,0){17}{\line(0,1){240}}
\multiput(30,30)(0,15){17}{\line(1,0){240}}

\global\ci0

\global\cj0

\global\ci0
\multiput(37.5,0)(15,0){16}{%
\global\cj0
\multiput(0,37.5)(0,15){16}{%
\makebox(0,0){\ifodd\ci\ifodd\cj$+$\else$-$\fi
\else\ifodd\cj$+$\else$0$\fi\fi}}