When a device that can produce hardcopy is closed the plot is sent off
to the printer (using the command given as SY in the device's
graphcap entry). The only way to close a device is to open another, any
other, so it is just as good to say dev x11 as it is to say
hardcopy dev x11 as the macro hardcopy does no more than
open the null device. So one way to produce a plot is to say
device postscript
plotting commands
device x11
There are many different printers available, and even if you are using
a postscript printer you might want portrait (postport) or
landscape (postland) plots, so it is traditional to put the
name of the desired printer into a variable printer. It is so
traditional, indeed, that it can be done with a line such as
printer postportin your `.sm' file.
The two commonest incantations are probably
device $printer
playback
device x11
or
device $printer
my_macro
device x11
which can be simplified to hcopy and hmacro my_macro respectively.
The former
can be given a single history number (e.g. hcopy 12) to only make
a hardcopy
of the one command, or a range of numbers (hcopy 1 12) to plot
those lines (inclusive).
The latter, if you omit the name of the macro, will prompt you to create
a temporary macro that is then printed. If you want to make a hardcopy of
the last line you have a choice, either hcopy -1 or hmacro,
and then use the history editor to retrieve the desired line.
Some sites have many hardcopy devices of the same type, in which case
they usually set up the SY command to expect an argument
which is the name of the desired printer. You can deal with this by including
it in your printer variable: define printer "postscript latypus"
but this can be a nuisance, especially as unix already has a special
(environment) variable PRINTER that specifies your default printer.
The resolution is that both hcopy and hmacro are quite
careful; if you have an SM variable PRINTER it is taken to be your
default printer; if you don't have one they look for one in your
`.sm' file, if they don't find one there they look for an
environment (VMS: logical) variable. If all of these fail they take the
first argument (hcopy) or last argument (hmacro) to be the name
of the printer.
So if you have a PRINTER variable anywhere, hcopy and
hmacro macro_name will work as before, if you don't then you'll have
to say hcopy printer_name or hmacro macro_name printer_name.