yonicd/texPreview

use TinyTex with texPreview?

jrosen48 opened this issue · 9 comments

Thanks for a great package! I am trying to use {texPreview} with the {tinytex} R package/LaTeX installation, and - perhaps as you might guess - seem to be running into some issues. Do you recommend that I stick with MiKTeX? Am I missing something highly obvious?

what error are you getting? can you it reprex incl sessioninfo ?

Sorry, should have done that to begin.

library(texPreview)
library(xtable)
tex_preview(obj = xtable(head(iris,10)))
#>  [1] "This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex 2019.5.30)  30 MAY 2019 21:11"
#>  [2] "entering extended mode"                                                                                                 
#>  [3] " restricted \\write18 enabled."                                                                                         
#>  [4] " %&-line parsing enabled."                                                                                              
#>  [5] "**/private/var/folders/hq/mqp7vd_n6_570bmbl4ly4wkm2ykyrz/T/RtmpjtAHn3/tex_tempD"                                        
#>  [6] "oc.tex"                                                                                                                 
#>  [7] ""                                                                                                                       
#>  [8] "(/private/var/folders/hq/mqp7vd_n6_570bmbl4ly4wkm2ykyrz/T/RtmpjtAHn3/tex_tempDo"                                        
#>  [9] "c.tex"                                                                                                                  
#> [10] "LaTeX2e <2018-04-01> patch level 5"                                                                                     
#> [11] ""                                                                                                                       
#> [12] "! LaTeX Error: File `standalone.cls' not found."                                                                        
#> [13] ""                                                                                                                       
#> [14] "Type X to quit or <RETURN> to proceed,"                                                                                 
#> [15] "or enter new name. (Default extension: cls)"                                                                            
#> [16] ""                                                                                                                       
#> [17] "Enter file name: "                                                                                                      
#> [18] "! Emergency stop."                                                                                                      
#> [19] "<read *> "                                                                                                              
#> [20] "         "                                                                                                              
#> [21] "l.2 \\usepackage"                                                                                                       
#> [22] "               [usenames,dvispnames,svgnames,table]{xcolor}^^M "                                                        
#> [23] "Here is how much of TeX's memory you used:"                                                                             
#> [24] " 11 strings out of 494587"                                                                                              
#> [25] " 414 string characters out of 6176888"                                                                                  
#> [26] " 51819 words of memory out of 5000000"                                                                                  
#> [27] " 3744 multiletter control sequences out of 15000+600000"                                                                
#> [28] " 3640 words of font info for 14 fonts, out of 8000000 for 9000"                                                         
#> [29] " 14 hyphenation exceptions out of 8191"                                                                                 
#> [30] " 10i,0n,8p,161b,8s stack positions out of 5000i,500n,10000p,200000b,80000s"                                             
#> [31] ""                                                                                                                       
#> [32] "!  ==> Fatal error occurred, no output PDF file produced!"
#> Error in tex_image(obj, stem, write_flag, overwrite): pdf not rendered
sessionInfo
sessionInfo()
#> R version 3.5.2 (2018-12-20)
#> Platform: x86_64-apple-darwin15.6.0 (64-bit)
#> Running under: macOS Mojave 10.14.1
#> 
#> Matrix products: default
#> BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] xtable_1.8-3     texPreview_1.3.2
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.1       rstudioapi_0.9.0 knitr_1.21       rematch2_2.0.1  
#>  [5] xml2_1.2.0       whisker_0.3-2    magrittr_1.5     rlang_0.3.4     
#>  [9] stringr_1.4.0    highr_0.7        tools_3.5.2      xfun_0.5        
#> [13] htmltools_0.3.6  yaml_2.2.0       digest_0.6.18    tibble_2.1.1    
#> [17] crayon_1.3.4     base64enc_0.1-3  evaluate_0.12    rmarkdown_1.11  
#> [21] stringi_1.4.3    compiler_3.5.2   pillar_1.3.1     magick_2.0      
#> [25] svgPanZoom_0.3.3 pkgconfig_2.0.2
Created on 2019-05-30 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1)

seeing that you're on macos run this from the terminal: tlmgr install standalone. that should work things out for you.

Ah thanks. In addition to standalone, also had to install:

  • varwidth
  • xcolor
  • colortbl
  • multirow

This seemed to work until I got to:

  • helvet

This seemed to require installing GnuPG, but, that didn't seem to do the trick:

(base) MBP:~ joshuarosenberg$ tlmgr install helvet
tlmgr: package repository http://mirrors.ibiblio.org/pub/mirrors/CTAN/systems/texlive/tlnet (verified)
tlmgr install: package helvet not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: An error has occurred. See above messages. Exiting.

Sorry, I know this isn't related to the package. Any ideas?

The helvet package is part of the psnfss package, so you need to run tlmgr install psnfss and it should work.

I think you can install fonts-extra and things should work out.

sudo apt-get install -y texlive-base texlive-latex-base texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra

Which is basically how we got the container on travis to work for testing.

Hi all, thanks.

Regarding psnfss (@andrewheiss), thanks, that worked.

After that, I seemed to also have to install:

listings
setspace

After installing those, I tried again, but different issue seemed to emerge...

texPreview::tex_preview(obj = xtable::xtable(head(iris, 10)))
#> Error in magick_image_readpath(path, density, depth, strip): Magick: FailedToExecuteCommand `'gs' -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 '-sDEVICE=pngalpha' -dTextAlphaBits=4 -dGraphicsAlphaBits=4 '-r150x150'  '-sOutputFile=/var/folders/zn/9_h784cn6t5b2tchsgx4v2p00000gn/T//RtmpPcvdOp/magick-5206tp76OSGaEeyO%d' '-f/var/folders/zn/9_h784cn6t5b2tchsgx4v2p00000gn/T//RtmpPcvdOp/magick-5206Oxg8V8HVabh1' '-f/var/folders/zn/9_h784cn6t5b2tchsgx4v2p00000gn/T//RtmpPcvdOp/magick-5206x0koAzYystEl'' (1) @ error/pdf.c/InvokePDFDelegate/292

Created on 2019-05-31 by the reprex package (v0.2.1)

Regarding installing fonts-extra (@yonicd), is there a comparable brew command (is apt-get available for macos users? sorry for my ignorance w/r/t the issues here ... it is great and vast and I appreciate your help).

no problem. sorry that getting this to work on your system has been so hard :(.

you can replace apt-get install with tlmgr install.

re that error. can you check what version of imagemagick you have installed? convert -version you may need to update that installation and reinstall the {magick}

You can do fonts-extra with tlmgr install collection-fontsextra, but I don't think you need it. It installs like a billion extra fonts, and I cancelled it early (it had made it to the Bs in the alphabet after a long while)