-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Conversion of LaTeX math formulas to MathML. -- -- The texmathml library provides functions to convert LaTeX math -- formulas to presentation MathML. It supports basic LaTeX and AMS -- extensions, and it can parse and apply LaTeX macros. -- -- Use the test flag to install a standalone executable, -- texmath, that reads a LaTeX formula from stdin and -- writes MathML to stdout. -- -- Use the cgi flag to install a cgi script, -- texmath-cgi. @package texmath @version 0.4 -- | Functions for parsing LaTeX macro definitions and applying macros to -- LateX expressions. module Text.TeXMath.Macros data Macro Macro :: String -> (forall st. GenParser Char st String) -> Macro macroDefinition :: Macro -> String macroParser :: Macro -> forall st. GenParser Char st String -- | Parses a \newcommand or \renewcommand macro -- definition and returns a Macro. pMacroDefinition :: GenParser Char st Macro -- | Skip whitespace and comments. pSkipSpaceComments :: GenParser Char st () -- | Applies a list of macros to a string recursively until a fixed point -- is reached. If there are several macros in the list with the same -- name, earlier ones will shadow later ones. applyMacros :: [Macro] -> String -> String instance Show Macro -- | Functions for parsing a LaTeX formula to a Haskell representation. module Text.TeXMath.Parser expr :: GenParser Char st Exp formula :: GenParser Char st [Exp] data Exp ENumber :: String -> Exp EGrouped :: [Exp] -> Exp EIdentifier :: String -> Exp EMathOperator :: String -> Exp ESymbol :: TeXSymbolType -> String -> Exp ESpace :: String -> Exp EBinary :: String -> Exp -> Exp -> Exp ESub :: Exp -> Exp -> Exp ESuper :: Exp -> Exp -> Exp ESubsup :: Exp -> Exp -> Exp -> Exp EOver :: Exp -> Exp -> Exp EUnder :: Exp -> Exp -> Exp EUnderover :: Exp -> Exp -> Exp -> Exp EUp :: Exp -> Exp -> Exp EDown :: Exp -> Exp -> Exp EDownup :: Exp -> Exp -> Exp -> Exp EUnary :: String -> Exp -> Exp EScaled :: String -> Exp -> Exp EStretchy :: Exp -> Exp EArray :: [Alignment] -> [ArrayLine] -> Exp EText :: String -> String -> Exp data TeXSymbolType Ord :: TeXSymbolType Op :: TeXSymbolType Bin :: TeXSymbolType Rel :: TeXSymbolType Open :: TeXSymbolType Close :: TeXSymbolType Pun :: TeXSymbolType Accent :: TeXSymbolType type ArrayLine = [[Exp]] data Alignment AlignLeft :: Alignment AlignCenter :: Alignment AlignRight :: Alignment AlignDefault :: Alignment instance Typeable Exp instance Typeable Alignment instance Typeable TeXSymbolType instance Show Exp instance Read Exp instance Eq Exp instance Data Exp instance Show Alignment instance Read Alignment instance Eq Alignment instance Data Alignment instance Show TeXSymbolType instance Read TeXSymbolType instance Eq TeXSymbolType instance Data TeXSymbolType -- | Functions for writing a parsed formula as MathML. module Text.TeXMath.MathMLWriter toMathML :: DisplayType -> [Exp] -> Element data DisplayType DisplayBlock :: DisplayType DisplayInline :: DisplayType showExp :: Exp -> Element instance Show DisplayType -- | Functions for converting LaTeX math formulas to MathML. module Text.TeXMath texMathToMathML :: DisplayType -> String -> Either String Element data DisplayType DisplayBlock :: DisplayType DisplayInline :: DisplayType