rotate.colnames=getOption("xtable.rotate.colnames", FALSE),\r
booktabs = getOption("xtable.booktabs", FALSE),\r
scalebox = getOption("xtable.scalebox", NULL),\r
+ width = getOption("xtable.width", NULL),\r
...) {\r
# If caption is length 2, treat the second value as the "short caption"\r
caption <- attr(x,"caption",exact=TRUE)\r
while ( attr(x,"align",exact=TRUE)[tmp.index.start] == '|' ) tmp.index.start <- tmp.index.start + 1\r
tmp.index.start <- tmp.index.start + 1\r
}\r
- BTABULAR <- paste("\\begin{",tabular.environment,"}{",\r
- paste(c(attr(x, "align",exact=TRUE)[tmp.index.start:length(attr(x,"align",exact=TRUE))], "}\n"),\r
- sep="", collapse=""),\r
- sep="")\r
+ # Added "width" argument for use with "tabular*" or "tabularx" environments - CR, 7/2/12\r
+ if (is.null(width)){\r
+ WIDTH <-""\r
+ } else if (is.element(tabular.environment, c("tabular", "longtable"))){\r
+ warning("Ignoring 'width' argument. The 'tabular' and 'longtable' environments do not support a width specification. Use another environment such as 'tabular*' or 'tabularx' to specify the width.")\r
+ WIDTH <- ""\r
+ } else {\r
+ WIDTH <- paste("{", width, "}", sep="")\r
+ }\r
+ \r
+ BTABULAR <- paste("\\begin{",tabular.environment,"}", WIDTH, "{",\r
+ paste(c(attr(x, "align",exact=TRUE)[tmp.index.start:length(attr(x,"align",\r
+ exact=TRUE))], "}\n"), sep="", collapse=""),\r
+ sep="")\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