A Vector Construction Kit
Vector 6:3, page 117
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 117
Background¶
Over my spell as Editor of this excellent journal of ours, I have been gradually evolving a set of hardware and software tools to make my life as easy as possible. As I am now nearly to the end of this particular road, I thought I should document the current state of play, so that others may carry on where I leave off.
What you Need to Typeset APL¶
My inclination has always been to go for the simplest and most reliable tools for the job. Accordingly, you will find little in the way of high-performance, leading-edge stuff here! The basic requirements of an APL typesetting shop are in my view:
- you must see the APL characters on screen. In general, substantial APL bits (function listings) will be imported from workspaces, but it must also be possible to enter occasional characters (e.g. alt-251 for ⍴) as required. Out of habit, I use the STSC
⎕AV, but APL2/PC would do rather better, as it stays away from the characters below blank (see below). - text should wrap properly, even when you have bits of APL embedded in it. Again, it should be possible to see the final page layout on screen to a reasonable degree of accuracy.
- it should be easy to print the results, either in draft form on a cheap dot-matrix (e.g. an FX-80 compatible), or on a high-quality printer at at least 300 dots per inch.
- page numbering should be automatic, as should the creation of the contents list and Index to Advertisers.
- cut and paste should be kept to an absolute minimum. Ideally, all APL code should be set as part of the document, not clipped from submitted articles and stuck in.
- you do need to be able to create rectangular ‘holes’ for things like photographs, and have the text flow around them.
- APL code should look good on the page, and should be set big enough to ensure readability.
I suspect that I could have all sorts of fun with a Mac and a flash DTP package, but I doubt if the finished product would be half as effective! I would also spend far too long playing with the package!
Hardware Requirements¶
My current workstation consists of:
- an old IBM PC (the original twin-floppy kind) with a fast 33Mbyte hard disk and a 386SX upgrade card (including 4Mbyte of 16bit memory). Obviously the original power supply has been beefed up to 150 watts.
- a Hercules-Plus Graphics card, driving a monochrome VDU. This is ideal for text processing, and is much faster than either EGA or VGA running similar software.
- an Epson FX-80 (on LPT1:)
- an HP Deskjet+ (on LPT2:)
You can work nearly as well on an EGA or VGA system, as long as you have access to one of the common APL soft character sets, such as are shipped with APL*PLUS/PC or APL2/PC. However I definitely prefer the Hercules card, as it gives me true ‘what you see is what you get’ with bold, italic and so on, but at text-mode speed.
Software¶
I have a judicious mix of standard software and hand-crafted bits in APL and C:
- Microsoft Word 5. I have owned a copy of Word from version 1 upwards. I appreciate that it can be hard to learn, but I would say that it relates to other common word processors (such as Wordperfect) rather as APL relates to Cobol. In short, I like power and speed, and am willing to invest the time in learning how to use a powerful tool properly!
- GoScript Plus. This provides a full PostScript emulation for common or garden printers such as the FX80 and HP Deskjet. It will run on a plain old PC (given 640K of memory), but at an average speed of 10 minutes per page. With some EEMS memory and a maths co-processor (and a decent clock speed like 16MHz) it cracks along at a very respectable 50sec per page.
- APL2741.FNT. This is a complete APL PostScript font, modelled on the old 2741-golfball. It incorporates all the normal APL symbols, plus any oddballs like (a row of boxed overstrikes) that I could find. It is encoded to the APL*PLUS/PC layout, but with any characters below ' ' moved up above 128.
- APL*PLUS/PC. This is pretty well essential, as quite a lot of material arrives in .AWS format. For the same reason, I also have a copy of APL2/PC.
- APL2MSW.AWS. A bunch of functions to map the pathological characters (∊ ⋄ ⊖ ↑ ↓ ← → and so on) and write out
⎕EDITvectors as native text files with the necessary CR/LF pair at the end of each line. - TF.EXE. A little C program, which will absorb almost anything (even a .AWS at a pinch) and output clean text. It has a couple of fancy bits to ensure that function listings don’t get re-wrapped (and to deal with Wordstar files), otherwise it is a pretty basic filter. So far its only serious failure was when faced with a Multimate file, and it made a bit of a meal of Tony O’Hagan’s article which was full of TeX code.
Getting APL Characters on the Screen¶
In order to get APL characters on screen, there are two possible approaches, suitable for the EGA/VGA combination and the Herc+ system respectively.
- For the colour systems, you can simply run any of the soft character sets (e.g. VGACHAR.COM from STSC or APL2FONT.COM from IBM) before you start Word. I actually use APL2FONT, patched to load the STSC character set, with the low-32 characters repeated above 128. The functions to do this were listed in Vector Vol.5 No.1 from page 85. The restriction is that you can only run Word in text mode, as the graphics characters are left untouched by the soft font. The page preview screen is also given a background of randomly jumbled characters (rather than a halftone grey); this is annoying, but appears to be harmless!
- For the Hercules, you need to patch the font file that Word loads on invocation (called SCREEN.VID). This is in the normal Hercules format, so it is just a matter of using the same functions from Vector 5.1, but with an offset into the file. I tend to start Word with a batch file (e.g. WD V for Vector, WD C for correspondence, WD B for Gill’s Brownie bits), so I only load the special font when I want Vector.
Snags¶
I have had very few problems with this approach. A couple of minor irritations are that Word uses the tiny centred dot (alt-250) as a space marker, and the normal centred dot (alt-249) in its ruler. APL thinks these are or and jot, so I either muck up my Word screen or have funny ors and jots.
Getting APL Characters on the Printer¶
This is beginning to sound like Computing at Chaos Manor (Jerry Pournelle’s column in Byte). Again, I have two approaches to this:
-
For dot-matrix kit like the FX-80 and LQ-500, I use downloaded characters (thanks to Iain Hayward for the LQ set) and a little chunk of C to print the files. The two types of printer require slightly different strategies:
In the FX-80 you can load your character set into the characters above 128, however these then obliterate the built in italics! Accordingly, I load the APL characters into their normal
⎕AVlocations, and load italic characters into the locations of the normal upper and lower case. I then write out the print to file, load the character set, and run a little C program which simply passes the file straight through to the printer, except that whenever it encounters an Esc-4 (Epson code for italic on) it substitutes an Esc-%1 to switch into the download font. Similarly Esc-5 maps to Esc-%0 to reverse the effect.In the LQ-500, you can only load characters into the lower 128. Accordingly, I have a slightly different C program which simply detects APL characters (using a boringly enormous switch statement) and prefaces these with a switch into the download font. It then writes out the appropriate character (e.g. ⍺ is mapped to A), and follows it up with the switch back into the normal character set. Overstrikes are written out as char-backspace-char, as there are obviously not enough holes in the bottom 128 characters for everything you need.
-
For decent quality print, I use GoScript, and simply write out a text file with Word set to its POSTSCRP printer driver. GoScript has drivers for all the common printers (FX-80, LQ-500, HP Laserjet II etc), so all I need to be sure of in Word is that I have set the page length correctly. The APL font is exactly the same size as Courier (and is of course monospaced), so all I do in Word is set the APL bits to Courier-Oblique (so they look italic on the screen) at the appropriate size. Word is then quite oblivious of the APL, so all the line-wrapping continues to work as normal. The only patch required is to Word’s PostScript prologue, where you must change Courier-Oblique to APL-2741; because this file is in plain editable text, you can do this with any basic text editor.
Snags¶
The first thing Word sends to the FX-type printer is an Esc-@ to reset it; this helpfully wipes out your download characters! I patched the printer driver to replace the @ with something harmless (5, I think). Word also attempts to make up the fancy characters like é by e-backspace-acute; again I had to patch the printer table to stop this.
Obviously, you can’t have your Courier in italics with the PostScript option. So far, I haven’t felt the lack! A mildly annoying consequence is that as well as getting the APL text italic on screen, the symbols get sloped too … so quad comes out as a parallelogram!!
Taste and Style¶
As I said earlier, I could have endless hours of fun with a top-line DTP system. However, when I look at the mess most of the common PC rags can make with Ventura, I think I shall stick to basics.
This is set in Palatino, set at 13 on 16 (before reduction). I have used very few tricks, other than the occasional drop-capital and some rectangular areas left blank for photographs. The big headings used as banners on the Education Vector are set at 48pt, with small caps; I suspect that this is about as big as you can go without getting too silly! The APL is set at 14pt in the text, and 12 on 13 in the listings. I think this is about right.
If you want lots of silly effects (like APL listings written vertically up the page) I would be delighted to produce them. Sensible suggestions on the format will obviously be welcomed, and may even have some effect. For the moment, I will concentrate on the content, and hope that the presentation is just good enough that nobody really notices it!