[R-pkg-devel] [FORGED] Math symbols in .Rd files

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Thu Apr 23 04:57:03 CEST 2020


Thanks, Rolf. This is very helpful.

Actually, I'm not that concerned about latex --> pdf. It's the html
that I want rendered nicely. So I'll see is that \enc{...} approach
works and gets me through the CRAN checks.

Not that the package is a big deal anyway -- just something I hope
might be useful to a few folks on occasion.

Bert


On Wed, Apr 22, 2020 at 7:17 PM Rolf Turner <r.turner using auckland.ac.nz> wrote:
>
>
> On 23/04/20 11:03 am, Bert Gunter wrote:
>
> > OS: Mac OSX Catalina
> > R Version 3.6.3
> > UTF-8 declared as Encoding in DESCRIPTION file
> >
> > First, apologies: I'm nearly certain that this has been asked (many
> > times) before, and I think I know the answer. But I need to verify.
> >
> > \eqn{...} allows me to insert a few math symbols in .Rd files, but
> > does not seem to work for symbols equivalent to unicode U+00B0 (degree
> > sign) and U+00B1 (plus minus sign). That is \eqn{\pm } is not rendered
> > properly, and there is no degree sign for Latex without adding
> > packages.  I can enter these as Mac symbols (presumably using UTF-8
> > encoding)  and they render properly on my machine in the installed
> > package documentation. But CRAN's winbuilder doesn't like them with
> > error message:
> >
> > LaTeX errors found:
> > ! Package inputenc Error: Unicode char ≤ (U+2264)
> > (inputenc)                not set up for use with LaTeX.
> >
> > Are there any fixes/workarounds other than a fallback to plain text?
> >
> > Thanks. Again, my apologies for asking this again, but I just wanted
> > to be sure my understanding is correct -- or find out where I'm
> > confused.
>
> My understanding is that \eqn{...} doesn't really work with html, only
> with LaTeX.  You need to do something like:
>
> \eqn{\hat{\theta} \pm 1.96 \times SE}{theta.hat +/- 1.96*SE}
>
> which (for me at least) gives a nicely rendered result in LaTeX -> pdf
> and the kludgy workaround in html.
>
> As for the degree sign I find that \eqn{42^\circ} gives acceptable
> results in LaTeX, but of course doesn't work in html.
>
> My understanding is that if you enclose things like "±" or "°" in
> \enc{...} and have
>
> \encoding{UTF-8}
>
> as the very first line of your *.Rd file, then CRAN won't complain about
> the presence of these symbols.  But this doesn't work inside \eqn{...};
> there the "\enc{...}" gets rendered literally.
>
> So for html I think you are stuck with the kludgy fallback to plain text.
>
> cheers,
>
> Rolf
>
> --
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276



More information about the R-package-devel mailing list