User's Guide
There is another version of W P2LATEX 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.
W P2LATEX 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 and C++. The pascal version will be no longer supported from me. Only severe bugs will 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.
W P2LATEX 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.
Because the capabilities of WordPerfect and LATEX differ strongly, it is not possible to convert all of WordPerfect's `features'.
Not converted are :
Not converted are all other features for this case.
The program is invoked with the command:
WP2LATEX [/? | /-help] [WP-filename.WP [TeX-filename.TEX]] [/L language] [ /cp895 | /cp852 | /cp1250 ] [/s] [/safemode] [/forceWP4] [ /texchars] [ /charset1 | /charsetCZ ] [/noerase-strip] [ /i WP-filename.WP] [/o TeX-filename.TEX] [/l Log-filename.TXT]
Following Unix-like call style is also possible:
WP2LATEX [-? | --help] [WP-filename.WP [TeX-filename.TEX]] [-L language] [ -cp895 | -cp852 | -cp1250 ] [-s] [-safemode] [-forceWP4] [ -texchars] [ -charset1 | -charsetCZ ] [-noerase-strip] [ -i WP-filename.WP] [-o TeX-filename.TEX] [-l Log-filename.TXT]
The parameter WP-filename.WP2 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 another3. Once the filenames are given, the following error messages may appear :
Arguments /cp895 ; /cp1250 or /cp852 are used for 8. bit TEX, which is able to process some of these code pages. 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.
If you try to convert documents from WP version 4.x then tis program normally says that you have no WP file. The reason is that WP 4.x format gives no chance for autodetection. If you are sure that you have a WP 4.x file turn the switch -forceWP4 on.
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 /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.
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.
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.
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.
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 W P2LATEX 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.41 (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 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 \vspace{\baselineskip} and the indenting environment. \vspace{\baselineskip} 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 § ).
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 abble 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.
The installation is very easy. Change to the directory sources.cc and type make install. It is all.
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?
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.
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. W P2LATEX 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. W P2LATEX 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.
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 TEX command 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 LATEX environment 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.
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 W P2LATEX 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]
Within a footnote only carriage returns and typefaces (see § 0.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.
Within a header or footer a number of converted features is reduced (see § 0.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 . 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.
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 W P2LATEX will convert are reproduced in figure .
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 ). W P2LATEX 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 ). 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.
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 typografically incorrect things and thus it is implicitly turned off. If you want to turn it on, then use switch -fix-spaces.
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} "
TEX equation 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:
|
The W P2LATEX 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 |
This section discusses all warning runtime output messages.
Errors:
Warnings:
The W P2LATEX package contains the following files :
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 advised, because the memory requirements of this program are too small to do this.
Because the W P2LATEX is distributed with source code you can solve to recompile all code. Recompilation is easy for supported systems: DJGPP and Linux. (May be Solaris, but I tested it only several times.)
Enter a command make in the source directory sources.cc
prompt:>make Enter
After this command all source code should be completelly rebuild. The program is without syntaktical bugs because I will never release new code without testing it.
This feature allows to internationalize programs by translating their messages into your native language. The code of W P2LATEX was modified to support this library. If you do not have it, comment the line GETTEXT=-D__gettext__ in the makefile. Othervise you will not abble to succesfully compile.
# Uncomment next line for allowing a gettext multilanguage translation features # This feature is not required for succesfull run of WP2LaTeX. GETTEXT=-D__gettext__
If you have problems with run of the W P2LATEX 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.
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 (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
or:fojtik@cmp.felk.cvut.cz
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/
I have found that these address are not currently valid:
R.C. Houtepen
Brusselstraat 150
4826 NK Breda
The Netherlands
Tel: 076-714777
or
uucp : rcronh@urc.tue.nl
bitnet : rcronh@heitue5
1 Translated from the Dutch by G. R. Roelofs
2 This may be a WordPefect 5.0 document with an extension other than .WP
3 This may be a file with an extension other than .TEX