问题描述
我正在使用GNU / Linux发行版(Arch,如果相关),Emacs v23.2.1,ESS v5.9和AucTeX v11.86。 I想要设置 AucTeX 来识别 .Rnw 文件,所以我可以在 .Rnw 文件之间运行 LaTeX Cc Cc
并自动获取 .dvi 文件。我认为通过编辑.emacs文件是非常易于管理的,但是我仍然没有牢牢把握 Elisp 。
另一个问题是令人讨厌的 - 不知何故,LaTeX 不承认 \usepackage {Sweave}
in preambule,所以我实际上需要复制 Sweave.sty
文件(在我的例子中,位于 / usr / share / R / texmf /Sweave.sty
)到 .Rnw 文件所在的目录(我在Windows平台上这是常见的错误这个事实变得更加沮丧) p>
我的问题归结为两个问题:
- 如何使LaTeX确认
\usepackage {Sweave}
(每次不复制Sweave.sty
到home文件夹)[编辑:设法做到这一点;请参阅Dirk的回答后的评论] - 如何设置 AucTeX 将 .Rnw 文件编译为 .dvi
这是两个不同的问题。
对于第一个,我的Debian R软件包确保从 $ RHOME / share / texmf /
目录进入TeX文件系统树,例如作为 / usr / share / texmf / tex / latex / R
。
对于第二个问题:dunno。尽管我在Emacs中进行了所有的编辑,但我倾向于通过我几年前制作的小shell脚本运行Sweave。
几个月后编辑: / em>使用ESS,而不是AucTeX。然后 Mn s
(即Alt-n后跟s)运行Sweave步骤, Mn P
运行LaTeX编译,如果需要,可致电Bibtex。
I'm using GNU/Linux distro (Arch, if that's relevant), Emacs v23.2.1, ESS v5.9 and AucTeX v11.86.
I want to setup AucTeX to recognize .Rnw files, so I can run LaTeX on .Rnw files with C-c C-c
and get .dvi file automatically. I reckon it's quite manageable by editing .emacs file, but I still haven't got a firm grasp on Elisp.
Yet another problem is quite annoying - somehow, LaTeX is not recognizing \usepackage{Sweave}
in preambule, so I actually need to copy Sweave.sty
file (in my case located in /usr/share/R/texmf/Sweave.sty
) to directory where .Rnw file is located (and I'm becoming more frustrated by the fact that this is common bug on Windows platforms!)
My question boils down to two problems:
- how to make LaTeX recognize
\usepackage{Sweave}
(without copyingSweave.sty
to "home" folder each time) [Edit: managed to do this; see comment after Dirk's answer] - how to setup AucTeX to compile .Rnw files to .dvi
That's two different questions.
For the first one, my Debian R packages make sure that there is a soft link from the $RHOME/share/texmf/
directory into the TeX file system tree, e.g. as /usr/share/texmf/tex/latex/R
.
For the second question: dunno. I tend to run Sweave via a small shell script I crafted years ago even though I do all the editing in Emacs.
Edit, a few months later: Use ESS, rather than AucTeX. Then M-n s
(i.e Alt-n followed by s) runs the Sweave step and M-n P
runs the LaTeX compilation, with a call to Bibtex if needed.
这篇关于ESS / AucTeX / Sweave集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!