rlatexr-markdowntinytex

How to solve RMarkdown error after installing tinytex::install_tinytex()


I'm just trying creating a pdf file with RMardown and after installing the tinytex package as follows:

tinytex::install_tinytex()

If I set at the very top of the .RMd doc the following wording:

output:
  pdf_document: default
  latex_engine: xelatex

I get back this error

! Package inputenc Error: Unicode character σ (U+03C3) (inputenc) not set up for use with LaTeX.

Try other LaTeX engines instead (e.g., xelatex) if you are using pdflatex. See https://bookdown.org/yihui/rmarkdown-cookbook/latex-unicode.html
Errore: LaTeX failed to compile REPORT-CODES.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See REPORT-CODES.log for more info

While If I try reporting it as suggested in other post (or like this):

output:
  pdf_document: default
    latex_engine: xelatex

The error is:

Errore in yaml::yaml.load(..., eval.expr = TRUE) : 
  Scanner error: mapping values are not allowed in this context at line 6, column 17
Chiamate: <Anonymous> ... parse_yaml_front_matter -> yaml_load -> <Anonymous>

Where actually line 6 and 7 are the one for pdf_document and latex_engine respectively. Does anyone knows how to fix this?


Solution

  • Remove the default keyword:

    ---
    output:
      pdf_document: 
        latex_engine: xelatex
    ---
    
     Ï
    

    enter image description here