Skip to content

Commit

Permalink
tweak print.latexMatrix() to eliminate unnecessary empty \phantom{}s
Browse files Browse the repository at this point in the history
  • Loading branch information
john-d-fox committed Sep 9, 2024
1 parent cff610e commit 139df8f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions R/latexMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -753,10 +753,13 @@ print.latexMatrix <- function(x, onConsole=TRUE,
countChars(colnames[j], adjust=FALSE)
}
pad <- max(max.col[j] - nchar, 0)
colnames[j] <- paste0(colnames[j],
paste0("\\phantom{",
paste(rep(colname.spacing, pad), collapse=""),
"}"))
if (any(pad > 0)){
colnames[j] <- paste0(colnames[j],
paste0("\\phantom{",
paste(rep(colname.spacing, pad),
collapse=""),
"}"))
}
}
}
if (!is.null(colnames)){
Expand Down

0 comments on commit 139df8f

Please sign in to comment.