Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a row of a table (tabular) that has small text (tiny). I would like to make this (first) row shorter, either automatically (automatic height) o̶r̶ ̶m̶a̶n̶u̶a̶l̶l̶y̶ ̶(̶s̶e̶t̶ ̶a̶ ̶n̶o̶n̶-̶d̶e̶f̶a̶u̶l̶t̶ ̶h̶e̶i̶g̶h̶t̶ ̶f̶o̶r̶ ̶t̶h̶a̶t̶ ̶p̶a̶r̶t̶i̶c̶u̶l̶a̶r̶ ̶r̶o̶w̶)̶.̶

I tried different tricks (like using \\[shift]) with no success.


enter image description here

\hline 0 & 4.94066e-323 & 22 & 9.78381e+199\\

A simple solution using tabular is preferred but elegant solutions using pgfplotstables is also welcomed; specially since I have in mind the enumeration of columns (and eventually of rows).

Note that similar questions, like How can I reduce table row height? deal with uniform row heights adjustments.

share|improve this question
Have you tried simply renewing \arraystretch inside the tabular environment? –  Joseph R. Nov 27 '12 at 18:18
Related: Column padding in tables –  Werner Nov 27 '12 at 18:29
@JosephR. it doesn't do what is expected. –  alfC Nov 27 '12 at 18:41
@Wernet: the code posted there doesn't seem to make the row thinner than one text-line height. –  alfC Nov 27 '12 at 18:41

3 Answers 3

up vote 16 down vote accepted

LaTeX adds struts inside the table rows/cells. Each update of the font size/\baselineskip (\size@update) sets \strutbox (a box with height 0.7\baselineskip and depth 0.3\baselineskip. At the start of a tabular/array the box \@arstrutbox is set that uses the current \strutbox and scales it with factor \arraystretch.

The following example defines \setarstrut{...} that sets the table strut before the next row:

  • The argument allows font size commands, in the example: \tiny. Alternatively \arraystretch can be changed:

  • Internally \nolign is used. Therefore \setarstrut must be at the start of the row. Otherwise it would be to late to set smaller struts anyway.
  • The old strutbox is remembered in \saved@arstrutbox.
  • Small disadvantage is the global settings of the strut box to skip the grouping levels. Thus some care is needed, if the table is nested inside another table.

Macro \saved@arstrutbox restores the saved strut box.

Example file:


        \vrule \@height\arraystretch\ht\strutbox
               \@depth\arraystretch \dp\strutbox

    0 & 4.94066e-323 & 22 & 9.78381e+199\\


share|improve this answer
Incredible, absolutely incredible. –  azetina Nov 27 '12 at 19:10
Perfect results. But it looks like the tabular is not made for this. I'll take a look at pgfplotstable to see if it is easier. –  alfC Nov 27 '12 at 22:46
This is marvelous, It helped me with reducing the spacing of "blocks" of a tabular environment. Instead of leaving a full blank line, I inserted a \tiny blank line. –  AlexR Nov 20 at 19:42

Given the complexity of the LaTeX solution, I have no option but to post a ConTeXt solution ;-)

Like LaTeX, ConTeXt also inserts a \strut in each row of a table. However, rather than fighting the strut, we can simply ask ConTeXt not to add the strut by saying strut=no.

\startsetups table:size
  \setupTABLE[row][1][style=\tfxx, strut=no]

  \NC 0 \NC 1 \NC 2 \NC 3 \NC \NR
  \NC 0 \NC 4.94066e-323 \NC 22 \NC 9.78381e+199  \NC \NR

enter image description here

share|improve this answer
I never used ConTeXt, but I see it here and there really doing things that LaTeX has a hard time doing. Why is ConTeXt so powerful and yet it has an unpleasant syntax (personal opinion). –  alfC Nov 28 '12 at 0:23
Just curious. What do you find unpleasant about ConTeXt's syntax? To me, ConTeXt's syntax is one of its nicer parts. –  Aditya Nov 28 '12 at 1:13
not to start a language war but since you ask. This is all personal taste and even can sound silly. All taken from you own example: 1) \star* \stop* blocks don't separate the environment name from the fact that they start or end (\begin{}\end{} looks more structured, 2) mixed lower-capital case 'startTABLE', 3) \NC, a command to separate columns? '&' looks more elegant. See, it is all taste. –  alfC Nov 28 '12 at 22:03
Thanks for your explanation. I understand your point of view, but, as you say, it is matter of personal taste. FWIW, you can use \start[...] and \stop[...] if you prefer. Mixed lower case for tables is because ConTeXt already has \starttable and \starttabular, and \startlinetable, so after a while you just run out of names;). Most environments are lower case. \NC is a conscious design decision. ConTeXt tends to avoid exposing low level TeX primitives: there were even discussion about getting rid of $! See randomdeterminism.wordpress.com/?p=767 for my view on this. –  Aditya Nov 28 '12 at 22:25

This isn't pretty, but it works:

enter image description here

\settoheight{\mylen}{\tiny 1}
  \raisebox{\dimexpr\normalbaselineskip-\mylen}{\tiny #1}}
\myheading{0} & \myheading{1} & \myheading{2} & \myheading{3} \\[\dimexpr-\normalbaselineskip+\mylen]
\hline 0 & 4.94066e-323 & 22 & 9.78381e+199 \\

This assumes you'll only use similar-height elements in the first row (using the length \mylen set to the height of {\tiny 1}).

share|improve this answer
+1. It looks too cumbersome, is there an automatic way? –  alfC Nov 27 '12 at 18:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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