I think I have a MikTeX problem. In RStudio I clicked on the Knit PDF button and received this error message.
我想我有一个MikTeX问题。在RStudio中,我点击了编织的PDF按钮,并收到了这个错误消息。
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9 64-bit)
pdflatex: The memory dump file could not be found.
pdflatex: Data: pdflatex.fmt
这是pdfTeX,版本3.1415926-2.3-1.40.12 (MiKTeX 2.9 64位)pdflatex:无法找到内存转储文件。pdflatex:数据:pdflatex.fmt
I then followed the first instruction at http://docs.miktex.org/manual/formats.html Then I rebooted my computer.
然后,我遵循了http://docs.miktex.org/manual/formats.html的第一个指令,然后重新启动了我的计算机。
At this point I do not know if I need to add a memory dump file and if so, the details of how to do so.
在这一点上,我不知道是否需要添加内存转储文件,如果需要,则需要添加该文件的详细信息。
I then tried Knit Word and that worked beautifully, producing a Word 2007 document.
然后我试着编织单词,效果很好,生成了一个Word 2007文档。
I am using RStudio. I have an R markup document Ira.Rmd. It produced files Ira.md and Ira.html. I would like to save as Ira.pdf. I downloaded and ran pandoc on the command line with
我用RStudio。我有一个R标记文档。它产生的文件Ira。md和Ira.html。我想存为Ira.pdf。我在命令行上下载并运行了pandoc。
pandoc Ira.md –o Ira.pdf.
I received the following error message.
我收到了以下错误信息。
Pandoc: Error producing PDF from TeX source. This is pdfTeX, Version 3.1415926-2.3.1.40.12 Pdflatex: The memory dump file could not be found. Pdflatex: Data: pdflatex.fmt
Pandoc:从TeX源生成PDF的错误。这是pdfTeX,版本3.1415926-2.3.1.40.12 Pdflatex:无法找到内存转储文件。Pdflatex:数据:pdflatex.fmt
Can someone explain in simple terms how I can perform this file conversion? I am using the following.
有人能用简单的术语解释我如何执行这个文件转换吗?我正在使用下面的方法。
Windows 7. R Version: 3.0.2 RStudio Version: 0.98.684
Windows 7。R版本:3.0.2 RStudio版本:0.98.684。
I did read https://github.com/rstudio/rmarkdown but I still do not understand how to convert my file.
我确实读过https://github.com/rstudio/rmarkdown,但我仍然不知道如何转换我的文件。
UPDATE I am editing my question.
我正在编辑我的问题。
I am trying to convert an R markdown file to PDF. I created the RMD file in R Studio. With a click of a button I successfully produced the HTML file which is filled with R code.
我正在尝试将一个R markdown文件转换为PDF。我在R工作室创建了RMD文件。通过单击按钮,我成功地生成了包含R代码的HTML文件。
I am using R version 3.0.2
我使用的是R版本3.0.2。
I am using RStudio version 0.98.684
我使用的是RStudio版本0.98.684。
I do not know if the following is relevant.
我不知道下面是否相关。
My .Rprofile file contains the following line.
我的. rprofile文件包含以下一行。
setwd("C:/Users/Ira/Documents/Statistics")
I ran the following
我跑以下
> getwd()
[1] "C:/Users/Ira/Documents/Statistics"
I have attempted all of the suggestions. Thank you. However, I continue to receive error messages when trying to convert to PDF. My most recent posts attempted to post the error messages.
我已经尝试了所有的建议。谢谢你!但是,在尝试转换为PDF时,我继续收到错误消息。我最近的帖子试图发布错误消息。
The real Rmarkup file is: IraAppliedStats.Rmd
真正的Rmarkup文件是:IraAppliedStats.Rmd。
Clicking on Knit produces the desired HTML file.
单击编织会生成所需的HTML文件。
I successfully ran the commands:
我成功地运行了命令:
install.packages("devtools"); devtools::install_github("rstudio/rmarkdown")
library(rmarkdown)
From the console I ran the following command, but I received an error.
从控制台我运行了下面的命令,但是我收到了一个错误。
render(input = "toPDF2.rmd", output_format = "pdf_document", output_file = "toPDF2.pdf")
I observed the monitor. After a few chunks were produced I started to see multiple messages such as the following after a few chunks were completed.
我观察到监视器。在完成几块后,我开始看到多个消息,比如在几个块完成后的后续消息。
*Warning in (if (out_format(c("latex", "sweave", "listings", "markdown"))) sanitize_fn else str_c)(path, : dots in figure paths replaced with _ ("IraAppliedStats_Rmd_files/figure-latex/unnamed-chunk-10")*
*警告(如果(out_format(c)(“latex”、“sweave”、“清单”、“markdown”)))(path,:图路径中的圆点替换为_(“IraAppliedStats_Rmd_files/图-latex/unnamed-chunk-10”)*。
Also each chunk had the following message.
每个块也有以下消息。
ordinary text without R code
普通文本没有R代码。
Much of the document is R code. The same line appears when I am producing the HTML file.
大部分文档都是R代码。当我生成HTML文件时,会出现相同的行。
The essence of the error message seems to be.
错误信息的本质似乎是这样的。
pandoc.exe: Error producing PDF from TeX source. This is pdfTeX, Version 3.1415926-2.3-1.40.12 (MiKTeX 2.9 64-bit) pdflatex: The memory dump file could not be found.
pandoc。exe:从TeX源生成PDF的错误。这是pdfTeX,版本3.1415926-2.3-1.40.12 (MiKTeX 2.9 64位)pdflatex:无法找到内存转储文件。
Using Notepad, I then added the following two lines to the top of the IraAppliedStats.md file.
然后,我使用记事本,将以下两行代码添加到伊拉克应用程序的顶部。md文件。
*title: IraAppliedStats.md output: pdf_document*
*标题:IraAppliedStats。md输出:pdf_document *
I closed Notepad.
我关闭记事本。
I again ran the command.
我再次运行命令。
render(input = "IraAppliedStats.Rmd", output_format = "pdf_document", output_file = "IraAppliedStats.Rmd.pdf")
This did not appear to help as I again received an error message and there was no PDF file produced.
当我再次收到错误消息时,并没有生成PDF文件,这似乎没有帮助。
End of addition/edit
添加/编辑
5
Using the rmarkdown package (included with RStudio Version 0.98.682, the current preview release) it's very simple to convert Rmd to PDF, there is a single function that will do the conversion: render
.
使用rmarkdown包(包括RStudio版本0.98.682,当前预览版),将Rmd转换为PDF非常简单,只有一个函数可以完成转换:渲染。
Here's my markdown file (the example one that is created when you start a new Rmd in RStudio), Assume it's called Untitled.Rmd
and saved in the working directory (and assuming your LaTeX distribution is fully up-to-date, and you have the latest version of Pandoc):
这是我的markdown文件(在RStudio中启动新的Rmd时创建的示例文件),假设它名为Untitled。Rmd并保存在工作目录中(假设您的乳胶分布是完全最新的,并且您拥有最新版本的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}
summary(cars)
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
Then I run in the console:
然后我在控制台运行:
library(rmarkdown)
render("Untitled.Rmd") # you could also use "Untitled.md"
And then I get Untitled.pdf
in my working directory, which looks like this:
然后我就没有名字了。在我的工作目录中,它是这样的:
Alternatively, here is the long-hand way to do this, if you can't use that version of RStudio, or don't want to include those title:
and output:
lines in your markdown code:
另外,如果您不能使用RStudio的版本,或者不希望包含这些标题:和输出:您的markdown代码中的行:
# 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-))
# Now find the location on your computer where the PDF file was created:
getwd()
More details about the packages & versions I'm using for this:
关于我正在使用的包和版本的更多细节:
> 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
-2
You have to install RStudio after installing MikTek.
在安装了MikTek之后,你必须安装RStudio。