Equations in r package documentation do not work
Asked Answered
T

2

0

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?

Tamarra answered 5/3, 2019 at 8:43 Comment(0)
B
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.

Biltong answered 5/3, 2019 at 8:50 Comment(1)
Damn, I forgot that this is expected. Shame on me.Tamarra
N
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.

Nitrous answered 5/3, 2019 at 8:50 Comment(0)
B
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.

Biltong answered 5/3, 2019 at 8:50 Comment(1)
Damn, I forgot that this is expected. Shame on me.Tamarra

© 2022 - 2024 — McMap. All rights reserved.