I am working on an R
package and I am using the package Roxygen2
to write the help manuals for my R
functions. What I would like to know is if it is possible to use latex for math equations in the manual pages?
For example, if I had a function called add2
that did the following:
add2 = function(x,y){
z = x+y
return(z)
}
And using Roxygen2
documentation I had the following:
##' @include add2.R
{}
##' Compute the sum of x_1 and x_2
##'
##' Computes the sum of x_1 and x_2
##'
##' @param x_1 number of guys
##' @param x_2 number of girls
##' @return The sum of the two values x_1 and x_2
##'
##' @example examples/adding.R
##' @export
##' @author Name
And this works for me, but this displays x1 and x2 as x_1 and x_2 in the help manual whereas I would like for it to look like latex math and actually have the subscripts on x, i.e., $x_1$ and $x_2$ in latex.
Is there any way to do this or does R
not accomodate this?
\eqn
and\deqn
– Matchboard