在R中编织为PDF [英] Knitting to PDF in R

查看:210
本文介绍了在R中编织为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是R的新手,正在尝试将我的R Markdown文件编织为PDF格式.

I am new to R and am trying to knit my R Markdown files into PDF format.

我不断收到错误消息:

pandoc:找不到pdflatex. pdflatex对于pdf输出是必需的. 错误:pandoc文档转换失败,错误41 执行停止

pandoc: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed with error 41 Execution halted

未检测到TeX安装(创建PDF输出需要TeX).您应该为平台安装推荐的TeX发行版:

No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform:

Windows:MiKTeX(完整)- http://miktex.org/2.9/setup (注意:请确保下载完整安装而不是基本安装)

Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup (NOTE: Be sure to download the Complete rather than Basic installation)

Mac OS X:TexLive 2013(完整版)- http://tug.org/mactex/ (注意:强烈建议使用Safari而不是Chrome下载)

Mac OS X: TexLive 2013 (Full) - http://tug.org/mactex/ (NOTE: Download with Safari rather than Chrome strongly recommended)

Linux:使用系统软件包管理器

Linux: Use system package manager

我已经下载了pandoc,还下载了TexLive并将它们都安装到我的计算机上.对于我一生,我无法弄清楚为什么R不会认识到我已经安装了它们并编织成PDF.

I have downloaded pandoc, and I have also downloaded TexLive and have installed them both onto my computer. For the life of me I cannot figure out why R wont recognize that Ive installed them, and knit into a PDF.

请帮助!

推荐答案

对于Mac OS X,如果您已经安装了TexLive(我是通过自制酒桶安装的),则应该通过命令行使用pdftex.

For Mac OS X, if you have installed TexLive (I installed so through homebrew caskroom) you should have pdftex available via command line.

键入"which pdftex"以确保显示内容.从那里,我创建了一个指向我的$ PATH的符号链接,特别是到我的/usr/local/bin(存储所有自制软件的位置)的符号链接:

type 'which pdftex' to make sure something shows up. from there, i created a symbolic link into my $PATH, specifically into my /usr/local/bin (which is where all my homebrew stuff is stored) with:

ln -s /usr/texbin/pdftex /usr/local/bin/pdflatex

从那里开始,通常在RStudio和R中使用knitr似乎可以工作,并且渲染R Markdown绝对是一个非常漂亮的选择(检查一些模板,例如Tufte模板!)

from there, using knitr in RStudio and R in general seemed to work and rendering R Markdown is definitely a really beautiful option (check some of the templates too like the Tufte one!)

这篇关于在R中编织为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆