Skip to content

[R-pkg-devel] LaTeX packages available for documentation?

5 messages · Ben Bolker, Duncan Murdoch, Uwe Ligges

#
I'm trying to figure out if the list of LaTeX packages that can be 
expected to be available *when building PDF versions of man pages* is 
documented/available somewhere.

  One of my co-authors is a bit enthusiastic about complex math 
expressions in the man pages, e.g. using \dfrac (from the amsmath 
package) and \mathscr (from the mathrsfs package). These are OK in HTML 
version of the docs (now that LaTeX is allowed), but throw an error when 
building the PDF manuals.

   I think this will probably turn out to be a case of "'doctor, it 
hurts when I do this.' 'Well, then, don't do that.'" (i.e., remove fancy 
LaTeX markup from man pages), but I'm curious.

   cheers
    Ben Bolker

PS


   I've looked at these sections of the documentation:

https://cran.r-project.org/doc/manuals/R-exts.html#Writing-portable-packages
https://cran.r-project.org/doc/manuals/R-exts.html#Checking-packages
https://cran.r-project.org/doc/manuals/R-admin.html#Making-the-manuals

   and have searched for packages in the R sources:

$ find . -type f -exec grep "^.usepackage" {} \; | sort | uniq
\usepackage{a4wide}
\usepackage{amsmath}
\usepackage[authoryear,round]{natbib}
\usepackage{color}
\usepackage{fullpage}
\usepackage{fullpage}% save trees ;-)
\usepackage{graphicx, Rd}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{myVignette}
\usepackage[pdftex]{graphicx}
\usepackage{Rd}
\usepackage{Rd, parskip, amsmath, enumerate}
\usepackage[round]{natbib}
\usepackage{Sweave}


   weirdly, amsmath is included here, but it's only used in vignettes -- 
seems puzzling but plausible that package availability would be 
different for building vignettes vs. man pages ... ??
#
I don't know if the LaTeX packages are fully documented, but there is 
some info in the R Admin manual in section 2.4 "Installation".  That 
might just apply to R, not contributed packages.

One way to figure it out is to ask R to convert an Rd file to pdf, and 
save the .tex file.  When I do that, I see that it uses or requires the 
following packages:

   Rd
   makeidx
   inputenc
   graphicx (maybe?  commented out in the example I ran)

and Rd.sty requires these (some conditionally), as seen in R sources 
share/texmf/tex/latex/Rd.sty:

   ifthen
   longtable
   hyperref
   bm
   alltt
   verbatim
   url
   textcomp
   iftex
   fontenc
   times
   lmodern
   beramono
   zi4
   inconsolata

Since these are gleaned from the source, they are likely subject to change.
On 03/09/2022 4:09 p.m., Ben Bolker wrote:
#
Thanks.  Feels like a request for including amsmath in Rd.sty might 
not be out of order (since presumably most TeX installations will have 
it if they have all of that other stuff, and since it might be a 
one-line change to the R source code ...)
On 2022-09-03 4:41 p.m., Duncan Murdoch wrote:

  
    
#
On 03/09/2022 4:45 p.m., Ben Bolker wrote:
Yes, I agree.

Duncan Murdoch
1 day later
#
On 03.09.2022 23:41, Duncan Murdoch wrote:
This is under discussion for some time now.  Although, there are some 
issues that adding amsmath witll break some packages and also requires 
minor changes in R. This will likely make it to R-devel shortly, perhaps 
also R-patched.

Best,
Uwe Ligges