From feferraz at ime.usp.br  Sun Jan 18 00:30:18 2004
From: feferraz at ime.usp.br (Fernando Henrique Ferraz)
Date: Sun Jan 18 00:28:47 2004
Subject: [Rd] xtable feature addition suggestion
Message-ID: <20040117233017.GA6866@gmx.de>

	Hi, attached follows a patch to add a feature that I think it would be useful having in the print.xtable function of the xtable package. It adds the option 'tabular.environment' to that function, which could be used to set an alternative tabular environment, as the name already suggests. 

	This is particulary useful when dealing with long tables, which do not fit in a single page. In the default behaviour, using \begin{tabular} ... \end{tabular}, everything that doesn't fit on the page dissappears. By using the LaTeX package 'longtable' and the 'tabular.environment="longtable"' option to print.xtable() this and other problems can be overcome, adding more flexiblity to the package.

	Thank you,

--
[]'s
Fernando Henrique Ferraz P. da Rosa
-------------- next part --------------
--- xtable_1.2-2/R/print.xtable.R	2004-01-17 20:43:04.000000000 -0200
+++ xtable_1.2-2-patched/R/print.xtable.R	2004-01-17 20:33:55.000000000 -0200
@@ -19,7 +19,7 @@
 ### License along with this program; if not, write to the Free
 ### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ### MA 02111-1307, USA
-print.xtable <- function(x,type="latex",file="",append=FALSE,floating=TRUE,table.placement="ht",caption.placement="bottom",latex.environments=c("center"),...) {
+print.xtable <- function(x,type="latex",file="",append=FALSE,floating=TRUE,table.placement="ht",caption.placement="bottom",latex.environments=c("center"),tabular.environment="tabular",...) {
 
   if (length(type)>1)
     stop("\"type\" must have length 1")
@@ -63,12 +63,12 @@
     }
 #    BTABULAR <- string("\\begin{tabular}{|") + paste(attr(x,"align"),collapse="|") + "|}\n\\hline\n"
 #    See e-mail from "BXC (Bendix Carstensen)" <bxc@novonordisk.com> dated Mon, 27 Aug 2001 10:11:54 +0200
-    BTABULAR <- paste("\\begin{tabular}{",
+    BTABULAR <- paste("\\begin{",tabular.environment,"}{",
                       paste(attr(x, "vsep"),
                             c(attr(x, "align"), "}\n\\hline\n"),
                             sep="", collapse=""),
                       sep="")
-    ETABULAR <- "\\hline\n\\end{tabular}\n"
+    ETABULAR <- paste("\\hline\n\\end{",tabular.environment,"}\n",sep="")
     BLABEL <- "\\label{"
     ELABEL <- "}\n"
     BCAPTION <- "\\caption{"

[Rd] xtable feature addition suggestion
Fernando Henrique Ferraz