texmath-0.13.1.2: Conversion between math formats.

Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.TeXMath.Readers.TeX.Macros

Description

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

Synopsis

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

# Documentation

data Macro Source #

#### Instances

Instances details

Show Macro Source # |
Instance details Defined in Text.TeXMath.Readers.TeX.Macros Methods showsPrec :: Int -> Macro -> ShowS Source # show :: Macro -> String Source # showList :: [Macro] -> ShowS Source #

parseMacroDefinitions :: Text -> ([Macro], Text) Source #

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 :: forall (m :: Type -> Type) s st. (Monad m, Stream s m Char) => ParsecT s st m Macro Source #

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

applyMacros :: [Macro] -> Text -> Text Source #

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.