2012-11-23 48 views
6

我在OS X 10.7.5Matlab的设置defaultTextInterpreter乳胶

运行Matlab的R2010a版本我有一个简单的MATLAB的情节和想在轴和图例使用LaTeX命令。但是设置:

set(0, 'defaultTextInterpreter', 'latex');

具有零效应,并导致我的TEX命令不能解析的TeX的警告。如果我打开这个图的绘图工具,默认的解释器被设置为'TeX'。手动设置为“LaTeX”显然可以解决这个问题,但是我无法为数百个地块做到这一点。

现在,如果我找回通过MATLAB提示符默认的解释,即 get(0,'DefaultTextInterpreter')

它说,“乳胶”,但同样,当我通过情节工具菜单看在人物的属性,解释仍然设置为'TeX'。

完整的绘图代码:

figure 
f = 'somefile.eps' 
set(0, 'defaultTextInterpreter', 'latex'); 
ms = 8; 
fontSize = 18; 
loglog(p_m_sip, p_fa_sip, 'ko-.', 'LineWidth', 2, 'MarkerSize', ms); hold on; 
xlabel('$P_{fa}$', 'fontsize', fontSize); 
ylabel('$P_{m}$', 'fontsize', fontSize); 
legend('$\textbf{K}_{zz}$', 'Location', 'Best'); 
set(gca, 'XMinorTick', 'on', 'YMinorTick', 'on', 'YGrid', 'on', 'XGrid', 'on'); 
print('-depsc2', f); 
+0

这可能是愚蠢的,但你尝试'设置( 0,'defaultTextInterpreter','LaTeX')'而不是'set(0,'defaultTextInterpreter','latex')'? – Adam27X

+0

@ Adam27X。对不起,它不起作用.. – Maurits

+0

@Maurits尝试更改标题/轴本身的'DefaultTextInterpreter'属性... –

回答

14

这对我的作品(R2011B)

figure 
ms = 8; 
fontSize = 18; 

xx = 0:.1:1; 
plot(xx,sin(xx)) 

xlabel('P_{fa}', 'fontsize', fontSize); %No need for latex explicitly (Tex is enabled by default) 
ylabel('P_{m}', 'fontsize', fontSize); 

legend({'$$\textbf{K}_{zz}$$'}, 'interpreter', 'latex','fontsize',fontSize); %Explicit latex 
     %REM: legend needs a cell 

enter image description here

我可以改变'defaultTextInterpreter'

set(0, 'defaultTextInterpreter', 'latex'); 

xlabel('$$P_{fa}$$', 'fontsize', fontSize); 
ylabel('$$P_{m}$$', 'fontsize', fontSize); 

legend({'$$\textbf{K}_{zz}$$'},'interpreter', 'latex','fontsize',fontSize) 

获取更好的版本

enter image description here

如果我从legend呼叫中除掉'interpreter', 'latex',我有不好的结果,但:

enter image description here

+0

太棒了,非常感谢。有一件事,如果我可以,我在哪里可以在文档中找到它? – Maurits