views:

43

answers:

1

I'm working on filling in an Rd file for a function.

When I use \eqn{2^{x}} in the Details section, then build and install the package, there is no superscripted exponent.

Looking at R-exts.pdf, it points to Poisson.Rd as an example on how to use \eqn or \deqn. In the example in that file, there is a superscripted exponent.

When I look at the help file for Poisson (?Poisson), There are no superscripted exponents.

Is this an issue on my computer or is this standard behavior?

Thanks!

> sessionInfo()
R version 2.11.1 (2010-05-31) 
i386-apple-darwin9.8.0 

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] cimis_0.1-3    RLastFM_0.1-4  RCurl_1.4-2    bitops_1.0-4.1 XML_3.1-0      lattice_0.18-8

loaded via a namespace (and not attached):
[1] grid_2.11.1  tools_2.11.1
A: 

You don't say where you looked to see if there was a superscripted exponent. I presume the text based help, not the PDF version of the manual?

The syntax for the \eqn macro is \eqn{latex}{ascii}. The {ascii} bit is optional, in which case R will do it's best to render the LaTeX version. Conventionally, subscripts in ASCII would be wrapped in [] and superscipts with ^.

So I would write:

\eqn{2^{x}}{2^x}

But in all practical senses these are the same. The issue is just that the text help can't display superscipts, but the PDF can.

Gavin Simpson
In the pdf it is fine - I thought that it would render in the OS X R.app help viewer with the exponent. (non)Problem solved.
Greg
For text-based help, use `[ ]` and `^` as best you can in `{ascii}` part of the `\eqn`. That is the best you can achieve in that format.
Gavin Simpson