knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(texblocks) library(texPreview)
tex_opts$set(returnType = 'html') tex_opts$append(list(cleanup='tex'))
as.tb('$\\alpha$') as.tb('aaa')
rep(as.tb('$\\alpha$'),3)
lapply(1:3,as.tb)
iris%>% head(5)%>% as.tb()
iris%>% head(5)%>% as.tb()%>% tabular()%>% texPreview::tex_preview()
matrix(0,3,3)%>% as.tb()
matrix(0,3,3)%>% as.tb()%>% tabular()%>% texPreview::tex_preview()
Matrix::bdiag(Matrix::Diagonal(2), matrix(1:3, 3,4), diag(3:2))%>% as.tb()
Matrix::bdiag(Matrix::Diagonal(2), matrix(1:3, 3,4), diag(3:2))%>% as.tb()%>% tabular()%>% texPreview::tex_preview()
matrix(1:9,3,3)%>% as.tb()%>% as.data.frame()
x <- as.tb('$\\alpha$') y <- as.tb('aaa') z <- as.tb('$\\beta$') x1 <- x+y+z
x1%>% tabular()%>% texPreview::tex_preview()
x/y/z
(x/y/z)%>% tabular()%>% texPreview::tex_preview()
Combined texblocks are texblocks themselves, thus can be further combined.
x2 <- x1 / x1 # 2x3 object x2 + x2
(x2 + x2)%>% tabular()%>% texPreview::tex_preview()
x3 <- x2/x2 # 4x3 object # 4x6 object with empty block in the lower right hand side of the table x2 + x3
(x2 + x3)%>% tabular()%>% texPreview::tex_preview()
# default alignment x1%>% texblocks::tabular()%>% texPreview::tex_preview()
# manual alignment x1%>% texblocks::tabular(align = '|cc|c')%>% texPreview::tex_preview()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.