+### xtable package\r
+###\r
+### Produce LaTeX and HTML tables from R objects.\r
+###\r
+### Copyright 2000-2012 David B. Dahl <dahl@stat.tamu.edu>\r
+###\r
+### Maintained by Charles Roosen <croosen@mango-solutions.com>\r
+###\r
+### This file is part of the `xtable' library for R and related languages.\r
+### It is made available under the terms of the GNU General Public\r
+### License, version 2, or at your option, any later version,\r
+### incorporated herein by reference.\r
+###\r
+### This program is distributed in the hope that it will be\r
+### useful, but WITHOUT ANY WARRANTY; without even the implied\r
+### warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR\r
+### PURPOSE. See the GNU General Public License for more\r
+### details.\r
+###\r
+### You should have received a copy of the GNU General Public\r
+### License along with this program; if not, write to the Free\r
+### Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,\r
+### MA 02111-1307, USA\r
+\r
+## The generic for toLatex() is declared in the base package "utils"\r
+\r
+toLatex.xtable <- function(object, ...){\r
+ # Initially just capturing the output of print.xtable(). At some\r
+ # point this could be refactored to have print.xtable() call\r
+ # toLatex() instead. - CR, 30/01/2012\r
+ dotArgs <- list(...)\r
+ dotArgs$x <- object\r
+ dotArgs$type <- "latex"\r
+ dotArgs$print.result <- FALSE\r
+ z <- do.call("print.xtable", dotArgs)\r
+\r
+ z <- strsplit(z, split="\n")[[1]]\r
+ class(z) <- "Latex"\r
+ z\r
+}\r