daqana / tikzDevice

A R package for producing graphics output as PGF/TikZ code for use in TeX documents.
https://daqana.github.io/tikzDevice
132 stars 26 forks source link

List of LuaTeX packages in documentation outdated #204

Open ChristianDerricks opened 4 years ago

ChristianDerricks commented 4 years ago

By using options(tikzDefaultEngine = 'luatex') there is a problem with calculating the character m, I am also aware that there are a few older posts about that. This is more a report on how to solve some symptoms and give hints for the developers to fix it. Currently, I have TexLive2019 (vanilla) and tikzDevice (0.12.3) installed. Building is done with TeXstudio (2.12.6) on Linux.

Solving the (my) problem was possible by removing

"\usepackage{fontspec,xunicode}\n"

from tikzLualatexPackages settings. The problem with xunicode can be explained by the error messages that xunicode currently only supports xelatex, however this package is selected by default if tikzLualatexPackages is selected (see manual on page 6).

What does work for me are the following settings for tikzLualatexPackages and tikzUnicodeMetricPackages.

options(tikzLualatexPackages =c("\RequirePackage{luatex85}\n", "\usepackage{tikz}\n", "\usetikzlibrary{calc}\n", "\usepackage{pgf}\n", "\usepackage{amssymb}\n", "\usepackage{amsfonts}", "\usepackage[utf8]{inputenc}\n" "\usepackage[active,tightpage,psfixbb]{preview}\n", "\PreviewEnvironment{pgfpicture}\n" ) )

options(tikzUnicodeMetricPackages = c("\usepackage[utf8]{inputenc}", "\RequirePackage{luatex85}\n", "\usetikzlibrary{calc}", "\usepackage{amssymb}" ) )

Hopefully, this helps to solve this special problem.

rstub commented 4 years ago

Can you provide a minimal example that demonstrates your problem? Using luatex works for me:

library(tikzDevice)
options(tikzDefaultEngine = 'luatex')
tikzTest("m")
#> 
#> Active compiler:
#>  /usr/bin/lualatex
#>  This is LuaTeX, Version 1.10.0 (TeX Live 2019/Debian)
#>  
#> Measuring dimensions of: m
#> Running command: '/usr/bin/lualatex' -interaction=batchmode -halt-on-error -output-directory '/tmp/Rtmp2RrM3m/tikzDevicefae70e27118' 'tikzStringWidthCalc.tex'
#> [1] 8.33298

Created on 2020-02-02 by the reprex package (v0.3.0)

Session info ``` r devtools::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 3.6.2 (2019-12-12) #> os Debian GNU/Linux bullseye/sid #> system x86_64, linux-gnu #> ui X11 #> language en_US:en #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz Europe/Berlin #> date 2020-02-02 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [3] CRAN (R 3.6.1) #> backports 1.1.5 2019-10-02 [3] CRAN (R 3.6.1) #> callr 3.4.0 2019-12-09 [3] CRAN (R 3.6.1) #> cli 2.0.1 2020-01-08 [1] CRAN (R 3.6.1) #> crayon 1.3.4 2017-09-16 [3] CRAN (R 3.5.0) #> desc 1.2.0 2018-05-01 [3] CRAN (R 3.5.0) #> devtools 2.2.1 2019-09-24 [2] CRAN (R 3.6.1) #> digest 0.6.23 2019-11-23 [3] CRAN (R 3.6.1) #> ellipsis 0.3.0 2019-09-20 [2] CRAN (R 3.6.1) #> evaluate 0.14 2019-05-28 [3] CRAN (R 3.6.1) #> fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.1) #> filehash 2.4-2 2019-04-17 [3] CRAN (R 3.6.1) #> fs 1.3.1 2019-05-06 [2] CRAN (R 3.6.1) #> glue 1.3.1 2019-03-12 [3] CRAN (R 3.6.1) #> highr 0.8 2019-03-20 [3] CRAN (R 3.6.1) #> htmltools 0.4.0 2019-10-04 [3] CRAN (R 3.6.1) #> knitr 1.26.4 2020-01-14 [1] Github (yihui/knitr@b80ece1) #> magrittr 1.5 2014-11-22 [3] CRAN (R 3.5.0) #> memoise 1.1.0 2017-04-21 [3] CRAN (R 3.5.0) #> pkgbuild 1.0.6 2019-10-09 [3] CRAN (R 3.6.1) #> pkgload 1.0.2 2018-10-29 [3] CRAN (R 3.5.1) #> prettyunits 1.1.0 2020-01-09 [1] CRAN (R 3.6.1) #> processx 3.4.1 2019-07-18 [3] CRAN (R 3.6.2) #> ps 1.3.0 2018-12-21 [3] CRAN (R 3.5.2) #> R6 2.4.1 2019-11-12 [3] CRAN (R 3.6.1) #> Rcpp 1.0.3 2019-11-08 [3] CRAN (R 3.6.1) #> remotes 2.1.0 2019-06-24 [3] CRAN (R 3.6.1) #> rlang 0.4.2 2019-11-23 [3] CRAN (R 3.6.1) #> rmarkdown 2.1 2020-01-20 [3] CRAN (R 3.6.2) #> rprojroot 1.3-2 2018-01-03 [3] CRAN (R 3.5.0) #> sessioninfo 1.1.1 2018-11-05 [3] CRAN (R 3.5.1) #> stringi 1.4.5 2020-01-11 [1] CRAN (R 3.6.1) #> stringr 1.4.0 2019-02-10 [3] CRAN (R 3.5.2) #> testthat 2.3.1 2019-12-01 [3] CRAN (R 3.6.1) #> tikzDevice * 0.12.3 2019-08-07 [3] CRAN (R 3.6.1) #> usethis 1.5.1 2019-07-04 [2] CRAN (R 3.6.1) #> withr 2.1.2 2018-03-15 [3] CRAN (R 3.5.0) #> xfun 0.12 2020-01-13 [2] CRAN (R 3.6.1) #> yaml 2.2.0 2018-07-25 [3] CRAN (R 3.5.1) #> #> [1] /home/ralf/R/x86_64-pc-linux-gnu-library/3.6 #> [2] /usr/local/lib/R/site-library #> [3] /usr/lib/R/site-library #> [4] /usr/lib/R/library ```

BTW, xunicode has not been used together with luatex for quite some time, c.f. https://github.com/daqana/tikzDevice/commit/44a8ca11d3bc1ecb46a31e2436f0b7e1e50c61a1. I need to update the documentation on this.

ChristianDerricks commented 4 years ago

Thanks for your response.

I believe there was a mistake on my side. First, I had some problems with tikzdevice 0.10.1 (version of the Linux package manager, R system library) and LuaLatex yesterday and updated to 0.12.3 (R user library). I also updated TexLive to the 2019 version yesterday. Using the manual and trying to narrow done the problem with version 0.10.1 led me to coping the configuration from the manual and using it with version 0.12.3 as well. The link you provided,however, shows that xunicode was removed with version 0.10.2. (making my system version off by one), which in the end caused some of the confusion.

To make it short: I can reproduce your mwe and with the same result.

rstub commented 4 years ago

Great! I have renamed the issue so that I do not forget about the error in the documentation.