# How to resize or scale a longtable - revised

Further to my earlier post, I am now getting errors and no output from latex simply by inserting: %\resizebox{.88\hsize}{!}{ } into my code. I have edited the code below to show where I am inserting it. Am I missing something incredibly simple here?! - any assistance would be appreciated as I am truly at a loss. thank you! R*******

I am new here and will try to be as specific as possible. I have searched everywhere to try and figure out how to resize or scale a table spanning several pages using \longtable. I have added the \usepackage{longtable} in the preamble and have coded as follows:

\documentclass[12pt]{article}
\usepackage{longtable}
\begin{document}
\begin{center}
\resizebox{.88\hsize}{!}{
\begin{longtable}{|c|c|c|c|}
\caption{A simple longtable example}\\
\hline
\textbf{First entry} & \textbf{Second entry} & \textbf{Third entry} & \textbf{Fourth entry} \\
\hline
\multicolumn{4}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\textbf{First entry} & \textbf{Second entry} & \textbf{Third entry} & \textbf{Fourth entry} \\
\hline
\hline \multicolumn{4}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
\end{longtable}
}
\end{center}
\end{document}


The table reacts as it should, meaning, it does not go into the margins, it continues from one page to the next until all rows have been displayed.

My problem is that I am trying to reduce the size of the table: shorter row heights, smaller font, etc, in order to scale my table down a page or two. I would be happy with a simple scaling just to make the entire thing smaller.

Any ideas?

I have searched through the questions and answers on here already - but no luck.

Thanks, R

-

## migrated from stackoverflow.comNov 20 '12 at 8:01

This question came from our site for professional and enthusiast programmers.

I am bound by my report's specifications and cannot turn the table 90degrees and/or make it landscape. Any other suggestions? Sidenote - the four columns are rather narrow and do not require the landscape in any case. – user1834300 Nov 18 '12 at 23:03

you cannot put a longtable into a box. Use a font macro for setting the textwidth down to \tiny. Example for \footnotesize:

\documentclass[12pt]{article}
\usepackage{longtable}
\begin{document}
\footnotesize%%%%%%%%%%%  smaller font size %%%%%%%%
\begin{longtable}{|c|c|c|c|}
\caption{A simple longtable example}\\\hline
\textbf{First entry} & \textbf{Second entry} & \textbf{Third entry} & \textbf{Fourth entry} \\\hline
\multicolumn{4}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\    \hline
\textbf{First entry} & \textbf{Second entry} & \textbf{Third entry} & \textbf{Fourth entry} \\    \hline
\hline \multicolumn{4}{r}{\textit{Continued on next page}} \\
\endfoot
\hline
\endlastfoot
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\
\end{longtable}

\normalsize
\end{document}

-
Any idea how to adapt this for within LyX longtables? – Nikos Alexandris Mar 14 '13 at 20:54
inser the longtable as usual, then mark the whole table and choose the size footnotesize from the menu – Herbert Mar 14 '13 at 20:59
Ah... sorry, I was after another solution/Q&A, i.e. after tex.stackexchange.com/a/54304/8272 – Nikos Alexandris Mar 14 '13 at 21:04

Here is some variants how to modify horizontal and vertical size of your table: at tex.stackexchange.com.

But, if you don't care of scaling text in table, I point you to command \resizebox -- it really works as you want, but it scales text respectively.

-
I have tried this unsuccessfully and am hoping you can take a quick look and tell me where I went wrong. thank you – user1834300 Nov 20 '12 at 4:09