What is your favorite way to export figure for use in LaTeX?
98 ビュー (過去 30 日間)
Matlab's standard plotting tools are sufficient for visualizing intermediate results, but there are many reasons why you can't simply export a eps or pdf to be included in a LaTeX generated report or publication. I've tried a several options varying from explicitly setting the fonts to using export tools such as matlab2tikz; but what tools/ methods do you find the most effective at easily making a beautiful figure without extensive effort?
回答 (4 件)
ibrahim thamary 2018 年 2 月 19 日
I found this useful:
width = 3; % Width in inches
height = 3; % Height in inches
papersize = get(gcf, 'PaperSize');
left = (papersize(1)- width)/2;
bottom = (papersize(2)- height)/2;
myfiguresize = [left, bottom, width, height];
% Save the file as PNG
Oliver Woodford 2011 年 10 月 13 日
I create the graph or image in a MATLAB figure on screen exactly as I want it to appear in the paper. Then I save the figure as either a PDF or a PNG using export_fig. Finally I insert the output in latex using includegraphic and compile using pdflatex.
Export_fig respects figure dimensions, crops whitespace, embeds fonts and saves bitmaps at high quality, so the results look good.
Daniel Shub 2011 年 10 月 14 日
While beauty is subjective, I don't think that it is possible to produce a beautiful figure without extensive effort. Even with extensive effort, I do not think that MATLAB can produce a beautiful figure. Now quick, publishable and clear, then you want to use export_fig.
Maalek Naghavi 2021 年 6 月 12 日
編集済み: Maalek Naghavi 2021 年 6 月 12 日
Matlab-generated PDF graph
If you have saved your Matlab-created graph as a pdf file, then you can use it in your Latex document using:
You may change the size of your figure by tuning the options inside the braces to fit it to your space. Then compile your whole document:
pdflatex -interaction=nonstopmode -src main.tex
Matlab-generated EPS graph
If you have saved your Matlab-created graph as an eps file, then the same procedure applies for including the figure. For compilation use:
latex -interaction=nonstopmode -src main.pdf
If you are creating a presentation using beamer class, see beamer's documentation, chapter Creating PostScripts.