rich-iannone / DiagrammeR

Graph and network visualization using tabular data in R
https://rich-iannone.github.io/DiagrammeR/
Other
1.7k stars 246 forks source link

DiagrammeR cannot make \grViz output as PDF in R v 4.0.x #409

Open jsgro opened 4 years ago

jsgro commented 4 years ago

This is a reproducible error in Mac/Linux/Windows with R 4.0.x but not R 3.6.3

On Mac /Linux (inside various Docker images) there is an error preventing the making of PDF:

I was unable to find any missing LaTeX packages from the error log Untitled4.log.
! LaTeX Error: Environment grViz undefined.

On Windows there is no error reported but the graph is not created at all.

However, all are OK in HTML and in R 3.6.3 all worked OK in PDF as well.

The grViz environment is a puzzling thing... and it is not created in the Windows version (hence PDF output but no graph.)

I have posted this issue on Stack Overflow first: https://stackoverflow.com/questions/62856190/error-with-r-version-4-0-2-but-not-in-r-version-3-6-3-with-diagrammr-latex-er

For lack of answer I then pushed up to Yihui Latex issue page: https://github.com/yihui/tinytex/issues/230 that I have annotated multiple time with examples.

This ZIP file test1-files.zip contains output .tex for Mac/Linux/Windows for R 4.0.x and one for R 3.6.3 for which the test1_files folder is created.

├── test1-MacOS-MOjave-4.0.2.tex
├── test1-MacOS-Mojave-R.3.6.3..pdf
├── test1-MacOS-Mojave-R.3.6.3.tex
├── test1-Windows-10-R4.0.2.tex
├── test1-docker-rocker-vers-4.0.2.tex
├── test1.Rmd
└── test1_files
    └── figure-latex
        └── unnamed-chunk-2-1.pdf

All details on the various tests to reproduce the error are on https://github.com/yihui/tinytex/issues/230

I am wondering if others are getting these errors too.

jsgro commented 4 years ago

SOLVED thank to Yihui's answer. Problem was due to some changes in Markdown. See his answer in https://github.com/yihui/tinytex/issues/230

SUMMARY if you have this problem:

  1. update with remotes::install_github('rstudio/rmarkdown')
  2. Also run webshot::install_phantomjs()

After that the PDF is created and the \grViz environment no longer is part of the .tex file.