André
André

Reputation: 257

Font problems when exporting to EPS/LateX

I created a simple plot that I want to include in my latex document:

enter image description here The font in the axis (both x and y) does not look like the font I used in my latex document, which is Utopia (regular). I want the axis to have the font Utopia as well but I did not succeed. I used the following:

  set(gca, 'XTick',[]);
  set(gca, 'YTick',[]);
  ylabel('Surface elevation','Fontsize',12,'Fontname','Utopia');
  xlabel(' Time', 'Fontsize',12,'Fontname','Utopia'); 
  set(gca,'FontSize',12,'Fontname','Utopia')
  set(findall(gcf,'Utopia','text'),'FontSize',15)
print -depsc figure_name

I tried to include Utopia, and I export it as EPS. How can I change it to Utopia (or any other font type)?

Upvotes: 2

Views: 844

Answers (1)

André
André

Reputation: 257

I have checked all possible ways to embed the font within the EPS and then include it in LateX. I find the solution with Matlab2Tikz the easiest. A brief summary how to do this:

  1. You create your own plot in Matlab with your preferred fonts, fontsize, etc.
  2. Download Matlab2TikZ: https://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz-matlab2tikz and include it in your path.
  3. In Matlab do the following: matlab2tikz('filename.tikz', ...)
  4. In Latex, include pgfplots package. (\usepackage(pgfplots)).
  5. An example how to include in LateX can be found here: http://www.howtotex.com/packages/beautiful-matlab-figures-in-latex/

Matlab2TikZ is very straightforward and a beginner with Matlab/Latex can use it without too much troubles!

Upvotes: 0

Related Questions