convert
command.tex2image(tex, format = "png", width = 6, pt = 12, density = 350,
dir = NULL, tdir = NULL, idir = NULL,
width.border = 0L, col.border = "white", resize = 650, shave = 4,
packages = c("amsmath", "amssymb", "amsfonts"),
header, header2 = NULL, Sweave = TRUE, show = TRUE,
name = "tex2image")
tempdir
.browseURL
.tex2image
converts LaTeX code to image files, e.g., for inclusion
in web pages. It proceeds in the following steps: (1) LaTeX code is
embedded into a suitable .tex file. (2) This is compiled to PDF using
texi2dvi
. (3) The PDF is converted to an image
file (PNG by default) using ImageMagick's convert
function.
To enable suitable clipping and cropping, each vector of LaTeX code
has to fit onto a single page (A4). It is automatically embedded into a
framebox that is removed in the conversion to image.
If tex
is a list of LaTeX chunks, then these are compiled to
separate pages of a single PDF in a single LaTeX run. Each page is
subsequently converted to a separate image.
For conversion to images, ImageMagick's convert
command is
assumed to be installed and available in the search path.texi2dvi
tex <- c("This is \\textbf{bold} and this \\textit{italic}.",
"Points on the unit circle: $x^2 + y^2 = 1$.")
tex2image(tex)
tex2image(tex, header = NULL)
Run the code above in your browser using DataLab