More efficient R / Sweave / TeXShop work-flow?

后端 未结 11 932
傲寒
傲寒 2021-01-30 05:28

I\'ve now got everything to work properly on my Mac OS X 10.6 machine so that I can create decent looking LaTeX documents with Sweave that include snippets of R code, output, an

11条回答
  •  野的像风
    2021-01-30 06:14

    I use these (saved as sweave.engine and sweavebibtex.engine) for custom engines in texshop. I usually work up a code chunk in R, then copy the block into the rnw file I have open in texshop. I'd love a solution that lets me do syntax highlighting and spelling correction of R and tex in the same document (that isnt emacs).

    #!/bin/bash
    echo 'SWEAVE | PDFLATEX. Custom engine--Akasurak-16Nov2009'
    export PATH=$PATH:/usr/texbin:/usr/local/bin
    R CMD Sweave "$1"
    pdflatex "${1%.*}"
    

    and the second, for doing bibtex as well:

    #!/bin/bash
    date
    before="$(date +%s)"
    echo 'SWEAVE | PDFLATEX | BIBTEX | PDFLATEX | PDFLATEX. Custom engine--Akasurak-16Nov2009'
    #Updated 20Jul2010 for auto including Sweave.sty
    
    
    export PATH=$PATH:/usr/texbin:/usr/local/bin
    
    R CMD Sweave "$1"
    R CMD pdflatex "${1%.*}"
    bibtex  "${1%.*}.aux"
    R CMD pdflatex "${1%.*}"
    R CMD pdflatex "${1%.*}"
    
    
    after="$(date +%s)"
    elapsed_seconds="$(expr $after - $before)"
    date
    echo Elapsed time '(m:s)': $(date -r $elapsed_seconds +%M:%S)
    

    Can't say they are the best way of doing things, but they do work.

提交回复
热议问题