一句话命令:
R CMD Sweave foo.Rnw R CMD texi2dvi foo.tex or latex foo dvipdfm foo |
需要将Sweave.sty文件保存在当前目录下。
Sweave.sty内容
\NeedsTeXFormat{LaTeX2e} \ProvidesPackage{Sweave}{} \RequirePackage{ifthen} \newboolean{Sweave@gin} \setboolean{Sweave@gin}{true} \newboolean{Sweave@ae} \setboolean{Sweave@ae}{true} \DeclareOption{nogin}{\setboolean{Sweave@gin}{false}} \DeclareOption{noae}{\setboolean{Sweave@ae}{false}} \ProcessOptions \RequirePackage{graphicx,fancyvrb} \IfFileExists{upquote.sty}{\RequirePackage{upquote}}{} \ifthenelse{\boolean{Sweave@gin}}{\setkeys{Gin}{width=0.8\textwidth}}{}% \ifthenelse{\boolean{Sweave@ae}}{% \RequirePackage[T1]{fontenc} \RequirePackage{ae} }{}% \DefineVerbatimEnvironment{Sinput}{Verbatim}{fontshape=sl} \DefineVerbatimEnvironment{Soutput}{Verbatim}{} \DefineVerbatimEnvironment{Scode}{Verbatim}{fontshape=sl} \newenvironment{Schunk}{}{} \newcommand{\Sconcordance}[1]{% \ifx\pdfoutput\undefined% \csname newcount\endcsname\pdfoutput\fi% \ifcase\pdfoutput\special{#1}% \else\immediate\pdfobj{#1}\fi} |