# [Rd] typesetting a matrix in an Rd file

Robin Hankin r.hankin at noc.soton.ac.uk
Thu Sep 21 11:05:42 CEST 2006

Hello everybody

I'm trying to write an Rd file so that the resulting LaTeX-ed document
includes a matrix.

Here is the line in question:

\deqn{
E_\theta\left(
\begin{array}{cc}
1 & x\theta\\
x\theta & x^2\theta^2
\end{array}\right)
}{ommitted: see dvi}

which looks OK to me; the contents of the first curly brace
produce the desired matrix in a regular .tex file.

But it doesn't produce the desired matrix when included
in an Rd file: on my system the ampersands show up
literally, and the whole equation is on one line. I
suspect that the backslashes and ampersands are
being escaped somehow, and TeX isn't interpreting
them as desired.

How do I write an Rd file so that the output of R CMD Rd2dvi
includes a nicely typeset matrix?

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
tel  023-8059-7743