Take the 2-minute tour ×
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.

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.

enter image description here

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.

share|improve this question
    
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
1  
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
1  
With pgfplotstable you typeset tables from data files or mathematical expressions. –  Ignasi Aug 2 '12 at 16:21
add comment

1 Answer

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).

enter image description here

\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
\multiput(45,25)(30,0){8}{\makebox(0,0){\the\ci \global\advance\ci1}}

\global\cj0
\multiput(25,45)(0,30){8}{\makebox(0,0){\the\cj \global\advance\cj1}}


\global\ci0
\multiput(37.5,0)(15,0){16}{%
\global\cj0
\multiput(0,37.5)(0,15){16}{%
\makebox(0,0){\raisebox{-12pt}{\tiny \the\ci\,\the\cj \global\advance\cj1}}
\makebox(0,0){\ifodd\ci\ifodd\cj$+$\else$-$\fi
               \else\ifodd\cj$+$\else$0$\fi\fi}}
\global\advance\ci1
}


\end{picture}}

\end{document}
share|improve this answer
    
This looks quite promising. Unfourtunately I will not have time to work on this until august 14th, but i will report on my progress then. Thank you very much! –  Robert Rauch Aug 3 '12 at 12:45
add comment

Your Answer

 
discard

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.