Minus sign would not show up in legend plot MATLAB 2010a linux
Show older comments
I run the following code:
figure;
plot(1,2,'b-');
legend({'$-k_2\varepsilon_2^2$'},'Interpreter','latex');
and got the desired printed result on a WinXP machine:
>> ver
-------
MATLAB Version 7.10.0.499 (R2010a)
MATLAB License Number: xx
Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 3)
Java VM Version: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
While on a linux workstation, the minus sign would not show up. Details concerning this platform
>> ver
---------------
MATLAB Version 7.10.0.499 (R2010a)
MATLAB License Number: xx
Operating System: Linux 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686
Java VM Version: Java 1.6.0_12-b04 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
I was curios if someone knew why the linux version of R2010a encounters this problem, although I did find some workaround, by excluding the minus between $ $ signs: legend({'-$k_2\varepsilon_2^2$'},'Interpreter','latex');
Answers (2)
Patrick Kalita
on 2 Jun 2011
0 votes
I think this is just a bug in how certain LaTeX symbols are handled on certain platforms. See this bug report.
The workaround you've found for yourself is probably the best you can do.
using: print('filename','-dpdf','-r600') the minus sign appears in the pdf-document, but the minus sign and letter behind appear at the same position.
the workaround does not work for a minus sign after ^ or _ .
Categories
Find more on Downloads in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!