Text.TeXMath.Readers.TeX.Macros

texmath-0.9.4: Conversion between formats used to represent mathematics.

Safe Haskell | Safe
Language | Haskell2010

Text.TeXMath.Readers.TeX.Macros

Description

Functions for parsing LaTeX macro definitions and applying macros to LateX expressions.

Synopsis

- data Macro
- parseMacroDefinitions :: String -> ([Macro], String)
- pMacroDefinition :: (Monad m, Stream s m Char) => ParsecT s st m Macro
- applyMacros :: [Macro] -> String -> String

# Documentation

data Macro #

Instances

Show Macro # |
Methods showsPrec :: Int -> Macro -> ShowS # show :: Macro -> String # showList :: [Macro] -> ShowS #

parseMacroDefinitions :: String -> ([Macro], String) #

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.

pMacroDefinition :: (Monad m, Stream s m Char) => ParsecT s st m Macro #

Parses a `\newcommand` or `\renewcommand` macro definition and returns a `Macro`.

applyMacros :: [Macro] -> String -> 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.