![](/img/trans.png)
[英]! LaTeX3 Error: Mismatched LaTeX support files detected. (LaTeX3) Loading 'expl3.sty' aborted! (LaTeX3)
[英]RMarkdown PDF “LaTeX3 error: Erroneous variable”
我已經通過RMarkdown創建了幾個月的PDF報告,但是今天在新機器上安裝了MikTex,R和rmarkdown和tidyverse軟件包后,我在嘗試編寫PDF時收到以下錯誤消息:
"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS Test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template "C:\Users\drewm\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:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS Test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template "C:\Users\drewm\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
我可以使用下面的簡單示例重新創建錯誤:
Test.R
library(rmarkdown)
library(knitr)
setwd(C:/something)
render("Test.rmd", output_format=pdf_document(latex_engine="xelatex"), output_file="test.pdf")
Test.Rmd
---
title: "Habits"
output:
pdf_document:
latex_engine: xelatex
---
Hello World!
當我直接在RStudio中編織Test.Rmd而不是使用帶有render()
的單獨.R文件時,我也看到了錯誤。 我也嘗試使用lualatex pdf引擎並收到與上面相同的錯誤。 我可以使用RStudio中內置的RMarkdown PDF示例生成PDF。
Sourceforge上的這篇文章似乎相關,但沒有用,因為解決方案是更新fontspec包,我已經使用了更新的fontspec包。
會話信息
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 15063)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.17 rmarkdown_1.6
loaded via a namespace (and not attached):
[1] compiler_3.4.1 backports_1.1.0 magrittr_1.5 rprojroot_1.2
[5] tools_3.4.1 htmltools_0.3.6 yaml_2.1.14 Rcpp_0.12.12
[9] stringi_1.1.5 stringr_1.2.0 digest_0.6.12 evaluate_0.10.1
非常感謝任何幫助或建議!
卸載/重新安裝MikTex將幾個軟件包恢復為過時的版本(如果MikTex安裝程序提示用戶在安裝后更新軟件包,將會很有幫助)。 在這種情況下,我的fontspec包恢復為2.6a(請參閱上面的Sourceforge鏈接中列出的潛在問題)。 運行MikTex Update以更新我所有已安裝的軟件包。 我能夠成功生成所需的PDF輸出。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.