### Install texmath with executable Source: https://github.com/jgm/texmath/blob/master/README.md To install the texmath executable, use the 'executable' Cabal flag. The binary will be installed in ~/.local/bin. ```bash cabal install -fexecutable ``` -------------------------------- ### cURL Example for GET / - Convert with Query Parameters Source: https://github.com/jgm/texmath/blob/master/_autodocs/endpoints.md Illustrates how to perform a formula conversion using a GET request with query parameters for text, input format, and output format. ```bash curl 'http://localhost:8080?text=a%2Bb&from=tex&to=mathml' ``` -------------------------------- ### Install with Both Build Flags Source: https://github.com/jgm/texmath/blob/master/_autodocs/configuration.md Use this command to install the package with both the 'executable' and 'server' build flags enabled. ```bash cabal install -fexecutable -fserver ``` -------------------------------- ### Install texmath as a server Source: https://github.com/jgm/texmath/blob/master/README.md To install a full webserver with a JSON API, set the 'server' Cabal flag. This allows running the server on a specified port. ```bash cabal install -fserver ``` -------------------------------- ### Start texmath-server in Background Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Starts the texmath-server on a specified port and runs it in the background using '&'. ```bash texmath-server -p 3000 & ``` -------------------------------- ### Example Log Line Source: https://github.com/jgm/texmath/blob/master/_autodocs/configuration.md Provides an example of the Apache-style HTTP request logging format used by the texmath server. ```log localhost - - [04/Jun/2026:10:23:45 +0000] "POST / HTTP/1.1" 200 256 "-" "curl/7.81.0" ``` -------------------------------- ### HTTPie Example for POST / - Convert Single Formula Source: https://github.com/jgm/texmath/blob/master/_autodocs/endpoints.md Provides an example using HTTPie for the same single formula conversion, showcasing its more concise syntax. ```bash http POST localhost:8080 text='2^2' from=tex to=mathml display:=false \ Accept:'text/plain' ``` -------------------------------- ### Specify Output Format (MathML to TeX Example) Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Use the -t or --to option to specify the desired output format. This example converts MathML to TeX notation. ```bash texmath --to tex formula.mathml ``` -------------------------------- ### CGI Mode Setup Source: https://github.com/jgm/texmath/blob/master/_autodocs/endpoints.md Shows how to enable CGI mode for the texmath server by creating a symbolic link. ```bash ln -s texmath-server texmath-server.cgi ``` -------------------------------- ### Specify Input Format (TeX to MathML Example) Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Use the -f or --from option to specify the input format when it's not the default (TeX). This example converts MathML input. ```bash texmath --from mathml input.mathml ``` -------------------------------- ### Controlling Output Packages Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Example demonstrating how to specify output packages for TeX rendering using `writeTeXWith`. ```APIDOC ## Controlling Output Packages ```haskell import Text.TeXMath (readTeX, writeTeXWith) -- Minimal LaTeX (no amsmath, amssymb) case readTeX "\\mathbb{N}" of Right exps -> putStrLn $ writeTeXWith ["base"] exps Left _ -> error "parse failed" ``` ``` -------------------------------- ### MathML to TeX Conversion Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Example demonstrating how to convert MathML to TeX notation using `readMathML` and `writeTeX`. ```APIDOC ## MathML → TeX ```haskell import Text.TeXMath (readMathML, writeTeX) case readMathML mathmlString of Right exps -> putStrLn $ writeTeX exps Left err -> putStrLn $ "Error: " ++ show err ``` ``` -------------------------------- ### Start texmath-server on Default Port Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Starts the texmath-server on the default port (8080). This server provides a REST API for formula conversion. ```bash texmath-server ``` -------------------------------- ### TeX to MathML Conversion Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Example demonstrating how to convert TeX notation to MathML using `readTeX` and `writeMathML`. ```APIDOC ## TeX → MathML ```haskell import Text.TeXMath (readTeX, writeMathML, DisplayInline) import Text.XML.Light (ppElement) case readTeX "2^2" of Right exps -> putStrLn $ ppElement $ writeMathML DisplayInline exps Left err -> putStrLn $ "Error: " ++ show err ``` ``` -------------------------------- ### TeX Conversion with Macro Definitions Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Example showing how to parse and convert TeX notation that includes custom macro definitions using `readTeX` and `writeTeX`. ```APIDOC ## With Macro Definitions ```haskell import Text.TeXMath (readTeX, writeTeX) let input = "\\newcommand{\\foo}{x+y} \\foo^2" case readTeX input of Right exps -> putStrLn $ writeTeX exps Left err -> putStrLn $ "Parse error" ``` ``` -------------------------------- ### Example TeX Input for Conversion Source: https://github.com/jgm/texmath/blob/master/server/texmath.html An example of a mathematical expression in TeX format. This input can be used with the texmath demo to convert it to other formats like MathML or OMML. ```tex \int_0^1 x^x\,\mathrm{d}x = \sum_{n = 1}^\infty{(-1)^{n + 1}\,n^{-n}} ``` -------------------------------- ### Batch Processing Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Example illustrating how to process multiple formulas in a batch using `readTeX` and `writeTeX`. ```APIDOC ## Batch Processing ```haskell import Text.TeXMath (readTeX, writeTeX) import qualified Data.Text as T let formulas = ["x+1", "y^2", "\\sin(z)"] let results = map readTeX formulas let outputs = [writeTeX e | Right e <- results] mapM_ (putStrLn . T.unpack) outputs ``` ``` -------------------------------- ### Run HTTP Server Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Command to run the texmath HTTP server. Ensure the 'server' Cabal flag is enabled during installation. ```bash cabal install -fserver texmath-server -p 8080 ``` -------------------------------- ### cURL Example for POST /batch - Convert Multiple Formulas Source: https://github.com/jgm/texmath/blob/master/_autodocs/endpoints.md Demonstrates how to use cURL to send a POST request to the /batch endpoint for converting multiple formulas simultaneously. ```bash curl -X POST http://localhost:8080/batch \ -H "Content-Type: application/json" \ -d '[{"text":"x^2","from":"tex","to":"mathml","display":true}]' ``` -------------------------------- ### Run texmath server on port 3000 Source: https://github.com/jgm/texmath/blob/master/README.md Start the texmath server to listen for requests on port 3000. This is useful for testing the JSON API. ```bash texmath-server -p 3000 ``` -------------------------------- ### Convert MathML to TeX from File Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Converts a MathML file to TeX format. This example shows specifying input and output formats when processing a file. ```bash texmath -f mathml -t tex formula.mathml ``` -------------------------------- ### Example of Symbol Fallback Source: https://github.com/jgm/texmath/blob/master/_autodocs/configuration.md Illustrates how 'writeTeXWith' handles missing packages by attempting to use alternative commands or Unicode escapes. ```haskell import Text.TeXMath (readTeX, writeTeXWith) import qualified Data.Text as T case readTeX "\\mathbb{R}" of Right exps -> do putStrLn $ writeTeXWith ["amsmath"] exps -- May output alternative if amssymb not available Left err -> putStrLn "Error" ``` -------------------------------- ### cURL Example for POST / - Convert Single Formula Source: https://github.com/jgm/texmath/blob/master/_autodocs/endpoints.md Demonstrates how to use cURL to send a POST request to the root endpoint for converting a single TeX formula to MathML. ```bash curl -X POST http://localhost:8080 \ -H "Content-Type: application/json" \ -H "Accept: text/plain" \ -d '{"text":"2^2","from":"tex","to":"mathml","display":false}' ``` -------------------------------- ### GET / - Convert with Query Parameters Source: https://github.com/jgm/texmath/blob/master/_autodocs/endpoints.md Converts a mathematical formula using query parameters in the URL. This method is simpler for basic conversions and defaults to text/plain output. ```APIDOC ## GET / ### Description Converts a mathematical formula using query parameters in the URL. This method is simpler for basic conversions and defaults to text/plain output. ### Method GET ### Endpoint / ### Parameters #### Query Parameters - **text** (string) - no - Input formula text - **from** (string) - no - Input format: `tex`, `mathml`, `omml` - **to** (string) - no - Output format: `tex`, `mathml`, `omml`, `eqn`, `typst` - **display** (flag) - no - If present, sets display mode to true ### Response #### Success Response (200) - **body** (string) - The converted formula as plain text. #### Response Example ```bash curl 'http://localhost:8080?text=a%2Bb&from=tex&to=mathml' ``` ``` -------------------------------- ### Test texmath-server API (POST Request) Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Sends a POST request to the texmath-server API to convert a formula. This example uses curl to send JSON data for conversion. ```bash curl -X POST http://localhost:3000 \ -H "Content-Type: application/json" \ -d '{"text":"x^2","from":"tex","to":"mathml","display":false}' ``` -------------------------------- ### Nginx Proxy Configuration Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Example Nginx configuration to proxy requests to a standalone texmath-server instance running on localhost:8080. This allows Nginx to handle external requests and forward them. ```nginx upstream texmath { server localhost:8080; } server { location /math { proxy_pass http://texmath/; } } ``` -------------------------------- ### Build With Server Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Build the TeXMath library with the server component enabled using the 'server' flag. ```bash cabal build -fserver ``` -------------------------------- ### Build All Components Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Builds the TeXMath library, executable, and server components by enabling both 'executable' and 'server' flags. ```bash cabal build -fexecutable -fserver ``` -------------------------------- ### Example 500 Internal Server Error Response Source: https://github.com/jgm/texmath/blob/master/_autodocs/errors.md This is an example of a plain text error message returned by the API when a conversion or parsing fails. ```http HTTP/1.1 500 Internal Server Error Content-Type: text/plain;charset=utf-8 Error: Failed to parse LaTeX at position 15: unexpected character ``` -------------------------------- ### Create CGI Executable Source: https://github.com/jgm/texmath/blob/master/_autodocs/configuration.md Demonstrates how to set up the texmath-server to run as a CGI script by creating a symbolic link. ```bash ln -s /path/to/texmath-server /path/to/texmath-server.cgi ``` -------------------------------- ### Show texmath-server Help Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Displays the help message for the texmath-server, listing available command-line options. ```bash texmath-server --help ``` -------------------------------- ### Build With Executable Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Build the TeXMath library along with its executable component by enabling the 'executable' flag. ```bash cabal build -fexecutable ``` -------------------------------- ### Create Input File with Formulas Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md This snippet demonstrates how to create an input file with one formula per line and pipe it to texmath for conversion. ```bash for formula in "x+y" "a^2+b^2" "sin(x)"; do echo "$formula" done | while read f; do echo "$f" | texmath -f tex -t mathml done ``` -------------------------------- ### Run Test Suite Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Execute the test suite for the TeXMath library using this command. ```bash cabal test ``` -------------------------------- ### Show Help Message Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Use the -h or --help flag to display the help message and usage information for the texmath CLI. ```bash texmath --help ``` -------------------------------- ### Get the Empty Expression Constant with empty Source: https://github.com/jgm/texmath/blob/master/_autodocs/api-reference/shared-utilities.md The 'empty' constant represents the empty expression EGrouped []. It serves as a neutral element for building expression trees. ```haskell import Text.TeXMath.Shared (empty) let expr = empty -- EGrouped [] ``` -------------------------------- ### Import Main Module Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Import the main texmath module to access core readers, writers, and types for formula conversion. ```haskell import Text.TeXMath ``` -------------------------------- ### Example Error Response Source: https://github.com/jgm/texmath/blob/master/_autodocs/endpoints.md Illustrates the format of an error response when formula conversion fails in a CGI environment. This typically indicates a parsing issue or an unsupported conversion. ```text Error: Failed to parse LaTeX: unexpected end of input ``` -------------------------------- ### Get LaTeX Text Command from TextType Source: https://github.com/jgm/texmath/blob/master/_autodocs/api-reference/shared-utilities.md Maps a TextType to its corresponding LaTeX command, considering available packages. Provides a fallback if a required package is missing. ```haskell import Text.TeXMath.Shared (getLaTeXTextCommand) import Text.TeXMath.Types (TextType(..)) let env = ["amsmath", "amssymb"] let cmd = getLaTeXTextCommand env TextBold -- "\mathbf" let cmd = getLaTeXTextCommand env TextScript -- "\mathscr" or fallback ``` -------------------------------- ### Convert File with Options (TeX to eqn) Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Converts a TeX file to GNU eqn format, using inline display style and redirecting the output to a file. ```bash texmath --from tex --to eqn --inline input.tex > output.eqn ``` -------------------------------- ### Build Library Only Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Use this command to build the TeXMath library without the executable or server components. ```bash cabal build ``` -------------------------------- ### isControlSeq Source: https://github.com/jgm/texmath/blob/master/_autodocs/api-reference/tex-representation.md Tests if a given text string is a valid LaTeX control sequence, which must start with a backslash and be followed by either a single non-space character or an alphabetic sequence. ```APIDOC ## isControlSeq ### Description Tests whether a text string is a valid LaTeX control sequence. ### Method ```haskell isControlSeq :: Text -> Bool ``` ### Parameters #### Path Parameters - **text** (Text) - Required - Text to test ### Response #### Success Response (Bool) - **True** (Bool) - True if text is a valid LaTeX control sequence. ### Request Example ```haskell import Text.TeXMath.TeX (isControlSeq) isControlSeq "\\alpha" -- True isControlSeq "\\mathbf" -- True isControlSeq "\\$" -- True isControlSeq "\\ " -- False (space not allowed) isControlSeq "alpha" -- False (no backslash) isControlSeq "\\2" -- False (not letter or space) ``` ``` -------------------------------- ### Write TeX with Custom Environment Source: https://github.com/jgm/texmath/blob/master/_autodocs/configuration.md Demonstrates how to use 'writeTeXWith' to specify a custom environment for LaTeX output, overriding the default. ```haskell writeTeXWith :: Env -> [Exp] -> Text -- Examples: writeTeXWith [] exps -- Only base LaTeX writeTeXWith ["amsmath"] exps -- Only amsmath writeTeXWith ["amsmath", "amssymb"] exps -- Standard (default) ``` -------------------------------- ### Example MathML with Entities Source: https://github.com/jgm/texmath/blob/master/_autodocs/api-reference/mathml-dictionaries.md This MathML snippet demonstrates the use of entity references like α, ∫, and ξ within text nodes. These entities are resolved to their Unicode equivalents during parsing. ```xml α f d ξ ``` -------------------------------- ### Get Closest LaTeX Scaler Command for a Factor Source: https://github.com/jgm/texmath/blob/master/_autodocs/api-reference/shared-utilities.md Finds the LaTeX scaler command that corresponds to a given scaling factor. Returns Nothing if the scaling factor is too small for any standard command. ```haskell import Text.TeXMath.Shared (getScalerCommand) case getScalerCommand 1.8 of Just cmd -> putStrLn $ "Use: " ++ show cmd -- "\Big" or "\bigg" Nothing -> putStrLn "No suitable scaler" ``` -------------------------------- ### Block vs. Inline Display Style Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Demonstrates the difference between default block display style and the --inline option for rendering mathematical formulas. ```bash # Block (display) style - default echo "sin(x)" | texmath -f tex # Inline style echo "sin(x)" | texmath -f tex --inline ``` -------------------------------- ### Haskell: Diagnose Failed Conversions Source: https://github.com/jgm/texmath/blob/master/_autodocs/errors.md Provides an example diagnostic function that takes input text, attempts to parse it as TeX, and prints error messages or success information, including generating MathML output. ```haskell import Text.TeXMath (readTeX, writeMathML, DisplayInline) import qualified Data.Text as T diagnoseError :: T.Text -> IO () diagnoseError input = do putStrLn $ "Input: " ++ T.unpack input case readTeX input of Left err -> putStrLn $ "TeX Parse Error: " ++ T.unpack err Right exps -> do putStrLn $ "Parsed successfully: " ++ show (length exps) ++ " expressions" let element = writeMathML DisplayInline exps putStrLn "MathML output generated" ``` -------------------------------- ### Monitor Server with Logs Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Monitors the texmath server process and logs its output to a file named server.log. ```bash texmath-server -p 3000 2>&1 | tee server.log ``` -------------------------------- ### Texmath HTTP API Endpoints Source: https://github.com/jgm/texmath/blob/master/_autodocs/INDEX.md The texmath library exposes HTTP endpoints for formula conversion. These endpoints support single formula conversion via POST or GET, and batch conversion via POST. ```APIDOC ## POST / ### Description Converts a single formula provided in the request body. ### Method POST ### Endpoint / ### Parameters #### Request Body - **formula** (string) - Required - The formula to convert. - **from** (string) - Optional - The input format (e.g., 'tex', 'mathml'). - **to** (string) - Optional - The output format (e.g., 'tex', 'mathml'). ### Request Example ```json { "formula": "a^2 + b^2 = c^2", "to": "mathml" } ``` ### Response #### Success Response (200) - **result** (string) - The converted formula. #### Response Example ```json { "result": "..." } ``` ## GET / ### Description Converts a formula provided via query parameters. ### Method GET ### Endpoint / ### Parameters #### Query Parameters - **formula** (string) - Required - The formula to convert. - **from** (string) - Optional - The input format (e.g., 'tex', 'mathml'). - **to** (string) - Optional - The output format (e.g., 'tex', 'mathml'). ### Response #### Success Response (200) - **result** (string) - The converted formula. ## POST /batch ### Description Converts a batch of formulas provided in the request body. ### Method POST ### Endpoint /batch ### Parameters #### Request Body - **formulas** (array) - Required - An array of formula objects to convert. - Each object can have 'formula', 'from', and 'to' fields. ### Request Example ```json [ { "formula": "a^2 + b^2 = c^2", "to": "mathml" }, { "formula": "\sum_{i=1}^{n} i = \frac{n(n+1)}{2}", "from": "tex", "to": "mathml" } ] ``` ### Response #### Success Response (200) - **results** (array) - An array of converted formulas corresponding to the input. #### Response Example ```json [ { "result": "..." }, { "result": "..." } ] ``` ``` -------------------------------- ### JavaScript AJAX Request for Texmath Conversion Source: https://github.com/jgm/texmath/blob/master/server/texmath.html This JavaScript function handles the AJAX POST request to the texmath server for converting mathematical expressions. It manages request setup, response handling, and error reporting. ```javascript var postConvert = function(body, onSuccess, onError) { var xhr = new XMLHttpRequest(); xhr.open('POST', 'https://texmath.johnmacfarlane.net/', true); xhr.setRequestHeader('Accept', 'application/json'); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function () { var res = null; if (xhr.readyState === 4) { if (xhr.status === 204 || xhr.status === 205) { onSuccess(); } else if (xhr.status >= 200 && xhr.status < 300) { try { res = JSON.parse(xhr.responseText); } catch (e) { onError(e); } if (res) onSuccess(res); } else { onError(xhr.responseText); } } }; xhr.send(JSON.stringify(body)); }; ``` -------------------------------- ### Check if text is a control sequence Source: https://github.com/jgm/texmath/blob/master/_autodocs/api-reference/tex-representation.md Tests if a given text string is a valid LaTeX control sequence. Control sequences must start with a backslash and be followed by either a single non-space character or an alphabetic character. ```haskell import Text.TeXMath.TeX (isControlSeq) isControlSeq "\\alpha" -- True isControlSeq "\\mathbf" -- True isControlSeq "\\$" -- True isControlSeq "\\ " -- False (space not allowed) isControlSeq "alpha" -- False (no backslash) isControlSeq "\\2" -- False (not letter or space) ``` -------------------------------- ### Haskell: Try Multiple Formats for Parsing Source: https://github.com/jgm/texmath/blob/master/_autodocs/errors.md Demonstrates a pattern to attempt parsing input text using multiple TeXMath readers (TeX, MathML, OMML) and return the first successful parse. ```haskell import Text.TeXMath (readTeX, readMathML, readOMML) import qualified Data.Text as T parseAny :: T.Text -> Either T.Text [Exp] parseAny input = case readTeX input of Right exps -> Right exps _ -> case readMathML input of Right exps -> Right exps _ -> readOMML input ``` -------------------------------- ### Lookup MathML Operator by Text and Form Source: https://github.com/jgm/texmath/blob/master/_autodocs/api-reference/mathml-dictionaries.md Looks up an operator in the MathML dictionary by its text and form type. If an exact match for the form is not found, it tries other forms in a specific order. This is used internally for parsing MathML to get operator properties. ```haskell import Text.TeXMath.Readers.MathML.MMLDict (getMathMLOperator) import Text.TeXMath.Types (FormType(..)) case getMathMLOperator "+" FInfix of Just op -> putStrLn $ "Operator: " ++ show (oper op) Nothing -> putStrLn "Not found" ``` -------------------------------- ### parseMacroDefinitions Source: https://github.com/jgm/texmath/blob/master/_autodocs/api-reference/macros.md Parses macro definitions from the beginning of input text and returns the list of macros plus the remainder. Macro definitions must appear at the start and are optionally separated and ended by spaces and TeX comments. Supports \newcommand, \renewcommand, \providecommand, and \DeclareMathOperator declarations with parameters and optional arguments. ```APIDOC ## parseMacroDefinitions ### Description Parses macro definitions from the beginning of input text and returns the list of macros plus the remainder. Macro definitions must appear at the start and are optionally separated and ended by spaces and TeX comments. Supports `\newcommand`, `\renewcommand`, `\providecommand`, and `\DeclareMathOperator` declarations with parameters and optional arguments. Returns `([], input)` if no macro definitions are found (not an error). ### Signature ```haskell parseMacroDefinitions :: Text -> ([Macro], Text) ``` ### Parameters #### Path Parameters - **input** (Text) - Required - Text containing macro definitions followed by expression ### Return type `([Macro], Text)` — Tuple of (list of parsed macros, remaining unparsed text). ### Example ```haskell import Text.TeXMath.Readers.TeX.Macros (parseMacroDefinitions) import qualified Data.Text as T let input = "\\newcommand{\\foo}{x+y} \\foo + \\foo" let (macros, rest) = parseMacroDefinitions input -- macros contains one Macro -- rest = " \\foo + \\foo" ``` ``` -------------------------------- ### Print Version Number Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Use the -v or --version flag to display the current version of the texmath tool and exit. ```bash texmath --version # Output: Version 0.13.1.2 ``` -------------------------------- ### Convert TeX to MathML using httpie Source: https://github.com/jgm/texmath/blob/master/README.md Sample usage of the texmath server API via httpie. This demonstrates converting a TeX string to MathML. The 'from' and 'to' parameters specify the input and output formats. ```http % 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 2 2 ``` -------------------------------- ### Enable CGI Mode Source: https://github.com/jgm/texmath/blob/master/_autodocs/cli-tool.md Creates a symbolic link to enable CGI mode for the texmath tool, allowing it to function as a CGI script. ```bash ln -s texmath texmath-cgi ``` -------------------------------- ### Library Usage Source: https://github.com/jgm/texmath/blob/master/_autodocs/README.md Import the main module Text.TeXMath to access readers, writers, macro handling, and core types for formula conversion. ```APIDOC ## Library Usage **Main module:** ```haskell import Text.TeXMath ``` Exports: - `readTeX`, `readMathML`, `readOMML` — readers - `writeTeX`, `writeTeXWith`, `writeEqn`, `writeMathML`, `writeOMML`, `writeTypst`, `writePandoc` — writers - `addLaTeXEnvironment` — wraps LaTeX with delimiters - `DisplayType(..), Exp` — core types **Type definitions:** ```haskell import Text.TeXMath.Types ``` All `Exp` constructors and supporting types. ```