WP2L^{A}TEX User’s Guide

R.C. Houtepen^{1} Jaroslav Fojtík April 23, 1998

1Translated from the Dutch by G. R. Roelofs

Contents

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Some general remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Authorship history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

2 Conversion possibilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 3 Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3.1 Tabbing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.2 Indenting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 3.3 Combinations of tabbing and indenting . . . . . . . . . . . . . . . . . . . 5 3.4 Footnotes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.5 Headers and footers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.6 Page number positioning . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.7 WordPerfect default values . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.8 Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.9 Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

4 Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 5 The program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15

1 Introduction

There is another version of Wp2LaTeX written from scratch by the original author R. C. Houtepen at TUE-Eindhoven. This version differs completely from the package in your hand. Please check it on your nearest CTAN host at tex-archive/support/wp2latex/* . The version there has the disadvantage, that there isn’t any source code available. The source code in the subdirectories is very old. I tried hardly to contact the author but failed. So I took the latest available sources (which based on these in the subdirectories mentioned above) and corrected some errors. I never checked the other version. I apologize everybody to compare both versions and tell me the conclusion. Wp2LaTeX was originally designed to translate WordPerfect 5.0 documents into LaTeX 2.09. Later some code was added to translate also WordPerfect 5.1 documents. Now the preamble is designed for LaTeX 2e (by changing the preamble by hand it runs also under LaTeX 2.09 of course). The programming language used was Turbo Pascal 7.0. The projection from one paradigm (WordPerfect = word processing) to another (L^{A}TEX = typesetting) requires some cooperation on the part of the user. Because the use of L^{A}TEX is tied to strict rules, one must take these rules into consideration when using WordPerfect, if the WordPerfect 5.0 document is to be converted as accurately as possible. This guide discusses those rules.

1.1 Some general remarks

1. Don’t expect a better looking result only caused by converting text from WordPerfect to LaTeX. You HAVE TO edit the resulting LaTeX files. The reason is, that wordprocessors didn’t give the structure of the text (sections, itemizations, labels, ...) but only the formatting (boldface, underline (uurgh), italic, ...).

2. See next section for conversion abilities

3. Don’t expect any miracles from this program.

1.2 Authorship history

wp2latex was written in Turbo Pascal by R. C. Houtepen at TUE-Eindhoven. It was converted into C using p2c, and modified, by Glenn Geers (Sydney U). It was further modified by Michael Covington (U of Geo4rgia). Modified to be used in unix/linux environment by Claudio Porfiri. The parsing of formulas was added by Dirk Lellinger (U Halle/Germany). The splitting of code into several files and the documentation was done by Andreas Tille. J Fojtik developed original version from R. C. Houtepen at TUE-Eindhoven and then tries to given all available versions together.

2 Conversion possibilities

Because the capabilities of WordPerfect and L^{A}TEX differ strongly, it is not possible to convert all of WordPerfect’s ‘features’. The conversions which are performed by WP2L^{A}TEX are :

• Advances

• Cross-references

• Equations

• Extended characters (foreign language/accented, math, Greek - not linedrawing)

• Flush-right text

• Footnotes

• Justification :

– left

– right

– center

– full

• Hard page breaks

• Hard returns

• Headers and footers

• Indenting :

– left

– left and right • Outlining

• Overstriking

• Page number positioning

• Tabs :

– setting

– left tabs

– center tabs – right tabs • Tables

• Table boxes

• Text boxes

• The following Typefaces :

– Extra large

– Very large

– Large

– Small

– Fine

– Superscript

– subscript

– Italic

– Small caps

– Bold

– Underlined

– Double-underlined

Not converted are : • margin settings

• newspaper-style columns

• line spacing

• top and bottom margins

• index

• endnotes

• graphics boxes

• and many other WP features ...

3 Guidelines

3.1 Tabbing

Tab settings allow the exact placement of pieces of text, e.g., for creating tables. There are two sorts of commands involved here. First, there is the setting of tabs; this defines where subsequent tab-stop commands will place text. Then there are the tabs themselves, which force a jump to one of the previously-defined positions. In L^{A}TEX, however, tabs are enabled only within a tabbing environment. WP2L^{A}TEX takes care of that by invoking a tabbing environment only for those lines where one or more tabs appear. Within WordPerfect, a line containing tabs must terminate with a hard carriage return. If this is not the case, the tab positions in the generated L^{A}TEX-document will not be fixed. L^{A}TEX will incorrectly typeset the spacing of such lines. The following WordPerfect text will be incorrectly converted :

   Text1 [Tab] text2 [Tab] text3 [SRt]
   text4 [Tab] text5. [HRt]

The following is better :

   Text1 [Tab] text2 [Tab] text3 [HRt]
   text4 [Tab] text5. [HRt]

A tab-setting in the middle of a line holds for the entire line in the converted document (unlike in WordPerfect). It is therefore advisable to set tabs at the beginning of or prior to the pertinent line.

A few restrictions :

L^{A}TEX endows such commands as \', \` and \= with special meanings within a tabbing environment. Outside a tabbing environment, these commands are used for the placement of accents; within one, however, they must be replaced by \a', \a` and \a=, respectively. WP2L^{A}TEX does not perform this replacement, so it is left to the user to do it after the conversion.

WordPerfect 5.0 allows up to 40 tabstops to be set. L^{A}TEX can set at most 14 of them. As a result, if tabs are to be converted properly, the user may set no more than 14 tabstops within WordPerfect, either. If more than 14 tabs are set, processing by L^{A}TEX will result in a number of error messages, and ultimately one or more tabs may be lost.

3.2 Indenting

Indenting is used to alter the margins of pieces of text (paragraphs). Possible conversions with regard to indenting commands are :

Examples :

   [→Indent]^{∗} An indented paragraph which [SRt]
                extends over several lines and [SRt]
                is closed with a hard carriage [SRt]
                return. [HRt]
   label  [→Indent]^{∗} We see here the possibility of [SRt]
                       placing a `label' in front of [SRt]
                       indented text. [HRt]
   [→Indent]^{∗} label  [ →Indent]^{∗} It is also possible to place [SRt]
                                    an `indented label' in front [SRt]
                                    of indented text. [HRt]

where [→Indent]^{∗} indicates one or more [→Indent] commands.

Remark :

When using WP2L^{A}TEX it is not possible to convert more than two levels of indented text.

3.3 Combinations of tabbing and indenting

In practice it is evident that tabbing and indenting commands are often used together. The effect of that within WordPerfect is often identical: words come out on the page where one wishes, on the screen as well as on paper (What You See Is What You Get).

In L^{A}TEX, however, the difference between tabs and indents is fundamental. It is important that the WordPerfect-user take this into account. Thus only the [Tab] command may be used for tabbing and only the [→Indent] command for indenting. If both tabbing and indenting commands are used within a single line, only the type which is encountered first will be converted.

An example :

   [Tab] tom [Tab] dick [→Indent] harry [HRt]

The tab command in this line comes before the indenting command. The interpretation by WP2L^{A}TEX is then :

   [Tab] tom [Tab] dick harry [HRt]

The indent-command is eliminated. The line should instead look as follows :

   [Tab] tom [Tab] dick [Tab] harry [HRt]

3.4 Footnotes

Within a footnote only carriage returns and typefaces (see § 2) are converted. A footnote number may consist only of numerals.

Footnotes within lines which contain tab settings will not appear at the bottom of the page; L^{A}TEX, in contrast to WordPerfect, does not process them. This is a limitation (read: bug) of L^{A}TEX.

3.5 Headers and footers

Within a header or footer a number of converted features is reduced (see § 2).

One can split a header or footer into three pieces :

• left-aligned

• centered

• right-aligned

These three parts are separated within WordPerfect by using the centering command (Shift F6) and the flush-right command (Alt F6).

The effect of the WordPerfect commands in the header

   Left[Cntr]Middle[C/A/Flrt][Flsh Rt]Right[C/A/Flrt]

will, after conversion to L^{A}TEX format, be interpreted as is shown in figure 1. Choosing a new setting for the placement of header or footer text on only even (or only odd) pages does not affect the alternate pages’ previous setting.

Left  Middle  Right

Figure 1: headers

3.6 Page number positioning

The WordPerfect document is converted to a single-sided document. This means that page number positions 4 and 8 are not converted. The page number positions which WP2L^{A}TEX will convert are reproduced in figure 2.

1  2  3 5  6  7

Figure 2: page number positions

3.7 WordPerfect default values

The conversion program generates, independently of the WordPerfect settings, a L^{A}TEX document with a left margin of 1 inch (2.54cm). This is because L^{A}TEX enforces left and top margins of at least 1 inch (see figure 3). WP2L^{A}TEX therefore assumes that the margins in the WordPerfect document are also set to 1 inch and that they do not change.

Tabs are set every inch by default (14 tab stops). A different default tab-setting can be placed at the first line. If the standard, one-inch default settings are not used, however, processing by L^{A}TEX may produce error messages. This has more to do with the manner in which WordPerfect positions tab-stops than it does with L^{A}TEX(see figure 3). L^{A}TEX positions tab stops relative to the left margin, which, as mentioned above, is a minimum of 1 inch wide. In WordPerfect the left margin and the tab settings are independent of each other.

[figure: WordPerfect; L^{A}TEX; 1"; 1"; tab 1; tab 2; tab 3; tab 1; tab 2; tab 3]

Figure 3: tab settings in WordPerfect and L^{A}TEX

3.8 Spaces

Because WordPerfect works well as tool for the visual design of a document, users often have the tendency to use spaces to produce an acceptable layout. Multiple spaces within L^{A}TEX, however, have the same effect as a single space. Therefore, in converting a WordPerfect document, multiple spaces are changed into ‘hard’ L^{A}TEX-spaces.

For example :

WordPerfect  L^{A}TEX

 word1␣␣␣␣word2  word1␣~~~word2

When these come at the beginning of a line, however, they have no effect. Moreover, the layout which existed in the WordPerfect environment will seldom be properly achieved in L^{A}TEX, because of the different typographic rules, typefaces and text-spacing that the latter handles.

3.9 Equations

Because of the philosophy of typing an equations in WP is very similar to TEX conversion is not so difficult. The Math is written in both cases in text notation, but in WP is enveloped into the object [Equ Box:nn;;]. This convertor is also able to translate Greek characters, symbols and matrixes included in equations. The convertor normally generates environment displaymath. If it is not possible (e.g. in the case of tables), then it generates environment $ $. Sometimes you should correct equations manually. Example (of some simple equation):

WP equation string: "a= 1/4+{4ˆ 5} over {2+xˆ 5} + 1 over {2 + 3 over {4+y}} 5 SQRT {68+xˆ e over 5} ˜ + ˜ NROOT {r+6}{8} " TEXequation string: " a= 1/4+\frac{{4ˆ 5}}{{2+xˆ 5}} +\frac{1}{{2 + \frac{3}{{4+y}}}} - 5 \sqrt {{68+xˆ \frac{e}{5}}} ˜ + ˜ \sqrt [ {r+6} ] { 8} " And correctly displayed equation follows:

a = 1/4 + \frac{4^{5}}{2 + x^{5}} + \frac{1}{2 + \frac{3}{4+y}} − 5\sqrt{68 + x^{\frac{e}{5}}} + ^{r+6} \sqrt{8}

4 Tables

The WP2L^{A}TEX is also able to convert a tables. It converts style of centering of columns. It do not recognize all WP features such as special dotted cells, and double lines somewhere. Also a size of columns is not converted. Tables in the table boxes are ignored in this release. Table looking like this in WP:

[Tbl Def:I;3,5.31cm,5.31cm,5.31cm]
[Row] [Cell] Left Centered  [Cell] Center [Cell] Right Centered
[Row] [Cell] 111 [Cell] 222 [Cell] 333 Centered
[Tbl Off]

Is converted to:

Left centered Center Right centered
111  222  333

5 The program

The WP2L^{A}TEX package contains the following files :

• WP2LATEX.TEX (this user’s guide)

• WP2LTX.TEX ( Dutch (original) version of the user’s guide - now obsolette)

• README.BAT (batch-file with user instructions)

• FILE_ID.DIZ (abbreviated description of this program)

• WP2LATEX.PAS (the original Turbo Pascal 7.0 source - main part)

• PASS1.PAS (the original Turbo Pascal 5.0 sources - procedures for PASS1)

• PASS2.PAS (the original Turbo Pascal 5.0 sources - procedures for PASS2)

• WP2LATEX.STY (style file needed by L^{A}TEX for processing)

• DOS\WP2LATEX.EXE (the conversion program DOS executable)

• WIN\WP2LATEX.EXE (the conversion program MS Windows executable)

• TEST\TEST.WP (WP test file with mix of features)

• TEST\CHARACTR.WP (WP test file with all WP charsets)

Two executable files is supported. One for real mode MSDOS and second for MSWindows. Both versions works in text mode. It is also possible to create DPMI version, but the memory requirements of this program are too small to do this.

The program is invoked with the command :

   WP2LATEX [WP-filename.WP [TeX-filename.TEX]] [/cp895 | /cp852]
    [ /texchars] [ /charset1 | /charsetCZ ]
    [ /i WP-filename.WP] [/o TeX-filename.TEX] [/l Log-filename.TXT]

Following Unix-like call style is also possible:

   WP2LATEX [WP-filename.WP [TeX-filename.TEX]] [-cp895 | -cp852]
    [ -texchars] [ -charset1 | -charsetCZ ]
    [ -i WP-filename.WP] [-o TeX-filename.TEX] [-l Log-filename.TXT]

The parameter WP-filename.WP^{1} is optional. The program starts with an opening screen and asks for the WordPerfect filename. The default filename is printed inside square brackets ([ ]) and is the parameter which was optionally included in the initial invocation of WP2LATEX. The user can at this point type in another WordPerfect filename, or he can hit return to choose the default filename. The program next requests the name of the generated L^{A}TEX document. The default given within brackets is the name of the WordPerfect file, with the extension .TEXor TeX-filename.TEX passed as second argument. Once again the user may accept this name or enter another^{2}. Once the filenames are given, the following error messages may appear :

1This may be a WordPefect 5.0 document with an extension other than .WP

2This may be a file with an extension other than .TEX

• \underline{File not found :} The given WordPerfect file does not exist.

• \underline{Path not found :} An invalid path was given in the name of one of the files.

• \underline{Not a WordPerfect 5.0 document :} The given WordPerfect file was not created in Word-Perfect 5.0

Arguments /cp895 or /cp852 are used for 8. bit TEX, which is able to process some of these code pages. The codepage /cp895 is called as Kameničtí and is often used in central Europe. The codepage /cp895 (ISO8) is preferred in Windows for central Europe. There are available several types of coding accented characters. It is too bad. I guess that coding char set 1 is most common. Thus switch /charset1 is default set. If user wants to switch to the another coding, he should add switch /charsetCZ. But I have no available description of this coding and only several characters will be converted properly. Switch /texchars allows using WordPerfect as a TEXeditor. If this switch is active, then controlling TEXsequences are not distorted and you can add for example new equation (in the WP equation editor), which will be converted.

The conversion takes place in two passes. In the first pass the WordPerfect input-file is read in, byte by byte. On the basis of that are created two files, WP-filename.STR and WP_filename.TBL. WP-filename.STR contains the characters, tab settings and changes of typefaces; WP-filename.TBL holds information regarding the various L^{A}TEX environments that must be opened and closed. In the second pass these files are assimilated into a single L^{A}TEX file. After a successful conversion the files WP-filename.STR and WP-filename.TBL are automatically deleted.

Invoking WP2L^{A}TEX to convert the WordPerfect 5.0 document C:\WPTEST\TEST.WP5 will cause the following screen to appear :

 Conversion program : From Wordperfect 5.0 to LaTeX Version 2.1 (WP2LATEX)
  (c) TUE-Eindhoven ---- Made by R.C.Houtepen ---- Date : 24 Jan 1990
  (c) CVUT Prague   ---- Made by J.Fojtik     ---- Date : 1996 - 1998

WordPerfect-filename [ ] :  c:\wptest\test.wp5
LaTeX-filename [c:\wptest\test.TEX] :
Converting ...
First pass :
Converting-percentage : 100%
Second pass :
Converting-percentage : 100%
Conversion completed.

The first line of the generated L^{A}TEX file, in the case of the file C:\WPTEST\TEST.TEX, will look as follows :

   \documentstyle[11pt,wp2latex]{report}

When calling L^{A}TEX to typeset the converted document, the style file WP2LATEX.STY should be in the current directory or in the style-file directory (e.g., \PCTEX\TEXINPUT). This style file defines a number of macros and environments which are regularly used in the generated L^{A}TEX files. Examples include the command \nwln and the indenting environment. \nwln generates a hard carriage return after the end of a L^{A}TEX-environment. The indenting environment is used in the conversion of WordPerfect’s [→Indent] command (see § 3.2).

6 Conclusion

The 100%-correct conversion of a WordPerfect-document is not guaranteed. Error messages can always appear during processing by L^{A}TEX. Some adjustments to the generated L^{A}TEX file will in many cases be necessary.

The following were given the highest priority :

• preventing the loss of text

• avoiding program crashes

Because the sources are included (Turbo Pascal 5.0 format) it should not be too difficult modifying the program to convert Wordperfect 5.1 documents, provided the WordPerfect file formats are known. The file formats we used for our program were found in the WordPerfect 5.0 Developer’s Toolkit. Most likely such a toolkit is available for version 5.1 of WordPerfect.

If you have remarks or comments regarding the program, you can send them to :

Jaroslav Fojtík Email:fojtik@vision.felk.cvut.cz

I have found that these address are not currently valid:

R.C. Houtepen Brusselstraat 150 4826 NK Breda The Netherlands Tel: 076-714777  or  R.L.M. Helwig Eindhoven University of Technology P.O. BOX 513 5600 MB Eindhoven The Netherlands Tel: 040 - 472724 uucp : rcronh@urc.tue.nl bitnet : rcronh@heitue5

(This page is intentionally left blank for notes.) 16