Take the 2-minute tour ×

When big tables are created in LaTeX, then the table extends to the footer as well. If I use the longtable package then it works fine for tables which are longer and it does not extend to the footer area but when the table size is smaller it splits the table into two, which is not required.

I am creating a report with many tables of different sizes. Is there any package in LaTeX so that it can automatically fit the table according to the size? Now, I am manually using \begin{tabular} and \end{tabular} for small tables and \begin{longtable} and \end{longtable} for long tables.

share|improve this question
add comment

1 Answer

You can modify the horizontal width of a table using a number of choices:

  • Manual inter-column separation using, for example,
\begin{tabular}{@{10}{@{\hspace{<len>}}c@{\hspace{<len>}}}} % Inter-column gap of <len>
  • Modify commands like \tabcolsep or \extracolsep to adjust the inter-column separation.

  • Resizing the entire table to fit within the line width via the graphicx package \resize{<h-len>}{<v-len>}{<stuff>} command:

  • Use fixed-width tabulars. This could be using the tabular* environment, or using tabularx from the tabularx package. The latter provides a stretchable column specifier X. However, none of these will shrink the table to fit into \linewidth if the table is wider than \linewidth. For example:
\begin{tabular*}{\linewidth}{<column specs>}
\begin{tabularx}{\linewidth}{<column specs>}
  • Use a different font, say \small. However, this gives the entire table a different look/feel compared to the rest of the document. Not recommended.

Read more about this on the fixed-width tables entry on the UK TeX FAQ.

For adjusting the vertical length of your table, you can try one of the following:

  • Adjust the vertical length using the \resizebox{<h-len>}{<v-len>}{<stuff>} command in a similar fashion than described above. This time, set <h-len>=! to maintain aspect ratio.

  • Modifying the \arraystretch parameter using something like \renewcommand{\arraystretch}{0.8}

  • Specify a manual line-skip by using \\[<len>] instead of just \\ to produce new tabular lines. This gives you some control over how big the skip between rows are.

share|improve this answer
Note that using \resizebox will scale the text in your table; if your document requires a particular font size, this, like other font size changes, is not a viable option. –  Alan Munn Aug 15 '11 at 19:30
add comment

Your Answer


