views:

395

answers:

1

Consider a *NIX executable, dvi2rtf, whose contents are:

#!/bin/sh
TMPX=`mktemp /tmp/dvi2rtf.XXXXXX`
dvitty $1 $TMPX         # CTAN
txt2rtf $TMPX $2        # CTAN, in rtfutils

If my head is working this morning and the right executables are on the PATH, this clobbers the second argument with an rtf file whose text contents will roughly correspond to those of the dvi file named by the first argument.

Such a program doesn't deserve the filename dvi2rtf, since it makes no attempt to preserve the formatting of the dvi file; Cf. Q#1621885: How to turn a dvi to tex. Rtf's \wpsp can allow rtf to handle horizontal space similarly to dvi; rtf's notion of code pages is similar to how dvi handles fonts: maybe it is possible to handle other tricky features of dvi, such as vertical space?

QUESTION: Is there such a worthy program, however flaky? And if not, is there useful prior art for implementing it?

Postscript edited, retagged

+1  A: 

The main problems that need solving seem to be solved in Richard M's answer to my question Laying out Graphics in RTF (1):

  1. Mapping dvi fonts to RTF fonts - seems to need the mapping worked out by hand, can specify using \deff directives
  2. Positioning RTF boxes - can be handled by \pvpg and \phpg directives, per (1);
  3. Rules - can be handled by \dprect directives, per (1);
  4. New page can be forced using \page.

So this seems to be implementable.

Links

  1. DVI spec
  2. RTF 1.5 spec
Charles Stewart