Table of Contents

Name

ltx2rtf - Converts LaTeX file to RTF text-format

Syntax

ltx2rtf [-V] [-m] [-M] [-D] [ -o outputfile ] [ -C pagecode ] [ inputfile ]

Description

The command converts a LaTeX file into RTF text format. The text and much of the formatting information is translated to RTF making the new file look very similar to the original. If inputfile is not specified, standard input is read. Unless an outputfile is specified the resulting RTF is put in a file whose name if taken from the input, changing suffix to .rtf.

-V option: prints version information
on standard output and exits.

-C option: specifies the coding of input characters >= 128. Only two -C options are provided at present time: -C 850 and -C ISO (recognising 850-coded and ISO-latin1-coded accented letters).

-D option: debugging (verbose)

-m option: compiles $$equation$$ with latex and incorporate the result as a picture (not Word-editable).

-M option: compiles $$equation$$ and $math$ with latex and incorporate the result as a picture (not Word-editable).

-Z option: inhibits appending }}}}} at end of RTF output. Excess closing braces are ignored by Word, but causes errors with Staroffice and some other editors.

User defined LaTex commands are ignored by ltx2rtf. If you are familiar with the RTF format and the commands can be translated by simply inserting a format string into the RTF file you can add these commands to the direct.cfg configuration file. See format description below.

However, a special program exp-macr is provided in a special sub-directory (a Fortran77 program, to be compiled with -!bs or -fno-backslash options). It translate most user defined LaTeX commands by issuing:

exp-macr <source>.tex <translated-source>.anything

\\label, \\ref, \\pageref and \\cite commands from LaTeX are translated into the RTF file. However, Word 6.0 does not handle the equivalent of \\label as comprehensively as LaTeX2e: labels to [[sub[sub]]sections, chapters and parts must therefore be inserted INSIDE the [[sub[sub]]section name, i.e.:

\\section{The title of the section\\label{thissect}}

or

\\section{\\label{thissect}The title of the section}

\\cite and \\bibitem approximately works but references to lists, figures and tables are not implemented.

Configuration

To correctly convert font names you must edit the fonts.cfg configuration file. You have to specify the font names you use and how the LaTeX default font names should be converted to RTF. See format description below.

LaTeX variables and user defined commands are not evaluated. They will be simply ignored. To know the names of variables you can add them in the ignore.cfg file. See format description below.

The environment variable RTFPATH may contain a search path for the support files (all files ending in .cfg). They are first searched in current directory, then in RTFPATH, finally in default directory /emtex/ltx2rtf (see makefile). If the required files are not found at all the program aborts.

Caution

Please make sure that the input file is a correct LaTeX2e file. Use LaTeX to find and correct errors before using ltx2rtf, otherwise it does not properly handle all errors because of corrupt input files.

Make sure that the configuration files - direct.cfg,
- fonts.cfg,
- ignore.cfg,
- config.cfg are in the correct directory: - either the same directory as the executable, - or the LIBDIR directory stated in the Makefile - or the directory stated by environemt variable RTFPATH. You may have to change fonts.cfg or direct.cfg to suit your needs.

Configuration Files

- You must adapt config.cfg to tell ltx2rtf where are the procedures (or shell scripts) performing LaTeX and converting the DVI to PBM files, to be read afterwards by ltx2rtf (case of equations and math text).

In this config.cfg, the latextmp= statement is supposed to indicate the actual LaTeXing command (preceeded with call  in the cas of MSDOS. LaTeXing is performed in the temporary directory stated by variable TMPDIR, or TMP, or TEMP (searched in this order), This specification can be overridden by the tempdir= statement in config.cfg file.

Normally, since version 4.1, working directory is set before calling the latextmp= and the dvi2pbm procedures. These procedures have no more need to perform a cd to that temporary directory.

In the same way the dvi2pbm= statement is supposed to work in the same temporary directory, which is set by ltx2rtf before calling it. This procedure ACTUALLY DECIDES the output resolution of the math images to be inserted as figures into RTF files. The given examples assume a resolution 360 DPI fit for inclusion in 300 DPI resolution. These examples have to be adapted to the resolution of the display and of the printer, if any.

The (optional) tempdir= statement specifies the working directory for latexing and image conversion, and overrides previous choices implied by environment variables. This directory name may not contain spaces.

- direct.cfg is used for converting LaTeX commands by simple text exchange. Write the LaTex command with backslash, followed by a comma. The rest of the line until the `.' character will be written to the RTF file when the command is recognized in the LaTeX file. After the `#' character everything is ignored until end of line. To select a specific font, use *fontname*. Make sure that the font name fontname is listed in the fonts configuration file at least as dummy. To write the `*' character use **". example: \\alpha,{\\f*Symbol* a}. #alpha under Windows Symbol Font \\copyright,{\\ansi\\'a9\\pc}.

- fonts.cfg contains
the fonts conversion table. A line consists of a font name in LaTeX followed by comma and a font name in RTF. The end is marked by a dot. No spaces are allowed. The LaTeX font will be converted to the RTF font if encountered in the LaTeX file. If multiple translations for a LateX font are specified, only the first is used. All fonts in a LaTeX file that are not in this file will be mapped to the default font. All RTF fonts listed in this file will be in every RTF file header whether used or not. After the `#' character everything is ignored till end of line. To add a RTF font not used as substitute for a LaTeX font - for example a Symbol font used in direct.cfg - use a dummy LaTeX name like in the following example: Dummy3,MathematicalSymbols. Make sure you use the correct font name. Take care of spaces in font names. The default fonts are named Roman (command \\rm), Slanted (command \\sl), Sans Serif (command \\sf), Typewriter (command \\tt).

- ignore.cfg is the file for defining how to ignore certain commands. This file is used for recognition of LaTeXvariables, user defined variables, and some simple commands. All variables are ignored but the converter must know the names to correctly ignore assignments to variables. Write the variable-name with backslash, followed by a comma then write the type of the variable followed by `.'. Possible Types are:
NUMBER : simple numeric value
MEASURE : numeric value with following unit of measure OTHER: ignores anything to the first character after `=' and from there to next space. eg. \\setbox\\bak=\\hbox COMMAND: ignores anything to next `\\' and from there to occurence of anything but a letter. eg. \\newbox\\bak SINGLE: ignore single command. eg. \\noindent

Please write the type in upper case exactly as above. Do not use spaces. After the `#' character everything is ignored till end of line. Example: \\pagelenght,MEASURE.

Image Conversion Scripts

The dvi2pbm= statement in the config.cfg configuration file ACTUALLY specifies the DOS or LINUX or UNIX script to be invoked to convert images DVI files (generated by an invocation or LaTeX) to PBM format, in the adapted resolution. Two dvi*.bat files are provided:
- dvi2pbm uses emTeX's drivers to generate PCX and then 3 converters taken from netpbm library to produce PBM files (monochrome)
- the other uses DVIPS and GhostScript (GS). Note that this batch refers to a DVIPS360.BAT script which forces DVIPS to produce 360 DPI PostScript. But now, remember that most DVIPS produce 600 DPI as a default... which has to be changed.

These example scripts HAVE TO be adapted to the resolution of the display and of the printer, if any.

Bugs

Some environments like figure are currently ignored. It would be nice to scan the included information and convert things if possible.

See Also

rtf2LaTeX(1) , LaTeX User's Guide & Reference Manual by Leslie Lamport


Table of Contents