2

I've got a longish sidewaystable which currently is to large for its page. At least with \footnotesize it is. With \scriptsize it becomes too small, which looks strange and is hard to read.

Is there some way to (semi-)automatically scale a table to best fit the page?

I'm thinking about some package which iteratively adjusts font sizes, or which does a magnification of a single box, or some such. Lacking an automated solution, what's the best way to adjust font sizes to a without too much trouble? I'd like to keep the header unscaled, and the caption as well if possible.

  • 1
    Normally I recommend using font size commands rather than scaling but you can use \resizebox{\linewidth}{!}{\begin{tabular... – David Carlisle May 28 '13 at 23:18
  • Maybe you can find a decent way to subdivide the data you want to present into two tables? – Andy Clifton May 28 '13 at 23:30
  • @DavidCarlisle. Nice except for the fact that I'm currently (ab)using \catcode`-=13\def-{$\dotdiv$} nested as \begingroup\catc…\begin{table}…\end{table}\endgroup. Plugging all of that into a \resizebox gives me some error about \inaccessible. Seems the change is not local enough. If everything else fails, I'll use a mass search and replace to avoid this redefinition of -, but that would make my code less readable than it is now. Not sure how I feel about that. – MvG May 28 '13 at 23:32
  • @LostBrit: Valid point. On the other hand, it's only one or two lines of the table which won't fit, and using \scriptsize is appropriate for the (non-)importance of the data in this table. I have mixed feeling about using yet another page on this data, particularly as the resulting pages would seem rather empty since I can't make the font much larger due to the number and width of the columns I need. – MvG May 28 '13 at 23:34
  • @MvG (a) abuse is wrong but (b) you just need to put the catcode chages before the resizebox not inside it. (which you want anyway as you don't want to put the table environment into the \resizebox (also you don't need/shouldn't use \begingroup there just put the catcode changes inside the table environment.. – David Carlisle May 28 '13 at 23:36
4

You can use

\begin{table}%or {sidewaystable}
%\catcode stuffif you must
\noindent
\resizebox{\linewidth}{!}{\begin{tabular}{...}
...
\end{tabular}}
\end{table}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.