R-alpha: Mathematical Annotation in R (plots)

Paul Murrell paul@stat.auckland.ac.nz
Thu, 11 Sep 1997 13:28:47 +1200 (NZST)


	[[ this has first bounced to me as 'list-manager', because the
	   subject said  ``Returned mail: User unknown''
	   Paul, I assume you'd approve the subject I've chosen...
	   -- Martin M 
	]]

 hi
 
 for those who are interested ...
 
 the following is a LaTeX document which describes the current state of
 mathematical expression syntax in R
 
 paul
 
 ------CUT HERE---------------------------------------------
 
 \documentstyle{article}
 \begin{document}
 
 \section*{Documentation for \\
 Mathematical Annotation in $R$}
 
 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 over}. For example, {\tt over(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 {\tt 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}

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-