-
Notifications
You must be signed in to change notification settings - Fork 328
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
rmarkdown::render errors when compiling tex to pdf, with png figure created using python code in French locale #1498
Comments
this is an issue using current github version > rmarkdown::render("fig-size-bug.Rmd")
processing file: fig-size-bug.Rmd
output file: fig-size-bug.knit.md
/usr/bin/pandoc +RTS -K512m -RTS fig-size-bug.knit.md --to beamer --from markdown+autolink_bare_uris+tex_math_single_backslash --output fig-size-bug.tex --lua-filter /home/tdhock/lib/R/library/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /home/tdhock/lib/R/library/rmarkdown/rmarkdown/lua/latex-div.lua --highlight-style tango --pdf-engine pdflatex --self-contained
! Package keyval Error: 5in undefined.
Erreur : LaTeX failed to compile fig-size-bug.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See fig-size-bug.log for more info.
> system("grep 4,5 fig-size-bug.tex")
## [1] 4,5
\includegraphics[width=4,5in]{fig-size-bug_files/figure-beamer/unnamed-chunk-2-1}
> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /home/tdhock/miniconda3/envs/2023-08-artificial-intelligence/lib/libmkl_rt.so.2; LAPACK version 3.10.1
locale:
[1] fr_FR.UTF-8
time zone: America/Phoenix
tzcode source: system (glibc)
attached base packages:
[1] stats graphics utils datasets grDevices methods base
loaded via a namespace (and not attached):
[1] digest_0.6.33 fastmap_1.1.1 xfun_0.40
[4] Matrix_1.6-1.1 lattice_0.22-5 reticulate_1.34.0.9000
[7] knitr_1.44 htmltools_0.5.6.1 png_0.1-8
[10] rmarkdown_2.25.1 tinytex_0.48 cli_3.6.1
[13] grid_4.3.1 withr_2.5.1 compiler_4.3.1
[16] tools_4.3.1 evaluate_0.22 Rcpp_1.0.11
[19] yaml_2.3.7 rlang_1.1.1 jsonlite_1.8.7 |
I'm not sure this is reticulate issue, and it's not clear to me what we can do to fix it in reticulate. In I think this might be a |
cc @cderv |
Hi! first of all, thanks very much for supporting the reticulate package, which I find very useful.
I first tried filing this as rstudio/rmarkdown#2525 (comment) but @yihui says this should be filed here instead.
I am trying to render Rmd to beamer slides on a computer with LC_NUMERIC=fr_FR.UTF-8 meaning that the decimal separator prints as a comma (one half is 0,5).
I expected that I should be able to render rmarkdown to beamer slides, but I observe that there is an error.
The issue is that there is a line in the generated tex file which looks like
\includegraphics[width=4,5in]{figure}
and that is problematic because pdflatex interprets the comma as a separator between optional arguments in the [ ].The issue only happens when dev: png is specified in the yaml header.
The work-around that users can do, is to set LC_NUMERIC=C, and then the compilation works fine.
The fix I would suggest in the reticulate/rmarkdown package(s) is to set LC_NUMERIC=C while generating the
\includegraphics[width=4.5in]{figure}
line.Below is a minimal reproducible example R script (of course you have to change the
RETICULATE_PYTHON
line to wherever you have python with matplotlib installed)When running the code above on my system, the output is shown below:
Please note that in the grep command, the first 4,5 is expected, because I set the french locale in my Rmd, so I would like to see that in the generated R code chunk output blocks (but it should be 4.5 in the tex file includegraphics width line).
The text was updated successfully, but these errors were encountered: