The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Using texPreview in Rmarkdown HTML Documents

Jonathan Sidi

2023-12-09

library(texPreview)

tex_opts$set( 
  returnType = 'html',
  opts.html   = list(width = '75%', height = '75%')
)

The following examples use kable to generate LaTeX table outputs and raw LaTeX to pipe into tex_preview to render the in the document.

Kable Input


knitr::kable(head(iris,5),format = 'latex') |>
tex_preview()
plot of chunk testOut

plot of chunk testOut

TeX Input

tab='
\\begin{tabular}{llr}
\\hline
\\multicolumn{2}{c}{Item} \\\\
\\cline{1-2}
Animal    & Description & Price (\\$) \\\\
\\hline
Gnat      & per gram    & 13.65      \\\\
          & each        & 0.01       \\\\
Gnu       & stuffed     & 92.50      \\\\
Emu       & stuffed     & 33.33      \\\\
Armadillo & frozen      & 8.99       \\\\
\\hline
\\end{tabular}'

tab |>
  tex_preview()
plot of chunk testOut2

plot of chunk testOut2

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.