如何使 sweave 将生成的图形复制到子文件夹中?
我很想在从我的 Sweave 报告创建的所有graphics.pdf 上使用一些基于 shell 脚本的 pdfcrop。因此,如果所有图形都存储到一个子文件夹中,而不是放在所有乳胶内容(如 .aux .log 文件(等等)所在的位置),那就太好了。如果我只需对特定目录中的所有文件使用裁剪脚本,那就容易多了。
这是我的 Sweave 块:
\begin{figure}[htbp]
\begin{center}
<<fig=true,echo=false>>=
print(mygraph)
@
\caption{my graph}
\end{center}
\end{figure}
如果我运行 sweave 代码,mygraph.pdf 将存储在与 report.tex 文件本身相同的目录中。
有没有办法将此文件存储在现有的子文件夹中,例如 /graphics ?
I would love to use some shell script based pdfcrop on all the graphics.pdf created from my Sweave report. Hence i'd be nice if all the graphics were stored to a subfolder instead of being dropped where all the latex stuff like .aux .log files (and so on) is located. If I just had to use the crop script on ALL files in a particular directory it would be much easier.
Here's my Sweave chunk:
\begin{figure}[htbp]
\begin{center}
<<fig=true,echo=false>>=
print(mygraph)
@
\caption{my graph}
\end{center}
\end{figure}
If I run the sweave code mygraph.pdf is stored in the same directory as the report.tex file itself.
Is there a way to store this file in an existing subfolder like /graphics ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将此:
插入到您的 Sweave 源文件中,最好位于序言的顶部。上面这行内容取自 Sweave FAQ,表示创建的图形将存储在(Sweave 源所在目录的)子目录
foo
中,每个图像文件名都以栏。这个以及更多内容在 Sweave 常见问题解答。
Insert this:
into your Sweave source file, preferably up the top in the preamble. The above line is taken from the Sweave FAQ, and indicates that the created figures will be stored in the subdirectory (of the directory where the Sweave source is)
foo
, and each image filename will begin withbar
. This, and a whole lot more is discussed in the Sweave FAQ.好的 RTFM,ran2。
操作方法如下:
另请参阅:手册。
Graphics 是目录,report 是您可能想要使用的子字符串。至少你会在谷歌上找到更好的:)
编辑:
为了完整起见,我将在这里添加几行shell脚本:
也许你们中的一些人想使用 $1 作为目录参数。
Okay RTFM, ran2.
Here's how:
See also: the manual.
graphics is directory and report is a substring you might wanna use. At least you'll find SO better on google :)
EDIT:
For the sake of completeness I'll add my several lines of shell script here:
Maybe some of you want to use $1 as a directory argument.