Text.TeXMath.Types

texmath-0.8.5: 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 |
Data Exp |
Read Exp |
Show Exp |

data TeXSymbolType

Constructors

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

Instances

Eq TeXSymbolType |
Data TeXSymbolType |
Read TeXSymbolType |
Show TeXSymbolType |

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 |
Data FractionType |
Read FractionType |
Show FractionType |

data TextType

Constructors

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

Instances

Eq TextType |
Data TextType |
Ord TextType |
Read TextType |
Show TextType |

data Alignment

Constructors

AlignLeft |
AlignCenter |
AlignRight |
AlignDefault |

Instances

Eq Alignment |
Data Alignment |
Read Alignment |
Show Alignment |

data DisplayType

Constructors

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

Instances

Eq DisplayType |
Show DisplayType |

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 |

data FormType

Constructors

FPrefix |
FPostfix |
FInfix |

Instances

Eq FormType |
Ord FormType |
Show FormType |

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 |

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`).