我在minimal.Rnw
中有以下代码,该代码位于我的桌面上:
<<load, echo=FALSE, warning=FALSE, message=FALSE,cache=FALSE>>=
options(digits=2)
opts_chunk$set(eval=TRUE, echo=FALSE, warning=FALSE, message=FALSE, cache = TRUE, dpi=300, dev = "pdf", fig.width=4.2, fig.height=3.7)
@
\documentclass[a4paper,11pt]{article}
\usepackage{lipsum} % Required to insert dummy text
\begin{document}
\section{Header}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{document}
当我运行下面的代码时,knitr
/ make
将minimal.Rnw
转换为PDF:
knit(input = "~/Desktop/minimal.Rnw", output = "~/Desktop/minimal.tex"); setwd("~/Desktop/"); system(paste0("make '-fMakefile' .pdf"))
但是这段代码现在给出了以下错误,并且没有制作PDF:
processing file: ~/Desktop/minimal.Rnw
|................................ | 50%
|.................................................................| 100%
ordinary text without R code
output file: ~/Desktop/minimal.tex
[1] "~/Desktop/minimal.tex"
Warning message:
In test_latex_pkg("framed", system.file("misc", "framed.sty", package = "knitr")) :
unable to find LaTeX package 'framed'; will use a copy from knitr
sh: kpsewhich: command not found
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
这是sessionInfo()
的输出:
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11 (unknown)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] grid splines stats graphics grDevices utils datasets methods base
other attached packages:
[1] tidyr_0.3.1 cowplot_0.5.0 readxl_0.1.0 boot_1.3-16 mgcv_1.8-6
[6] nlme_3.1-120 stringi_0.4-1 pavo_0.5-1 rgl_0.95.1201 GGally_0.5.0
[11] moult_1.4 geosphere_1.3-13 broom_0.3.6 testthat_0.9.1 pscl_1.4.9
[16] MASS_7.3-40 repmis_0.4.2 english_1.0-1 dplyr_0.4.1 scales_0.2.5
[21] stargazer_5.1 combinat_0.0-8 xlsx_0.5.7 xlsxjars_0.6.1 rJava_0.9-6
[26] gdata_2.13.3 tuneR_1.2.1 GPArotation_2014.11-1 MuMIn_1.13.4 psych_1.5.4
[31] effects_3.0-3 openNLP_0.2-4 extrafont_0.17 car_2.0-25 raster_2.3-40
[36] Hmisc_3.15-0 Formula_1.2-1 survival_2.38-1 lattice_0.20-31 maptools_0.8-36
[41] ggmap_2.4 ggplot2_1.0.1 rgdal_0.9-2 formatR_1.2 lme4_1.1-7
[46] Rcpp_0.11.5 Matrix_1.2-0 rgeos_0.3-8 sp_1.1-0 knitr_1.11
[51] lubridate_1.3.3 stringr_0.6.2 plyr_1.8.2 reshape2_1.4.1 gam_1.12
[56] foreach_1.4.2
loaded via a namespace (and not attached):
[1] pbkrtest_0.4-2 RColorBrewer_1.1-2 httr_0.6.1 R.cache_0.10.0 tools_3.2.0 rpart_4.1-9
[7] lazyeval_0.1.10 DBI_0.3.1 colorspace_1.2-6 openNLPdata_1.5.3-1 nnet_7.3-9 mnormt_1.5-2
[13] extrafontdb_1.0 chron_2.3-45 quantreg_5.11 SparseM_1.6 NLP_0.1-6 digest_0.6.8
[19] foreign_0.8-63 minqa_1.2.4 R.utils_2.0.2 jpeg_0.1-8 maps_2.3-9 gtools_3.4.2
[25] acepack_1.3-3.3 R.oo_1.19.0 magrittr_1.5 munsell_0.4.2 proto_0.3-10 R.methodsS3_1.7.0
[31] RJSONIO_1.3-0 parallel_3.2.0 mapproj_1.2-2 rcdd_1.1-8 rjson_0.2.15 codetools_0.2-11
[37] magic_1.5-6 evaluate_0.8 latticeExtra_0.6-26 data.table_1.9.4 png_0.1-7 nloptr_1.0.4
[43] RgoogleMaps_1.2.0.7 Rttf2pt1_1.3.3 gtable_0.1.2 reshape_0.8.5 assertthat_0.1 geometry_0.3-5
[49] signal_0.7-4 iterators_1.0.7 memoise_0.2.1 cluster_2.0.1