davidgohel / flextable

table farming
https://ardata-fr.github.io/flextable-book/
557 stars 80 forks source link

"Package pdftex.def Error: File" with flextable #196

Closed wolski closed 4 years ago

wolski commented 4 years ago

I hope this is my errror and the issue can be resolved fast.

I have a markdown file test.Rmd with just this content:

```{r}
library(flextable)
flextable(cars)
```

and I would like to render it to pdf. This is the error I get:

> rmarkdown::render("test.Rmd", output_format = "pdf_document")

processing file: test.Rmd
  |................................................................                                                                 |  50%
  ordinary text without R code

  |.................................................................................................................................| 100%
label: unnamed-chunk-1

output file: test.knit.md

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output test.tex --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --lua-filter "C:/Users/wolski/Documents/R/win-library/3.6/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Users/wolski/Documents/R/win-library/3.6/rmarkdown/rmd/lua/latex-div.lua" --variable "geometry:margin=1in" 
! Package pdftex.def Error: File `test_files/figure-latex/unnamed-chunk-1-1.png
' not found: using draft setting.

Error: LaTeX failed to compile test.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See test.log for more info.

I just updated all packages from CRAN

SeesionInfo:


> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                            LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] flextable_0.5.9

loaded via a namespace (and not attached):
  [1] tidyselect_1.0.0     lme4_1.1-21          RSQLite_2.2.0        AnnotationDbi_1.46.1 htmlwidgets_1.5.1    grid_3.6.1          
  [7] pROC_1.16.1          munsell_0.5.0        codetools_0.2-16     LFQService_0.1.5     DT_0.12              miniUI_0.1.1.1      
 [13] Brobdingnag_1.2-6    colorspace_1.4-1     WebGestaltR_0.4.3    Biobase_2.44.0       ggfortify_0.4.9      knitr_1.28          
 [19] uuid_0.1-4           rstudioapi_0.11      stats4_3.6.1         officer_0.3.7        brms_2.12.0          bayesplot_1.7.1     
 [25] rstan_2.19.3         bit64_0.9-7          pheatmap_1.0.12      bridgesampling_1.0-0 coda_0.19-3          vctrs_0.2.3         
 [31] generics_0.0.2       TH.data_1.0-10       xfun_0.12            fastcluster_1.1.25   R6_2.4.1             markdown_1.1        
 [37] doParallel_1.0.15    bitops_1.0-6         reshape_0.8.8        assertthat_0.2.1     promises_1.1.0       scales_1.1.0        
 [43] multcomp_1.4-12      gtable_0.3.0         processx_3.4.2       sandwich_2.5-1       rlang_0.4.5          systemfonts_0.1.1   
 [49] splines_3.6.1        lazyeval_0.2.2       broom_0.5.5          inline_0.3.15        yaml_2.2.1           reshape2_1.4.3      
 [55] abind_1.4-5          modelr_0.1.6         threejs_0.3.3        crosstalk_1.0.0      backports_1.1.5      httpuv_1.5.2        
 [61] rsconnect_0.8.16     tools_3.6.1          ggplot2_3.3.0        MCMCvis_0.13.5       gplots_3.0.3         RColorBrewer_1.1-2  
 [67] BiocGenerics_0.30.0  ggridges_0.5.2       Rcpp_1.0.3           plyr_1.8.5           base64enc_0.1-3      purrr_0.3.3         
 [73] ps_1.3.2             prettyunits_1.1.1    S4Vectors_0.22.0     zoo_1.8-7            haven_2.2.0          ggrepel_0.8.1       
 [79] fs_1.3.1             tinytex_0.20         apcluster_1.4.8      magrittr_1.5         data.table_1.12.8    quantable_0.3.8     
 [85] lmerTest_3.1-1       reactome.db_1.68.0   colourpicker_1.0     reprex_0.3.0         mvtnorm_1.1-0        whisker_0.4         
 [91] packrat_0.5.0        matrixStats_0.55.0   hms_0.5.3            shinyjs_1.1          mime_0.9             fgczgseaora_0.1.0   
 [97] evaluate_0.14        xtable_1.8-4         shinystan_2.5.0      readxl_1.3.1         IRanges_2.18.1       gridExtra_2.3       
[103] rstantools_2.0.0     testthat_2.3.2       compiler_3.6.1       tibble_2.1.3         KernSmooth_2.23-15   crayon_1.3.4        
[109] minqa_1.2.4          StanHeaders_2.21.0-1 htmltools_0.4.0      later_1.0.0          heatmap3_1.1.7       tidyr_1.0.2         
[115] lubridate_1.7.4      DBI_1.1.0            dbplyr_1.4.2         MASS_7.3-51.4        boot_1.3-24          Matrix_1.2-17       
[121] readr_1.3.1          cli_2.0.2            gdata_2.18.0         parallel_3.6.1       igraph_1.2.4.2       forcats_0.5.0       
[127] pkgconfig_2.0.3      numDeriv_2016.8-1.1  plotly_4.9.2         xml2_1.2.2           foreach_1.4.8        dygraphs_1.1.1.6    
[133] svglite_1.2.3        rngtools_1.5         webshot_0.5.2        rvest_0.3.5          doRNG_1.8.2          stringr_1.4.0       
[139] callr_3.4.2          digest_0.6.25        rmarkdown_2.1        cellranger_1.1.0     gdtools_0.2.1        sigora_3.0.5        
[145] shiny_1.4.0.1        gtools_3.8.1         nloptr_1.2.2         lifecycle_0.2.0      nlme_3.1-144         jsonlite_1.6.1      
[151] viridisLite_0.3.0    limma_3.40.6         fansi_0.4.1          pillar_1.4.3         lattice_0.20-38      loo_2.2.0           
[157] GGally_1.4.0         fastmap_1.0.1        httr_1.4.1           pkgbuild_1.0.6       survival_3.1-8       GO.db_3.8.2         
[163] glue_1.3.1           xts_0.12-0           zip_2.0.4            UpSetR_1.4.0         shinythemes_1.1.2    iterators_1.0.12    
[169] bit_1.1-15.2         stringi_1.4.6        blob_1.2.1           org.Hs.eg.db_3.8.2   caTools_1.18.0       memoise_1.1.0       
[175] dplyr_0.8.4          tidyverse_1.3.0     
> 
davidgohel commented 4 years ago

I don't think you send the correct information. How can you have 176 loaded packages with only flextable loaded? The fast resolution you are hoping is then compromised ;)

I can not reproduce, I ran a more complex example:

rmarkdown::render(system.file(package = "flextable", "examples/rmd/demo.Rmd"), output_format = "pdf_document", output_dir = ".")

demo.pdf

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.3

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] fr_FR.UTF-8/fr_FR.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] data.table_1.12.8 magrittr_1.5      flextable_0.5.9   knitr_1.28       

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        xml2_1.2.2        uuid_0.1-4        R6_2.4.1          rlang_0.4.5       stringr_1.4.0    
 [7] tools_3.6.1       webshot_0.5.2     packrat_0.5.0     xfun_0.12         tinytex_0.20      htmltools_0.4.0  
[13] systemfonts_0.1.1 yaml_2.2.1        digest_0.6.25     processx_3.4.2    zip_2.0.4         officer_0.3.7    
[19] callr_3.4.2       base64enc_0.1-3   ps_1.3.2          evaluate_0.14     rmarkdown_2.1     stringi_1.4.6    
[25] compiler_3.6.1    gdtools_0.2.1     jsonlite_1.6.1
wolski commented 4 years ago

Just upgraded to 3.6.3 and reinstalled my packages and it works. Thanks for the greate package. Closing issue.

davidgohel commented 4 years ago

Oh, OK

BTW, in case of, webshot is used by default to create the png, if possible, use webshot2. That's far better.

See https://davidgohel.github.io/flextable/articles/offcran/images.html

David

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.