FAQ


Table of Contents


SM's Frequently Asked Questions

How do I generate coloured postscript plots?

One frequent problem that people meet is that they generate beautiful colour postscript plots, but when they send them to their colour postscript printer they come out in black and white. This is due to the the printer lying to SM when asked politely, "do you know about colour?". The question that SM asks has changed in version 2.3.28, and should be more robust.

Fortunately it's easily worked around. Here's the procedure:

Generate a colour postscript file; with modern SMs that's any postscript file (e.g. device postfile).

Now look at it with e.g. ghostview -- is it coloured? If so, good. If not, this answer won't solve your problem; you probably have an old version of SM.

Now print it on your coloured printer. Is it coloured? I'd guess not, judging from the fact that you are reading this.

What should you do? You have two options; either

  1. Edit the file to make it coloured whatever the printer may claim to support. How to do this depends on what version of SM you have. If your version is newer than 2.3.27, you can do this with the (unix) command
    sed -e 's/processcolors where/sub where/' -e 's/processcolors/2/' file.ps > file.colour.ps
    
    If your version is 2.3.27 or older, the command is
    sed -e 's/processcolors known/sub known/' -e 's/processcolors/2/' file.ps > file.colour.ps
    
    You might consider either updating SM, or adding the following entries to your local graphcap file:
    postscript|POSTSCRIPT:SM 2.4 coloured postscript:\
    	:OY=/SET_COLOUR statusdict begin /processcolors where\n\
    	'  {pop processcolors 1 gt} {false} ifelse\n\
    	'  {'(setrgbcolor')} {'(pop pop pop')} ifelse cvx end def\n:\
            :TC=postscript:
    postland|POSTLAND:SM 2.4 Coloured postscript to a landscape file:\
    	:OY=/SET_COLOUR statusdict begin /processcolors where\n\
    	'  {pop processcolors 1 gt} {false} ifelse\n\
    	'  {'(setrgbcolor')} {'(pop pop pop')} ifelse cvx end def\n:\
            :TC=postland:
    postport|POSTPORT:SM 2.4 Coloured postscript to a portrait file:\
    	:OY=/SET_COLOUR statusdict begin /processcolors where\n\
    	'  {pop processcolors 1 gt} {false} ifelse\n\
    	'  {'(setrgbcolor')} {'(pop pop pop')} ifelse cvx end def\n:\
            :TC=postport:
    
  2. Add graphcap devices to your graphcap.local that look like:
    postfile_colour|postfile_color:Coloured postscript to a file:\
            :OY=/SET_COLOUR { setrgbcolor } def\n:\
            :TC=postfile:
    postlandfile_colour|postlandfile_color:Coloured postscript to a landscape file:\
            :OY=/SET_COLOUR { setrgbcolor } def\n:\
            :TC=postlandfile:
    postportfile_colour|postportfile_color:Coloured postscript to a portrait file:\
            :OY=/SET_COLOUR { setrgbcolor } def\n:\
            :TC=postportfile:
    

Is SM available for macs?

Macs running OS/X

If by `mac' you mean the ones that are closet unix machines (i.e. running OS/X), SM builds without problems(1). The X11 device works; there's no native device, and won't be until someone sends me a G4 powerbook as a christmas present.

Macs running older operating systems

As for `classic' or `stone-age' macs It wouldn't be too hard to port SM to run on a mac, and there are persistent rumours that the port has been done, but I've never seen it myself.

I don't have a mac, and don't want one, so I'm not going to do it myself, but if you want to cover yourself in glory send me the patches and you'll get a Personal Lifetime SM license, and a tee shirt if ever I get around to actually printing some.

Is SM available for PCs?

SM runs fine on PCs running linux, of course, so I imagine that you want to know about machines running dos/windows 3.1.

We have built SM on both dos and windows (but not windows 95 as we don't have such a machine), but the ports are not of very high quality. The standard source code is used, so anyone wanting to work on the device drivers is welcome to do so...

We currently make available executable for both platforms from the Usual Place.

Why does x != y fail if I input a file?

If you have the file:

define z 1
if($z != 2) { echo hello }

and try to input it, you get a syntax error:

: input test.sm
Syntax error at "\n" in macro input
if ( 1 \n
       ^^

The problem lies in the macro input. If you say help input you'll see the comment read and execute a Mongo (not SM) file, and the main body contains the command READ OLD; i.e. it reads files intended for John Tonry's mongo, not SM at all. And Mongo used ! as a comment character. Hence the problem.

There are two solutions: you can recompile SM not to recognise ! as a comment in READ OLD (edit `options.h'), or you can use the command read_new. If you get tired of typing input_new, you can redefine input; this is most easily done by a line like

input           # don't use OLD MONGO when inputting commands
                input_new

in the file $macro2/default (where macro2 is set in your `.sm' file).

How Should I Refer to SM in a Paper?

We are sometimes asked how to refer to SM in a published paper. The best answer is that you should be sure to call it SM, and if you want to include it in your references, use

        The SM Reference Manual,
        Robert H. Lupton and Patricia Monger (1997).
        (URL: http://www.astro.princeton.edu/~rhl/sm/sm.html)


Footnotes

(1)

Well, actually I had to work around a tty driver bug that I found.


This document was generated on 31 December 2002 using the %M% translator version %I%.