texi2dvi() error when running a .Rnw script with LaunchControl

孤者浪人 提交于 2019-12-01 10:26:14

To run a .Rnw file using LaunchControl for task scheduling, create the following files in the same directory. Then, run the *.sh script in the scheduler. Voila! The problem I was encountering in my original post was the LaunchControl doesn't (by default, at least) read ~/.bash_profile, so adding the PATH variable into the .sh script resolves this.

1) Your *.Rnw script

This is any knitr script that you can compile without issue from RStudio.

2) A *.R script

#!/Library/Frameworks/R.framework/Resources/Rscript
library("knitr")
setwd("~/some_directory")
knit2pdf("yourscript.Rnw", output = "yourscript.tex")

3) A *.sh script

Make sure that you have the PATH variable to your LaTeX installation.

#! /bin/bash 

PATH="/usr/texbin:${PATH}"
export PATH

Rscript yourscript_dispatcher.R

This solution works on OSX Yosemite 10.10.5 on R version 3.3.2 (2016-10-31).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!