1

我是第一次尝试 RMarkdown,使用的是 Yihui 的《R Markdown A Definitive Guide》一书中的第一个例子:

---
title: "Hello R Markdown"
author: "Awesome Me"
date: "2018-02-14"
output: pdf_document
---

This is a paragraph in an R Markdown document.

Below is a code chunk:

options(tinytex.verbose = TRUE)
fit = lm(dist ~ speed, data = cars)
b = coef(fit)
plot(cars)
abline(fit)

The slope of the regression is `r b[1]

根据 Yihui 的评论,我使用以下方法安装了TinyTex

devtools::install_github('yihui/tinytex')

tinytex:::install_prebuilt()

运行tinytex:::is_tinytex()产生 TRUE。

单击Knit会给我以下输出。有一条错误线I can't find the format file 'pdflatex.fmt'

processing file: Testpdf1.Rmd
  |.......................                                               |  33%
  ordinary text without R code

  |...............................................                       |  67%
label: unnamed-chunk-1
  |......................................................................| 100%
   inline R code fragments

"C:/Users/xxxxxx/Documents/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS Testpdf1.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash --output Testpdf1.tex --self-contained --highlight-style tango --pdf-engine pdflatex --variable graphics --lua-filter "C:/Users/xxxxxx/Documents/R/R-3.6.1/library/rmarkdown/rmd/lua/pagebreak.lua" --lua-filter "C:/Users/xxxxxx/Documents/R/R-3.6.1/library/rmarkdown/rmd/lua/latex-div.lua" --variable "geometry:margin=1in" 
output file: Testpdf1.knit.md

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/W32TeX) (preloaded format=pdflatex)
 restricted \write18 enabled.
I can't find the format file `pdflatex.fmt'!

kpathsea: Running mktexfmt pdflatex.fmt

The command name is C:\Users\xxxxxx\AppData\Roaming\TinyTeX\bin\win32\mktexfmt
I was unable to find any missing LaTeX packages from the error log Testpdf1.log.
! kpathsea: Running mktexfmt pdflatex.fmt

! The command name is C:\Users\xxxxxx\AppData\Roaming\TinyTeX\bin\win32\mktexfmt

Error: LaTeX failed to compile Testpdf1.tex. See https://yihui.org/tinytex/r/#debugging for debugging 
tips. See Testpdf1.log for more info.
Execution halted

我正在尝试编译一个pdf文件。我在公司防火墙后面运行 Windows。在我的计算机上搜索该文件“pdflatex.fmt”一无所获。我一直在网上寻找解决方案,但无法解决问题。有谁知道我如何解决这个问题?

4

1 回答 1

2

2020 年 5 月 14 日更新:这不太可能是解决最近 TeX Live中断的方法。如果有人通过搜索到达这里,您必须等到破损解决。


可能和这个问题一样,请尝试

tinytex::tlmgr_install(c('texlive-scripts', 'dehyph-exptl'))
于 2020-01-28T16:15:13.947 回答