热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

转换*。*md。使用pdfRStudio-Convert*.mdto*.pdfusingRStudio

IthinkIhaveaMikTeXproblem.InRStudioIclickedontheKnitPDFbuttonandreceivedthiserror

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

添加/编辑

2 个解决方案

#1


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:

然后我就没有名字了。在我的工作目录中,它是这样的:

enter image description here

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


-2  

You have to install RStudio after installing MikTek.

在安装了MikTek之后,你必须安装RStudio。


推荐阅读
  • 在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板
    本文介绍了在Xamarin XAML语言中如何在页面级别构建ControlTemplate控件模板的方法和步骤,包括将ResourceDictionary添加到页面中以及在ResourceDictionary中实现模板的构建。通过本文的阅读,读者可以了解到在Xamarin XAML语言中构建控件模板的具体操作步骤和语法形式。 ... [详细]
  • MyBatis多表查询与动态SQL使用
    本文介绍了MyBatis多表查询与动态SQL的使用方法,包括一对一查询和一对多查询。同时还介绍了动态SQL的使用,包括if标签、trim标签、where标签、set标签和foreach标签的用法。文章还提供了相关的配置信息和示例代码。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • 本文介绍了使用哈夫曼树实现文件压缩和解压的方法。首先对数据结构课程设计中的代码进行了分析,包括使用时间调用、常量定义和统计文件中各个字符时相关的结构体。然后讨论了哈夫曼树的实现原理和算法。最后介绍了文件压缩和解压的具体步骤,包括字符统计、构建哈夫曼树、生成编码表、编码和解码过程。通过实例演示了文件压缩和解压的效果。本文的内容对于理解哈夫曼树的实现原理和应用具有一定的参考价值。 ... [详细]
  • GetWindowLong函数
    今天在看一个代码里头写了GetWindowLong(hwnd,0),我当时就有点费解,靠,上网搜索函数原型说明,死活找不到第 ... [详细]
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • 搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的详细步骤
    本文详细介绍了搭建Windows Server 2012 R2 IIS8.5+PHP(FastCGI)+MySQL环境的步骤,包括环境说明、相关软件下载的地址以及所需的插件下载地址。 ... [详细]
  • 这是原文链接:sendingformdata许多情况下,我们使用表单发送数据到服务器。服务器处理数据并返回响应给用户。这看起来很简单,但是 ... [详细]
  • 如何去除Win7快捷方式的箭头
    本文介绍了如何去除Win7快捷方式的箭头的方法,通过生成一个透明的ico图标并将其命名为Empty.ico,将图标复制到windows目录下,并导入注册表,即可去除箭头。这样做可以改善默认快捷方式的外观,提升桌面整洁度。 ... [详细]
  • android listview OnItemClickListener失效原因
    最近在做listview时发现OnItemClickListener失效的问题,经过查找发现是因为button的原因。不仅listitem中存在button会影响OnItemClickListener事件的失效,还会导致单击后listview每个item的背景改变,使得item中的所有有关焦点的事件都失效。本文给出了一个范例来说明这种情况,并提供了解决方法。 ... [详细]
  • FeatureRequestIsyourfeaturerequestrelatedtoaproblem?Please ... [详细]
  • 深入理解CSS中的margin属性及其应用场景
    本文主要介绍了CSS中的margin属性及其应用场景,包括垂直外边距合并、padding的使用时机、行内替换元素与费替换元素的区别、margin的基线、盒子的物理大小、显示大小、逻辑大小等知识点。通过深入理解这些概念,读者可以更好地掌握margin的用法和原理。同时,文中提供了一些相关的文档和规范供读者参考。 ... [详细]
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • 先看官方文档TheJavaTutorialshavebeenwrittenforJDK8.Examplesandpracticesdescribedinthispagedontta ... [详细]
  • 本文介绍了一种轻巧方便的工具——集算器,通过使用集算器可以将文本日志变成结构化数据,然后可以使用SQL式查询。集算器利用集算语言的优点,将日志内容结构化为数据表结构,SPL支持直接对结构化的文件进行SQL查询,不再需要安装配置第三方数据库软件。本文还详细介绍了具体的实施过程。 ... [详细]
author-avatar
手机用户2602925311
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有