Diagnosing R package build warning: "LaTeX errors when creating PDF version"

RError HandlingPackage

R Problem Overview


When building a package, I received the following warning:

* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typically indicates Rd problems.

I have no idea how to even begin diagnosing this. Is there a tool that tells me what .Rd file the problem is in?

I get no warnings about any of my Rd files in the checking documentation step....

R Solutions


Solution 1 - R

Try R CMD Rd2pdf mypackage to create the manual, and possibly also set the --no-clean option to keep the temporary files. This should allow you to debug the LaTeX code triggering the error.

Solution 2 - R

Though @Dirk's answer also helped me to fix the problem I would like to add a bit which might especially help recent updaters. That is, people who haven't encountered other LaTeX / R troubles after the update to 3.1.3 yet. The problem is little bit more general than just building. For me, on OS X the problem was that R CMD Rd2pdf as well as the R CMD CHECK expected texi2dvi to be in /usr/local/bin while it was in /usr/bin. A symlink helped to fix the problem. On terminal type:

# to check whether the same issue exists for you
which texi2dvi
# if so
cd /usr/local/bin
ln -s /usr/bin/texi2dvi

Of course if the first line returns something else, you need to adapt the symlink here.

Solution 3 - R

Concluding from the comments and from my own experience the problem often seems to be that some TeX fonts are missing, most often

  • inconsolata.sty and
  • upquote.sty

First you have to find the right directory where TeX fonts are stored - in my case this is:

C:\Program Files\R\R-3.3.0\share\texmf\tex\latex

Then you can download them here:

Just copy them to the respective folder and in many cases the problem will be solved (in my case too). This should work for all operating systems.

Solution 4 - R

...and another reason is that you haven't installed MikTex yet.

  1. Download MikTex from here and follow the dialog prompts to install. I found the defaults to be reasonable and worked well for me.

  2. Try to build your R package again. It should be OK now.

Solution 5 - R

If you are on Ubuntu just install Tex Live by this command: apt-get install texlive and restart Rstudo if you use it.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAri B. FriedmanView Question on Stackoverflow
Solution 1 - RDirk EddelbuettelView Answer on Stackoverflow
Solution 2 - RMatt BannertView Answer on Stackoverflow
Solution 3 - RvonjdView Answer on Stackoverflow
Solution 4 - RhackRView Answer on Stackoverflow
Solution 5 - RkoralgoollView Answer on Stackoverflow