latex-svg-image-0.2: A library for rendering LaTeX formulae as SVG using an actual LaTeX

Safe HaskellSafe
LanguageHaskell2010

Image.LaTeX.Render

Contents

Synopsis

Rendering Formulas

imageForFormula :: EnvironmentOptions -> FormulaOptions -> Formula -> IO (Either RenderError SVG) Source #

Convert a formula into a SVG image.

type Formula = String Source #

A LaTeX formula, e.g x=frac{-bpmsqrt{b^2-4ac}}{2a} for the quadratic formula. Do not include any $s to denote the environment, just specify the environment in the FormulaOptions instead.

type SVG = String Source #

A source of SVG image.

BaseLine

type BaseLine = Double Source #

Number of points (pt) from the bottom of the image to the typesetting baseline. Useful for setting your formulae inline with text

alterForHTML :: SVG -> SVG Source #

Alter SVG image to be embeddable in HTML page, i.e.align baseline.

  • Add style="vertical-align: baseline-correction"
  • Remove id="page1"

Errors

data RenderError Source #

This type contains all possible errors than can happen while rendering an equation. It includes all IO errors that can happen as well as more specific errors.

Constructors

LaTeXFailure String

latex returned a nonzero error code

DVISVGMFailure String

dvisvgm returned a nonzero error code

IOException IOException

An IOException occurred while managing the temporary files used to convert the equation

Instances
Eq RenderError Source # 
Instance details

Defined in Image.LaTeX.Render

Show RenderError Source # 
Instance details

Defined in Image.LaTeX.Render

Options

Environment Options

data EnvironmentOptions Source #

Constructors

EnvironmentOptions 

Fields

defaultEnv :: EnvironmentOptions Source #

Sensible defaults for system environments. Works if dvisvgm and latex are recent enough and in your $PATH.

data TempDirectoryHandling Source #

Constructors

UseSystemTempDir String

A temporary directory with a name based on the given template will be created in the system temporary files location

UseCurrentDir String

A temporary directory with a name based on the given template will be created in the current directory

Formula Options

displaymath :: FormulaOptions Source #

Use the amsmath, amsfonts and lmodern package, the displaymath environment.

math :: FormulaOptions Source #

Use the amsmath, amsfonts and lmodern package, the math environment.

defaultFormulaOptions :: FormulaOptions Source #

Use the amsmath, amsfonts and lmodern packages.