Subscript of math equation in R documentation
Asked Answered
P

2

15

I'm trying to insert an equation in to an R documentation such that:

\deqn{p_{x}(1)=Pr(y=1|x)}

but it does come out as I expected where x is a subscript of p.

Does anybody know the reason OR how to subscript p in R documentation?

Pearce answered 7/4, 2014 at 17:8 Comment(0)
J
17

The subscript will only render properly in the pdf version of your documentation, the HTML version is ASCII only as far as I know. To provide both a latex version of your equation for the pdf as well as a simplified equation for the html help, you can use both arguments of \deqn{<<latex>>}{<<plain>>}. Take a look for example at the documentation of the `geigen package for a few examples of providing both:

\deqn{A x = \lambda Bx}{A*x = lambda B*x}
\deqn{(A,B) = (Q S Z^H, Q T Z^H)}{(A,B) = (Q*S*Z^H, Q*T*Z^H)}
Janettjanetta answered 7/4, 2014 at 18:1 Comment(1)
In addition to basic ASCII, the HTML version can produce Greek letters and a few other symbols such as the square root sign. I'm not sure how this gets rendered in the terminal if you view the help directly from a command in R.Left
E
5

You can do

\ifelse{html}{\out{p_<sub>x</sub>(1)=Pr(y=1|x)}}{\eqn{p_x(1)=Pr(y=1|x)}}
Electrostatics answered 4/9, 2017 at 14:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.