[comp.text] nroff/troff to TeX/LaTex translator

intern@dasys1.UUCP (intern ) (01/12/89)

Is there a troff/nroff to TeX/LaTeX translator? I have a few *roff
documents that I would like to convert to LaTeX, but doing this manually
proved to be a monumental task.
	Thanks,

debra@alice.UUCP (Paul De Bra) (01/13/89)

In article <8248@dasys1.UUCP> intern@dasys1.UUCP (intern ) writes:
>Is there a troff/nroff to TeX/LaTeX translator? I have a few *roff
>documents that I would like to convert to LaTeX, but doing this manually
>proved to be a monumental task.
>	Thanks,

I don't think this exists. Translating a small part of troff may be
feasible, but troff has many very odd commands (often used in common
macro packages!) that are very hard or impossible to translate.

A few examples:
.cs uses constant character spacing for possibly non-constant-width fonts.
.wh sets a trap at a given vertical position on the page, so whenever the
    output reaches that point some macro is called. This is impossible in
    Tex, as the vertical position of output text is unknown until Tex
    decides where to break a page and how much to stretch or shrink the
    text vertically.
.tr replace some characters by others on OUTPUT. so different widths are
    used when calculating linebreaks.
hp  register containing the horizontal place on INPUT line.
nl  vertical positions of last printed text base-line. again impossible in
    Tex as vertical positions are unknow while composing a page.
.k  horizontal size of the text portion of the current, partially-collected
    OUTPUT line. This is again an alian concept in Tex, because paragraphs
    are not build the same way as in troff. (I believe this .k register
    silently stopt producing any useful information in ditroff, so the
    old troff and ditroff are NOT 100% compatible, in spite of various
    claims)

I honestly believe that a troff output to dvi converter would be easier
if all you want is to print your old documents.

Paul.
-- 
------------------------------------------------------
|debra@research.att.com   | uunet!research!debra     |
------------------------------------------------------

david@indetech.UUCP (David Kuder) (01/15/89)

In article <8248@dasys1.UUCP> intern@dasys1.UUCP (intern ) writes:
>Is there a troff/nroff to TeX/LaTeX translator? I have a few *roff
>documents that I would like to convert to LaTeX, but doing this manually
>proved to be a monumental task.
>	Thanks,

In comp.sources.unix Volume 10, Number 32 there is a package called
tr2latex written by Kamal Al-Yahya <kamal@hanauma.stanford.edu>. To quote
the introduction to shar:
	This program translates troff documents to latex.  You will 
	notice that the translation is not always 100%, but it relieves 
	one from manual translation, where the user might need to touch
	up on the translated document to customize the translation.
I haven't used this extensively so I don't know how effective it is.

This does however, contradict Paul De Bra who writes in <8738@alice.UUCP>:
>I don't think this exists. Translating a small part of troff may be
>feasible, but troff has many very odd commands (often used in common
>macro packages!) that are very hard or impossible to translate.
-- 
____*_  David A. Kuder              {sun,sharkey,pacbell}!indetech!david
\  / /  Independence Technologies
 \/ /   42705 Lawrence Place        FAX: 415 438-2034
  \/    Fremont, CA 94538           Voice: 415 438-2003

intern@dasys1.UUCP (intern ) (01/16/89)

In article <8738@alice.UUCP> debra@alice.UUCP () writes:
>I honestly believe that a troff output to dvi converter would be easier
>if all you want is to print your old documents.
>
>Paul.
>|debra@research.att.com   | uunet!research!debra     |

Thanks, Paul for your response.  Where would I be able to obtain
a troff --> dvi converter?

	Thanks,
		- Steve -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve Faiwiszewski	bang   :  {sun!hoptoad , cmcl2!phri} !dasys1!intern 
			domain : intern@dasys1.UUCP
	    Help save a tree: Print on both sides of the paper
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Steve Faiwiszewski	bang   :  {sun!hoptoad , cmcl2!phri} !dasys1!intern 
			domain : intern@dasys1.UUCP
	    Help save a tree: Print on both sides of the paper

debra@alice.UUCP (Paul De Bra) (01/16/89)

In article <1243@indetech.UUCP> david@emerald.UUCP (David Kuder) writes:
>In article <8248@dasys1.UUCP> intern@dasys1.UUCP (intern ) writes:
>>Is there a troff/nroff to TeX/LaTeX translator? I have a few *roff
>>>...
>In comp.sources.unix Volume 10, Number 32 there is a package called
>tr2latex written by Kamal Al-Yahya <kamal@hanauma.stanford.edu>. To quote
>the introduction to shar:
>	This program translates troff documents to latex.  You will 
>	notice that the translation is not always 100%, but it relieves 
>	one from manual translation, where the user might need to touch
>	up on the translated document to customize the translation.
>I haven't used this extensively so I don't know how effective it is.
>
>This does however, contradict Paul De Bra who writes in <8738@alice.UUCP>:
>>I don't think this exists. Translating a small part of troff may be
>>feasible, but troff has many very odd commands (often used in common
>>macro packages!) that are very hard or impossible to translate.

Oops, didn't look in the sources list... I'll request tr2latex and check
it out.  Even if it only translates 20% of troff correctly it could be very
useful as most normal documents only use about 10% of troff. However,
I would be supersurprised if tr2latex could produce a decent latex file
from the troff that is generated by monk, tbl, eqn, pic, and other
preprocessors.

If tr2latex does what the introduction to the shar file says it should
generate awful latex input since it won't know what should be in math
mode, it won't know what will be a table or a picture, or something else
that is special. However, maybe it does NOT translate troff documents
to latex but rather tbl, eqn, pic, MM, MS, and other stuff (including a
little bit of troff maybe), and that is much more feasible, but is not
what the original poster asked for. Can anyone with some experience on
tr2latex comment?

Paul.
-- 
------------------------------------------------------
|debra@research.att.com   | uunet!research!debra     |
------------------------------------------------------

hartl@lan.informatik.tu-muenchen.dbp.de (Anton Hartl) (01/16/89)

In article <1243@indetech.UUCP> david@emerald.UUCP (David Kuder) writes:
>In article <8248@dasys1.UUCP> intern@dasys1.UUCP (intern ) writes:
>>Is there a troff/nroff to TeX/LaTeX translator? I have a few *roff
>>documents that I would like to convert to LaTeX, but doing this manually
>>proved to be a monumental task.
>>	Thanks,
>
>In comp.sources.unix Volume 10, Number 32 there is a package called
>tr2latex written by Kamal Al-Yahya <kamal@hanauma.stanford.edu>. To quote
... the manual page:
     Tr2tex 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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anton Hartl 	Domain: hartl@tumult.informatik.tu-muenchen.de
		Bang:   ...!{uunet,mcvax}!unido!tumult!hartl
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Only those who attempt the absurd will achieve the impossible.

cudcv@warwick.ac.uk (Rob McMahon) (01/17/89)

In article <8765@alice.UUCP> debra@alice.UUCP () writes:
>However, I would be supersurprised if tr2latex could produce a decent latex
>file from the troff that is generated by monk, tbl, eqn, pic, and other
>preprocessors.

Just a little question ... can someone tell me what `monk' is ?

Thanks, Rob.
-- 
UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England

iwm@ic.ac.uk (Ian Moor) (01/18/89)

Paul De Bra says:
>If tr2latex does what the introduction to the shar file says it should
>generate awful latex input since it won't know what should be in math
>mode, it won't know what will be a table or a picture, or something else
>that is special. However, maybe it does NOT translate troff documents
>to latex but rather tbl, eqn, pic, MM, MS, and other stuff (including a
>little bit of troff maybe), and that is much more feasible, but is not
>what the original poster asked for. Can anyone with some experience on
>tr2latex comment?

I assume you mean tr2tex that was posted a while back. I use it now and
then, it handles MS and manual page macros (MM ?) and copes with some 
troff -- I dont know much troff to be able to tell which is which. It does
math mode and simple tables. It puts commented out copies of the commands
that it cannot cope with in the output so that you can hand translate them. 

I have got good results from translating man pages and documents written using
ms macros. The only real complain I have is that the error messages dont have
line numbers, -- it says `cant translate command foo' and I have to search the 
file for foo.

How many people write documents in their own macros or lowe level troff anyway?
 
--
Ian W Moor
  UUCP: seismo!mcvax!ukc!icdoc!iwm     
  ARPA: iwm@doc.ic.ac.uk
  JANET: iwm@uk.ac.ic.doc
           
 Department of Computing   We don't need no documentation,
 Imperial College.         We don't need no source control,
 180 Queensgate            No dark sarcasm in the boardroom,
 London SW7 UK.            Manager! leave those programmers alone!