使用xelatex进行Rmarkdown

时间:2017-11-20 20:57:50

标签: r latex knitr r-markdown xelatex

我正在尝试使用Calibri字体,但据我所知,我首先需要能够使用xelatex引擎。这是我遇到问题的地方。示例代码和错误如下。

请注意我对乳胶很新,所以很有可能我错过了一些明显的东西。如果重要的是我安装了MikTeX 2.9,并且我已经使用默认的pdflatex引擎成功生成了pdf(根据我的理解,这里的字体非常有限。)

我在Windows 10 64位上。

---
header-includes:
- \usepackage{fontspec}
output:
   pdf_document:
     latex_engine: xelatex
---


```{r}
data(mtcars)
```

错误:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS 
SimpleTest.utf8.md --to latex --from 
markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --
output SimpleTest.pdf --template "C:\Users\ce29109\Documents\R\win-
library\3.4\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style 
tango --latex-engine xelatex --variable graphics=yes --variable 
"geometry:margin=1in" 
! Undefined control sequence.
<argument> \LaTeX3 error: 
                       Erroneous variable \c__fontspec_shape_n_n_tl used!
l.3806 \emfontdeclare{ \emshape, \eminnershape }

pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -
RTS SimpleTest.utf8.md --to latex --from 
markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --
output SimpleTest.pdf --template "C:\Users\ce29109\Documents\R\win-
library\3.4\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style 
tango --latex-engine xelatex --variable graphics=yes --variable 
"geometry:margin=1in"' had status 43 
Execution halted

编辑:使用了错误识别的乳胶分布,我正在使用MikTex

0 个答案:

没有答案