R Markdown中的西班牙语字符在标头中起作用,但在主体中不起作用,即使它在纯乳胶中也起作用

问题描述 投票:5回答:1

R Markdown可以在我的文档标题上正常工作,但不能在正文上正常工作,因为西班牙字符看起来有所不同。当我使用纯乳胶(背面)时,它既可以在正文中也可以在标头中使用。

如果我复制粘贴西班牙语字符(例如á, é, ñ, ó),它们将保留原样,但是如果我使用反斜杠连字符方法(\'a, \'e, \~n, \'o),则它们只会在文档的标题中正确翻译,而不能在正文中正确翻译。

[我已经检查过我是否正在使用utf8(以前是,并且headers-include\usepackage函数也无济于事。

\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$

这是当前的编织方式:

https://i.stack.imgur.com/P91QF.png

如您所见,标题正确显示了上述字符,而正文仅在直接键入西班牙字符(即e)的情况下才能正确显示西班牙字符,这是我不能做的,因为我的键盘没有这些字符。使用unicode不是一个理想的解决方案。

r latex r-markdown
1个回答
0
投票

如果将\'设置为xelatex,则不必使用latex_engine这样的本地TeX命令向文档中添加带有重音符号的字符。

---
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$
© www.soinside.com 2019 - 2024. All rights reserved.