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

Safe Haskell | None
Language | Haskell2010

Text.TeXMath.Types

Description

Types for representing a structured formula.

Synopsis

- data Exp
  - = ENumber String
  - | EGrouped [Exp]
  - | EDelimited String String [InEDelimited]
  - | EIdentifier String
  - | EMathOperator String
  - | ESymbol TeXSymbolType String
  - | ESpace Rational
  - | ESub Exp Exp
  - | ESuper Exp Exp
  - | ESubsup Exp Exp Exp
  - | EOver Bool Exp Exp
  - | EUnder Bool Exp Exp
  - | EUnderover Bool Exp Exp Exp
  - | EPhantom Exp
  - | EBoxed Exp
  - | EFraction FractionType Exp Exp
  - | ERoot Exp Exp
  - | ESqrt Exp
  - | EScaled Rational Exp
  - | EArray [Alignment] [ArrayLine]
  - | EText TextType String
  - | EStyled TextType [Exp]
- data TeXSymbolType
  - = Ord
  - | Op
  - | Bin
  - | Rel
  - | Open
  - | Close
  - | Pun
  - | Accent
  - | Fence
  - | TOver
  - | TUnder
  - | Alpha
  - | BotAccent
  - | Rad
- type ArrayLine = [[Exp]]
- data FractionType
  - = NormalFrac
  - | DisplayFrac
  - | InlineFrac
  - | NoLineFrac
- data TextType
  - = TextNormal
  - | TextBold
  - | TextItalic
  - | TextMonospace
  - | TextSansSerif
  - | TextDoubleStruck
  - | TextScript
  - | TextFraktur
  - | TextBoldItalic
  - | TextSansSerifBold
  - | TextSansSerifBoldItalic
  - | TextBoldScript
  - | TextBoldFraktur
  - | TextSansSerifItalic
- data Alignment
  - = AlignLeft
  - | AlignCenter
  - | AlignRight
  - | AlignDefault
- data DisplayType
  - = DisplayBlock
  - | DisplayInline
- data Operator = Operator {
  - oper :: String
  - description :: String
  - form :: FormType
  - priority :: Int
  - lspace :: Int
  - rspace :: Int
  - properties :: [Property]
  }
- data FormType
  - = FPrefix
  - | FPostfix
  - | FInfix
- data Record = Record {
  - uchar :: Char
  - commands :: [(String, String)]
  - category :: TeXSymbolType
  - comments :: String
  }
- type Property = String
- data Position
  - = Under
  - | Over
- type Env = [String]
- defaultEnv :: [String]
- type InEDelimited = Either Middle Exp

# Documentation

data Exp #

Constructors

ENumber String | A number (`<mn>` in MathML).
EGrouped [Exp] | A group of expressions that function as a unit (e.g. `{...}`) in TeX, `<mrow>...</mrow>` in MathML.
EDelimited String String [InEDelimited] | A group of expressions inside paired open and close delimiters (which may in some cases be null).
EIdentifier String | An identifier, e.g. a variable (`<mi>...</mi>` in MathML. Note that MathML tends to use `<mi>` tags for "sin" and other mathematical operators; these are represented as `EMathOperator` in TeXMath.
EMathOperator String | A spelled-out operator like `lim` or `sin`.
ESymbol TeXSymbolType String | A symbol.
ESpace Rational | A space, with the width specified in em.
ESub Exp Exp | An expression with a subscript. First argument is base, second subscript.
ESuper Exp Exp | An expresion with a superscript. First argument is base, second subscript.
ESubsup Exp Exp Exp | An expression with both a sub and a superscript. First argument is base, second subscript, third superscript.
EOver Bool Exp Exp | An expression with something over it. The first argument is True if the formula is "convertible:" that is, if the material over the formula should appear as a regular superscript in inline math. The second argument is the base, the third the expression that goes over it.
EUnder Bool Exp Exp | An expression with something under it. The arguments work as in `EOver`.
EUnderover Bool Exp Exp Exp | An expression with something over and something under it.
EPhantom Exp | A "phantom" operator that takes space but doesn't display.
EBoxed Exp | A boxed expression.
EFraction FractionType Exp Exp | A fraction. First argument is numerator, second denominator.
ERoot Exp Exp | An nth root. First argument is index, second is base.
ESqrt Exp | A square root.
EScaled Rational Exp | An expression that is scaled to some factor of its normal size.
EArray [Alignment] [ArrayLine] | An array or matrix. The first argument specifies the alignments of the columns; the second gives the contents of the lines. All of these lists should be the same length.
EText TextType String | Some normal text, possibly styled.
EStyled TextType [Exp] | A group of styled expressions.

Instances

Eq Exp # |
Methods (==) :: Exp -> Exp -> Bool # (/=) :: Exp -> Exp -> Bool #
Data Exp # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Exp -> c Exp # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Exp # toConstr :: Exp -> Constr # dataTypeOf :: Exp -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Exp) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Exp) # gmapT :: (forall b. Data b => b -> b) -> Exp -> Exp # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Exp -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Exp -> r # gmapQ :: (forall d. Data d => d -> u) -> Exp -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Exp -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Exp -> m Exp # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Exp -> m Exp # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Exp -> m Exp #
Ord Exp # |
Methods compare :: Exp -> Exp -> Ordering # (<) :: Exp -> Exp -> Bool # (<=) :: Exp -> Exp -> Bool # (>) :: Exp -> Exp -> Bool # (>=) :: Exp -> Exp -> Bool # max :: Exp -> Exp -> Exp # min :: Exp -> Exp -> Exp #
Read Exp # |
Methods readsPrec :: Int -> ReadS Exp # readList :: ReadS [Exp] # readPrec :: ReadPrec Exp # readListPrec :: ReadPrec [Exp] #
Show Exp # |
Methods showsPrec :: Int -> Exp -> ShowS # show :: Exp -> String # showList :: [Exp] -> ShowS #

data TeXSymbolType #

Constructors

Ord |
Op |
Bin |
Rel |
Open |
Close |
Pun |
Accent |
Fence |
TOver |
TUnder |
Alpha |
BotAccent |
Rad |

Instances

Eq TeXSymbolType # |
Methods (==) :: TeXSymbolType -> TeXSymbolType -> Bool # (/=) :: TeXSymbolType -> TeXSymbolType -> Bool #
Data TeXSymbolType # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TeXSymbolType -> c TeXSymbolType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TeXSymbolType # toConstr :: TeXSymbolType -> Constr # dataTypeOf :: TeXSymbolType -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c TeXSymbolType) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TeXSymbolType) # gmapT :: (forall b. Data b => b -> b) -> TeXSymbolType -> TeXSymbolType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TeXSymbolType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TeXSymbolType -> r # gmapQ :: (forall d. Data d => d -> u) -> TeXSymbolType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TeXSymbolType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TeXSymbolType -> m TeXSymbolType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TeXSymbolType -> m TeXSymbolType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TeXSymbolType -> m TeXSymbolType #
Ord TeXSymbolType # |
Methods compare :: TeXSymbolType -> TeXSymbolType -> Ordering # (<) :: TeXSymbolType -> TeXSymbolType -> Bool # (<=) :: TeXSymbolType -> TeXSymbolType -> Bool # (>) :: TeXSymbolType -> TeXSymbolType -> Bool # (>=) :: TeXSymbolType -> TeXSymbolType -> Bool # max :: TeXSymbolType -> TeXSymbolType -> TeXSymbolType # min :: TeXSymbolType -> TeXSymbolType -> TeXSymbolType #
Read TeXSymbolType # |
Methods readsPrec :: Int -> ReadS TeXSymbolType # readList :: ReadS [TeXSymbolType] # readPrec :: ReadPrec TeXSymbolType # readListPrec :: ReadPrec [TeXSymbolType] #
Show TeXSymbolType # |
Methods showsPrec :: Int -> TeXSymbolType -> ShowS # show :: TeXSymbolType -> String # showList :: [TeXSymbolType] -> ShowS #

type ArrayLine = [[Exp]] #

data FractionType #

Constructors

NormalFrac | Displayed or textual, acc to `DisplayType`
DisplayFrac | Force display mode
InlineFrac | Force inline mode (textual)
NoLineFrac | No line between top and bottom

Instances

Eq FractionType # |
Methods (==) :: FractionType -> FractionType -> Bool # (/=) :: FractionType -> FractionType -> Bool #
Data FractionType # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FractionType -> c FractionType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FractionType # toConstr :: FractionType -> Constr # dataTypeOf :: FractionType -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c FractionType) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FractionType) # gmapT :: (forall b. Data b => b -> b) -> FractionType -> FractionType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FractionType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FractionType -> r # gmapQ :: (forall d. Data d => d -> u) -> FractionType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> FractionType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FractionType -> m FractionType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FractionType -> m FractionType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FractionType -> m FractionType #
Ord FractionType # |
Methods compare :: FractionType -> FractionType -> Ordering # (<) :: FractionType -> FractionType -> Bool # (<=) :: FractionType -> FractionType -> Bool # (>) :: FractionType -> FractionType -> Bool # (>=) :: FractionType -> FractionType -> Bool # max :: FractionType -> FractionType -> FractionType # min :: FractionType -> FractionType -> FractionType #
Read FractionType # |
Methods readsPrec :: Int -> ReadS FractionType # readList :: ReadS [FractionType] # readPrec :: ReadPrec FractionType # readListPrec :: ReadPrec [FractionType] #
Show FractionType # |
Methods showsPrec :: Int -> FractionType -> ShowS # show :: FractionType -> String # showList :: [FractionType] -> ShowS #

data TextType #

Constructors

TextNormal |
TextBold |
TextItalic |
TextMonospace |
TextSansSerif |
TextDoubleStruck |
TextScript |
TextFraktur |
TextBoldItalic |
TextSansSerifBold |
TextSansSerifBoldItalic |
TextBoldScript |
TextBoldFraktur |
TextSansSerifItalic |

Instances

Eq TextType # |
Methods (==) :: TextType -> TextType -> Bool # (/=) :: TextType -> TextType -> Bool #
Data TextType # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TextType -> c TextType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TextType # toConstr :: TextType -> Constr # dataTypeOf :: TextType -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c TextType) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TextType) # gmapT :: (forall b. Data b => b -> b) -> TextType -> TextType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TextType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TextType -> r # gmapQ :: (forall d. Data d => d -> u) -> TextType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TextType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TextType -> m TextType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TextType -> m TextType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TextType -> m TextType #
Ord TextType # |
Methods compare :: TextType -> TextType -> Ordering # (<) :: TextType -> TextType -> Bool # (<=) :: TextType -> TextType -> Bool # (>) :: TextType -> TextType -> Bool # (>=) :: TextType -> TextType -> Bool # max :: TextType -> TextType -> TextType # min :: TextType -> TextType -> TextType #
Read TextType # |
Methods readsPrec :: Int -> ReadS TextType # readList :: ReadS [TextType] # readPrec :: ReadPrec TextType # readListPrec :: ReadPrec [TextType] #
Show TextType # |
Methods showsPrec :: Int -> TextType -> ShowS # show :: TextType -> String # showList :: [TextType] -> ShowS #

data Alignment #

Constructors

AlignLeft |
AlignCenter |
AlignRight |
AlignDefault |

Instances

Eq Alignment # |
Methods (==) :: Alignment -> Alignment -> Bool # (/=) :: Alignment -> Alignment -> Bool #
Data Alignment # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Alignment -> c Alignment # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Alignment # toConstr :: Alignment -> Constr # dataTypeOf :: Alignment -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c Alignment) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Alignment) # gmapT :: (forall b. Data b => b -> b) -> Alignment -> Alignment # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Alignment -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Alignment -> r # gmapQ :: (forall d. Data d => d -> u) -> Alignment -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Alignment -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Alignment -> m Alignment #
Ord Alignment # |
Methods compare :: Alignment -> Alignment -> Ordering # (<) :: Alignment -> Alignment -> Bool # (<=) :: Alignment -> Alignment -> Bool # (>) :: Alignment -> Alignment -> Bool # (>=) :: Alignment -> Alignment -> Bool # max :: Alignment -> Alignment -> Alignment # min :: Alignment -> Alignment -> Alignment #
Read Alignment # |
Methods readsPrec :: Int -> ReadS Alignment # readList :: ReadS [Alignment] # readPrec :: ReadPrec Alignment # readListPrec :: ReadPrec [Alignment] #
Show Alignment # |
Methods showsPrec :: Int -> Alignment -> ShowS # show :: Alignment -> String # showList :: [Alignment] -> ShowS #

data DisplayType #

Constructors

DisplayBlock | A displayed formula.
DisplayInline | A formula rendered inline in text.

Instances

Eq DisplayType # |
Methods (==) :: DisplayType -> DisplayType -> Bool # (/=) :: DisplayType -> DisplayType -> Bool #
Ord DisplayType # |
Methods compare :: DisplayType -> DisplayType -> Ordering # (<) :: DisplayType -> DisplayType -> Bool # (<=) :: DisplayType -> DisplayType -> Bool # (>) :: DisplayType -> DisplayType -> Bool # (>=) :: DisplayType -> DisplayType -> Bool # max :: DisplayType -> DisplayType -> DisplayType # min :: DisplayType -> DisplayType -> DisplayType #
Show DisplayType # |
Methods showsPrec :: Int -> DisplayType -> ShowS # show :: DisplayType -> String # showList :: [DisplayType] -> ShowS #

data Operator #

A record of the MathML dictionary as defined in the specification

Constructors

Operator |
Fields oper :: String Operator description :: String Plain English Description form :: FormType Whether Prefix, Postfix or Infix priority :: Int Default priority for implicit nesting lspace :: Int Default Left Spacing rspace :: Int Default Right Spacing properties :: [Property] List of MathML properties

Instances

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

data FormType #

Constructors

FPrefix |
FPostfix |
FInfix |

Instances

Eq FormType # |
Methods (==) :: FormType -> FormType -> Bool # (/=) :: FormType -> FormType -> Bool #
Ord FormType # |
Methods compare :: FormType -> FormType -> Ordering # (<) :: FormType -> FormType -> Bool # (<=) :: FormType -> FormType -> Bool # (>) :: FormType -> FormType -> Bool # (>=) :: FormType -> FormType -> Bool # max :: FormType -> FormType -> FormType # min :: FormType -> FormType -> FormType #
Show FormType # |
Methods showsPrec :: Int -> FormType -> ShowS # show :: FormType -> String # showList :: [FormType] -> ShowS #

data Record #

A record of the Unicode to LaTeX lookup table a full descripton can be seen <http://milde.users.sourceforge.net/LUCR/Math/data/unimathsymbols.txt here>

Constructors

Record |
Fields uchar :: Char Unicode Character commands :: [(String, String)] LaTeX commands (package, command) category :: TeXSymbolType TeX math category comments :: String Plain english description

Instances

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

type Property = String #

data Position #

Constructors

Under |
Over |

type Env = [String] #

List of available packages

defaultEnv :: [String] #

Contains `amsmath` and `amssymbol`

type InEDelimited = Either Middle Exp #

An `EDelimited` element contains a string of ordinary expressions (represented here as `Right` values) or fences (represented here as `Left`, and in LaTeX using `mid`).