### Running the SnuggleTeX webapp
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/README.md
Instructions to install and run the SnuggleTeX documentation & demos webapp locally.
```shell
mvn install
cd snuggletex-webapp
mvn tomcat7:run
```
--------------------------------
### Large text example (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the \Huge command example.
```html
This is some big huge text.
New paragraph
```
--------------------------------
### Macro Expansion to MathML
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Example of a macro expanding to a simple mathematical expression.
```LaTeX
\newcommand{\test}{x}$\test$
```
--------------------------------
### Large text example (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example using \Huge command for large text.
```latex
\Huge
This is some big huge text.
New paragraph
```
--------------------------------
### Regression: \begin{eqnarray*} (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the \begin{eqnarray*} regression example.
```html
```
--------------------------------
### Assume Symbol Function
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Example of assuming a symbol is a function and its corresponding MathML.
```tex
\assumeSymbol{f}{function} $f(x)$
f
x
```
--------------------------------
### Assume and Unassume Symbol
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Example of assuming and then unassuming a symbol, and its MathML.
```tex
\assumeSymbol{f}{function}\unassumeSymbol{f} $f(x)$
f
x
```
--------------------------------
### Centered text (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example of centering text using \begin{center} environment.
```latex
\begin{center}
Line 1\\
Line 2\\
\end{center}
```
--------------------------------
### Assume Symbol with Subscript
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Example of assuming a symbol is a function with a subscript, and its MathML.
```tex
\assumeSymbol{f_n}{function} $f_n(x)$
f
n
x
```
--------------------------------
### Basic HTML list equivalent
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the LaTeX list example.
```html
```
--------------------------------
### Centered text (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the \begin{center} example.
```html
Line 1
Line 2
```
--------------------------------
### Regression: \begin{eqnarray*}
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example demonstrating a regression fix for \begin{eqnarray*}.
```latex
\begin{eqnarray*}
& 1 \\
\end{eqnarray*}
```
--------------------------------
### Extra error examples
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/simple-error-tests.txt
A section for additional error examples.
```plaintext
## Extra error examples... add new and interesting cases here when found
$}
TTEG00
====
```
--------------------------------
### Assume Symbol with Superscript
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Example of assuming a symbol is a function with a superscript, and its MathML.
```tex
\assumeSymbol{f}{function} $f^2(x)$
f
2
x
```
--------------------------------
### Assume Symbol with Subscript and Superscript
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Example of assuming a symbol is a function with a subscript and superscript, and its MathML.
```tex
\assumeSymbol{f_n}{function} $f_n^{-1}(x)$
f
n
-1
x
```
--------------------------------
### User-defined commands/environments in lists
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example of a user-defined command \vspace that does nothing, used before the first item in a list.
```latex
\newcommand{\vspace}[1]{}
\begin{itemize}
\vspace{0.1cm}
\item A
\end{itemize}
```
--------------------------------
### Fancy table 1 (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the first LaTeX table example.
```html
```
--------------------------------
### Handling comments inside tabulars (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the LaTeX tabular example with comments.
```html
```
--------------------------------
### Fancy table 1 (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example of a basic LaTeX table with specified column formatting.
```latex
\begin{tabular}{|r|l|}
1 & 2 \\
3 & 4
\end{tabular}
```
--------------------------------
### Regression: Bug handling comments (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example demonstrating regression fix for bug handling comments.
```latex
%\n%\nHello
```
--------------------------------
### Similar regression: square brackets with comments (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example demonstrating correct handling of comments within square brackets in commands.
```latex
\newcommand{\bob}[1][]{x#1x}
\bob[A%
B]
```
--------------------------------
### Regression: Bug handling comments (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the bug handling comments regression example.
```html
Hello
```
--------------------------------
### Similar regression: square brackets with comments (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the square brackets with comments regression example.
```html
xABx
```
--------------------------------
### Handling comments inside tabulars (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example demonstrating correct handling of comments within LaTeX tabular environments.
```latex
\begin{tabular}{|r|l|}
\hline
1 & 2 \\ %Blah
\hline %Blah
\end{tabular}
```
--------------------------------
### Fancy table 2 with \hline (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the second LaTeX table example with \hline.
```html
```
--------------------------------
### Incomplete Macro Definition (Opening Brace)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/simple-error-tests.txt
Tests an incomplete macro definition starting with an opening brace, expecting an error.
```tex
\newcommand{\
```
--------------------------------
### Regression: Support '\' at end of line (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the '\' at end of line regression example.
```html
æ X
```
--------------------------------
### Environment with Arguments
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Demonstrates an environment that accepts arguments.
```LaTeX
\newenvironment{test}[2]{#1 #2}{End}\begin{test}{A}{B}Hello\end{test}
```
--------------------------------
### Basic Hello World
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
A simple test case with 'Hello'.
```LaTeX
Hello
```
```HTML
Hello
```
--------------------------------
### Function application with exponent: \sin^2
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Demonstrates \sin^2 with an exponent.
```tex
\sin^2
sin
2
```
--------------------------------
### New Environment Definition and Usage
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Shows the definition and basic usage of a new environment.
```LaTeX
\newenvironment{test}{Begin}{End}\begin{test}Hello\end{test}
```
--------------------------------
### Regression: Trivial endpoint case in tabular (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the trivial endpoint case in tabular regression example.
```html
```
--------------------------------
### Regression: Trivial endpoint case in tabular (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example demonstrating a regression fix for a trivial endpoint case in a tabular environment.
```latex
\begin{tabular}{c}
Hello
\end{tabular}
```
--------------------------------
### Prefix/Infix/Postfix Handling
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Tests for improved prefix, infix, and postfix operator handling.
```latex
1++x
```
```mathml
1
+
+
x
```
```latex
1+-x
```
```mathml
1
+
-
x
```
```latex
1-+x
```
```mathml
1
-
+
x
```
```latex
1+++x
```
```mathml
1
+
+
+
x
```
```latex
1---x
```
```mathml
1
-
-
-
x
```
```latex
1--
```
```mathml
1
-
-
```
```latex
+
```
```mathml
+
```
--------------------------------
### Environment with Whitespace Handling
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Illustrates how whitespace is handled within an environment.
```LaTeX
\newenvironment{test}{Begin}{End}\begin{test} Hello \end{test}
```
--------------------------------
### Environment with Optional Argument and Provided Values
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Shows an environment with an optional argument and both arguments provided.
```LaTeX
\newenvironment{test}[2][]{#1#2}{End}\begin{test}[A]{B}Hello\end{test}
```
--------------------------------
### Infix as prefix handling
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-cmathml-tests.txt
Demonstrates the conversion of infix operators to prefix notation.
```tex
1++x
1
x
```
```tex
1+-x
1
x
```
```tex
1+++x
1
x
```
--------------------------------
### Enumerate
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \begin{enumerate}.
```LaTeX
\begin{enumerate} \item A \end{enumerate}
```
```HTML
- A
```
--------------------------------
### Factorial binding with double factorial: 2x!!
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Demonstrates factorial binding with a double factorial.
```tex
2x!!
2
x
!
!
```
--------------------------------
### Verbatim Environment
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \begin{verbatim} environment.
```LaTeX
\begin{verbatim}This is verbatim\end{verbatim}
```
```HTML
This is verbatim
```
--------------------------------
### Macro with Arguments
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Shows a macro that accepts two arguments and how they are used.
```LaTeX
\newcommand{\test}[2]{1=#1 2=#2}\test{A}{B}
```
--------------------------------
### Environment Followed by Text
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Shows an environment followed immediately by other text.
```LaTeX
\newenvironment{test}{Begin}{End}\begin{test}Hello\end{test}After
```
--------------------------------
### Nested Environments with Content
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Illustrates nesting of custom environments with content in between.
```LaTeX
\newenvironment{test}{Begin}{End}\begin{test}A\begin{test}B\end{test}C\end{test}D
```
--------------------------------
### Command Usage (Two Args Optional Default)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing usage of a defined command with two arguments, using the optional default.
```LaTeX
\newcommand{\test}[2][You]{Hello #1 #2}\test{There}
```
```LaTeX
Hello You There
```
--------------------------------
### Verbatim Environment with Whitespace
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \begin{verbatim} with leading/trailing whitespace.
```LaTeX
\begin{verbatim} This is verbatim \end{verbatim}?
```
```HTML
This is verbatim
?
```
--------------------------------
### Environment with Optional Argument, No Optional Value Provided
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Illustrates an environment with an optional argument where the optional value is not provided.
```LaTeX
\newenvironment{test}[2][]{#1#2}{End}\begin{test}{B}Hello\end{test}
```
--------------------------------
### Change to Bold Text (bf environment)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing changing to bold text with \begin{bf} environment.
```LaTeX
Change to {\bf Bold Text}
```
```HTML
Change to Bold Text
```
--------------------------------
### Fancy table 2 with \hline (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example of a LaTeX table including \hline for horizontal rules.
```latex
\begin{tabular}{|r|l|}
1 & 2 \\
\hline
3 & 4 \\
\hline
\end{tabular}
```
--------------------------------
### Bold Text (bf environment)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \begin{bf} environment for bold text.
```LaTeX
\begin{bf}Bold Text\end{bf}
```
```HTML
Bold Text
```
--------------------------------
### Basic Macro Definition and Usage
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Demonstrates defining a simple macro and its expansion.
```LaTeX
\newcommand{\test}{Hello}\renewcommand{\test}{There}\test
```
--------------------------------
### Command Definition (Two Args with Default)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \newcommand with two arguments and a default value.
```LaTeX
\newcommand{\test}[2][Sausage]{Hello #1 #2}Good
```
```LaTeX
Good
```
--------------------------------
### Function application with negative exponent: \sin^{-1}
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Illustrates \sin^{-1} with a negative exponent.
```tex
\sin^{-1}
sin
-1
```
--------------------------------
### Consecutive factorials: x!y!
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Demonstrates 'x!y!' parsing.
```tex
x!y!
x
!
y
!
```
--------------------------------
### Regression: Commands at end of lines eating newline (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the commands at end of lines regression example.
```html
Hello…
There…
```
--------------------------------
### Command Definition (Two Args)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \newcommand with two arguments.
```LaTeX
\newcommand{\test}[2][]{Hello #1 #2}Good
```
```LaTeX
Good
```
--------------------------------
### Regression: Comments skipped in bracket matching (HTML)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
The HTML equivalent of the comment skipping in bracket matching regression example.
```html
A
```
--------------------------------
### Command Usage with Text Immediately After
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing command usage followed immediately by more text.
```LaTeX
\newcommand{\test}[1]{Hello #1}\test{There}more text afterwards
```
```LaTeX
Hello Theremore text afterwards
```
--------------------------------
### Regression: Comments skipped in bracket matching (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example showing correct skipping of comments when matching curly/square brackets.
```latex
\newcommand{\bob}{%} This close bracket should not be counted!
A}
\bob
```
--------------------------------
### Nested Command Usage with Text Immediately After
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing nested command usage followed immediately by more text.
```LaTeX
\newcommand{\test}[1]{Hello #1}\test{\test{There}}More
```
```LaTeX
Hello Hello ThereMore
```
--------------------------------
### Regression: Support '\' at end of line (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example demonstrating support for '\' at the end of a line, treated as '\ '.
```latex
\ae\
X
```
--------------------------------
### Macro with Optional Argument and Provided Value
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Demonstrates using an optional argument with a provided value.
```LaTeX
\newcommand{\test}[2][]{1=#1 2=#2}\test[A]{B}
```
--------------------------------
### Factorial as exponent: x^{!}
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Shows a factorial used as an exponent.
```tex
x^{!}
x
!
```
--------------------------------
### Constant Pi
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-maxima-tests.txt
Demonstrates conversion of the constant Pi.
```TeX
\assumeSymbol{\pi}{constantPi} $\pi$
%pi
```
--------------------------------
### Factorial binding with function: \sin 2x!
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Shows factorial binding in the context of a function.
```tex
\sin 2x!
sin
2
x
!
```
--------------------------------
### Regression: Commands at end of lines eating newline (LaTeX)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/multiline-tests.txt
Example demonstrating regression fix for commands at end of lines consuming trailing whitespace.
```latex
Hello\ldots
There\ldots
```
--------------------------------
### Unapplied elementary functions: \sin {}
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Shows how an unapplied elementary function like \sin is represented.
```tex
\sin {}
sin
```
--------------------------------
### Command Definition (No Args)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \newcommand without arguments.
```LaTeX
\newcommand{\test}[1]{Hello #1}Good
```
```LaTeX
Good
```
--------------------------------
### Environment with Default Optional Argument
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Demonstrates an environment with a default value for its optional argument.
```LaTeX
\newenvironment{test}[2][A]{#1#2}{End}\begin{test}[C]{B}Hello\end{test}
```
--------------------------------
### Curly brackets handling
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-cmathml-tests.txt
Demonstrates the default conversion of curly brackets to sets.
```tex
\{1,2\}
1
2
```
```tex
[[a,b],c]
a
b
c
```
--------------------------------
### Command Usage with Text After
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing command usage followed by more text.
```LaTeX
\newcommand{\test}[1]{Hello #1}\test{There} more text afterwards
```
```LaTeX
Hello There more text afterwards
```
--------------------------------
### Macro with Optional Argument
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Illustrates a macro with an optional first argument.
```LaTeX
\newcommand{\test}[2][]{1=#1 2=#2}\test{A}
```
--------------------------------
### Square brackets handling
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-cmathml-tests.txt
Illustrates the default conversion of square brackets to lists.
```tex
[1,2]
1
2
```
--------------------------------
### Function application with negative exponent and empty argument: \sin^{-1} {}
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Shows \sin^{-1} followed by an empty argument.
```tex
\sin^{-1} {}
sin
-1
```
--------------------------------
### Function Inverse with Argument
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-maxima-tests.txt
Shows conversion of function inverse notation with an argument.
```TeX
\assumeSymbol{f}{function} $f^{-1}(x)$
inverse[f](x)
```
--------------------------------
### User-defined commands and environments
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Tests the handling of user-defined LaTeX commands and environments, including implicit argument searching.
```latex
\newcommand{\bob}[1]{#1}\bob x
x
====
```
```latex
\begin{center} Hello! \end{center}
Hello!
====
```
```latex
\fbox{Hello}
Hello
====
```
```latex
\Huge This is \small small
This is small
====
```
```latex
\textrm{Hello}
Hello
====
```
--------------------------------
### Environment with Default Optional Argument, No Optional Value Provided
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Shows an environment with a default optional argument where the optional value is not explicitly given.
```LaTeX
\newenvironment{test}[2][A]{#1#2}{End}\begin{test}{B}Hello\end{test}
```
--------------------------------
### Basic Up-conversion Tests
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Tests for basic up-conversion of Presentation MathML to LaTeX.
```latex
1
```
```mathml
1
```
```latex
\alpha
```
```mathml
α
```
```latex
x = 3
```
```mathml
x
=
3
```
```latex
1+x = 2
```
```mathml
1
+
x
=
2
```
```latex
x
```
```mathml
x
```
```latex
-x
```
```mathml
-
x
```
```latex
1+x
```
```mathml
1
+
x
```
```latex
-x+1
```
```mathml
-
x
+
1
```
--------------------------------
### Command Definition (Optional Arg)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \newcommand with an optional argument.
```LaTeX
\newcommand{\test}[1][]{Hello #1}Good
```
```LaTeX
Good
```
--------------------------------
### Command Usage (Optional Arg Default Used)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing usage of a defined command with an optional argument, using the default.
```LaTeX
\newcommand{\test}[1][There]{Hello #1}\test
```
```LaTeX
Hello There
```
--------------------------------
### Function application with exponent and empty argument: \sin^2 {}
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Shows \sin^2 followed by an empty argument.
```tex
\sin^2 {}
sin
2
```
--------------------------------
### Use of \ensuremath
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \ensuremath for math.
```LaTeX
\ensuremath{x}
```
```MathML
```
--------------------------------
### Itemize with Multiple Items
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \begin{itemize} with multiple items.
```LaTeX
\begin{itemize}\item Item 1 \item Item 2\end{itemize}
```
```HTML
```
--------------------------------
### Command Usage (Two Args)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing usage of a defined command with two arguments.
```LaTeX
\newcommand{\test}[2][]{Hello #1 #2}\test[You]{There}
```
```LaTeX
Hello You There
```
--------------------------------
### List Handling with Round Fence
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-cmathml-tests.txt
Demonstrates how round fence handling is set to list for tuples.
```text
\setUpConversionOption{roundFenceHandling}{list} (1,2)
1
2
====
```
--------------------------------
### Environment Followed by Spaced Text
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Demonstrates an environment followed by spaced text.
```LaTeX
\newenvironment{test}{Begin}{End}\begin{test}Hello\end{test} After
```
--------------------------------
### The Quadratic Equation
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Up-conversion of the quadratic equation formula.
```latex
\frac{-b+\sqrt{b^2-4ac}}{2a}
```
```mathml
-
b
+
b
2
-
4
a
c
2
a
```
--------------------------------
### Command Usage (Optional Arg Default)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing usage of a defined command with an optional argument and default value.
```LaTeX
\newcommand{\test}[1][]{Hello#1}\test
```
```LaTeX
Hello
```
--------------------------------
### Function Inverse
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-maxima-tests.txt
Demonstrates conversion of function inverse notation.
```TeX
\assumeSymbol{f}{function} $f^{-1}$
inverse[f]
```
--------------------------------
### Cube Root and Powers
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Up-conversion of cube root and power expressions.
```latex
\sqrt[3]{x}
```
```mathml
x
3
```
```latex
x^2 + 1
```
```mathml
x
2
+
1
```
--------------------------------
### Testing array environments
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/math-tests.txt
Shows the conversion of LaTeX array environments to MathML.
```tex
\begin{array}{lc} 1 & 2 \\ 3 & 4 \end{array}\n\n \n 1\n 2\n \n \n 3\n 4\n \n
```
```tex
\begin{matrix} 1 & 2 \\ 3 & 4 \end{matrix}\n\n \n 1\n 2\n \n \n 3\n 4\n \n
```
```tex
\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\n\n \n \n 1\n 2\n \n \n 3\n 4\n \n \n
```
```tex
\begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}\n\n \n \n 1\n 2\n \n \n 3\n 4\n \n \n
```
```tex
\begin{Bmatrix} 1 & 2 \\ 3 & 4 \end{Bmatrix}\n\n \n \n 1\n 2\n \n \n 3\n 4\n \n \n
```
```tex
\begin{vmatrix} 1 & 2 \\ 3 & 4 \end{vmatrix}\n\n \n \n 1\n 2\n \n \n 3\n 4\n \n \n
```
```tex
\begin{Vmatrix} 1 & 2 \\ 3 & 4 \end{Vmatrix}\n\n \n \n 1\n 2\n \n \n 3\n 4\n \n \n
```
```tex
\begin{cases} 1 & \mbox{if $x>0$,} \\ 2 & \mbox{otherwise.} \end{cases}\n\n \n \n \n 1\n \n \n \n if\n \n \n x\n >\n 0\n \n ,\n \n \n \n \n \n 2\n \n \n \n otherwise.\n \n \n \n \n
```
--------------------------------
### Command Usage (Optional Arg)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing usage of a defined command with an optional argument.
```LaTeX
\newcommand{\test}[1][]{Hello #1}\test[There]
```
```LaTeX
Hello There
```
--------------------------------
### Function with Subscript
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-maxima-tests.txt
Demonstrates function notation with subscripts.
```TeX
\assumeSymbol{f_n}{function} $f_n(x)$
f[n](x)
```
--------------------------------
### Set membership with addition: x+A \in B
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Shows set membership with an addition expression.
```tex
x+A \in B
x
+
A
∈
B
```
--------------------------------
### Empty Cases
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Tests for various 'empty' cases in MathML up-conversion.
```latex
\frac{}{}
```
```mathml
```
--------------------------------
### Hyphen and link handling
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Tests the conversion of different hyphen types and the \href command.
```latex
Hello - There
Hello - There
====
```
```latex
Hello -- There
Hello – There
====
```
```latex
Hello --- There
Hello — There
====
```
```latex
Hello|There
Hello—There
====
```
```latex
\href[My Web Site]{http://www.ph.ed.ac.uk/~dmckain}
My Web Site
====
```
```latex
\href{urn:x#a}
urn:x#a
====
```
```latex
\href{urn:x%20b}
urn:x%20b
====
```
```latex
\anchor{susan}
====
```
--------------------------------
### Function Application Over Fences
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Tests for function application binding with expressions inside fences.
```latex
\sin(x+y) z
```
```mathml
sin
x
+
y
z
```
```latex
\sin \cos x
```
```mathml
sin
cos
x
```
--------------------------------
### New Environment with Incomplete Usage
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/simple-error-tests.txt
Tests the definition of a new environment and its incomplete usage, expecting an error.
```tex
\newenvironment{test}{Start}{End}\begin{test}
```
--------------------------------
### Space Handling
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Tests for how spaces are handled, including suppression of implicit multiplication.
```latex
\,
```
```mathml
```
```latex
x\,y
```
```mathml
x
y
```
```latex
x\,y\,z
```
```mathml
x
y
z
```
```latex
\sin x\,y
```
```mathml
sin
x
y
```
--------------------------------
### Empty Math
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing empty math mode $ $.
```LaTeX
Empty $ $
```
```MathML
Empty Maths
```
--------------------------------
### Nested Macro Calls
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Shows how nested macro calls are expanded.
```LaTeX
\newcommand{\test}[1]{#1#1}\test{\test{Hello}}
```
--------------------------------
### Verbatim Command with Text
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \verb|x| with surrounding text.
```LaTeX
This is \verb|x| some verbatim
```
```HTML
This is x some verbatim
```
--------------------------------
### New Environment with Empty Name
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/simple-error-tests.txt
Tests defining a new environment with an empty name, expecting an error.
```tex
\newenvironment{}{}{}
```
--------------------------------
### New Environment Definition with Errors
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/simple-error-tests.txt
Tests the definition of a new environment with invalid syntax, expecting an error.
```tex
\newenvironment{test}{\bad}{You}\begin{test}Hello\end{test}
```
--------------------------------
### Change to Bold Text (bf command)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing changing to bold text with \bf command.
```LaTeX
Change to \bf Bold Text
```
```HTML
Change to Bold Text
```
--------------------------------
### Test case: Undefined new environment
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/simple-error-tests.txt
A test case for an undefined \newenvironment, expected to produce TTEUE0 error.
```plaintext
\newenvironment
TTEUE0
====
```
--------------------------------
### Thin Space
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing thin space with \,.
```LaTeX
This is\,thin space
```
```HTML
This is thin space
```
--------------------------------
### Pathological triple negation: \neg \neg \neg
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Illustrates a pathological case of triple negation.
```tex
\neg \neg \neg
¬
¬
¬
```
--------------------------------
### Nested Command Usage with More Text
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing nested command usage followed by more text.
```LaTeX
# 1 2 3 4
#1234567890123456789012345678901234567890123456789012345
\newcommand{\test}[1]{Hello #1}\test{\test{There}} More
```
```LaTeX
Hello Hello There More
```
--------------------------------
### Inference of Apply Function on Inverses and Powers
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Tests for inference of apply function on inverses and powers of functions.
```latex
\sin^{-1} x
```
```mathml
sin
-1
x
```
```latex
\sin^{2} x
```
```mathml
sin
2
x
```
```latex
\log_a x
```
```mathml
log
a
x
```
```latex
\log_a^2 x
```
```mathml
log
a
2
x
```
--------------------------------
### Set union and difference: A \cup B \setminus C
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Represents a combination of set union and difference.
```tex
A \cup B \setminus C
A
∪
B
∖
C
```
--------------------------------
### Nested Itemize
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing nested \begin{itemize}.
```LaTeX
\begin{itemize} \item \begin{itemize} \item A \end{itemize} \end{itemize}
```
```HTML
```
--------------------------------
### Exponential Function
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-maxima-tests.txt
Demonstrates conversion of the exponential function e^x.
```TeX
\assumeSymbol{e}{exponentialNumber} $e^x$
exp(x)
```
--------------------------------
### Command Usage (One Arg)
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing usage of a defined command with one argument.
```LaTeX
\newcommand{\test}[1]{Hello #1}\test{There}
```
```LaTeX
Hello There
```
--------------------------------
### Handling of special characters and commands
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Demonstrates how snuggletex converts various LaTeX special characters and commands into their HTML or MathML equivalents.
```latex
Hello{\rm There}
HelloThere
====
\underline{Hello}
Hello
====
```
```latex
$\underline{x}$
====
```
```latex
1% Following
1% Following
====
```
```latex
1$\$$ Following
1$ Following
====
```
```latex
1# Following
1# Following
====
```
```latex
1& Following
1& Following
====
```
```latex
1_ Following
1_ Following
====
```
```latex
{Hello}
{Hello}
====
```
```latex
${x}$
====
```
--------------------------------
### Comma operator: a,b
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Demonstrates the comma operator, often used for tuples or sequences.
```tex
a,b
a
b
```
--------------------------------
### Test case: Unknown begin environment
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/simple-error-tests.txt
A test case with an unknown \begin environment, expected to produce TTEE02 error.
```plaintext
\begin{bob}
TTEE02
====
```
--------------------------------
### Test case: New environment with invalid content
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/simple-error-tests.txt
A test case for \newenvironment with invalid content, expected to produce TTEUE6 error.
```plaintext
## Regression: partner of TTEUE5
\newenvironment{x}{}{#1}\begin{x}\end{x}
TTEUE6...
====
```
--------------------------------
### Verbatim Command with Asterisk
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \verb*!Verbatim With Space! with asterisk.
```LaTeX
\verb*!Verbatim With Space!
```
```HTML
Verbatim␣With␣Space
```
--------------------------------
### Factorial as exponent
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-cmathml-tests.txt
Shows the MathML for a factorial operator used as an exponent.
```tex
x^{!}
x
```
--------------------------------
### Environment Redefinition
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Illustrates redefining an environment and its effect on subsequent usage.
```LaTeX
\newenvironment{test}{A}{B}\renewenvironment{test}{C}{D}\begin{test}Hello\end{test}
```
--------------------------------
### Empty \textrm handling
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/math-tests.txt
Tests the handling of empty \textrm, which generated empty until version 1.2.0.
```tex
\textrm{}\n
```
--------------------------------
### Verbatim Command
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Testing \verb|x|.
```LaTeX
\verb|x|
```
```HTML
x
```
--------------------------------
### Set union with addition: A \cup x+A
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-upconversion/src/test/resources/math-upconversion-pmathml-tests.txt
Shows set union with an addition expression.
```tex
A \cup x+A
A
∪
x
+
A
```
--------------------------------
### Macro Expanding to Mathematical Function
Source: https://github.com/davemckain/snuggletex/blob/development_1_2_x/snuggletex-core/src/test/resources/line-tests.txt
Demonstrates a macro representing a mathematical function.
```LaTeX
\newcommand{\test}{\sin}$\test x$
```