why rmarkdown stops generating .tex file when finds an accent?

55 Views Asked by At

I have a problem but I don't know exactly its origin. When I knit a rmarkdown document with accents in the text such as á, é, í, ó, ú, the .tex file stops being generated at that point, and R gives the following error:

Emergency stop. rmarkdown_file.tex

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

I've tried installing TinyTeX, MacTex, older and newer versions of R and RStudio, and added the following front matter:

output:
pdf_document: 
latex_engine: xelatex
toc: true
extra_dependencies: ["float"]
html_document:
df_print: paged
word_document: default
always_allow_html: true
editor_options: 
markdown: 
wrap: sentence
encoding: UTF-8
header-includes:
- \usepackage[utf8]{inputenc}

I don't know if the problem if with the knit, the pandoc or the LaTeX distribution. In other computer it does work, but in my M1 Mac it always crashes.

1

There are 1 best solutions below

0
Manuel Modroño On

Update: a few weeks after I updated the RStudio version and it run properly. I believe that some sort of encoding trouble may have occurred while reading R files.