%%- \documentclass[a4paper,12pt]{article}
%%- \usepackage{a4}%------ ##--- (so I can print it '2on1' ...)
%%- 
%%- \begin{document}
%%- \author{Paul Murrell \\ Statistics, Auckland, NZ}
%%- \date{Sept.~11, 1997}
%%- 
%%- \title{Documentation for \\
%%- Mathematical Annotation in $R$}
%%- \maketitle

%%- \author{Paul Murrell \\ Statistics, Auckland, NZ}
%%- \date{Sept.~11, 1997}
%%- 
%%- \title{%
%%- Documentation for \\
%%- Mathematical Annotation in $R$}
%%- \maketitle
If the {\tt text} argument to one of the text-drawing functions ({\tt
text}, {\tt mtext}, {\tt axis}) in \R\ is an expression, the argument
is interpreted as a mathematical expression and the output will be
formatted according to \TeX -like rules.

A mathematical expression must obey the normal rules of syntax for
any \R\ expression, but it is interpreted according to very
different rules than for normal \R\ expressions.

\begin{description}
\item[binary operators]  addition, subtraction, multiplication, and
division use the standard \R\ syntax, although multiplication only
juxtaposes the arguments.  For example, {\tt a+b}, {\tt a-b}, and {\tt
a/b}, produce $a+b$, $a-b$, and $a/b$, but {\tt a*b} produces $ab$.

\item[unary operators]  positive and negative numbers are specified
with standard syntax.  For example, {\tt +x} produces $+x$ and {\tt
-y} produces $-y$.

\item[subscripts and superscripts]  a subscript is specified
using the subsetting syntax and a superscript is specified using
the power syntax.  For example, {\tt x[i]} produces
$x_i$ and {\tt x\^{}2} produces $x^2$.

\item[accents] accented expressions are specified using the special
mathematical functions {\tt hat} and {\tt bar}.  For example, {\tt
hat(x)} produces $\hat x$ and {\tt bar(x)} produces $\bar x$.

\item[fractions] fractions are specified using the special
mathematical function {\tt frac} (or its alias, {\tt over}). 
For example, {\tt frac(1,2)} produces $1\over2$.  

\item[relations]  equality or assignment of terms is specified using
the {\tt ==} relation.  For example, {\tt x == y} produces $x=y$.

\item[visible grouping]  terms are visibly grouped by placing them
within parentheses.  For example, {\tt (x+y)} produces $(x+y)$.

\item[invisible grouping]  terms are invisibly grouped by placing
them within curly braces. For example \verb|x^{2*y}| produces
$x^{2y}$, whereas {\tt x\^{}2*y} produces $x^2y$.

\item[big operators]  a sum, product, or integral is specified using
the special mathematical function of the corresponding name.  Each
of these functions takes three arguments;  the first indicates what
is being summed/multiplied/integrated and the second and third specify
the limits of the summation/product/integral.  For example, {\tt
sum(x[i], i==0, n)} produces $\sum\limits_{i=0}^n x_i$.

\item[radicals]  a square root expression is specified using the
special mathematical functions {\tt root} and {\tt sqrt}.  For
example, {\tt sqrt(x)} produces $\sqrt x$.

\item[absolute values]  an absolute term is specified using the
special mathematical function {\tt abs}.  For example, {\tt abs(x)}
produces $\left|x\right|$.

\item[juxtaposition]  multiple terms are juxtaposed using the special
mathematical function {\tt paste}.  For example, {\tt paste(over(b,
2), y, sum(x))} produces ${b\over2} y \sum x$.

\item[typeface changes]  the default font in mathematical expressions
is italic (except for terms which are symbols).  A new typeface is
specified using the special mathematical functions {\tt bold}, {\tt
italic}, {\tt plain}, and {\tt bolditalic}.  For example, {\tt
plain(X)[i]} produces ${\rm X}_i$. These font specifications do not
accumulate (i.e., {\tt bold(italic(x)))} produces $x$ (an italic "x"),
whereas {\tt bolditalic(x)} produces \textit{\textbf{x}} (a bold, italic "x").

\item[general expressions]  any functional expression which is not a
special mathematical function is simply reproduced as a function
expression.  For example, {\tt foo(x)} produces $foo(x)$.


\end{description}

%%- \end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: Man.tex
%%% End:
