New package tabularew: centering multicolumn headings

In standard tabular environments multicolumn headings will be aligned to the left when they are wider then the text below, even if they contain a “c” as format parameter. Here’s a very small demonstration example:

\documentclass[a4paper,10pt]{article}
\usepackage{eurosym}
\begin{document}
\begin{tabular}{r@{.}l}
\multicolumn{2}{c}{Price in \euro} \\
  \hline
  79 & 50 \\
   9 & 85 \\
  10 & 00
\end{tabular}
\end{document}

Output:

tabular example

The tabularew package by Diego Saba solves this problem by introducing new commands for modifying the horizontal alignment. The example above can be changed to:

\documentclass[a4paper,10pt]{article}
\usepackage{eurosym}
\usepackage{tabularew}
\begin{document}
\begin{tabularew}{>{\spew{.5}{+1}}r@{.}l}
\multicolumn{2}{c}{Price in \euro} \\
  \hline
  79 & 50 \\
   9 & 85 \\
  10 & 00
\end{tabularew}
\end{document}

Output:

tabular example

The command \spew and the tabularew environment are explained in the package documentation.

03. June 2009 by stefan
Categories: Uncategorized | Leave a comment

Leave a Reply

Required fields are marked *