Warm tip: This article is reproduced from serverfault.com, please click

Adding Greek letters to LaTeX code while creating documentation for an R package

发布于 2017-08-16 15:39:19

I'm making a new package for R and I want to include the table generated by the following code in the documentation:

\tabular{cccc}{
sign beta \tab sign gamma \tab K \tab g \cr
+ \tab + \tab 0 \tab -1 \cr
+ \tab - \tab -2pi \tab 1 \cr
- \tab + \tab -pi \tab 1 \cr
- \tab - \tab -pi \tab -1
}

However, I would like the words 'beta', 'gamma' and 'pi' to be replaced by actual corresponding Greek letters. How can I do this? I've tried the following:

$\beta$

and the following:

$\\beta$

but it doesn't work. Any help would be greatly appreciated!

Questioner
J. Doe
Viewed
0
880 2020-11-30 19:16:16

If you wrap it in an equation macro like this \eqn{\gamma} it should work.

Further info in the roxygen2 vignette.

Also, additional information can be found in the Rd format documentation of the R Extensions page.