Greek Unicode in Rmarkdown (2023 question)

Hello!
I have a bookdown book some greek symbols inline. I tried to add them as unicode, and also in the visual RStudio (insert>special characters). It looks like this

TNF- ⍺

Looks fine in word and HTML, but not in PDF. If I do the standard pdfLaTeX there is a unicode error, if I change to

output:
  html_document: default
  word_document: default
  pdf_document:
    latex_engine: xelatex

it knits, but the unicode alpha doesnt show. I also tried to add a font which solved this similar question a few years ago, but didn't work for me :frowning:

mainfont: Arial
monofont: "Courier New"
monofontoptions: "Scale=0.7"

Even if I replace the ⍺ with \alpha or even $\alpha$ it doesn't show.

Any ideas?
Thanks!

Try doing a toy document with just \alpha as content and this is the YAML

---
site: "bookdown::bookdown_site"
output:
  bookdown::gitbook:
    lib_dir: "book_assets"
  bookdown::pdf_book:
    keep_tex: yes
---

(not pdf_document if you are doing bookdown

No luck, it doesnt knit :frowning:
Error:

output file: dell.knit.md

! LaTeX Error: Unicode character α (U+03B1)
               not set up for use with LaTeX.

Error: LaTeX failed to compile dell.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See dell.log for more info.
Execution halted

I has had a similar problem recently and I could not resolve it with Rstudio (I posted an issue for kind of unrelated package Writing equations in the response · Issue #1 · pjbouchet/respondR · GitHub). What I did at the end, I editted the resulting docx file and insert greek symbols and some math formulas manually

That narrows the problem to the somewhat more limited area of the LaTeX version. Hopefully, you just need to

install.packages("tinytex")

if you get an error with

library(tinytex)

If that doesn't work, please provide

sessionInfo()

results.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.