Using TexToIDL in Coyote Graphics Routines [message #82275] |
Sat, 24 November 2012 09:03 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
Although cgSymbol provides the vast majority of functionality
that the TexToIDL program provides, many IDL users are
familiar with the TexToIDL program and prefer to use it
to format graphical text output.
There is no problem using TexToIDL in Coyote Graphics
programs, UNTIL you use the resizeable graphics window,
cgWindow. Then there is a problem with evaluating keyword
expressions:
http://www.idlcoyote.com/cg_tips/kwexpressions.php
Basically, I can't execute the TexToIDL program from
the "replay commands" strategy used in a resizeable
graphics window. At least not until now.
Today I made a few changes to Coyote Graphics programs
that will allow you to embed TexToIDL strings directly
in textual output. All you will have to do is add a
"\tex" prefix to any embedded symbol.
Let me give you an example. Suppose you wanted to
write "A goes to B, for B subset of C". This involves
a right arrow symbol and a subset symbol that are
not in cgSymbol, so you want to use TexToIDL to
create those symbols. You would construct and display
the string like this:
aString = 'A $\tex\rightarrow$ B, B $\tex\subset$ C'
cgText, 0.5, 0.5, Align=0.5, /Normal, Charsize=2, aString
You can use this string in any plot or axis title, etc.
cgPlot, cgDemoData(1), XTitle=aString
You can even use it in the resizeable graphics window, cgWindow:
cgPlot, cgDemoData(1), XTitle=aString, /Window
It will produce the correct PostScript version automatically.
Naturally, you have to have the TexToIDL programs installed
properly and on your IDL path. Plus, you will have to have
today's version of the Coyote Library to obtain this
functionality:
http://www.idlcoyote.com/programs/zip_files/coyoteprograms.z ip
Also, because of the way TexToIDL selects it PostScript output,
you will have to set !P.Font to either 0 or 1 to get the correct
PostScript output. If you are using PS_START and PS_END, as
all Coyote Graphics programs do, you won't have to worry about
this at all. It is done automatically.
If you want to use this embedded functionality in non-Coyote
Graphics programs, you will have to prepare your text output
with cgCheckForSymbols.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|