Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- imageForFormula :: EnvironmentOptions -> FormulaOptions -> Formula -> IO (Either RenderError SVG)
- type Formula = String
- type SVG = String
- type BaseLine = Double
- getBaseline :: SVG -> Double
- alterForHTML :: SVG -> SVG
- data RenderError
- data EnvironmentOptions = EnvironmentOptions {}
- defaultEnv :: EnvironmentOptions
- data TempDirectoryHandling
- data FormulaOptions = FormulaOptions {
- preamble :: String
- environment :: Maybe String
- displaymath :: FormulaOptions
- math :: FormulaOptions
- defaultFormulaOptions :: FormulaOptions
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.
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
getBaseline :: SVG -> Double Source #
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.
LaTeXFailure String |
|
DVISVGMFailure String |
|
IOException IOException | An |
Instances
Eq RenderError Source # | |
Defined in Image.LaTeX.Render (==) :: RenderError -> RenderError -> Bool # (/=) :: RenderError -> RenderError -> Bool # | |
Show RenderError Source # | |
Defined in Image.LaTeX.Render showsPrec :: Int -> RenderError -> ShowS # show :: RenderError -> String # showList :: [RenderError] -> ShowS # |
Options
Environment Options
data EnvironmentOptions Source #
EnvironmentOptions | |
|
Instances
Eq EnvironmentOptions Source # | |
Defined in Image.LaTeX.Render (==) :: EnvironmentOptions -> EnvironmentOptions -> Bool # (/=) :: EnvironmentOptions -> EnvironmentOptions -> Bool # | |
Ord EnvironmentOptions Source # | |
Defined in Image.LaTeX.Render compare :: EnvironmentOptions -> EnvironmentOptions -> Ordering # (<) :: EnvironmentOptions -> EnvironmentOptions -> Bool # (<=) :: EnvironmentOptions -> EnvironmentOptions -> Bool # (>) :: EnvironmentOptions -> EnvironmentOptions -> Bool # (>=) :: EnvironmentOptions -> EnvironmentOptions -> Bool # max :: EnvironmentOptions -> EnvironmentOptions -> EnvironmentOptions # min :: EnvironmentOptions -> EnvironmentOptions -> EnvironmentOptions # | |
Read EnvironmentOptions Source # | |
Defined in Image.LaTeX.Render | |
Show EnvironmentOptions Source # | |
Defined in Image.LaTeX.Render showsPrec :: Int -> EnvironmentOptions -> ShowS # show :: EnvironmentOptions -> String # showList :: [EnvironmentOptions] -> ShowS # |
defaultEnv :: EnvironmentOptions Source #
Sensible defaults for system environments. Works if dvisvgm
and latex
are recent enough and in your $PATH
.
data TempDirectoryHandling Source #
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 |
Instances
Formula Options
data FormulaOptions Source #
FormulaOptions | |
|
Instances
Eq FormulaOptions Source # | |
Defined in Image.LaTeX.Render (==) :: FormulaOptions -> FormulaOptions -> Bool # (/=) :: FormulaOptions -> FormulaOptions -> Bool # | |
Ord FormulaOptions Source # | |
Defined in Image.LaTeX.Render compare :: FormulaOptions -> FormulaOptions -> Ordering # (<) :: FormulaOptions -> FormulaOptions -> Bool # (<=) :: FormulaOptions -> FormulaOptions -> Bool # (>) :: FormulaOptions -> FormulaOptions -> Bool # (>=) :: FormulaOptions -> FormulaOptions -> Bool # max :: FormulaOptions -> FormulaOptions -> FormulaOptions # min :: FormulaOptions -> FormulaOptions -> FormulaOptions # | |
Read FormulaOptions Source # | |
Defined in Image.LaTeX.Render readsPrec :: Int -> ReadS FormulaOptions # readList :: ReadS [FormulaOptions] # | |
Show FormulaOptions Source # | |
Defined in Image.LaTeX.Render showsPrec :: Int -> FormulaOptions -> ShowS # show :: FormulaOptions -> String # showList :: [FormulaOptions] -> ShowS # |
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.