# My table doesn't fit; what are my options?

I have a table that I want to insert on a page, but at least one (perhaps both) of the following conditions are met:

1. The table is too wide to fit within the text block or page. That is, I'm exceeding some horizontal restriction.

2. The table is too tall to fit within the text block or page. That is, I'm exceeding some vertical restriction.

What are my options to make this table fit? If it doesn't fit, regardless of my attempts, what other options exist?

• We receive a large number of questions regarding tables that "don't fit". This is meant to be a resource to address those in a generic fashion.
– Werner
Oct 6, 2016 at 12:01
• If a table is too large, please consider first 1) should it be a table at all, and 2) does it really need all content you're stuffing into it? Changing the table's content is usually much more difficult than simply adjusting some typography, but it is frequently the better solution when you want to visualize information! You should be certain that your gigantic table is the best (or least bad) solution to convey information before you go on reading the answers here. (I'm posting this as a comment and not an answer, because it's not really TeX related). Oct 7, 2016 at 11:25
• Sometimes the width of a table can be reduced by placing text into a tablenote/footnote/endnote instead of a table-cell. Jan 30, 2022 at 23:52

Let's first identify what we're referring to when we use the term "table". The typical table environment is a float, and can contain anything: a paragraph of text, an image, or even a tabular. Working with the latter - a tabular - and how to adjust it is what is discussed here. The discussion also applies to array structures since they provide a math analogue to tabular.

Consider reading How to influence the position of float environments like figure and table in LaTeX? if you're interested in float-specific placements.

Secondly, understand that a tabular is a static, two-dimensional construction. As such, it's probably best-suited for representing two dimensions (like age x gender, or region x type). Representing anything more than two dimension may therefore inherently be problematic if not presented "carefully," since the number of elements to tabulate expands geometrically. If you're presenting (say) three dimensions of information by (say) age, gender and ethnicity and the table doesn't fit, perhaps consider breaking this single table into a tabular by age and gender for each ethnicity. Remember that tables should extend or ease the digestion of the information, so if its representation seems complex, dense or confusing, separation into more elementary components might be your best option.

### 1. My table/tabular is too wide. What can I do to make it fit?

The following are possible options to consider (in no particular order):

• If you're presenting data that has large (wide) column headings, consider stacking or abbreviating these to collapse too-wide columns:

    \documentclass{article}
\usepackage{makecell}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide. \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12
\end{tabular}

\medskip

% Condense column headers using abbreviations or acronyms
\begin{tabular}{ *{12}{c} }
This&is&a&\texttt{tbl}&with&twelve&cols&that&is&just&too&wide. \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\[.5\normalbaselineskip]
\multicolumn{12}{l}{%
\footnotesize \texttt{tbl}: \texttt{tabular} title; cols: column title}
\end{tabular}

\bigskip

\begin{tabular}{ *{3}{c} }
This is a \texttt{tabular} with&three columns that is just&too wide to fit in \texttt{\string\textwidth}. \\
\hline
1  2  3  4 & 5  6  7  8 & 9  10  11  12
\end{tabular}

\medskip

% Condense column headers via stacking
\begin{tabular}{ *{3}{c} }
This is           &                    &           too wide             \\
a \texttt{tabular} with & three columns that &            to fit              \\
&      is just       & in \texttt{\string\textwidth}. \\
\hline
1  2  3  4 & 5  6  7  8 & 9  10  11  12
\end{tabular}

\medskip

% Condense column headers via stacking
\begin{tabular}{ *{3}{c} }
\makecell[b]{This is \\ a \texttt{tabular} with} &
\makecell[t]{three columns that \\ is just} &
\makecell{too wide \\ to fit \\ in \texttt{\string\textwidth}.} \\
\hline
1  2  3  4 & 5  6  7  8 & 9  10  11  12
\end{tabular}

\medskip

% Condense column headers via stacking in a paragraph-style column
\begin{tabular}{ *{3}{c} }
\multicolumn{1}{p{60pt}}{\centering This is a \texttt{tabular} with} &
\multicolumn{1}{p{7em}}{\raggedleft three columns that is just} &
\multicolumn{1}{p{3cm}}{\raggedright too wide to fit in \texttt{\string\textwidth}.} \\
\hline
1  2  3  4 & 5  6  7  8 & 9  10  11  12
\end{tabular}

\caption{This is a table caption.}
\end{table}

\end{document}


Manual stacking may be tedious. Setting a column heading a fixed-width p{<len>}-column is a way of providing an automated way of line-breaking (also shown above).

• Allowing columns entries to wrap naturally is possible when using a paragraph-style column specification. This p{<len>}-style column wraps at <len>. If you don't know what <len> should be, tabularx can help with its flexible X-column:

    \documentclass{article}
\usepackage{tabularx}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{3}{c} }
This is a \texttt{tabular} with&three columns that is just&too wide to fit in \texttt{\string\textwidth}. \\
\hline
1  2  3  4 & 5  6  7  8 & 9  10  11  12
\end{tabular}

\medskip

% tabularx provides a fixed-width table with flexible columns
\begin{tabularx}{\textwidth}{ c X >{\raggedright\arraybackslash}X }
This is a \texttt{tabular} with&three columns that is just&too wide to fit in \texttt{\string\textwidth}. \\
\hline
1  2  3  4 & 5  6  7  8 & 9  10  11  12
\end{tabularx}

\caption{This is a table caption.}
\end{table}

\end{document}


Justified wrapping within the X-columns may cause overfull \hbox warnings, which may be avoided by using a \raggedright setting. Since tabularx loads array, column prefixes >{<prefix>} can be added.

tabulary provides a similar interface and may also be helpful in this regard.

• Header rotation may also provide some horizontal reduction:

    \documentclass{article}
\usepackage{graphicx}
\newcommand{\hd}{\rotatebox{60}}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide. \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12
\end{tabular}

\bigskip

% Condense column headers using rotation
\begin{tabular}{ *{12}{c} }
\hd{This}&\hd{is}&\hd{a}&\hd{\texttt{tabular}}&\hd{with}&\hd{twelve}&
\hd{columns}&\hd{that}&\hd{is}&\hd{just}&\hd{too}&\hd{wide.} \\
\hline
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12
\end{tabular}

\caption{This is a table caption.}
\end{table}

\end{document}


Rotational formatting is fairly extreme visually and should be used sparingly.

• Probably the best way of attempting a horizontal fit would be to break the tabular is smaller, width-fitting tabulars. It's the least invasive visually (in general) and perhaps airs out the information for better reader digestion:

    \documentclass{article}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\bigskip

\begin{tabular}{ *{6}{c} }
1 & 2 & 3 & 4 & 5 & 6 \\
\hline
This & is & a & \texttt{tabular} & with & twelve \\
\\
7 & 8 & 9 & 10 & 11 & 12 \\
\hline
columns & that & is & just & too & wide.
\end{tabular}

\bigskip

\begin{tabular}{ *{6}{c} }
1 & 2 & 3 & 4 & 5 & 6 \\
\hline
This & is & a & \texttt{tabular} & with & twelve
\end{tabular}

\medskip

\begin{tabular}{ *{6}{c} }
7 & 8 & 9 & 10 & 11 & 12 \\
\hline
columns & that & is & just & too & wide.
\end{tabular}

\caption{This is a table caption.}
\end{table}

\end{document}

• Consider removing horizontal content to make it fit within the width that you need. You can either remove content manually, although this might be tedious for large tabulars. However, if you don't want to remove the content yet still remove a column(s), read Easiest way to delete a column?.

    \documentclass{article}

% https://tex.stackexchange.com/a/16607/5764
\usepackage{array}
\newcolumntype{H}{>{\setbox0=\hbox\bgroup}c<{\egroup}@{}}

\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\bigskip

% Drop/Hide column 10
\begin{tabular}{ *{9}{c} H *{2}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\caption{This is a table caption.}
\end{table}

\end{document}

• Consider reducing the horizontal separation between columns. The default document classes define \tabcolsep to be 6pt. For arrays the length used is \arraycolsep with a default of 5pt. This may be more than you need. For a multi-column tabular, reducing the \tabcolsep could save you valuable points.

    \documentclass{article}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\bigskip

\begingroup
\setlength{\tabcolsep}{0.75\tabcolsep}% Reduce \tabcolsep by 25%
\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}
\endgroup

\caption{This is a table caption.}
\end{table}

\end{document}


It may be required to limit the scope of the change to \tabcolsep, hence the use of grouping the \setlength adjustment (via \begingroup...\endgroup or {...}).

• Consider reducing the size of fonts used for the tabular. If using the default \normalsize for your document, perhaps \small or \footnotesize might make it fit:

    \documentclass{article}
\begin{document}

\begin{table}
\centering

% This tabular is too wide
\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\bigskip

\begingroup
\footnotesize% Change to smaller font from \normalsize
\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}
\endgroup

\caption{This is a table caption.}
\end{table}

\end{document}


See What is the default font size of a LaTeX document? and What point (pt) font size are \Large etc.? for a discussion on fonts and font sizes.

It may be required to limit the scope of the change to the font, hence the use of grouping (via \begingroup...\endgroup or {...}).

• For just-too-wide tabulars, you can resize the entire table to fit within your bounds horizontally using \resizebox{<width>}{<height>}{<tabular>} where <width> is at most \linewidth or \textwidth (see Difference between \textwidth, \linewidth and \hsize). The notation ! for <height> will ensure that the aspect ratio of the resizing is kept.

    \documentclass{article}
\usepackage{graphicx}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\bigskip

% \resizebox{<width>}{<height>}{<tabular>}
\resizebox{\linewidth}{!}{%
\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}}

\caption{This is a table caption.}
\end{table}

\end{document}


Scaling the tabular shrinks all the content... text included. If the factor of shrinking is small enough, there may not be a noticeable different between the fonts used in the document and the scaled tabular.

• Maybe you've conceded that the tabular can butt into the margin(s) because any of the above changes are just not sufficient for your needs. However, the default \centering doesn't set the tabular in a centred way, so you can set the tabular inside a \makebox[<width>] of small enough <width> (less than \linewidth) which will automatically centre it within the margin span (see How can I center a too wide table?):

    \documentclass{article}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\bigskip

% This tabular is still too wide, but we'll keep it as-is...
\makebox[\textwidth]{%
\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}}

\caption{This is a table caption.}
\end{table}

\end{document}

• You can rotate the table by 90 degrees (clockwise or counter-clockwise), placing it on its side. Typically pages are taller than they are wider, which may make the tabular fit. This, however, would be an extreme adjustment as you're requesting your audience to adjust their point of view and some people may not enjoy this switch between horizontal (left-to-right) and vertical (bottom-to-top) setting:

    \documentclass{article}
\usepackage{graphicx}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\bigskip

\rotatebox{90}{%
\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}}

\caption{This is a table caption.}
\end{table}

\end{document}


graphicx's \rotatebox{<angle>}{<tabular>} is used to rotate the <tabular> by <angle> degrees.

The above example rotates the tabular only, leaving the caption in its original place. If you want to rotate the entire float - caption included, you can use a sidewaystable (provided by the rotating package):

    \documentclass{article}
\usepackage{rotating}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\caption{This is a table caption.}
\end{table}

\begin{sidewaystable}
\centering

\begin{tabular}{ *{12}{c} }
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 \\
\hline
This&is&a&\texttt{tabular}&with&twelve&columns&that&is&just&too&wide.
\end{tabular}

\caption{This is a table caption.}
\end{sidewaystable}

\end{document}


Note that a sidewaystable assumes your table is fairly wide and therefore will occupy most of the text block height during rotation. As such, the default behaviour is to place it on a page of its own.

### 2. My table/tabular is too tall. What can I do to make it fit?

Many of the same procedures listed above can be applied vertically in order to adjust your tabular layout, like font changes, rotation or manually breaking content into multiple tabulars; some suggestions are listed below.

• \arraystretch is used to stretch (or shrink) each row within a tabular. Perhaps your \documentclass increased this. You can adjust it using \renewcommand:

    \documentclass{article}
\begin{document}

\begin{table}

\begin{minipage}{0.3333\linewidth}
\centering
\renewcommand{\arraystretch}{1.2}

\begin{tabular}{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\
7&rows \\ 8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}

\end{minipage}%
\begin{minipage}{0.3333\linewidth}
\centering
\renewcommand{\arraystretch}{1}

\begin{tabular}{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\
7&rows \\ 8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}

\end{minipage}%
\begin{minipage}{0.3333\linewidth}
\centering
\renewcommand{\arraystretch}{0.8}

\begin{tabular}{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\
7&rows \\ 8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}

\end{minipage}

\caption{This is a table caption.}
\end{table}

\end{document}

• Consider cutting out chunks of rows and stacking them horizontally rather than keeping the content in a vertical fashion.

    \documentclass{article}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\
7&rows \\ 8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}

\bigskip

\begin{tabular}{ c c @{\hspace{2em}} c c }
1&This & 1&This \\
\hline
2&is & 8&that \\
3&a  & 9&is \\
4&\texttt{tabular} & 10&just \\
5&with & 11&too \\
6&twelve & 12&tall. \\
7&rows
\end{tabular}

\bigskip

\begin{tabular}[t]{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\ 7&rows
\end{tabular}\hspace{2em}%
\begin{tabular}[t]{ c c }
1&This \\
\hline
8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}

\caption{This is a table caption.}
\end{table}

\end{document}

• Reducing the font size also reduces the line height and consequently the vertical span of a tabular:

    \documentclass{article}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\
7&rows \\ 8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}%
\hspace{2em}%
\begingroup
\small% Change to smaller font size from \normalsize
\begin{tabular}{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\
7&rows \\ 8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}%
\endgroup

\caption{This is a table caption.}
\end{table}

\end{document}


Again, here, scoping might be required to limit font changes.

• graphicx's \scalebox{<factor>} or \resizebox{<width>}{<height>} is an option. You can specify an appropriate height-fitting <height> length or portion. A <width> of ! ensures to maintain the aspect ratio during resizing:

    \documentclass{article}
\usepackage{graphicx}
\begin{document}

\begin{table}
\centering

\begin{tabular}{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\
7&rows \\ 8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}%
\hspace{2em}%
\resizebox{!}{.8\height}{%
\begin{tabular}{ c c }
1&This \\
\hline
2&is \\ 3&a \\ 4&\texttt{tabular} \\ 5&with \\ 6&twelve \\
7&rows \\ 8&that \\ 9&is \\ 10&just \\ 11&too \\ 12&tall.
\end{tabular}}

\caption{This is a table caption.}
\end{table}

\end{document}


The following example is taken directly from the longtable documentation and illustrates the construction of the longtable environment components in order to break a table across multiple pages (with a "continued caption"):

    \documentclass{article}
\usepackage{longtable}

\def\v{\char}

\begin{document}

% Note: Various parts of the following table will
% *not* line up correctly until this document has been run
% through LaTeX several times. This is a characteristic feature of
% this package, as described below.

\begin{longtable}{@{*}r||p{1in}@{*}}
KILLED & LINE!!!! \kill
\caption
[An optional table caption (used in the list of tables)]
{A long table\label{long}} \\
\hline\hline
\multicolumn{2}{@{*}c@{*}}%
{This part appears at the top of the table} \\
\textsc{First} & \textsc{Second} \\
\hline\hline
\caption[]{(continued)} \\
\hline\hline
\multicolumn{2}{@{*}c@{*}}%
{This part appears at the top of every other page} \\
\textbf{First} & \textbf{Second} \\
\hline\hline
\hline
This goes at the & bottom. \\
\hline
\endfoot
\hline
These lines will & appear \\
in place of the  & usual foot \\
at the end       & of the table \\
\hline
\endlastfoot
\texttt{longtable} columns are specified & in the \\
same way as  in the \texttt{tabular} & environment. \\
\verb~@{*}r||p{1in}@{*}~'' & in this case. \\
Each row ends with a & \verb|\\|'' command. \\
The \verb|\\|'' command  has an & optional \\
argument, just as in & the \\
\texttt{tabular} & environment. \\[10pt]
See the effect of \verb|\\[10pt]|'' & ? \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Also \verb|\hline|'' may be used, & as in \texttt{tabular}. \\
\hline
That was a \verb|\hline|'' & . \\
\hline\hline
That was \verb|\hline\hline|'' & . \\
\multicolumn{2}{||c||}%
{This is a \ttfamily\v\\multicolumn\v{2\v}\v{||c||\v}} \\
If a page break occurs at a \verb|\hline|'' then & a line is drawn \\
at the bottom of one page and at the & top of the next. \\
\hline
The \verb|[t] [b] [c]|'' argument of \texttt{tabular} & can not be used. \\
The optional argument may be one of & \verb|[l] [r] [c]|'' \\
to specify whether the table should be & adjusted \\
to the left, right & or centrally. \\
\hline\hline
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Some lines may take up a lot of space, like this: &
\raggedleft This last column is a \texttt{p}'' column so this
row'' of the table can take up several lines. Note however that
\TeX\ will  never break a page within such a row. Page breaks only
occur between rows of the table or at \verb|\hline|'' commands.
\tabularnewline
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
Lots of lines & like this. \\
\hline
Lots\footnote{This is a footnote.} of lines & like this. \\
Lots of lines & like this\footnote{\texttt{longtable} takes special
precautions, so that footnotes may also be used in \texttt{p}' columns.} \\
\hline
Lots of lines & like this. \\
Lots of lines & like this.
\end{longtable}

\end{document}


### 3. My tabular is too wide and too tall for where I placed it. What can I do?

Typically one can combine the above methods for width/height improvements. There may be some incompatible choices (like resizing a longtable, for example).

• I'm guessing you're not done here, but a common reason for having too wide tables is that the user has a lot of text in c/l/r columns, and the usual fix is p/X columns, so an example of that would be useful. Oct 6, 2016 at 12:09
• some publishers consider that table captions should go at the top (and figure captions at the bottom). other tactics not (yet) mentioned are that (1) if text in either a column heading or a cell is too wide, can be broken into multiple lines, using a "paragraph" approach to keep appropriate baselines, and (2) if material in a particular column has repetitive elements (such as a currency unit or"%"), that can be moved to the column header. great job! Oct 6, 2016 at 12:28
• Another option: When it's only the column names that are long but not the values, you can create shorthands for the names: There are two basic options, for Geometric mean one could use the first letters (GM or g.~m. or alike) or an arbitrary symbol such as (\dagger) (†), (*) etc. Don't forget to add a legend in that case (in the caption or as a table footnote just below the last line of the table).
– yo'
Oct 6, 2016 at 12:42
• Have you considered writing something for TUGboat based on this? Oct 26, 2016 at 20:36
• i second @JosephWright's suggestion. please do consider. Oct 26, 2016 at 20:58

If a document consists of pages in portrait format and the table would fit on the paper in width if you had landscape format, you can consider making a longtable rotated by 90 degrees spanning several pages.

(One might probably do that only if the table is only used for dull lookups, like a price list or similar, where it is not important to see correlations between groups of data by looking at several records at once.)

Nowadays you could use zref and the hook system recently introduced in the LaTeX2e kernel:

• For the longtable, temporarily change the layout so that page width and page height are swapped.

• In the longtable, set a label in the first and last cell using the tools of the zref package to hold the information about the absolute page numbers at the beginning and end of the longtable.

• Use the new hook system for adding to the hook that is executed before each shipout the instruction to rotate the page/the \ShipoutBox by 90 degrees if the absolute page number is in the range of the pages denoted by the zref-labels placed at the beginning and at the end of the longtable environment.

\documentclass{article}
\usepackage{graphicx}
\usepackage[abspage]{zref}
\usepackage{longtable}
\usepackage{blindtext}

\makeatletter

% A scratch loop for repeating #3 while counting from #1 to #2.
% As counter is used \scratchmacro
% #3 is expanded until finding an unexpandable token.
% If the unexpandable token is a space token it is discarded.
\newcommand\scratchmacro{}
\newtoks\scratchtoks
\newcommand\PassFirstToSecond[2]{#2{#1}}
\newcommand\scratchtoksloop[3]{%
\begingroup
\def\scratchmacro{#1}%
\scratchtoks{\endgroup}%
\loop
\scratchtoks\expandafter{\the\expandafter\scratchtoks\romannumeral\^^@#3}%
\ifnum\scratchmacro < #2 %
\edef\scratchmacro{\the\numexpr\scratchmacro+1\relax}%
\repeat
\the\scratchtoks
}%

% This checks if the current value of the abspage-counter is within the
% range given by zref-label #1 and zref-label #2.
\newcommand\saveabspage[1]{\zref@labelbyprops{#1}{abspage}}%
\newcommand\CheckWhetherAbsPageInLabelrange[2]{%
\zref@ifrefundefined{#1}{\@secondoftwo}{%
\zref@ifrefundefined{#2}{\@secondoftwo}{%
\zref@ifrefcontainsprop{#1}{abspage}{%
\zref@ifrefcontainsprop{#2}{abspage}{%
\ifnum\zref@extractdefault{#1}{abspage}{-1}>\value{abspage}%
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
{\@secondoftwo}{%
\ifnum\zref@extractdefault{#2}{abspage}{-1}<\value{abspage}%
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
{\@secondoftwo}{\@firstoftwo}%
}%
}{\@secondoftwo}%
}{\@secondoftwo}%
}%
}%
}%

\makeatother

% The zref-label at the start of the longtable is "tablesfirstpage".
% The zref-label at the end of the longtable is "tableslastpage".
% Add to the hook carried out at every shipout the directive to check if
% absolute page is in range denoted by these labels, and if so,
% to rotate the page/to rotate \ShipoutBox:
\CheckWhetherAbsPageInLabelrange{tablesfirstpage}{tableslastpage}{%
\setbox\ShipoutBox=\vbox{\hbox{\rotatebox[origin=c]{90}{%
\vbox{\hbox{\box\ShipoutBox\kern\ifodd\value{page}\evensidemargin\else\oddsidemargin\fi}}%
}}}%
}{%
}%
}%

% Just make sure...
\csname @ifundefined\endcsname{pagewidth}{}{\pagewidth=\paperwidth}%
\csname @ifundefined\endcsname{pdfpagewidth}{}{\pdfpagewidth=\paperwidth}%
\csname @ifundefined\endcsname{pageheight}{}{\pageheight=\paperheight}%
\csname @ifundefined\endcsname{pdfpageheight}{}{\pdfpageheight=\paperheight}%

\begin{document}

\blindtext
\newpage
\begingroup
\ifodd\value{abspage}\newpage\else\newpage\null\newpage\fi
% ---- Layout ----------------------------------------------------------------------
%      For typesetting the longtable temporarily change the layout so that
%      width and height of page are exchanged and textwidth is increased etc:
\pagestyle{plain}%
\csname zref@ifrefundefined\endcsname{tablesfirstpage}{%
\paperwidth=\the\expandafter\paperheight
\expandafter\paperheight\expandafter=\the\paperwidth
\csname @ifundefined\endcsname{pagewidth}{}{\pagewidth=\paperwidth}%
\csname @ifundefined\endcsname{pdfpagewidth}{}{\pdfpagewidth=\paperwidth}%
\csname @ifundefined\endcsname{pageheight}{}{\pageheight=\paperheight}%
\csname @ifundefined\endcsname{pdfpageheight}{}{\pdfpageheight=\paperheight}%
\textwidth=\paperwidth
}{%
\textwidth=\paperheight
}%
\evensidemargin=\dimexpr-1in+1.5cm\relax
\oddsidemargin=\dimexpr-1in+1.5cm\relax
\marginparsep=2mm\relax
\marginparwidth=\dimexpr2cm-2\marginparsep\relax
\csname zref@ifrefundefined\endcsname{tablesfirstpage}{%
\textheight=\paperheight
}{%
\textheight=\paperwidth
}%
\topmargin=\dimexpr-1in+1.5cm\relax
{\normalfont
\setbox\csname @tempboxa\endcsname\hbox{0123456789}%
\footskip=\dimexpr 1cm -.5\dp\csname @tempboxa\endcsname
+.5\ht\csname @tempboxa\endcsname\relax
\expandafter}\expandafter\footskip\expandafter=\the\footskip
\csname @colht\endcsname=\textheight
\csname @colroom\endcsname=\textheight
\vsize=\textheight
\columnwidth=\textwidth
\hsize=\columnwidth
\linewidth=\hsize
\parindent=0pt\relax
% ---- Layout-changes done. --------------------------------------------------------
\begin{longtable}{|c|c|c|c|}
\caption{Caption of Longtable}\label{LongtableLabel}\\
\hline
\saveabspage{tablesfirstpage}number&left&middle&right\\
\hline
number&left&middle&right\\
\hline
\multicolumn{4}{|c|}{This is a clever remark.}\\
\hline\endfoot
\hline
\multicolumn{4}{|c|}{This is a clever remark.\saveabspage{tableslastpage}}\\
\hline\endlastfoot
\scratchtoksloop{1}%
{100}%
{%
\expandafter\hbox\expandafter{%
\expandafter\PassFirstToSecond
\expandafter{\scratchmacro}{\hphantom{100}\llap}%
}%
&left&middle&\scratchtoksloop{1}{11}{ this is wide }\\%
}%
\end{longtable}%
\newpage
\endgroup
% ---- After typesettig the longtable reset the page layout ------------------------
\csname @colht\endcsname=\textheight
\csname @colroom\endcsname=\textheight
\vsize=\textheight
\columnwidth=\textwidth
\hsize=\columnwidth
\linewidth=\hsize

\blindtext

\end{document}
`