\documentstyle[11pt,wp2latex]{report}

\newcommand{\arrow}{$\rightarrow$}
\renewcommand{\thechapter}{}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thefigure}{\arabic{figure}}

\title{\WPtoLaTeX\\
 \hspace{1cm}\\
       User's Guide}
\author{R.C. Houtepen\thanks{Translated from the Dutch by G. R. Roelofs}}

\begin{document}

\maketitle

\newpage

\pagenumbering{roman}
\tableofcontents

\newpage

\pagenumpos{\pnbc}
\pagenumbering{arabic}

\section{Introduction}

The program \WPtoLaTeX\ allows the conversion of WordPerfect 5.0 documents
into \LaTeX\ format.  The program was written in the framework of a 
commissioned publication by the Computation Center of the Eindhoven University 
of Technology, the Netherlands.  The programming language used was Turbo 
Pascal 5.0.\\
\\
The projection from one paradigm (WordPerfect = word processing) to another
(\LaTeX\ = typesetting) 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.\\

\newpage

\section{Conversion possibilities}
\label{capabilities}

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 \WPtoLaTeX\ are :\\
\begin{itemize}
  \item hard returns
  \item hard page breaks
  \item the following typefaces :
    \begin{itemize}
      \item extra large
      \item very large
      \item large
      \item small
      \item fine
      \item superscript
      \item subscript
      \item italic
      \item small caps
      \item bold
      \item underlined
      \item double-underlined
    \end{itemize}
  \item extended characters (foreign language/accented, not linedrawing)
  \item overstriking
  \item tabs :
    \begin{itemize}
      \item setting
      \item left tabs
      \item center tabs
      \item right tabs
    \end{itemize}
  \item flush-right text
  \item outlining
  \item indenting :
    \begin{itemize}
      \item left
      \item left and right
    \end{itemize}
  \item footnotes
  \item headers and footers
  \item page number positioning
  \item full justification on/off 
\end{itemize}
\nwln
{\bf Not} converted are :
\begin{itemize}
  \item margin settings
  \item newspaper-style columns
  \item line spacing
  \item top and bottom margins
  \item index
  \item references
  \item endnotes
  \item table of contents
  \item graphics boxes
\end{itemize}

\newpage

\section{Guidelines}

\subsection{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 {\em where} subsequent tab-stop commands will
place text.  Then there are the tabs themselves, which force a {\em jump} to
one of the previously-defined positions.  In \LaTeX , however, tabs
are enabled only within a \verb|tabbing| environment.  \WPtoLaTeX\ takes
care of that by invoking a \verb|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 :\\

\begin{verbatim}
   Text1 [Tab] text2 [Tab] text3 [SRt]
   text4 [Tab] text5. [HRt]
\end{verbatim}
\nwln

The following is better :\\

\begin{verbatim}
   Text1 [Tab] text2 [Tab] text3 [HRt]
   text4 [Tab] text5. [HRt]
\end{verbatim}
\nwln

A tab-setting within a line holds only for the whole line.  It is
therefore advisable to place tab-settings at the beginning of or prior to the
pertinent line.\\
\\
\\
{\bf A few restrictions :}\\
\\
\LaTeX\ endows such commands as \verb|\'|, \verb|\`| and \verb|\=| with special
meanings within a \verb|tabbing| environment.  Outside a \verb|tabbing|
environment, these commands are used for the placement of accents; within
one, however, they must be replaced by \verb|\a'|, \verb|\a`| and \verb|\a=|, 
respectively.  \hbox{\WPtoLaTeX} 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.\\

\newpage

\subsection{Indenting}
\label{indent}

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

Examples :\\
\\
\begin{tabbing}
\verb|   [|\arrow\verb|Indent]|$^*$\verb|  |\=
        \verb|An indented paragraph which [SRt]| \\
     \> \verb|extends over several lines and [SRt]| \\
     \> \verb|is closed with a hard carriage [SRt]| \\
     \> \verb|return. [HRt]| \\
\end{tabbing}
\begin{tabbing}
\verb|   label  [|\arrow\verb|Indent]|$^*$\verb|  |
  \= \verb|We see here the possibility of [SRt]| \\
  \> \verb|placing a `label' in front of [SRt]| \\
  \> \verb|indented text. [HRt]| \\
\end{tabbing}
\begin{tabbing}
\verb|   [|\arrow\verb|Indent]|$^*$\verb|  label  [|
\arrow\verb|Indent]|$^*$\verb|  |
  \= \verb|It is also possible to place [SRt]| \\
  \> \verb|an `indented label' in front [SRt]| \\
  \> \verb|of indented text. [HRt]| \\
\end{tabbing}

\nwln
where \verb|[|\arrow\verb|Indent]|$^*$ indicates one or more 
\verb|[|\arrow\verb|Indent]| commands. \\

\vspace{1cm}

{\bf Remark :}\\

When using \WPtoLaTeX\ it is {\bf not} possible to convert more than two 
levels of indented text.\\

\newpage

\subsection{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 \verb|[Tab]| command may be used for tabbing and only the 
\verb|[|\arrow\verb|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 :\\
\begin{tabbing}
\verb|   [Tab] tom [Tab] dick [|\arrow\verb|Indent] harry [HRt]| \\
\end{tabbing}

The tab command in this line comes before the indenting command.  The
interpretation by \hbox{\WPtoLaTeX} is then : \\
\begin{tabbing}
\verb|   [Tab] tom [Tab] dick harry [HRt]| \\
\end{tabbing}

The indent-command is eliminated.  The line should instead look as follows :\\
\begin{tabbing}
\verb|   [Tab] tom [Tab] dick [Tab] harry [HRt]| \\
\end{tabbing}

\newpage

\subsection{Footnotes}

Within a footnote only carriage returns and typefaces (see 
\S~\ref{capabilities}) 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.\\
\\

\newpage

\subsection{Headers and footers}

Within a header or footer only typefaces are converted (see 
\S~\ref{capabilities}).\\
\\
One can split a header or footer into three pieces :
\begin{itemize}
  \item left-aligned
  \item centered
  \item right-aligned
\end{itemize}
\nwln
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\\

\begin{verbatim}
   Left[Centr]Middle[C/U/SR/D][Flush Right]Right
\end{verbatim}
\nwln
will, after conversion to \LaTeX\ format, be interpreted as is shown in
figure~\ref{fig:header}.  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.\\

\begin{figure}[hbt]
\centering
\setlength{\unitlength}{3mm}
\begin{picture}(12,16)
 \thicklines
 \put(0,0){\framebox(12,16)}
 \put(1,14){\makebox(10,1)[l]{{\tiny Left}}}
 \put(1,14){\makebox(10,1){{\tiny Middle}}}
 \put(1,14){\makebox(10,1)[r]{{\tiny Right}}}
 \put(1,12){\line(1,0){10}}
 \put(1,11){\line(1,0){10}}
 \put(1,10){\line(1,0){10}}
 \put(1,9){\line(1,0){10}}
 \put(1,8){\line(1,0){10}}
 \put(1,7){\line(1,0){10}}
 \put(1,6){\line(1,0){10}}
 \put(1,5){\line(1,0){10}}
 \put(1,4){\line(1,0){10}}
 \put(1,3){\line(1,0){10}}
 \put(1,2){\line(1,0){10}}
\end{picture}
\caption{headers}
\label{fig:header}
\end{figure}

\newpage

\subsection{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 \WPtoLaTeX\ will convert are reproduced in 
figure~\ref{fig:pagnr}.\\

\begin{figure}[hbt]
\centering
\setlength{\unitlength}{3mm}
\begin{picture}(12,16)
 \thicklines
 \put(0,0){\framebox(12,16)}
 \put(1,14){\makebox(10,1)[l]{1}}
 \put(1,14){\makebox(10,1){2}}
 \put(1,14){\makebox(10,1)[r]{3}}
 \put(1,1){\makebox(10,1)[l]{5}}
 \put(1,1){\makebox(10,1){6}}
 \put(1,1){\makebox(10,1)[r]{7}}
\end{picture}
\caption{page number positions}
\label{fig:pagnr}
\end{figure}

\newpage

\subsection{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~\ref{fig:tabs}).  \WPtoLaTeX\ 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~\ref{fig:tabs}). 
\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.\\

\begin{figure}[hbt]
\centering
\setlength{\unitlength}{1.5mm}
\begin{picture}(60,50)
 \thicklines
 \put(0,0){\framebox(28,35)}
 \put(32,0){\framebox(28,35)}
 \thinlines
 \put(0,37){\makebox(1,3)[l]{WordPerfect}}
 \put(32,37){\makebox(1,3)[l]{\LaTeX}}
 \put(36,31){\line(1,0){21}}
 \put(36,31){\line(0,-1){28}}
 \put(32,31){\vector(1,0){4}}
 \put(36,31){\vector(-1,0){4}}
 \put(36,31){\vector(0,1){4}}
 \put(36,35){\vector(0,-1){4}}
 \put(37,31){\makebox(1,4)[l]{{\small 1"}}}
 \put(32,28){\makebox(4,2){{\small 1"}}}
 \put(36,27){\vector(1,0){3}}
 \put(40,27){\makebox(1,1)[tl]{{\scriptsize tab 1}}}
 \put(36,25){\vector(1,0){6}}
 \put(43,25){\makebox(1,1)[tl]{{\scriptsize tab 2}}}
 \put(36,23){\vector(1,0){9}}
 \put(46,23){\makebox(1,1)[tl]{{\scriptsize tab 3}}}
 \put(4,31){\line(0,-1){28}}
 \put(4,31){\line(1,0){21}}
 \put(0,27){\vector(1,0){7}}
 \put(8,27){\makebox(1,1)[tl]{{\scriptsize tab 1}}}
 \put(0,25){\vector(1,0){10}}
 \put(11,25){\makebox(1,1)[tl]{{\scriptsize tab 2}}}
 \put(0,23){\vector(1,0){13}}
 \put(14,23){\makebox(1,1)[tl]{{\scriptsize tab 3}}}
\end{picture}
\caption{tab settings in WordPerfect and \LaTeX}
\label{fig:tabs}
\end{figure}

\newpage

\subsection{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 : \\

\begin{tabular}{|l|l|}
\hline
WordPerfect                & \LaTeX \rule[-.5cm]{0cm}{1.5cm} \\
\hline
\verb*|word1    word2|   & \verb*|word1 ~~~word2|\rule[-.5cm]{0cm}{1.5cm} \\
\hline
\end{tabular}
\nwln

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.

\newpage

\section{The program}

The \WPtoLaTeX\ package contains the following files :\\

\begin{itemize}
  \item \verb|WP2LATEX.EXE| (the conversion program)
  \item \verb|WP2LATEX.PAS| (the original Turbo Pascal 5.0 sources)
  \item \verb|WP2LATEX.STY| (style file needed by \LaTeX\ for processing)
  \item \verb|WP2LTX.TEX  | (this user's guide)
  \item \verb|README.BAT  | (batch-file with user instructions)
\end{itemize}
\nwln
The program is invoked with the command :\\

\begin{verbatim}
   WP2LATEX [WP-filename.WPF]
\end{verbatim}

\nwln
The parameter \verb|WP-filename.WPF|\footnote{This may be a WordPefect 5.0
document with an extension other than \verb|.WPF|} is optional.
The program starts with an opening screen and asks for the WordPerfect 
filename.  The default filename is printed inside square brackets 
\mbox{(\verb|[ ]|)} and is the parameter which was optionally included in
the initial invocation of \verb|WP2LATEX|\null.  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 \verb|.TEX|\null.  Once again the user
may accept this name or enter another\footnote{This may be a file with an
extension other than \verb|.TEX|}.  Once the filenames are given, the 
following error messages may appear :

\begin{itemize}
  \item \Underline{File not found :} The given WordPerfect file does not exist.
  \item \Underline{Path not found :} An invalid path was given in the name
        of one of the files.
  \item \Underline{Not a WordPerfect 5.0 dokument :} The given WordPerfect
        file was not created in WordPerfect 5.0
\end{itemize}
\nwln
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, \verb|WP-filenaam.STR| and \verb|WP_filenaam.TBL|\null.  
\verb|WP-filenaam.STR| contains the characters, tab settings and changes of
typefaces; \verb|WP-filenaam.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 \verb|WP-filenaam.STR| and \verb|WP-filenaam.TBL| are 
automatically deleted.\\

\newpage

Invoking \WPtoLaTeX\ to convert the WordPerfect 5.0 document 
\verb|C:\WPTEST\TEST.WP5| will cause the following screen to appear :\\

\begin{verbatim}

     Conversionprogram : From Wordperfect 5.0 to LaTeX  (WP2LATEX)

  (c) TUE-Eindhoven ---- Made by R.C.Houtepen ---- Date : 24 Jan 1990


WordPerfect-filename [ ] :  c:\wptest\test.wp5
LaTeX-filename [c:\wptest\test.TEX] :

Converting ...

First strike :
Converting-percentage : 100%

Second strike :
Converting-percentage : 100%

Conversion completed.

\end{verbatim}

The first line of the generated \LaTeX\ file, in the case of the file
\verb|C:\WPTEST\TEST.TEX|, will look as follows : \\

\begin{verbatim}
   \documentstyle[11pt,wp2latex]{report}
\end{verbatim}
\nwln

When calling \LaTeX\ to typeset the converted document, the style file
\verb|WP2LATEX.STY| should be in the current directory or in the style-file
directory (e.g., \verb|\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
\verb|\nwln| and the \verb|indenting| environment. \verb|\nwln| generates a
hard carriage return after the end of a \LaTeX-environment.  The 
\verb|indenting| environment is used in the conversion of WordPerfect's
\verb|[|\arrow\verb|Indent]| command (see \S~\ref{indent}). \\

\newpage

\section{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 :
\begin{itemize}
  \item preventing the loss of text
  \item avoiding program crashes
\end{itemize}
\nwln

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, we 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 : \\

\vspace{2cm}

\begin{minipage}[t]{6cm}
R.C. Houtepen \\
Brusselstraat 150 \\
4826 NK Breda \\
The Netherlands \\
Tel: 076-714777
\end{minipage}
\hfill or \hfill
\begin{minipage}[t]{6cm}
\raggedleft
R.L.M. Helwig \\
Eindhoven University of Technology \\
P.O. BOX 513\\
5600 MB Eindhoven\\
The Netherlands \\
Tel: 040 - 472724\\
\nwln
uucp : rcronh@urc.tue.nl\\
bitnet : rcronh@heitue5
\end{minipage}

\newpage
\nwln
\begin{center}
(This page is intentionally left blank for notes.)
\end{center}
\nwln
\end{document}
