Table of Contents


tr2latex - convert a document from troff to LaTeX


tr2latex [ -m ] [ -t ] [ -n ] [ -s style ] [ -o outfile ] filename...


Tr2latex converts a document typeset in troff to a LaTeX format. It is intended to do the first pass of the conversion. The user should then finish up the rest of the conversion and customize the converted manuscript to his/her liking. It can also serve as a tutor for those who want to convert from troff to LaTeX.

Most of the converted document will be in LaTeX but some of it may be in plain TeX. It will also use some macros in troffms.sty or troffman.sty which are included in the package and must be available to the document when processed with LaTeX.

If there is more than one input file, they will all be converted into one LaTeX document.

Tr2latex understands most of the -ms and -man macros and eqn preprocessor symbols. It also understands several plain troff commands. Few tbl preprocessor commands are understood to help convert very simple tables.

When converting manuals, use the -m flag. Otherwise tr2latex assumes to translate a -me input file.

If a troff command cannot be converted, the line that contain that command will be commented out.

NOTE: if you have eqn symbols, you must have the in-line mathematics delimiter defined by delim in the file you are converting. If it is defined in another setup file, that setup file has to be concatenated with the file to be converted, otherwise tr2latex will regard the in-line math as ordinary text.


Convert manual pages. This makes tr2latex understand most of the -man macros. It uses the style file troffman.sty.
Produce twoside page style.
Use a font size of npt. The default font size is 12pt for -man and 11pt otherwise.
-s style
Use the style file style instead of the default article.sty.
-o outfile
Write output to file outfile.


Many of these bugs are harmless. Most of them cause local errors that can be fixed in the converted manuscript.

- Some macros and macro arguments are not recognized.

- Commands that are not separated from their argument by a space are not properly parsed (e.g .sp3i).

- When some operators (notably over, sub and sup) are renamed (via define), then they are encountered in the text, tr2latex will treat them as ordinary macros and will not apply their rules.

- rpile, lpile and cpile are treated the same as cpile.

- rcol, lcol are treated the same as ccol.

- Math-mode size, gsize, fat, and gfont are ignored.

- lineup and mark are ignored. The rules are so different.

- Some troff commands are translated to commands that require delimiters that have to be explicitly put. Since they are sometimes not put in troff, they can create problems. Example: .nf not closed by .fi.

- When local motions are converted to \raise or \lower, an \hbox is needed, which has to be put manually after the conversion.

- ’a sub i sub j’ is converted to ’a_i_j’ which TeX parses as ’a_i{}_j}’ with a complaint that it is vague. ’a sub {i sub j}’ is parsed correctly and converted to ’a_{i_j}’.

- Line spacing is not changed within a paragraph in TeX (which is a bad practice anyway). TeX uses the last line spacing in effect in that paragraph.


Access registers via .nr command.




Kamal Al-Yahya, Stanford University
Christian Engel, Aachen University of Technology

Table of Contents