我在PDF格式的MATLAB中打印一些数字,并可以使用Fedora 16上的Evince PDF查看器查看它们。
但是,当我尝试将它们包含在LaTeX(TeXLive 2011)中时,我收到错误
!pdfTeX error: /usr/local/texlive/2011/bin/x86_64-linux/pdflatex (file ./caroti
d_amp_mod_log.pdf): xpdf: reading PDF image failed
但是,我可以在Mathematica中生成一个示例PDF图像并将其包含在内,这告诉我问题在于MATLAB生成的PDF而不是PDF文件。
它可能与我放入set(0,'defaultfigurepaperpositionmode','auto')
文件的startup.m
有关,这样页面会自动调整图片吗?
编辑:我刚尝试使用saveas(figure(1), 'filename.pdf')
代替print(figure(1), 'filename.pdf')
,但效果很好,但忽略了PaperPositionMode
属性。有什么方法吗?
答案 0 :(得分:6)
print(handle, '-dformat', 'filename')
语法。
因此,对于PDF,我们需要print(figure(1), '-dpdf', 'myfigure')
。有关更多信息,请参阅图形文件格式的MATLAB documentation。
使用print(figure(1), 'filename.pdf')
仍会生成有效的PDF供查看,但它不能包含在LaTeX中。
答案 1 :(得分:1)
您可以尝试使用 pdfpages
或 PGF
包含pdf文件。但是,您需要仅使用pdflatex,就像您现在所做的那样。