I'm using roxygen2 for my package description and I want to have mathematic equations in my documentation. For example I want to write n_{u} like a formula. When I write \eqn{n_{u}} in @details nothing happens but the text is italic. I document the package with control, shift and d and then i push "Clean and rebuild". Did I forget anything?
Asked
Active
Viewed 1,012 times
2 Answers
3
\eqn{n_u}
is for the PDF documentation.
Write that instead:
\ifelse{html}{\out{n<sub>u</sub>}{\eqn{n_u}}
The syntax is:
\ifelse{html}{\out{HTML CODE}}{\eqn{LATEX-LIKE CODE}{ASCII}}
with {ASCII}
optional is for the text documentation. HTML CODE
is for the HTML documentation, and LATEX-LIKE CODE
is for the PDF documentation.

Stéphane Laurent
- 75,186
- 15
- 119
- 225
1
This is expected behaviour. The R documentation format doesn't have "real" equations like you might get from Mathjax or another fully-fledged Latex engine; it uses a basic representation that just copies your equation text but sets it in italics. Think of it as more akin to code, rather than mathematical notation.

Hong Ooi
- 56,353
- 13
- 134
- 187
-
Damn, I forgot that this is expected. Shame on me. – TobiSonne Mar 05 '19 at 09:50