Safe Haskell | None |
---|---|
Language | Haskell2010 |
Image.LaTeX.Render
Synopsis
- imageForFormula :: EnvironmentOptions -> FormulaOptions -> Formula -> IO (Either RenderError (Baseline, DynamicImage))
- type Formula = String
- type Baseline = Int
- data RenderError
- data EnvironmentOptions = EnvironmentOptions {}
- defaultEnv :: EnvironmentOptions
- data TempDirectoryHandling
- = UseSystemTempDir { }
- | UseCurrentDir { }
- data FormulaOptions = FormulaOptions {}
- displaymath :: FormulaOptions
- math :: FormulaOptions
Rendering Formulas
imageForFormula :: EnvironmentOptions -> FormulaOptions -> Formula -> IO (Either RenderError (Baseline, DynamicImage)) Source #
Convert a formula into a JuicyPixels DynamicImage
, also detecting where the typesetting baseline of the image is.
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.
Number of pixels from the bottom of the image to the typesetting baseline. Useful for setting your formulae inline with text.
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
ImageIsEmpty | The equation produced an empty image |
CannotDetectBaseline | The baseline marker could not be found |
LaTeXFailure String |
|
DVIPSFailure String |
|
IMConvertFailure String |
|
IOException IOException | An |
ImageReadError String | The PNG image from ImageMagick could not be read by JuicyPixels. |
Instances
Eq RenderError Source # | |
Defined in Image.LaTeX.Render | |
Show RenderError Source # | |
Defined in Image.LaTeX.Render Methods showsPrec :: Int -> RenderError -> ShowS # show :: RenderError -> String # showList :: [RenderError] -> ShowS # |
Options
Environment Options
data EnvironmentOptions Source #
Constructors
EnvironmentOptions | |
Fields
|
Instances
defaultEnv :: EnvironmentOptions Source #
Sensible defaults for system environments. Works if dvips
, convert
, and latex
are recent enough and in your $PATH
.
data TempDirectoryHandling Source #
Constructors
UseSystemTempDir | A temporary directory with a name based on the given template will be created in the system temporary files location |
Fields | |
UseCurrentDir | A temporary directory with a name based on the given template will be created in the current directory |
Fields |
Instances
Formula Options
data FormulaOptions Source #
Constructors
FormulaOptions | |
Fields
|
Instances
Eq FormulaOptions Source # | |
Defined in Image.LaTeX.Render Methods (==) :: FormulaOptions -> FormulaOptions -> Bool # (/=) :: FormulaOptions -> FormulaOptions -> Bool # | |
Ord FormulaOptions Source # | |
Defined in Image.LaTeX.Render Methods 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 Methods readsPrec :: Int -> ReadS FormulaOptions # readList :: ReadS [FormulaOptions] # | |
Show FormulaOptions Source # | |
Defined in Image.LaTeX.Render Methods showsPrec :: Int -> FormulaOptions -> ShowS # show :: FormulaOptions -> String # showList :: [FormulaOptions] -> ShowS # |
displaymath :: FormulaOptions Source #
Use the amsmath
package, the displaymath
environment, and 200dpi.
math :: FormulaOptions Source #
Use the amsmath
package, the math
environment, and 200dpi.