help-octave
[Top][All Lists]

Re: superscript, subscript, Greek characters in plot labels?

 From: Quentin Spencer Subject: Re: superscript, subscript, Greek characters in plot labels? Date: Thu, 27 Oct 2005 09:51:59 -0500 User-agent: Mozilla Thunderbird 1.0.7-1.1.fc4 (X11/20050929)

A S Hodel wrote:


I had a similar question last spring. The best answer of the many provided involves the use of the script fig2ps and a slight modification to the octave-forge print.m function so that it generates fig files with "special" text.


I also use fig2ps and recommend it.


You also need to pay attention to the fact that the backslash character "\" is escaped a couple of times in the octave scripts, so you need to write
\\\\omega
\omega

in the octave plot command legend, or, if you use the octave-forge legend command, I think you need eight backslashes instead of four. Weird and annoying, but you get what you want in the output.



Another way to deal with this problem is using the undo_string_escapes function:
octave:1> undo_string_escapes('\a')
ans = \\a
octave:2> undo_string_escapes('\\a')
ans = \\\\a


I've also noticed the need for a potentially large number of backslashes when using certain commands like legend. Ideally, those functions should be calling undo_string_escapes internally each time they evaluate the strings so that the number of backslahes you need is always consistent. Are the legend commands the only ones you've found with this problem?

-Quentin

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------