yonicd/texPreview

Soft deprecate buildUsepackage

gadenbuie opened this issue · 6 comments

It seems that f3ad95d deprecated camel case spelling for buildUsepackage() and getTexPackages() in favor of snake case.

I'm all for the change, but the hard deprecation will break old code without warning and without notice (also there's no NEWS entry for this). I noticed this issue when developing scripts that were breaking in different versions of rocker's R docker images.

I strongly recommend keeping an alias for the old names around for a little while longer with an appropriate warning message.

Sorry, I did revdeps and didn't think I was compromising anyone on the change. I'll add the alias with a depreciation message.

Are you depending on CRAN version or GH version?

you can try this one commit to see if it fills your need. 23f2024. I'll merge in a few days after checking it a bit more.

That looks great, thanks! We're using texPreview() in a Shiny app, so we're out of view of revdep. I haven't tested it but looking at the source I don't see any reason why 23f2024 wouldn't work.

Another thing I noticed was that it seems that previously texPreview() would embed tex_lines in the LaTeX document headers if those aren't provided, but now those lines are linked to via \input{ <stem>.tex }. Was this a change in the package or is it related to my system? If it was a change on the package side, would you consider adding an option to embed the tex_lines in the final output file? Or is there an easier way to get the full .tex output file?

do you mean this?

texPreview::tex_preview(obj = xtable::xtable(head(iris,10)),returnType = 'tex')
#>  [1] "\\begin{table}[ht]"                                                        
#>  [2] "\\centering"                                                               
#>  [3] "\\resizebox{\\textwidth}{!}{\\begin{tabular}{rrrrrl}"                      
#>  [4] "  \\hline"                                                                 
#>  [5] " & Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species \\\\ "
#>  [6] "  \\hline"                                                                 
#>  [7] "1 & 5.10 & 3.50 & 1.40 & 0.20 & setosa \\\\ "                              
#>  [8] "  2 & 4.90 & 3.00 & 1.40 & 0.20 & setosa \\\\ "                            
#>  [9] "  3 & 4.70 & 3.20 & 1.30 & 0.20 & setosa \\\\ "                            
#> [10] "  4 & 4.60 & 3.10 & 1.50 & 0.20 & setosa \\\\ "                            
#> [11] "  5 & 5.00 & 3.60 & 1.40 & 0.20 & setosa \\\\ "                            
#> [12] "  6 & 5.40 & 3.90 & 1.70 & 0.40 & setosa \\\\ "                            
#> [13] "  7 & 4.60 & 3.40 & 1.40 & 0.30 & setosa \\\\ "                            
#> [14] "  8 & 5.00 & 3.40 & 1.50 & 0.20 & setosa \\\\ "                            
#> [15] "  9 & 4.40 & 2.90 & 1.40 & 0.20 & setosa \\\\ "                            
#> [16] "  10 & 4.90 & 3.10 & 1.50 & 0.10 & setosa \\\\ "                           
#> [17] "   \\hline"                                                                
#> [18] "\\end{tabular}}"                                                           
#> [19] "\\end{table}"                                                              
#> [20] ""

readLines(file.path(tempdir(),'tex_temp.tex'))
#>  [1] "\\begin{table}[ht]"                                                        
#>  [2] "\\centering"                                                               
#>  [3] "\\resizebox{\\textwidth}{!}{\\begin{tabular}{rrrrrl}"                      
#>  [4] "  \\hline"                                                                 
#>  [5] " & Sepal.Length & Sepal.Width & Petal.Length & Petal.Width & Species \\\\ "
#>  [6] "  \\hline"                                                                 
#>  [7] "1 & 5.10 & 3.50 & 1.40 & 0.20 & setosa \\\\ "                              
#>  [8] "  2 & 4.90 & 3.00 & 1.40 & 0.20 & setosa \\\\ "                            
#>  [9] "  3 & 4.70 & 3.20 & 1.30 & 0.20 & setosa \\\\ "                            
#> [10] "  4 & 4.60 & 3.10 & 1.50 & 0.20 & setosa \\\\ "                            
#> [11] "  5 & 5.00 & 3.60 & 1.40 & 0.20 & setosa \\\\ "                            
#> [12] "  6 & 5.40 & 3.90 & 1.70 & 0.40 & setosa \\\\ "                            
#> [13] "  7 & 4.60 & 3.40 & 1.40 & 0.30 & setosa \\\\ "                            
#> [14] "  8 & 5.00 & 3.40 & 1.50 & 0.20 & setosa \\\\ "                            
#> [15] "  9 & 4.40 & 2.90 & 1.40 & 0.20 & setosa \\\\ "                            
#> [16] "  10 & 4.90 & 3.10 & 1.50 & 0.10 & setosa \\\\ "                           
#> [17] "   \\hline"                                                                
#> [18] "\\end{tabular}}"                                                           
#> [19] "\\end{table}"                                                              
#> [20] ""

Created on 2018-11-09 by the reprex package (v0.2.1)

By the way. For shinyapps we put in returnType ‘html’, which returns a magick object. It should be simpler to use in shiny now.

You can use the vignettes as a guide for interactive environments.
https://metrumresearchgroup.github.io/texPreview/articles/rmarkdown.html

soft deprecation (with single session warning) merged 9e104b2