我刚刚在Inkscape中注意到,您可以将矢量图形导出为pdf + latex文件,它基本上将文本与图形分开。这非常酷,因为它使数字中的字体与文档的字体一致。将R图导出到pdf + latex
然后我看看设备功能的文档,如postscript(), pdf()
,似乎没有相应的选项。这在R中可能吗?
在@DWin的要求,我解释一下什么进一步的我在寻找:可输出两个文件A R功能:x.pdf和x.pdftex,第一个包含了图形,第二个包含文本(分离可能不完美,但大部分应该是这样)。下面是从Inkscape的一个例子:
x.pdf:
x.pdftex
%% Creator: Inkscape inkscape 0.48.4, www.inkscape.org
%% PDF/EPS/PS + LaTeX output extension by Johan Engelen, 2010
%% Accompanies image file 'drawing.pdf' (pdf, eps, ps)
%%
%% To include the image in your LaTeX document, write
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics{<filename>.pdf}
%% To scale the image, write
%% \def\svgwidth{<desired width>}
%% \input{<filename>.pdf_tex}
%% instead of
%% \includegraphics[width=<desired width>]{<filename>.pdf}
%%
%% Images with a different path to the parent latex file can
%% be accessed with the `import' package (which may need to be
%% installed) using
%% \usepackage{import}
%% in the preamble, and then including the image with
%% \import{<path to file>}{<filename>.pdf_tex}
%% Alternatively, one can specify
%% \graphicspath{{<path to file>/}}
%%
%% For more information, please see info/svg-inkscape on CTAN:
%% http://tug.ctan.org/tex-archive/info/svg-inkscape
%%
\begingroup%
\makeatletter%
\providecommand\color[2][]{%
\errmessage{(Inkscape) Color is used for the text in Inkscape, but the package 'color.sty' is not loaded}%
\renewcommand\color[2][]{}%
}%
\providecommand\transparent[1]{%
\errmessage{(Inkscape) Transparency is used (non-zero) for the text in Inkscape, but the package 'transparent.sty' is not loaded}%
\renewcommand\transparent[1]{}%
}%
\providecommand\rotatebox[2]{#2}%
\ifx\svgwidth\undefined%
\setlength{\unitlength}{86.275bp}%
\ifx\svgscale\undefined%
\relax%
\else%
\setlength{\unitlength}{\unitlength * \real{\svgscale}}%
\fi%
\else%
\setlength{\unitlength}{\svgwidth}%
\fi%
\global\let\svgwidth\undefined%
\global\let\svgscale\undefined%
\makeatother%
\begin{picture}(1,0.86757462)%
\put(0,0){\includegraphics[width=\unitlength]{drawing.pdf}}%
\put(0.15439887,0.382321){\color[rgb]{0,0,0}\makebox(0,0)[lb]{\smash{test}}}%
\end{picture}%
\endgroup%
编译你应该得到后:
的好处是你可以指定主乳胶文档中的字体和数字中的文字字体将自动进行调整。
(Inkscape中支持PS +胶乳和EPS +胶乳也。)
我编辑了我的问题 – qed
需要'knitr'或'Sweave'。 –