[Rd] Possible bug in the Rd parser?
Mathieu Ribatet
mathieu.ribatet at epfl.ch
Sun Oct 11 12:57:18 CEST 2009
Thanks Duncan for all these answers. Indeed I should have checked that
the "cases" environment was provided by Rd.sty. Mea culpa.
The good point is that before 2.10.0 alpha "R CMD check" finished
without any error but the output was wrong - because of the cases
environment as you said. Now it fails and this is a good point as I,
maybe others??, usually don't have a look at "mypkg-manual.pdf" but only
at the html version of it.
Cheers,
Mathieu
Le samedi 10 octobre 2009 à 20:40 +0200, Duncan Murdoch a écrit :
> On 10/10/2009 2:25 PM, Duncan Murdoch wrote:
> > On 10/10/2009 8:07 AM, Mathieu Ribatet wrote:
> >> Dear list,
> >>
> >> I got an automatic email complaining than some of my packages didn't
> >> pass 'R CMD check' for R-2.10.0 alpha anymore. Both of them make use of
> >> the "cases" LaTeX environment.
> >>
> >> Inspecting the log outputs I got:
> >>
> >> LaTeX errors when creating PDF version.
> >> This typically indicates Rd problems.
> >> LaTeX errors found:
> >> ! Misplaced alignment tab character &.
> >>
> >> I noticed that the Rd parser changed quite recently and that '#', '_'
> >> and '&' must not be escaped according to "Writing R extensions".
> >> However, the problematic .Rd portion seems (to me) OK
> >>
> >> \deqn{\theta(h) =
> >> \begin{cases}
> >> u_\beta \left(\mu + \frac{\nu(h)}{\Gamma(1 - \xi)}
> >> \right),&\xi \neq 0\\
> >> \exp\left(\frac{\nu(h)}{\sigma}\right),&\xi = 0
> >> \end{cases}
> >> }{u_beta (mu + nu(h) / Gamma(1 - \xi)), if \xi < 1,
> >> exp(nu(h)/sigma), otherwise}
> >>
> >
> > One more followup: the problem appears to be in the "cases"
> > environment. If I rewrite that block using "array" instead, things are
> > fine:
> >
> > \deqn{\theta(h) =
> > \left\{\begin{array}{ll}
> > u_\beta \left(\mu + \frac{\nu(h)}{\Gamma(1 - \xi)}
> > \right),&\xi \neq 0\\
> > \exp\left(\frac{\nu(h)}{\sigma}\right),&\xi = 0
> > \end{array}\right.
> > }{u_beta (mu + nu(h) / Gamma(1 - \xi)), if \xi < 1,
> > exp(nu(h)/sigma), otherwise}
> >
> > This makes me think it's a bug in the LaTeX package that provides
> > "cases", or a conflict with our Rd.sty file, but I don't know which.
>
> And the final answer: the "cases" environment is in the amsmath
> package, which is not used by R. You need to use regular LaTeX, not
> fancy stuff like that. (There's a \cases macro in LaTex, which doesn't
> know what to do with alignment tabs: that's why you got the error you did.)
>
> Duncan Murdoch
--
Institute of Mathematics
Ecole Polytechnique Fédérale de Lausanne
STAT-IMA-FSB-EPFL, Station 8
CH-1015 Lausanne Switzerland
http://stat.epfl.ch/
Tel: + 41 (0)21 693 7907
More information about the R-devel
mailing list