Contents Up Previous Next

Changes to LaTeX syntax

Here are the conventions you need to observe to satisfy the Tex2RTF parser.

Space
Command arguments
Avoid the setlength command
Units
Labels
Tables


Space

Tex2RTF attempts to insert spaces where LaTeX assumes whitespace. However, for the benefit of RTF conversion, you need to use the \rtfsp command where a command or brace within a paragraph begins or ends with a macro. For example:

    Within a paragraph, you need to be careful about commands
    \rtfsp{\it that begin at the start of a line.}
As normal with LaTeX, two newlines represents a paragraph break, although \par can also be used at the end of a paragraph.

You need to have a blank line between section and some environment commands and the first paragraph or your document will look rather weird, e.g. headings running into paragraphs.

wxHelp is more fussy than LaTeX or RTF: you need to use percent characters at line ends liberally to eliminate newlines after commands on single lines.


Command arguments

Commands that have one or more arguments can be used in the following three ways:

    \bf{Some text.}

    \begin{bf}
    Some text.
    \end{bf}

    {\bf Some text.}
The first method is a normal LaTeX command.

The second method is called an environment; LaTeX has specific environments that do not always correspond to normal commands, but Tex2RTF recognizes environments and normal commands interchangeably, so long as the command has no more than two arguments.

With the third method, it is important that the command has its own pair of braces, and that the command immediately follows the first brace. Otherwise, the parser cannot parse the argument(s) properly. With multiple arguments, each should be enclosed in braces.

Optional arguments are specified using square brackets or parentheses.

The braces that start command arguments must not be separated from the other arguments by whitespace. For example, the following produces an error:

    \image{5cm;0cm}
    {picture.eps}
and should be replaced by

    \image{5cm;0cm}{picture.eps}

Avoid the setlength command

Using the \setlength command doesn't work, since its first argument looks like a command with the wrong number of arguments. Use an alternative form instead, e.g.

    \parindent 0pt
instead of

    \setlength{\parindent}{0pt}

Units

Only a subset of LaTeX units may be used for specifying dimensions. Valid units are pt, mm, cm and in. Units should usually be specified for dimensions or the results may be unexpected.


Labels

The \label command may be used for sections and figure captions, but must come immediately after the section or caption commands with no intervening whitespace.


Tables

For best layout, table rows should be enclosed in a \row or \ruledrow command, since Tex2RTF can't cope with parsing the LaTeX tabular syntax unaided. However, if you really don't want to go through LaTeX files inserting new syntax, set the compatibility flag to TRUE in your tex2rtf.ini file. In this mode, Tex2RTF tries to make the best of a bad job, but the results won't be optimal (e.g., no table borders). Without this flag set, normal LaTeX tables can crash RTF readers such as Word for Windows.