### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# lib.latextools

## Module: `lib.latextools`

Tools for handling LaTeX.

Authors:

- Brian Granger

## Functions

`IPython.lib.latextools.``latex_to_html`(s, alt='image')

  Render LaTeX to HTML with embedded PNG data using data URIs.

  Parameters :

  s : str

  > The raw string containing valid inline LateX.

  alt : str

  > The alt text to use for the HTML.

`IPython.lib.latextools.``latex_to_png`(s, encode=False)

  Render a LaTeX string to PNG using matplotlib.mathtext.

  Parameters :

  s : str

  > The raw string containing valid inline LaTeX.

  encode : bool, optional

  > Should the PNG data bebase64 encoded to make it JSON’able.

`IPython.lib.latextools.``math_to_image`(s, filename_or_obj, prop=None, dpi=None, format=None)

  Given a math expression, renders it in a closely-clipped bounding box to an image file.

  s
    A math expression. The math portion should be enclosed in dollar signs.
  filename_or_obj
    A filepath or writable file-like object to write the image data to.
  prop
    If provided, a FontProperties() object describing the size and style of the text.
  dpi
    Override the output dpi, otherwise use the default associated with the output format.
  format
    The output format, eg. ‘svg’, ‘pdf’, ‘ps’ or ‘png’. If not provided, will be deduced from the filename.

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »