[英]Accents and xtable linebreaks for a PDF document generated with knitr
[英]Producing pdf with knitr and Rmarkdown: accents in text show up but not in figures.
段落中的口音很完美。 图中的文字在绘图查看器中是正确的,但是一旦我编译了pdf,口音就会从图中消失。
这是重现此问题的示例。
---
title: 'Some title'
author: 'This be me'
date: '`r format(Sys.Date(), "%B %Y")`'
lang: es
header-includes:
- \usepackage{tikz}
output:
pdf_document:
fig_caption: yes
---
```{r global options, echo = F, message=F}
library(knitr)
opts_chunk$set(fig.width=6, fig.height=3.5, dev = 'tikz')
```
I have some paragraphs that include cool accents like áspid.
If I run the next chunk in the R console I see the accent on the figure it generated. But the accent is missing in the pdf.
```{r}
plot(pressure, main= "áspid")
```
这看起来像是R tikzDevice
软件包中的错误。 它使用UTF-8编码生成.tikz
文件,但不包含类似
\usepackage[utf8]{inputenc}
在其中声明编码。 它的文档中对?tikzDevice
帮助主题的“ Unicode”部分有很多引用,但是没有这样的部分。 您可能想在Github页面上报告该软件包的问题, 网址为https://github.com/yihui/tikzDevice 。
编辑添加:
经过一些试验,我看不到将该行添加到.tikz
文件中的方法,但是请求xelatex
而不是默认的LaTeX引擎似乎确实可行。 您可以通过添加R代码来做到这一点
options(tikzDefaultEngine = "xetex")
到您的早期代码块中。 这将使用xelatex
作为数字,其余部分使用pdflatex
。 ( "xetex"
不是拼写错误;这就是您请求xelatex
。)
如果需要,可以使用latex_engine: xelatex
在YAML标头中其余部分切换到xelatex
,但是除非您还添加选项设置,否则这些图仍将使用pdflatex
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.