Warning: Unable to interpret TeX string
Mostrar comentarios más antiguos
I often use greek/ latin variables in my titles/ axis, with no problem.
For example;
figure; title('\bf My Output, \Theta');
comes out fine.
I have just tried to use a latex command for the first time and get the error "Warning: Unable to interpret TeX string "Maxima \hat{V}"
plot(1:10);
legend('Maxima {\hat V}', 'Location','Best', 'interpreter','latex');
I am using MATLAB 2012A on Win7. I use WinEdt 6 and the latest MikTex Package.
I have seen there is a lot of stuff on this error in the forums, but it seems to be platform dependant. None of the fixes I have found seem to work for me.
any ideas? thank you!
Respuesta aceptada
Más respuestas (1)
Daniel Shub
el 28 de En. de 2013
Editada: Daniel Shub
el 28 de En. de 2013
It is very possible that I have screwed up my systems LaTeX processing (I have been playing with it recently). For example, on my system,
title('\bf My Output, \Theta');
doesn't work, but
title('\bf My Output, $\Theta$');
does. Similarly
title('Maxima {\hat V}', 'interpreter','latex')
doesn't work, but
title('Maxima ${\hat V}$', 'interpreter','latex')
does.
EDIT
Getting LaTeX to work with a legend is apparently a little tricker. Apparently, despite legend objects having an Interpreter property, it cannot be set with
plot(1:10);
h = legend('Maxima ${\hat V}$', 'Location','Best', 'interpreter','latex');
get(h, 'Interpreter')
Tells you that the interpreter is still tex. It also produces a warning
Warning: Ignoring extra legend entries.
This keys you into the fact that it is treating 'interpreter','latex' as legend entries. If instead you do
plot(1:10);
h = legend('Maxima ${\hat V}$', 'Location','Best');
set(h, 'Interpreter', 'latex')
everything is fine (despite the warnings). Even better would be
plot(1:10);
h = legend('XXX', 'Location','Best');
set(h, 'Interpreter', 'latex', 'string', 'Maxima ${\hat V}$');
which avoids all the errors also.
3 comentarios
Daniel Shub
el 28 de En. de 2013
Moved from answer to comment
none wrote:
ok. very odd.
When I do
plot(1:10);
title('Maxima ${\hat V}$', 'interpreter','latex')I can see the latex as its supposed to be.
When I try and do
plot(1:10);
legend('Maxima ${\hat V}$', 'Location','Best', 'interpreter','latex');
I get "Warning: Unable to interpret TeX string "Maxima ${\hat V}$" "
and the latex does not show properly
Matlab2010
el 28 de En. de 2013
jqfortune
el 16 de En. de 2024
This is so helpful for me in R2020b, thanks so much!
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!