# Math Text Instruction Syntax

The math text instruction set offers advanced formatting of text in the Didger plot window. Math text instructions can be used to change the typeface, size, color, weight, and style of text on a character-by-character basis. Greek letters and mathematical symbols can be written in the plot window using math text instructions. The math text instructions also allow for the detailed placement of characters and symbols; thus, superscripts, subscripts, and the superposition of characters are possible.

All text within the plot window can be controlled by math text instructions. For example, labels can include math text instructions in the text string. To use different text properties in the Text Editor, highlight the text to change and click the appropriate button or command in the dialog.

Unless otherwise indicated, all math text instructions begin with a backslash ("\"), and end with a single space. For example, the instruction "\up50 " shifts the baseline of the text up 50 percent of the current text height. All characters from the beginning backslash through the ending single space are interpreted as instructions by the math text interpreter and are not included in the resulting label.

Each line in a text block starts with the default text properties such as typeface, size, color, and style. (Note that some typefaces, such as Symbol, do not support bold or italicized text.) A line of text within a text block uses the current properties until a math text instruction is encountered. All text following an instruction is modified according to the instruction. For example, if the typeface is changed in the middle of a text string, the text following the instruction will use the new typeface until the end of the line of text is reached, or until another instruction affecting the typeface is encountered.

## Encapsulate Math Text Instruction

Math text instructions can also be encapsulated so they are not carried out over an entire line. A left curly brace ("{") instructs the math text system to remember all of the text properties in effect at that point. A right curly brace ("}") restores the properties to what they were at the matching left curly brace. This allows the insertion of special text in the middle of an otherwise uniform text block. The only instructions this does not apply to are text baseline instructions (\dnX and \upX), and the position instructions (\rpX and \spX). Curly braces can be nested.

To incorporate a backslash, right curly brace, or left curly brace as a text character in a text block, precede them with a backslash when entering the text string. For example, "\\" produces "\", and "\{" produces "{".

## Percentage Instructions

Instructions based on a percentage, such as font size, are cumulative. This means that a second percentage change within a text block is interpreted as a percentage of the first percentage change. For example, if the font is scaled by 50%, and later in the same text block the font is scaled by 50% again, the font size after the second percentage would be 25% of the original font size.

Note: Instructions names case insensitive (\fs50, \FS50, \Fs50 or \fS50 are all valid).

Note: The \sp and \rp instructions only refer to positions on the same line.

## Instructions that Change Typefaces, Sizes, and Styles

 Math Text Instruction Result \b All text after the \b command is bold. \f"X" Change to the typeface named X. These are the names listed in the Face list box in the Text dialog in the plot window. Typeface names are case sensitive. Enclose the face name in double quotes. If the typeface is not found, a generic stick typeface is used in place of the unfound typeface. \fsX Change font size to X% of current font size. For example, a value of 200 for X increases the font size by two, and a value of 50 for X decreases the font size by one-half. \i All text after the \i instruction is italicized. \plain This sets the text to "plain" text with normal weight, no italics, no underlining, and no strikethrough. \strike Strikethrough the text. \ul All text after the \ul instruction is underlined.

## Instructions that Change Text Color

 Math Text Instruction Result The following instructions are provided to make it easy to set basic text colors: \black Sets the text color to black. \blue Sets the text color to blue. \green Sets the text color to green. \cyan Sets the text color to cyan. \red Sets the text color to red. \magenta Sets the text color to magenta. \yellow Sets the text color to yellow. \white Sets the text color to white. \gray Sets the text color to gray. The following instructions allow the text color to be set to an arbitrary RGBA (Red,Green,Blue, Alpha) value: \rgbrX Sets the amount of red in an RGBA text color (X=0 to 255). \rgbgX Sets the amount of green in an RGBA text color (X=0 to 255). \rgbbX Sets the amount of blue in an RGBA text color (X=0 to 255). \rgbaX Sets the alpha value in the RGBA text color (X=0 to 255). \color(r,g,b,a) Sets the amount or red, green, blue, and alpha value in the RGBA text color. r, g, b, and a are all a value between 0 and 255.

## Instructions that Change Text Position

 Math Text Instruction Result \dnX Moves text baseline down X% of current font size (subscript). This instruction produces subscripts or returns the baseline to the original position following a \upX instruction. If a font size (\fsX) instruction follows the \dnX instruction, any subsequent \dnX or \upX instructions are relative to the changed font size. \rpX Restores the current position to position #X (X = 1 to 20). This instruction is used in conjunction with the \spX instruction. Any text following this instruction begins at the position defined with the \spX instruction. If the \rpX instruction is used without first setting a position with the \spX instruction, the position for the text is returned to the stating position for the text block. \spX Saves the current position as position #X (X = 1 to 20). The position is the up, down, left, and right areas within the text block. When the \spX instruction is used, the current location within the text block is assigned a position number. Return to this position using the \rpX instruction. Specify the position number assigned with the \spX instruction when using the \rpX instruction. These instructions are most useful when placing both superscript and subscripts after the same character. \upX Moves the text baseline up X% of current font size (superscript). This instruction is used to produce superscripts or to return the baseline to the original position following a \dnX instruction. If a font size (\fsX) instruction follows the \spX instruction, any subsequent \upX or \dnX instructions are relative to the changed font size.

## Instructions Used to Insert Special Characters or Date and Time

 Math Text Instruction Result \aX Insert an ANSI character with code given by X (0 to 255). Generally, this instruction is needed for characters with ANSI numbers beyond the normal limits of the keyboard. For example, use the ANSI character code to include an integral sign in a text string. By determining the character set, followed by the \aX command to specify the correct character number. For example, an integral sign is located at ANSI position 242 in a symbol set called Symbol. Type \f"Symbol" \a242 for the integral to appear in the text block.   The Character Map program is an accessory program in the Windows installations. Use the Character Map to display each of the available character sets with the ANSI code. The ANSI code is displayed in the right half of the Character Map status bar when a character is selected. \date Inserts the current date. Be sure to follow this instruction with a space, even if no other text follows the date. The date is updated every time the text is redrawn. \time Inserts the current time. Be sure to follow this instruction with a space, even if no other text follows the time. The time is updated every time the text is redrawn. \dt("format") Inserts the current date and/or time as indicated by a custom format string. Be sure to follow this instruction with a space, even if no other text follows the closing parenthesis. The date and or time is updated every time the text is redrawn.

## Examples of Math Text Instructions

Due to page size limitations, some of these examples contain multiple lines of math text instructions. These examples must be entered on one line for the text to be displayed correctly.

 Math Text Instruction Result CO\dn50 2 CO2 x\up50 2 x2 \sp1 {\fs200 \f"Symbol" \a229 \sp2 }{\rp1 \dn90 \fs75 i=1\rp1 \up220 n}\rp2 \up25 X\dn50 {\fs75 i}\up50 Y\dn50 {\fs75 i}\up50 = S{\dn50 {\fs75 XY}\up50 } {\i Avogadro} Constant = 6.022 x 10{\up50 {\fs75 23}\dn50 } Avogadro Constant = 6.022 x 1023 {\f"Symbol" \a209 }{\up50 {\fs50 2}\dn50 }{\f"Symbol" \a102 } = {\f"Symbol" \a182 }{\up50 {\fs50 2}\dn50 }{\f"Symbol" \a102 }/{\f"Symbol" \a182 }x{\up50 {\fs50 2}\dn50 } + {\f"Symbol" \a182 }{\up50 {\fs50 2}\dn50 }{\f"Symbol" \a102 }/{\f"Symbol" \a182 }y{\up50 {\fs50 2}\dn50 } {\fs200 N}\sp1 \up100 \fs75 5 \rp1 \dn50 1 sin{\up50 {\fs50 2}\dn50 }(X) + cos{\up50 {\fs50 2}\dn50 }(X) = 1 104\f"Symbol" \a176 \f"Arial" 37' \sp1 \up25 a\dn25 {\fs75 c}\rp1 ___\rp1 \dn100 b\dn25 {\fs75 c} {\f"Symbol" d}\up50 {\fs75 234}\dn50 U