xlabeltex.m (706B)
1 function []=xlabeltex(x,str); 2 % where str=strmat('$\bar{a}$ $\bar{b}$') for example. 3 % Place tick marks at the x location as well as the LaTex strings. 4 % 5 % Revised Sep 2005: Use tex interpreter, not latex, if 6 % no $$ are found in the string: e.g. str='\bar{a} \pi'. 7 % This works better! Although does not have \bar{} for some reason! 8 9 cax=axis; 10 ymin=cax(3); 11 ystep=cax(4)-ymin; 12 set(gca,'XTick',x,'XTickLabel',''); 13 14 for i=1:length(x); 15 if ~isempty(find(str=='$')); 16 text(x(i),ymin-.05*ystep,str(i,:),'Interpreter','latex','HorizontalAlignment','center','FontSize',16); 17 else; 18 text(x(i),ymin-.05*ystep,str(i,:),'Interpreter','tex','HorizontalAlignment','center','FontSize',16); 19 end; 20 end;