Produce PDF from Rmarkdown

I am using rmarkdown in Rstudio to try to Knit a PDF using the example code provided by Rstudio (code below):

---
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.

But, I get the following error:

! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts. AtBegShi@Output ...ipout box AtBeginShipoutBox fi fi l.144 end{document}

pandoc.exe: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 In addition: Warning message: running command '"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:UsersXXXXDocumentsRwin-library3.2rmarkdownrmdlatexdefault.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' had status 43 Execution halted

My session info is shown below:

> 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 

And I am running the complete TeXworks version 0.4.6 64-bit.


I had similar problems before. Try to run devtools::install_github("rstudio/rmarkdown") This worked for me. If you dont have devtools you need to run this to:

install.packages("devtools")
library(devtools).
链接地址: http://www.djcxy.com/p/33468.html

上一篇: Windows上的RStudio不使用XeLaTeX

下一篇: 从Rmarkdown产生PDF