From b404eafec2b371018c1a02bcc52226f88e625749 Mon Sep 17 00:00:00 2001
From: dscott <dscott@edb9625f-4e0d-4859-8d74-9fd3b1da38cb>
Date: Wed, 6 Jan 2016 23:34:03 +0000
Subject: [PATCH] Fixed alignment of column headings in xtableList, with
 multiple and include.rownmes TRUE

git-svn-id: svn://scm.r-forge.r-project.org/svnroot/xtable@82 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
---
 pkg/R/xtableList.R | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pkg/R/xtableList.R b/pkg/R/xtableList.R
index 35736f0..f0fb6d6 100644
--- a/pkg/R/xtableList.R
+++ b/pkg/R/xtableList.R
@@ -105,6 +105,7 @@ print.xtableList <- function(x,
     include.colnames <- TRUE
   }
 
+  ## Create headings for columns if multiple headings are needed
   if (colnames.format == "multiple"){
     if (is.null(sanitize.colnames.function)) {
       colHead <- names(x[[1]])
@@ -115,6 +116,9 @@ print.xtableList <- function(x,
       colHead <- paste("\\begin{sideways}", colHead, "\\end{sideways}")
     }
     colHead <- paste0(colHead, collapse = " & ")
+    if (include.rownames) {
+      colHead <- paste0(" & ", colHead)
+    }
     colHead <- paste0(tRule, "\n", colHead, " \\\\", mRule, "\n")
     add.to.row <- list(pos = NULL, command = NULL)
     add.to.row$pos <- as.list(c(0, c(combinedRowNums[1:length(x)])))
-- 
2.39.5