【问题标题】:RStudio on Windows not using XeLaTeXWindows 上的 RStudio 不使用 XeLaTeX
【发布时间】:2016-08-16 19:38:28
【问题描述】:

我在 Windows 10 上使用 RStudio 0.99.896。

我正在尝试使用 knitr 通过 XeLaTex 引擎将 RMarkdown 文件转换为 PDF。

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

您可以看到我在全局选项中选择了XeLaTeX(见图)

我也在项目选项中选择了它(见图)

这是一个最小的可重复的 Markdown 文件示例,当我调用 knitr 时失败:

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


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

当我对上面的文件调用 Knit PDF 时,我得到以下输出:

"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS sample1.utf8.md --to latex --from markdown+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" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" 输出文件: sample1.knit.md

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! ! !致命字体规范 错误:“不能使用-pdftex”! ! fontspec 包需要 XeTeX 或 LuaTeX 功能。 ! !你必须改变你的排版 引擎,例如,“xelatex”或“lualatex”!而不是普通的“乳胶”或 “pdflatex”。

您可以在上面显示的输出的粗体部分看到 RStudio 仍在调用 pdflatex 而不是 xelatex

我不知道为什么会这样。关于我错过的设置有什么想法吗?

【问题讨论】:

  • 如 Rstudio 首选项中所述,这些设置适用于 Rnw 文件;在这里,您正在使用 Rmarkdown。您需要在每个文档的 YAML 前端添加 latex_engine: xelatex 设置。

标签: rstudio r-markdown pdflatex xelatex


【解决方案1】:

我也有这个问题。

试试这个:

output:
   pdf_document:
     latex_engine: xelatex

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-13
    • 2022-11-25
    • 2015-05-06
    • 1970-01-01
    • 2015-02-09
    • 2012-12-18
    • 1970-01-01
    • 2015-10-25
    相关资源
    最近更新 更多