Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Turning off the Latex Interpreter

405 views
Skip to first unread message

Kashif Israr

unread,
May 23, 2002, 3:06:35 AM5/23/02
to
Hello all


I am trying to print text on matlab plots and that text have some
underscores, due to which the display on the plot screws and I have
to click on each text box and turn off the Latex Interpreter
manually, which is a tedious process because of huge number of text
blocks...


Can anyone tell me how to turn that latex interpreter 'off' from
command line... or some way of replacing UNDERSCORES in a text array
with some other character like HYPHENS ....


Thankyou in advance.


Regards,
Kashif

Peter Rydesäter

unread,
May 23, 2002, 4:08:40 AM5/23/02
to
> I am trying to print text on matlab plots and that text have some
> underscores.........


Each text string in a matlab figure window is represented internal as structure/object with a lot of options. All text objects has a option "interpreter" that can have two values "latex" or "none" and you should change to "none". If you have the handler (a referns numer stored in a variable) to the text object then can you change it easy by:


set(h,'interpreter','none');


Functions that create crapichal object in figure windows almost returns the hander number if an return argument is specified.


h=title('My_test_file.txt');
set(h,'interpreter','none');


h=xlabel('X_X');
set(h,'interpreter','none');


In some cases it also possible to feed this extra options as extra parameters to the function that create it:


xlabel('X_X','interpreter','none');
title('My_test_file.txt','interpreter','none','FontSize',18);


If you what to know what other options is available:


h=title('Test')
get(h) % List actual state of all paramters
% or
set(h) % List possible options for all paramters


This will list paramters and its state/options in the screen.


If you whant to have some fancy mathimatical symbols in your
labels then its good to have the interprer turned on like


title('My \pi^2 function')


If you whant to keep underscores _ and latex, then you have to replace all _ with its latex code, \_ , in matlab strings.


/Peter

Ross Woods

unread,
May 23, 2002, 6:33:33 PM5/23/02
to
"Kashif Israr" <kis...@eecs.umich.edu> wrote in message news:<eeae1...@WebX.raydaftYaTP>...

> Can anyone tell me how to turn that latex interpreter 'off' from
> command line...
1. For each text object, set the 'interpreter' property to 'none'

2. It is less work to set the default for the figure before you make
any text:
figure
set(gcf,'defaulttextinterpreter','none')
% and now all succeeding text objects in that figure will be
interpreted as 'none' instead of 'tex'

3. Or you can make everything with the tex interpreter as you do now,
and then find all the text objects in a figure, and change the
interpreter:

% after creating the figure,
%find all the axes in the current figure
h=findobj(gcf,'type','axes');
%get the handles of the axis label strings in all these axes
hl=[get(h,'title') get(h,'xlabel') get(h,'ylabel') get(h,'zlabel')];
%Find all the text objects in this figure
ht=findobj(gcf,'type','text');
%Change the interpreter for all the label strings AND all text strings
set([hl{:} ht(:)],'interpreter','none');


> or some way of replacing UNDERSCORES in a text array
> with some other character like HYPHENS ....

%The strrep function:
newarray=strrep(oldarray,'_','-');

Cheers,
Ross

ws

unread,
May 28, 2002, 10:53:32 AM5/28/02
to
Hello,
a minor alternative:
>>title('My_test_file.txt','interpreter','none')

Thanks,
--ws

0 new messages