简体   繁体   中英

How to quote an Rscript call?

My goal is to call Rscript from an .Rnw file via SweavePDF , set up as follows:

(add-hook 'Rnw-mode-hook
      (lambda ()
        (add-to-list 'TeX-command-list
             '("SweavePDF" "Rscript -e 'patchDVI::SweavePDF('%t', encoding='utf8')'"
               TeX-run-command nil t :help "Run SweavePDF") t)
        (setq TeX-command-default "SweavePDF")))

How can the R script Rscript be called correctly? Something with the quotes seems to not work as expected:?

Running `SweavePDF' on `ch03_copula' with ``Rscript -e 'patchDVI::SweavePDF('ch03_copula.Rnw', encoding='utf8')''
/bin/sh: 1: Syntax error: Unterminated quoted string

SweavePDF exited abnormally with code 2 

刚刚发现双引号可以用反斜杠转义\\"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM