### Install texmath with Stack
Source: https://hackage.haskell.org/package/texmath-0.8.6
Use stack to set up the environment and install the executable.
```bash
stack setup
stack install --flag texmath:executable
```
--------------------------------
### Install texmath Server with Stack
Source: https://hackage.haskell.org/package/texmath-0.13.1
Install the texmath web server using Stack by setting the `server` cabal flag.
```bash
stack install --flag texmath:server
```
--------------------------------
### Install texmath with CGI binary
Source: https://hackage.haskell.org/package/texmath-0.6.7
Install the Haskell library with the cgi flag to produce a CGI binary, texmath-cgi.
```bash
cabal install -fcgi
```
--------------------------------
### Install texmath with executable
Source: https://hackage.haskell.org/package/texmath-0.6.7
Install the Haskell library with the executable flag to include a test program.
```bash
cabal install -fexecutable
```
--------------------------------
### Install texmath Executable with Cabal
Source: https://hackage.haskell.org/package/texmath-0.13.1
Install the texmath executable using Cabal. The executable will be installed in `~/.cabal/bin` by default.
```bash
cabal install -fexecutable
```
--------------------------------
### Install texmath server via Stack
Source: https://hackage.haskell.org/package/texmath
Build the texmath server component using stack.
```bash
stack install --flag texmath:server
```
--------------------------------
### Install texmath executable
Source: https://hackage.haskell.org/package/texmath-0.12.9
Commands to install the texmath test program using Cabal or Stack.
```bash
cabal install -fexecutable
```
```bash
stack setup
stack install --flag texmath:executable
```
--------------------------------
### Install texmath Executable with Stack
Source: https://hackage.haskell.org/package/texmath-0.13.1
Install the texmath executable using Stack. Ensure the stack binary is in your path. The texmath binary will be placed in `~/.local/bin`.
```bash
stack setup
stack install --flag texmath:executable
```
--------------------------------
### Run texmath Server
Source: https://hackage.haskell.org/package/texmath-0.13.1
Run the texmath server on a specified port. This example runs the server on port 3000.
```bash
texmath-server -p 3000
```
--------------------------------
### Convert math via HTTP API
Source: https://hackage.haskell.org/package/texmath-0.12.9
Example request and response using httpie to convert TeX to MathML.
```http
% http --verbose localhost:3000/convert text='2^2' from=tex to=mathml display:=false Accept:'text/plain'
POST /convert HTTP/1.1
Accept: text/plain
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 64
Content-Type: application/json
Host: localhost:3000
User-Agent: HTTPie/3.1.0
{
"display": false,
"from": "tex",
"text": "2^2",
"to": "mathml"
}
HTTP/1.1 200 OK
Content-Type: text/plain;charset=utf-8
Date: Mon, 21 Mar 2022 18:29:26 GMT
Server: Warp/3.3.17
Transfer-Encoding: chunked
```
--------------------------------
### Convert TeX to MathML using httpie
Source: https://hackage.haskell.org/package/texmath-0.13.1
Example of using httpie to send a POST request to the texmath server for conversion. This specific request converts '2^2' from TeX to MathML.
```http
% http --verbose localhost:3000 text='2^2' from=tex to=mathml display:=false Accept:'text/plain'
```
```json
{
"display": false,
"from": "tex",
"text": "2^2",
"to": "mathml"
}
```
```http
HTTP/1.1 200 OK
Content-Type: text/plain;charset=utf-8
Date: Mon, 21 Mar 2022 18:29:26 GMT
Server: Warp/3.3.17
Transfer-Encoding: chunked
```
--------------------------------
### Deprecated split usage in Test.QuickCheck.Test
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/reports/1
Example of a deprecated call to split within the Test module.
```haskell
(rnd1,rnd2) = split (randomSeed st)
```
--------------------------------
### Deprecated split usage in Test.QuickCheck.Random
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/reports/1
Examples of deprecated split usage for left and right random generation.
```haskell
left = fst . split
```
```haskell
right = snd . split
```
--------------------------------
### Deprecated split usage in Test.QuickCheck.Gen
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/reports/1
Example of a deprecated split call within a case expression in the Gen module.
```haskell
case split r of
```
--------------------------------
### Convert TeX to MathML with AST Manipulation
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath.html
Converts TeX to MathML after modifying the Abstract Syntax Tree (AST), for example, to replace identifiers. Requires additional imports for Data.Generics and Text.TeXMath.Types.
```Haskell
{-# LANGUAGE OverloadedStrings -#}
import Control.Applicative ((<$>))
import Data.Text (Text)
import Data.Generics (everywhere, mkT)
import Text.TeXMath (writeMathML, readTeX)
import Text.TeXMath.Types
import Text.XML.Light (Element)
changeIdent :: Exp -> Exp
changeIdent (EIdentifier "x") = EIdentifier "y"
changeIdent e = e
texToMMLWithChangeIdent :: DisplayType -> Text -> Either Text Element
texToMMLWithChangeIdent dt s =
writeMathML dt . everywhere (mkT changeIdent) <$> readTeX s
```
--------------------------------
### Run texmath server
Source: https://hackage.haskell.org/package/texmath-0.12.9
Commands to build and execute the texmath web server.
```bash
stack install --flag texmath:server
```
```bash
texmath-server -p 3000
```
--------------------------------
### Run texmath test suite
Source: https://hackage.haskell.org/package/texmath-0.6.7
Navigate to the tests directory and execute the runtests.sh script to run the test suite for the texmath library.
```bash
cd tests
sh runtests.sh
```
--------------------------------
### Type Aliases and Constants
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Types.html
Common type aliases and default environment configurations.
```APIDOC
## Type Aliases and Constants
### Property
- **Property** (Text) - Alias for Text
### Env
- **Env** ([Text]) - List of available packages
### defaultEnv
- **defaultEnv** ([Text]) - Contains `amsmath` and `amssymbol`
### InEDelimited
- **InEDelimited** (Either Middle Exp) - An `EDelimited` element containing ordinary expressions or fences.
```
--------------------------------
### TeX Instances
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-TeX.html
Details the instances for the TeX data type, including Show and Eq.
```APIDOC
## Instances for TeX
### Show TeX
* **Methods**: `showPrec :: Int -> TeX -> ShowS`, `show :: TeX -> String`, `showList :: [TeX] -> ShowS`
### Eq TeX
* **Methods**: `(==) :: TeX -> TeX -> Bool`, `(/=) :: TeX -> TeX -> Bool`
```
--------------------------------
### Convert math via HTTPie
Source: https://hackage.haskell.org/package/texmath
Perform a POST request to the texmath server to convert TeX to MathML.
```bash
% http --verbose localhost:3000 text='2^2' from=tex to=mathml display:=false Accept:'text/plain'
POST /convert HTTP/1.1
Accept: text/plain
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 64
Content-Type: application/json
Host: localhost:3000
User-Agent: HTTPie/3.1.0
{
"display": false,
"from": "tex",
"text": "2^2",
"to": "mathml"
}
HTTP/1.1 200 OK
Content-Type: text/plain;charset=utf-8
Date: Mon, 21 Mar 2022 18:29:26 GMT
Server: Warp/3.3.17
Transfer-Encoding: chunked
```
--------------------------------
### Convert TeX to MathML
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath.html
Combines reading TeX input and writing it as MathML. Requires importing Control.Applicative, Data.Text, and Text.TeXMath.
```Haskell
import Control.Applicative ((<$>))
import Data.Text (Text)
import Text.TeXMath (writeMathML, readTeX)
texMathToMathML :: DisplayType -> Text -> Either Text Element
texMathToMathML dt s = writeMathML dt <$> readTeX s
```
--------------------------------
### Clone texmath source repository
Source: https://hackage.haskell.org/package/texmath-0.9
Command to clone the texmath source code from the git repository.
```bash
git clone git://github.com/jgm/texmath.git
```
--------------------------------
### POST /batch
Source: https://hackage.haskell.org/package/texmath
Converts a list of mathematical expressions in a single request.
```APIDOC
## POST /batch
### Description
Accepts a JSON-encoded list of conversion requests and returns a JSON-encoded list of results.
### Method
POST
### Endpoint
/batch
### Request Body
- **list** (array) - Required - A list of objects containing 'text', 'from', 'to', and optional 'display' fields.
```
--------------------------------
### Package Search Functionality
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath.html
Information on how to use the search functionality provided by the package to find exported types, constructors, classes, functions, or patterns by name.
```APIDOC
## Package Search
### Description
This section describes the search functionality available within the package, allowing users to quickly find exported entities by name.
### Usage
You can find any exported type, constructor, class, function, or pattern defined in this package by (approximate) name.
### Shortcuts
| Key | Action |
|------------|----------------------------|
| `s` | Open this search box |
| `esc` | Close this search box |
| `↓`, `ctrl + j` | Move down in search results |
| `↑`, `ctrl + k` | Move up in search results |
| `↵` | Go to active search result |
```
--------------------------------
### POST /convert
Source: https://hackage.haskell.org/package/texmath
Converts a single mathematical expression from one format to another.
```APIDOC
## POST /convert
### Description
Converts a mathematical expression from a source format to a target format.
### Method
POST
### Endpoint
/convert
### Request Body
- **text** (string) - Required - The mathematical expression to convert.
- **from** (string) - Required - The source format (tex, mathml, omml).
- **to** (string) - Required - The target format (tex, mathml, omml, eqn, typst, pandoc).
- **display** (boolean) - Optional - Whether to use display mode (true/false).
### Request Example
{
"display": false,
"from": "tex",
"text": "2^2",
"to": "mathml"
}
### Response
#### Success Response (200)
- **body** (string) - The converted mathematical expression in the requested format.
```
--------------------------------
### Generate Unicode to TeX Table
Source: https://hackage.haskell.org/package/texmath-0.13.1
Steps to regenerate the Unicode to TeX conversion table using `runghc`. Requires `unimathsymbols.txt`.
```bash
runghc unicodetotex.hs
```
--------------------------------
### Generate MathML Dictionary
Source: https://hackage.haskell.org/package/texmath-0.13.1
Steps to regenerate the MathML operator dictionary using `xsltproc` and `runghc`. Requires `unicode.xml` and `operatorDictionary.xsl`.
```bash
xsltproc -o dictionary.xml operatorDictionary.xsl unicode.xml
runghc generateMMLDict.hs
```
--------------------------------
### Text.TeXMath.Shared Utility Functions
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Shared.html
A collection of functions for handling mathematical format conversions, scaling, and expression tree manipulation.
```APIDOC
## Text.TeXMath.Shared Functions
### Description
Functions for mapping between MathML and LaTeX, handling scaling factors, and manipulating expression trees.
### Functions
- **getMMLType** (TextType -> Text) - Maps TextType to the corresponding MathML mathvariant.
- **getTextType** (Text -> TextType) - Maps MathML mathvariant to the corresponding TextType.
- **getLaTeXTextCommand** (Env -> TextType -> Text) - Maps TextType to corresponding LaTeX command.
- **getScalerCommand** (Rational -> Maybe Text) - Maps a LaTeX scaling command to the percentage scaling.
- **getScalerValue** (Text -> Maybe Rational) - Gets percentage scaling from LaTeX scaling command.
- **getSpaceWidth** (Char -> Maybe Rational) - Returns the space width for a unicode space character, or Nothing.
- **getSpaceChars** (Rational -> Text) - Returns the sequence of unicode space characters closest to the specified width.
- **getDiacriticalCommand** (Position -> Text -> Maybe Text) - Given a diacritical mark, returns the corresponding LaTeX command.
- **fixTree** (Exp -> Exp) - Walks over a tree of expressions, removing empty expressions, and fixing delimited expressions.
- **isEmpty** (Exp -> Bool) - Test to see whether an expression is empty.
```
--------------------------------
### Data.Vector.Unboxed.Mutable Warnings
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/reports/1
Lists warnings related to missing link destinations for mutable unboxed vectors in Data.Vector.Unboxed.Mutable.
```APIDOC
## Data.Vector.Unboxed.Mutable Warnings
### Description
This section details warnings encountered during the processing of `Data.Vector.Unboxed.Mutable`, specifically regarding the inability to find link destinations for certain `PrimState` related types.
### Endpoints
No API endpoints are defined here. This section lists types for which link destinations could not be resolved:
- `Control.Monad.Primitive.D:R:PrimStateAccumT`
- `Control.Monad.Primitive.D:R:PrimStateContT`
- `Control.Monad.Primitive.D:R:PrimStateExceptT`
- `Control.Monad.Primitive.D:R:PrimStateIO`
- `Control.Monad.Primitive.D:R:PrimStateIdentityT`
- `Control.Monad.Primitive.D:R:PrimStateMaybeT
### Response
This section describes warnings and missing links, not API responses.
```
--------------------------------
### Text.TeXMath.Writers.Eqn - writeEqn
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Writers-Eqn.html
The `writeEqn` function in `Text.TeXMath.Writers.Eqn` transforms an expression tree into its equivalent Eqn representation.
```APIDOC
## writeEqn
### Description
Transforms an expression tree to equivalent Eqn.
### Method
N/A (Haskell function)
### Endpoint
N/A (Haskell function)
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
N/A
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### Generate Unicode Table
Source: https://hackage.haskell.org/package/texmath-0.13.1
Steps to regenerate the Unicode table using `runghc`. Requires `UnicodeData.txt`.
```bash
runghc mkUnicodeTable.hs
```
--------------------------------
### MathML Parsing
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Readers-MathML.html
This section details the `readMathML` function, which parses MathML content into a list of `Exp` objects. It conforms to the MathML3 specification, with noted unimplemented features and areas for improvement.
```APIDOC
## Text.TeXMath.Readers.MathML
### Description
Parses MathML in conformance with the MathML3 specification. Unimplemented features include mpadded, malignmark, maligngroup, and Elementary Math. Areas for improvement include handling of menclose and mstyle.
### Synopsis
`readMathML :: Text -> Either Text [Exp]`
### Function Documentation
#### `readMathML`
* **Description**: Parse a MathML expression to a list of `Exp`.
* **Type Signature**: `Text -> Either Text [Exp]`
### Request Example
```json
{
"mathml_content": ""
}
```
### Response
#### Success Response (200)
* **`[Exp]`** (Array of Exp) - A list of parsed expressions.
#### Response Example
```json
{
"parsed_expressions": [
{
"type": "Identifier",
"value": "x"
}
]
}
```
```
--------------------------------
### Exp Data Type Instances
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath.html
Details the various type class instances available for the Exp data type, such as Data, Read, Show, Eq, and Ord. This allows for advanced data manipulation, serialization, and comparison.
```APIDOC
## Exp Data Type Instances
### Description
This section details the type class instances for the `Exp` data type, providing functionalities for data manipulation, reading, writing, equality comparison, and ordering.
### Instances
#### Data Instance
Provides generic programming capabilities for the `Exp` type.
- **Methods:** `gfoldl`, `gunfold`, `toConstr`, `dataTypeOf`, `dataCast1`, `dataCast2`, `gmapT`, `gmapQl`, `gmapQr`, `gmapQ`, `gmapQi`, `gmapM`, `gmapMp`, `gmapMo`
#### Read Instance
Enables parsing `Exp` values from strings.
- **Methods:** `readsPrec`, `readList`, `readPrec`, `readListPrec`
#### Show Instance
Enables converting `Exp` values to strings.
- **Methods:** `showsPrec`, `show`, `showList`
#### Eq Instance
Allows for equality comparison between `Exp` values.
- **Methods:** `(==)`, `(/=)`
#### Ord Instance
Enables ordering comparison between `Exp` values.
- **Methods:** `compare`, `(<)`, `(<=)`, `(>)`, `(>=)`, `max`, `min`
```
--------------------------------
### Regenerate ToTeXMath.hs
Source: https://hackage.haskell.org/package/texmath-0.8.6
Command to update the Unicode to TeX mapping table.
```bash
runghc unicodetotex.hs
```
--------------------------------
### TeX Rendering and Utility Functions
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-TeX.html
Provides functions for rendering TeX to text, checking for control sequences, and escaping LaTeX characters.
```APIDOC
## Functions
### renderTeX
* **Description**: Render a `TeX` to a string, appending to the front of the given string.
* **Type**: `TeX -> Text -> Text`
### isControlSeq
* **Description**: Checks if a given Text is a TeX control sequence.
* **Type**: `Text -> Bool`
### escapeLaTeX
* **Description**: Escapes a character to be represented as a TeX construct.
* **Type**: `Char -> TeX`
```
--------------------------------
### OMML to TeXMath Conversion
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Readers-OMML.html
Provides functions for converting OMML (Open Math Markup Language) into TeXMath Exp (expressions).
```APIDOC
## readOMML
### Description
Converts OMML text into TeXMath `Exp`s.
### Method
Source (Haskell function signature)
### Endpoint
N/A (This is a library function)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```haskell
-- Example usage would depend on the surrounding Haskell code.
-- Assuming 'Text' is imported from Data.Text
-- let ommlString = ""
-- let result = readOMML ommlString
```
### Response
#### Success Response
- **Either Text [Exp]** - Either an error message (Text) or a list of TeXMath expressions ([Exp]).
#### Response Example
```haskell
-- Success case:
-- Right [Exp1, Exp2, ...]
-- Error case:
-- Left "Error message describing the parsing failure"
```
```
--------------------------------
### Regenerate ToUnicode.hs
Source: https://hackage.haskell.org/package/texmath-0.8.6
Command to update the Unicode mapping table.
```bash
runghc mkUnicodeTable.hs
```
--------------------------------
### Regenerate MMLDict.hs
Source: https://hackage.haskell.org/package/texmath-0.8.6
Commands to update the MathML operator dictionary using xsltproc and runghc.
```bash
xsltproc -o dictionary.xml operatorDictionary.xsl unicode.xml
runghc generateMMLDict.hs
```
--------------------------------
### Access Operator Table
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Readers-MathML-MMLDict.html
Provides the complete list of operators defined by the MathML dictionary.
```haskell
operators :: [Operator]
```
--------------------------------
### operators
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Readers-MathML-MMLDict.html
Access the full table of MathML operators.
```APIDOC
## operators
### Description
A table of all operators as defined by the MathML operator dictionary.
### Response
- **[Operator]** - A list containing all defined operators.
```
--------------------------------
### Incomplete Pattern Match for List Dispatch
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/reports/1
This warning indicates a non-exhaustive pattern match for a list of 'Q Exp' in 'Data.Aeson.TH'. The pattern 'x:xs' does not account for an empty list.
```haskell
let x:xs = [ dispatchParseJSON jc conName tvMap argTy
```
--------------------------------
### Deprecated Solo Constructor Usage in ToJSON
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/reports/1
This warning indicates the use of the deprecated 'Solo' data constructor, which has been renamed to 'MkSolo' to prevent punning. Ensure to update usages to 'MkSolo'.
```haskell
liftToJSON _ t _ (Solo a) = t a
```
```haskell
liftToEncoding _ t _ (Solo a) = t a
```
--------------------------------
### DisplayType Data Type
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Types.html
Details about the DisplayType data type and its instances.
```APIDOC
## Data Type: DisplayType
### Description
Specifies whether a formula is displayed as a block or inline.
### Constructors
- DisplayBlock: A displayed formula.
- DisplayInline: A formula rendered inline in text.
### Instances
#### Show DisplayType
##### Methods
- showsPrec :: Int -> DisplayType -> ShowS
- show :: DisplayType -> String
- showList :: [DisplayType] -> ShowS
#### 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
```
--------------------------------
### Text.TeXMath.Unicode Module
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Unicode-ToTeX.html
This module provides functions for converting Unicode characters to TeX commands, based on mappings compiled by Günter Milde.
```APIDOC
## Text.TeXMath.Unicode Module
### Description
This module is derived from the list of unicode to LaTeX mappings compiled by Günter Milde.
### Synopsis
- getTeXMath :: Text -> Env -> [TeX]
- getSymbolType :: Char -> TeXSymbolType
- symbolMap :: Map Text Exp
- records :: [Record]
## getTeXMath
### Description
Converts a string of unicode characters into a string of equivalent TeXMath commands. An environment is a list of strings specifying which additional packages are available.
### Method
(Not specified, likely a function call within Haskell)
### Endpoint
(Not applicable, this is a Haskell module function)
### Parameters
#### Path Parameters
(Not applicable)
#### Query Parameters
(Not applicable)
#### Request Body
(Not applicable)
### Request Example
(Not applicable)
### Response
#### Success Response (200)
(Not applicable, this is a Haskell function)
#### Response Example
(Not applicable)
## getSymbolType
### Description
Returns TeX symbol type corresponding to a unicode character.
### Method
(Not specified, likely a function call within Haskell)
### Endpoint
(Not applicable, this is a Haskell module function)
### Parameters
#### Path Parameters
(Not applicable)
#### Query Parameters
(Not applicable)
#### Request Body
(Not applicable)
### Request Example
(Not applicable)
### Response
#### Success Response (200)
(Not applicable, this is a Haskell function)
#### Response Example
(Not applicable)
## symbolMap
### Description
Mapping from TeX commands to Exp.
### Method
(Not specified, likely a function call within Haskell)
### Endpoint
(Not applicable, this is a Haskell module function)
### Parameters
#### Path Parameters
(Not applicable)
#### Query Parameters
(Not applicable)
#### Request Body
(Not applicable)
### Request Example
(Not applicable)
### Response
#### Success Response (200)
(Not applicable, this is a Haskell function)
#### Response Example
(Not applicable)
## records
### Description
(No specific description provided for this field beyond its type)
### Method
(Not specified, likely a function call within Haskell)
### Endpoint
(Not applicable, this is a Haskell module function)
### Parameters
#### Path Parameters
(Not applicable)
#### Query Parameters
(Not applicable)
#### Request Body
(Not applicable)
### Request Example
(Not applicable)
### Response
#### Success Response (200)
(Not applicable, this is a Haskell function)
#### Response Example
(Not applicable)
```
--------------------------------
### Parse MathML to Exp
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Readers-MathML.html
Parses a MathML string into a list of Exp objects. Returns an Either type indicating success or failure.
```haskell
readMathML :: Text -> Either Text [Exp]
```
--------------------------------
### Text.TeXMath.Unicode.Fonts Module
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Unicode-Fonts.html
Utilities to convert between MS font codepoints and unicode characters.
```APIDOC
## Text.TeXMath.Unicode.Fonts
### Description
Utilities to convert between MS font codepoints and unicode characters.
### Synopsis
* `getUnicode :: Font -> Char -> Maybe Char`
* `data Font = Symbol`
* `textToFont :: Text -> Maybe Font`
## getUnicode
### Description
Given a font and codepoint, returns the corresponding unicode character.
### Type Signature
`getUnicode :: Font -> Char -> Maybe Char`
## data Font
### Description
Enumeration of recognised fonts.
### Constructors
* `Symbol` - Adobe Symbol
### Instances
* `Show Font`
* `Eq Font`
## textToFont
### Description
Parse font name into Font if possible.
### Type Signature
`textToFont :: Text -> Maybe Font`
```
--------------------------------
### Data.Vector.Unboxed.Base Types
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/reports/1
Lists the available unboxed vector types and their associated mutable counterparts within the Data.Vector.Unboxed.Base module.
```APIDOC
## Data.Vector.Unboxed.Base Types
### Description
This section lists the various unboxed vector types and their mutable counterparts provided by the `Data.Vector.Unboxed.Base` module.
### Endpoints
This module primarily defines data types rather than API endpoints. The following are notable types:
#### Unboxed Vector Types
- `V_Identity`
- `V_Complex`
- `V_Bool`
- `V_Char`
- `V_Double`
- `V_Float`
- `V_Word64`
- `V_Word32`
- `V_Word16`
- `V_Word8`
- `V_Word`
- `V_Int64`
- `V_Int32`
- `V_Int16`
- `V_Int8`
- `V_Int`
- `V_Unit
#### Mutable Unboxed Vector Types
- `D:R:MVectorsTuple60`
- `D:R:MVectorsTuple50`
- `D:R:MVectorsTuple40`
- `D:R:MVectorsTuple30`
- `D:R:MVectorsTuple20`
- `D:R:MVectorsCompose0`
- `D:R:MVectorsAlt0`
- `D:R:MVectorsConst0`
- `D:R:MVectorsAll0`
- `D:R:MVectorsAny0`
- `D:R:MVectorsArg0`
- `D:R:MVectorsWrappedMonoid0`
- `D:R:MVectorsLast0`
- `D:R:MVectorsFirst0`
- `D:R:MVectorsMax0`
- `D:R:MVectorsMin0`
- `D:R:MVectorsProduct0`
- `D:R:MVectorsSum0`
- `D:R:MVectorsDual0`
- `D:R:MVectorsDown0`
- `D:R:MVectorsIdentity0`
- `D:R:MVectorsComplex0`
- `D:R:MVectorsBool0`
- `D:R:MVectorsChar0`
- `D:R:MVectorsDouble0`
- `D:R:MVectorsFloat0`
- `D:R:MVectorsWord640`
- `D:R:MVectorsWord320`
- `D:R:MVectorsWord160`
- `D:R:MVectorsWord80`
- `D:R:MVectorsWord0`
- `D:R:MVectorsInt640`
- `D:R:MVectorsInt320`
- `D:R:MVectorsInt160`
- `D:R:MVectorsInt80`
- `D:R:MVectorsInt0`
- `D:R:MVectorsUnit0
#### Vector Tuple Types
- `D:R:VectorTuple60`
- `D:R:VectorTuple50`
- `D:R:VectorTuple40`
- `D:R:VectorTuple30`
- `D:R:VectorTuple20
#### Other Vector Types
- `D:R:VectorCompose0`
- `D:R:VectorAlt0`
- `D:R:VectorConst0`
- `D:R:VectorAll0`
- `D:R:VectorAny0`
- `D:R:VectorArg0`
- `D:R:VectorWrappedMonoid0`
- `D:R:VectorLast0`
- `D:R:VectorFirst0`
- `D:R:VectorMax0`
- `D:R:VectorMin0`
- `D:R:VectorProduct0`
- `D:R:VectorSum0`
- `D:R:VectorDual0`
- `D:R:VectorDown0`
- `D:R:VectorIdentity0`
- `D:R:VectorComplex0`
- `D:R:VectorBool0`
- `D:R:VectorChar0`
- `D:R:VectorDouble0`
- `D:R:VectorFloat0`
- `D:R:VectorWord640`
- `D:R:VectorWord320`
- `D:R:VectorWord160`
- `D:R:VectorWord80`
- `D:R:VectorWord0`
- `D:R:VectorInt640`
- `D:R:VectorInt320`
- `D:R:VectorInt160`
- `D:R:VectorInt80`
- `D:R:VectorInt0`
- `D:R:VectorUnit0
#### Special Vector Types
- `D:R:VectorUnboxViaPrim0`
- `D:R:MVectorsUnboxViaPrim0`
- `D:R:VectorAs0`
- `D:R:MVectorsAs0`
- `D:R:VectorDoNotUnboxLazy0`
- `D:R:MVectorsDoNotUnboxLazy0`
- `D:R:VectorDoNotUnboxStrict0`
- `D:R:MVectorsDoNotUnboxStrict0`
- `D:R:VectorDoNotUnboxNormalForm0`
- `D:R:MVectorsDoNotUnboxNormalForm0
### Response
This section describes the types available, not API responses.
```
--------------------------------
### FormType Data Type
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Types.html
Details about the FormType data type and its constructors.
```APIDOC
## Data Type: FormType
### Description
Represents the form of an operator (Prefix, Postfix, or Infix).
### Constructors
- FPrefix
- FPostfix
- FInfix
```
--------------------------------
### Text.TeXMath.Writers.Typst - writeTypst
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Writers-Typst.html
The `writeTypst` function transforms an expression tree into its equivalent Typst representation.
```APIDOC
## writeTypst
### Description
Transforms an expression tree to equivalent Typst.
### Method
N/A (This is a function signature, not an API endpoint)
### Endpoint
N/A
### Parameters
#### Path Parameters
N/A
#### Query Parameters
N/A
#### Request Body
N/A
### Request Example
N/A
### Response
#### Success Response (200)
N/A
#### Response Example
N/A
```
--------------------------------
### Operator Data Type
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Types.html
Details about the Operator data type and its fields and instances.
```APIDOC
## Data Type: Operator
### Description
A record of the MathML dictionary as defined in the specification.
### Fields
- oper :: TextOperator
- description :: TextPlain 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
```
--------------------------------
### Text.TeXMath.Writers.TeX Functions
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Writers-TeX.html
Provides functions to convert Haskell expression trees into LaTeX formatted strings.
```APIDOC
## writeTeX /writeTeX
### Description
Transforms an expression tree to equivalent LaTeX with the default packages (amsmath, amssymb, and cancel).
### Method
Not applicable (Haskell function)
### Endpoint
Not applicable (Haskell function)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **Text** (Text) - The LaTeX formatted string.
#### Response Example
None
## writeTeXWith /writeTeXWith
### Description
Transforms an expression tree to equivalent LaTeX with the specified packages.
### Method
Not applicable (Haskell function)
### Endpoint
Not applicable (Haskell function)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **Text** (Text) - The LaTeX formatted string.
#### Response Example
None
## addLaTeXEnvironment /addLaTeXEnvironment
### Description
Adds the correct LaTeX environment around a TeXMath fragment.
### Method
Not applicable (Haskell function)
### Endpoint
Not applicable (Haskell function)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **Text** (Text) - The LaTeX string with the environment added.
#### Response Example
None
```
--------------------------------
### Incomplete Pattern Match in TH Module
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/reports/1
This warning signals a non-exhaustive pattern match in the 'Data.Aeson.TH' module. The pattern '[Q Exp]' does not cover all possible cases, specifically the empty list '[]'.
```haskell
x:xs = [ lookupField argTy
```
--------------------------------
### Retrieve MathML Operator
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Readers-MathML-MMLDict.html
Looks up an operator record based on position, defaulting to Infix, Postfix, or Prefix if no exact match is found.
```haskell
getMathMLOperator :: Text -> FormType -> Maybe Operator
```
--------------------------------
### Alignment Data Type
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Types.html
Details about the Alignment data type and its instances.
```APIDOC
## Data Type: Alignment
### Description
Represents alignment options for mathematical expressions.
### Instances
#### 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 :: 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
##### 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
#### Eq Alignment
##### Methods
- (==) :: Alignment -> Alignment -> Bool
- (/=) :: Alignment -> Alignment -> Bool
#### 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
```
--------------------------------
### Text.TeXMath.Unicode Functions
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Unicode-ToUnicode.html
Provides functions for converting between Unicode characters and math formats, including TextType.
```APIDOC
## Text.TeXMath.Unicode Functions
### Description
Functions for replacing strings of characters with their respective mathvariant and vice versa.
### Functions
#### `fromUnicodeChar :: Char -> Maybe (TextType, Char)`
##### Description
The inverse of `toUnicodeChar`: returns the corresponding unstyled character and `TextType` of a unicode character.
#### `toUnicodeChar :: (TextType, Char) -> Maybe Char`
##### Description
Converts a `TextType` and character pair to its corresponding unicode character.
#### `fromUnicode :: TextType -> Text -> Text`
##### Description
Inverse of `toUnicode`. Converts a `TextType` and `Text` to its corresponding unicode `Text`.
#### `toUnicode :: TextType -> Text -> Text`
##### Description
Replace characters with their corresponding mathvariant unicode character. MathML has a mathvariant attribute which is unimplemented in Firefox (see here) Therefore, we may want to translate mathscr, etc to unicode symbols directly.
```
--------------------------------
### Text.TeXMath.Readers.TeX.Macros
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Readers-TeX-Macros.html
Provides functions for parsing LaTeX macro definitions and applying macros to LaTeX expressions.
```APIDOC
## 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`
### Data Types
#### data Macro
Represents a LaTeX macro.
### Functions
#### parseMacroDefinitions :: Text -> ([Macro], Text)
**Description:** 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.
**Parameters:**
* None
**Returns:**
* A tuple containing a list of `Macro` objects and the remaining unparsed `Text`.
#### pMacroDefinition :: forall (m :: Type -> Type) s st. (Monad m, Stream s m Char) => ParsecT s st m Macro
**Description:** Parses a `\newcommand` or `\renewcommand` macro definition and returns a `Macro`.
**Parameters:**
* None
**Returns:**
* A `Macro` object representing the parsed definition.
#### applyMacros :: [Macro] -> Text -> Text
**Description:** 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.
**Parameters:**
* `macros` ([Macro]): A list of macros to apply.
* `text` (Text): The input text to apply macros to.
**Returns:**
* The text after applying the macros.
```
--------------------------------
### writeOMML Function
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Writers-OMML.html
Transforms a parsed mathematical expression tree into an OMML XML Element.
```APIDOC
## writeOMML
### Description
Transforms an expression tree to an OMML XML Tree.
### Parameters
- **DisplayType** - Required - Specifies the display mode for the formula.
- **[Exp]** - Required - A list of expressions representing the parsed formula.
### Response
- **Element** - The resulting OMML XML element.
```
--------------------------------
### Text.TeXMath.Writers.MathML - writeMathML
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Writers-MathML.html
Functions for writing a parsed formula as MathML. The writeMathML function transforms an expression tree to a MathML XML tree.
```APIDOC
## writeMathML
### Description
Transforms an expression tree to a MathML XML tree.
### Synopsis
writeMathML :: DisplayType -> [Exp] -> Element
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
- **Element** (type) - The MathML XML tree representation of the expression.
#### Response Example
None
```
--------------------------------
### Data Structure: Record
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Types.html
Represents a record of the Unicode to LaTeX lookup table.
```APIDOC
## Data Structure: Record
### Description
A record of the Unicode to LaTeX lookup table.
### Fields
- **uchar** (Char) - Unicode Character
- **commands** ([(Text, Text)]) - LaTeX commands (package, command)
- **category** (TeXSymbolType) - TeX math category
- **comments** (Text) - Plain english description
```
--------------------------------
### getUnicode Function
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath-Readers-MathML-EntityMap.html
Translates a MathML entity reference to the corresponding Unicode string based on W3C entity definitions.
```APIDOC
## getUnicode
### Description
Translates a MathML entity reference to the corresponding Unicode string.
### Parameters
- **entity** (Text) - Required - The MathML entity reference to translate.
### Returns
- **Maybe Text** - The corresponding Unicode string if found, otherwise Nothing.
```
--------------------------------
### Mathematical Format Conversion API
Source: https://hackage.haskell.org/package/texmath-0.13.1.1/docs/Text-TeXMath.html
Functions for reading and writing mathematical expressions between different formats.
```APIDOC
## readTeX
### Description
Parses a TeX formula string into a list of Exp objects.
### Parameters
- **input** (Text) - Required - The TeX formula string.
### Response
- **result** (Either Text [Exp]) - Returns a list of expressions or an error message.
## writeMathML
### Description
Transforms an expression tree into a MathML XML tree.
### Parameters
- **display** (DisplayType) - Required - The display mode (DisplayBlock or DisplayInline).
- **expressions** ([Exp]) - Required - The list of expressions to convert.
### Response
- **result** (Element) - The resulting MathML XML element.
## writeTeX
### Description
Transforms an expression tree to equivalent LaTeX with default packages.
### Parameters
- **expressions** ([Exp]) - Required - The list of expressions to convert.
### Response
- **result** (Text) - The resulting LaTeX string.
```