繁体   English   中英

来自RMarkdown的PDF文档

[英]PDF Docs from RMarkdown

一段时间以来,我一直在尝试从Rstudio中的Rmarkdown制作PDF文档时遇到很多麻烦。 我的目标是创建“统计软件期刊”格式,当我运行提供的示例脚本时,出现错误。

脚本:

---
author:
  - name: FirstName LastName
    affiliation: University/Company
    address: >
      First line
      Second line
    email: name@company.com
    url: http://rstudio.com
  - name: Second Author
    affiliation: Affiliation
title:
  formatted: "A Capitalized Title: Something about a Package \\pkg{foo}"
  # If you use tex in the formatted title, also supply version without
  plain:     "A Capitalized Title: Something about a Package foo"
  # For running headers, if needed
  short:     "\\pkg{foo}: A Capitalized Title"
abstract: >
  The abstract of the article.
keywords:
  # at least one keyword must be supplied
  formatted: [keywords, not capitalized, "\\proglang{Java}"]
  plain:     [keywords, not capitalized, Java]
preamble: >
  \usepackage{amsmath}
output: rticles::jss_article
---

# Introduction

This template demonstrates some of the basic latex you'll need to know to create a JSS article.

## Code formatting

Don't use markdown, instead use the more precise latex commands:

* \proglang{Java}
* \pkg{plyr}
* \code{print("abc")}

# R code

Can be inserted in regular R markdown blocks.

```{r}
x <- 1:10
x
```

这样做时,我的错误是:

pandoc.exe: pdflatex not found. pdflatex is needed for pdf output.
Error: pandoc document conversion failed with error 41
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS Untitled.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output Untitled.pdf --template "C:\Users\OPTIMA~1\DOCUME~1\R\WIN-LI~1\3.3\rticles\RMARKD~1\TEMPLA~1\JSS_AR~1\RESOUR~1\template.tex" --highlight-style tango --latex-engine pdflatex' had status 41 
Execution halted

我知道这与下载MikTex有关,但是我无法找到一种简单的逐步下载方式来从RStudio在RMarkdown中运行PDF文档。

任何帮助都将是非常有用的,如果您知道直接从R而不是从Web下载某些内容的任何方式,那么这将是我认为最简单的解决方案。

谢谢!

pandoc使用pdflatex创建pdf输出,因此必须安装。

在Windows下,您可以使用miktex,可以在https://miktex.org/download下找到

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM