Tidyverse 1.2.1 knitting to PDF issue

Hi I can knit PDF files in my mac under tidyverse version 1.1.1. When I updated to tidyverse 1.2.1 the following error is generated and the rendering stops. If I reinstall version 1.1.1 the rendering works again and PDF files are generated. Is there a fix for this? The exact error is below:

! Package inputenc Error: Unicode char √ (U+221A)
(inputenc) not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type H for immediate help.
...

l.570 \end{verbatim}

Try running pandoc with --latex-engine=xelatex.
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
Execution halted

This is independent of the code in the script and it happens with multiple scripts.

Thank you.

Paco

See this post:

3 Likes

I changed the rendereing to Xelatex in RStudio and redering does not work. What is interesting is that the same code works with tidyverse 1.1.1 in LaTex. In other words, the same code renders correctly to PDF if I install tidyverse 1.1.1.

Does the error message change? Also, can you post an example document that fails with just the YAML header you use and a section loading tidyverse?

The other thread on this issue (Can't render tidyverse 1.2 startup message in LaTex) makes it more clear that the error is due to library(tidyverse) printing out messages that include characters that the default latex_engine can't support.

This stung me this morning and I don't want to switch latex_engines, if you don't need the messages to appear here are two solutions:

  1. suppressMessages on the library call
    suppressMessages(library("tidyverse"))

  2. Prevent the code chunk from printing messages

suppressMessages(library("tidyverse"))
2 Likes

Or 3) use message = FALSE in the knitr chunk.

3 Likes

@hadley, any plans to alter the tidyverse package to remove the Unicode or change the RStudio default PDF template to use the xelatex engine? I'd personally lean towards the latter (under the assumption that making the default handle Unicode documents is the Right Thing), but I don't use PDF output enough for my opinion to mean anything. It seems like inserting library(tidyverse) should "just work" with the default templates, even if suppressing the messages makes sense in most cases.

1 Like

https://github.com/r-lib/cli/issues/34 :wink:

Changing to xelatex would be a big change.

1 Like

Bah, forgot to check upstream when looking for existing issues. Thanks for the link!

suppressMeassages(library(tidyverse)) did the trick. Now the rendering works.

Thank you.

paco

Good suggestion, this works as well. Just a small typo; it should be message = FALSE