In a paper, I'm using a large amount of associative tables. Tables with a key and value. Since both the keys and values are quite short, this is quite space inefficient.

One could repeat the column headers and thus make more use of a row. For example

H1 H2
A  1
B  2
C  3
D  4


H1 H2 H1 H2
A  1  C  3
B  2  D  4

Is their a package to handle such transformations automatically. Doing this manually is quite cumbersome (because the tables are generated by programs) and if it is not always straight forward how much repeats fit on one page...

  • 1
    Not really an answer, but why not just write a script (e.g. in python) that reads the table as a text file and outputs the latex code as you want it to be? That should be pretty straightforward. – yori Jun 9 '13 at 14:50
  • have a look at pgfplotstable – cmhughes Jun 9 '13 at 15:26
  • @Yori: I've written such scripts in the past. The problem is that one cannot really measure if a table with n columns will fit on a page. Furthermore it's not really the LaTeX way to worry about layout: the philosophy is that one only writes "the content" of the report and LaTeX being smart enough to figure it out itself. – Willem Van Onsem Jun 9 '13 at 15:49

This could do with a bit more work (it doesn't actually allocate any space for the headings it inserts so you get overfull page warnings and could overprint the footer in principle) but it could be improved, or it might be OK as it is.

It shows a two column table spread over three page columns and two pages.

enter image description here


\setbox\count@\vbox{\hbox to \columnwidth{%
   \bfseries Head A\hfill Head B}\box\count@}}%


\noindent X\dotfill X


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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