› _____________________________________› TEXTPRO: CONTINUOUS UNDERLINE #8› By Frank Walters› _____________________________________›› SYMBOLS:›› The following symbols will be used in› the text to describe how to type non-› ASCII characters in TextPRO editor› for macros:›› < > = SELECT › ^ = ESC CONTROL› ^K = ESC CONTROL+K(ey)› <^K>= ESC SELECT+CONTROL+K(ey)›› When TYPING a CONTROL (^) key in the› editor, you must type ESCape first.› When using TextPRO CONTROL commands,› the term CTRL_ will be used in this› article.› _____________________________________› DISCUSSION OF THE PROBLEM:›› TextPRO has a generic underline› format which simply sends a backspace› character to the printer and then› overtypes the understroke character› (_). It is unsatisfactory for most› underlining since it prints as a› dashed line instead of solid› underlining.›› Most printers have a continuous› underline feature. By defining the› inverse upper case for your› printer command, we can embed it› anywhere in the text to turn› continuous underline on and off. A› problem occurs when a series of› underlined words breaks at the end of› a line. TextPRO substitutes spaces› for left margin formatting, so these› spaces will be underlined in the left› margin when printed on the paper. The› only practical solution to this› problem is to turn off the underline› at the end of a printed line and turn› it back on again after the left› margin spaces are printed. To do this› manually by using CTRL_P to the E:› device is almost too complicated to› bother using continuous underline at› all. Limit it to only brief phrases› or titles that do not exceed one line› in length.›› However, I have developed a utility› macro to help format a paragraph› containing lengthly underlined› passages to automatically insert the› underline off/on commands at the› proper places in your text. I call it› ULINE.MAX. To use it you will have to› enter your printer codes for› underline on/off into your TextPRO› editor and save the codes in the› configuration file TEXTPRO.ENV (or› TEXTPRO.CNF for v.5.0 and earlier).›› DEFINING PRINTER UNDERLINE COMMANDS:›› In the case of many printers, 3 bytes› are required for underline on or off.› For Epson or compatibles, the› continuous underline commands are› usually:›› Underline ON: 27,45,49 or› 27,45,1› Underline OFF: 27,45,48 or› 27,45,0›› I prefer the ASCII 48 and 49 rather› than ASCII 0 and 1 since they are› easier to recognize when printing to› the E: device for checking line› breaks. Either set will work.›› With TextPRO we can take care of the› 27 (Esc) by configuring it to send› ESC prior to sending any inverse› upper case letter code. With TP 5.20› you must load OPTIONS.ADN into the› macro buffer to do this. Press CTRL_;› and reply No to "ASCII CR" and› "Linefeeds" and Yes to "Add ESCape"› prompts. The 27 will be sent any time› an inverse or any other upper› case inverse letter is used. Use› (SELECT_CTRL_S) to save this› configuration to TEXTPRO.ENV.›› Therefore we can't use a letter for› the 3rd character ("1" or "0")› because another ESC would be sent› prior to the "1" or "0". We can› either simply type the underline as:› 1 for on and 0 for off. But› TextPRO does not know the 1 and 0 are› printer commands so it will mis-count› them when figuring the number of› characters per line, sometimes› causing a line break at the wrong› place. TP does not count inverse› characters in the byte-per-line› count. It does count inverse when› using enter or dge formats.›› We will define inverse numbers, since› TextPRO does NOT add an ESC to those.› Here is what I type in the editor to› set my Panasonic equates:›› =52=53=45<0>=48<1>=49›› <0> <1>›› NOTE: and are used for› Italics ON and OFF. If you redefine› <1>=49 then you might want to› redefine <9>=27 also, since the› default TP had <1> defined as 27› before you changed it. The underline› command would look like this in› the middle of a paragraph. The› brackets indicate inverse and are› not actually typed in the editor.›› You can save your new equates to› TEXTPRO.CNF by installing them in› memory first. Just type the equates› in a blank editor, as above, but› pressing SELECT for the › items. I usually add the second line› with just the inverse printer keys› (as above) so you can see what gets› printed to the Editor.›› Print to E: so it puts the equate› values in the configuration portion› of memory before saving it to disk as› TEXTPRO.ENV using SELECT_CTRL_S. The› editor will show the five characters› below the equates, with spaces› between each. (If you used inverse› spaces you might see little "hearts"› instead of spaces between printer› commands.) You should also see an ESC› character printed in front of the› first three Letter-defined› characters, but not preceeding the› two numeric-defined characters. If› NOT, use the CTRL_; command again as› explained above, before you save your› configuration. The ESC characters are› essential for the commands to work› with the printer.›› UIP.MAX -- WHAT IS IT?›› A better way to type underline ON/OFF› commands in the middle of text would› be to use a macro key to avoid all› the fingers and thumbs finding the› SELECT, SHIFT, and U keys, etc. Then› we sometimes turn it on for a line or› two and forget to turn it off. Ever› happen to you? What a mess. UIP› stands for Underline, Italics, Print› to>E:. It defines the OPTION+ U,u,› I,i, and CTRL_P keys as macro keys.› Type the macros as described below› and save to disk. Then load› TEXTPRO.MAX into the editor and› CTRL_E to end of text. CTRL_L to load› the macros from disk and append them› to the end of your TEXTPRO.MAX. Check› CTRL_U to insure your TEXTPRO.MAX› does not exceed 2000 bytes before› saving it back to disk. This assumes› your macros do not include the above› keys already defined for something› else. If so, change either key to› another one. I always define letter› key macros for both upper and lower› case so they work regardless of case› set on keyboard. Here is the› breakdown of the three macros.›› OPTION_U›› U<=><^G>uu<=U1><^Y>(Ret.)› <^I><^Y>(Ret.)›› This defines the Underline portion of› the macro. Yes, it is mostly› so you need to hold down› SELECT a lot. (Ret.) means a hard› carriage return entered only at those› points in the macros. Pressing› OPTION_u (or U) will type inverse› at the cursor position and print› the UNDERLINE ON message to the› status line. You are in "Input Mode"› in the macro. You continue typing› your text until reaching the end of› the underlined part. However, you› cannot use most control keys so you› can only make corrections with Back› Space. But it won't let you forget to› turn underline off. As soon as you› hit Return, the macro types inverse› and ends both the Input Mode and› the macro, with the UNDERLINE OFF› message up at top.›› OPTION_I›› I<=><^G>ii<=I><^Y>(Ret.)› <^I><^Y>(Ret.)›› This is virtually identical to the U› macro, except only single inverse› characters are used for italics:› is on, and off is. I threw this› in as a freebie as it has none of the› problems associated with continuous› underlining except the one about› forgetting to turn it off.›› You must define the and keys› in equates for the printer. Epson› uses =52=53 and you save them› as explained in the previous section› about the underline equates.›› OPTION_CTRL_P›› ^P<=>^P(Esc BkSp 2-times)E:(Return 3-› times)›› Remember, use ESC CTRL with ^ symbol.› Press ESC and then Back Space key,› without pressing CTRL for the above› "Esc BkSp" character, a funny looking› triangle pointing left.›› This simple macro defines› OPTION_CTRL_P so it prints the› current buffer to Editor immediately.› You need to use this to insure your› underlined words do not break between› two or more lines, after using› ULINE.MAX to set the correct codes.›› ULINE.MAX -- HOW TO CREATE IT:›› The DATA listing for ULINE.MAX will› allow you to create the macro by› using ANALOG Magazine's MLEDIT.BAS› program. Another way to create the› macro is by using TextPRO's own› editor in Atascii mode and the› SHIFT_TAB function to type the› decimal numbers from the DATA› statements. Using this method you› must first insert enough spaces to› accept the macro. SHIFT_INSERT will› insert 255 spaces, more than the 207› required.›› With cursor at top of editor, press› Atari Logo key to get Atascii mode.› Then press SHIFT_TAB and type the› first decimal number and press› Return. will be printed on your› screen. Move cursor to next position› and repeat SHIFT_TAB step, etc.›› CAUTION WHEN USING SHIFT_TAB METHOD:›› Do not type SHIFT_TAB for number 155.› Instead press the RETURN key and move› to next decimal input. Do this for› each of the ten 155 items in the DATA› lines. Do not type the number 30 the› four times it occurs in lines 1070› and 1100. Type 155 instead of 30.› TextPRO reverses the 155 and 30 when› saving them to disk. Do not type last› decimal number in each line. They are› CHECKSUM numbers for MLEDIT.BAS and› not part of the macro itself. Ignore› the last zero at the end of the last› DATA line, it is just filler to› complete the 16 items-per-line› required by MLEDIT.›› When finished typing the DATA into› your editor, the cursor will be on› the line below the last byte in the› file, a RETURN character. Press› CTRL_D and P to delete the remaining› spaces. Press CTRL_U and the status› line should show "207 Used."› CTRL_S(ave) the file as ULINE.MAX to› disk.›› ULINE.MAX -- HOW TO USE IT:›› It is rather too complex to describe› key by key, but here is how to use› it.›› Four macro keys are defined to exit› the macro and load TEXTPRO.MAX:› OPTION_Esc, OPTION_?, OPTION_/, or› HELP. Esc or / are more convenient› for 800 users with no HELP key.› Insert Mode is turned off and <^P>@› sets the @ (autorun) macro to run› from TEXTPRO.MAX when loaded. Or you› can substitute for @ if you have› TEXTPRO.MAX set up to print the macro› identification to the Status line.›› Now that we know how to get out of› it, here's what you see and do to› find the line breaks with ULINE:›› Before using ULINE.MAX on your text› file, proof-read the paragraph(s)› containing underlined phrases. Edit› as necessary. Once you insert the› line breaks with ULINE, any changes› you make in the paragraph might› change the line breaks. Editing the› rest of the document will not affect› the line breaks containing underline› characters as long as there are› Return characters at the beginning› and end of the underline paragraph.›› Press START, type ULINE and press› RETURN to load the macro.›› It will automatically set Text Mode› and Insert Mode on. Status line› prompt after loading tells you:›› START>line # OPT_SPACE>New Line › pause›› Press any key and the screen should› blank and the cursor appears on the› first in the file. CTRL_W› automatically has been sent to› display "Page n, Line n of n" on the› status line.›› Press START to move cursor to next› word. It should display an updated› status line. You are only interested› in the Line number to see if it› changes to the next higher Line› number. How fast the macro operates› depends on how high the Page number.› Lower numbered pages mean faster› computation of the CTRL_W command.› Near the top of file you may have to› tap the START key or it might jump› too fast and you miss a word. When› the line number changes to the next› line, check to make sure you have not› passed the underline-OFF command and› are still in the middle of the› underlined phrase. If you are ready› to make a break in the underline for› the next line, see below.›› OPTION + (left cursor) is a quick way› to jump three words to the left, in› case you went too fast with the START› key or want to re-check the line› break point again. Or just use the› CTRL + Cursor keys to move the cursor› left or right.›› OPTION_SPACE is used to insert the› underline-OFF and ON codes between› lines. With the cursor on the first› letter of the first word of the next› line number, press OPTION_SPACE and› it will insert the underline OFF and› ON codes in the space to the left of› the cursor. The cursor will check› Line # of current word, then jump› left to the last word of the previous› line and check the Line # to make› sure it is 1 less. This is to insure› you did not break the underline at› the wrong place or the underline› codes did not shift the end-of-line› break position.›› Let me explain further. TextPRO is› not supposed to count inverse print› keys to determine bytes per line. But› sometimes when you insert thecodes in a line, the end of line› and may shift to the previous space.› If this happens, remove the › characters with CTRL_BackSpace and› insert them between the previous› space. Test to see if the line breaks› at that point and if not insert one› or two more spaces between thecodes to force the line break.›› Continue using START and OPT_SPACE› until you reach the that shuts› off the last underline in the› paragraph. Then press CTRL_F to Find› the beginning of another underline› phrase, if there is one. If you get› "Not Found" then go on to check the› format by printing to Editor, below.›› Use OPTION_CTRL_P to print the text› to the Editor (E:) and see the line› breaks yourself. In the underlined› section of the document, you should› see the ESC character followed by the› two codes for your printer up against› the left margin for each line that is› within the underline portion of text.› If it breaks in the wrong place, hit› CTRL_W during scroll to break out of› Print mode and re-check your line› breaks again; you made a mistake.› Remember, during Print to E: you can› use CTRL_S to skip to next page of› document without waiting for the› whole file to print to E:.›› Press HELP or OPTION_ESC to quit the› macro when you are done using ULINE.›› That's all there is to it. You have› to practice a few times to get the› hang of it but it is easier than it› seems. At least it is a better way to› insure you don't get those unsightly› underlined margins on your printed› document.› _____________________________________› Frank Walters› T.A.C.O. Bell BBS› 08/28/96›››