R Markdown is working properly on the headers of my document, but not the body, as spanish characters look different. When I use pure Latex (Overleaf) it works in both the body and header.
If I copy-paste spanish characters (eg. á, é, ñ, ó
) they are preserved as such, but if I use the backslash-hyphen method (\'a, \'e, \~n, \'o
) they only translate properly in the headers of the document but not the body.
I already checked if i was using utf8
(I was), and the headers-include
and \usepackage
functions didn't help either.
\section{Secci\'on \~n}
Hola, esta es mi primera edici\'on de texto
\subsection{Subsecci\'on}
Esto deber\'ia ser una subsecci\'on.
Ahora, anotaré una f\'ormula, tal que $\lim_{x \rightarrow y} x = y$
This is how it currently knits:
As you can see, the headers display said characters properly, while the body only renders spanish characters correctly if It type them directly (the e), which I can't do because my keyboard doesn't have them. Using unicode is a not an ideal solution.
You don't have to use such native TeX commands as \'
to add characters with accents to your document if you set xelatex
as the latex_engine
.
---
title: "Untitled"
author: "Author"
date: "2020/4/16"
output:
pdf_document2:
#bookdown::pdf_document2: #When you need cross-referencing of figures and tabular
latex_engine: xelatex
---
# Sección ñ
Hola, esta es mi primera edición de texto
## Subsección
Esto debería ser una subsección.
Ahora, anotaré una fórmula, tal que $\lim_{x \rightarrow y} x = y$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With