@node Aspect, Axis, Arithmetic, Commands @iftex @syntax Aspect. @end iftex @example Syntax: ASPECT A @end example @pindex Aspect @findex text plotting, aspect ratio @findex labels, aspect ratio Set the aspect ratio (Y/X) to be A; This is used in drawing characters and points and is reset when a new DEVICE command is issued. The current values of the x- and y- dimensions of the current device are (almost) always available as the variables @code{$nx} and @code{$ny}, and the current aspect ratio is @code{$aspect} (they are some of the special variables that are affected by the @code{DEFINE variable |} command). @findex internal variables, aspect @findex internal variables, nx @findex internal variables, ny If A is exactly 0, the current aspect ratio is printed -- this is equivalent to @code{echo $aspect} and is retained as a curiosity. Usually the aspect ratio is calculated by SM to make characters look right (and to make square points square), but it is sometimes useful to override this, especially when positioning labels on graphs that will be plotted on printers of different aspect ratios. It might be worth going through an example. Suppose that you want to make a plot that really is square when printed; how should you proceed? The available plotting area runs from 0--32767 on each axis. So a plot set up as @example location 5000 20000 5000 20000 @end example @noindent will have the same aspect ratio as the plotting device, in general rectangular. We can write this as @example define len 15000 # axis length, SCREEN units location 5000 $(5000 + $len) 5000 $(5000 + $len) @end example @noindent if we feel sophisticated. The variable @code{$aspect} tells you the Y/X ratio of the current device; so the location @example location 5000 $(5000+$len) 5000 $(5000+int($len/$aspect)) box @end example @noindent will be a square box. Of course, you'd probably really want to say @example if($aspect > 1) @{ location 5000 $(5000+int($aspect*$len)) 5000 $(5000+$len) box @} else @{ location 5000 $(5000+$len) 5000 $(5000+int($len/$aspect)) box @} @end example @noindent There is a problem with this; the sizes of points and labels are varied to look right with the current aspect ratio. This means that a @example putlabel 5 Hello World @end example @noindent command that looks fine on the screen of your workstation will look awful on the printer. That's where the ASPECT command comes into play: on your workstation lie to SM and tell it that the aspect ratio is that of the printer. How do you do that? Well, the slick way is to say @example macro aspect_as_device 1 @{ DEVICE $1 define 1 $aspect ABORT DEVICE $device ASPECT $1 @} @end example @noindent which assumes that you use a version of the device command that saves the current device as @code{$device}; the macro @code{dev} does this, and you can overload @code{device} to mean @code{dev}. Then you can say @example aspect_as_device postport @end example @noindent to force the same aspect ratio as the @code{postport device.}; your plots will look ugly on the screen but beautiful when printed.