Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tikzDevice ignores engine passed via dev.args #2150

Closed
3 tasks done
fkohrt opened this issue Jul 24, 2022 · 2 comments
Closed
3 tasks done

tikzDevice ignores engine passed via dev.args #2150

fkohrt opened this issue Jul 24, 2022 · 2 comments
Labels
bug Bugs

Comments

@fkohrt
Copy link
Contributor

fkohrt commented Jul 24, 2022

When using tikzDevice as device when plotting with knitr and rmarkdown, there appear to be differences between using global options and chunk options for setting the PDF engine. I will demonstrate this with a R Markdown document with embedded PDF documents.

Setting engine = "luatex" has no effect when using the dev.args chunk option, the PDF metadata still indicate pdfTeX as creator:

---
title: "Setting PDF engine via chunk options"
output: html_document
---

```{r, dev-tikz, dev = "tikz", dev.args = list(engine = "luatex")}
par(mar = c(4, 4, 2, .1))
curve(dnorm, -3, 3, xlab = '$x$', ylab = '$\\phi(x)$',
      main = 'The density function of $N(0, 1)$')
text(-1, .2, cex = 3, col = 'blue',
  '$\\phi(x)=\\frac{1}{\\sqrt{2\\pi}}e^{\\frac{-x^2}{2}}$')
```

Only when setting the global option tikzDefaultEngine = "luatex", the metadata indicate LuaTeX as creator:

---
title: "Setting PDF engine via global options"
output: html_document
---

```{r}
options(tikzDefaultEngine = "luatex")
```

```{r, dev-tikz, dev = "tikz"}
par(mar = c(4, 4, 2, .1))
curve(dnorm, -3, 3, xlab = '$x$', ylab = '$\\phi(x)$',
      main = 'The density function of $N(0, 1)$')
text(-1, .2, cex = 3, col = 'blue',
  '$\\phi(x)=\\frac{1}{\\sqrt{2\\pi}}e^{\\frac{-x^2}{2}}$')
```

See also daqana/tikzDevice#214


By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('knitr'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('yihui/knitr').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

xfun::session_info('knitr')
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS, RStudio 2021.9.1.372

Locale:
  LC_CTYPE=en_US.UTF-8      
  LC_NUMERIC=C              
  LC_TIME=en_US.UTF-8       
  LC_COLLATE=en_US.UTF-8    
  LC_MONETARY=en_US.UTF-8   
  LC_MESSAGES=en_US.UTF-8   
  LC_PAPER=en_US.UTF-8      
  LC_NAME=C                 
  LC_ADDRESS=C              
  LC_TELEPHONE=C            
  LC_MEASUREMENT=en_US.UTF-8
  LC_IDENTIFICATION=C       

Package version:
  evaluate_0.15   glue_1.6.2      graphics_4.1.2 
  grDevices_4.1.2 highr_0.9       knitr_1.39     
  magrittr_2.0.3  methods_4.1.2   stats_4.1.2    
  stringi_1.7.8   stringr_1.4.0   tools_4.1.2    
  utils_4.1.2     xfun_0.31       yaml_2.3.5
@yihui yihui added the bug Bugs label Aug 10, 2022
@yihui yihui closed this as completed in 5481c3f Aug 10, 2022
@yihui
Copy link
Owner

yihui commented Aug 10, 2022

Should be fixed now. Thanks for the report!

@github-actions
Copy link

github-actions bot commented Feb 8, 2023

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs
Projects
None yet
Development

No branches or pull requests

2 participants