## Institut für Astronomie und Astrophysik

### Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany

### Introduction

TeXtoIDL, written by Matthew Craig, is one of the most useful IDL routines on the market. It should really be in the main IDL distribution itself. The following description is taken from the README file of the TeXtoIDL distribution

### Summary

The purpose of the TeXtoIDL routines is to make it simple to use Greek letters, subscripts and superscripts in making labels for plots in IDL. This is accomplished by allowing the user to use TeX control sequences for Greek letters and special symbols and for sub/superscripts. The TeX control sequences are simple and easy to remember, especially if you already use TeX for writing papers (for those unfamiliar with TeX, an explanation of that notation is below). The translation is done for either vector or PostScript fonts.

Once installed, type (in IDL):

IDL> print,TeXtoIDL(/HELP)

for brief instructions. The command SHOWTeX will display the available TeX sequences on the current graphics device. In addition, subscripts and superscripts in the usual TeX notation are available. For more details on what TeX notation is, see the section INTRO TO TeX, below. EXAMPLE: If you type
IDL> str = TeXtoIDL("\rho^2 + 2\Gamma_{ij}")
IDL> print, str
STR             STRING    = '!7q!X!U2!N + 2!7C!X!Dij!N'
IDL> xyouts,.5,.5,str,CHARSIZE=2.,/NORM

then on the screen you will see the Greek letter rho with a 2 in the exponent, and then a + and then a 2 and then the uppercase Greek letter gamma, with an "ij" in the subscript.

### Intro to TeX:

TeX is a typesetting language which makes including equations in manuscripts very easy. In particular, it has an easy to remember syntax for including Greek letters, special symbols, and subscripts and superscripts. These routines emulate the behavior of TeX, allowing its syntax to be used in making IDL plot labels and the like.

The TeX syntax for Greek letters is simple. If you want, for example, the Greek letter rho, just type \rho and you will get it. The IDL string for rho is !7q!X (for vector fonts) or !Mr!X (for PostScript fonts). In any event, the IDL strings are not easy to remember, and depend on the font type. If you type SHOWTEX at the IDL command line, a table will be made on the current graphics device showing which Greek letters and special symbols are available, and what they look like on your graphics device.

The syntax for sub/superscripts is also simple. An example will make it clear. If I write N_{sub}, I will get an N with the subscript sub. The underscore begins the subscript, and everything enclosed in the braces is in the subscript. Superscripts are similar; N^{sup} is an N with a superscript sup. Since it is frequent to have one character sub- or superscripts, braces are not needed for a one character script. So N^2 makes an N with a 2 in the exponent. You can combine sub and superscripts, for example N^2_{sub}, and you can even put subscripts on the things in your superscripts, e.g. N^{N_j}, though this probably won't look very good.

### Index of Subroutines

 MATCHDELIM Match open/close delimiters in a string. NEXTTOK Find the next occurance of any of a set of characters in a string and return the character which occurs next. SHOWTEX Display TeX sequence translation table on current graphics device. STR_TOKEN Retrieve portion of string up to token. STRCNT Count number of occurrences of a substring in a string. STRTRANS Translate all occurences of one substring to another. SUB_SUP_IDL Return the proper IDL font positioning command for TeX sub/superscripts. TEXTABLE Returns a translation table from TeX to IDL. TEXTOIDL Convert a valid TeX string to a valid IDL string for plot labels. TRANSLATE_SUB_SUPER Translate TeX sub/superscripts to IDL sub/superscripts.