从命令行更改 Sweave 驱动程序
我当前用于编织的 Makefile
看起来类似于:
SUFFIXES: .tex .pdf .Rnw
MAIN = lecture
INCLUDES = chapter1.tex chapter2.tex ...
all: $(INCLUDES) $(MAIN).pdf
$(MAIN).pdf: $(INCLUDES) $(MAIN).tex
.Rnw.tex:
R CMD Sweave $*.Rnw
.tex.pdf:
pdflatex $*.tex
<snip>
假设我想更改 Sweave 驱动程序以使用 突出显示 包(例如)。这样做的最佳方法是什么?
My current Makefile
for weaving looks something like:
SUFFIXES: .tex .pdf .Rnw
MAIN = lecture
INCLUDES = chapter1.tex chapter2.tex ...
all: $(INCLUDES) $(MAIN).pdf
$(MAIN).pdf: $(INCLUDES) $(MAIN).tex
.Rnw.tex:
R CMD Sweave $*.Rnw
.tex.pdf:
pdflatex $*.tex
<snip>
Suppose I want to change the Sweave driver to use the highlight package (say). What's the best way of doing this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以像我们对 Rcpp* 包所做的那样。这是 RcppGSL:
这将实际源代码和“假”变体保留在子目录
inst/doc/RcppGSL/
中仅当我们也需要时才欺骗 R 重新创建 pdf——否则它会看到具有相同基本名称的 Rnw 和 pdf 并且很高兴。
比您开始使用的基本
Makefile
稍微复杂一些,但目前仍然如此我们知道切换到 highlight 的唯一方法。
You could do what we do for the Rcpp* packages. Here is RcppGSL:
This keeps the actual source and a 'fake' variant in a subdirectory
inst/doc/RcppGSL/
to trick R into recreating the pdf only when we want it too---otherwise it sees an Rnw and pdf of the same basename and is happy.
A little more convoluted than the basic
Makefile
you started with, but currently stillthe only way to switch to highlight that we know.