[R-pkg-devel] How to write a 'cases' environment in .Rd files?

Marius Hofert m@r|u@@ho|ert @end|ng |rom uw@ter|oo@c@
Thu Aug 11 20:43:44 CEST 2022


Hi,

For quite some time my .Rd files had 'cases' environments like these:

\deqn{F(x) = \cases{
1,&if x > 0,\cr
0,&if x = 0.\cr}}{...}

Since recently, r-devel-linux-x86_64-debian-clang and r-devel-linux-x86_64-debian-gcc trigger the note 'Undefined control sequence: \cases in F(x) = \cases{...', possibly due to KaTeX rendering help pages. I looked around quite a bit but couldn't find a way to implement 'cases' environments. For example, https://katex.org/docs/supported.html#environments mentions \begin{cases} \end{cases}, so I tried

\deqn{F(x) = \begin{cases}
1,&\text{if}\ x > 0,\\
0,&\text{if} x = 0.}}{...}

but that triggers:

...
* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.
LaTeX errors found:
! Misplaced alignment tab character &
....

What is the proper way (is there one?) to get displayed 'cases' environments in .Rd files?

Thanks & cheers,
Marius


More information about the R-package-devel mailing list