quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.59k stars 294 forks source link

German umlauts disappear in output when qmd-file contain R code chunks #6493

Closed tieying12 closed 7 months ago

tieying12 commented 11 months ago

Bug description

I have a qmd-file where the body contains text with german umlauts. Generating as output a pdf-file the umlauts are correct displayed. However if I insert a R code chunk in the qmd document the umlauts diappear in the pdf-file.

Steps to reproduce

`--- format: pdf: papersize: A4

pdf-engine: "pdflatex"

lang: de

execute: echo: false

Ich würde es über alle Maßen begrüßen


x <- 4

y <- x**x

Es wäre schön, wenn dies auch gehen würde.`

Expected behavior

Expected output in pdf document:

Ich würde es über alle Maßen begrüßen

Es wäre schön, wenn dies auch gehen würde.


I get this result when I remove the R code chunk

Actual behavior

output in pdf document:

Ich wrde es ber alle Ma<9f>en begr<9f>en

Es wre schn, wenn dies auch gehen wrde.1

Your environment

-IDE: Rstudio 2023.06.1 Build 524

Quarto check output

[✓] Checking versions of quarto binary dependencies... Pandoc version 3.1.1: OK Dart Sass version 1.55.0: OK [✓] Checking versions of quarto dependencies......OK [✓] Checking Quarto installation......OK Version: 1.3.433 Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK Version: 3.11.4 (Conda) Path: /home/hubert/anaconda3/bin/python Jupyter: 5.3.0 Kernels: haskell, ir, julia-1.8, tm, python3, xonsh

mcanouil commented 11 months ago

Thanks for the report!

Could you format your code properly? Thanks.

You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````).

````qmd
---
title: "Reproducible Quarto Document"
format: html
---

This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.

```{r}
plot(cars)

The end.

tieying12 commented 11 months ago

Here is the Quarto document with R code chunk included:

---
format: 
  pdf: 
    papersize: A4

pdf-engine: "pdflatex"

lang: de

execute:
  echo: false
---

Ich würde es über alle Maßen begrüßen

```{r include=FALSE}

x <- 4

y <- x**x

Es wäre schön, wenn dies auch gehen würde.



Attached are the results with R code chunk included (test1.pdf) and without (test2.pdf)

[test1.pdf](https://github.com/quarto-dev/quarto-cli/files/12321812/test1.pdf)
[test2.pdf](https://github.com/quarto-dev/quarto-cli/files/12321813/test2.pdf)
mcanouil commented 11 months ago

I believe your LaTex Installation is faulty. I just edited a bit the code to make it more clear and Quarto-like.

include: true include: false
image image
tieying12 commented 11 months ago

Thank you for your hint and for the clarification. When I worked with knitR and rmd-files I had never problems so I wrongly assumed my TeX Live installation is working correctly in any case.

mcanouil commented 11 months ago

To note, I am using TinyTex which can be install by Quarto.

tieying12 commented 11 months ago

When I uninstalled my TeXLive and installed TinyTex with Quarto I got the same strange behaviour. While rendering with knitR the corresponding Rmd file I get a correct pdf output, but when rendering the qmd file with Quarto all Umlauts disappear. Meanwhile I found the cause. My R version was installed with linuxbrew. When I uninstalled R und reinstalled it using apt, everything works fine. It seems that Quarto has some problems when R and RStudio are installed by different tools, however knitR still works fine.

github-actions[bot] commented 10 months ago

Thank you for using Quarto and reporting an issue!

Unfortunately, this issue is now considered stale because it has been opened since 14 days without providing a "working" reproducible example to help us investigate. If you are still facing the issue, please review the "Bug Reports" guide on how to provide a fully reproducible example as a self-contained Quarto document or a link to a Git repository. Without a reproducible example, it is unlikely that the issue will be addressed.

You can share a Quarto document using the following syntax, i.e., using more backticks than you have in your document (usually four ````).

````qmd
---
title: "Reproducible Quarto Document"
format: html
---

This is a reproducible Quarto document using `format: html`.
It is written in Markdown and contains embedded R code.
When you run the code, it will produce a plot.

```{r}
plot(cars)

The end.