我在Windows 10上使用 RStudio 0.99.896。
我正在尝试使用 knitr 将 RMarkdown 文件转换为使用 XeLaTex 引擎的PDF格式。
我已在RStudio中设置全局选项和项目选项以使用XeLaTex构建
以下是我在调用knitr时失败的降价文件的最小可重现示例:
---
header-includes:
- \usepackage{fontspec}
output:
pdf_document
---
```{r}
data(mtcars)
```
当我在上面的文件中调用编织PDF 时,我得到以下输出:
" C:/ Program Files / RStudio / bin / pandoc / pandoc" + RTS -K512m -RTS sample1.utf8.md - 到latex --from 降价+ autolink_bare_uris + ascii_identifiers + tex_math_single_backslash-implicit_figures --output sample1.pdf --template" C:\ Users \ xxxx \ Documents \ R \ win-library \ 3.2 \ rmarkdown \ rmd \ latex \ default-1.14.tex" - 高光风格的探戈 - 乳胶引擎pdflatex - 变量图形=是 - 变量"几何:margin = 1in"输出文件: sample1.knit.md
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! !致命的fontspec 错误:"不能使用-pdftex" ! ! fontspec包需要 XeTeX或LuaTeX功能。 ! !您必须更改排版 引擎,例如" xelatex"或" lualatex" !而不是普通的"乳胶"要么 " pdflatex"
您可以在上面显示的输出的粗体部分看到RStudio仍在调用 pdflatex 而不是 xelatex 。
我不确定为什么会这样。关于我错过的环境的任何想法?
答案 0 :(得分:2)
我也有这个问题。
试试这个:
output:
pdf_document:
latex_engine: xelatex
除了你所做的一切。这为我修好了!