Windows上的RStudio不使用XeLaTeX

时间:2016-04-23 03:18:21

标签: rstudio r-markdown pdflatex xelatex

我在Windows 10上使用 RStudio 0.99.896。

我正在尝试使用 knitr RMarkdown 文件转换为使用 XeLaTex 引擎的PDF格式。

我已在RStudio中设置全局选项项目选项以使用XeLaTex构建

你可以看到我在全局选项中选择了XeLaTeX(见图) enter image description here

我也在项目选项中选择了它(见图) enter image description here

以下是我在调用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

我不确定为什么会这样。关于我错过的环境的任何想法?

1 个答案:

答案 0 :(得分:2)

我也有这个问题。

试试这个:

output:
   pdf_document:
     latex_engine: xelatex

除了你所做的一切。这为我修好了!