Coyote Graphics Routines

Date: Fri Mar 27 12:14:20 2015

single page | use frames     summary     class     fields     routine details     file attributes

.\

cgcheckforsymbols.pro


top cgCheckForSymbols

Utilities

result = cgCheckForSymbols(aString)

The purpose of this funciton is to check a string for symbols, encased in escape characters, that should be revolved with cgSymbol. The cgSymbol name will appear with the characters "$\" prepended to the name, and the character "$" appended. All Greek characters and other symbols supported by cgSymbol are allowed. Also, subscripts and superscripts are allowed:

$\upTEXT$ : Raise the text in TEXT to superscript level and reduce character size by 62%. $\extTEXT$ : Raise the text in TEXT to superscript level and reduce character size by 44%. $\downTEXT$ : Lower the text in TEXT to subscript level and reduce character size by 62%. $\subTEXT$ : Lower the text in TEXT to subscript level and reduce character size by 44%.

Return value

The modified string with the cgSymbol code embedded in place of the escaped symbol name.

Parameters

aString in required type=string

The string that should be searched for cgSymbol values.

Examples

To create a plot that uses the Greek mu character on the X axis and the Angstrom squared symbol on the Y axis:

cgPlot, cgDemoData(1), XTitle='Length ($\mu$M)', YTitle='Distance ($\Angstrom$$\up2$)'
It is possible to use Greek characters as superscripts and subscripts. Do so by prepending the Greek character with "\\" inside the normal superscript or subscript notation. For example, to use lambda as an exponent to the Greek character Omega, you can type this:
cgPlot, cgDemoData(1), XTitle='$\Omega$$\exp\\lambda$', Charsize=2.0
To use lambda as a subscript, type this:

cgPlot, cgDemoData(1), XTitle='$\Omega$$\sub\\lambda$', Charsize=2.0

The program has been modified to accept TexToIDL tokens. They must be preceed by a "\tex" prefix. For example, to draw a right arrow between 5 and 3, you would construct the embedded string like this:

aString = '5 $\tex\rightarrow$ 3' cgText, 0.5, 0.5, /Normal, Align=0.5, Charsize=3.0, aString

Author information

Author:

FANNING SOFTWARE CONSULTING:

David W. Fanning 1645 Sheely Drive Fort Collins, CO 80526 USA Phone: 970-221-0438 E-mail: david@idlcoyote.com Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Copyright:

Copyright (c) 2012, Fanning Software Consulting, Inc.

History:

Change History:

Written by David W. Fanning, 27 July 2012. Modified to check for superscript and subscript codes. 9 November 2012. DWF. Modified to allow the user to use the TexToIDL program from embedded codes. To use a right arrow, for example, aString = '5 $\tex\rightarrow$ 3' Added the ability to use Greek letters as subscripts and superscripts. See the examples for details. 21 April 2013. DWF.

File attributes

Modification date: Fri Mar 27 11:07:37 2015
Lines: 205
Docformat: rst rst