User's Guide

Jaroslav Fojtík

Contents

1  Introduction
    1.1  Some general remarks
    1.2  Authorship history
2  Conversion possibilities
3  The program
    3.1  Description of command line arguments
    3.2  Program Behaviour
4  How to install WP2LaTeX
    4.1  Under DOS and OS/2
    4.2  Under Linux
    4.3  Windows
5  Discussion about conversion reliability
6  Guidelines
    6.1  Tabbing
    6.2  Indenting
    6.3  Combinations of tabbing and indenting
    6.4  Page number positioning
    6.5  WordPerfect default values
    6.6  Footnotes & Endnotes
    6.7  Formulas
    6.8  Headers and footers
    6.9  Images
    6.10  Spaces
    6.11  Tables
7  Used Styles
8  Advanced features
    8.1  Understanding log file
    8.2  Logging of nested objects
9  Warning and Error messages
10  The package
    10.1  Re-compilation of the code
    10.2  Compile options
    10.3  Modularity of the code
    10.4  Support for gettext library
    10.5  Debugging version of W P2LATEX
11  Copyright
12  Conclusion

1  Introduction

There is another version of  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.
 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 original programming language used was Turbo Pascal 7.0 and C++. The pascal version will be no longer supported from me. Only severe bugs might be corrected. C++ code has been ported to OS/2, DOS DJGPP and Linux operation systems.
The projection from one paradigm (WordPerfect = word processing) to another (LATEXtypesetting) requires some cooperation on the part of the user. Because the use of LATEX 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

 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 Georgia). 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 tried to give all available versions together.

2  Conversion possibilities

Because the capabilities of WordPerfect and LATEX differ strongly, it is not possible to convert all of WordPerfect's `features'.

The conversions which are performed by  (when converting WP1.x documents) are:

The conversions which are performed by  (when converting WP2,3,4.x MAC documents) are:

The conversions which are performed by  (when converting WP4.x documents) are:

The conversions which are performed by  (when converting WP5.x documents) are:

Not converted are :

The conversions which are performed by  (when converting WP6.x documents) are:

Not converted are all other features for this case.
Note: WP7.x and WP8.x have the same binary format as WP6.x, so the same subset of features is converted. WP11.x and WP12.x have a new formula format (MTEFF same as MS Word) that is also supported by WP6.x module.

RTF2LaTeX conversion module could convert these RTF (Rich Text File) features:

3  The program

The program is invoked with the command:
   WP2LATEX [/? | /-help]
    [WP-filename.WP [TeX-filename.TEX]] [ /i WP-filename.WP] [/o TeX-filename.TEX]
    [/fig-output-dir directory] [ /l Log-filename.TXT ] [ /amssymb ] [ /bbm ]
    [ -configfile filename | -@ filename ] [ /copyright ] [ /cp-codepage ]
    [ /cp-styles ] [ /charset1 | /charsetCZ ] [ /extract-WPG ] [ /fancyhdr ]
    [/force-xxx] [/FORCE-xxx] [ /ignore-tabs ] [ /input-PS ] [/L language] 
    [ /LaTeX2 | /LaTeX3 ] [ /latexsym ] [ /no-amssymb ] [ /no-bbm ] [ /no-columns ] 
    [/no-erase-strip] [ /no-extract-WPG ] [ /no-input-PS ] [ /no-latexsym ]
    [ /no-safemode ] [ /no-texchars ] [ /no-wasy ]  [ /s "password" ] 
    [ /S | /silent] [/safemode] [ /silent ] [ /texchars] [ /ulem ] [ /v ] 
    [ /wasy ]




Following Unix-like call style is also possible:
   WP2LATEX [-? | --help]
    [WP-filename.WP [TeX-filename.TEX]] [ /i WP-filename.WP] [/o TeX-filename.TEX]
    [-fig-output-dir directory] [ -l Log-filename.TXT ] [ -amssymb ] [ -bbm ]
    [ -configfile filename | -@ filename ] [ -copyright ] [ -cp-codepage ] 
    [ -cp-styles ] [ -charset1 | -charsetCZ ] [ -extract-WPG ] [ -fancyhdr ]
    [-force-xxx] [-FORCE-xxx] [ -ignore-tabs ] [ -input-PS ] [-L language] 
    [ -LaTeX2 | -LaTeX3 ] [ -latexsym ] [ -no-amssymb ] [ -no-bbm ] [ -no-columns ]
    [-no-erase-strip] [ -no-extract-WPG ] [ -no-input-PS ] [ -no-latexsym ] 
    [ -no-safemode ] [ -no-texchars ] [ -no-wasy ]  [ -s "password" ] 
    [ -S | -silent] [-safemode] [ -silent ] [ -texchars] [ -ulem ] [ -v ]
    [ -wasy ]

3.1  Description of command line arguments

The parameter WP-filename.WP1 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 LATEX document. The default given within brackets is the name of the WordPerfect file, with the extension .TEX or TeX-filename.TEX passed as second argument. Once again the user may accept this name or enter another2. Once the filenames are given, the following error messages may appear :
Arguments /cpXXX are used for 8. bit TEX, which is able to process some of these code pages. WP2LaTeX currently supports these codepages: "852"(ISO8), "866"(Russ), "895"(Kamenicky), "1250"(Win), "1251"(WinRuss), ÏSO8859-2", ÏSO8859_1", "KOI8R".
The codepage /cp895 is called as Kamenictí and is often used in central Europe. The codepage /cp895 (ISO8) is preferred in DOS for central Europe and the codepage /cp1250 is designed for central Europe Windows. Russian people would prefer /cp1251 (Windows) or /cp866 or /cpKOI8R.
WP2LaTeX has sophisticated way how to autodetect file format of given document. Some file formats like WP4.x or WP1.x could not be fully detected. Turning this parameter on switch to the selected conversion module in the case when autodetection do not find any appropriate file format. xxx stands for conversion module shortcut. These are WP1.x, WP3.x, WP4.x, WP5.x, WP6.x, HTML, RTF, T602, AbiWord. Type wp2latex -v to obtain list of them.
Please note that one conversion module converts whole family of fileformat modifications. WP3.x converts WP2.x MAC, WP3.x MAC and WP4.x MAC. WP6.x convertor converts files from Word Perfect 6 up to Word Perfect 12.
If you try to convert documents e.g. from WP version 4.x then this program sometimes says that you have no WP file. The reason is that WP 4.x format gives no chance for reliable autodetection. If you are sure that you have a WP 4.x file turn the switch -force-WP4.x on. The same approach could apply foe any conversion module. If you are absolutely sure that you have a binary corrupted fragment of WP5.x file you could use -force-WP5.x. Lowercase -force-xxx uses suggested conversion module only if autodetection fails.
Much more stronger is argument -FORCE-xxx. This argument turns off any autodetection and enforces using of a given conversion module. Use it only if you are sure about it and expect troubles, because your file might be corrupted.
There are available several types of coding accented characters in WP5.x. 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. This switch has no influence for other conversion modules.
There is a very unclean custom to enhance documents with tabulators ([Tab]). Any attempt to convert these documents into LATEX would look quite ugly. That is why -ignore-tabs switch was introduced to ignore all tabs inside document.
Switch /L language turns on the translation features. These features are based on the gettext library, which must be properly installed. This means, that the system variable LOCALEDIR should be properly set. If not, then the program wp2latex looks for the file referred in the DJGPP and attempts to find the description of LOCALEDIR. The system variable LANGUAGE has same meaning, but the command line switch has stronger influence.
Switches -LaTeX2 and -LaTeX3 are aimed for selecting a LaTeX dialect. There are some fine nuances between LATEX3 and LATEX2 and slightly different output is generated. LATEX3 stands for LATEX20e.
Switch /noerase-strip is intended for debugging purposes. The program do not erase all temporary files so you can analyze them later.
If you turn the switch -safemode on, you can convert even corrupted WP wiles which hang WordPerfect well. All internal objects are tested and corrupted ones are digged out. If you don't want this feature then omit this switch. Do not expect better conversion from this feature. In most cases it only slow down a conversion. But if your documents are really corrupted, the conversion results may be better due to fixing errors.
Use -silent switch to reduce output messages. WP2LaTeX normally outputs a lot of warnings and notes about conversion. These notes could be usefull for analysing conversion results. This switch could be used to stop message generation.
Switch /texchars allows using WordPerfect as a TEX editor. If this switch is active, then controlling TEX sequences are not distorted and you can add for example new equation (in the WP equation editor), which will be converted. Please look also for the example file test\texchars.wp.
If you want to use some switch very often, it is possible to set a system variable wp2latex. This variable is read before a command line is processed. For example you may want to set output codepage 895 and language CS. wp2latex=-cp985 -L cs.

3.2  Program Behaviour

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 LATEX environments that must be opened and closed. In the second pass these files are assimilated into a single LATEX file. After a successful conversion the files WP-filename.STR and WP-filename.TBL are automatically deleted.
Invoking  to convert the WordPerfect 3.x, 4.x, 5.x or 6.x - 12.x document e.g. C:\WPTEST\TEST.WP5 will cause the following screen to appear:

>>>WP2LaTeX<<< Conversion program: From Wordperfect to LaTeX Version 3.33
  (c) Made by J.Fojtik  ---- Date : 1996-2006

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 LATEX file, in the case of the file C:\WPTEST\TEST.TEX, will look as follows:
   \documentstyle[11pt,wp2latex]{report}

When calling LATEX 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 LATEX files. Examples include the command \nwln and the indenting environment. \nwln generates a hard carriage return after the end of a LATEX-environment. The indenting environment is used in the conversion of WordPerfect's [®Indent] command (see § 6.2).

4  How to install WP2LaTeX

4.1  Under DOS and OS/2

You should place properly four files: wp2latex.exe, wp2latex.sty endnotes.sty and wp2latex.mo.
Place the file wp2latex.exe somewhere into your path. The good solution is to place it to c:\emtex\ etc.
The path for files wp2latex.sty and endnotes.sty should be available in the system variable texinput. A good solution is to place them to c:\emtex\texinput\.
The last step is not required for proper behaviour of the program wp2latex. It the last file is not placed, then your program will not be able to translate output messages to your language (if the translation is available of course).
Merge the directory e.g. c:\gnu\share\locale\ with doc\locale\. Or you may have translations in the directory referred in the system variable localedir.

4.2  Under Linux

The installation is very easy. Change to the directory sources.cc and type make install. It is all.

4.3  Windows

Windows are meant Windows 95, Windows 98, Windows ME, Windows NT, Windows 2000 and Windows XP. (I hope that Windows Vista will work a same way.) Obsolete Windows 3.1 are not supported. If you have them, use pure DOS or DPMI command line wp2latex.
Please create this directory structure:
 |
 +wp2latex           (win_wp2l.exe; wp2latex.chm)
  +-locale
    +-cs
    | +-lc_messages  (wp2latex.mo)
    +-de
      +-lc_messages  (wp2latex.mo)

A root that contains wp2latex directory could be C:\Program Files\wp2latex or C:\wp2latex or any other you decide.
Files win_wp2l.exe; wp2latex.chm are located in a directory win\. Locale subtree is located in directory doc\. If you have central storage of locale, you could also merge its directory e.g. c:\gnu\share\locale\ with doc\locale\. Or you may have translations in the directory referred in the system variable localedir.
The path for files wp2latex.sty and endnotes.sty should be available in the system variable texinput. A good solution is to place them to c:\emtex\texinput\. It depends on your LATEX distribution.
Anyway, you could get first experiences without installing wp2latex. Just simply execute a file win_wp2l.exe from Windows file manager.

MikTeX

(Recommended) Install the .sty file with MiKTeX as follows:
* Navigate to the folder where LaTeX packages get installed. If you accepted the default location when you installed MiKTeX, this folder is probably C:\Program Files\MiKTeX 2.5\tex\latex. (If you have an older MiKTeX installation, this folder is probably C:\texmf\tex\latex.) * Create a new folder inside this folder and call it wp2latex. * Save your .sty file into this folder. * Open the MiKTeX Options program. (You can do this by clicking Start, then All Programs, then MiKTeX, then MiKTeX Options.) * Click 'Refresh Now' on the window that opens. Now you should be able to use any information in that .sty file in any LaTeX source file.

5  Discussion about conversion reliability

When I started to contribute to this convertor, I have read that after conversion somebody must use several filters and special program to make a nice LATEX output. I have translated a huge WP file (about 1MB text) with a lot of footnotes but no tables and formulas. To get a nice LaTeX format I wrote about 5 C-programs and about 40 sed-lines to convert some ugly formattings. After this I spend some time with manual editing. At last I wrote a LaTeX-style for a nice looking document. The whole procedure took me three days. It was too bad! I hope, that this is not true with a current release.
So I expect that the conversion should be done better. Thus I started to improve convertor. Now it is something like AI (Artificial Intelligence) project and the results are not excellent. Why?
  1. Conversions performed by  are only partial and some features are ignored.
  2. In WordPerfect document are some unwanted codes (such as [Tab], [Tab Set], [indent] instead [Tab] etc.) I advise you to use [Tab] as small as possible.
  3. Word Perfect allow anybody to do some terrible thinks which are in LATEX prohibited. For example \section{Some sect\tableofcontents ion}. Many of them have been founded and fixed but I guess that number of such situations is very big.
But don't worry so much. If your document is simple, you can use converted LATEX file immediately with only minor changes. If your document become complex, then you must check conversion results more carefully. It is a good idea to print a converted file and compare it with original one.
If you expect, that something is removed from your document you can try -l logfile.txt option to see a list of all WP objects.

6  Guidelines

6.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 LATEX, however, tabs are enabled only within a tabbing environment.  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 LATEX-document will not be fixed. LATEX 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.

Few restrictions:
LATEX 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. 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. LATEX 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 LATEX will result in a number of error messages, and ultimately one or more tabs may be lost.

6.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.


The indenting consists from three commands:
\testlastline
        This TEXcommand replaces a \par command. But moreover it measure the length of the last paragraph line.
A command \zerolastline assumes that the size of the last paragraph line is zero.
A LATEXenvironment indenting is used to indent a text. In current release the limitation of two indents is broken, but you cannot combine indents and tabs together.

6.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 LATEX, 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 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]

6.4  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  will convert are reproduced in figure 1.

Picture Omitted
Figure 1: page number positions

6.5  WordPerfect default values

The conversion program generates, independently of the WordPerfect settings, a LATEX document with a left margin of 1 inch (2.54cm). This is because LATEX enforces left and top margins of at least 1 inch (see figure 2).  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 LATEX may produce error messages. This has more to do with the manner in which WordPerfect positions tab-stops than it does with LATEX(see figure 2). LATEX 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.

Picture Omitted
Figure 2: tab settings in WordPerfect and LATEX

6.6  Footnotes & Endnotes

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; LATEX, in contrast to WordPerfect, does not process them. This is a limitation (read: bug) of LATEX.
Endnotes are processed similarly as footnotes. Moreover an additional style endnotes.sty must be present in TEX path for styles. If you don't use endnotes in your WP document, the style endnotes.sty is not required.

6.7  Formulas

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.

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+ 45

2+x5
+ 1

2 + 3

4+y
- 5
Ö
 

68+x[e/5]
 
  +  
r+6
Ö
 

8
 

Influence of formula attributes

The inside part of formulas is nearly same, but interfacing LaTeX environment depends on setting many attributes.
The simplest output environment is displaymath. It is used for single formulas with anchor type paragraph or page without any caption. The eqnarray* environment is used for multiple formulas in one.
If there is any caption then displaymath is changed to equation or eqnarray. Only first equation in array is numbered and others are marked by nonumber LATEXcommand.
Environment $ $ is used mainly for the character type anchoring. Don't ask me why. Character anchored equations are usually a part of sentence and displaymath will distort such sentences like this: Ö4 + 1/2. It is also used in places where previous environments cannot be typed (e.g. in the case of tables).
The most complicated case occurs when formula is enclosed in table, figure or special box. Then correct box is generated and formula is placed inside.

Sometimes you must repair converted equations manually.

6.8  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 : 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 LATEX format, be interpreted as is shown in figure 3. 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.

Picture Omitted
Figure 3: headers

6.9  Images

It is quite difficult to convert text with images without any compromise. Current version of attempts to ease image conversion as much as possible. Some images are not converted, but they could be extracted from WP file by using switch -extract-WPG. Then they could be normally converted by external utility (e.g. ImageMagick http://www.imagemagick.com/ or GraphicMagick http://www.graphicsmagick.org/index.html). generates a postscript placeholder when it cannot cope with image. User could replace this placeholder with converted postscript image. Switch -extract-WPG do not influence output LATEX file.
The image boxes are created in the LATEX file. There are three different ways for converting them:
epsfig This option is activated by -epsfig switch.
graphicx This option is activated by -graphicx switch. This is a standard package included in LATEX20e. This option is refused when converting into LATEX2.0.
input-PS This option is activated by -inputPS switch. InputPS is useful package for including postscript files.


Example of converted image:
\begin{figure}[htbp]
\begin{forcewidth}{7.54cm}
 \begin{center}\InputPS{\FigDir/TRAINER.ps} \end{center}
\end{forcewidth}
\caption{Three point attachment to the wall.}
\end{figure}


This will look like this image:

Picture Omitted
Figure 4: Three point attachment to the wall.
The user could replace dummy image TRAINER.PS by the newly converted one. It is not necessary to change LATEX source after replacing images, because they are stored externally.
If the file contains a lot of images, it is good idea to redirect them into separate directory. Use the switch -fig-output-dir for specifying a directory for storing images. It is good idea to enter relative path like ./images. Otherwise the LATEXfile would be not portable. The relative path is related to output .tex file. Default value is ".".

6.10  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 LATEX, however, have the same effect as a single space. Therefore, in converting a WordPerfect document, multiple spaces are changed into `hard' LATEX-spaces.
For example:
WordPerfect LATEX
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 LATEX, because of the different typographic rules, typefaces and text-spacing that the latter handles.
Note: This feature produces typographically incorrect things and thus it is implicitly turned off. If you want to turn it on, then use switch -fix-spaces.

6.11  Tables

The  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. Thus an line art from tables will not be converted well. A size of columns is not converted.

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

7  Used Styles

 has its own style named WP2LATEX.STY. Features in this style could be divided into two categories:
  1. Features that I cannot find in any package.
  2. Automatically disabled/enabled features that could be found in some packages. Packages with those features must precede WP2LATEX.STY to avoid double definition errors.
Please keep in mind, that you do not need to use all listed packages. You can disable some of them or all of them and  should still be able to produce LATEX output. WP2LATEX.STY is the only mandatory style.


The full list of used packages:
amssymb
Style with special math characters.
makeidx
Style for creating index file.
ulem
Style for better underlining and striking out text.
wp2latex
The  basic style. This style is mandatory and is used in every documents.
twoside
The style for distinguishing odd and even pages mainly for headers and footers.
twocolumn
Style that supports typesetting in two columns.
multicol
Style that supports typesetting in two or more columns.
endnotes
Style that supports endnotes.
cyrillic
Style with special mainly Russian characters.
graphicx
Standard style for including postscript graphics in LATEX2.0e.
InputPS
Style that supports postscript tricks inside LATEX files. The newest version could be downloaded from http://wuarchive.wustl.edu/packages/TeX/macros/generic/boxedeps/
wasyfont
Style with special characters.
textcomp
Style with special characters.
bbm
Style with special characters.
mathrsfs
Style with special characters.
fancyhdr
Style that supports headers and footers for pages.
fontenc[T1]
Style with special characters.
longtable
Another style for tables.
czech
Native support for Czech language. Used only if the czech language is autodetected.
german
Native support for German language. Used only if the czech language is autodetected.

8  Advanced features

8.1  Understanding log file

The log file is aimed to better understanding of the contents of binary objects in the original WordPerfect file. It is similar to reveal codes in the WordPerfect editor. From this file you could find all objects that are not converted yet.
Creation of the log file is normally disabled. You could enable it by option -l logfilename. After conversion you can use any text viewer for analysing this file.

An example of the log file:
% log file for converted file c:\temp\font8.wp, WP ver 6.0
% conversion program WP2LaTex v. 2.111 from 27 Dec 1999.

Object type: DDh subtype:  Ah length:  16 [!Global on] 
Object type: D1h subtype:  Fh length:  16    
Object type: D1h subtype: 13h length:  12    
Object type: D1h subtype: 11h length: 340    
Object type: D3h subtype:  5h length:  12 [Justification Full] 
Object type: DDh subtype:  Bh length:  11 [!Global off] 
Object type: D4h subtype: 5Fh length:  16    TNR1>>>
Object type: D4h subtype: 1Bh length:  31 [!Font 1.00] 
Object type: D4h subtype: 1Ah length:  31 [!Font Times] <<<Kecy kecy
Object type: CFh subtype:  0h length:   1 [SRt] kecy 
% pass1 finished going to pass2

% pass2 finished
%  There were 0 unconverted characters.
%  There were 25 unrecognized/ignored objects.

On the top of the log file is placed small header. The list of objects continues. Features Object type: D4h subtype: 1Ah length:  31 are WP internals and you do not need to care with them. If the interpretation of object is known, the bracketed symbol [Justification Full] appear. If the interpretation of object is known, but object cannot be converted, the exclamation mark '!' appear before object name [!Font Times]. The object name is normal reveal code of recognized symbol. Normal text is placed after objects.

8.2  Logging of nested objects

When WP2LaTeX parses any object nested into a main WP file, different output might appear. That is why different internal symbol subset must be used to understand file contents. Symbols from nested objects are indented for better reading of logs.
Object type: D2 subtype:  5 length: 128 L    
  {GRtyp#F;len:6;!Start WPG l1}
  {GRtyp#2;len:4;Line Attributes}
  {GRtyp#1;len:2;Fill Attributes}
  {GRtyp#14;len:ae3b;Bitmap l2}
  {GRtyp#10;len:0;!End WPG l1}
Object type: DA subtype:  0 length: 121 L [Figure] 

This is example of WPG graphic included inside WP file. Tho get a full understanding of symbol meaning you should read WPG file format specification.

9  Warning and Error messages

This section discusses all warning runtime output messages.
Fatal Errors:
Errors:
Warnings:

10  The package

The  package contains the following files :
MAKEFILE (The root makefile for wp2latex package.)
README.1ST (The file with basic instructions- abbreviated description of this program.)
README.TXT (The main readme file for advertising this program.)
WP2LATEX.FAQ (File with answers to frequently asked questions.)
STYLES.TEX\BoxedEPSF.TEX (Additional style for including PS images.)
STYLES.TEX\ENDNOTES.STY (Additional style for processing endnotes in LATEX\.)
STYLES.TEX\CYRACC.DEF (Additional package for including cyrillic characters into LATEX document.)
STYLES.TEX\CYRILLIC.STY (Additional style for including cyrillic characters into LATEX document - uses CYRACC.DEF.)
STYLES.TEX\InputPS.STY (Additional style for including PS images.)
STYLES.TEX\WP2LATEX.STY (Style file needed by LATEX for processing.)
STYLES.TEX\WASYFONT.STY (Additional style for including characters from wasy2 font into LATEX\.)
SOURCES.CC\ (The directory with C++ sources.)
SOURCES.CC\FORMULAS.CC (Procedures for converting WP5.x and WP6.x formulas.)
SOURCES.CC\CHARACTR.CC (Procedures for converting extended WP characters.)
SOURCES.CC\IGETTEXT.CC (Procedures for initialize gettext translation features.)
SOURCES.CC\MAKEFILE (Makefile for C++ version under both DJGPP and Linux.)
SOURCES.CC\PASS1.CC (common procedures needed for all WP convertors during 1st pass.)
SOURCES.CC\PASS1XML.H (Prototypes for HTML and XML tags)
SOURCES.CC\PASS2.CC (procedures for PASS2)
SOURCES.CC\WP2LATEX.CC (main part of )
SOURCES.CC\WP2LFUTI.CC (file related functions for general usage)
SOURCES.CC\WP2L_LIB.CC (miscellaneous functions for general usage)
SOURCES.CC\WP2LATEX.H (main include file for all components of .)
SOURCES.CC\PASS1_3.CC (conversion module (PASS1) for Macintosh WP version 2.x, 3.x or 4.x)
SOURCES.CC\PASS1_4.CC (conversion module for WP version 4.x)
SOURCES.CC\PASS1_5.CC (conversion module for WP version 5.x.)
SOURCES.CC\PASS1_6.CC (conversion module for WP version 6.x (and also 7.x) )
SOURCES.CC\PASS1ABI.CC (conversion module for AbiWord documents)
SOURCES.CC\PASS1C45.CC (decrypter for WP4.x and WP5.x encrypted files - does not perform conversion)
SOURCES.CC\PASS1MTF.CC (MTEFF equations parser - used in >WP10, RTF and Word documents.)
SOURCES.CC\PASS1OLE.CC (procedures for parsing OLE wrapper that might contain WP6x document.)
SOURCES.CC\PASS1HTM.CC (conversion module for HTML documents)
SOURCES.CC\PASS1RTF.CC (conversion module for RTF documents)
SOURCES.CC\PASS1WMF.CC (Attempt to parse Window metafile)
SOURCES.CC\PASS1WRD.CC (Attempt to convert Word documents)
SOURCES.CC\PASS1XML.CC (Support for HTML and XML tags)
SOURCES.CC\PASS1602.CC (conversion module for Text 602 documents)
SOURCES.CC\ATOMS (Additional library with some special C++ stuff like strings, sets, matrices etc.)
SOURCES.CC\ATOMS\INCLUDE\COMMON.H (Include file with some compiler specific commands.)
SOURCES.CC\ATOMS\LISTS.CC (Collection of procedures for operations with lists of text.)
SOURCES.CC\ATOMS\INCLUDE\LISTS.H (The include file for tool LISTS.CC.)
SOURCES.CC\ATOMS\SETS.CC (Collection of procedures for operations with sets.)
SOURCES.CC\ATOMS\INCLUDE\SETS.H (The include file for tool SETS.CC.)
SOURCES.CC\ATOMS\STRINGS.CC (Collection of procedures for operations with strings.)
SOURCES.CC\ATOMS\INCLUDE\STRINGS.H (The include file for tool STRINGS.CC.)
SOURCES.CC\ATOMS\STRUCT.C (Procedures for endian conversion of multi-byte numbers.)
SOURCES.CC\ATOMS\INCLUDE\TYPES.H (This include file provides fixed size numbers like BYTE, WORD, DWORD.)
SOURCES.CC\CP_LIB (Additional library for handling and converting codepages.)
SOURCES.CC\CP_LIB\WP5.ENC (Character positions for WP5.x)
SOURCES.CC\CP_LIB\WP6.ENC (Character positions for WP6.x)
SOURCES.CC\CP_LIB\UNICODE.ENC (Character positions for unicode)
SOURCES.PAS\ (The directory with the original Turbo Pascal 7.0 sources - obsolete!)
SOURCES.PAS\COMMON.PAS (Commonly used procedures)
SOURCES.PAS\FORMULAS.PAS (Unit for converting of formulas)
SOURCES.PAS\PASS1.PAS (procedures for PASS1)
SOURCES.PAS\PASS1_6.PAS (experimental procedures for PASS1 for WP version 6.0)
SOURCES.PAS\PASS2.PAS (procedures for PASS2)
SOURCES.PAS\WP2LATEX.PAS (main part of )
DOS\WP2LATEX.EXE (the conversion program DOS executable)
OS2\WP2LATEX.EXE (the conversion program OS/2 executable)
LINUX\WP2LATEX (the conversion program Linux ELF executable)
WIN\WP2LATEX.EXE (the conversion program MS Windows executable)
WIN\BCC55.BAT (batch file for compilation with Borland C++ 5.5)
WIN\BCC55.BAT (response file for Borland C++ 5.5)
DOC\ (The directory with documentation texts.)
DOC\BUG.TXT (The description of known bugs. Please consult this file first before you will report anything.)
DOC\WP2LTX.TEX ( Dutch (original) version of the user's guide - now obsolete)
DOC\WP2LATEX.1 (Man page for WP2LATEX program.)
DOC\WP2LATEX.TEX (This user's guide.)
TEST\ (The directory with testing WordPerfect files.)
TEST\TEST.WP (WP test file with mix of features)
TEST\CHARACTR.WP (WP test file with all WP charsets)
Four executable files are supported. One for real mode MSDOS, second for MSWindows, third for Linux and fourth for protected DOS DJGPP. All versions work in text mode. Using of DPMI (protected mode) version is not necessary, because the memory requirements of this program are too small to do this. DJGPP version benefits only for raster images conversion.

10.1  Re-compilation of the code

Because the  is distributed with source code you can solve to recompile all code. Recompilation is easy for supported systems: DJGPP and Linux. (May be that you will succeed in others systems like Solaris, AIX but I have no chance to test it.)

Linux and other Unixes

Type: prompt:>./configure Enter prompt:>make Enter
A configure script should do all configuration job for you in most cases. If not, you have to solve a current problem. Please consult a WP2LaTeX.faq file, where known compilation failures are discussed.

DOS-DJGPP and GCC



Enter a command make generic followed by make in the  directory.
prompt:>make Enter
After this command all source code should be completely rebuild. The program is distributed without syntactical bugs because I will never release a new code without testing it.
You could benefit from installing a JPG library and compile a code with JPG support enabled. I have uploaded one snapshot of JPG library to a  homepage: http://www.penguin.cz/~fojtik/wp2latex/wp2latex.htm .

DOS/WINDOWS and Borland C++

Because there is freely available Borland C++ compiler, I also provide script for building  by BCC. Before using it please ensure that paths in the file bcc55.bat are correct and also check paths inside .RSP file .

change to directory win
cd win
execute bcc55.bat
bcc55.bat

DOS/WINDOWS and MSVC

The project for Microsoft Visual Studio 6.0 is also distributed.
Microsoft Visual Studio 2000 and Microsoft Visual Studio 2003 are able to open it and upgrade it to their release. If you have MSVC200 or MSVC2003 import a MSVC/wp2latex.dsw file.
You could rebuild a target Win32 release or Win32 release gettext that has also added online translations to foreign languages.

10.2  Compile options

You could control tradeoff size over speed by configure script a little bit.
Use ./configure --enable-extra-optimization=size to optimize for size. This option shrink executable by 3% (measured with gcc-3.0.4). I hope that normal user might prefer this option.
Use ./configure --enable-extra-optimization=speed to optimize for speed. This option generates fastest executable that is 5.5% bigger. When you are using WP2LaTeX for automatical batch conversion this option might help you a little bit. Safe mode and output messages also slow down conversion time.

10.3  Modularity of the code

The current release of  is quite big > 400kb. But from now you could shrink size of code a lot.  consists from separate conversion modules that do not need to be all included in the code.
If you do not need some module, simply comment out it the makefile and relink  . Everything should work fine without recompilation of another conversion modules.

OBJECTS+=pass1_1$(OBJ)
OBJECTS+=pass1_3$(OBJ)
OBJECTS+=pass1_4$(OBJ)
OBJECTS+=pass1_5$(OBJ)
OBJECTS+=pass1_6$(OBJ)
OBJECTS+=pass1c45$(OBJ)
OBJECTS+=pass1ole$(OBJ) cole/new_cole$(OBJ)

## codepage library for HTML & RTF ##
OBJECTS+=cp-trn$(OBJ)
#conversion module for HTML
OBJECTS+=pass1_ht$(OBJ)
#conversion module for RTF
OBJECTS+=pass1rtf$(OBJ)
#conversion module for T606
# T602 parser ##
OBJECTS+=pass1602$(OBJ)


Orientational values of module sizes:
Module name Purpose code size data size results
PASS1ABI.CC Abiword (f) 5731 488 moderate
PASS1C45.CC encrypted WP4 and WP5 3395 323 decrypts all
PASS1CDCB.CC Docbook 3171 353 experimental
PASS1RTF.CC Rich Text File (+) 16620 (+) 2247 moderate
PASS1_1.CC WP1.x for MAC 3564 695 experimental
PASS1_3.CC WP2,3,4.x for MAC 10107 2567 moderate
PASS1_4.CC WP4.x 9046 685 good
PASS1_5.CC WP5.x and WPG 16583 1335 excellent
PASS1_6.CC WP6.x - WP12.x 26751 2761 excellent
PASS1OLE.CC OLE Wrapper (*) 1068 (*) 138 extracts all
PASS1_HT.CC HTML and Accent (+f) 12708 (+) 3332 moderate
PASS1602.CC Text 602 (+) 3464 (+) 278 good
PASS1WRD.CC MS Word (unfinished) (*) 11970 774 bad
PASS1MTF.CC Math Type Equation 8053 8767 good
(*) Require cole library (code+6697 :data+18)
(+) Require cp_trn module (code+357 :data+24665)
(f) Require XML module (code+1983 :data+13)

For example: you want to convert only WP5 documents so you will save
(1907+285) + (10537+1740) + (2988+352) + (8629+581) +(698+121 + 6697+18) +(24685+1961) + (12708+3332) + (3580+281) + = 106122
It means that final code will be about 106kb shorter in this case.
Please note also conversion results. Some modules are mature enough and some are only experimental. You could try this convertor e.g. for Microsoft Word and look for another convertor, if you are not satisfied with results attained.

10.4  Support for gettext library

This feature allows to internationalize programs by translating their messages into your native language. The code of  was modified to support this library. If you do not have it, comment the line GETTEXT=-D__gettext__ in the makefile. Otherwise you will not able to successfully compile.
# Uncomment next line for allowing a gettext multilanguage translation features
# This feature is not required for successful run of WP2LaTeX.
GETTEXT=-D__gettext__

10.5  Debugging version of

If you have problems with run of the  you can solve to create debugging version. The comment in makefile should be clear for explanation.
# Uncomment next line for compile a debugging version of WP2LaTeX
# DEBUG=-DDEBUG -g

The debugging version logs all function calls so that big .LOG file can be created. Use this feature only if you really want to debug because it slows down all code.

11  Copyright

This program can be redistributed and/or modified under the terms of the GNU General Public License version 2 available from http://www.gnu.org/copyleft/gpl.html. If anybody makes any change to this package, I am asking him to explicitly write that his package differs from original package.
Current copyright could be obtained by typing wp2latex -copyright. WP2LaTeX contains several libraries, that have different licencing models.
It is also possible to buy commercial version that is GPL free.

12  Conclusion

The 100%-correct conversion of a WordPerfect-document is not guaranteed. Error messages can always appear during processing by LATEX. Some adjustments to the generated LATEX file will in many cases be necessary.
The following were given the highest priority :
Because the sources are included in portable C++ language it should not be too difficult modifying the program.
The file formats we used for our program were found in the WordPerfect Developer's Toolkit.
If you have remarks or comments regarding the program, you can send them to:


Jaroslav Fojtík
Email: fojtik@penguin.cz (my new Email)
fojtik@htc.honeywell.cz (might be invalid after 8/1/2005)
or: fojtik@cmp.felk.cvut.cz (this may be invalid after 2000, but still works in 2005 :-)))

Post Address:
Jaroslav Fojtik
Dvouramenna 13
Praha 4 - Podoli
140 00
Czech Republic

Before doing this please visit my www page and test recent version:
http://www.penguin.cz/~fojtik/wp2latex/


I have found that all addresses of previous authors 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.)

Footnotes:

1This may be a WordPefect 5.0 document with an extension other than |.WP|}\end
\tthhref{#tthFrefAAC}{$^{2}$}{Thismay be a file with an extension other than |.TEX|}\end


File translated from TEX by TTH, version 3.85.
On 21 Nov 2008, 00:15.