问题
I am trying RMarkdown for the first time, using the very first example in Yihui's book "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]
I installed TinyTex using the following as per Yihui's comments here:
devtools::install_github('yihui/tinytex')
tinytex:::install_prebuilt()
Running tinytex:::is_tinytex()
yields TRUE.
Clicking Knit gives me the following output. There is an error line 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
I am trying to compile a pdf file. I am running Windows behind my company firewall. Searching for that file 'pdflatex.fmt' on my computer yields nothing. I have been searching for solution on the net for a while but can't relate to the problem. Does anyone know how I go about solving this?
回答1:
Update on 2020/05/14: this is unlikely to be the solution to the recent breakage in TeX Live. If anyone reached here through searches, you have to wait until the breakage is resolved.
It may be the same issue as this one, so please try
tinytex::tlmgr_install(c('texlive-scripts', 'dehyph-exptl'))
来源:https://stackoverflow.com/questions/59939055/rmarkdown-cant-find-pdflatex-fmt-file