2017-09-07 1 views
4

저는 RMarkdown을 통해 몇 달 동안 PDF 보고서를 작성했지만 오늘 MikTex, R 및 rmarkdown 및 tidyverse 패키지를 새 시스템에 설치 한 후 다음 오류가 발생했습니다. 메시지는 때 PDF 니트을 시도하셨습니다 :RMarkdown PDF "LaTeX3 오류 : 잘못된 변수"

"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") 

내가 render()와 별도의 .R 파일을 사용하는 대신 RStudio에서 직접 Test.Rmd 니트 때 나는 또한 오류가 표시

--- 
title: "Habits" 
output: 
    pdf_document: 
    latex_engine: xelatex 
--- 

Hello World! 

을 Test.Rmd. 나는 또한 lualatex pdf 엔진을 사용해 보았고 위와 같은 오류를 받았다. 나는 RStudio에 내장 된 RMarkdown PDF 예제를 사용하여 PDF를 생성 할 수 있습니다.

This post on 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 

어떤 도움이나 조언이 크게 감사합니다!

+0

재현 할 수 없습니다. 그러나'render ("Test.rmd", output_file = "Text.tex")'를 사용하고 생성 된'Test.tex'에'xelatex'를 수동으로 실행할 수 있습니다. 그러면 오류가 재현됩니까? 만약 그렇다면,'Test.tex'에 기초한 최소한의 예제를 만들고 TeX/LaTeX 스택 교환에서 여기 또는 그 이상으로 게시하십시오. –

+0

시도'latex_engine = "pdflatex"'resp. 'latex_engine : pdflatex'? – jaySf

+0

@ jaySf, 나를 위해 일했습니다. 내가 직접 시도해 봤어야했지만 특정 글꼴을 선택해야하기 때문에 그 해결책을 피하고있었습니다. –

답변

3

MikTex의 제거/재설치로 인해 여러 패키지가 오래된 버전으로 되돌려졌습니다 (MikTex 설치 프로그램이 설치 후 패키지를 업데이트하라는 메시지를 표시하는 경우 유용합니다). 이 경우, 내 fontspec 패키지가 2.6a로 되돌려졌습니다 (위의 Sourceforge 링크에 설명 된 잠재적 문제를 참조하십시오). 설치된 모든 패키지를 업데이트하기 위해 MikTex Update를 실행 한 후. 나는 원하는 PDF 출력을 성공적으로 생성 할 수있었습니다.

관련 문제