3

抱歉,如果我在这里遗漏了一些信息。我正在尝试从 R shiny 和 R Markdown 渲染 PDF,但不断收到此错误。整个事情确实在 HTML 中运行,但我的想法是我可以导出 PDF。

我试过重新安装tinytex,安装MikTex,在Shiny中使用非临时设置,并options(tinytex.verbose = TRUE)在代码中使用,但它没有给出问题出在哪里的任何线索。


"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS Consultants_normal.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output pandoc7ea82ffe49d2.tex --lua-filter "C:\Users\xxx\Documents\R\win-library\4.0\rmarkdown\rmarkdown\lua\pagebreak.lua" --lua-filter "C:\Users\xxx\Documents\R\win-library\4.0\rmarkdown\rmarkdown\lua\latex-div.lua" --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --variable "geometry:margin=1in" 
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/W32TeX) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
Warning: Error in : LaTeX failed to compile C:\Users\xxx\AppData\Local\Temp\RtmpqUZDpX\file7ea82b6d767c.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips.
  [No stack trace available]

这是 Markdown 文档的 R Shiny 输出:

output$ConsultantsReport <- downloadHandler(
            # For PDF output, change this to "report.pdf"
            filename = "report.pdf",
            content = function(file) {
                # Copy the report file to a temporary directory before processing it, in
                # case we don't have write permissions to the current working dir (which
                # can happen when deployed).
                tempReport <- file.path(tempdir(), "Consultants_normal.Rmd")
                file.copy("Consultants_normal.Rmd", tempReport, overwrite = TRUE)
                
                # Set up parameters to pass to Rmd document
                params <- list(DateRange1 = input$dateRange[1],
                               DateRange2 = input$dateRange[2],
                               ConsultantName = input$SelectedConsultantName,
                               Data = MergedPaymentInfo())
                
                # Knit the document, passing in the `params` list, and eval it in a
                # child of the global environment (this isolates the code in the document
                # from the code in this app).
                rmarkdown::render(tempReport,
                                  output_file = file,
                                  params = params,
                                  envir = new.env(parent = globalenv())
                )
            }
        )

这是 R Markdown 中的 JML:

---
title: "Consultants Statement Normal"
author: "xxx"
params:
  DateRange1: NA,
  DateRange2: NA,
  ConsultantName: NA,
  Data: NA
output: pdf_document
---
4

0 回答 0