Compile and Preview Snippets of 'LaTeX' in 'RStudio'

Compile and preview snippets of 'LaTeX'. Can be used directly from the R console, from 'RStudio', in Shiny apps and R Markdown documents. Must have 'pdflatex' or 'xelatex' or 'lualatex' in 'PATH'.

CRAN_Status_Badge Project Status: Active - The project has reached a stable, usable state and is being actively developed. downloadsTravis-CI Build Status Coverage Status Covrpage Summary

Preview and save images of rendered snippets of LaTeX in RStudio viewer

  • Must have pdflatex in PATH (Windows users can install by running the following in R: install.packages("installr"); installr::install.MikTeX())

  • Supports Tabular, equations and other LaTex functionalities.

  • Load TeX packages

  • Input Preamble

  • Supports xtable inputs

  • Defined as Rstudio Addin so user can highlight text in the editor and invoke preview automatically.

  • Can be run in a rmarkdown enviornment pdf/html/book/beamer/ioslides/slidy/revealjs ...

  • Can be run in a shiny enviornment, as shiny::renderImage or as part of htmlwidgets like bsplus::carousel, loryR::renderLoryR and slickR::renderSlickR.

When the output is set to 'svg' the default output to the viewer is svgPanZoom, which allows for panning and zooming on the image in the viewer. If the package is not installed a static image will be loaded.


texPreview 1.3.2

  • Fix rotation LaTeX library used for rotation in the internal template.

texPreview 1.3.1

  • Fix path normalization to OS agnostic.

texPreview 1.3.0

  • Change names of function from camelcase to underscore and soft depreciate the camelcase
    • Old: texPreview, buildUsepackage, getTexPackages, texAddin
    • New: tex_preview, build_usepackage, get_texpackages, tex_addin

texPreview 1.1.5

  • fix viewer issue to keep new pages in internal viewer

texPreview 1.1.4

  • Added a file to track changes to the package.
  • Added pagination of preview outputs in the Rstudio internal viewer.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.4.2 by Jonathan Sidi, 3 hours ago

Report a bug at

Browse source code at

Authors: Jonathan Sidi [aut, cre] , Daniel Polhamus [aut]

Documentation:   PDF Manual  

GPL-2 | GPL-3 license

Imports base64enc, fs, htmltools, knitr, lifecycle, magick, magrittr, rematch2, rstudioapi, svgPanZoom, utils, whisker, xml2

Suggests covr, kableExtra, nlme, rmarkdown, shiny, slickR, testthat, texreg, xtable, details, pdftools

Imported by mathpix.

See at CRAN