The following instructions assume that you have something on your Unix account that you want to print.
Sure, you could print out your program scripts, but it will waste more and more paper as the semester progresses. A better solution is to prepare your script as a PDF. That way, you can view it just about anywhere (except mars, oddly enough) but you could still print it if you desperately wanted to. This can be done with the 'enscript' and 'ps2pdf' commands (found in most Unix environments).
enscript transforms a plain text file (like the typescript file created by the script command) and transforms it into the printer language PostScript. This is the first step to creating our PDF. (There are plain text to PDF translators, but they aren't available on mars or our Windoze machines.)
enscript takes many options, but the most useful are summarized in the table below. (To find out more, use 'enscript --help' or 'man enscript' at a terminal prompt.)
|-2||print 2 pages per sheet|
|print in landscape|
|-j||print a border around each page's column on the sheet|
|--media=Letter||use 8.5x11 (letter size) paper|
(most administrators don't bother to change the default of A4 size paper — a European standard size)
|--pretty-print=cpp||make some C++ syntax prettier by using bold and italics to high-light parts of the code|
|-ofilename.ps||the name of the file to store the postscript (a printer language)
typically this will be the file you are printing but with a '.ps' extension [added]
So, to turn your typescript file into PostScript, you might do this:
$ enscript -2jr --media=Letter --pretty-print=cpp -otypescript.ps typescript ...
One other advantage of using enscript is that it will warn you when lines are too long and must be wrapped. If you see this warning, you might want to go back to your program, info file, or TPQ responses and wrap longer lines as we discussed in class and on the master style guide. Then you can re-run your script and try again.
The ps2pdf command is used to convert PostScript to PDF. Its use is actually extra simple. Just tell it the PostScript file to convert and it does it:
$ ps2pdf typescript.ps
You'll end up with 'typescript.pdf' in your directory that you can then load into Acrobat Reader and print. Yea!
The only time I've seen ps2pdf give an error message (and it is a doozy!) was when I asked it to translate a PostScript file that I didn't actually have. (You'd think a simple error message of 'file not found' would have been easier.) If you see a big, hairy message after your ps2pdf, check how you spelled the name of the .ps file.