3 The KASDEF commands

3.1 Preface

The term KASDEF has historical reasons (german \Kastendenition", i.e. denition of the box). KASDEF commands start with the word KASDEF. It's more modern to use the Backslash (n) instead (both are valid, though). Error messages (and partly this manual) still use the old naming KASDEF.

KASDEF commands may have continuation lines. They start with
n>
and work as if the previous line's KASDEF command were continued behind the > character.

(Nearly) all KASDEF commands that have a parameter with the meaning in units may have these replaced by predened constants XMIN, XMAX, YMIN, YMAX and PXMIN etc., where XMIN etc. are the coordinates of the BoundingBox and PXMIN etc. are those of the page. This option is however partly obsolete and should not be used anymore. It's more convenient to use (proper variables instead (see below).

KASDEF commands may contain variables which are replaced by their current content during the program execution. Variables (see Ch. 3.3.2) are marked by a preceding dollar sign ($, like in Unix). In principal they are Strings, but one can also calculate with them if their contents are numbers (see, e.g., nCALC). The command nPREDEFINE-VARIABLES (see page 23) creates a whole set of standard variables, e.g. $XMIN.

Note that variable names are re|laced by their conten nearly everywhere. When printing text, each $ is interpreted as the beginning of a variable and the program tries to replace it. In case a dollar sign shall be printed, it needs to be escaped by n$ (also see Table 1). Exception: As long as a plot has no variables dened, the substitution of variables is switched o.

Furthermore, in many cases it's possible (try!) to use the code word SAME in place of repeated parameters, e.g.:
nSYM 3. 4. 0. 0. 1. 4
nSYM SAME SAME 0. 0. 1. 8
plots a square and a circle centered at the same coordinates.

In many KASDEF commands, parameters may be specied to be taken logarithmically, or to be raised to a power of ten. For example, one can write LOG35000 (without blank!) for log(35000) and DEX5. for 105:. Arithmetic expressions instead of parameters are not yet possible but planned for future versions of the program (so far one has to use the CALC command to prepare parameters).

3.1.1 Three types of KASDEF commands

The execution of WRplot is split into three phases:

WRplot has three types of KASDEF commands:

Settings
are interpreted during the read-in phase of the WRplot le. They set certain specications for the plot which cannot be changed later. The nINCLUDE command, which inserts the KASDEFS from an external le, belongs to the Settings, too.
Instructions
are KASDEF commands that do not perform plotting actions, but, e.g., deal with variables. Instructions can be arranged inside INSTRUCTION EXPORT blocks; such blocks are already executed during the read-in phase of the plot le. Any KASDEF commands outside such blocks are rst stored in a buer and executed later during the phase when the plot is created.
Plot commands
create the output of text and graphics or relate to such actions (e.g. denition of the current color by nCOLOR). As Plot commands are not executed in the read-in phase, and are therefore not allowed inside an INSTRUCTION EXPORT block.

Because some old WRplot scripts may violate this strict rule, WRplot enters a compatibility mode if a Plot command is found inside an INSTRUCTION EXPORT block. In this case, all commands of the INSTRUCTION EXPORT block are executed a second time during the Plot phase. A WARNING is issued, because this might cause spurious eects.

Settings and Instructions may only appear in the preamble, e.g. before the block that describes the box (starting with HEADER). Plot commands may in contrast also appear further below, i.e. between the data blocks.

3.2 Settings

KASDEF commands of this type are read rst, as they pre-specify certain values which cannot be modied later anymore. These commands must appear before the HEADER line (otherwise they are ignored and produce a non-fatal error message).

nINTERACTIVE
 
enters the interactive mode; the same mode can be reached by the interactive menues, when calling wrplot without lename. Clearly, it only works with the X11 window (i.e. not when a PostScript le shall be produced).

The INTERACTIVE mode oers many possibilities, especially by means of graphic input with the mouse, for instance:

The menus are self-explaining, please gure out yourself.

nPENDEF
<pen: integer>
Denes the default value of the line thickness for datasets (in units of typographic points, i.e. 1/72 inch).
nDEFAULTCOLOUR
: integer>
Denes the default color of the datasets. If not specied, it is 1 (black).
nOFS
<xoffset: cm> <yoffset: cm>
Sets the oset of the lower left corner of the plot box relative to the corner of the page. The default is (4., 3.). This option is especially needed to arrange multiple plots on a single page (MULTIPLOT).
nSKL
<Scale factor f : real>
Scales the following plot by the given scale factor f . The default is 1. This is often needed to arrange multiple plots on a single page.
nINBOX
 
Datasets are clipped to the inside of the box. Graphical objects plotted by KASDEF commands are not subject to this clipping, unless the corresponding KASDEF command stands after a PAUSE command and is hence plotted after the datasets. Filled areas which are partly clipped might suer from spurious eects.
nNOBOX
 
The plot box (including tick marks and their labels) are suppressed. The header (plot caption) and axes descriptions are not aected.
nLATEBOX
 
The data box (including tick marks etc.) are plotted after the datasets, i.e. can overplots other objects.
nDEFAULTS
 
denes a coordinate system with scales of 1 cm per unit in both axes. The origin is at the lower left corner of the page (i.e. it implies nOSF 0 0), and the axes are not shown (i.e. it implies NOBOX). This DEFAULTS setting is mutually exclusive with the denition of the coordinate box as decribed in Sect. 5.
nLETTERSIZE
<size r: real>
Size of the characters for labels of the plot box (tick labels, axes descriptions, plot caption). Default: 0.4
nTICKSIZE
<size r: real>
Size of the (small) ticks at the plot box (the numbered ones have the double length); by default their size is harmonic to the LETTERSIZE (same numerical value).
nSET_NDATMAX
<n.points n: integer>
Changes the maximum number of data pairs in a dataset. The default is NDATMAX = 100000. The maximum value allowed is 10 times this default. Increasing NDATMAX leads to a corresponding decrease of the maximum number of datasets, NSETMAX.
nSET_NSETMAX
<n.sets n: integer>
Change the maximum number of datasets. The default is NSETMAX = 100. The maximum value allowed is 10 times the default. Increasing NSETMAX leads to a corresponding decrease of the maximum number of data pairs in a dataset, NDATMAX, such that NSETMAX NDATMAX 107.
nINCLUDE
<lename: string> [INCKEY=\string"]
Reads and includes all KASDEF commands from the given le at that point in the WRplot le. Lines are checked for KASDEF commands (i.e. for lines starting with n or KASDEF); other lines are ignored.

If the keyword INCKEY=\<string>" is set, the reading starts below the rst line which starts with the given string; reading ends when a line \END" is encountered (or at the end of the le).

If the include-key is a variable, this variable must be dened inside an INSTRUCTION EXPORT block (see below). If this variable contains blanks (or other delimiters), the variable name must be enclosed in double (!) double quotes, for instance: INCKEY=""$varkey"".

nINSTRUCTION EXPORT
 
until
nINSTRUCTION NO-EXPORT
 
All Instructions between these two lines constitute an \INSTRUCTION EXPORT" block. All commands inside such blocks are already executed during the read-in phase. This is needed, for instance, to set variables or create data which are used when reading the datasets.

3.3 Instructions

3.3.1 Output in the Terminal/command window and System calls

nECHO
string
Writes the String to the Terminal/command window
nSYSTEM
commands-to-be-passed
WRplot allows shell calls, i.e.
nSYSTEM echo The le $le has cat $le j wc -l lines.
The line's content after SYSTEM is passed to a fortran shell call, i.e. to Bash. Note: Variables are expanded before they are passed to the shell. To use system variables, use n$ (e.g. n$PWD). Variables are not handed back to WRplot (see the example at nREAD, e.g. Sect.  3.3.5).

3.3.2 Variables

Variables are used by WRplot in a similar syntax as in UNIX. A dollar sign ($) preceding a variable name refers to the content of this variable. Note that, like in UNIX, variable names are case-sensitive. The length of a variable name, as well of a variable's content, is limited to 132 characters. The end of the variable's name is indicated by a blank or another delimiter out of the set ,=:+-*/^{}()"$ | these characters cannot be part of the variable's name, thus. For compatibility with older versions, the arithmetic operators +-*/ are still { until further notice? | allowed, unless this variable is used in nCALC operations. To separate a variable's name from directly following text, enclose it in double quotes, e.g. "$Mv"mag (the quotes are interpreted as delimiters and removed).

Square brackets ([,]) are allowed at the end of variables' names to indicate/emulate indexed variables. In case the index is a variable (with preceding $), it is rst replaced by its value, then all other variables are interpreted. Example:
nCALC x2[$i] = $x[$i]**2 

Blanks are not allowed between the square brackets. Variables with multiple indices are not allowed yet.

nVAR
A = :::
Fill a variable (here A) with the given content.
nPREDEFINE-VARIABLES
 

Denes a couple of standard variables, e.g.:
the minimum and maximum value of the plot's coordinate box, as well as the midpoint values of both axes (in their respective units) (XMIN, XMAX, XMID, YMIN, YMAX, YMID)

the coordinates (in units) of the paper borders and center of the page (PXMIN, PXMAX, PXCENTER, PYMIN, PYMAX, PYCENTER)
the scale factors to convert units to cm (XSCALE, YSCALE)

lename, date and time (FILENAME, DATE, TIME). Attention, only these three variables are immediately accessible after the predene command; all others are dened after the coordinate box has been specied.

nGETTIME
 
Write the current time (format: hh:mm:ss) into the variable TIME.
nCALC
A = expression
Calculate arithmetic expressions. The syntax is quite exible and robust. It mainly corresponds to the syntax rules of fortran. The following arithmetic operators are allowed:
+ - * /, power (ab) with ** or ^   and functions as well as nested parentheses. Constants may be in the following formats: I, F, E (Integer, Float/Real, Exponential). Variables need the preceding $, of course. Blanks are not signicant.

The following functions are intrinsic (the names of these functions may be typed in small or in capital letters, but not mixed):

SIN, COS: sinus, cosinus; in contrast to fortran, the argument is in degrees;

ATAN: arcus tangens; in contrast to fortran, the result is in degrees;

DEX: dex($x) is equivalent to 10x;

LOG: decadic logarithm

EXP exponential function;

LN: natural logarithm;

SQRT: square root;

ABS: absolute value

RAND: random number in the range (0.0, 1.0); the argument of this function decides: RAND(0) ! each run yields the same sequence of random numbers; RAND(1) (or any argument , 0) ! each run yields dierent random numbers. Actually, the alternative executables behave slightly dierent in this respect: in the gnu version, the rst call of the RAN function decides the seed behaviour, while in the intel versions all calls must have the zero argument in order to reproduce the random sequence;

INT: cuts o the decimals (like in fortran);

INT: rounding to the nearest integer (like in fortran).

nCALC_DEBUG
 
or nCALC_DEBUG ON enables debug output in the console window showing how nCALC evaluates the arithmetic expression step by step.
nCALC_DEBUG OFF
Switch o the debug output (default).
nEXPR
A = $var1 // $var2
concatenates the strings in the two variables;
for historical reasons, the operator between the variables can also be an arithmetic operator (+, -, * or /), but one should now use nCALC instead.
nVAR-LIST
 
prints the current list of all variables and their content to the terminal.
nFORMAT
formatstring $var
Formatting of a real number according to the formatstring which has to be specied in fortran syntax, including the parentheses, e.g. (F5.2), (PG8.2) or (E8.2). Use doublequotes if the string contains delimiters.
nFORMATI
formatstring $var
formatting of an integer number according to the formatstring which has to be specied in fortran syntax, including the parentheses. Use doublequotes if the string contains delimiters. Example: a variable i = 1, after
 \FORMATI "(SP,I4.3)" $i
has the content +001
nFORMATA
formatstring $var
formatting of a string variable according to the formatstring which has to be specied in fortran syntax, including the parentheses. Enclose in doublequotes if the formatstring contains delimiters. Note that the format specier \A" may not be used without specied length, and that the length of the re-formatted string may not exceed 132 characters. formata can be conveniently used to augment a string with leading blanks, as in the following example:
 \FORMATA "(3X,A10)" $text 
nCUTVAR
var  n : m
Cutting a string that is content of a variable. The new value of var will be the substring (n : m) where n and m are the character positions within the string (starting with 1). The colon between n and m stands for any delimiter or blank. The rst argument may be left blank (i.e. var  : m) or the second may be blank, i.e. var  n : (with obvious defaults). If n and/or m are negative, the position is counted from the end.
Example: \CUTVAR $var 1:-5 cuts o the last ve characters of $var. Here the dollar sign of $var may be omitted.

3.3.3 IF (conditional) constructions

Like in fortran, one can build (nested) constructions of IF, ELSEIF, ELSE and ENDIF. In contrast to fortran syntax, the logical expression may only be a simple comparison (no .AND. and .OR.). Neither parentheses nor the keyword THEN are allowed.

The operators .EQ. and .NE. compare the operands as strings (i.e. 0 is dierent from 0.0 here!); the other operators .LT., .LE., .GT. and .GE. assume the operands as numbers and compare them accordingly.
The command ELSEIF must be written as one word.
Example:

\IF $k .LT. $l  
  \ECHO branch 0  
\ELSE  
  \IF a .EQ. b  
    \ECHO branch1  
  \ELSEIF a .EQ. $c  
    \ECHO branch 2  
  \ELSE  
    \ECHO branch 3  
  \ENDIF  
\ENDIF

3.3.4 DO-Loops and GOTO

One can construct (nested) DO loops with KASDEFs, too:

nDO
labelname I=start end [increment]
n... kasdef statements)
nLABEL
labelname

nLABEL labelname
(with the same labelname as specied in the nDO statement) marks the end of the loop. The control parameter must not be integer. Nested loops may end at the same LABEL.

Note: WRplot does not check for repeated allocation of the same labelname; a DO loop ends where the rst tting LABEL is found.

nGOTO
labelname
Jump to the line with the rst occurrence of nLABEL labelname in the plot le, starting the search from the beginning of the le.

3.3.5 Write into/read from a le

Only one le can be open at a time for reading or writing with KASDEF commands. A unix lename is assigned by:

nOPEN lename

...

nWRITE ...

nCLOSE <lename>

If the OPEN command is absent, the default lename is fort.50. If the CLOSE command is absent, the le will not be closed and may either be incomplete or grow with each new execution of the WRplot le.

Note: If a le is opened and written with an INSTRUCTION EXPORT block, the le written can already be read as a dataset in the dataset section. This provides very exible possibilities.

nREAD varname
reads from the currently open le. The current line will be stored in the variable $varname. If reading reaches the end of the le, $varname gets the content E-O-F.

Example:

\VAR n=0  
\OPEN inutfile  
\LABEL begin  
 \READ line  
 \IF $line .EQ. E-O-F  
  \GOTO continue  
 \ENDIF  
 \CALC n = $n + 1  
 \FORMATI "(I2.2)" $n  
 \ECHO $n $line  
\GOTO begin  
\LABEL continue  
\CLOSE

This example reads from inputle and echoes line-by-line on the console with a preceding two-digit line number, till the end of the le is reached.

3.4 Plotcommands

Plot commands allow the output of text or graphics or relate to such output.

nPAUSE
 
the execution of the subsequent KASDEF commands is postponed until the datasets have been plotted.

3.4.1 Changing line thickness, color and font

nPEN
<pen: integer>
sets the line thickness hereafter to pen typographical points (default: PEN=1).
nFONT
<font: string>
sets the current font for text output in the plot. The following fonts are dened: WRPLOT (default), TIMES, HELVETICA (in short: HELVET), COURIER or ZAPF (see page 78).
nCOLOR
<color i: integer>
sets the color for graphical and text output by the subsequent KASDEF commands. Colors are encoded as one-digit integers (i = 0:::9), using the current color denitions. See Fig.  3 for the default denitions. The default is COLOR=1.
nDEFINECOLOR
<color i: integer> : real> : real> : real>
It is possible to change colors in WRplot, i.e. to plot in more than ten colors or just to alter them. The new color denition is valid from the point of denition onward (either to the end of the plot { if using a MULTIPLOT it needs to be dened for each PLOT { or until the color is reset/redened).

The values r, g and b are the relative intensities of red, green and blue, respectively; they can each range between 0 (no intensity, i.e. `00' in hex) and 1 (full intensity, i.e. `FF' in hex). Colors are mixed in an additive way.

The colors 0 to 9 are predened according to the following table (also see Fig.  3). For usage with projectors one can use a set of predened colors with darker background, see wrplot.dir/screen.kasdefs and the right part of Fig.  3.














numberi 0 1 2 3 4 5 6 7 8 9
name whiteblackredgreendarkyellowpinklight light blue
blue bluegreen












red r 1. 0. 1. 0. 0. 1. 1. 0. 0.5 0.0
green g 1. 0. 0. 1. 0. 1. 0. 1. 1.0 0.5
blue b 1. 0. 0. 0. 1. 0. 1. 1. 0.0 1.0













nRESETCOLOR
 
Restore all predened colors to their original values (i.e. see the above table). Luxury!
nLIMITCOLOR = nr ng nb
 
Limit the number of colors usable with DEFINECOLOR. It coarsens the steps of the RGB-color cube to nr, ng and nb steps. This only applies to the X11-window (if the graphic controller of the computer needs some adjustment), but not the generated PS-le(s). Should be obsolete with modern computers.
nNCOLORSTEP = nstep
 
This command is only used in combination with the plot SYMBOL=40 (false-color plot) and limits the number of color steps per color table. This only applies to the X11-window (if the graphic controller of the computer needs some adjustment), but not the generated PS-le(s). Should be obsolete with modern computers.

3.4.2 Graphics: drawing actions

Nearly all plot options in the following description allow to specify coordinates by four parameters, x;y in the units of the plot, plus osets in x and y, named xoffset and yoffset in centimeter.

In the following, these parameters are not repeatedly described. Parameters in [square brackets] are optional, while mandatory ones are placed between < and >.

nLIN
<x1: cm> <y1: cm> <x2: cm> <y2: cm>
draws a straight line from (x1;y1) to (x2;y2) (parameters here only in cm!).
nLINREL
<x: units> <y: units> <x: cm> <y: cm> [<xoffset: cm> <yoffset: cm> <SYMBOL=i> <SIZE=x>]
Plot a line from a starting point (x;y) with the length (x; y) in cm.
The following parameters are optional:
Osets in x and y (either none or both need to be specied);
A dierent SYMBOL can be chosen for the line, i.e. dashed lines, SYMBOL=i, where i is the number of the symbol, see Fig.  5 (note: discrete symbols only mark the start and end point, not in between).
A dierent SIZE can be chosen as well, the default is SIZE=0.5
(if SYMBOL and/or SIZE are used, one needs to specify the oset before these keywords).
nLINUN
<x1: units> <y1: units> <x2: units> <y2: units> <xoffset: cm> <yoffset: cm> [<SIZE=x> <SYMBOL=i>]
Plot a line between the points (x1;y1) and (x2;y2). The keywords SIZE (default: 0.5) and SYMBOL (default: 5) can change the size and style of the line, i.e. to plot a dashed line.
nARC
<x: units> <y: units> <xoffset: cm> <yoffset: cm> <radius: cm> <: degree> <: degree> [<FILLED>]
Plot an arc of a circle at the given coordinates with given radius, starting at the angle and with an arc of length ( = 0 is to the right, counting in the mathematically positive sense). With the keyword FILLED the sector (\piece of cake") is lled.
nELLI
<x: units> <y: units> <xoffset: cm> <yoffset: cm> <a: units> <b: units> <: degree> <: degree> <: degree> [<FILLED> <SYMBOL=i> <SIZE=x>]
Plot an arc of an ellipse with half axes a and b, where the longer axis is tilted by the angle . The arc starts at the angle (the angles are taken for a circle of radius r = max(a;b) before the axes' ratio is applied) and has the length . If the keyword FILLED is set, the (arc of an) ellipse is lled. By setting SIZE and SYMBOL, one can choose the style of the arc (see Fig.  5).
nARR
<x: units> <y: units> <3rd parameter> <4th parameter> <size r of the arrow's tip: cm> <xoffset: cm> <yoffset: cm> <Mode: 0,1,2,3,4,5> [<FILLED> <BAR> <SHRINK=f : real>]
Plot an arrow. If the keyword BAR is set, the arrow's foot gets a perpendicular bar, if the keyword FILLED is set, the arrow's head is lled, with SHRINK=real one can multiply the arrow's length by a given factor f , i.e. to leave some elegant space between the connected points.
Example: nARR 0 0 5 45 0.25 0 0 0 FILLED

They have the starting point (x;y) and the fth parameter as the size of the arrow's tip (if the keyword BAR is set, the bar will have the same size) in common.

There are dierent modes (specied as seventh parameter). The meaning of the third and forth parameter depending on that mode:




ModeInterpretation of the third and fourth parameter




0 3rd par.: Length of the arrow in cm or units(1);
4th par.: Set the angle to which the arrow points (0: right, 90: top etc.);
1 as in mode 0, but xoffset is the oset in direction of the arrow; yoffset is ignored
2 3rd par.: Length of the arrow in x direction in cm or units(1);
4th par.: Length of the arrow in y direction in cm or units(1);
3 as in mode 2, but yoffset is ignored here
4 3rd par.: x coordinate of the tip in units;
4th par.: y coordinate of the tip in units;
5 as in mode 4?



Note (1): Lengths (in modes 0 and 2) can be specied in units if an U is directly attached to the number, i.e. 5U.

nRECT
<x1: units> <y1: units> <x2: units> <y2: units> <xoffset: cm> <yoffset: cm> [<FILLED>]
Plot a rectangular between the given corners (x1;y1) and (x2;y2).
nRECTLUN
<x: units> <y: units> <xoffset: cm> <yoffset: cm> <width: cm> <height: cm> [<FILLED> <ROTATE=: degree>]
Plot a rectangular. Depending on the prex of xoffset and yoffset (l, r, m in x for left, right, middle and u, d, m in y for upper, lower, middle) the coordinates (x;y) refer to the left, right, upper, lower or middle of the rectangle. If no prexes are given, the coordinates refers to the lower left corner.

The rectangular has dimensions width, height in cm, with attached U in units (c.f. nARR). If the keyword FILLED is set, it will be lled. If ROTATE= is set, the gure will be rotated (the reference point of rotation is set by the osets) by angle .

Note: It's useful, e.g. when plotting a box around some text, to use SAME instead of (x;y) and x=yoffset. SAME takes the prexes of the osets used in the LUN command, i.e. one has the position NEXTLUN would have. This makes plotting boxes around text rather easy:

KASDEF LUN 5 2 M0 M0 0.22 Text text text  
KASDEF RECTLUN SAME SAME SAME SAME 2.5 0.7
nSYM
<x: units> <y: units> <xoffset: cm> <yoffset: cm> <size r: real> <symbol j: integer> [<CFILL=i: integer>]
Plot the symbol j (numbers see Fig.  5 { only discrete symbols are allowed here!) in size r at the position (x;y). If CFILL=i is set, ll the inner part of the symbol (if it's a circle, square etc.) with color i and have its border in the current plot color.
nBARLEN
<y;up: units> <y;down: units> <x;up: units> <x;down: units>
Dene the lengths of the error bar in y and x direction in units of x;y. Default: 0.,0.,0.,0. (i.e. no bars).
nBARPAR
<space: cm> <edge: cm>
Specify the space left out at the center (at the bars' intersection) and dene the length of the edges (i.e. small perpendicular foot bars at the end of the error bars). Default: 0.,0.
nBAR
<x: units> <y: units> <xoffset: cm> <yoffset: cm>
Plot an error bar at (x;y) with the previously specied properties.

Note: One rst needs to specify the BARLEN (and BARPAR) parameters at least once before setting the BAR, else it will plot error bars of zero (=default) length.

3.4.3 Hatched Areas

Various areal objects can be lled with a color, e.g. by the optional keyword FILLED (see, e.g., nARC or nELLI). Discrete symbols (cf. nSYM) can be lled by specifying a negative SIZE, or with the parameter CFILL=n, where n species the color of the lling.

Alternatively to a full color, the area can be lled with a hatched pattern. Note that hatched patterns only appear in the PostScript les, while in the X11-window the area is just lled smoothly.

For hatching, one uses the keyword HATCHED instead of FILLED. In nSYM, the value of SIZE must be positive now, while CFILL can still be used to dene the color of the hatched pattern.

The hatched pattern can be specied in detail by further keywords (actually, the keyword HATCHED is redundant as soon as such hatching specications appear):

HTYPE = t
with t = [D, V, H, K, C] denes the pattern of the hatching; D: (default) diagonal lines; V: vertical lines; H: horizontal lines; K: checked hatching (vertically and horizontally); C: cross-hatched (diagonal).
HW=x:x
sets the thickness of the hatching lines. x:x is in typographical points, i.e. 1/72 inch as in the PEN commands. For hatching even decimal fractions are allowed.
HSEP=x:x
sets the spacing between the hatching lines. The value is in typographical points as for HW (see above).

3.4.4 Text output

nLAB
<x: cm> <y: cm> <size r: real> <text: string>
Write the text string of size r at the location x,y.
nLUN
<x: units> <y: units> <xoffset: cm> <yoffset: cm> <size r: real> <text: string>
Plotting a text string at a position given in the coordinate units (LUN = Label at UNits). An oset in cm can be given additionally. xoffset and yoffset can have prexes. In order to understand their meaning, imagine the text string represented by its bounding-box. By default, the string is placed such that the coordinates refer to the lower-left corner of that box. For xoffset precede by the letter L (default), M or R, the string is placed with its middle (in x direction) or with its right boundary at the specied coordinates. Similarly, one can use the prexes D (default), M or U for yoffset. The coordinates then refer to the baseline (D), the middle, or the upper boundary of the string's bounding-box. Note that these features make it very convenient to place labels close to discrete plotsymbols.
nLUNA
<x: units> <y: units> <xoffset: cm> <yoffset: cm> <size r: real> <angle: degree> <text: string>
issues a text string like LUN, but the string is rotated counterclockwise by the given angle; the reference point for rotation is set by the coordinates including the osets. Hence the prexes R, M ets. allow to rotate around the rspective corner or midpoint of the string's bounding-box.
nLINUNLAB
<x1: units> <y1: units> <x2: units> <y2: units> <xoffset: cm> <yoffset: cm> offcenter: cm> <size r: real> <text: string>
Plot a line from (x1;y1) to (x2;y2) and write the text string at the center of that line, shifted by Soffcenter.
nLUNINC
<x: units> <y: units> <xoffset: cm> <yoffset: cm> <size r: real> <lename: string> <prex: string> <search string: string>
Grep the rst line in lename that starts with the search string, and issues that line as text string like LUN would do, but with preceeded by the string given as parameter prex (e.g. &F&2 as prex string writes the line in boldface and red color). The writing position is given by the coordinates.
nNEXTLUN
<text>
writes another line of text. The position (coordinates, osets, prexes) are taken from the previous LUN command, but shifted by a LINESKIP to write into the next line. An error will ocur if no previous writing position has been dened by a corresponding LUN command.
nSAMELUN
<text>
Like NEXTLUN, but without a LINESKIP in order to write into the same line.
nTEXT
[<x: units> <y: units> <xoffset: cm> <yoffset: cm> <size r: real>]
until
nENDTEXT
 
All lines between these two commands are considered as a paragraph of running text. Line breaks are created automatically according to the currently set RIGHTMARGIN. Hyphenation is semi-automatic: hyphenation breaks can only happen where indicated by hand by \n-" (like in LATEX). Example: hyphen\-ation

Line spacing is the same as LINESKIP by default, but can de chosen dierently by the command TEXTLINESKIP.

The parameters (position, osets and size) are optional; if they are not set, the rst line of the oating text appears in the same place as NEXTLUN ould write.

3.4.5 Text output options

nNEWSIZELUN
<size r: real>
Change the font size of LUN to r.
nLINESKIP
<spacing l: cm>
Set the line spacing (for NEXTLUN) to the given value. The default unit of r is cm. If an S or U is attached to the number (i.e. 0.5S), it is interpreted in units of symbol size (S) or y-units (U), respectively. The default corresponds to LINESKIP=2.0S, which means 2:0 the current font size.
nTEXTLINESKIP
<spacing l: cm>
Set the line spacing for continuous text (for TEXT) to the given value (default: same as LINESKIP). Again, an attached S or U is interpreted as units of symbol size or y-units, respectively.
nMEDSKIP
 
Insert half a LINESKIP as line spacing at that position, i.e. between two lines.
nTABLUN
<tab l: cm>
adds a horizontal oset to the current writing position; the parameter tab may carry a prex (L, R or M) which then replaces a prex that has been set before.
nRIGHTMARGIN
<x: cm>
Set the right margin for oating text and for horizontal lines (see nHLINE). Default is 18 cm.
nBLOCK
or BLOCK ON
sets a parameter that oating text appears in block mode, i.e. each line is stretched till the RIGHTMARGIN. Default is ragged-right margin.
nBLOCK OFF
 
returns to ragged-right margin for oating text.
nBGRLUN
[<L=x:x, R=x:x, U=x:x, D=x:x > <OFF> <ON> <RESET> <COLOR=i>]
lls the text box with color i befor printing the text. This works for all subsequent LUN, NEXTLUN and LUNA commands (but not for TEXT), as well as included eps les (see Sect.  3.4.12) or LATEX blocks. Default for the underlying color is i=0 (white, if not re-dened).

The lled box is larger than the text bounding box a margin; its widths can be with the parameters L, R, U and D (left, right, upper, lower; in units of the current font size). By default, all margins are 0.5.

If COLOR=i is negative, the box is not lled but only surrounded by a line with color abs(i). One can also be lled with hatched patterns (see Sect.  3.4.3).

Note: The underlying box does not belong to the object as such, i.e. so its position and BoundingBox are not aected by BGRLUN.

BGRLUN OFF
disables the BGRLUN feature. With a later BGRLUN one enters it again with the parameters kept from the previous use. All defaults (color, L, R, U, D) are restored by the option RESET.

nHLINE
 
draws a horizontal line between the current writing position (where NEXTLUN would write) and the RIGHTMARGIN position. If HLINE is drawn within the TABON environment, it covers the width of the table.

3.4.6 Itemizing

nITEMIZE
<size r: real> <string>
starts en itemizing environment; subsequently, all text lines or paragraphs written by LUN, NEXTLUN or TEXT are indented and marked by string in the font size r (or SAME). Examples: nITEMIZE SAME &2no
marks the items with a red bullet;
nITEMIZE SAME &4n>
marks each item with a blue arrow
nITEMIZE OFF
 
closes the itemize environment.
nITEMSEP
<spacing l: cm>
species an additional space between items (default: 0cm) l is in cm, or in units of the current font size if appended with letter S.

3.4.7 Tables

nTABON
<colums> [<prex>]
enters the tabular environment. The string colums consists of the letters L, R or C, each letter representing one column. The meaning of the letters is analog to LATEX syntax and describes the positioning of the entries: (L: left-justied, R: right-justied, M: centered).

The optional parameter prex will preceed each entry in the table.

Example:
nTABON LLL &F&2
opens a table with three colums, where all entries are ushed left, and all entries are in boldface style and color 2.

The table starts at the current position (i.e. where NEXTLUN would write). In x direction the current prex is taken, i.e. M centers the table. In that sense TABON acts like a NEXTLUN.

nTAB
<strings>
writes a row in the table. The string is parsed according to the usual rules, i.e. the arguments are separated by blanks and/or delimiters, while quotation marks keep an argument together. Each argument then is a column entry. The number of arguments must agree with the number of columns declared in TABON.
nTABOFF
 
quits the tabular environment.
nDATE
[<x: units> <y: units> <xoffset: cm> <yoffset: cm> <size r: real> <angle: real>]
Write the date string (\Plot created on dd-Mon-yy hh:mm:ss" where Mon is the three character abbreviation of the month) at the given position or (default) at the right side of the plot in vertical alignment.
nFILE
[<x: units> <y: units> <xoffset: cm> <yoffset: cm> <size r: real> <angel: real>]
Write the le name of the current le at the given position or (default) at the right side of the plot in vertical alignment (a bit right of the position DATE would have).

3.4.8 Special characters, Umlauts etc.
See Appendix A (page 76) to have an overview of the special characters WRplot can print in dierent fonts. Special characters are encoded by a prexed n or & (see Table 1). For other special characters (i.e. , ó, ^s  etc., use LATEX instead).
Table 1: Encoding of special characters with n and &










CodeSymb.CodeSymb.CodeSymb.CodeSymb.CodeSymb.




















nS nA Å nM M_ n* n8 1
n> ! n< n+ no nn n
n# # n'e é n`e è nn ñ &i í
&` \ &' " && & &a ä &o ö
&u ü &A Ä &O Ö &U Ü &s











nGLATEX
or nGLATEX ON
Enter the \German-LaTeX" mode, i.e. umlauts and german  can be encoded by a prexed " (double quote) like in LATEX, i.e. "a for ä etc.

To print double quotes, use two single quotes (apostrophes, ) like in LATEX and two backquotes (): (quoted text), or (the german variant with lower and upper quotation marks): "Text", double quote plus backquote and double quote plus single quote.

 

nGLATEX OFF
 
leaves the German-LATEX environment again.
Greek letters
 
The hashmark (#) toggles between latin and greek letters. Example: #abg# results in plotting .
Fractions
 
simple fractions can be written in text strings in the form \{a\|b\}, which produces a
b.
Special spaces/orientation
can be inserted into strings by:
n, :\thin space" (0.3 SIZE)
n! :\negative thin space" (-0.3 SIZE)
n^ :small upward displacement (superscript; only in PS fonts)
nv :small downward displacement (subscript; only in PS fonts)


3.4.9 LATEX formulae

Any text strings (e.g. in LUN commands or axis descriptions) can contain LATEX formulae. This environment is started by n( and ended by n).

The formula is inserted into the string in the current font size (the default scaling factor, 3:6SIZELUN, can be changed by setting SCALE_LATEX; see there) and font color. WRplot variables, recognized by the preceeding $ sign, can also appear in this environment and are expanded as usual.

As LATEX output is imported as postscript code, it cannot be displayed in the X11-window where only its bounding box is shown instead.

Example:  
\NEXTLUN Every child knows \(c = \sqrt{a^2+b^2}\), the essence  
\> of the Pythagorean theorem.

nSCALE_LATEX =
<factor f : real>
The given factor (default f = 1:0) is multiplied to the default factor (3:6) and acts on all LATEX elements. Together with the Helvetica font (nFONT=HELVET) a factor f = 1:25 looks more harmonic than the default.

3.4.10 Text attributes

The text style can be changed at (mostly) any point of the string by prexes, see Table 2 below.


Table 2: Prexes in text strings


PrexEect


&T subscript (tiefgestellt)
&H superscript (hochgestellt)
&M Return to normal, middle vertical alignment


&E compact letter spacing (compressed by 30%; eng gestellte Schrift)
&B broad letter spacing (broadened by 30%; weit/breit gestellte Schrift)
&I Italics font
&N return to normal font style (inclination and letter spacing, switch o &W)
&R inclination to the right
&L inclination to the left
&G return to uninclined font (gerade)


&F \boldface" Postscript-Fonts (fett; has no eect in the X11-window)
&f quit boldface font
&W quasi-bold face by double plotting (WRplot fonts only, use in X11 window)


&i change to color i = 0:::9
&PW locally change the font to WRplot (only at the beginning of the string)
&PT locally change the font to Times (only at the beginning of the string)
&PH locally change the font to Helvetica (only at the beginning of the string)



3.4.11 Spectral line identications

A whole set of KASDEF commands are especially designed to label spectral lines in a pretty and convenient way.

nIDENT
<x: units> <text: string>
Plot an identication mark at the given position in x (i.e. wavelength) and write the text at that mark. The height and font size can be changed by the following commands; the default size is 0.4 and the default height is 8 cm. Note that (by default) idents and their texts do not run into each other, i.e. get an automatic spacing.
nIDMULT
<1: units> <2: units> . . . <n: units> <text: string>
This command combines n components of a blended line or multiplet transition with their respective wavelengths i and a single identication text (the last parameter; if it contains blanks, use quotation marks, e.g. "C IV").
Settings for subsequent line identications
nIDLENG
<length l: cm>
Set the length of the identication marks (default 2 cm). In case the value is negative, the identication mark points down and the text is underneath. If the sux U (i.e. 0.5U) is set, the length is taken in y-units.
nIDY
<height y: cm>
Set the height of the identication marks over the x axis (default: 8 cm) in cm or units if suxed with U (i.e. 1.5U).
nIDXOFF
<oset a: units>
Shift the x position of the identications (nIDENT and nIDMULT) by a units in x direction.
nIDXFAC
<factor f : real>
Multiply the x position of the identication (nIDENT and nIDMULT) by f , i.e. for radial velocity or redshift. If both IDXOFF and IDXFAC are set, the total shift is calculated as follows: xident = f + a, where is the unshifted x value.
nIDSIZE
<size r: real>
Set the font size for identications (default: 0.4).
nIDSPACE
or ID_SPACE <space l: real>
Set the minimum spacing between the identications (basically in units of IDSIZE).
nIDRESET
or ID_RESET
Disable the spacing once, i.e. identications can run into each other.
nIDHOR
or ID_HOR
The following identications are written horizontally.
nIDVER
or ID_VER
The following identications are written vertically (default).
nIDBACKWARD
or ID_BACKWARD
The following identications are arranged from right to left (or downward).
nIDFORWARD
or ID_FORWARD
The following identications are arranged from left to right (or upward) (default).
nID_START
or IDENT_START <x: units>
The identications' text starts at the given x value, i.e. wavelength.
nID_CONNECT
 
The identications are kept together.
nID_NOCONNECT
 
The identications are not kept together (default), i.e. remain at their given x value (i.e. wavelength).
nIDMLENG
<RESET> or : real> : real>
Set the division of the identication line or RESET to default values of a = 0:43 and b = 0:43 (43%). The rst value, a, sets the proportion of the lower part of the line, the second (b) is the middle part. The upper part gets the rest of the length, i.e. 1 a b. Thus, both a and b can only range between (0; 1) and their sum must be less than 1.
nIDMCOMB
<TRUE/FALSE>
If set TRUE, IDMULT does not write the identications and just plots the comb, i.e. connects the components of IDMULT.
nIDLOG
 
take the logarithm of all x positions specied in subsequent identication commands; usefull is spectra are plotted over log
nIDNOLOG
 
Change to non-logarithmic x scale (default).
nID_INBOX
 
Set to suppress identications outside the x range of the plot box. It acts on nIDENT and nIDMULT (note: at IDMULT the whole set is suppressed if at least one of its components is out of the box's range).

There are some related, obsolete commands:

nLAM
<x: units> <y: cm> <y: cm>
Plot a vertical line (i.e. line identication) of length y at position x and height y.
nTRA
<x: units> <y: cm> <size r: real> <text: string>
Write the string text in vertical alignment and given size at position x and height y.
nCON
<x1: units> <x2: units> <y: cm>
Plot a horizontal line in height y between x1 and x2 (i.e. connect the components of a multiplet).

3.4.12 Include PostScript les/gures

WRplot can include PostScript (PS) les in its PS output (in the X11-window only the BoundingBox is shown as a lled rectangular in the current color). The position and scaling of the included object is oriented { like in LATEX { by its BoundingBox. If neither NEXTLUN nor COORDs are given, the lower left corner of the BoundingBox will be placed at (x;y)=(0; 0).

nEPSF
<lename.ps> [options]

If no options are specied, the size, position and scaling is default (this also works if no BoundingBox is present or if it's broken).

 COORD <x: units> <y: units> <xoffset: cm> <yoffset: cm>
Place at coordinates (x;y) with osets (see nLUN, Sect.  3.4.4, for details of the oset options, i.e. prexes and their meaning).

 NEXTLUN
Place at the position NEXTLUN would write (set either COORD or NEXTLUN).

 EPSFXSIZE = <xsize: cm> or EPSFYSIZE = <ysize: cm>
Scale to the given width xsize or height ysize in cm or in x=y units if suxed by U.

 SCALE = <factor f : real>
Scale by the given factor

 ROTATE = <angle: degree>
Rotate by the given angle, the center of rotation is set by the reference point of the coordinates/osets (cf. nLUNA, page 34).

 LATEX
Try to remove the showpage of epsf les, i.e. les that were created by latex and dvips -o -E lename.

 NOSHOW
Do not include the actual EPSF le but simulate a placeholder of same size; the positions for NEXTLUN is updated, and the variables EPS_X1 etc. are updated as if the eps le was shown. BGRLUN is shown if active.

 New variables for coordinates:
The box's coordinates are saved in new variables named EPS_X1, EPS_XM and EPS_X2 for the x coordinates (left, middle, right) and the same with Y1 etc. for the y coordinates of the box (all in units). An additional set of variables with sux CM (EPS_X1CM etc.) is also created (all in cm).

3.4.13 Objects from LATEX code
nLATEX [options]
...latex-script ...
...latex-script ...
nENDLATEX

The lines betwee LATEX and ENDLATEX are inserted into a LATEX document (documentstyle, default font size 12 pt) between \begin{document} and \end{document}. In addition, the leading lines may contain \usepackage{...} instructions which are properly taken into account.

The font color is taken from the current nCOLOR; if the color is changed within the LATEX code, this will aect the current color outside the LATEX-Block.

The LATEX code is compiled and the created eps le is included into the WRplot. By default, the position correspond to the next line of text, but can be specied alternatively by the option COORD=xunits yunits xoffset yoffset (same syntax as described for nLUN).

Note: As the X11-window cannot display the eps le, it just shows a lled rectangle of the BoundingBox's size.

The options following nLATEX are those of nEPSF (position, scaling, rotation). In contrast to EPSF the defaults are dierent:

Notes: In most cases the default options for nLATEX will be sucient. Use BGRLUN to create a background or box around.

Hint: For inserting smaller formulae in text strings, see Sect. 3.4.9.