Re: text in graphics
- To: mathgroup at yoda.physics.unc.edu
- Subject: Re: text in graphics
- From: ross at macmath.btec.mq.edu.au (Ross Moore)
- Date: Wed, 3 Jun 92 18:13:06 +1000
Gerhold Fasol asks...
Does anybody know if some TeX-like method
exists to produce exponents etc in FrameLabels and other text within
graphics?
Yes, you can do exponents and subscripts and other fonts.
For fonts you use FontForm[] see pp467-470 of the bible.
This section also explains how to position pieces of text at
desired locations, and oriented at specified angles.
There is a catch that is not mentioned which may be applicable if
you are using non-standard fonts, or non-standard symbols within
standard fonts. Basically the problem is with PostScript, not Mma.
It relates to character codes of the characters within a font.
Typing a, b, c, ... A, B, C, ... will get you most characters but
there may be some, with codes 128--255 that cannot be generated this way.
To get these you must type \xyz where xyz is the 3-digit Octal representation
of the desired character. e.g. \260 produces an infinity symbol in many
Macintosh fonts.
e.g.
Show @ Graphics[
Text[FontForm["\265",{"Symbol",36}],{.5,.5}]
]
produces the desired symbol, and prints correctly.
WARNING: FontForm["\260",{Times-Roman",36}] also gives an infinity
symbol on screen, but it does not print. This is because there is no
character \260 in the PostScript Times-Roman font. The Mac references
this character from the Symbol font.
To get exponents for labels, the easiest way is to use OutputForm .
For example,
PlotLabel -> "f(x) = " (5/4 x^(4/5) //OutputForm)
gives a label formatted in the same way as you get with:
Print[ "f(x) = ", 5/4 x^(4/5) ];
4/5
5 x
f(x) = ------
4
If the spacings and/or sizes are not to your liking here, you might try
hacking at the PostScript code to get what you want.
Cheers,
Ross Moore.