【问题标题】:Produce PDF from Rmarkdown从 Rmarkdown 生成 PDF
【发布时间】:2016-01-30 01:37:12
【问题描述】:

我在 Rstudio 中使用 rmarkdown 尝试使用 Rstudio 提供的示例代码(代码如下)来编织 PDF:

---
title: "Untitled"
output: 
  pdf_document: 
    keep_tex: yes
---

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

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.

但是,我收到以下错误:

! pdfTeX 错误(字体扩展):自动扩展仅适用于可缩放 字体。 \AtBegShi@Output ...ipout \box \AtBeginShipoutBox \fi \fi l.144 \end{文档}

pandoc.exe:从 TeX 源生成 PDF 时出错 错误:pandoc 文档转换失败,错误 43 另外:警告信息: 运行命令'"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS test_rmarkdown.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output test_rmarkdown。 pdf --template "C:\Users\XXXX\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "几何: margin=1in"' 的状态为 43 执行停止

我的会话信息如下所示:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.6      digest_0.6.8     MASS_7.3-43      grid_3.2.2       plyr_1.8.2       gtable_0.1.2     magrittr_1.5     scales_0.2.4    
 [9] ggplot2_1.0.1    stringi_0.4-1    reshape2_1.4.1   rmarkdown_0.8    proto_0.3-10     tools_3.2.2      stringr_1.0.0    munsell_0.4.2   
[17] yaml_2.1.13      colorspace_1.2-6 htmltools_0.2.6 

我正在运行完整的 TeXworks 版本 0.4.6 64 位。

【问题讨论】:

  • 你解决了吗?我的回答有帮助吗?

标签: r r-markdown pdflatex


【解决方案1】:

我以前也遇到过类似的问题。 尝试运行devtools::install_github("rstudio/rmarkdown") 这对我有用。 如果你没有 devtools,你需要运行它:

install.packages("devtools")
library(devtools).

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-15
    • 1970-01-01
    • 1970-01-01
    • 2014-08-16
    • 2022-11-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多