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.

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
\endfirsthead
\multicolumn{4}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
\hline
\textbf{First entry} & \textbf{Second entry} & \textbf{Third entry} & \textbf{Fourth entry} \\
\hline
\endhead
\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

share|improve this question

migrated from stackoverflow.com Nov 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
add comment

2 Answers 2

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
\endfirsthead
\multicolumn{4}{c}%
{\tablename\ \thetable\ -- \textit{Continued from previous page}} \\    \hline
\textbf{First entry} & \textbf{Second entry} & \textbf{Third entry} & \textbf{Fourth entry} \\    \hline
\endhead
\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}
share|improve this answer
    
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
add comment

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

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