Skip to content

Commit

Permalink
Fix bug in print.latexMatrix(sparse=TRUE)
Browse files Browse the repository at this point in the history
  • Loading branch information
john-d-fox committed Oct 13, 2024
1 parent b8e25ef commit 74c2b54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

- Rename vignettes to put them in order
- Add `papers/matlib-useR-2016.pdf` to avoid bad URL
- Consolidate options for `print.latexMatrix`
- Fix bug in `print.latexMatrix(sparse=TRUE)`

# matlib 1.0.0

Expand Down
4 changes: 2 additions & 2 deletions R/latexMatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ latexMatrix <- function(
body <- unname(do.call(rbind, splt)) # matrix of LaTeX cells
body <- sub(" *$", "", sub("^ *", "", body))
if(sparse)
mat.result <- gsub('[[:blank:]]+0[[:blank:]]+', ' ', mat.result)
mat.result <- gsub('[[:blank:]]*0[[:blank:]]*', ' ', mat.result)

if (!is.null(rownames)){
rownames <- as.character(rownames)
Expand Down Expand Up @@ -771,7 +771,7 @@ print.latexMatrix <- function(x, onConsole=TRUE,
cell.spacing <- "e"
if (is.null(colname.spacing) || is.na(colname.spacing))
colname.spacing <- "i"
if (is.null(text.labels) || is.na(text.labels))
if (is.null(text.labels) || all(is.na(text.labels)))
text.labels <- c("row"=FALSE, "column"=FALSE)
if (is.null(display.labels) || is.na(display.labels))
display.labels <- TRUE
Expand Down

0 comments on commit 74c2b54

Please sign in to comment.