Sublime Forum

Issue Creating Build System for R

#1

Hi there! Im currently struggling to create a build system to construct pdf using “pdflatex”. The two commands I use to build my pdfs are : Rscript -e “library(knitr); knit(‘file.Rnw’)” & pdflatex file.tex. When trying to create a build system, i have started with:

{
“cmd”: “Rscript -e “library(knitr); knit(’$file’)””
}

This come up with the error “Error: ‘\U’ used without hex digits in character string starting “'C:\U” Execution halted”. I feel the error is to do with JSON Escape strings but i’m not aware how to solve this.

Any help/advice is greatly appreciated!

EDIT 1:
For clarification I am running this on a Windows 10 PC and shell_cmd has made no difference

EDIT 2:
Having no spaces in the directory that my RNW file is saved does not seem to make a difference either.

0 Likes

#2

try changing $file to ${file/\\\\/\\\\\\\\/g} to escape the slashes for Rscript

3 Likes

#3

This has worked a treat! Thanks for your help on Discord as well!

0 Likes