I am using
\resizebox{\columnwidth}{!}{% ... %}
to fit a table which might be too wide onto a page by scaling it down.
However, my problem is that if the table is smaller than the column width, it gets scaled up, which looks really ugly, and, more importantly, it can then become too long to fit on the page.
So how do I change above to either shrink it or keep it the same, but not scale it up?
I need something along the lines of
\resizebox{min(\columnwidth,\originalwidth)}{!}{% ... %}
Best Answer
With the
adjustbox
package you can saythat will scale the contents only if it exceeds the
\columnwidth
, according to the documentation:Of course
\textwidth
is just by way of example and any dimension can be used.Here's an example:
As suggested by Martin Scharrer in a comment, the environment form can be even handier in this case:
The environment form automatically adds
\noindent
.