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

前端 未结 5 1373
南方客
南方客 2020-12-07 20:28

When building a package, I received the following warning:

* checking PDF version of manual ... WARNING
LaTeX errors when creating PDF version.
This typicall         


        
相关标签:
5条回答
  • 2020-12-07 21:16

    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.

    0 讨论(0)
  • 2020-12-07 21:16

    ...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.

    0 讨论(0)
  • 2020-12-07 21:17

    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:

    • https://www.ctan.org/tex-archive/fonts/inconsolata/?lang=en
    • https://www.ctan.org/tex-archive/macros/latex/contrib/upquote?lang=en

    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.

    0 讨论(0)
  • 2020-12-07 21:31

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

    0 讨论(0)
  • 2020-12-07 21:33

    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.

    0 讨论(0)
提交回复
热议问题