SCM

[#4962] Add support for graphicx's resizebox command

View Trackers | Feature Requests | Download .csv | Monitor

Date:
2013-10-03 14:50
Priority:
3
State:
Open
Submitted by:
Alastair Andrew (alastairandrew)
Assigned to:
David Scott (dscott)
Product:
None
Operating System:
All
Component:
None
 
Summary:
Add support for graphicx's resizebox command

Detailed description
Scaling a table to fit neatly within a document is a common operation. The graphicx package provides the \resizebox command that nicely allows tables (amongst other things) to be scaled. It would be good if xtable provided an option to wrap the inner tabular block in a \resizebox.

It should be a fairly minor change, I've patched my working copy of xtable to support it already.

> print(xtable(lm.D9,caption="\\tt latex.environments=c(center, resizebox)"),latex.environments=c("center","resizebox"))
% latex table generated in R 3.0.2 by xtable 1.7-1 package
% Thu Oct 3 15:49:52 2013
\begin{table}[ht]
\centering
\resizebox{\linewidth}{!}{
\begin{tabular}{rrrrr}
\hline
& Estimate & Std. Error & t value & Pr($>$$|$t$|$) \\
\hline
(Intercept) & 5.0320 & 0.2202 & 22.85 & 0.0000 \\
groupTrt & -0.3710 & 0.3114 & -1.19 & 0.2490 \\
\hline
\end{tabular}
\caption{\tt latex.environments=c(center, resizebox)}
}
\end{table}

Followup

Message
Date: 2016-01-28 04:14
Sender: David Scott

I have given this low priority given the existence of the scalebox argument which can already be used to scale a table. The resizebox alternative is a little nicer in some ways.
Date: 2014-09-26 13:07
Sender: David Scott

I am not sure if this feature request was already dealt with, but it seems that there is the facility for scaling tables already in 1.7-4 at least.

There is an example in xtableGallery of the use of the argument scalebox to scale a table. The following one-liner should give an illustration:

print(xtable(matrix(rnorm(200), ncol = 10)), scalebox = 0.7)


Attached Files:

Changes:

Field Old Value Date By
assigned_tonone2014-09-26 13:07dscott
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge