2012-11-23 47 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