我想我有一个MikTeX问题。在RStudio中,我点击了针织PDF按钮,并收到了这条错误消息。
这是pdfTeX,版本3.1415926-2.3-1.40.12 (MiKTeX 2.9 64位)
pdflatex:找不到内存转储文件。
pdflatex: Data: pdflatex.fmt
然后我遵循了http://docs.miktex.org/manual/formats.html的第一条指令,然后重新启动了我的计算机。
此时,我不知道是否需要添加内存转储文件,如果需要,则不知道如何添加。
然后我试了一下编织词,这个方法效果很好,制作了一个Word 2007文档。
我正在使用RStudio。我有一个R标记文档Ira.Rmd。它生成了文件Ira.md和Ira.html。我想把它保存为Ira.pdf。我在命令行上下载并运行pandoc
pandoc Ira.md –o Ira.pdf. 我收到了以下错误消息。
从TeX源生成PDF时出错。这是pdfTeX,版本3.1415926-2.3.1.40.12 Pdflatex:找不到内存转储文件。Pdflatex:数据: pdflatex.fmt
有人能简单地解释一下我如何执行这个文件转换吗?我正在使用以下方法。
Windows7.r版本: 3.0.2 RStudio版本: 0.98.684
我确实读过https://github.com/rstudio/rmarkdown,但我仍然不知道如何转换我的文件。
更新我正在编辑我的问题。
我正在尝试将一个R标记文件转换为PDF。我在RMD中创建了RMD文件。单击一个按钮,我成功地生成了一个HTML文件,其中填充了R代码。
我使用的是R版本3.0.2
我使用的是RStudio版本0.98.684
我不知道以下是否相关。
我的.Rprofile文件包含以下行。
setwd("C:/Users/Ira/Documents/Statistics")我运行了以下命令
> getwd()
[1] "C:/Users/Ira/Documents/Statistics"我已经尝试了所有的建议。谢谢。但是,当我试图转换为PDF时,我会继续收到错误消息。我最近的文章试图发布错误消息。
真正的Rmarkup文件是: IraAppliedStats.Rmd
单击针织物将生成所需的HTML文件。
我成功地运行了这些命令:
install.packages("devtools"); devtools::install_github("rstudio/rmarkdown")
library(rmarkdown)我在控制台上运行了以下命令,但收到了一个错误。
render(input = "toPDF2.rmd", output_format = "pdf_document", output_file = "toPDF2.pdf")我观察了监视器。在生成了几个块之后,我开始看到多条消息,例如在完成了一些块之后的如下消息。
*警告in (if (c(“("IraAppliedStats_Rmd_files/figure-latex/unnamed-chunk-10")*”,“out_format”)) sanitize_fn str_c(路径,:图路径中的点替换为_sanitize_fn str_c)
另外,每个块都有以下消息。
没有R码的普通文本
大部分文档是R代码。在生成HTML文件时会出现相同的行。
错误信息的本质似乎是。
pandoc.exe:从TeX源生成PDF错误。这是pdfTeX,版本3.1415926-2.3-1.40.12 (MiKTeX 2.964位) pdflatex:找不到内存转储文件。
然后使用记事本,我将以下两行添加到IraAppliedStats.md文件的顶部。
*标题: IraAppliedStats.md输出: pdf_document*
我关闭了记事本。
我再次执行命令。
render(input = "IraAppliedStats.Rmd", output_format = "pdf_document", output_file = "IraAppliedStats.Rmd.pdf")这似乎没有帮助,因为我再次收到一条错误消息,没有生成PDF文件。
添加结束/编辑
发布于 2014-03-03 09:26:56
使用rmarkdown包 ( RStudio版本0.98.682,当前预览版本)将Rmd转换为当前预览版本非常简单,只有一个函数可以完成转换:render。
下面是我的标记文件(在RStudio中启动新的Rmd时创建的示例),假设它名为Untitled.Rmd并保存在工作目录中(假设您的LaTeX发行版是最新的,并且您有最新版本的Pandoc):
---
title: "Untitled" # you must have lines similar to these in your Rmd file
output: pdf_document # this is how R knows to convert this file to a PDF
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. Click the **Help** toolbar button for more details on using R Markdown.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r}摘要(Cars)
You can also embed plots, for example:
```{r, echo=FALSE}阴谋(汽车)
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.然后我在控制台中运行:
library(rmarkdown)
render("Untitled.Rmd") # you could also use "Untitled.md"然后在我的工作目录中得到Untitled.pdf,它如下所示:

或者,如果您不能使用该版本的RStudio,或者不希望在您的标记代码中包括这些title:和output:行,那么这里有一种很长的方法可以做到这一点:
# Load packages.
require(knitr)
require(markdown)
# Process your .Rmd and generate a .pdf file
# (including smart punctuation and grey background of code blocks)
# For this step you'll need to have two other programs installed on your computer
# 1. Pandoc: http://johnmacfarlane.net/pandoc/installing.html
# 2. LaTeX: follow the instructions on the Pandoc download page
filen <- my_rmd_filename # name of the markdown file without .Rmd suffix
knit(paste0(filen,".Rmd"))
system(paste0("pandoc -s ", paste0(filen,".md"), " -t latex -o ", paste0(filen,".pdf"), " --highlight-style=tango -S"))
# Now find the location on your computer where the PDF file was created:
getwd()有关我为此使用的包和版本的更多详细信息:
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 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] rmarkdown_0.1.4
loaded via a namespace (and not attached):
[1] evaluate_0.5.1 formatR_0.10 knitr_1.5 stringr_0.6.2 tools_3.0.2 yaml_2.1.10发布于 2014-07-29 18:50:41
您必须在安装RStudio后安装MikTek。
https://stackoverflow.com/questions/22140742
复制相似问题