I've been frustrated in recent applications with designing tables in LaTeX that have the properties I desire. I can almost always achieve the formatting I want, but a large part of my frustration comes from the fact that every formatting change is ad-hoc or appears like a hack. I am not a fan of this style of LaTeX design.

I was wondering if there is a single package that allows me to create a table environment with the following properties:

  1. I can specify the horizontal and vertical alignments of every row and column, individually.
  2. I can specify the height and width of every row and column, individually, either in terms of fixed lengths or stretching.
  3. Failing to specify one of the above yields a pleasing default behavior similar to the default tabular settings.
  4. The table is capable of spanning multiple pages without breaking.

The ideal formatting for me would be one for which, at the beginning of the environment, one can declare all the relevant spacing and alignment parameters for both rows and columns, and then the body of the table follows. Note that in the default tabular environment, this is true only of the columns; the formatting for each row appears in the body.

  • @DavidCarlisle I like the emphasis ................... – azetina Oct 22 '13 at 0:36
  • Haha, well, is there anything that can just do the first two? I recognize the difficulties in designing table environments that can work across multiple pages. – Christopher A. Wong Oct 22 '13 at 0:36
  • 4
    @azetina not so much emphasis, just obeying the site rules:-) – David Carlisle Oct 22 '13 at 0:37
  • 1
    I would specify rows in a syntax nearly identical to the column settings in tabular. Just as trying to make more columns than are specified (using too many &'s) breaks the output, specifying too many rows would do the same thing. – Christopher A. Wong Oct 22 '13 at 0:45
  • 3
    have you looked at the pgfplotstable package? – cmhughes Oct 22 '13 at 3:35

The One And Only Tabular Layout Package

You are asking for a package to improve the way to lay out your tabulars. On the German list TEX-D-L recently somebody required help to display data in a special way, depending whether the integer inside a cell differs from a standard value and Herbert Voss came up with a very nice and short solution:


\begin{tabular}{@{} *5{>{\checkVal}c<{!!}} c @{}}
1 & 2 & 3 & 4 & 5 &\\
7 & 5 & 3 & 2 & 3 & \\


Tabular with coloured values

Nice, isn't it?

People need very different layouts inside tabulars. They vary much more than the layout of ordinary text does.

So the package that serves your needs won't help others much. So please, give us some examples of the tabulars you'd like to create. Maybe someone here can provide some kind of shortcut.


As noted by David Carlisle in the comments, the "normal" underlying TeX primitives for this are \halign and \valign, for horizontal alignment and vertical alignment, respectively.

They are used like this:

\[h|v]align{<preamble template(s)>\cr

where # (or, character with \catcode 6) marks the place where the <content> for that column/row will go, and & (or, character with \catcode 4) divides columns/rows, both in the <preamble>, and in the <content>.

\halign puts the <content>s into \hboxes, while \valign puts them in \vboxes.

Unfortunately they cannot be combined (at least to my knowledge); so while with \halign you can define individual column templates, and with \valign individual row templates, you can't use them both at the same time.

So the "normal" underlying primitives fail on points 1) and 2), while 3) depends on the given <preamble template>. 4) should be covered, though.

If ConTeXt is an option, you could have a look at the TABLE, and other table typesetting possibilities.

  • Thanks for the info about \halign and \valign. I don't think I'll be switching from basic LaTeX any time soon, however. – Christopher A. Wong Oct 24 '13 at 18:23

I'd suggest my cals package, which support decorations by design. Although it does not fit your request completely, you might find it useful. Examples of use.

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.