Do Run Run STWRITER.PRGB„!B„!14 4 0 4 0 6 78 2 12 132S T W R I T E R T R I C K SFine Tuning Two-Column OutputBy Joe Waters- @ -0 10 75As most 4-ST Writer0- users are aware, output may be formatted for two columns. Using a single font, double columns work reasonably well. However, if you attempt to mix fonts (switching from compressed to pica and back, for example), your final output usually doesn't look anything like what you intended. In this little tutorial, then, I will try and explain how 4-ST Writer0- formats columns and how you can work around its shortcomings to produce the output you want.41-Margin Math0-Margins in 4-ST Writer0- are set using a control character and a paramater that represents the character count. Let me use an example to explain. If you are using an elite font (^G8), characters are printed at 12 characters per inch (cpi). For a standard 8.5 x 11 inch page, a maximum of 102 characters (8.5 x 12) can fit across the page. A one-inch margin on the left and right side of the page would require a margin of 12 characters (one inch) on the sides with 78 characters (6.5 inches worth) left in the center for the text. Your left margin would be set by ^L12 (note: I am using the symbol ^ to represent the [Control] key). The right margin would be ^R90. (Where did the 90 come from? Subtract 12 from 102 or add 78 to 12.)With the above settings, all of your text would appear in the center 6.5 inches of the page. If you wanted to switch to a different font size, say pica at 10 cpi, you would have to reset your margins since the margins are measured in characters not in inches. With a pica font, only 85 characters would fit on that page (8.5 x 10) and, with one-inch margins on the left and right, the margin settings would be ^L10 and ^R75. A maximum of 65 characters would then fit on a line. For compressed mode, (assume 17 cpi), you would have to set your margins at ^L17 and ^R128 and you could print 111 characters are on a line. If you carefully change your left and right margin when you change your font size, the margins of your document will stay lined up even though your font is changing.In single column mode, by switching your margins you can, indeed, switch fonts and still maintain even margins. (You still can't, however, switch fonts right in the middle of a sentence.) How about double column mode.?41-Margins With Two Columns0-To indicate two columns, you specify the left and right margins of both the left and right column. The margins for the left column are set with ^L and ^R while the margins for the right column are set with ^M and ^N. Assume you want to print two 3-inch columns with a half-inch gap inbetween. Using a pica font, you could get 30 characters in a column and your margins would be ^L10 ^R40 ^M45 ^N75. In elite you could fit 36 characters in a column. The margins would be specified by ^L12 ^R48 ^M54 ^N90.Now we get to the heart of the problem. Suppose we have two columns set up in elite (^G8). We want to use a section title in pica (^G0) to make it stand out more. However, when we do this, we find the characters in the right-hand column are shifted over too far thus messing up the two-column output. What happened?41-The Problem0-Remember that 4-ST Writer0- does all of its counting in characters. When you specify the limits for a page, 4-ST Writer0- uses that information to completely format a page in memory. In two-column mode, it writes the first column to memory and then adds the second column. When both columns are on the page in memory, each line is then sent to the printer. When writing to its "memory" page for our two-column elite example, 4-ST Writer0- will see that 12 blank characters are followed by 36 characters for column one, 6 characters for the gap, and 36 characters for column two. If we stick in a 10-character subtitle switching to pica at the beginning (^G0) and back to elite at the end (^G8) of our subtitle, 4-ST Writer0- counts that as 10 characters. It ignores all control characters and their parameters since it knows these are printer controls and not characters in the text. 4-ST Writer0- then adds another 26 blanks to fill up the rest of column one on that line.When it comes time to send that line to the printer, 4-ST Writer0- passes the ^G0 on to the printer, sends the 10-character expression, passes the ^G8 on to the printer, sends 26 blanks, the 6-character gap, and the text in column two. What happend at the printer? It received the ^G0 code and switched to 10 cpi, it printed 10 characters (at 10 cpi), received the ^G8 code to switch back to 12 cpi, and then printed 26 blanks (at 12 cpi). The 10 characters took up one inch. The remaining 26 blanks took up 2 and 1/6 inches. Whoops, column one went 1/6 of an inch too far. Column two, therefore, is shifted to the right by 1/6 of an inch or 2 characters in elite mode. We told 4-ST Writer0- we wanted 36 characters in a column and then we cheated by sticking in a code to the printer telling it to print the characters further apart. The result: character spacing gets messed up.41-The Solution0-How do we fix this? If we switch to pica and send 5 characters to the printer, we want 4-ST Writer0- to actually count 6 characters. (The amount of physical line space used up in 5 characters of pica is the same as in 6 characters of elite.) If we could only type a character that 4-ST Writer0- counts but the printer igonres, we would be in business. But we can! All we have to do is use the 4-ST Writer0- printer configuration file to define one of the keys on the keyboard as a null character. 4-ST Writer0- will still count it, but the printer will ignore it. I had to pick a character I don't normally use. I chose the accent mark located to the right of the equal sign on the keyboard. Checking an ASCII conversion table, I found that the accent mark was listed as hex 60, decimal 96. In the 4-ST Writer0- CONFIG.TXT file, I changed the '60' in the character table to an '00'. Therefore, whenever 4-ST Writer0- encountered an accent mark (hex 60), it would convert it to a null character (hex 00) before sending it on to the printer.After making that change, saving CONFIG.TXT, and running the CONFIG.TOS program, I had a new printer driver for my 4-ST Writer0-. Everytime I typed an accent mark, 4-ST Writer0- would count that as a character, but the printer would receive it as a null character and ignore it. Now, it was a simple matter to use pica subtitles in the midst of elite two-column text. For every five characters in my subtitle, I would send an accent mark. (If my subtitle didn't have an even multiple of 5, I would add enough blanks to make it come out even.) For example, the subtitle "INTRODUCTION" would be written like this: ^G0-INTRODUCTION '''^G8-[Return]The subtitle "INTRODUCTION" has 12 characters. I add three blanks to make it 15 characters (3 groups of 5) and then send 3 accent marks. Finally, I switch back to 12 cpi. [Note, since my accent mark is still being interpretted as a null character, I used three apostrophes in the example above.] 4-ST Writer0- thinks it sent a total of 18 characters. At 12 cpi, that's 1.5 inches. The printer received 18 characters, but ignored the last three. The fifteen characters it printed, at 10 cpi, took up 1.5 inches. Both 4-ST Writer0- and the printer are now in accord. The second column will line up exactly.What I use in CURRENT NOTES is based on this principle. Normal text is printed at 15 cpi. Subtitles are printed at 10 cpi. Everytime I send 10 characters in a subtitle, I have to trick 4-ST Writer0- into thinking I sent 15. That is a ratio of 2 to 3, i.e. for every two characters in the subtitle, I add a null character. If my subtitle is 12 characters, I add 6 nulls; if 20 characters, I add 10 nulls.There is one other change in my subtitles: they are printed in a different font. I can download fonts to my QMS Kiss laser printer. To change fonts, I send the printer code: [NNNNs where "NNNN" is a particular font number. How do I get 4-ST Writer0- to send this code? Once again, I make use of the printer configuration file. I use almost everything in there: pica, elite, compressed, underline, bold, italics. However, I almost never need to use superscript or subscript. Therefore, I embedded the necessary printer control codes to switch to a larger font in the "superscript on" section. The code to switch back to standard prestige elite font was put in the "superscript off" section. Therefore, my subtitles follow the following format: start with ^G0 (to switch to 10 cpi), superscript on (to switch to the appropriate font), the text of the subtitle followed by half as many null characters, superscript off (to switch back to prestige elite), and finally, ^G2 (to switch back to compressed which I have defined to be 15 cpi). And there you have it, two columns with mixed fonts.Actually, I only just tried sending ^G0 and ^G2 to do the switching and they worked like a charm since both were defined to produce 10 and 15 cpi respectively. Previously, I had sent the actual printer control codes to tell a QUME to switch character spacing. The sequence "E12" switches to 10 cpi while "E08" switches back to 15 cpi. These sequences are, of course, printer dependent. How did I send the code? Using ^O in 4-ST Writer0- doesn't work. All the ^O's wind up being sent at the beginning of a page and cannot, therefore, be used to change things in the body of the text. Have you figured it out yet? That's right. Just use the character translation table in the CONFIG.TXT file to redefine one of the characters to be decimal 27, the escape code. I used the pound sign for this. Whenever I typed a pound sign, the printer received the escape code. Using this trick, I can now send an escape sequence to the printer anywhere in the document. There is one drawback, however. If I send, for example, a four-character sequence started by the "pound" sign, 4-ST Writer0- thinks all of those characters count when, in fact, the printer is interpreting them as printer control codes. But that's another story.....[Reprinted from the July/August, 1987 issue of CURRENT NOTES.] lows you to work in GEM. This is the only program I am aware of that allows this kind