Is there an easy-to-use, all-encompassing table package?

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:

\documentclass[12pt]{article}
\usepackage{array,xcolor}
\def\stripCmd\ignorespaces#1\unskip{#1}
\def\checkVal#1!!{\def\temp{\stripCmd#1}%
   \ifnum\temp>3\textcolor{red}{#1}\else%
     \ifnum\temp<3\textcolor{blue}{#1}\else#1\fi\fi}
\begin{document}

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

\end{document}

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
            <content>\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.


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.

Tags:

Tables