-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Conversion of LaTeX math formulas to MathML or OMML. -- -- The texmathml library provides functions to convert LaTeX math -- formulas to presentation MathML (which can be used in HTML) or OMML -- (Office Math Markup Language, used in Microsoft Office). It supports -- basic LaTeX and AMS extensions, and it can parse and apply LaTeX -- macros. -- -- Use the executable 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.6.7 module Text.TeXMath.Unidecode -- | Approximates a single unicode character as an ASCII string (each -- character is between 0x00 and 0x7F). getASCII :: Char -> String module Text.TeXMath.EntityMap -- | Translates MathML entity reference to the corresponding Unicode string getUnicode :: String -> Maybe String -- | Functions for parsing LaTeX macro definitions and applying macros to -- LateX expressions. module Text.TeXMath.Macros data Macro -- | Parses a string for a list of macro definitions, optionally separated -- and ended by spaces and TeX comments. Returns the list of macros -- (which may be empty) and the unparsed portion of the input string. parseMacroDefinitions :: String -> ([Macro], String) -- | 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 -- | Types for representing a structured formula. module Text.TeXMath.Types data Exp ENumber :: String -> Exp EGrouped :: [Exp] -> Exp EDelimited :: String -> String -> [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 :: TextType -> String -> Exp data TeXSymbolType Ord :: TeXSymbolType Op :: TeXSymbolType Bin :: TeXSymbolType Rel :: TeXSymbolType Open :: TeXSymbolType Close :: TeXSymbolType Pun :: TeXSymbolType Accent :: TeXSymbolType type ArrayLine = [[Exp]] data TextType TextNormal :: TextType TextBold :: TextType TextItalic :: TextType TextMonospace :: TextType TextSansSerif :: TextType TextDoubleStruck :: TextType TextScript :: TextType TextFraktur :: TextType TextBoldItalic :: TextType TextBoldSansSerif :: TextType TextBoldSansSerifItalic :: TextType TextBoldScript :: TextType TextBoldFraktur :: TextType TextSansSerifItalic :: TextType data Alignment AlignLeft :: Alignment AlignCenter :: Alignment AlignRight :: Alignment AlignDefault :: Alignment data DisplayType DisplayBlock :: DisplayType DisplayInline :: DisplayType -- | A record of the MathML dictionary as defined in the -- specification data Operator Operator :: String -> String -> FormType -> Int -> Int -> Int -> [Property] -> Operator -- | Operator oper :: Operator -> String -- | Plain English Description description :: Operator -> String -- | Whether Prefix, Postfix or Infix form :: Operator -> FormType -- | Default priority for implicit nesting priority :: Operator -> Int -- | Default Left Spacing lspace :: Operator -> Int -- | Default Right Spacing rspace :: Operator -> Int -- | List of MathML properties properties :: Operator -> [Property] data FormType FPrefix :: FormType FPostfix :: FormType FInfix :: FormType -- | A record of the Unicode to LaTeX lookup table a full descripton can be -- seen -- <http:milde.users.sourceforge.netLUCRMathdataunimathsymbols.txt -- here> data Record Record :: String -> Char -> String -> String -> String -> String -> String -> String -> Record -- | Hex value point :: Record -> String -- | Unicode Character uchar :: Record -> Char -- | LaTeX command latex :: Record -> String -- | Unicode-Math package command unicodemath :: Record -> String -- | Unicode math character class cls :: Record -> String -- | TeX math category category :: Record -> String -- | Required packages requirements :: Record -> String -- | Alternative commands and description comments :: Record -> String data Position Under :: Position Over :: Position instance Typeable TeXSymbolType instance Typeable Alignment instance Typeable TextType instance Typeable Exp instance Show TeXSymbolType instance Read TeXSymbolType instance Eq TeXSymbolType instance Data TeXSymbolType instance Show Alignment instance Read Alignment instance Eq Alignment instance Data Alignment instance Show DisplayType instance Show TextType instance Ord TextType instance Read TextType instance Eq TextType instance Data TextType instance Show Exp instance Read Exp instance Eq Exp instance Data Exp instance Show FormType instance Ord FormType instance Eq FormType instance Show Operator instance Show Record module Text.TeXMath.Shared -- | Maps TextType to the corresponding MathML mathvariant getMMLType :: TextType -> String -- | Maps MathML mathvariant to the corresponing TextType getTextType :: String -> TextType -- | Maps a length in em to the nearest bigger LaTeX space command getSpaceCommand :: String -> String -- | Maps TextType to corresponding LaTeX command getLaTeXTextCommand :: TextType -> String -- | Maps a LaTeX scaling command to the percentage scaling getScalerCommand :: String -> Maybe String -- | Gets percentage scaling from LaTeX scaling command getScalerValue :: String -> Maybe String -- | Given a diacritical mark, returns the corresponding LaTeX command getDiacriticalCommand :: Position -> String -> Maybe String -- | Returns the correct constructor given a LaTeX command getDiacriticalCons :: String -> Maybe (Exp -> Exp) -- | Function for replacing strings of characters with their respective -- mathvariant module Text.TeXMath.ToUnicode -- | The inverse of toUnicode, returns the corresponding | A-Za-z character -- and TextType of a unicode character. fromUnicode :: Char -> Maybe (TextType, Char) -- | Replace all characters in the string A-Z, a-z with their corresponding -- mathvariant unicode character. | MathML has a mathvariant attribute -- which is unimplemented in Firefox | (see -- https:bugzilla.mozilla.org/show_bug.cgi?id=114365) | Therefore, -- we may want to translate mathscr, etc to unicode symbols directly. toUnicode :: TextType -> String -> String module Text.TeXMath.MMLDict -- | Tries to find the Operator record, returns a dummy record -- indicating a math operator if none are found getOperator :: String -> FormType -> Operator module Text.TeXMath.UnicodeToLaTeX -- | Converts a string of unicode characters into a string of equivalent -- LaTeX commands. getLaTeX :: String -> String records :: [Record] module Text.TeXMath.LaTeX toTeXMath :: DisplayType -> [Exp] -> String -- | Functions for writing a parsed formula as a list of Pandoc Inlines. module Text.TeXMath.Pandoc -- | Converts a formula to a list of Pandoc inlines. Defaults to raw -- formula between $ characters if entire formula can't be -- converted. toPandoc :: DisplayType -> [Exp] -> Maybe [Inline] -- | Functions for writing a parsed formula as OMML. module Text.TeXMath.OMML toOMML :: DisplayType -> [Exp] -> Element showExp :: Exp -> [Element] -- | Functions for writing a parsed formula as MathML. module Text.TeXMath.MathML toMathML :: DisplayType -> [Exp] -> Element showExp :: Exp -> Element module Text.TeXMath.MathMLParser -- | Parse a MathML expression to a list of Exp readMathML :: String -> Either String [Exp] -- | Functions for parsing a LaTeX formula to a Haskell representation. module Text.TeXMath.Parser -- | Parse a formula, returning a list of Exp. readTeXMath :: String -> Either String [Exp] -- | Functions for converting LaTeX math formulas to MathML. module Text.TeXMath -- | Convert texMath string to MathML texMathToMathML :: DisplayType -> String -> Either String Element -- | Convert texMath string to OMML (Office Math Markup Language) texMathToOMML :: DisplayType -> String -> Either String Element -- | Convert texMath to Pandoc inlines texMathToPandoc :: DisplayType -> String -> Either String [Inline] -- | Convert MathML to OMML (Office Math Markup Language) mathMLToOMML :: DisplayType -> String -> Either String Element -- | Convert MathML to Pandoc inlines mathMLToPandoc :: DisplayType -> String -> Either String [Inline] -- | Convert MathML to Pandoc Math Element mathMLToLaTeX :: DisplayType -> String -> Either String Inline -- | Parse a MathML expression to a list of Exp readMathML :: String -> Either String [Exp] -- | Parse a formula, returning a list of Exp. readTeXMath :: String -> Either String [Exp] toTeXMath :: DisplayType -> [Exp] -> String toOMML :: DisplayType -> [Exp] -> Element toMathML :: DisplayType -> [Exp] -> Element data DisplayType DisplayBlock :: DisplayType DisplayInline :: DisplayType