Debian Codegraph @

lib/mlrisc-lib/MLRISC/Doc/latex/mltex.tex

raw
1 \section{\MLTeX}
2 \newdef{\MLTeX} is a special \newdef{\LaTeX} package for writing
3 \MLRISC{} documentation. It is similar to the
4 \newdef{latex2html}~\cite{latex2html} tool
5 except that \MLTeX{} has special environments for documenting
6 Standard ML code. In addition, there is an accompanying tool
7 called \newdef{mltex2html} for generating HTML pages.
8 This page, for example, is formatted by \MLTeX.
9
10 \subsection{Macros}
11
12 Environments defined in \MLTeX{} are:
13 \begin{description}
14 \item[SML] This environment is used to display MLRISC code.
15 For example,
16 \begin{verbatim}
17 \begin{SML}
18 datatype 'a tree =
19 EMPTY
20 | LEAF of 'a
21 | NODE of 'a * 'a tree * 'a tree
22 \end{SML}
23 \end{verbatim}
24 generates:
25 \begin{SML}
26 datatype 'a tree =
27 EMPTY
28 | LEAF of 'a
29 | NODE of 'a * 'a tree * 'a tree
30 \end{SML}
31
32 \item[methods] This environment can be used to document a list of
33 methods to an interface. For example,
34 \begin{verbatim}
35 \begin{methods}
36 \sml{+ : int * int -> int} & addition \\
37 \sml{- : int * int -> int} & subtraction \\
38 \sml{* : int * int -> int} & multiplication \\
39 \sml{/ : int * int -> int} & division \\
40 \end{methods}
41 \end{verbatim}
42 generates:
43 \begin{methods}
44 \sml{+ : int * int -> int} & addition \\
45 \sml{- : int * int -> int} & subtraction \\
46 \sml{* : int * int -> int} & multiplication \\
47 \sml{/ : int * int -> int} & division \\
48 \end{methods}
49 \end{description}
50
51 Macros defined in \MLTeX{} are:
52 \begin{description}
53 \item[sml] This macro can be used inline for formating SML code fragment.
54 For example the fragment
55 \begin{verbatim}
56 \begin{quotation}
57 \begin{tabular}{l}
58 \sml{val toString : int -> string} \\
59 \sml{val map : ('a -> 'b) -> 'a list -> 'a list}
60 \end{tabular}
61 \end{quotation}
62 \end{verbatim}
63 \noindent is formated as:
64 \begin{quotation}
65 \begin{tabular}{l}
66 \sml{val toString : int -> string} \\
67 \sml{val map : ('a -> 'b) -> 'a list -> 'a list}
68 \end{tabular}
69 \end{quotation}
70 \item[href] This macro generates a html hypertext link to a
71 page within the same logical document. For example, we can say
72 \begin{verbatim}
73 \href{url}{text}
74 \end{verbatim}
75 \item[mlrischref] This macro generates a html hypertext link to MLRISC
76 code. The general syntax is:
77 \begin{verbatim}
78 \mlrischref{path}{text}
79 \end{verbatim}
80 The \verb|path| parameter is a relative path in the MLRISC hierarchy.
81 \item[externhref]
82 This macro generates an external hypertext link to a document outside
83 of the same logical document. The general syntax is:
84 \begin{verbatim}
85 \externhref{url}{text}
86 \end{verbatim}
87 \item[newdef] This macro defines a new term. The general syntax is
88 \begin{verbatim}
89 \newdef{text}
90 \end{verbatim}
91 \end{description}
92
93 \subsection{Other Stuff}
94 In addition to the above, \MLTeX{} understands the following \LaTeX{}
95 environments and macros, and will translate them into HTML equivalents.
96 \begin{verbatim}
97 \begin{itemize} \end{itemize}
98 \begin{description} \end{description}
99 \begin{enumerate} \end{enumerate}
100 \verb
101 \begin{tabular} \end{tabular}
102 \begin{figure} \end{figure} \caption
103 \begin{wrapfigure} \end{wrapfigure}
104 \section \subsection \subsubsection \paragraph
105 \ref \label
106 \noindent \linebreak
107 \psfig
108 \end{verbatim}
109
110 \subsection{Bugs and Shortcomings}
111 There are too many to list. But the things to watch for are:
112 \begin{itemize}
113 \item A macro and all its arguments must appear in the same line.
114 \item The tool can get confused if too many macros appear on the same line.
115 \item Nesting of macros may not be handled correctly.
116 \item Math mode is not robust.
117 \end{itemize}
118
119 Please send bug fixes and comments to
120 \href{mailto:[email protected]}{Allen Leung}.