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

Viewed 735

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!

3 Answers

As of roxygen2 version 6.0.0 (released early 2017) you can also place the characters directly into the text as they are left as is.

That is characters typed or pasted directly into the roxygen2 comment section like α, β and γ get rendered both within the internal R documentation and also in generated docs using tools such as pkgdown.

The change that determines this is the support of CommonMark described in the roxygen2 vignette, with the relevant section about the support of these characters available in the Commonmark Spec

\documentclass{article} \begin{document}

\begin{tabular}{cccc}
    \(\beta\)  &\(\gamma\) & \( \kappa\) & g \\
    &  & \( \theta\) &  -1 \\
    + & - & -2\(pi\)&  1\\ 
    - & + & -\(pi\)& 1 \\
    - & - & -\(pi\) & -1\\

\end{tabular} \end{document} Here I have used primitive form of tabulation. It works

Related