* Added "booktabs" argument to use the "\toprule", "\midrule", and
"\bottomrule" tags from the Latex "booktabs" package rather than
using "\hline" for all horizontal lines.
+ * Added "scalebox" argument to include a "\scalebox" clause around
+ the tabular environment with the specified value used as the
+ scaling factor.
* Changed the "print.xtable()" arguments to use "getOption()"
to check the options for a default value. This was suggested
since "print.xtable()" has a lot of arguments that the user
will typically leave unchanged between tables.
* Added an "is.null()" check on the "table.placement" argument.
- * Added an example of header and footer specification with longtable
- to the vignette.
* Added examples using the new arguments to the vignette.
1.6-0 (2011-10-07)
rotate.rownames=getOption("xtable.rotate.rownames", FALSE),\r
rotate.colnames=getOption("xtable.rotate.colnames", FALSE),\r
booktabs = getOption("xtable.booktabs", FALSE),\r
+ scalebox = getOption("xtable.scalebox", NULL),\r
...) {\r
# If caption is length 2, treat the second value as the "short caption"\r
caption <- attr(x,"caption",exact=TRUE)\r
paste(c(attr(x, "align",exact=TRUE)[tmp.index.start:length(attr(x,"align",exact=TRUE))], "}\n"),\r
sep="", collapse=""),\r
sep="")\r
- \r
+\r
## fix 10-26-09 (robert.castelo@upf.edu) the following 'if' condition is added here to support\r
## a caption on the top of a longtable\r
if (tabular.environment == "longtable" && caption.placement=="top") {\r
BTABULAR <- paste(BTABULAR,lastcol[1], sep="")\r
# the \hline at the end, if present, is set in full matrix \r
ETABULAR <- paste("\\end{",tabular.environment,"}\n",sep="")\r
+\r
+ ## Add scalebox - CR, 7/2/12\r
+ if (!is.null(scalebox)){\r
+ BTABULAR <- paste("\\scalebox{", scalebox, "}{\n", BTABULAR, sep="")\r
+ ETABULAR <- paste(ETABULAR, "}\n", sep="")\r
+ }\r
\r
# BSIZE contributed by Benno <puetz@mpipsykl.mpg.de> in e-mail dated Wednesday, December 01, 2004\r
if (is.null(size) || !is.character(size)) {\r
\subsection{Long tables}
Remember to insert \verb|\usepackage{longtable}| in your \LaTeX preamble.
-See Table \ref{tabbig}.
<<longtable>>=
print(x.big,tabular.environment='longtable',floating=FALSE)
@
-\subsubsection{Long tables with the header on each page}
-
-The {\tt add.to.row} argument can be used to display the header
-for a long table on each page, and to add a "continued" footer
-on all pages except the last page. See Table \ref{tabbig2}.
-
-<<results=tex>>=
-library(xtable)
-x<-matrix(rnorm(1000), ncol = 10)
-
-addtorow<-list()
-addtorow$pos<-list()
-addtorow$pos[[1]]<-c(0)
-addtorow$command<-c(paste(
- "\\hline \n",
- " \\endhead \n",
- " \\hline \n",
- " {\\footnotesize Continued on next page} \n",
- " \\endfoot \n",
- " \\endlastfoot \n",sep=""))
-x.big2 <- xtable(x, label = "tabbig2",
- caption = "Example of longtable with the header on each page")
-print(x.big2, tabular.environment = "longtable", floating = FALSE,
-include.rownames=FALSE,add.to.row=addtorow,hline.after=c(-1) )
-@
+%%
+%% The column name alignment is off in the following example.
+%% It needs some revision before exposing it. - CR, 7/2/2012
+%%
+%
+%\subsubsection{Long tables with the header on each page}
+%
+%The {\tt add.to.row} argument can be used to display the header
+%for a long table on each page, and to add a "continued" footer
+%on all pages except the last page.
+%
+%<<results=tex>>=
+%library(xtable)
+%x<-matrix(rnorm(1000), ncol = 10)
+%addtorow<-list()
+%addtorow$pos<-list()
+%addtorow$pos[[1]]<-c(0)
+%addtorow$command<-c(paste(
+% "\\hline \n",
+% " \\endhead \n",
+% " \\hline \n",
+% " {\\footnotesize Continued on next page} \n",
+% " \\endfoot \n",
+% " \\endlastfoot \n",sep=""))
+%x.big2 <- xtable(x, label = "tabbig2",
+% caption = "Example of longtable with the header on each page")
+%print(x.big2, tabular.environment = "longtable", floating = FALSE,
+%include.rownames=FALSE, add.to.row=addtorow, hline.after=c(-1) )
+%@
\subsection{Sideways tables}
Remember to insert \verb|\usepackage{rotating}| in your LaTeX preamble.
Sideways tables can't be forced in place with the `H' specifier, but you can
use the \verb|\clearpage| command to get them fairly nearby.
-See Table \ref{tabsmall}.
<<>>=
x <- x[1:30,]
@
\clearpage
+\subsection{Rescaled tables}
+Specify a \code{scalebox} value to rescale the table.
+
+<<>>=
+x <- x[1:20,]
+x.rescale <- xtable(x,label='tabrescaled',caption='A rescaled table')
+@
+
+<<results=tex>>=
+print(x.rescale, scalebox=0.7)
+@
+
\section{Suppressing Printing}
By default the {\tt print} method will print the LaTeX or HTML to standard
output and also return the character strings invisibly. The printing to
rotate.rownames=getOption("xtable.rotate.rownames", FALSE),\r
rotate.colnames=getOption("xtable.rotate.colnames", FALSE),\r
booktabs = getOption("xtable.booktabs", FALSE),\r
+ scalebox = getOption("xtable.scalebox", NULL),\r
...)}\r
\arguments{\r
\item{x}{An object of class \code{"xtable"}.}\r
\item{rotate.rownames}{If \code{TRUE}, the row names are displayed vertically in LaTeX.}\r
\item{rotate.colnames}{If \code{TRUE}, the column names are displayed vertically in LaTeX.}\r
\item{booktabs}{If \code{TRUE}, the \code{toprule}, \code{midrule} and \code{bottomrule} tags from the LaTex "booktabs" package are used rather than \code{hline} for the horizontal line tags.}\r
+ \item{scalebox}{If not \code{NULL}, a \code{scalebox} clause will be added around the tabular environment with the specified value used as the scaling factor.}\r
\item{...}{Additional arguments. (Currently ignored.)}\r
}\r
\details{\r