[R-pkg-devel] How to write a 'cases' environment in .Rd files?
Deepayan Sarkar
deep@y@n@@@rk@r @end|ng |rom gm@||@com
Fri Aug 12 05:56:46 CEST 2022
On Fri, Aug 12, 2022 at 12:14 AM Marius Hofert <marius.hofert using uwaterloo.ca>
wrote:
> 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:
>
Yes, the PDF refmans don't support amsmath (so no \begin{pmatrix},
\begin{cases}, etc.), although \pmatrix and \cases are supported. KaTeX has
it the other way around.
Unfortunately there is no nice workaround at the moment. Even if the PDF
version begins supporting \begin{cases} by including amsmath, \cases will
stop working, and your package will need to depend on a very recent R.
Possibly the only practical workaround is to use more basic LaTeX
constructs such as \begin{array}.
Best,
-Deepayan
>
> ...
> * 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
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list