LaTeX Tabular More

The width and height of a cell in a tabular is controlled by many parameters. Read the following codes:

c & c \\
c & c \\

You specify p{2cm} as part of your \begin{tabular}{} arguments, in the hope that the first column in the table is 2cm wide. Unfortunately, it appears wider than you think. The width of a cell in the table, without regard to the line width of separators, is actually computed by

\tabcolsep + p{length} + \tabcolsep.

The length you specify, gives place to contain characters in the cell. Between the left separator and the left side of the bounding box of the first character, there is some room which is controlled by \tabcolsep, such that the cell will not look too crowded. It is the same on the right side of the cell. In other words, \tabcolsep governs such that the contents in the cell will not be positioned right next to the boarders, which looks rather ugly.

By default, \tabcolsep is set to 6pt, which equals to 2.12mm in digital printing. In the above codes, we re-set it to 1cm. So the total width of the first column in the table is 4cm, while the second column is 5cm wide.

The mechanism of the height of a cell is a little bit different. In default setting, the distance between the upper boarder and lower boarder of a cell is \baselineskip, which is the line spacing in paragraphs. If you look at two adjacent lines of texts in the paragraph, \baselineskip is the distance between the two base lines of the texts. \baselineskip is specified at the font selection stage. The primitive command \fontsize{size}{skip} sets this value. Usually a 10pt font size is associated with 12pt line skip.

The command \arraystretch scales the height of the cell by a factor. As in the above codes, the spacing of a row in the table is 2 times the default.

Note that the default height of a row in a tabular cannot be changed by manually setting \baselineskip. As to my current knowledge, the height of a row can only be changed by specifying a different \arraystretch factor. (Similarly, if you want to change the line spacing in the texts, such as to double spacing, do not change \baselineskip. Use \baselinestretch instead.)


13 Responses to “LaTeX Tabular More”

  1. 1 Whatever-ishere November 21, 2007 at 10:29 am

    thanks for the GREAT post! Very useful…

  2. 2 Dan August 8, 2008 at 7:07 pm

    You can also use struts to artificially increase the height of a row: use \rule{0cm}{5cm} to insert a box that’s 0 cm wide (so it takes up no space) but 5 cm tall. LaTeX will then make the row height so that it can accomodate this box, but naturally you don’t see anything. (Except the taller row.)

  3. 3 Jie August 8, 2008 at 11:28 pm


    Yes, you are right. Your method can adjust the height of some specific rows of the table while leaving other rows unchanged.

  4. 4 Ras December 26, 2008 at 8:52 am

    Nice. I like the \rule solution because i can apply it to a single row or a single tabular, except that the text is still aligned to the bottom, and i would prefer it to be center-aligned .. is this possible?

    • 5 Jie December 26, 2008 at 12:08 pm

      Ras, a trick to do this is to move the rule from the baseline: \rule[-2.5cm]{0cm}{5cm}. Note that 2.5cm is exactly half of 5cm. Now the baseline of the characters is vertically centered at the cell, and the characters look roughly centered.

  5. 6 Hugo June 17, 2009 at 10:29 am

    I tend to use \\[1.5ex] (and similar) to increase the height of rows. You’ll need some playing around, the values don’t necessarily translate straightforward into effects on paper, but it works too.

    This seems to add space below the text, and none above it.

  6. 7 Ashish Jain November 7, 2009 at 2:16 am

    Thank you so much. The article is very informative and useful.

  7. 8 ER May 4, 2010 at 5:11 pm

    Your treasures come very handy as I was looking for a way to increase the line height in tables. Thanks for the \arraystrech command. I used to use \rule{} command, but \arraystrech gives better results in my case.

  8. 9 Juan June 29, 2010 at 12:58 pm

    At the end of the row:

  9. 10 Naman Dauthal April 25, 2011 at 1:51 pm

    Thanks a lot. This article helped a lot.

  10. 11 Mischa August 25, 2011 at 2:25 pm

    Hi, thanks for the post, it helped a lot!
    Do you know any way to set the colsep attribute of some specific columns only ?

    • 12 Jie August 25, 2011 at 2:39 pm


      I have no idea. But there are two quick hacks to work around. One way is that you can specify the column width. If the contents in the column are centered, then this column looks having a wider margin. Another way is to put something like \makebox[1.5cm]{} on both ends of the longest item in this column. This also makes the column looks wider.

  11. 13 CWK October 16, 2011 at 1:35 am

    To get evenly spaced rows, I ended up using a parbox in the first cell of every row with the height specified, since I wanted to center the contents of the cell (an image) anyway:


    This produces an (invisible) box, centered against the text line, with a height of 2cm and a width of 1in. Hope this helps someone.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


Blog Stats

  • 253,706 hits

%d bloggers like this: