Text.TeXMath.Types

texmath-0.12.10.3: Conversion between math formats.

Safe Haskell | None
Language | Haskell2010

Text.TeXMath.Types

Description

Types for representing a structured formula.

Synopsis

- data Exp
  - = ENumber Text
  - | EGrouped [Exp]
  - | EDelimited Text Text [InEDelimited]
  - | EIdentifier Text
  - | EMathOperator Text
  - | ESymbol TeXSymbolType Text
  - | 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 Text
  - | 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
- data DisplayType
  - = DisplayBlock
  - | DisplayInline
- data Operator = Operator {
  - oper :: Text
  - description :: Text
  - form :: FormType
  - priority :: Int
  - lspace :: Int
  - rspace :: Int
  - properties :: [Property]
  }
- data FormType
  - = FPrefix
  - | FPostfix
  - | FInfix
- data Record = Record {
  - uchar :: Char
  - commands :: [(Text, Text)]
  - category :: TeXSymbolType
  - comments :: Text
  }
- type Property = Text
- data Position
  - = Under
  - | Over
- type Env = [Text]
- defaultEnv :: [Text]
- type InEDelimited = Either Middle Exp

# Documentation

data Exp #

Constructors

ENumber Text | 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 Text Text [InEDelimited] | A group of expressions inside paired open and close delimiters (which may in some cases be null).
EIdentifier Text | 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 Text | A spelled-out operator like `lim` or `sin`.
ESymbol TeXSymbolType Text | 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 Text | Some normal text, possibly styled.
EStyled TextType [Exp] | A group of styled expressions.

#### Instances

Instances details

Data Exp # |
Instance details Defined in Text.TeXMath.Types 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 :: forall r r'. (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 #
Read Exp # |
Instance details Defined in Text.TeXMath.Types Methods readsPrec :: Int -> ReadS Exp # readList :: ReadS [Exp] # readPrec :: ReadPrec Exp # readListPrec :: ReadPrec [Exp] #
Show Exp # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> Exp -> ShowS # show :: Exp -> String # showList :: [Exp] -> ShowS #
Eq Exp # |
Instance details Defined in Text.TeXMath.Types Methods (==) :: Exp -> Exp -> Bool # (/=) :: Exp -> Exp -> Bool #
Ord Exp # |
Instance details Defined in Text.TeXMath.Types 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 #

data TeXSymbolType #

Constructors

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

#### Instances

Instances details

Data TeXSymbolType # |
Instance details Defined in Text.TeXMath.Types 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 :: forall r r'. (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 #
Read TeXSymbolType # |
Instance details Defined in Text.TeXMath.Types Methods readsPrec :: Int -> ReadS TeXSymbolType # readList :: ReadS [TeXSymbolType] # readPrec :: ReadPrec TeXSymbolType # readListPrec :: ReadPrec [TeXSymbolType] #
Show TeXSymbolType # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> TeXSymbolType -> ShowS # show :: TeXSymbolType -> String # showList :: [TeXSymbolType] -> ShowS #
Eq TeXSymbolType # |
Instance details Defined in Text.TeXMath.Types Methods (==) :: TeXSymbolType -> TeXSymbolType -> Bool # (/=) :: TeXSymbolType -> TeXSymbolType -> Bool #
Ord TeXSymbolType # |
Instance details Defined in Text.TeXMath.Types 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 #

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

Instances details

Data FractionType # |
Instance details Defined in Text.TeXMath.Types 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 :: forall r r'. (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 #
Read FractionType # |
Instance details Defined in Text.TeXMath.Types Methods readsPrec :: Int -> ReadS FractionType # readList :: ReadS [FractionType] # readPrec :: ReadPrec FractionType # readListPrec :: ReadPrec [FractionType] #
Show FractionType # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> FractionType -> ShowS # show :: FractionType -> String # showList :: [FractionType] -> ShowS #
Eq FractionType # |
Instance details Defined in Text.TeXMath.Types Methods (==) :: FractionType -> FractionType -> Bool # (/=) :: FractionType -> FractionType -> Bool #
Ord FractionType # |
Instance details Defined in Text.TeXMath.Types 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 #

data TextType #

Constructors

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

#### Instances

Instances details

Data TextType # |
Instance details Defined in Text.TeXMath.Types 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 :: forall r r'. (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 #
Read TextType # |
Instance details Defined in Text.TeXMath.Types Methods readsPrec :: Int -> ReadS TextType # readList :: ReadS [TextType] # readPrec :: ReadPrec TextType # readListPrec :: ReadPrec [TextType] #
Show TextType # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> TextType -> ShowS # show :: TextType -> String # showList :: [TextType] -> ShowS #
Eq TextType # |
Instance details Defined in Text.TeXMath.Types Methods (==) :: TextType -> TextType -> Bool # (/=) :: TextType -> TextType -> Bool #
Ord TextType # |
Instance details Defined in Text.TeXMath.Types 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 #

data Alignment #

Constructors

AlignLeft |
AlignCenter |
AlignRight |

#### Instances

Instances details

Data Alignment # |
Instance details Defined in Text.TeXMath.Types 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 :: forall r r'. (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 #
Read Alignment # |
Instance details Defined in Text.TeXMath.Types Methods readsPrec :: Int -> ReadS Alignment # readList :: ReadS [Alignment] # readPrec :: ReadPrec Alignment # readListPrec :: ReadPrec [Alignment] #
Show Alignment # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> Alignment -> ShowS # show :: Alignment -> String # showList :: [Alignment] -> ShowS #
Eq Alignment # |
Instance details Defined in Text.TeXMath.Types Methods (==) :: Alignment -> Alignment -> Bool # (/=) :: Alignment -> Alignment -> Bool #
Ord Alignment # |
Instance details Defined in Text.TeXMath.Types 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 #

data DisplayType #

Constructors

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

#### Instances

Instances details

Show DisplayType # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> DisplayType -> ShowS # show :: DisplayType -> String # showList :: [DisplayType] -> ShowS #
Eq DisplayType # |
Instance details Defined in Text.TeXMath.Types Methods (==) :: DisplayType -> DisplayType -> Bool # (/=) :: DisplayType -> DisplayType -> Bool #
Ord DisplayType # |
Instance details Defined in Text.TeXMath.Types 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 #

data Operator #

A record of the MathML dictionary as defined in the specification

Constructors

Operator |
Fields oper :: Text Operator description :: Text 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

Instances details

Show Operator # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> Operator -> ShowS # show :: Operator -> String # showList :: [Operator] -> ShowS #

data FormType #

Constructors

FPrefix |
FPostfix |
FInfix |

#### Instances

Instances details

Show FormType # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> FormType -> ShowS # show :: FormType -> String # showList :: [FormType] -> ShowS #
Eq FormType # |
Instance details Defined in Text.TeXMath.Types Methods (==) :: FormType -> FormType -> Bool # (/=) :: FormType -> FormType -> Bool #
Ord FormType # |
Instance details Defined in Text.TeXMath.Types 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 #

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 :: [(Text, Text)] LaTeX commands (package, command) category :: TeXSymbolType TeX math category comments :: Text Plain english description

#### Instances

Instances details

Show Record # |
Instance details Defined in Text.TeXMath.Types Methods showsPrec :: Int -> Record -> ShowS # show :: Record -> String # showList :: [Record] -> ShowS #

type Property = Text #

data Position #

Constructors

Under |
Over |

type Env = [Text] #

List of available packages

defaultEnv :: [Text] #

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