【问题标题】:R Markdown via RStudio cannot generate PDFs but only HTML and Word (Pandoc generates status 43)通过 RStudio 的 R Markdown 无法生成 PDF,只能生成 HTML 和 Word(Pandoc 生成状态 43)
【发布时间】:2016-02-19 08:10:37
【问题描述】:

即使使用'Newfile' -> 'New R Markdown' 序列生成的非常简单的 Rmd 文件,选择“文档”和“PDF”作为默认输出格式,当按下 RStudio 中的“编织 PDF”按钮时,我也会收到以下错误:

"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS mist2.utf8.md --to latex 
--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures 
--output mist2.pdf --template "D:\_Dateien_von_ulk\Dokumente\R\win-library\3.2\rmarkdown\rmd\latex\default-1.14.tex" --highlight-style tango 
--latex-engine pdflatex --natbib --variable graphics=yes --variable "geometry:margin=1in" 
  output file: mist2.knit.md

  ! Incomplete \iffalse; all text was ignored after line 131.
  <inserted text> 
    \fi 
  <*> ./tex2pdf.2196/input.tex

  !  ==> Fatal error occurred, no output PDF file produced!
    Transcript written on D:/ulk/uk-uni/Uni-ab-September-1999/Lehre/Unterlagen-Lehr
  e-WS-2015-16/Lektuerekurs.VAR.ECM.COINT.WS2015.16/Pfaff.2008.RCode/RCode/tex2pd
  f.2196/input.log.

  pandoc.exe: Error producing PDF from TeX source
  Fehler: pandoc document conversion failed with error 43
  Zusätzlich: Warnmeldung:
    Ausführung von Kommando '"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS mist2.utf8.md --to latex 
 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output mist2.pdf 
 --template "D:\_Dateien_von_ulk\Dokumente\R\win-library\3.2\rmarkdown\rmd\latex\default-1.14.tex"
 --highlight-style tango --latex-engine pdflatex --natbib --variable graphics=yes 
 --variable "geometry:margin=1in"' ergab Status 43 
  Ausführung angehalten

sessionInfo() 提供的 R 会话信息给出:

R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C                    LC_TIME=German_Germany.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RevoUtilsMath_3.2.2

loaded via a namespace (and not attached):
[1] htmltools_0.2.6 tools_3.2.2     yaml_2.1.13     rmarkdown_0.8.2 digest_0.6.8   

在 8.1 窗口下。我用:

  1. MikTeX 版本 2.9.5721
  2. 潘多克 1.15.1.1.
  3. RStudio 0.99.489

今天(2015 年 11 月 17 日)所有库都已更新。此外,所有软件都已使用管理员权限安装在驱动器 C: 上的安装默认路径中,并且所有用户都可以使用。

将 Rmd 文件编入 HTML,Word 可以正常工作。
有什么解决问题的建议吗?

【问题讨论】:

  • 我看到你已经进入了 Windows pandoc 地狱。祝你好运。在我让它正常工作之前,我花了半天的时间进行故障排除试验和错误。
  • 错误 43 表示 pandoc 生成了一个 tex 文件但编译失败。您可以通过在 output: pdf_document: 下的 yaml 前端添加 keep_tex: true 开始故障排除并检查生成的乳胶文件(尝试使用 pdflatex 或 xelatex 编译它,看看它在哪里失败)
  • 我不确定问题是由 pandoc 引起的。根据我的测试 RMarkdown -> PDF 适用于日期标签,如日期:“2015 年 11 月 22 日”和日期:“22.11.2015”,但不适用于日期标签:“2015 年 11 月 22 日”,它使用典型的德国日期格式 witj a DOT 背后的一天。无论如何,现在问题已经解决了——我只是使用 DD.MM.YYYY 格式。

标签: r pdf markdown rstudio pandoc


【解决方案1】:

刚刚遇到同样的问题。以下是发生的事情:

---
date: "8. Mai 2017"
---

pandoc 视为枚举。然后 TeX 在\date{} 中找到一个枚举:

\date{\begin{enumerate} \def\labelenumi{\arabic{enumi}.} \setcounter{enumi}{7} \tightlist \item Mai 2017 \end{enumerate}} 它根本不喜欢。

解决方法:

  • 转义点:date: 8\. Maidate: '8\. Mai 2017'date: "8\\. Mai 2017"

    date: '`r format(Sys.time(), "%d\\. %B %Y")`'
    
  • 作为枚举的处理由序列号点空间触发。 08.05.2017 不会出现此问题(8.Mai 2017 也不会出现轻微输入错误)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-05
    • 2014-03-10
    • 1970-01-01
    • 1970-01-01
    • 2015-04-07
    • 2016-06-26
    • 1970-01-01
    • 2014-03-30
    相关资源
    最近更新 更多