R/rm2l.R

Defines functions rm2l

Documented in rm2l

## rm2l converts a matrix into its transpose in latex code.

rm2l <- function(matrix){
  printmrow <- function(x) {
    y <- paste(paste(x,collapse ="&"),"\\")
    sprintf(y)
  }
  out <- apply(matrix,2,printmrow)
  out2 <- paste("\\\\begin{bmatrix}",paste(out,collapse='\\\\\\'),"\\\\end{bmatrix}")
  return(out2)
}

Try the Tex4exams package in your browser

Any scripts or data that you put into this service are public.

Tex4exams documentation built on May 31, 2023, 8:04 p.m.