Save PDF for Latex problems in resolution

조회 수: 3 (최근 30일)
George
George 2015년 4월 26일
답변: Udit Gupta 2015년 4월 27일
Hello
I am plotting figures in Matlab to then use them in Latex. I am using the following code to change the size of the display while I am using the save2pdf function (<http://uk.mathworks.com/matlabcentral/fileexchange/16179-save2pdf>) to save the pdf.
set(0,'DefaultTextInterpreter','Latex')
grid on
h_xlabel = get(gca,'XLabel');
set(h_xlabel,'FontName','Arial')
set(h_xlabel,'FontSize',18);
h_ylabel = get(gca,'YLabel');
set(h_ylabel,'FontName','Arial')
set(h_ylabel,'FontSize',18);
h_title = get(gca,'Title');
set(h_title,'FontName','Arial')
set(h_title,'FontSize',18);
set(gca,'FontName','Arial')
set(gca,'FontSize',18)
legend boxoff
save2pdf([year,nameloc])
The problem arises when I insert the figure in Latex, the letters became squeezed and very small to see, which troubles me to display my results.
Any ideas would be helpful
  댓글 수: 1
Philip Caplan
Philip Caplan 2015년 4월 27일
Hi George, how does the generated PDF file look (without inserting it in a LaTeX document)? Are the letters still too small to see? Instead of only setting the 'DefaultTextInterpreter', can you also try setting the 'DefaultTextInterpreterMode'?
set(0,'DefaultTextInterpreter','latex')
set(0,'DefaultTextInterpreterMode','manual')

댓글을 달려면 로그인하십시오.

채택된 답변

Udit Gupta
Udit Gupta 2015년 4월 27일
I do the following operations before saving my figures for latex
set(gcf,'Units','Inches');
pos = get(gcf,'Position');
set(gcf,'PaperPositionMode','Auto','PaperUnits','Inches','PaperSize',[pos(3), pos(4)])
saveas(gcf,sprintf('%s\\%s.pdf',figPath,figName));
After thins the bounding box for the pdf becomes identical to the dimensions of the figure on-screen.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Printing and Saving에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by