# MLTEX

 MLTEX
Macros
Other Stuff
Bugs and Shortcomings
MLTEX is a special LATEX package for writing MLRISC documentation. It is similar to the latex2html[latex2html] tool except that MLTEX has special environments for documenting Standard ML code. In addition, there is an accompanying tool called mltex2html for generating HTML pages. This page, for example, is formatted by MLTEX.

## Macros

Environments defined in MLTEX are:
SML
This environment is used to display MLRISC code. For example,
    \begin{SML}
datatype 'a tree =
EMPTY
|  LEAF of 'a
|  NODE of 'a * 'a tree * 'a tree
\end{SML}

generates:
       datatype 'a tree =
EMPTY
|  LEAF of 'a
|  NODE of 'a * 'a tree * 'a tree

methods
This environment can be used to document a list of methods to an interface. For example,
   \begin{methods}
\sml{+ : int * int -> int} &  addition \\
\sml{- : int * int -> int} &  subtraction \\
\sml{* : int * int -> int} &  multiplication \\
\sml{/ : int * int -> int} &  division \\
\end{methods}

generates:
+ : int * int -> int
- : int * int -> int
subtraction
* : int * int -> int
multiplication
/ : int * int -> int
division

Macros defined in MLTEX are:

sml
This macro can be used inline for formating SML code fragment. For example the fragment
   \begin{quotation}
\begin{tabular}{l}
\sml{val toString : int -> string}  \\
\sml{val map : ('a -> 'b) -> 'a list -> 'a list}
\end{tabular}
\end{quotation}

is formated as:
 val toString : int -> string val map : ('a -> 'b) -> 'a list -> 'a list
href
This macro generates a html hypertext link to a page within the same logical document. For example, we can say
    \href{url}{text}

mlrischref
This macro generates a html hypertext link to MLRISC code. The general syntax is:
    \mlrischref{path}{text}

The path parameter is a relative path in the MLRISC hierarchy.
externhref
This macro generates an external hypertext link to a document outside of the same logical document. The general syntax is:
     \externhref{url}{text}

newdef
This macro defines a new term. The general syntax is
     \newdef{text}


## Other Stuff

In addition to the above, MLTEX understands the following LATEX environments and macros, and will translate them into HTML equivalents.
   \begin{itemize} \end{itemize}
\begin{description} \end{description}
\begin{enumerate} \end{enumerate}
\verb
\begin{tabular} \end{tabular}
\begin{figure} \end{figure} \caption
\begin{wrapfigure} \end{wrapfigure}
\section \subsection \subsubsection \paragraph
\ref \label
\noindent \linebreak
\psfig


## Bugs and Shortcomings

There are too many to list. But the things to watch for are:
• A macro and all its arguments must appear in the same line.
• The tool can get confused if too many macros appear on the same line.
• Nesting of macros may not be handled correctly.
• Math mode is not robust.