开发者

Mathematical notion/superscripts in Rd files

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


Nowadays, people mainly use the HTML help.

To get the superscript in the HTML help as well as in the PDF help, do:

\ifelse{html}{\out{2<sup>x</sup>}}{\eqn{2^x}}

The syntax is:

\ifelse{html}{\out{HTML CODE}}{\eqn{LATEX-LIKE CODE}{ASCII}}

with {ASCII} optional.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜