\newcommand{\px}[1]{{\parbox[t]{1.1in}{\raggedright #1}}} \newcommand{\py}[1]{{\parbox[t]{1.7in}{\raggedright #1}}} \newcommand{\dbr}{\discretionary{}{}{}} \newcommand{\mydefaults}{% \renewcommand{\baselinestretch}{1.1}% \sf \scriptsize} \title{Table design} \author[Siep Kroonenberg]{Siep Kroonenberg\\ \texttt{N.S.Kroonenberg@eco.rug.nl}} \begin{Article} \begin{figure*} {\sf\bf Example: before and after} \vspace{9pt} \footnotesize \noindent \begin{minipage}[t]{3.2in} {\bf Economic forecasts for 1992} \begin{tabular}{|l|r@{}l|r@{}l|} \hline & \multicolumn{4}{c|}{forecast}\\ \cline{2-5} variable & \multicolumn{2}{c|}{Grecon} & \multicolumn{2}{c|}{CPB} \\ & & & \multicolumn{2}{c|}{(MEV '92)}\\ \hline &\multicolumn{4}{l|}{\% mutations}\\ &\multicolumn{4}{l|}{w.r.t. 1991}\\ \cline{2-5} real consumption ($c$) & 1&.1 &1&.25\\ price index consumption ($p_c$) & 2&.6 &3&.25\\ real investments ($i_m$) &1&.4 &-2&.5\\ export price index ($p_b$) & 3&.5 &3&.25\\ real import of goods ($m$) & 4&.1 &3&\\ real output of goods ($v'$) &2&.5 &2&.1\footnote{% The quantities $v'$ and $bpr$ aren't given as such by the CPB. The CPB data presented here are computed using their GRECON definitional equations. For details, see appendix D.} \\ real domestic production ($bpr$) &1&.4 &1&.6\\ private employment ($a$) &0&.32 &0&\\ wage rate ($l$) &4&.0 &4&\\ government income (\%) &-0&.1 & \multicolumn{2}{c|}{--\footnote{% Not available.} }\\ \ \ from output of goods ($iso'$) &&&&\\ \cline{2-5} & \multicolumn{4}{l|}{absolute quantities}\\ \cline{2-5} unemployment ($\times$1000 persons) &510&\footnote{% Not a model outcome: see text in par.\ 3.1 and 3.2.} & 525&\\ balance of payments ($10^9$ Hfl) &24&.4&25&.0 \\ \hline \end{tabular} \end{minipage}\hfill% % \begin{minipage}[t]{3.1in} \mydefaults \mpfoot {\bf\small Economic forecasts for 1992} \vspace{-3pt} \noindent\rule{\linewidth}{1pt} \vspace*{3pt} \begin{tabular*}{\linewidth}{@{}l@{~~~~}r@{}lr@{}l@{}} & \multicolumn{4}{l@{}}{\bf\sf Grecon~~~~~CPB\footnote{MEV '92}} \\[3pt] \hline \\[-6pt] \em mutations w.r.t. 1991 \\ real consumption ($c$) & 1&.1 &1&.25 \\ price index consumption ($p_c$) & 2&.6 &3&.25 \\ real investments ($i_m$) &1&.4 &$-$2&.5 \\ export price index ($p_b$) & 3&.5 &3&.25 \\ real import of goods ($m$) & 4&.1 &3 \\ real output of goods ($v'$) &2&.5 &2&.1\footnote{% The quantities $v'$ and $bpr$ aren't given as such by the CPB. The CPB data presented here are computed using their GRECON definitional equations. For details, see appendix D.} \\ real domestic production ($bpr$) &1&.4 &1&.6 \\ private employment ($a$) &0&.32 &0 \\ wage rate ($l$) &4&.0 &4 \\ government income (\%) \\ \ \ from output of goods ($iso'$) &$-$0&.1 &--&{}\footnote{% Not available}\\[6pt] \em absolute quantities \\ unemployment ($\times$1000) & 510 &\footnote{% Not a model outcome: see text in par.\ 3.1 and 3.2.} & 525 \\ balance of payments (10$^9$ Hfl) &24&.4 & 25&.0 \end{tabular*} \vspace*{-6pt} \end{minipage} \vspace{9pt} \end{figure*} \begin{quote} {\em [Editor's note: I am grateful to Siep Kroonenberg and Gerard van Nes (editor) for permission to reprint this article from MAPS, the journal of the Nederlandstalige \TeX\ Gebruikersgroep.]} \end{quote} \noindent \LaTeX\ users generally seem unaware of current ideas on table design. The following table is a typical \LaTeX\ production: \vspace{6pt} {\footnotesize \begin{tabular}{|l|rr|} \hline \multicolumn{3}{|c|}{\bf \LaTeX\ table design}\\ \hline & 1991 & 1992 \\ \hline Unemployment ($\times$1000) & 500 & 600 \\ Balance of Payments (10$^9$ Hfl) & 24 & 25 \\ \hline \end{tabular}} \vspace{6pt} In a professionally-designed publication, the above table would probably look more like this: \vspace{6pt} {\mydefaults \begin{tabular}{@{}lrr@{}} \multicolumn{3}{@{}l@{}}{\small\bf Common sense table design} \\[3pt] \hline \\[-6pt] & \bf 1991 & \bf 1992 \\ [3pt] \cline{2-3} \\[-6pt] Unemployment ($\times$1000) & 500 & 600 \\ Balance of Payments (10$^9$ Hfl) & 24 & 25 \\ \end{tabular}} \vspace{6pt} If you read a book on typography, \eg \cite{treebus} or \cite{mclean}: you'll find that they use rules and boxes with far more restraint, and rely more on white space and variation in typefaces for organization. The table examples in \cite{lamport} were (I hope) merely intended to demonstrate techniques. However, their style was almost unanimously adopted by \LaTeX\ users. So I think that some design education is in order. I am not a design professional. However, many people never even think about table design; so if I set them thinking and they start reading books on typography by real professionals then this paper has served its purpose. {\bf Note.} This is not meant to be a technical exposition. \cite{bernard} and \cite{lamport} tell you most of the technical things you need to know. All the same, I have indicated here and there with what codes or constructs you might accomplish certain effects. \section{Basics of table design} A table should present its information as clearly as possible. Typographic means to organize this information includes rules, white space, choice of typefaces and appropriate headings and captions. But if a feature doesn't help to make a table clearer, it had better be left out. \vspace{6pt} {\mydefaults \noindent\begin{tabular*}{\linewidth}{@{}lll@{}} \multicolumn{3}{@{}l@{}}{\small\bf Macroeconomic memoranda} \\[3pt] \hline \\[-9pt] 1. & \px{Karl L\"ausche, Maria Vader, Theo Zernike} & \py{Money illusion and savings illusion; an illusionistic look on neo-\dbr Hegel\-ian monetary theory} \\ \\[-6pt] \hline \\[-9pt] 2. & \px{Hendrik Kooy\-ker, Johan Zonder\-link} & \py{BIGTHUMB, a software package for handling missing and politically incorrect data} \\ \\[-6pt] \hline \\[-9pt] 3. & Anneke~Draaijer & \py{Consumer behavior, expectation formation and the long-term economic effects of risk-aversion} \\ \\[-6pt] \hline \end{tabular*}} \vspace{6pt} \subsection*{Rules and boxes} Rules have their uses. They can emphasize headings. They can also separate different items and unite the several data for one item, as in the table above. Vertical rules, as in the table below, would have the opposite effect and would be no help at all in making the table easier to read. \vspace{6pt} {\mydefaults \noindent\begin{tabular*}{\linewidth}{@{}l|l|l@{}} \multicolumn{3}{@{}l@{}}{\small\bf Macroeconomic memoranda} \\[3pt] \hline && \\ 1. & \px{Karl L\"ausche, Maria Vader, Theo Zernike} & \py{Money illusion and savings illusion; an illusionistic look on neo-\dbr Hegel\-ian monetary theory} \\ && \\ 2. & \px{Hendrik Kooy\-ker, Johan Zonder\-link} & \py{BIGTHUMB, a software package for handling missing and politically incorrect data} \\ && \\ 3. & Anneke~Draaijer & \py{Consumer behavior, expectation formation and the long-term economic effects of risk-aversion} \\ && \\ \hline \end{tabular*}} \vspace{6pt} But even in the earlier example one might wonder whether white space wouldn't have been more effective than rules. A table may also be boxed to set it off from the surrounding text. But \LaTeX\ users normally don't go through the trouble of wrapping text around tables and figures; therefore, there is little reason to box in a table. In all cases, there should be enough space between rules and text. A rule too close to text interferes with readability and makes the text look cramped. An alternative to rules or boxes is a shaded background, preferably in a second colour. This is not supported by \LaTeX\ as far as I know, although with PostScript some tricks are possible (see \eg \cite{bernard} section 11.6). This formatting device requires high output quality in order to look good. \subsection*{Alignment and justification} A column of text labels can be left- or right-aligned, or centered. If the table has any length at all, a centered column can easily look sloppy. With left- or right-alignment there is at least one straight edge to give the column structure. Think twice before centering a column in a longer table. A column of figures is usually decimally aligned (see below for some technical issues). If the figures are unrelated, you may consider right- or left-alignment instead. Don't justify text inside a narrow column or you'll end up with large distracting holes between words. This is easier said than done, but see further below. \subsection*{Headings} Headings may get added emphasis by setting them bold, italic, at a larger point size or in a different typeface. Don't go overboard, though. The heading of a centered or decimally-aligned column may need some manual adjustment. \section{An example} We illustrate some of these points with the `before-and-after' example. It is sufficiently complex to illustrate a number of points; I am not implying that it is any worse than other \LaTeX\ tables I have seen. The `before' table is a \LaTeX\ remake of a table from \cite{grecon}. At an earlier occasion, it has been used as a demonstration of \LaTeX's table-making capabilities. The example table contains footnotes; therefore it is enclosed in a minipage environment. \subsection*{Rules} The most conspicuous shortcoming of the `before' example is the tight spacing between horizontal lines and text. I am not aware of a parameter which controls this distance; however, the `\verb+\\+' command takes an optional length parameter, also in a \verb+tabular+ environment. In this case, as in most cases, the vertical rules are better left out. It is advisable to begin and end the column specification with \verb+@{}+: \begin{verbatim} \begin{tabular}{@{}l@{}r@{}lr@{}l@{}} \end{verbatim} Without vertical rules, no white space needs to be reserved at the left- and righthand sides. Actually, I used a \verb+tabular*+ environment, which allowed me to set the width to \verb+\linewidth+: exactly the width of the minipage. Another unfortunate detail is the footnote rule next to the bottom rule. I solved this by dropping the bottom rule. Also, I redefined in a separate style file several aspects of minipage footnotes: among others, the footnote rule now stretches across the width of the minipage. The rule under the title is not part of the \verb+tabular+ environment, but is constructed as a `\verb+\rule+'-rule. This made it easy to give it a custom thickness. Again, the length was set to \verb+\linewidth+. \subsection*{Headings} As to the various headings: the word {\em forecast} repeated information from the table header and was dropped. The word {\em variable} could also safely be omitted. Aligning the Grecon- and CPB headings at the bottom instead of the top would have been an improvement, but moving the text `{\em MEV '92}' to a footnote was even better. Their horizontal positioning was adjusted by hand, adding `\verb+~+' here and there. The `{\em \% mutations...}' and `{\em absolute quantities}' headings looked rather jarring in the figures columns, and were moved to the left column. \subsection*{Fonts} Sans serif faces are especially appropriate for tabular material. At small sizes serifed faces easily look fussy, especially if the output quality is not top notch. Sans serif faces suffer much less from scaling down. A sans serif face also helps to set off the table from the surrouding text. Several sizes and weights are used (typographers talk about an italic {\em weight}; the \TeX\ community should realize that they entertain rather off-beat ideas about font families). And hyphens are replaced by proper minus-signs. \section{Technical issues}\label{tech} Some things in \LaTeX\ are harder than they should be. Two notorious examples are table-related: aligning a column of figures on the decimal point, and setting text in a table cell ragged right. \subsection*{Decimal alignment} There are at least three ways in \LaTeX\ to accomplish decimal alignment: \begin{itemize} \item If all numbers have the same number of digits after the decimal point, decimal alignment coincides with right alignment, since in most fonts all digits have the same width. \item Split the numbers right before the decimal point, i.e. put an ampersand `\verb+&+' before the decimal point (or after the number, if it has none). The column formatting for the resulting two columns should be \verb+r@{}l+: right-align the part before the decimal point, left-align the remainder, and put no white space in between. \item Use the {\tt dcolumn} package by David Carlisle. This is documented in \cite{bernard} section 5.5.1. \end{itemize} \subsection*{Ragged right justification} You may have noticed that \verb+\raggedright+ simply doesn't work in a tabular environment. Again, let me suggest a couple of brute-force workarounds. \begin{itemize} \item Divide the text manually between rows. Of course, this is practical only in very simple cases. \item Put a parbox around the text, \eg \\ \verb+\parbox{1in}{\raggedright+\ {\em text...}\verb+}+ \\ This is simple enough, but not very elegant since it involves specifying column widths outside the \verb+\begin{tabular}+ command. \end{itemize} Goossens \emph{et al.} give a more sophisticated solution in section 5.3.1, `{\em Typesetting Narrow Columns.}' As in the last of the above two workarounds, it adds code to make \verb+\raggedright+ operational again. \section{The trouble with \LaTeX} It took me a lot of time to prepare the examples in this paper. Even the standard \LaTeX\ \verb+tabular+ environment has plenty of quirks, and extension packages such as {\tt array} or {\tt tabularx} only add to them. Too often, it was a matter of trial and error what would work and what wouldn't, and that might depend on the package used. In the end I didn't use any of the table extension packages for this paper. In \LaTeX, some aspects of layout and typography can be controlled by changing a few parameters or by replacing some simple code out of a style file. But there are quite a few rough spots: sometimes the code is too cryptic for easy modification and sometimes the code is not in the style file at all. When typesetting tables one tends to run into such rough spots. Besides \LaTeX, I use high-end wordprocessors and low-end desktop publishing software. I am exceedingly frustrated that simple things that you just do in a commercial program, require hours or days of study and experimentation in \LaTeX. Still, \LaTeX\ can't be beaten (yet) for long documents or for automation. It remains robust and efficient whatever the size and complexity of the job. So I keep using it for certain types of work. I hope that \AllTeX\ developers are seriously addressing \LaTeX's shortcomings. What is really needed is a more accessible basic \LaTeX\ system, which doesn't require wizardry to tailor to one's own preferences, and which can put an end to the current proliferation of style files to patch up its defects. Finally I want to mention that \cite{bernard} was a great help in preparing this paper, even though the solutions proposed there didn't always work out. \begin{thebibliography}{[GMS94]} \bibitem[Treebus 1982]{treebus} Treebus, K. F. {\em Tekstwijzer.} SDU 1982. \bibitem[McLean 1980]{mclean} McLean, Ruari. {\em Typography.} Thames and Hudson 1980. \bibitem[Lamport 1986]{lamport} Lamport, Leslie. {\em \LaTeX, A Document Preparation System.} Addison-Wesley 1986. \bibitem[Goossens \emph{et~al.}~1994]{bernard} Goossens, Michel, Frank Mittelbach, Alexander Samarin. {\em The \LaTeX\ Companion.} Addison-Wesley 1994. \bibitem[DV91]{grecon} Dietzenbacher, H.W.A., W. Voorhoeve. {\em Het model GRECON 91-D. Septembervoorspellingen voor 1992}. Onderzoeksmemorandum no. 450. Economics Department, Groningen University 1991. \end{thebibliography} \end{Article}