Wolfram Research

Function Repository Resource:

LaTeXPreview

Source Notebook

Render LaTeX as an image

Contributed by: Aster Gal

ResourceFunction["LaTeXPreview"][tex]

renders the LaTeX string tex as an image.

Details and Options

LaTeXPreview uses a third-party API, so a network connection is required.
The following option values are supported for the option "API":
"Codecogs" https://latex.codecogs.com
"LaTeX2PNG" https://latex2png.com

Examples

Basic Examples

Show a Tex string as an image:

In[1]:=
tex = "\\Gamma_{\\epsilon}(x)=\\left[1-e^{-2 \\pi \
\\epsilon}\\right]^{1-x} \\prod_{n=0}^{\\infty} \\frac{1-\\exp (-2 \
\\pi \\epsilon(n+1))}{1-\\exp (-2 \\pi \\epsilon(x+n))}";
In[2]:=
ResourceFunction["LaTeXPreview"][tex]
Out[2]=

Options

API

Get rendering results from a different place:

In[3]:=
ResourceFunction["LaTeXPreview"][tex, "API" -> "LaTeX2PNG"]
Out[3]=

ImageResolution

Get HD rendering from LaTeX2PNG:

In[4]:=
ResourceFunction["LaTeXPreview"][tex, "API" -> "LaTeX2PNG", ImageResolution -> 300]
Out[4]=

Resource History