## Generating Content MathML

SnuggleTeX can attempt to convert input LaTeX to Content MathML by first creating Enhanced Presentation MathML and then processing that. In many ways, this part of the process is relatively simple since most of the semantic structure has already been inferred (though might not necessarily make any sense).

The following tables demonstrate the types of inputs that we support.

### Supported Operators

 LaTeX operator Application Content MathML element Live Example + unary or n-ary x+1 - unary or binary -a-b Any multiplication n-ary A\times 3x Any division binary 1/2/{3\div 4} \vee n-ary A\vee B \wedge n-ary A\wedge B \cup n-ary A\cup B \cap n-ary A\cap B \setminus binary A\setminus B\setminus C \lnot unary (prefix) \lnot \lnot A ! unary (postfix) x!! Any mix of relation operators binary, applied in adjacent pairs See below 1\leq x < y

#### Notes

• Operators may be left “unapplied”, e.g. a raw input of + would result in <plus/> with no enclosing <apply/>.+
• Failures will be registered if an operator is used in an inappropriate context.

### Supported Relation Operators

 LaTeX operator Content MathML element Live Example = x=1 \not= x\not=a < a...... a\not a>b \not> ...... a\not>b \leq x\leq 1 \not\leq ...... x\not\leq 1 \geq x\geq 1 \not\geq ...... x\not\geq 1 \equiv a\equiv b \not\equiv ...... a\not\equiv b \approx x\approx 1 \not\approx ...... x\not\approx 1 \mid a\mid b \not\mid ...... a\not\mid b \in a\in A \not\in a\not\in A

#### Notes

• Relation operators will be paired up earlier in the up-conversion process. Where there are two or more relations together, each pairing becomes an operand of an enclosing logical and when converting to Content MathML. So a LaTeX input like 1<x\leq 2 will result in the same output as (1<x) \land (x \leq 2).
• Note that this pairing is still done for inputs like a=b=c, even though they could have been converted to an n-ary application of the <eq/> operator.

### Supported Pre-defined Functions

 LaTeX function Arity Invertible Content MathML element Live Example \sin unary Yes or \sin x \cos unary Yes or \cos^{-1} 0 \tan unary Yes or \tan\tan^{-1}x \sec unary Yes or \sec 0 \cot unary Yes or \cot x \sinh unary Yes or \sinh x \cosh unary Yes or \cosh x \tanh unary Yes or \tanh x \sech unary Yes or \sech^{-1}x \csch unary Yes or \csch x \coth unary Yes or \coth x \arcsin unary No \arcsin x \arccos unary No \arccos x \arctan unary No \arctan x \arcsec unary No \arcsec x \arccsc unary No \arccsc x \arccot unary No \arccot x \arcsinh unary No \arcsinh x \arccosh unary No \arccosh x \arctanh unary No \arctanh x \arcsech unary No \arcsech x \arccsch unary No \arccsch x \arccoth unary No \arccoth x \ln unary No \ln x \log unary No \log x \exp unary No \exp x \det unary No \det A \gcd n-ary No \gcd(x,y) \lcm n-ary No \lcm(x,y) \max n-ary No \max(1,2,3) \min n-ary No \min A \Re n-ary No \Re z \Im n-ary No \Im(1+3i)

#### Notes

• For all functions, constructs like \cos^3 x is interpreted as “cosine x raised to the power of 3”. This behaviour is used for any power that is a number greater than or equal to 1.\cos^2x+\sin^2x = 1
• For functions listed as Invertible in the table above, the up-conversion process interprets constructs like \sin^{-1} x as the “inverse sin of x” and would result in <apply><arcsin/><ci>x</ci></apply>. A failure will be noted if constructs like these are used on functions which do not support this.\sin^{-1}0 = 0
• For the log function, an input like \log_a x is interpreted as “logarithm to base a of x”.\log_{10}100 = 2

### Supported Fixed Symbols

 LaTeX symbol Content MathML interpretation Live Example \emptyset A=\emptyset \infty x<\infty

### Configurable Symbols

Some input symbols are not given pre-defined meanings and instead may be configured, either via the custom \assumeSymbol macro provided as part of the snuggletex-upconversion module, or via the Java API.

The following table shows examples of what is available:

 LaTeX input Content MathML interpretation Live Example \assumeSymbol{e}{exponentialNumber} $e$ e \assumeSymbol{e}{exponentialNumber} $e^x$ Application of function e \assumeSymbol{i}{imaginaryNumber} $i$ i \assumeSymbol{\pi}{constantPi} $\pi$ \pi \assumeSymbol{\gamma}{eulerGamma} $\gamma$ \gamma \assumeSymbol{f}{function} $f(x)$ Application of a function called f, rather than a product f(x)+a(x)

### Interpretation of Brackets

SnuggleTeX inteprets brackets of various types according to the following default rules:

 LaTeX input Default Content MathML intepretation Live Example (x) Round brackets treated as grouping only (x) (x,y) Round fence treated as (x,y) [x,y] Square fence treated as [x,y] \{x,y\} Curly fence treated as \{x,y\}

From SnuggleTeX 1.2.0 onwards, this behaviour can be changed using the \setUpConversionOption command. Here are some examples:

 Live Example Notes \setUpConversionOption{roundBracketHandling}{list} $(x)$ Creates a list \setUpConversionOption{roundFenceHandling}{set} $(1,2)$ Creates a set \setUpConversionOption{squareFenceHandling}{vector} $[x]$ Creates a vector \setUpConversionOption{curlyFenceHandling}{error} $[x]$ Treated as an error \setUpConversionOption{squareFenceHandling}{grouping} $a[x]$ Treated as a grouping only